query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
le jouer peut entrer un nombre compris entre 1 et 9, si le nombre n'est pas compris dans cet intervalle un message s'affiche demandant de redonner une valeur.
def turn puts "" puts " " * 35 + "c'est au tour à #{@current_player.name} de joué (1-9): " puts "" print " " * 40 + "> " choice = gets.chomp.to_i if choice > 9 || choice < 1 puts "Tu te trompe de touche jeune apprentie" elsif @current_player.move(choice) != false @winner = @current_player if @current_player.winner? @turn += 1 switch_player end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def starting_msg(n)\n \"#{n} bottles of beer on the wall, #{n} bottles of beer.\"\nend", "def repeat_message(n)\n\tloop do\n\t\tbefore = Time.now\n\t\tyield\n\t\tinterval = n-(Time.now-before)\n\t\tsleep(interval) if interval > 0\n\tend\nend", "def get_message(num)\n\n case num\n when 1\n message = \"Your numerology number is #{num}.\\nOne is the leader. The number one indicates the ability to stand alone, and is a strong vibration. Ruled by the Sun.\"\n when 2\n message = \"Your numerology number is #{num}.\\nThis is the mediator and peace-lover. The number two indicates the desire for harmony. It is a gentle, considerate, and sensitive vibration. Ruled by the Moon.\"\n when 3\n message = \"Your numerology number is #{num}.\\nNumber Three is a sociable, friendly, and outgoing vibration. Kind, positive, and optimistic, Three's enjoy life and have a good sense of humor. Ruled by Jupiter.\"\n when 4\n message = \"Your numerology number is #{num}.\\nThis is the worker. Practical, with a love of detail, Fours are trustworthy, hard-working, and helpful. Ruled by Uranus.\"\n when 5\n message = \"Your numerology number is #{num}.\\nThis is the freedom lover. The number five is an intellectual vibration. These are 'idea' people with a love of variety and the ability to adapt to most situations. Ruled by Mercury.\"\n when 6\n message = \"Your numerology number is #{num}.\\nThis is the peace lover. The number six is a loving, stable, and harmonious vibration. Ruled by Venus.\"\n when 7\n message = \"Your numerology number is #{num}.\\nThis is the deep thinker. The number seven is a spiritual vibration. These people are not very attached to material things, are introspective, and generally quiet. Ruled by Neptune.\"\n when 8\n message = \"Your numerology number is #{num}.\\nThis is the manager. Number Eight is a strong, successful, and material vibration. Ruled by Saturn.\"\n when 9\n message = \"Your numerology number is #{num}.\\nThis is the teacher. Number Nine is a tolerant, somewhat impractical, and sympathetic vibration. Ruled by Mars.\"\n end\nend", "def style_notif_count(num)\n\t return \"\" if !num.is_a? Integer\n\t return \"font-size:5px;\" if num > 99\n\t return \"font-size:10px;\" if num > 9\n\tend", "def repeat(message, num = 1)\n message * num\nend", "def como_metodos_sin_nombre\n 5.times do\n puts \"Soy un bloque de codigo y no una funcion\"\n end\nend", "def print_changing_numbers\n\t\ti = 1\n\t\t#zolang i kleiner is dan 11\n\t\twhile i < 11\n\t\t\t#print de string met het nummer variabele en verhoog het daarna met 1\n\t\t\tputs \"This sentence is number #{i}\"\n\t\t\ti = i+1\n\t\tend\n\tend", "def increase_new_chat_notifications\n increment!(:new_chat_notification)\n end", "def get_message(birth_num)\n case birth_num\n when 1\n message = \"Your numerology number is #{birth_num}.\\nOne is the leader. The number one indicates the ability to stand alone, and is a strong vibration. Ruled by the Sun.\"\n when 2\n message = \"Your numerology number is #{birth_num}.\\nThis is the mediator and peace-lover. The number two indicates the desire for harmony. It is a gentle, considerate, and sensitive vibration. Ruled by the Moon.\"\n when 3\n message = \"Your numerology number is #{birth_num}.\\nNumber Three is a sociable, friendly, and outgoing vibration. Kind, positive, and optimistic, Three's enjoy life and have a good sense of humor. Ruled by Jupiter.\"\n when 4\n message = \"Your numerology number is #{birth_num}.\\nThis is the worker. Practical, with a love of detail, Fours are trustworthy, hard-working, and helpful. Ruled by Uranus.\"\n when 5\n message = \"Your numerology number is #{birth_num}.\\nThis is the freedom lover. The number five is an intellectual vibration. These are 'idea' people with a love of variety and the ability to adapt to most situations. Ruled by Mercury.\"\n when 6\n message = \"Your numerology number is #{birth_num}.\\nThis is the peace lover. The number six is a loving, stable, and harmonious vibration. Ruled by Venus.\"\n when 7\n message = \"Your numerology number is #{birth_num}.\\nThis is the deep thinker. The number seven is a spiritual vibration. These people are not very attached to material things, are introspective, and generally quiet. Ruled by Neptune.\"\n when 8\n message = \"Your numerology number is #{birth_num}.\\nThis is the manager. Number Eight is a strong, successful, and material vibration. Ruled by Saturn.\"\n when 9\n message = \"Your numerology number is #{birth_num}.\\nThis is the teacher. Number Nine is a tolerant, somewhat impractical, and sympathetic vibration. Ruled by Mars.\"\n else\n message = \"I am pretty sure that you were not born on the leap year date, because you should still get a Numerology number. Either you entered your birthddate in the incorrect format or you are not originally from Earth, you should have a number between 1-9.\"\n end\nend", "def give_message(num)\n\ncase num \nwhen 1 \n message = \"\\nYour numerology number is #{num}.\\nOne is the leader. The number one indicates the ability to stand alone, and is a strong vibration. Ruled by the Sun.\"\nwhen 2\n message = \"\\nYour numerology number is #{num}.\\nThis is the mediator and peace-lover. The number two indicates the desire for harmony. It is a gentle, considerate, and sensitive vibration. Ruled by the Moon.\"\nwhen 3\n message = \"\\nYour numerology number is #{num}.\\nNumber Three is a sociable, friendly, and outgoing vibration. Kind, positive, and optimistic, Three's enjoy life and have a good sense of humor. Ruled by Jupiter.\"\nwhen 4\n message = \"\\nYour numerology number is #{num}.\\nThis is the worker. Practical, with a love of detail, Fours are trustworthy, hard-working, and helpful. Ruled by Uranus.\"\nwhen 5\n message = \"\\nYour numerology number is #{num}.\\nThis is the freedom lover. The number five is an intellectual vibration. These are 'idea' people with a love of variety and the ability to adapt to most situations. Ruled by Mercury.\"\nwhen 6\n message = \"\\nYour numerology number is #{num}.\\nThis is the peace lover. The number six is a loving, stable, and harmonious vibration. Ruled by Venus.\"\nwhen 7\n message = \"\\nYour numerology number is #{num}.\\nThis is the deep thinker. The number seven is a spiritual vibration. These people are not very attached to material things, are introspective, and generally quiet. Ruled by Neptune.\"\nwhen 8\n message = \"\\nYour numerology number is #{num}.\\nThis is the manager. Number Eight is a strong, successful, and material vibration. Ruled by Saturn.\"\nwhen 9\n message = \"\\nYour numerology number is #{num}.\\nThis is the teacher. Number Nine is a tolerant, somewhat impractical, and sympathetic vibration. Ruled by Mars.\"\nelse\n message = \"\\nRuh row! Your birth path number is not 1-9; someone needs to check this code!\"\nend\nend", "def repeat(msg, repeat_count = 2)\n result = msg;\n i = repeat_count;\n\n while (i > 1) do\n result = (result + \" \" + msg);\n i = (i - 1);\n end\n\n return result;\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 redmine_counter_delete(m, params)\n begin\n \tcertificate = redmine_check_auth(m)\n\t\tif ! certificate\n\t\t\t# ne rien faire, l'utilisateur n'est pas connecté\n\t\telse\n\t\t\tif params[:othername]\n\t\t\t\tuser_login = params[:othername]\n\t\t\telse\n\t\t\t\tuser_login = certificate[:username]\n\t\t\tend\n\t\t\tif @registry.has_key? user_login\n\t\t\t\t# j'affiche un message listant tous les temps effacés\n\t\t\t\t@registry[user_login].each do |task_logger|\n\t\t\t\t\t\tif (task_logger.inprogress == \"pause\")\n\t\t\t\t\t\t\t# preparation du paramètre durée de tache\n\t\t\t\t\t\t\tgap = task_logger.alreadydone.to_i\n\t\t\t\t\t\t\thours = gap/3600.to_i\n\t\t\t\t\t\t\tmins = ( gap/60 % 60 ).to_i\n\t\t\t\t\t\t\tsecs = ( gap % 60 )\n\t\t\t\t\t\t\treal_hours = ( task_logger.alreadydone )/3600\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tgap = ( Time.now - task_logger.time ).to_i + task_logger.alreadydone.to_i\n\t\t\t\t\t\t\thours = gap/3600.to_i\n\t\t\t\t\t\t\tmins = ( gap/60 % 60 ).to_i\n\t\t\t\t\t\t\tsecs = ( gap % 60 )\n\t\t\t\t\t\t\treal_hours = ( Time.now - task_logger.time )/3600\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# affichage d'un message\n\t\t\t\t\t\tm.reply \"#{@redmine_l_timesavedforthistask} ##{task_logger.task}[#{task_logger.time.strftime('%H:%M')}]; #{@redmine_l_were} : #{hours}h #{mins}min, #{secs}secs\"\n\t\t\t\tend\n\t\t\t\t# on indique à l'utilisateur\n\t\t\t\t@bot.say m.replyto, \"#{certificate[:username]}, #{@redmine_l_ijusterasedthishoursdontforgettoreportit}.\"\n\t\t\t\t# on efface la tache enregistrée\n\t\t\t\t@registry.delete user_login\n\t\t\telse\n\t\t\t\tm.reply \"#{@redmine_l_notaskrunning}\"\n\t\t\tend\n\t\tend\n rescue Exception => e\n m.reply e.message\n m.reply e.backtrace.inspect\n end\n end", "def mostrar_mensaje(mensaje)\n\tputs \"-\" * 100\n\tputs mensaje\n\tputs \"-\" * 100\nend", "def loop_message_n_times(message, number)\n count = 0\n while count < number do\n puts message\n count += 1\n end\nend", "def repeat(message, num_repeats=2)\n\tret = \"\"\n\tnum_repeats.times do |i|\t\t\n\t\tret << message + \" \"\n\tend\n\n\t#removes trailing space\n\tret[0..-2]\nend", "def define_num\n self.num ||= from.new_num_message\n end", "def loop_message_n_times(message, number)\n number.times {puts message}\nend", "def test_generate_message_greater_than_with_default_message\n assert_equal \"must be greater than 10\", @person.errors.generate_message(:title, :greater_than, value: \"title\", count: 10)\n end", "def seleccion_jugada()\n # Suma de todas las frecuencias \n total_frecuencias = -1\n @frecuencia_jugadas.each_value do |valor|\n total_frecuencias += valor \n end\n \n # Este bloque me permite saber si todas las frecuencias estan en 0 (Inicio del juego)\n # Si es asi el numero_aleatorio sera 0\n numero_aleatorio = $r.rand(0..total_frecuencias)\n\n # Calculo de rango para cada una de las jugadas\n frecuencia_piedra = @frecuencia_jugadas[\"Piedra\"]\n frecuencia_papel = frecuencia_piedra + @frecuencia_jugadas[\"Papel\"]\n frecuencia_tijera = frecuencia_papel + @frecuencia_jugadas[\"Tijera\"]\n frecuencia_lagarto = frecuencia_tijera + @frecuencia_jugadas[\"Lagarto\"]\n frecuencia_spock = frecuencia_lagarto + @frecuencia_jugadas[\"Spock\"]\n\n\n # Bloque case para cada uno de los rangos \n case numero_aleatorio\n when 0 .. (frecuencia_piedra - 1)\n return Jugada.new(\"Piedra\")\n when frecuencia_piedra .. (frecuencia_papel - 1)\n return Jugada.new(\"Papel\")\n when frecuencia_papel .. (frecuencia_tijera - 1)\n return Jugada.new(\"Tijera\")\n when frecuencia_tijera .. (frecuencia_lagarto - 1)\n return Jugada.new(\"Lagarto\")\n when frecuencia_lagarto .. (frecuencia_spock - 1)\n return Jugada.new(\"Spock\") \n end\n\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 time_notification\n \"You have #{@time_to_answer / 60} min #{@time_to_answer % 60} sec left\"\n end", "def next_message_id\n if not @message_id\n @message_id = 1\n else\n @message_id += 1\n end\n\n @message_id < (1 << (4*8)) ? @message_id : (@message_id = 1)\n end", "def add_countup(name, seconds, notify_frequency = nil)\n @timers[name] = Timer.new(name, Timer::COUNTUP, seconds, notify_frequency) {|timer| @game_object.notify :timer_tick, timer }\n end", "def get_message(number)\n\tcase number\n\twhen 1\n\t\t@message = \"One is the leader. The number one indicates the ability to stand alone and is a strong vibration. Ruled by the Sun.\"\n\twhen 2\n\t\t@message = \"Two is the mediator and peace-lover. The number two indicates the desire for harmony. It is a gentle, considerate, and sensitive vibration. Ruled by the Moon.\"\n\twhen 3\n\t\t@message = \"Three is a sociable, friendly, and outgoing vibration. Kind, positive, and optimistic. Three's enjoy life and have a good sense of humor.\"\n\twhen 4\n\t\t@message = \"This is the worker. Practical, with a love for detail, Fours are trustworthy, hard-working, and helpful. Ruled by Youranus.\"\n\twhen 5\n\t\t@message = \"This is the freedom lover. The number five is an intellectual vibration. These are \\\"idea\\\" people with a love of variety and the ability to adapt to most situations. Ruled by Mercury.\"\n\twhen 6\n\t\t@message = \"This is the peace lover. The number six is a loving, stable, and harmonious vibration. Ruled by Venus.\"\n\twhen 7\n\t\t@message = \"This is the deep thinker. The number seven is a spiritual vibration. These people are not very attached to material things, are introspective, and generally quiet. Ruled by Neptune.\"\n\twhen 8\n\t\t@message = \"This is the manager. Number Eight is a strong, successful, and material vibration. Ruled by Saturn.\"\n\twhen 9\n\t\t@message = \"This is the teacher. Number Nine is a tolerant, somewhat impractical, and sympathetic vibration. Ruled by Mars.\"\n\telse\n\t\t@message = \"Uh oh! Your birth path number is not 1-9!\"\n\tend\nend", "def set_number\n self.number = self.application.chat_count + 1\n end", "def get_message(birth_number)\n \n case birth_number\n when 1\n message = \"You're #{birth_number}. \\nThe Sun!\"\n when 2\n message = \"You're #{birth_number}. \\nThe Moon!\"\n when 3\n message = \"You're #{birth_number}. \\nThe Jupiter!\"\n when 4\n message = \"You're #{birth_number}. \\nThe Uranus!\"\n when 5\n message = \"You're #{birth_number}. \\nThe Mercury!\"\n when 6\n message = \"You're #{birth_number}. \\nThe Venus!\"\n when 7\n message = \"You're #{birth_number}. \\nThe Neptune!\"\n when 8\n message = \"You're #{birth_number}. \\nThe Saturn!\"\n when 9\n message = \"You're #{birth_number}. \\nThe Mars!\"\n else\n message = \"Oh my!, were you even born?\"\n end\nend", "def loop_message_five_times(message)\n 5.times {puts message}\nend", "def remove_old(n=1)\n n.times {@msgs.shift}\n @msgs.count\n end", "def remove_old(n=1)\n n.times {@msgs.shift}\n @msgs.count\n end", "def test_generate_message_too_short_with_default_message_plural\n assert_equal \"is too short (minimum is 10 characters)\", @person.errors.generate_message(:title, :too_short, count: 10)\n end", "def test_generate_message_too_long_with_default_message_plural\n assert_equal \"is too long (maximum is 10 characters)\", @person.errors.generate_message(:title, :too_long, count: 10)\n end", "def random_number(msg)\n return if Variables::Constants::IGNORED_USERS.include?(msg.user.nick)\n random_number_max(msg, 100)\n end", "def message_speed=(value)\n @message_speed = value.clamp(1, 999)\n end", "def get_message(birth_path_num)\n case birth_path_num\n when 1\n message = \"Your numerology number is #{birth_path_num}.\\nOne is the leader. The number one indicates the ability to stand alone, and is a strong vibration. Ruled by the Sun.\"\n when 2\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the mediator and peace-lover. The number two indicates the desire for harmony. It is a gentle, considerate, and sensitive vibration. Ruled by the Moon.\"\n when 3\n message = \"Your numerology number is #{birth_path_num}.\\nNumber Three is a sociable, friendly, and outgoing vibration. Kind, positive, and optimistic, Three's enjoy life and have a good sense of humor. Ruled by Jupiter.\"\n when 4\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the worker. Practical, with a love of detail, Fours are trustworthy, hard-working, and helpful. Ruled by Uranus.\"\n when 5\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the freedom lover. The number five is an intellectual vibration. These are 'idea' people with a love of variety and the ability to adapt to most situations. Ruled by Mercury.\"\n when 6\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the peace lover. The number six is a loving, stable, and harmonious vibration. Ruled by Venus.\"\n when 7\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the deep thinker. The number seven is a spiritual vibration. These people are not very attached to material things, are introspective, and generally quiet. Ruled by Neptune.\"\n when 8\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the manager. Number Eight is a strong, successful, and material vibration. Ruled by Saturn.\"\n when 9\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the teacher. Number Nine is a tolerant, somewhat impractical, and sympathetic vibration. Ruled by Mars.\"\n else\n message = \"Uh oh! Your birth path number is not 1-9!\"\n end #birth_path_num case\nend", "def chronometer(seconds)\n last_tick = Time.now\n yield\n loop do\n sleep 0.1\n if Time.now - last_tick >= seconds\n last_tick += seconds\n yield\n end\n end\n end", "def combien_handle_numero(journaliste)\n \tcount = 0\n \tjournaliste.each do |numero|\n \t\tif numero.match(/[0-9]/)\n \t\tcount +=1\n \tend\nend\n \tputs \"Reponse : \"\n \tputs \"Il y en a #{count}\"\n \tputs \" \"\n \nend", "def repeat(message, times)\n\tcounter = 1\n\twhile counter <= times\n\t\tputs message\n\t\tcounter += 1\n\tend\nend", "def end_message(number, days, real, fake)\n raise 'Not an integer' unless real.is_a? Integer\n raise 'Not an integer' unless fake.is_a? Integer\n raise 'Not an integer' unless days.is_a? Integer\n raise 'Not an integer' unless number.is_a? Integer\n raise 'Not an integer' unless real >= 0 && fake >= 0 && number >= 0 && days >= 0\n\n # Ending message to display which Rubyist return with how many real/fake\n puts \"After #{days} days, Rubyist ##{number} found:\"\n puts \"\\t#{real} rubies.\" # How many real rubies the Rubyist got\n puts \"\\t#{fake} fake rubies.\" # How many fake rubies the Rubyist got\n if real >= 10\n puts \"Going home victorious!\\n\" \n elsif real >= 1 && real <= 9\n puts \"Going home sad.\\n\" \n else\n puts \"Going home empty-handed.\\n\"\n end\n end", "def recolectar_una\n\t\test = \"\"\n\t\tif @estado == ESTADO::MUERTE\n\t\t\test = \"El árbol está muerto\"\n\t\telse\n\t\t\tif @contador == 0\n\t\t\t\test = \"No hay más naranjas\"\n\t\t\telse\n\t\t\t\test = \"La naranja estaba deliciosa\"\n\t\t\t\t@contador -= 1\n\t\t\tend\n\t\tend\n\t\test\n\tend", "def set_progress_msg(word)\n @progress_message = (\"-\" * word.length)\n @progress_message\nend", "def mills_mess\n if @count_of_presses == 1\n press = Press.new\n press << @jobs\n @distribution << press.jobs\n @time_required = press.time\n return\n end\n\n @presses = Array.new(@count_of_presses) { Press.new }\n\n @presses.min << @jobs.pop until @jobs.empty? \n\n\n end", "def next_message_id\n if max_message_id = redis.get('max_message_id')\n next_id = max_message_id.to_i + 1\n else\n next_id = 1\n end\n\n redis.set('max_message_id', next_id)\n next_id\n end", "def increment_listened_times\n increment(:listened_times)\n end", "def warn_if_char_count_exceeded(field_id, update_id, maximum_number_of_chars, options = {})\n\t #First attempt - Simple Counter\n\t #var field_id => Conteúdo escrito até agora.\n\t #var update_id => campo que mostra qtos caracteres faltam para atingir o max.\n\t \n\t \n\t #.innerHTML actualiza o contador (char_count_out_id no app/views/shared/_micropost_form.html.erb) com o número de caracteres \n\t #que ainda faltam para os 140.\n #innerHTML -> By manipulating an element's innerHtml you'll be able to change the contents of an HTML element.\n\t \n\t # javascript_tag() -> Returns a JavaScript tag with the content inside.\n # O que se esta aqui a fazer é a correr a função dentro de um Script. \n # O número de caracteres que ainda faltam para atingir o maximo ou o número de carateres em excesso é colocado na var out.\n \n #A linha observe_field é reponsável pela actualização em real time do número de caracteres em falta ou em excesso.\n\n\t \n function = \"var out = []; \n var remaining_chars = $(#{maximum_number_of_chars}) - $F('#{field_id}').length; \n \n if (remaining_chars >= 0) { \n out = remaining_chars; \n document.getElementById('#{field_id}').style.backgroundColor='white' \n } \n else { \n out = 'Too long by ' + remaining_chars; \n document.getElementById('#{field_id}').style.backgroundColor='red' \n }\n $('#{update_id}').innerHTML = out;\"\n\n out = javascript_tag(function)\n out += observe_field(field_id, options.merge(:function => function))\n\tend", "def first_message_number\n @first_message_index < 0 ? @messages.length + @first_message_index : @first_message_index\n end", "def check\n nbErreur = @grid.check\n if(nbErreur > 0)\n @chrono.addTime(10)\n end\n return nbErreur\n end", "def joga nome, dificuldade\n\tnumero_secreto = sortea_numero_secreto dificuldade\n\tpontos_ate_agora = 1000\n\tlimite_tentativas = 5\n\tchutes = []\n\ttentativa = 1\n\n\tfor tentativa in 1..limite_tentativas\n\t\t\n\t\tchute = pede_numero_jogador chutes, tentativa,\n\t\t\tlimite_tentativas\n\n\t\tchutes << chute\t\n\t\n\t\tif nome == \"Vinicius\"\n\t\t\tputs \"Acertou em cheio meu camarada.\"\n\t\t\tbreak\n\t\tend\n\n\t\tpontos_a_perder = (chute - numero_secreto).abs / 2.0\n\t\tpontos_ate_agora -= pontos_a_perder\n\n\t\tvitoria = verifica_se_acertou numero_secreto, chute\n\n\t\tbreak if vitoria\n\n\t\tif tentativa == 5\n\t\t\tif perdeu_por_um numero_secreto, chute\n\t\t\t\ttentativa += 1\n\t\t\t\tlimite_tentativas += 1\n\t\t\t\tchute = pede_numero_jogador chutes, tentativa, limite_tentativas\n\t\t\t\tvitoria = verifica_se_acertou numero_secreto, chute\n\t\t\t\tbreak if vitoria\n\t\t\tend\n\t\tend\n\tend\n\n\tputs \"Você ganhou #{pontos_ate_agora} pontos\"\n\tvitoria\nend", "def meter_maid_check\n if minutes_remaining < 0\n fine = minutes_remaining * -3\n \"Bummer! You got a $#{fine} ticket.\"\n else\n 'The meter maid came and went.'\n end\n end", "def interval\n (self['resque.interval'] || 5).to_i\n end", "def mensaje_error(mensaje)\n\t\tmostrar_mensaje 31, mensaje\n\tend", "def message_count\n 0\n end", "def get_message(numerology)\n\n\tcase numerology\n\n\twhen 1\n\t\tmessage = \"One is the leader. The number one indicates the ability to stand alone, and is a strong vibration. Ruled by the Sun.\\n\\n\"\n\twhen 2\n\t\tmessage =\"This is the mediator and peace-lover. The number two indicates the desire for harmony. It is a gentle, considerate, and sensitive vibration. Ruled by the Moon.\\n\\n\"\n\twhen 3\n\t\tmessage =\"Number Three is a sociable, friendly, and outgoing vibration. Kind, positive, and optimistic, Three’s enjoy life and have a good sense of humor. Ruled by Jupiter.\\n\\n\"\n\twhen 4\n\t\tmessage =\"This is the worker. Practical, with a love of detail, Fours are trustworthy, hard-working, and helpful. Ruled by Uranus.\\n\\n\"\n\twhen 5\n\t\tmessage =\"This is the freedom lover. The number five is an intellectual vibration. These are ‘idea’ people with a love of variety and the ability to adapt to most situations. Ruled by Mercury.\\n\\n\"\n\twhen 6\n\t\tmessage =\"This is the peace lover. The number six is a loving, stable, and harmonious vibration. Ruled by Venus.\\n\\n`\"\n\twhen 7\n\t\tmessage =\"This is the deep thinker. The number seven is a spiritual vibration. These people are not very attached to material things, are introspective, and generally quiet. Ruled by Neptune.\\n\\n\"\n\twhen 8\n\t\tmessage =\"This is the manager. Number Eight is a strong, successful, and material vibration. Ruled by Saturn.\\n\\n\"\n\twhen 9 \n\t\tmessage =\"This is the teacher. Number Nine is a tolerant, somewhat impractical, and sympathetic vibration. Ruled by Mars.\\n\\n\"\n\n\telse\n\t\tmessage =\"You were born at the wrong time...\\n\\n\"\n\n\tend\nend", "def send_text\n @number_list.each do |number|\n # clock = Alarm.new(2014, 07, 17, 11, 38, 40)\n puts Time.now\n account_sid = 'ACe330ba04d082392df4cb3511dcb72cec'\n auth_token = '2008ea097713e401a16c54029058da82'\n @client = Twilio::REST::Client.new account_sid, auth_token\n # until Time.now > clock.time\n # puts \"It's not time!\"\n # sleep (5)\n # end\n @client.account.messages.create(\n :from => '+18152642023',\n :to => number,\n :body => @body\n )\n end\n end", "def loop_message_five_times(mssg)\n count = 0\n while count < 5 do\n puts mssg\n count += 1\n end\nend", "def countdown_display_before_restart_in_minutes=(value)\n @countdown_display_before_restart_in_minutes = value\n end", "def jumping_jacks(number, energy)\n count = 0\n while count < number\n if energy >= 15\n count += 1\n energy -= 15\n puts \"Did #{count} jumping jacks, you have #{energy} energy left.\"\n else\n puts \"Waiting, #{energy} energy left.\"\n energy += 5\n end\n end\nend", "def countdown(seconds)\n seconds.downto(0).each do |remaining|\n if remaining <= 5\n puts \" #{remaining} \" if @verbose\n elsif remaining % 60 == 0\n minutes = remaining / 60\n puts \"Retrying in #{minutes} minutes...\" if @verbose\n end\n sleep 1\n end\n end", "def nombre_comun_a_id_referencia(num_nombre)\n # El 9 inicial es apra identificarlo, despues se forza el ID a 6 digitos y el numero de nombre comun a 2 digitos\n \"1#{id.to_s.rjust(6,'0')}#{num_nombre.to_s.rjust(3,'0')}\".to_i\n end", "def o_ucount_notify\n User.bot.lobby_speak(\"#{linked_name}さんが本日#{today_total_o_ucount}問解きました\")\n end", "def formata_numero number, opts={}\n number = number.to_s\n opts = { loop: 10, insert: :\"0\" }.merge opts\n # remove as virgulas e pontos caso seja um valor de dinheiro\n number.gsub! /[,\\.\\ ]/ , ''\n (opts[:loop] - number.length).times { number = \"#{opts[:insert]}#{number}\" }\n number\n end", "def format_countdown(seconds)\n minutes = (seconds / 60).to_s.rjust(2,\"0\")\n while seconds >= 60\n seconds -= 60\n end\n seconds = seconds.to_s.rjust(2,\"0\")\n\n \"#{pomodoro_status} -- #{minutes}:#{seconds}\"\n end", "def pre_schedule_message(time, message)\n assert time.is_a? Fixnum\n assert time >= 0\n assert message.is_a? String\n end", "def jeu\n marche = 1\n puts \"C'est parti, tu es sur la marche 1 et tu vas lancer ton dé\"\n while marche < 10 \n puts \"tu as lancé le dé, quel chiffre est sorti ?\"\n chiffre_de = Integer(gets.chomp)\n until chiffre_de <= 6 && chiffre_de >= 1\n puts \"Merci de rentrer un chiffre entre 0 et 6\"\n chiffre_de = Integer(gets.chomp)\n end\n marche = lancer(chiffre_de,marche)\n end\nend", "def greeting_message()\n greeting_message = case Time.now.hour\n when 6..11 then \"Buen dia\"\n when 12..20 then \"Buenas tardes\"\n else \"Buenas noches\"\n end\n end", "def imprimir_machete(rondas_del_juego = 1)\n\t\t1.upto(@cantidad_de_alumnos.*(rondas_del_juego)) do |numero|\n\t\t\tprint juzgar_numero(numero).<<(' ')\n\t\tend\n\t\tprint \"\\n\\n\"\n\tend", "def on_timer(value=1000)\n Thread.new() {\n begin\n nbtick=(value/TICK)+1\n loop do\n i=0\n sleep(TICK/1000.0) while self.connected?() && (i+=1)<nbtick\n self.connected?() ? yield() : break\n end\n rescue Exception => e\n $stdout.puts \"#{e} :\\n #{e.backtrace.join(\"\\n \")}\"\n end\n }\n end", "def validate_message(message)\n if $from == 'lending'\n value = $money == '' ? '2' : '1'\n @@xp_txt_message = \"//p[contains(@class,'validacion ingresos_mensuales')][#{value}]\"\n else\n @@xp_txt_message = $money == '' ? @@xp_txt_lower : @@xp_txt_higher\n end\n wait_displays(:xpath, @@xp_txt_message, 5)\n get_element_text(:xpath, @@xp_txt_message).should == message\n end", "def retrymsg(msgid)\n req(\"retrymsg\", \"\", \"\", msgid, \"\")\n end", "def plural_every(int, str)\r\n return \"#{int} #{str}s\" unless int == 1\r\n \"#{str}\"\r\n end", "def message(path_number)\r\n\tcase path_number\r\n\twhen 1\r\n\t\tdisplay_message = \"One is the leader. The number one indicates the ability to stand alone, and is a strong vibration. Ruled by the Sun.\"\r\n\twhen 2\r\n\t\tdisplay_message = \"This is the mediator and peace-lover. The number two indicates the desire for harmony. It is a gentle, considerate, and sensitive vibration. Ruled by the Moon.\"\r\n\twhen 3\r\n\t\tdisplay_message = \"Number Three is a sociable, friendly, and outgoing vibration. Kind, positive, and optimistic, Three’s enjoy life and have a good sense of humor. Ruled by Jupiter.\"\r\n\twhen 4\r\n\t\tdisplay_message = \"This is the worker. Practical, with a love of detail, Fours are trustworthy, hard-working, and helpful. Ruled by Uranus.\"\r\n\twhen 5\r\n\t\tdisplay_message = \"This is the freedom lover. The number five is an intellectual vibration. These are ‘idea’ people with a love of variety and the ability to adapt to most situations. Ruled by Mercury.\"\r\n\twhen 6\r\n\t\tdisplay_message = \"This is the peace lover. The number six is a loving, stable, and harmonious vibration. Ruled by Venus.\"\r\n\twhen 7\r\n\t\tdisplay_message = \"This is the deep thinker. The number seven is a spiritual vibration. These people are not very attached to material things, are introspective, and generally quiet. Ruled by Neptune.\"\r\n\twhen 8\r\n\t\tdisplay_message = \"This is the manager. Number Eight is a strong, successful, and material vibration. Ruled by Saturn.\"\r\n\twhen 9\r\n\t\tdisplay_message = \"This is the teacher. Number Nine is a tolerant, somewhat impractical, and sympathetic vibration. Ruled by Mars.\"\r\n\telse\r\n\t\tdisplay_message = \"Your numerology number is not 1 - 9\"\r\n\tend\r\nend", "def send_msgs(t)\n $groups.each { |g| $group_sent_in_btick[g] = 0 } if fmod(t, $big_tick)\n $groups.each do |g|\n $group_sent_in_tick[g] = 0\n $members[g].each do |n|\n sending_rate(g, n, t) # set the sending rate for a node in this\n $group_sent_in_btick[g] += $sent_in_tick[[g,n]]\n $group_sent_in_tick[g] += $sent_in_tick[[g,n]]\n end\n end\nend", "def bump(x)\n x.count('n') <= 15 ? \"Woohoo!\" : \"Car Dead\"\nend", "def konversiMenit(menit)\n detik = menit % 60\n menit = menit / 60\n\n detik = \"0#{detik}\" if detik < 10\n \"#{menit}:#{detik}\"\n end", "def poll_every_n_minutes(send,n=1)\n\t\t\ttimer = Timers::Group.new\n\t\t\tevery_seconds = timer.every(60*n) { poll(send) }\n\t\t\tloop { timer.wait } \n\t\tend", "def chronometerWithTemporizer(seconds, to)\n\n last_tick = Time.now\n stop = Time.now + to\n yield\n while Time.now < stop\n sleep 0.1\n if Time.now - last_tick >= seconds\n last_tick += seconds\n yield\n end\n end\n end", "def error_message_finder(name)\n if !(1..100).cover? name.size\n 'Todo name must be between 1 and 200 characters.'\n end\nend", "def pluralizer num,name\n \n if num >= 2\n p \"#{num} #{name}s.\"\n else\n p \"1 #{name}.\"\n end\nend", "def check_meter\n puts \"You have #{minutes_remaining} minutes remaining.\"\n end", "def manage_errors event, client\n\n puts \"Error Counter #{ @@error_counter }\"\n \n @@error_counter += 1\n\n if @@error_counter > 5\n client.chat_postMessage(channel: event.channel, text: \"This is really fishy now. Why are you doing this? :unamused: Please be nice or type `help` to find my commands.\", as_user: true)\n elsif @@error_counter > 2 and @@error_counter <= 4\n client.chat_postMessage(channel: event.channel, text: \"Hmmm, you seem to be different today :thinking_face:. Hope all is well. Anyways, type `help` to find my commands.\", as_user: true) \n else\n client.chat_postMessage(channel: event.channel, text: \"I didn't get that but that's alright. If you're stuck, type `help` to find my commands.\", as_user: true)\n end\n end", "def get_message(birth_path_num)\n # use a case statement to display the correct meaning\n case birth_path_num\n when 1\n message = \"Your numerology number is #{birth_path_num}.\\nOne is the leader. The number one indicates the ability to stand alone, and is a strong vibration. Ruled by the Sun.\"\n when 2\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the mediator and peace-lover. The number two indicates the desire for harmony. It is a gentle, considerate, and sensitive vibration. Ruled by the Moon.\"\n when 3\n message = \"Your numerology number is #{birth_path_num}.\\nNumber Three is a sociable, friendly, and outgoing vibration. Kind, positive, and optimistic, Three's enjoy life and have a good sense of humor. Ruled by Jupiter.\"\n when 4\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the worker. Practical, with a love of detail, Fours are trustworthy, hard-working, and helpful. Ruled by Uranus.\"\n when 5\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the freedom lover. The number five is an intellectual vibration. These are 'idea' people with a love of variety and the ability to adapt to most situations. Ruled by Mercury.\"\n when 6\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the peace lover. The number six is a loving, stable, and harmonious vibration. Ruled by Venus.\"\n when 7\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the deep thinker. The number seven is a spiritual vibration. These people are not very attached to material things, are introspective, and generally quiet. Ruled by Neptune.\"\n when 8\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the manager. Number Eight is a strong, successful, and material vibration. Ruled by Saturn.\"\n when 9\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the teacher. Number Nine is a tolerant, somewhat impractical, and sympathetic vibration. Ruled by Mars.\"\n else\n message = \"Uh oh! Your birth path number is not 1-9!\"\n end\nend", "def get_message(birth_path_num)\n # use a case statement to display the correct meaning\n case birth_path_num\n when 1\n message = \"Your numerology number is #{birth_path_num}.\\nOne is the leader. The number one indicates the ability to stand alone, and is a strong vibration. Ruled by the Sun.\"\n when 2\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the mediator and peace-lover. The number two indicates the desire for harmony. It is a gentle, considerate, and sensitive vibration. Ruled by the Moon.\"\n when 3\n message = \"Your numerology number is #{birth_path_num}.\\nNumber Three is a sociable, friendly, and outgoing vibration. Kind, positive, and optimistic, Three's enjoy life and have a good sense of humor. Ruled by Jupiter.\"\n when 4\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the worker. Practical, with a love of detail, Fours are trustworthy, hard-working, and helpful. Ruled by Uranus.\"\n when 5\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the freedom lover. The number five is an intellectual vibration. These are 'idea' people with a love of variety and the ability to adapt to most situations. Ruled by Mercury.\"\n when 6\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the peace lover. The number six is a loving, stable, and harmonious vibration. Ruled by Venus.\"\n when 7\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the deep thinker. The number seven is a spiritual vibration. These people are not very attached to material things, are introspective, and generally quiet. Ruled by Neptune.\"\n when 8\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the manager. Number Eight is a strong, successful, and material vibration. Ruled by Saturn.\"\n when 9\n message = \"Your numerology number is #{birth_path_num}.\\nThis is the teacher. Number Nine is a tolerant, somewhat impractical, and sympathetic vibration. Ruled by Mars.\"\n else\n message = \"Uh oh! Your birth path number is not 1-9!\"\n end\nend", "def add_countdown(name, seconds, notify_frequency = nil)\n @timers[name] = Timer.new(name, Timer::COUNTDOWN, seconds, notify_frequency) {|timer| @game_object.notify :timer_tick, timer }\n end", "def random_spawn_countdown minimum\n 10.randomize(:ratio, :sign).to_i + 60\n end", "def next_message_id\n @message_id += 1\n end", "def next_message_id\n @message_id += 1\n end", "def timebomb n, m, finis = nil, start = nil\n require \"time\"\n finis = Time.parse(finis || \"#{Time.now.year}-12-31\")\n start = Time.parse(start || \"#{Time.now.year}-01-01\")\n rest = (finis - Time.now)\n full = (finis - start)\n\n [((n - m) * rest / full).to_i + m, m].max\n end", "def countdown(time, message)\n while time > 0 do\n puts time\n time-=1\n end\n puts message\nend", "def Traductor nume\n\nnumero = {}\nnumero[0] = \"Cero\"\nnumero[1] = \"Uno\"\nnumero[2] = \"Dos\"\nnumero[3] = \"Tres\"\nnumero[4] = \"Cuatro\"\nnumero[5] = \"Cinco\"\nnumero[6] = \"Seis\"\nnumero[7] = \"Siete\"\nnumero[8] = \"Ocho\"\nnumero[9] = \"Nueve\"\nnumero[10] = \"Diez\"\n\n\n\nreturn numero[nume.to_i]\n\n\nend", "def next_message; end", "def next_message; end", "def quit_message\n \"\\nRemaining pomodoros will not be posted.\" +\n \"\\nQuitting slack_pomodoro_timer...\"\n end", "def interval; end", "def interval; end", "def process_messages\n sleep 0.05\nend", "def set_message(value)\n return false unless have_lock?\n cur = get_status\n set_status(value, cur[:percent])\n end", "def on_message(message)\n case message.action\n when :add\n @counter = @counter + message.value\n when :subtract\n @counter = @counter - message.value\n when :value\n @counter\n else\n pass\n end\n end", "def message_create_train\n @message = 'Enter the train number with format > xxx(-?)xx: '\n end", "def fix_potato\n last_msg = $nv2_channel.history(1)[0] rescue nil\n $last_potato = last_msg.timestamp.to_i rescue Time.now.to_i\n if last_msg.author.id == $config['discord_client']\n $potato = ((FRUITS.index(last_msg.content) + 1) % FRUITS.size) rescue 0\n end\nrescue\n nil\nend", "def delivery_time_can_not_be_too_soon\n if time < Time.now + @@starttime\n errors.add(\"Ora di consegna:\", \"ci vogliono almeno #{@@starttime/60} minuti per l\\'elaborazione.\n Quindi ordinazioni prima delle #{(Time.now + @@starttime).strftime(\"%H:%M\")} non possono essere accettate.\")\n end\n end", "def notifications_number\n Sql.answer_to_query(JACINTHE_MODE, SQL_SUBSCRIPTION_NUMBER)[1].to_i\n end" ]
[ "0.57940143", "0.5695143", "0.54767185", "0.5446541", "0.53772956", "0.52779365", "0.5252009", "0.52298504", "0.52248544", "0.5206136", "0.5195897", "0.5180812", "0.5175079", "0.5154141", "0.51309854", "0.5111978", "0.5084036", "0.50793403", "0.507903", "0.5066103", "0.50548166", "0.50461364", "0.50398165", "0.50292575", "0.50248086", "0.5022027", "0.50140566", "0.50121087", "0.5010543", "0.5010543", "0.49767083", "0.4958131", "0.4957244", "0.49508724", "0.4950778", "0.49447882", "0.49446422", "0.49424326", "0.49367198", "0.4934164", "0.49162102", "0.4913887", "0.49138772", "0.49092168", "0.49066097", "0.4899361", "0.48903304", "0.48899686", "0.4884138", "0.48825753", "0.48804322", "0.4873903", "0.48679605", "0.48641992", "0.48611304", "0.4847118", "0.48433584", "0.48403037", "0.48381355", "0.4835815", "0.48353046", "0.48352116", "0.483354", "0.48256895", "0.4816299", "0.48148188", "0.48137078", "0.4812363", "0.4810105", "0.4807693", "0.48068622", "0.48066902", "0.4805351", "0.48039076", "0.48029992", "0.4794159", "0.4783911", "0.4783474", "0.47812343", "0.47792813", "0.4775489", "0.4775489", "0.476963", "0.4762217", "0.47619727", "0.47619727", "0.47616002", "0.47598732", "0.47549805", "0.4754799", "0.4754799", "0.4754386", "0.47538558", "0.47538558", "0.47524133", "0.47523275", "0.47501075", "0.47494626", "0.47488585", "0.47458208", "0.47429228" ]
0.0
-1
if neg 1 check odd with modulo def is_odd?(integer) integer = 1 if integer > 0 if integer % 2 != 0 true else false end end
def is_odd?(integer) integer % 2 == 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_odd?(integer)\r\n !(integer.abs.remainder(2) == 0)\r\nend", "def is_odd?(integer)\n integer % 2 == 0 ? false : true\nend", "def is_odd?(integer)\n\tinteger.abs % 2 == 1\n\t\nend", "def is_odd?(int) \n if int % 2 == 0\n return false\n else return true\n end\nend", "def is_odd?(integer)\n integer % 2 != 0\nend", "def is_odd2?(int) \n if int < 0\n int = int * -1\n end\n int % 2 == 1\nend", "def is_odd?(int)\n int.abs.remainder(2) == 1\nend", "def is_it_odd?(int)\n int.abs % 2 != 0\nend", "def is_odd?(num)\n num.remainder(2) == 1 || num.remainder(2) == -1\nend", "def is_odd?(num)\n # return false if num.zero?\n # num *= -1 if num < 0\n !(num % 2).zero?\n # !(num.remainder(2).zero?)\nend", "def is_odd?(int)\n \n # int.abs.odd? # #abs, #remainder\n\n # int.abs.remainder(2) == 1 # #abs and #remainder \n \n # int.remainder(2) == 1 || int.remainder(2) == -1 # remainder only\n \n int % 2 == 1 # #modulo % always has the sign of the divisor (positive 2)\n\nend", "def is_odd?(int)\n (int % 2).abs != 0\nend", "def is_odd?(num)\n if num == 0 ||num.remainder(2) == 0\n false\n else\n true\n end\nend", "def is_odd?(int)\n int.abs % 2 == 1\nend", "def is_odd?(num)\n num = num * -1 if num < 0 # get absolute value\n num.remainder(2) == 1 ? true: false\nend", "def is_odd?(int)\n int % 2 == 1\nend", "def is_odd?(num)\n # num.abs % 2 != 0 \n num % 2 == 1\n # ruby modulus operator always return non-negative result if num on right is positive\n # ie, % is a modulus operator and \"not a remainder operator as in some languages\"\n # my first line was correct, but more properly per the proposed problem\n # check if odd, do not check if not even\nend", "def is_odd?(number)\n number.remainder(2).abs > 0\nend", "def is_odd?(number)\n number.remainder(2) != 0\nend", "def is_odd?(number)\n number.abs.remainder(2) == 1\nend", "def is_odd?(number)\n number.abs % 2 != 0 && number != 0\nend", "def is_odd1?(integer)\n integer.remainder(2) != 0\nend", "def is_odd?(number)\n number.abs % 2 != 0\nend", "def is_odd?(number)\n number.abs % 2 != 0\nend", "def is_odd?(number)\n number % 2 != 0\nend", "def is_odd?(num)\n num.remainder(2).abs == 1\nend", "def is_odd?(num)\n num.remainder(2) != 0\nend", "def is_odd?(num)\n num.remainder(2) != 0\nend", "def is_odd?(num)\n num.remainder(2) != 0\nend", "def is_odd(number)\n return true if number % 2 != 0\n return false if number % 2 == 0\nend", "def is_odd?(num)\n num.abs.to_i % 2 != 0 && num.to_i == num\nend", "def is_odd?(integer)\n# integer.abs % 2 == 1 the #abs method is unnecessary here, because of how modulus works :)\n integer % 2 == 1\nend", "def is_odd(number)\n if number%2 > 0\n return true\n end\n return false\nend", "def is_odd_using_remainder(int)\n int.remainder(2).abs == 1\nend", "def is_odd(number)\n if number % 2== 1\n return true\n else \n return false\n end \nend", "def is_also_odd?(param_integer)\n param_integer % 2 > 0\nend", "def is_odd?(num)\n num.abs % 2 != 0\nend", "def is_odd?(num)\n return num.abs % 2 == 1 ? true : false\nend", "def is_odd?(num)\n num % 2 != 0\nend", "def is_odd?(num)\n num % 2 != 0\nend", "def is_odd?(integer)\n integer.abs.remainder\nend", "def is_odd?(n)\n n.abs % 2 != 0\nend", "def is_odd(number)\n if number % 2 == 0\n return false\n end\n return true\nend", "def is_odd(num)\n return ((num % 2) != 0)\nend", "def still_odd?(num)\n num.remainder(2).abs == 1\nend", "def this_is_also_odd?(param_integer)\n param_integer.remainder(2) != 0\nend", "def is_odd(n)\n n % 1 == 0 && n.to_i.odd?\nend", "def is_odd?(number)\n\n\t#WHY WASN\"T MODULO WORKING?\n\t# if (number%2) != 0\n\t# \tputs \"true\"\n\t# \treturn true\n\tnumber = number.to_i\n\tif number.odd?\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def is_odd?(number)\n number % 2 == 1\nend", "def is_odd?(input)\n input % 2 != 0 # => true\nend", "def is_odd?(number)\n number.remainder(2).abs == 1 # I originally wrote this w/o the .abs method call; -17 returned false as a result due to the remainder being\nend", "def is_odd? number\n number % 2 == 1\nend", "def is_odd(x)\n x % 2 == 0 ? false : true\nend", "def is_odd(number)\n output = false\n if (number % 2) != 0\n output = true\n end\n return output\nend", "def is_odd(num)\n return true if num % 2 != 0\n return false\nend", "def is_odd(x)\n # Use the logical results provided to you by Ruby already..\n x % 2 != 0\nend", "def is_odd?(num)\n # could use the built-in Integer#odd? method but building my own for practice\n num.abs % 2 == 1\nend", "def is_odd?(num)\r\n num % 2 == 1\r\nend", "def is_odd3?(int)\n if int.remainder(2) == 0\n return false\n else\n return true\n end\nend", "def is_odd(num)\n if num % 2 == 0\n return false\n else\n return true\n end\nend", "def is_odd2?(num)\n num.remainder(2) != 0\nend", "def is_odd(number)\n\tif(number%2 != 0)\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd(num)\n output = false\n if num % 2 != 0\n output = true\n end\n return output\nend", "def is_odd?(value)\n return false unless value == value.to_i # check float = integer\n value.abs % 2 == 1 ? true : false # check if odd\nend", "def is_odd(num)\n return num % 2 == 1\nend", "def is_odd(tal)\n if tal % 2 != 0\n return true\n else\n return false\n end\nend", "def is_odd?(input)\n\n if input % 2 == 1\n true\n else\n false\n end\n\nend", "def is_odd?(n)\n n % 2 == 1\nend", "def is_odd?(num)\n absolute_num = num.abs\n if absolute_num % 2 == 0 || num.to_i != num\n return false\n else\n return true\n end\nend", "def is_odd?(number)\n number.to_i.odd?\nend", "def is_other_odd?(n)\n n.abs.remainder(2) == 1\nend", "def is_odd?(int)\n int.odd?\nend", "def is_odd2?(num)\n num.abs % 2 == 1\nend", "def is_odd?(number)\n puts \"Is number #{number} an odd number?:\"\n number % 2 == 0 ? false : true\n\nend", "def odd_number_check_two(number)\r\n number % 2 == 1 || number % 2 == -1 \r\nend", "def is_odd_no_modulo?(number)\n float = number / 2.0\n if float == float.to_i.to_f\n puts \"#{number} is even.\"\n else\n puts \"#{number} is odd.\"\n end\nend", "def odd(int)\n int % 2 == 1\nend", "def odd?(number)\n if number % 2 == 0\n false\n else \n true\n end\nend", "def is_odd_remainder?(num)\n num.abs.remainder(2) == 1\n # x.remainder(y) means x-y*(x/y).truncate.\nend", "def is_odd_no_modulo?(number)\n float = number / 2.0\n float != float.to_i.to_f \nend", "def is_odd_rem?(num)\n num.abs.remainder(2) == 1\nend", "def is_odd?(num)\n num.odd?\nend", "def is_odd?(num)\n num.odd?\nend", "def odd_number?(number)\n number % 2 == 1\nend", "def odd_integer(n)\n if n % 2 == 0 || n == 0\n return false\n else \n return true\n end\nend", "def odd_even(number)\n # Modulo Operator\n return number % 2\nend", "def is_even(n)\n !n.odd?\nend", "def is_odd?(number)\n number % 2 == 1 # returned due to being last line in method + returns boolean due to operator\nend", "def odd (numb)\n return true if numb % 2 == 1\n return false\nend", "def even? num\n num.to_i % 2 == 0\n end", "def odd?\n return !even?\n end", "def odd?\n odd\n end", "def odd?\n signum == -1\n end" ]
[ "0.9034896", "0.9010646", "0.8999884", "0.8948142", "0.89392084", "0.8938481", "0.89161056", "0.8909959", "0.8898139", "0.8893692", "0.88921833", "0.8878248", "0.88670474", "0.8859486", "0.8844612", "0.88445747", "0.88428974", "0.8838492", "0.88292015", "0.8813165", "0.88055366", "0.8804242", "0.87922376", "0.87922376", "0.878121", "0.87706816", "0.87665886", "0.87665886", "0.87665886", "0.872986", "0.8727389", "0.8726046", "0.8716159", "0.870856", "0.8707883", "0.8707214", "0.8705319", "0.8702891", "0.87023425", "0.87023425", "0.869999", "0.8675869", "0.86713743", "0.8652204", "0.8651967", "0.8650495", "0.864315", "0.864025", "0.8631767", "0.86287534", "0.86120546", "0.8605001", "0.8600858", "0.85993534", "0.85848904", "0.8581196", "0.8578735", "0.8572457", "0.85475445", "0.8544175", "0.85419095", "0.85410875", "0.8518697", "0.8518697", "0.8518697", "0.8518697", "0.8518697", "0.85081404", "0.8503618", "0.85019994", "0.8494705", "0.8494698", "0.8488306", "0.8429527", "0.84279", "0.84269285", "0.83980286", "0.8378952", "0.8343761", "0.83390373", "0.8329683", "0.83233833", "0.8318409", "0.828984", "0.82112277", "0.82105595", "0.81647503", "0.81647503", "0.8157625", "0.8055076", "0.7916808", "0.7915911", "0.789041", "0.78732383", "0.7787535", "0.7741087", "0.77314156", "0.7710319" ]
0.8815377
21
and then outputs the modified string.
def caesar_cipher(string, shift_factor = 0) result = '' string.each_char do |char| # use cipher only if char is an uppercase or lowercase letter if char.ord.between?(65, 90) || char.ord.between?(97, 122) new_code = char.ord + shift_factor #ensure wrapping from Z to A or z to a new_code -= 26 if (new_code > 91 && char.ord < 91) || new_code > 122 result += new_code.chr else result += char end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stringOutput\n\t\tend", "def stringOutput\n\t\tend", "def output_formatted_text(output_string)\n puts output_string\n end", "def raw_output(s)\n s\n end", "def output(s)\n if @lstrip\n s = s.gsub(/\\A\\s+/, \"\")\n @lstrip = false\n end\n\n newlines = s.count(NEWLINE)\n if newlines > 0\n @line += newlines\n @offset = s[s.rindex(NEWLINE)..-1].size\n else\n @offset += s.size\n end\n\n @result << s\n end", "def replace_with str\n self.class.new \"\" << raw[0] << str << raw[-1]\n end", "def replace(in_str)\n @out_str = in_str + \" \" + in_str\n end", "def print(str)\n @output.write(Iconv.iconv(@options[:encoding], \"utf-8//ignore\", str))\n end", "def play_back_string(str)\n full_buffer = ''\n str.split(\"\\n\").each do |buf|\n begin\n full_buffer += buf\n # unless this is puppet code, otherwise skip repl keywords\n if keyword_expression.match(buf)\n out_buffer.write('>> ')\n else\n parser.parse_string(full_buffer)\n out_buffer.write('>> ')\n end\n rescue Puppet::ParseErrorWithIssue => e\n if multiline_input?(e)\n full_buffer += \"\\n\"\n next\n end\n end\n out_buffer.puts(full_buffer)\n handle_input(full_buffer)\n full_buffer = ''\n end\n end", "def output(string)\n unless @headers_sent\n puts @cgi.header(@headers)\n @headers_sent = true\n end\n\n puts string\n end", "def outo( str )\n outi nil, str\n end", "def write string\n end", "def string_output(string)\n return string.gsub /\\s/, \"+\"\nend", "def assemble_to_string\n #put the strings at the end of the assembled code.\n # adding them will fix their position and make them assemble after\n @string_table.values.each do |data|\n add_block data\n end\n io = StringIO.new\n assemble(io)\n io.string\n end", "def prettify(str); end", "def dostr\n return <<EOS\ns=<<ES\n#{@dostr.gsub(/_REMOVE_/,'')}\nES\nEOS\n end", "def write( output=$stdout, indent=-1, transitive=false, ie_hack=false )\n #indent( output, indent ) unless transitive\n\t\t\toutput << START\n\t\t\toutput << @string\n\t\t\toutput << STOP\n\t\tend", "def play_back_string(str)\n full_buffer = ''\n str.split(\"\\n\").each do |buf|\n begin\n full_buffer += buf\n # unless this is puppet code, otherwise skip repl keywords\n if PuppetDebugger::InputResponders::Commands.command_list_regex.match(buf)\n debugger.out_buffer.write('>> ')\n else\n debugger.parser.parse_string(full_buffer)\n debugger.out_buffer.write('>> ')\n end\n rescue Puppet::ParseErrorWithIssue => e\n if debugger.multiline_input?(e)\n full_buffer += \"\\n\"\n next\n end\n end\n debugger.out_buffer.puts(full_buffer)\n debugger.handle_input(full_buffer)\n full_buffer = ''\n end\n end", "def reencode_string(input); end", "def write_string(*text); end", "def process\n @string\n end", "def to_s\n \"$ \" + input + \"\\n\" + output\n end", "def string_in_line(string, length)\r\n puts '-'*((length/2)-(string.length/2))+\" #{string} \"+'-'*((length/2)-(string.length/2))\r\n end", "def modString(str)\n\tstr=str+\" hello\"\n\treturn str + \" world\"\nend", "def write(str)\n puts self.writings(str)\n end", "def write(str)\n puts self.writings(str)\n end", "def format!\n substitutions.each { |s| sub_string.gsub!(match(s), replace(s)) }\n sub_string\n end", "def formatting(str)\n puts str * 80\nend", "def modify_string(str, options = { \"upper\" => false, \"repeats\" => 1 })\n str.upcase! if options[\"upper\"]\n p str * options[\"repeats\"]\nend", "def say_goodbye\n str = \"Hello\"\n abc = str\n str.replace(\"Goodbye\")\n puts str\n puts abc\nend", "def carets(str)\n \"&#60;#{str.to_s}&#62;\"\n end", "def echo(str)\n\tstr\nend", "def echo(str)\n\tstr\nend", "def modify_string(str, options={\"upper\"=>false, \"repeats\"=>1})\n str.upcase! if options[\"upper\"]\n p str * options[\"repeats\"]\nend", "def to_html_msg(str)\n str.gsub!(\"<stdin>:\", \"\") # Output from the compiler\n str.gsub!(\"<\", \"&lt;\")\n str.gsub!(\">\", \"&gt;\")\n str.gsub!(/[\\n|\\r\\n]/, '<br\\>') # Replace newlines with line breaks \n str\n end", "def display(string)\n result = \"\"\n string.each_char do |char|\n result << \"#{char} \"\n end\n result\n end", "def shout(str)\n puts str\n end", "def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s + \" \"\n @output.text = @input\n end", "def printed_code\n self.code.gsub('/','-')\n end", "def printed_code\n self.code.gsub('/','-')\n end", "def format(text); end", "def to_s\n output || content || \"\"\n end", "def str2; end", "def str2; end", "def use string\n @use = string.gsub(/^\\s*\\n/, '').gsub(/\\n\\s*$/, '')\nend", "def output()\n add_newline if @linebreak\n @text\n end", "def string() end", "def puts str\n %s(puts (callm str __get_raw))\n end", "def output(command)\n @buffer << command.gsub(/'/, '\"')\n end", "def print(string)\n self.buffer += string\n Kernel.print string\n end", "def output text\n puts text\n end", "def replace_text(out = nil)\n print out if out\n exit 201\n end", "def output(str)\n str = str.to_s.strip\n str = nil if str && str.length == 0\n str ||= \"Completed (no output)\"\n output = Time.now.strftime(\"%H:%M:%S\") + \" [#{self}] \"\n output << str\n print output + \"\\n\"\n output\n end", "def put\n next_str\n puts(@str)\n end", "def write_output(string)\n @output << string\n end", "def do_encoding(string)\n ## removing newline (needed for pty/expect newlines)\n string[0, 2] = '' if string.start_with? \"\\r\\n\"\n string[0, 3] = '' if string.start_with? \"\\r\\r\\n\"\n string.gsub!(\"\\r\\n\", \"\\n\")\n # string.chomp!\n string\n end", "def crunch(double_string)\n current_character = ''\n new_string = ''\n double_string.each_char do |character|\n if character != current_character\n new_string += character\n current_character = character\n end\n end\n new_string\nend", "def shout(string)\n\t\t\tstring.upcase\t\t\n\t\tend", "def replace(string, chr, replace)\n i = 0\n output = \"\"\n while i < string.length\n if string[i..i+chr.length-1] != chr\n output += string[i]\n i += 1\n else \n output += replace\n i += chr.length\n end\n \n end\n return output\nend", "def output(text)\n puts text\n end", "def do_encoding_terminal(string)\n string = string.to_s\n string.gsub!(\"\\r\\r\", \"\\r\")\n string.gsub!(\"\\r\\n\", \"\\n\")\n string.gsub!(\"\\r\\$\\s\", \"\")\n\n string.gsub!(/.\\r/, \"\")\n string.gsub!(/\\x1B\\[\\d*?[ABCDsuKJ]/, '')\n string\n end", "def format_ouput(str1,str2)\n len = 50 - str1.length\n space = \"#{'-' * len}\".to_s\n str1.concat(space)\n str1.concat(str2.to_s)\n str1\nend", "def string(st)\n if st.length > 10\n puts st.upcase\n else\n puts st\nend\nend", "def render_text(text)\n @out << text\n end", "def render( render_state )\n\t\traw = super\n\t\tbuf = String.new( '' )\n\t\tPP.pp( raw, buf )\n\t\treturn self.escape( buf.chomp, render_state )\n\tend", "def shout(str); str.upcase end", "def display_string\n op_match = /#{SORTEDOPS.map { |o| Regexp.quote(o) }.join(\"|\")}/\n popen = Regexp.quote(OPEN_PAREN)\n pclose = Regexp.quote(CLOSE_PAREN)\n text = self.to_s\n text.gsub(/#{popen}(.*?)#{pclose}/) { |m|\n payload = $1.dup\n count = 0\n payload.gsub(op_match) do |pm|\n count += 1\n pm\n end\n if count == 1\n payload.strip\n else\n OPEN_PAREN + payload.strip + CLOSE_PAREN\n end\n }.strip\n end", "def print(string)\n terminator = @options[\"Terminator\"]\n\n if @options[\"Binmode\"]\n self.write(string)\n else\n self.write(string.gsub(/\\n/n, terminator))\n end\n end", "def do_adhoc(str)\n str.gsub!(/^\\\\cleardoublepage$/, \"\")\n str.gsub!(/^\\\\plainifnotempty$/, \"\")\n str.gsub!(/^\\\\small$/, \"\")\n str.gsub!(/^\\\\normalsize$/, \"\")\n str.gsub!(/^\\\\centering$/, \"\")\n\n # URL\n str.gsub!(/\\\\verb\\|(.+?)\\|/) do |m|\n s = $1\n if s =~ URI.regexp\n s\n else\n m\n end\n end\n\n text_pairs = {\n %! \\\\vspace*{-0.1\\\\Cvs}! => \"\",\n %!$10^{12} = 1 \\\\mathrm{TB}$! => %!@<raw>#{LBRACE}|html|10<sup>12</sup>#{RBRACE}=1TB!,\n %!$\\\\exists, \\\\forall$! => %!@<raw>#{LBRACE}|html|&exist;, &forall;#{RBRACE}!,\n %!$\\\\lnot,\\\\land,\\\\lor$! => %!@<raw>#{LBRACE}|html|&not;,&and;,&or;#{RBRACE}!,\n %!$>$! => %!@<raw>#{LBRACE}|html|&gt;#{RBRACE}!,\n %!$<$! => %!@<raw>#{LBRACE}|html|&lt;#{RBRACE}!,\n %!B$^+$! => %!@<raw>#{LBRACE}|html|B<sup>+</sup>#{RBRACE}!,\n %!\\\\paragraph{Step 4.} \\\\ ! => %!\\\\paragraph{Step 4.}!,\n %!\\\\verb|http://s2k-ftp.cs.berkeley.edu/ingres/|! => %!http://s2k-ftp.cs.berkeley.edu/ingres/!,\n %!\\\\verb|pc<code.size()|! => %!@<tt>#{LBRACE}pc<code.size()#{RBRACE}!,\n %!\\\\verb|c|! => %!@<tt>#{LBRACE}c#{RBRACE}!,\n %!\\\\verb|m|! => %!@<tt>#{LBRACE}m#{RBRACE}!,\n %!\\\\verb|z|! => %!@<tt>#{LBRACE}z#{RBRACE}!,\n %!$n$! => %!n!,\n %!$\\\\mathrm{O}(1)$! => %!O(1)!,\n %!$\\\\mathrm{O}(n)$! => %!O(n)!,\n %!$\\\\beta$! => %!@<raw>#{LBRACE}|html|&beta;#{RBRACE}!,\n %!$t$! => %!t!,\n %![$^{11}$C]! => %!@<raw>#{LBRACE}|html|[<sup>11</sup>C]#{RBRACE}!,\n }\n\n text_pairs.each do |k,v|\n regex = Regexp.compile(Regexp.quote(k))\n str.gsub!(regex, v)\n end\n\n str.gsub!(/^\\s*\\\\begin\\{lstlisting\\}\\n((?:.|\\n)*?)\\n\\s*\\\\end\\{lstlisting\\}\\n/) do |m|\n \"//emlist{\\n\" + $1 + \"\\n//}\\n\"\n end\n\n str.gsub!(/^\\s*\\\\begin\\{quote\\}\\n((?:.|\\n)*?)\\n\\s*\\\\end\\{quote\\}\\n/) do |m|\n \"//quote{\\n\" + $1 + \"\\n//}\\n\"\n end\n\n str.gsub!(/^\\s*\\\\(begin|end)\\{(minipage|center|figure)\\}.*$/, \"\")\n\n img_refs = Hash.new\n str.gsub!(/^\\s*\\\\includegraphics(?:\\[.*?\\])?\\{(.+?)\\}[\\s\\n]*\\\\caption\\{(.+?)\\}[\\s\\n]*\\\\label\\{(.+?)\\}/) do |m|\n imgfile = $1.strip\n caps = $2.strip\n label = $3.strip\n if imgfile =~ /\\.eps\\Z/\n imgfile = File.basename(imgfile, \".eps\")\n img_refs[label.strip] = imgfile\n \"\\n//image[#{imgfile}][#{caps}]{\\n//}\\n\"\n elsif imgfile =~ /\\.pdf\\Z/\n imgfile = File.basename(imgfile, \".pdf\")\n img_refs[label.strip] = imgfile\n \"\\n//image[#{imgfile}][#{caps}]{\\n//}\\n\"\n else\n m\n end\n end\n\n str.gsub!(/^\\s*\\\\includegraphics(?:\\[.*?\\])?\\{(.+?)\\}[\\s\\n]*\\\\caption\\{(.+?)\\}/) do |m|\n imgfile = File.basename($1.strip)\n caps = $2.strip\n imgfile.gsub!(/\\.\\w+\\Z/, \"\")\n \"\\n//image[#{imgfile}][#{caps}]{\\n//}\\n\"\n end\n\n str.gsub!(/図\\s*\\\\ref\\{([^\\}]*)\\}/) do |m|\n \"@<img>#{LBRACE}#{img_refs[$1.strip] || $1.strip}#{RBRACE}\"\n end\n\n str.gsub!(/^\\s*\\\\begin\\{enumerate\\}((?:.|\\n)*)\\s*\\\\end\\{enumerate\\}/) do |m|\n block = $1\n idx = 0\n if block =~ /\\\\begin/\n block\n else\n items = block.strip.split(/\\\\item\\s*/).select{|s| s.size > 0}\n items_str = \"\\n\"\n items.each do |item|\n items_str += \" \" + (idx += 1).to_s + \". \" + item.gsub(/\\n\\s*/,\"\").strip + \"\\n\"\n end\n items_str\n end\n end\n\n str.gsub!(/^\\s*\\\\begin\\{itemize\\}((?:.|\\n)*)\\s*\\\\end\\{itemize\\}/) do |m|\n block = $1\n if block =~ /\\\\begin/\n block\n else\n items = block.strip.split(/\\\\item\\s*/).select{|s| s.size > 0}\n items_str = \"\\n\"\n items.each do |item|\n items_str += \" * \" + item.gsub(/\\n\\s*/,\"\").strip + \"\\n\"\n end\n items_str\n end\n end\n\n # brainfuck\n str.gsub!(/\\\\verb\\|([-+><,\\.\\[\\] ]+)\\|/) do |m|\n %!@<tt>#{LBRACE}#{$1}#{RBRACE}!\n end\n\n # file url in hoge.tex\n str.gsub!(/\\{\\\\scriptsize((?:.|\\n)+?)\\}/) do |m|\n s = $~[1].strip\n if s.strip =~ URI.regexp && s == $~[0]\n s\n else\n m\n end\n end\n\n str\nend", "def output\n results = ziv_lempel_ordered\n # results.each do |ary|\n # puts \"now: %Q{#{buf_string(ary[0],ary[1][0])}} #{ary.inspect}\"\n # end\n the_output = @buffer.join('')\n variable = \"@a\"\n variables = Array.new\n results.each do |ary|\n string = buf_string(ary[0],ary[1][0])\n count = 0\n re = Regexp.new(Regexp.quote(string))\n the_output.gsub(re) do |s|\n count += 1\n s\n end\n if count >= 2\n variables << [variable.dup, string.dup]\n the_output.gsub!(re, \"\\#\\{#{variable}\\}\")\n variable.succ!\n else\n # puts \"string #{string} /#{re}/ not found\"\n end\n end\n print <<EOF\n#!/usr/local/bin/ruby -w --\n\n# Takes DRY code and soaks it... undoes TumbleDRYer.\nclass WashingMachine\n def initialize\nEOF\n variables.each do |ary|\n puts \" #{ary[0]} = %q{#{ary[1]}}\"\n end\n print <<EOF\n end\n def output\n # We need a string unlikely to be in the input as a terminator.\n print <<BLOBULARIZATION\nEOF\n puts the_output \n print <<EOF\nBLOBULARIZATION\n end\nend\n\nWashingMachine.new.output\nEOF\n end", "def fragment(string); end", "def decorate_string(str, _istruct)\n str\n end", "def decorate_string(str, _istruct)\n str\n end", "def change_letters(string)\r\n if string.include? \"s\"\r\n string.gsub!(/s/, \"th\")\r\n end\r\n\r\n puts string\r\nend", "def escape(s); s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n){'%'+$1.unpack('H2'*$1.size).join('%').upcase}.tr(' ', '+') end", "def output_line(line)\n output = line[:mode] + ' '\n output << line[:repl] + ' '\n output << line[:owner].ljust(@alignment[:owner]) + ' '\n output << line[:group].ljust(@alignment[:group]) + ' '\n output << line[:size].rjust(@alignment[:size]) + ' '\n output << line[:time] + ' '\n output << line[:name] + \"\\n\"\n puts output\n end", "def write_mstring(*text); end", "def _rl_output_some_chars(string,start,count)\r\n case @encoding\r\n when 'X'\r\n @_rl_out_stream.write(string[start, count].force_encoding(@encoding_name))\r\n else\r\n @_rl_out_stream.write(string[start, count])\r\n end\r\n end", "def str(str); end", "def str(str); end", "def write(str)\n writing { write0 str }\n end", "def content=(string); end", "def content=(string); end", "def e(str)\n str.to_s.gsub(/(?=[^a-zA-Z0-9_.\\/\\-\\x7F-\\xFF\\n])/n, '\\\\').\n gsub(/\\n/, \"'\\n'\").\n sub(/^$/, \"''\")\n end", "def to_ascii!; replace(to_ascii); end", "def text(str); end", "def american_string(string)\n\tputs string + \" only in america\"\nend", "def write(text = '')\n puts(sanitize(text))\n end", "def outi( ind, str )\n ind = setind( ind )\n @@fh.write( ' ' * ind[0] )\n @@fh.puts( str )\n @@outind = ind[1]\n end", "def output_command(command_string)\n $stdout.puts\n $stdout.puts StringMasker.new(command_string, :username => username, :password => password).to_s\n end", "def echo(string)\n string\n end", "def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s\n @output.text = @input\n end", "def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s\n @output.text = @input\n end", "def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s\n @output.text = @input\n end", "def conceal(string)\n if string.length < 8\n '****'\n else\n front = string[0, 4]\n back = string[-4, 4]\n \"#{front}****#{back}\"\n end\n end", "def escape(string)\n string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do\n '%' + $1.unpack('H2' * $1.size).join('%').upcase\n end.tr(' ', '+')\t\n\tend", "def translateToShow(str)\n @result = str\n @result.gsub!(/</, '&lt;')\n @result.gsub!(/>/, '&gt;')\n @result.gsub!(/\\*{2}(.+)\\*{2}/, '<b>\\1</b>')\n @result.gsub!(/\\\\{2}(.+)\\\\{2}/, '<i>\\1</i>')\n @result.gsub!(/\\({2}((\\/[\\S]+)+)\\s+(.+)\\){2}/, '<a href=\"\\1\">\\3</a>')\n return @result\n end", "def echo(phrase)\n\treturn \"#{phrase}\"\nend", "def string=(p0) end", "def output_word\n puts @displayed_character.join('')\n end", "def show_text(string, *params)\n @content.last << string.strip\n end" ]
[ "0.68570876", "0.68570876", "0.6749846", "0.635182", "0.6339313", "0.61864674", "0.61746275", "0.6117725", "0.61070323", "0.60885286", "0.6078779", "0.6070128", "0.6011861", "0.59968966", "0.5995648", "0.5991007", "0.59167445", "0.5891626", "0.5884663", "0.5832941", "0.5822167", "0.58154804", "0.58128214", "0.58092594", "0.58074284", "0.58074284", "0.58034134", "0.5803065", "0.57993734", "0.57954055", "0.57924753", "0.57919604", "0.57919604", "0.5791196", "0.5789752", "0.5780475", "0.57708424", "0.5766262", "0.5746001", "0.5746001", "0.5745305", "0.5741655", "0.574064", "0.574064", "0.570635", "0.569684", "0.5693183", "0.56910616", "0.5686578", "0.5684812", "0.5680023", "0.5674064", "0.5668235", "0.5663956", "0.56587136", "0.5656877", "0.56544423", "0.5644179", "0.5641557", "0.5640219", "0.56305146", "0.56236106", "0.5617661", "0.5615693", "0.5614885", "0.5609689", "0.56013566", "0.5598108", "0.55976635", "0.5588322", "0.5584407", "0.55800396", "0.55800396", "0.5577014", "0.55740666", "0.5561524", "0.55569094", "0.55515814", "0.5548658", "0.5548658", "0.55483377", "0.55439323", "0.55439323", "0.5541812", "0.55413157", "0.5526997", "0.5516815", "0.55165637", "0.55142045", "0.5511881", "0.55092555", "0.5509163", "0.5509163", "0.5509163", "0.55091226", "0.5508247", "0.5507057", "0.5506677", "0.5502006", "0.5500863", "0.54978573" ]
0.0
-1
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: "League Spec password reset" mail from: "password-reset@leaguespec.com" 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 send_password_reset_email\n \t\tUserMailer.password_reset(self).deliver_now\n \tend", "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 set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "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 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 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 password_reset(user)\n @user = user\n mail to: user.email, subject: \"Password reset [Delfy]\", from: \"Delfy <noreply@delfy.us>\"\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.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 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.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 subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\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 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.password_reset(self.class.name.to_s.downcase.pluralize, self).deliver_now\n logger.info \"email: admin password reset sent to #{email}\"\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" ]
[ "0.6847792", "0.6811161", "0.6743567", "0.67034006", "0.667996", "0.6636797", "0.65923536", "0.6572514", "0.6554156", "0.65073377", "0.6480957", "0.64693576", "0.6456036", "0.6449797", "0.6441507", "0.6410659", "0.640921", "0.6402868", "0.63984996", "0.63880104", "0.63861823", "0.63791823", "0.6342578", "0.6337313", "0.63291794", "0.63248587", "0.6316453", "0.63150257", "0.6315", "0.63127697", "0.63100624", "0.63100624", "0.63100624", "0.63100624", "0.63100624", "0.63100624", "0.6308942", "0.6301065", "0.629145", "0.6290517", "0.6284044", "0.6282159", "0.6280235", "0.62754637", "0.6274613", "0.6268611", "0.6264849", "0.62587124", "0.62571955", "0.62561077", "0.62561077", "0.62561077", "0.6238732", "0.6238471", "0.6237769", "0.6234744", "0.6233249", "0.623289", "0.62306744", "0.6227928", "0.6227382", "0.6226166", "0.62092113", "0.62028825", "0.6200016", "0.6200016", "0.6200016", "0.6200016", "0.6200016", "0.61936116", "0.61921805", "0.61921805", "0.61921805", "0.61921805", "0.61921805", "0.61921805", "0.61921805", "0.61921805", "0.61921805", "0.6189175", "0.61873907", "0.61859816", "0.6181036", "0.6179902", "0.6179902", "0.6175641", "0.6175126", "0.61734456", "0.61706376", "0.61686754", "0.61659163", "0.6164563", "0.6160904", "0.61589676", "0.61588615", "0.61529183", "0.61529183", "0.6149357", "0.614676", "0.61467046", "0.61449635" ]
0.0
-1
GET /source_pages GET /source_pages.json
def index @source_pages = SourcePage.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_source\n # must set max nesting. default limit of 20 is too low for selendroid\n JSON.parse @driver.page_source, max_nesting: 9999\n end", "def index\n @pages = Page.all\n render json: @pages\n end", "def get_pages(options = nil)\n @client.raw('get', '/content/pages', options)\n end", "def pages\n get(\"v1/event/#{@id}/pages\")\n end", "def index\n @src_gsts = SrcGst.where(hotel_src_id: current_user.hotel_src_id).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @src_gsts }\n end\n end", "def index\n respond_with(sources)\n end", "def index\n @pages = current_site.pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @sources = Source.paginate(:page => page, :per_page => 10, :order => \"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sources }\n end\n end", "def get_bundles(options = nil)\n @client.raw('get', '/content/pages', options)\n end", "def index\n @pages = Page.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def page_source; end", "def index\n @student_sources = StudentSource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @student_sources }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @source }\n end\n end", "def index\n @urls = @site.urls.paginate(:page => params[:page])\n render json: @urls\n end", "def get_page\n render_page_sections_json\n end", "def index\n @sources = Source.all\n end", "def index\n @pages = Page.all\n \n respond_to do |format|\n format.json { render :json => @pages }\n format.xml { render :xml => @pages }\n end\n end", "def index\n @pages = Page.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Page.roots.map{|r| r.node}}\n end\n end", "def index\n #@sources = Source.all\n \n @sources = Source.search(params[:search], params[:page])\n \n @title = \"Sources\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sources }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.json { render json: @pages }\n format.xml { render xml: @pages }\n end\n end", "def index\n\t\t@pages = Page.order('created_at DESC').all\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.json { render json: @pages }\n\t\tend\n\tend", "def get_page_source(page_url)\n url = URI.parse(page_url)\n req = Net::HTTP::Get.new(url.path)\n Net::HTTP.start(url.host, url.port) do |http|\n http.request(req)\n end\nend", "def index\n @financial_aid_sources = @financial_aid_package.sources\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financial_aid_sources }\n end\n end", "def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end", "def index\n @static_pages = StaticPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @static_pages }\n end\n end", "def index\n @static_pages = StaticPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @static_pages }\n end\n end", "def view\n \t@parent = params[:parent]\n\n @pages = Page.where(\"digital_edition_id = ?\", @parent).order(\"page_page ASC\").page( params[:page]).per(20)\n\n respond_to do |format|\n format.html # view.html.erb\n format.json { render json: @page }\n end\n end", "def pages\n @pages ||= source.map {|path| Page.new(self, path) }\n end", "def convictions_index_at_source\n page = get(base)\n page.search('div.listing-container ol li').map do |el|\n { 'link' => el.search('a').first['href'] }\n end\nend", "def get_page_contents()\n JSON.parse( \n @client.api.get(\"#{@client.base_uri.path}/api.php?#{URI.encode_www_form({\n :action => 'query',\n :prop => 'info|revisions',\n :titles => BAN_PAGE,\n :rvprop => 'content',\n :intoken => 'edit',\n :indexpageids => 1,\n :format => 'json',\n :cb => rand(1000000)\n })}\", @headers).body,\n :symbolize_names => true\n )[:query]\n end", "def page_source\n bridge.page_source\n end", "def sources_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_get ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'client_id'] = opts[:'client_id'] if opts[:'client_id']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'created_at'] = opts[:'created_at'] if opts[:'created_at']\n query_params[:'updated_at'] = opts[:'updated_at'] if opts[:'updated_at']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\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\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, 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 => 'inline_response_200_15')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_get. Result: #{result.inspect}\"\n end\n return result\n end", "def pages; end", "def pages\n end", "def show\n render json: @page\n end", "def index\n @sites = current_user.sites.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def list\n response = connect(base_url, :get)\n pagination_links(response)\n self.current_page = JSON.load(response.body)\n end", "def index\n @enq_pages = EnqPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enq_pages }\n end\n end", "def index\n @links = Link.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end", "def index\n @event_sources = EventSource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @event_sources }\n end\n end", "def index\n @pages = Page.all\n\n respond_with @pages\n end", "def get_sources\n response = execute_get(\"/reference/source\")\n Source.from_array(decode(response))\n end", "def index\n if params[:item_id]\n @parent = Item.find(params[:item_id])\n @sources = @parent.sources\n elsif params[:person_id]\n @parent = Person.find(params[:person_id])\n @sources = @parent.sources\n else\n @sources = Source.scoped\n end\n\n @sources_all = @sources\n @q = @sources.search(params[:q])\n @sources = @q.result(distinct: true).includes(:author)\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @sources }\n end\n end", "def show\n @page = Page.find(params[:id])\n @version = @page.versions.last\n @author = User.all\n page = {\n :version => @version.changeset,\n :body => @page.body,\n :author => @author\n }\n respond_to do |format|\n format.html\n format.json { render json: page.to_json }\n end\n end", "def index\n @pages = Page.all\n respond_with(@pages)\n end", "def index\n @pages = Page.all\n respond_with(@pages)\n end", "def get_sources\n @page.all(input_elements[:sources_list])\n end", "def index\n @pages = Page.all\n\n respond_to do |format| \n format.json {render json: @pages}\n format.xml {render xml: @pages}\n end\n\n end", "def index\n @source_codes = SourceCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @source_codes }\n end\n end", "def index\n page = params[:page] || 1\n\n @global_jsons = CfTemplate.global\n\n respond_to do |format|\n format.json { @global_jsons = @global_jsons }\n format.html { @global_jsons = @global_jsons.page(page) }\n end\n end", "def index\n @source_files = SourceFile.all\n end", "def pages_data\n\n config_data = get_config_data\n\n all_data_files = Dir.glob(\"../#{ROOT_DIR}/lib/views/source/#{config_data[\"templates_page\"]}/**/*.json\")\n\n pageData_files = []\n\n all_data_files.map { |data| \n\n data_name = data.split(\"/\")[-1]\n pageData_files.push(\n {\n \"file_name\": data_name,\n \"link_name\": data_name.sub(\"~\", \"__\").chomp(\".json\"),\n \"label\": data_name.sub(\"~\", \" \").chomp(\".json\")\n }\n )\n }\n\n return pageData_files\n end", "def index\n @articles = Article.page(params[:page]).order(:pub_date,:source,:headline)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @pages = Page.all\n respond_with(@pages)\n end", "def index\n respond_with(pages)\n end", "def index\n @agent_import_files = AgentImportFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @agent_import_files }\n end\n end", "def index\n @about_pages = AboutPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @about_pages }\n end\n end", "def index\n @page_objects = PageObject.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @page_objects }\n format.tson { render :json => @page_objects }\n end\n end", "def index\n @page = Page.find(params[:page_id])\n @revisions = @page.revisions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @revisions }\n end\n end", "def sources\n respond_to do |format|\n format.html{ redirect_to root_path }\n format.json{\n list = []\n Plugins::Import.included_modules.each do |plugin|\n list << { \n :display => \"#{plugin::Meta::NAME} (#{plugin.name} #{plugin::Meta::VERSION::STRING})\",\n :value => plugin.name\n }\n end\n render :json => list\n }\n end\n end", "def index\n render json: @links\n end", "def index\n @inventory_files = InventoryFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @inventory_files }\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 show\n @student_source = StudentSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_source }\n end\n end", "def pages\n get(\"v1/account/#{@email}/pages\")\n end", "def show\n @board = Board.find(params[:id])\n @content_years = @board.content_years.page(params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @board }\n end\n end", "def index\n @sites = Site.paginate(:page=>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\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\n @contents = Content.order('created_at DESC').paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end", "def index\n @temporary_sources = TemporarySource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @temporary_sources }\n end\n end", "def index\n @founding_sources = FoundingSource.all\n end", "def index\n respond_to do |format|\n format.html do\n @recent_objects = Source.created_this_week.order(updated_at: :desc).limit(10)\n render '/shared/data/all/index'\n end\n format.json {\n @sources = Queries::Source::Filter.new(params).all\n .order(:cached)\n .page(params[:page])\n .per(params[:per])\n }\n format.bib {\n # TODO - handle count and download\n @sources = Queries::Source::Filter.new(params).all\n .order(:cached)\n .page(params[:page])\n .per(params[:per] || 2000)\n }\n end\n end", "def index\n # @donation_year_links = DonationYearLink.all\n @donation_year_links = DonationYearLink.order(:created_at).page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @donation_year_links }\n end\n end", "def index\n @event_import_files = EventImportFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @event_import_files }\n end\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 new\n @source = Source.new\n @sources = current_user.sources\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @source }\n end\n end", "def index\n @snippets = Snippet.order(\"updated_at DESC\").where(private: false).paginate(page: params[:page], per_page: 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snippets }\n end\n end", "def get_json\n html = Nokogiri::HTML(@page)\n text = open(\"https://theintercept.com/api/requestSIDDocuments/?orderBy=publishedTime&orderDirection=desc&perPage=2000\").read\n documents = JSON.parse(text)[\"documents\"][\"edges\"].map{|d| d[\"node\"]}\n \n documents.each do |doc|\n @output.push(parse_json(doc))\n end\n\n return JSON.pretty_generate(@output)\n end", "def index \n @source_webs = SourceWeb.websources(params[:project_id]) \n end", "def show\n @proxy_source = ProxySource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proxy_source }\n end\n end", "def show\n # TODO: this is a placeholder for logic using Sentence\n render :json => { :index => params[:id],\n :contents => \"SERVER: this would be the contents of page \" + params[:id]\n }\n end", "def index\n @event_import_files = EventImportFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_import_files }\n end\n end", "def index\n @pages = Page.all\n end", "def index\n @pages = Page.all\n end", "def index\n @pages = Page.all\n end", "def index\n @pages = Page.all\n end", "def index\n @pages = Page.all\n end", "def index\n @pages = Page.all\n end", "def index\n @pages = Page.all\n end", "def index\n @pages = Page.all\n end", "def index\n @pages = Page.all\n end", "def index\n @pages = Page.all\n end" ]
[ "0.69422096", "0.655444", "0.6551009", "0.6504953", "0.6473319", "0.64149475", "0.63961554", "0.63830733", "0.6368293", "0.6299695", "0.6297939", "0.6297939", "0.6297939", "0.6297939", "0.6297939", "0.6297939", "0.6297939", "0.62795764", "0.62692845", "0.6259181", "0.6229108", "0.62128717", "0.61898774", "0.6181314", "0.61724174", "0.6146201", "0.6134263", "0.61038566", "0.6097868", "0.60899734", "0.6088344", "0.608507", "0.6058234", "0.6058234", "0.6052733", "0.60362643", "0.60269046", "0.6009311", "0.60054225", "0.600337", "0.59888387", "0.59813815", "0.5970784", "0.59509313", "0.5943003", "0.5934417", "0.59037393", "0.58929783", "0.5885413", "0.58811784", "0.58727115", "0.58460635", "0.5838472", "0.5838472", "0.5831775", "0.5826283", "0.58252245", "0.5801011", "0.57986736", "0.5791324", "0.57866025", "0.57824504", "0.5780405", "0.57797307", "0.5779345", "0.5778975", "0.5773605", "0.577097", "0.5768105", "0.5768094", "0.57542825", "0.5752178", "0.57461977", "0.57333916", "0.5720767", "0.57190067", "0.5687375", "0.5686451", "0.56830156", "0.56796354", "0.5678469", "0.5675092", "0.56717813", "0.566891", "0.56626576", "0.56614", "0.56587565", "0.5640377", "0.563899", "0.5638843", "0.56360567", "0.56360567", "0.56360567", "0.56360567", "0.56360567", "0.56360567", "0.56360567", "0.56360567", "0.56360567", "0.56360567" ]
0.7498058
0
GET /source_pages/1 GET /source_pages/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @source_pages = SourcePage.all\n end", "def get_source\n # must set max nesting. default limit of 20 is too low for selendroid\n JSON.parse @driver.page_source, max_nesting: 9999\n end", "def index\n @pages = Page.all\n render json: @pages\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @source }\n end\n end", "def index\n @pages = current_site.pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @src_gsts = SrcGst.where(hotel_src_id: current_user.hotel_src_id).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @src_gsts }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def get_page\n render_page_sections_json\n end", "def show\n @page = Page.find(params[:id])\n @version = @page.versions.last\n @author = User.all\n page = {\n :version => @version.changeset,\n :body => @page.body,\n :author => @author\n }\n respond_to do |format|\n format.html\n format.json { render json: page.to_json }\n end\n end", "def show\n render json: @page\n end", "def pages\n get(\"v1/event/#{@id}/pages\")\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def view\n \t@parent = params[:parent]\n\n @pages = Page.where(\"digital_edition_id = ?\", @parent).order(\"page_page ASC\").page( params[:page]).per(20)\n\n respond_to do |format|\n format.html # view.html.erb\n format.json { render json: @page }\n end\n end", "def get_page(id)\n @client.raw('get', \"/content/pages/#{id}\")\n end", "def index\n @pages = Page.all\n \n respond_to do |format|\n format.json { render :json => @pages }\n format.xml { render :xml => @pages }\n end\n end", "def index\n @sources = Source.paginate(:page => page, :per_page => 10, :order => \"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sources }\n end\n end", "def get_pages(options = nil)\n @client.raw('get', '/content/pages', options)\n end", "def show\n @structure_page = Structure::Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @structure_page }\n end\n end", "def page_source; end", "def get_bundles(options = nil)\n @client.raw('get', '/content/pages', options)\n end", "def index\n @static_pages = StaticPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @static_pages }\n end\n end", "def index\n @static_pages = StaticPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @static_pages }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.json { render json: @pages }\n format.xml { render xml: @pages }\n end\n end", "def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end", "def index\n @urls = @site.urls.paginate(:page => params[:page])\n render json: @urls\n end", "def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def get_page_contents()\n JSON.parse( \n @client.api.get(\"#{@client.base_uri.path}/api.php?#{URI.encode_www_form({\n :action => 'query',\n :prop => 'info|revisions',\n :titles => BAN_PAGE,\n :rvprop => 'content',\n :intoken => 'edit',\n :indexpageids => 1,\n :format => 'json',\n :cb => rand(1000000)\n })}\", @headers).body,\n :symbolize_names => true\n )[:query]\n end", "def show\n @page = @chapter.pages.find_by_number(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def index\n @student_sources = StudentSource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @student_sources }\n end\n end", "def index\n @pages = Page.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Page.roots.map{|r| r.node}}\n end\n end", "def index\n respond_with(sources)\n end", "def show\n @Page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @Page }\n end\n end", "def show\n # TODO: this is a placeholder for logic using Sentence\n render :json => { :index => params[:id],\n :contents => \"SERVER: this would be the contents of page \" + params[:id]\n }\n end", "def get_page_source(page_url)\n url = URI.parse(page_url)\n req = Net::HTTP::Get.new(url.path)\n Net::HTTP.start(url.host, url.port) do |http|\n http.request(req)\n end\nend", "def index\n\t\t@pages = Page.order('created_at DESC').all\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.json { render json: @pages }\n\t\tend\n\tend", "def index\n #@sources = Source.all\n \n @sources = Source.search(params[:search], params[:page])\n \n @title = \"Sources\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sources }\n end\n end", "def index\n @sites = current_user.sites.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sources = Source.all\n end", "def index\n @financial_aid_sources = @financial_aid_package.sources\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financial_aid_sources }\n end\n end", "def show\n @document_page = DocumentPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document_page }\n end\n end", "def index\n @links = Link.paginate(page: params[:page])\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 @board = Board.find(params[:id])\n @content_years = @board.content_years.page(params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @board }\n end\n end", "def index\n @page = Page.find(params[:page_id])\n @revisions = @page.revisions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @revisions }\n end\n end", "def index\n @inventory_files = InventoryFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @inventory_files }\n end\n end", "def convictions_index_at_source\n page = get(base)\n page.search('div.listing-container ol li').map do |el|\n { 'link' => el.search('a').first['href'] }\n end\nend", "def index\n @enq_pages = EnqPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enq_pages }\n end\n end", "def index\n page = params[:page] || 1\n\n @global_jsons = CfTemplate.global\n\n respond_to do |format|\n format.json { @global_jsons = @global_jsons }\n format.html { @global_jsons = @global_jsons.page(page) }\n end\n end", "def show\n \t @pagenav = Page.find_all_by_published('true')\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @oasis_page = OasisPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oasis_page }\n end\n end", "def show\n @static_page = StaticPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @static_page }\n end\n end", "def show\n @static_page = StaticPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @static_page }\n end\n end", "def show\n @student_source = StudentSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_source }\n end\n end", "def set_source_page\n @source_page = SourcePage.find(params[:id])\n end", "def pages\n end", "def show\r\n @page = Page.find(params[:id])\r\n data = File.read(\"#{Rails.public_path}/#{@page.project_id}/#{@page.page_name}.html\")\r\n @page.update_attribute(:html , data)\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @page }\r\n end\r\n end", "def show\n @book_page = @book.book_pages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_page }\n end\n end", "def grab_project\n project_size = Project.all.length\n current_offset = (params[:payload][:pagenumber] - 1)*10\n direction = params[:payload][:direction]\n\n respond_to do |format|\n format.json {\n\n if current_offset + direction < project_size && current_offset + direction >= 0\n offset = current_offset + direction\n @projects = Project.all.offset(offset).take(10)\n render :json => @projects\n else \n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n \n }\n end\n end", "def show\n @nested_page = Nested::Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nested_page }\n end\n end", "def show\r\n @new_page = Page.new({project: @project, name: generate_new_page_name})\r\n @new_data_source = DataSource.new({project: @project})\r\n @pages_list = @project.pages.map {|i| [i.id, i.name]}\r\n @data_sources = @project.data_sources.includes(:data_source_type)\r\n end", "def show\n @page_template = PageTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_template }\n end\n end", "def index\n @about_pages = AboutPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @about_pages }\n end\n end", "def show\n @proxy_source = ProxySource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proxy_source }\n end\n end", "def pages; end", "def index\n @page_objects = PageObject.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @page_objects }\n format.tson { render :json => @page_objects }\n end\n end", "def show\n if admin?\n @page = Page.find_by_slug(params[:id]) \n else\n @page = Page.published.find_by_slug(params[:id]) \n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page, :only => [:title, :content] }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format| \n format.json {render json: @pages}\n format.xml {render xml: @pages}\n end\n\n end", "def show\n # turn ruby database into json\n # route to the project 3 page with this json\n # id = 1\n end", "def index\n @agent_import_files = AgentImportFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @agent_import_files }\n end\n end", "def index\n @pages = Page.all\n\n respond_with @pages\n end", "def create\n @source_page = SourcePage.new(source_page_params)\n\n respond_to do |format|\n if @source_page.save\n format.html { redirect_to @source_page, notice: 'Source page was successfully created.' }\n format.json { render :show, status: :created, location: @source_page }\n else\n format.html { render :new }\n format.json { render json: @source_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def sources_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_get ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'client_id'] = opts[:'client_id'] if opts[:'client_id']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'created_at'] = opts[:'created_at'] if opts[:'created_at']\n query_params[:'updated_at'] = opts[:'updated_at'] if opts[:'updated_at']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\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\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, 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 => 'inline_response_200_15')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_get. Result: #{result.inspect}\"\n end\n return result\n end", "def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @page }\n format.xml { render xml: @page }\n end\n end", "def show\n @admin_agency = Admin::Agency.where(:id => params[:id]).includes(:pages)[0]\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_agency }\n end\n end", "def lookup\n # gets a page (Hash) or a FB error\n page = @key_master.get_page(params[:name])\n respond_to do |format|\n format.json do\n render json: page, status: (page.is_a?(Hash) ? :ok : :not_found)\n end\n end\n end", "def page_source\n bridge.page_source\n end", "def booking\n page = @site.pages.where(order: 2).first\n unless page\n head 404\n else\n render json: { content: Content.where(page_id: page.id, order: 0).first }\n end\n end", "def index\n @sites = Site.paginate(:page=>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def page\n obj\n end", "def index\n # @donation_year_links = DonationYearLink.all\n @donation_year_links = DonationYearLink.order(:created_at).page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @donation_year_links }\n end\n end", "def index\n @general_frames = @university.general_frames.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @general_frames }\n end\n end", "def index\n render json: @links\n end", "def index\n @pages = Page.all\n respond_with(@pages)\n end", "def index\n @pages = Page.all\n respond_with(@pages)\n end", "def index\n @contents = Content.order('created_at DESC').paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end", "def list\n response = connect(base_url, :get)\n pagination_links(response)\n self.current_page = JSON.load(response.body)\n end", "def index\n @articles = Article.page(params[:page]).order(:pub_date,:source,:headline)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @declaration_containers = @declaration.declaration_containers.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @declaration_containers }\n end\n end", "def show\n @page_type = PageType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_type }\n end\n end" ]
[ "0.7342679", "0.6731636", "0.6605638", "0.6492692", "0.64293", "0.6428574", "0.63961655", "0.6385099", "0.6385099", "0.6385099", "0.6385099", "0.6385099", "0.6385099", "0.6385099", "0.6369304", "0.63363415", "0.6329705", "0.63288707", "0.6311444", "0.6306529", "0.62426126", "0.621901", "0.62146974", "0.6208858", "0.6199923", "0.6175214", "0.6173597", "0.61585736", "0.61585736", "0.6140735", "0.6132778", "0.6113542", "0.6104807", "0.6104807", "0.6104807", "0.6104807", "0.6104807", "0.6104807", "0.6104807", "0.6096782", "0.60897636", "0.6081693", "0.6076399", "0.60649204", "0.6055819", "0.6036958", "0.60359114", "0.60107577", "0.6002425", "0.60003924", "0.59933704", "0.5975354", "0.597151", "0.59714705", "0.5965916", "0.59636664", "0.5956799", "0.5948317", "0.5938565", "0.59357923", "0.5935488", "0.5925351", "0.5923582", "0.5923582", "0.5921682", "0.59178555", "0.59176487", "0.5910879", "0.5905033", "0.5900466", "0.5899933", "0.5896075", "0.5895614", "0.58803374", "0.5875", "0.586901", "0.58648926", "0.58606595", "0.5853813", "0.5847368", "0.5844518", "0.5843133", "0.58417284", "0.5841616", "0.5834272", "0.5830308", "0.5830225", "0.58170176", "0.5805907", "0.58040875", "0.5797945", "0.5791889", "0.5790527", "0.57885426", "0.5779998", "0.5779998", "0.5772786", "0.5767127", "0.5766611", "0.5763464", "0.57614565" ]
0.0
-1
POST /source_pages POST /source_pages.json
def create @source_page = SourcePage.new(source_page_params) respond_to do |format| if @source_page.save format.html { redirect_to @source_page, notice: 'Source page was successfully created.' } format.json { render :show, status: :created, location: @source_page } else format.html { render :new } format.json { render json: @source_page.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @page_content = PageContent.new(page_content_params)\n @page_content.parse_url(page_content_params[:source])\n\n respond_to do |format|\n if @page_content.save\n format.html { redirect_to action: :index }\n format.json { render json: @page_content, status: :created, location: @page_content }\n else\n format.html { render :new }\n format.json { render json: @page_content.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @source_pages = SourcePage.all\n end", "def source_page_params\n params.require(:source_page).permit(:url)\n end", "def sources_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_post ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\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 = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:POST, 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 => 'inline_response_200_16')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_post. Result: #{result.inspect}\"\n end\n return result\n end", "def create\n @page = Page.new(page_params)\n\n if @page.save\n render json: @page, status: :created, location: @page\n else\n render json: @page.errors, status: :unprocessable_entity\n end\n end", "def create\n @page = Page.new(params[:page])\n if @page.save\n respond_with(@page, location: api_pages_url)\n else\n respond_with(@page)\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.json { render json: @page, status: :created, location: [:api, @page] }\n format.xml { render xml: @page, status: :created, location: [:api, @page] }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n format.xml { render xml: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n response = @page.parse_url\n render json: response\n end", "def create\n respond_to do |format|\n begin\n @page = Page.create_page!\n format.html { redirect_to \"/#{@page.request_id}/inspect\", notice: t('pages.create.success') }\n format.json { render action: 'show', status: :created, location: @page }\n rescue => e\n format.html { render action: 'index' }\n format.json { render json: {:message => \"create page error\"}, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nested_page = Nested::Page.new(params[:nested_page])\n\n respond_to do |format|\n if @nested_page.save\n format.html { redirect_to @nested_page, notice: 'Page was successfully created.' }\n format.json { render json: @nested_page, status: :created, location: @nested_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nested_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def copy_wiki_pages\n index = []\n puts \"--------------------FINDING PAGES--------------------\"\n findPages(\"\",index)\n puts \"--------------------COPYING RESOURCES--------------------\"\n copyResources()\n puts \"--------------------GENERATING MENU--------------------\"\n defineLayoutMenu()\n \n File.open(\"lunr.json\",\"w\") do |f|\n f.write(JSON.generate(index))\n end\nend", "def create\r\n html=params[:page][:html]\r\n @page = Page.new(params[:page])\r\n respond_to do |format|\r\n if @page.save\r\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\r\n format.json { render json: @page, status: :created, location: @page }\r\n target = \"#{Rails.public_path}/#{@page.project_id}/#{@page.page_name}.html\"\r\n if !File.directory?(\"#{Rails.public_path}/#{@page.project_id}\")\r\n Dir.mkdir(\"#{Rails.public_path}/#{@page.project_id}\")\r\n Dir.mkdir(\"#{Rails.public_path}/#{@page.project_id}/images\")\r\n end\r\n File.open(target, \"w+\") do |f|\r\n f.write(html)\r\n end\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @page.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @source_page.update(source_page_params)\n format.html { redirect_to @source_page, notice: 'Source page was successfully updated.' }\n format.json { render :show, status: :ok, location: @source_page }\n else\n format.html { render :edit }\n format.json { render json: @source_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n @pages = current_user.pages\n format.html { redirect_to page_url(@page), notice: \"Page was successfully created.\" }\n format.json { render :show, status: :created, location: @page }\n flash.now[:notice] = \"Page was successfully created.\"\n format.turbo_stream { render \"shared/index\", locals: { object: Page.new, objects: @pages } }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_pdf_insert_pages_with_http_info(source_file, destination_file, page_start_source, page_end_source, page_insert_before_desitnation, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EditPdfApi.edit_pdf_insert_pages ...'\n end\n # verify the required parameter 'source_file' is set\n if @api_client.config.client_side_validation && source_file.nil?\n fail ArgumentError, \"Missing the required parameter 'source_file' when calling EditPdfApi.edit_pdf_insert_pages\"\n end\n # verify the required parameter 'destination_file' is set\n if @api_client.config.client_side_validation && destination_file.nil?\n fail ArgumentError, \"Missing the required parameter 'destination_file' when calling EditPdfApi.edit_pdf_insert_pages\"\n end\n # verify the required parameter 'page_start_source' is set\n if @api_client.config.client_side_validation && page_start_source.nil?\n fail ArgumentError, \"Missing the required parameter 'page_start_source' when calling EditPdfApi.edit_pdf_insert_pages\"\n end\n # verify the required parameter 'page_end_source' is set\n if @api_client.config.client_side_validation && page_end_source.nil?\n fail ArgumentError, \"Missing the required parameter 'page_end_source' when calling EditPdfApi.edit_pdf_insert_pages\"\n end\n # verify the required parameter 'page_insert_before_desitnation' is set\n if @api_client.config.client_side_validation && page_insert_before_desitnation.nil?\n fail ArgumentError, \"Missing the required parameter 'page_insert_before_desitnation' when calling EditPdfApi.edit_pdf_insert_pages\"\n end\n # resource path\n local_var_path = '/convert/edit/pdf/pages/insert'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'pageStartSource'] = page_start_source\n header_params[:'pageEndSource'] = page_end_source\n header_params[:'pageInsertBeforeDesitnation'] = page_insert_before_desitnation\n\n # form parameters\n form_params = {}\n form_params['sourceFile'] = source_file\n form_params['destinationFile'] = destination_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EditPdfApi#edit_pdf_insert_pages\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n redirect_to pages_path\n end", "def publish\n @page.publish\n respond_with(@page, location: published_api_pages_url)\n end", "def pages\n end", "def create\n @page = Page.new(params[:page])\n \n if @page.save\n respond_to do |format|\n format.json { render :json => @page, :status => :created }\n format.xml { render :xml => @page, :status => :created }\n end\n else\n respond_to do |format|\n format.json { raise Palani::Api::InvalidRecordJSONException }\n format.xml { raise Palani::Api::InvalidRecordXMLException }\n end\n end\n end", "def set_source_page\n @source_page = SourcePage.find(params[:id])\n end", "def transform_pages(dir = '', source = self.source)\n base = File.join(source, dir)\n entries = filter_entries(Dir.entries(base))\n directories = entries.select { |e| File.directory?(File.join(base, e)) }\n files = entries.reject { |e| File.directory?(File.join(base, e)) }\n\n [directories, files].each do |entries|\n # we need to make sure to process _posts *first* otherwise they \n # might not be available yet to other templates as {{ site.posts }}\n if entries.include?('_posts')\n entries.delete('_posts')\n read_posts(dir)\n end\n entries.each do |f|\n if File.symlink?(File.join(base, f))\n # preserve symlinks\n FileUtils.mkdir_p(File.join(self.dest, dir))\n File.symlink(File.readlink(File.join(base, f)),\n File.join(self.dest, dir, f))\n elsif File.directory?(File.join(base, f))\n next if self.dest.sub(/\\/$/, '') == File.join(base, f)\n transform_pages(File.join(dir, f), source)\n else\n first3 = File.open(File.join(source, dir, f)) { |fd| fd.read(3) }\n \n # if the file appears to have a YAML header then process it as a page\n if first3 == \"---\"\n # file appears to have a YAML header so process it as a page\n page = Page.new(source, dir, f)\n page.add_layout(self.layouts, site_payload)\n page.write(self.dest)\n else\n # otherwise copy the file without transforming it\n FileUtils.mkdir_p(File.join(self.dest, dir))\n FileUtils.cp(File.join(source, dir, f), File.join(self.dest, dir, f))\n end\n end\n end\n end\n end", "def create\n #Each Page could be tied to an ApiKey or set of ApiKeys for security\n @page = Page.new(page_params)\n #Render the object created or errors\n respond_to do |format|\n if @page.save\n #Cache bust pages\n Rails.cache.delete(\"pages\")\n format.json { render action: 'show', status: :created, location: api_page_url(@page) }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n url = params['url']\n doc = Crawl::PageHandler.fetch_page(url)\n page_data = Crawl::PageHandler.parse_page(url, doc)\n page = Page.create(url: url,\n chksum: Zlib.crc32(url),\n parsed: page_data.to_json)\n render json: { url: page[:url],\n chksum: page[:chksum],\n parsed: page[:parsed] }\n end", "def create\n @page = Page.new(params[:page])\n\n if @page.save\n respond_to do |format|\n format.json {render json: @page, status: :created }\n format.xml {render xml: @page, status: :created}\n end\n \n else\n respond_to do |format|\n format.json {render json: @page.errors, status: :unprocessable_entity}\n format.xml {render xml: @page.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\n @page = Page.new(page_params)\n respond_to do |format|\n if @page.save\n self.build_pages_tree\n format.html { redirect_to @pages_tree[@page.id], notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @structure_page = Structure::Page.new(params[:structure_page])\n\n respond_to do |format|\n if @structure_page.save\n format.html { redirect_to @structure_page, notice: 'Page was successfully created.' }\n format.json { render json: @structure_page, status: :created, location: @structure_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @structure_page.errors, status: :unprocessable_entity }\n end\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 create\n @test_page = TestPage.new(params[:test_page])\n\n respond_to do |format|\n if @test_page.save\n format.html { redirect_to @test_page, notice: 'Test page was successfully created.' }\n format.json { render json: @test_page, status: :created, location: @test_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def generate_source_map_page(source_map)\n return if associate_page_failed?\n\n source_map_page.source_map(source_map)\n site.pages << source_map_page\n end", "def new\n get_sources\n @stg_source = StgSource.all\n @report = Report.find(params[:report_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @source }\n end\n end", "def create\r\n @project = current_user.projects.new(project_params)\r\n new_page = @project.pages.new({ name: generate_new_page_name})\r\n @project.startpage = new_page\r\n @project.date_created = Time.now\r\n @project.last_modified = Time.now\r\n respond_to do |format|\r\n if @project.save\r\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: @project }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @project.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def pages; end", "def create\n @source = Source.new(source_params)\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to edit_source_path(@source), notice: 'Source was successfully created.' }\n format.json { render :show, status: :created, location: @source }\n else\n format.html { render :new }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @story = Story.find(params[:story_id])\n @page = @story.pages.build(page_params)\n\n @parent = Page.find(params[:parent_id]);\n\n if @page.save!\n if(params[:parent_id] && params[:choice_text])\n @parent = Page.find(params[:parent_id]);\n @branch = @parent.branches.build(destination_id: @page.id, choice_text: params[:choice_text], story_id: @story.id)\n\n if !@branch.save\n render json: { error: \"Error saving page\", status: 400 }, status: 400\n end\n\n if !@parent.save\n render json: { error: \"Error saving page\", status: 400 }, status: 400\n end\n end\n\n render json: @parent, status: 201\n end\n end", "def index\n @pages = Page.all\n render json: @pages\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to pages_path, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @page = current_site.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def create\n respond_with(@page = Page.create(params[:page]), :status => :created)\n end", "def create\n @student_source = StudentSource.new(params[:student_source])\n\n respond_to do |format|\n if @student_source.save\n format.html { redirect_to student_sources_path, notice: 'Student source was successfully created.' }\n format.json { render json: @student_source, status: :created, location: @student_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.find params[:project_id]\n @file = @project.source_files.create :name=>params[:name], :code=>params[:code]\n\n respond_to do |format|\n if @file.save \n format.html {redirect_to @project}\n format.json {render json: @file}\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n flash[:notice] = 'The source was successfully created.' if source.save\n respond_with(source)\n end", "def create\n @source_web = SourceWeb.new(source_web_params)\n\n respond_to do |format|\n if @source_web.save\n format.html { redirect_to @source_web, notice: 'Source web was successfully created.' }\n format.json { render :show, status: :created, location: @source_web }\n else\n format.html { render :new }\n format.json { render json: @source_web.errors, status: :unprocessable_entity }\n end\n end\n end", "def page_source; end", "def new\n \n @page = Page.new\n @page.images.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\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 create\n params[:page].except!(:map_info) unless params[:page][:map_info].present?\n @page = current_user.pages.new(params[:page])\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n @business = Business.select('id, title')\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n begin\n ActiveRecord::Base.transaction do\n @page = Page.new(\n page_slug: params[\"page\"][\"page_slug\"],\n title: params[\"page\"][\"title\"],\n tag_list: params[\"page\"][\"tags\"]\n )\n @page.save!\n @version = Version.new(body: params[\"page\"][\"body\"], page: @page)\n @version.save!\n end\n respond_to do |format|\n format.html { redirect_to action: \"show\", slug: page_params[:page_slug] , notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n end\n rescue => @err\n respond_to do |format|\n @page.body = params[\"page\"][\"body\"]\n format.html { render :new }\n format.json { render json: @err, status: :unprocessable_entity }\n end\n end\n end", "def edit_pdf_insert_pages(source_file, destination_file, page_start_source, page_end_source, page_insert_before_desitnation, opts = {})\n data, _status_code, _headers = edit_pdf_insert_pages_with_http_info(source_file, destination_file, page_start_source, page_end_source, page_insert_before_desitnation, opts)\n data\n end", "def create\n @source = new_source\n respond_to do |format|\n # We must check for manually added errors first, as they\n # are lost when .valid? is called during the callback chain.\n if !@source.errors.any? && @source.save\n format.html { redirect_to url_for(@source.metamorphosize),\n notice: \"#{@source.type} successfully created.\" }\n format.json { render action: 'show', status: :created, location: @source.metamorphosize }\n else\n format.html { render action: 'new' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = current_site.pages.new(params[:page])\n @site = @page.site\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @document_page = DocumentPage.new(params[:document_page])\n\n respond_to do |format|\n if @document_page.save\n format.html { redirect_to @document_page, notice: 'Document page was successfully created.' }\n format.json { render json: @document_page, status: :created, location: @document_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\r\n @page = Page.new\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @page }\r\n end\r\n end", "def create\n @pagemaster = Pagemaster.new(pagemaster_params)\n\n respond_to do |format|\n if @pagemaster.save\n format.html { redirect_to @pagemaster, notice: 'Pagemaster was successfully created.' }\n format.json { render :show, status: :created, location: @pagemaster }\n else\n format.html { render :new }\n format.json { render json: @pagemaster.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n flash[:notice] = 'The page was successfully created.' if page.save\n respond_with(page, location: project_page_path(page.project, page))\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to [:admin, @page], notice: 'Страница успешно создана.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n\n @project.urls.each_line do |url|\n puts \"saving #{url}\"\n url.strip!\n page = Page.create(:schedule => @project.schedule, :runtime => @project.startdate, :url => url, :project => @project)\n end \n\n \n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page, :only => [:title, :content] }\n end\n end", "def get_source\n # must set max nesting. default limit of 20 is too low for selendroid\n JSON.parse @driver.page_source, max_nesting: 9999\n end", "def new\n @nested_page = Nested::Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nested_page }\n end\n end", "def create\n @post = Post.new(post_params)\n if @post.save\n redirect_to find_redirect(@post.page)\n else\n render :new\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "def load_pages_json(pages_json_path)\n basename = File.basename pages_json_path\n rel_dir = File.dirname pages_json_path\n rel_dir = rel_dir[self.source.size..rel_dir.size]\n page = ::JekyllPagesApi::PageWithoutAFile.new(\n self, self.source, rel_dir, basename)\n page.output = File.read(pages_json_path)\n self.pages << page\n end", "def create\n @page = Page.new(params[:page])\n \n\n respond_to do |format|\n if @page.save\n @page.update_attribute('published_at', Time.now) if params[:commit] == 'Publish'\n \n if params[:commit] == 'Publish'\n format.html { redirect_to root_page_path(@page), notice: 'Page was successfully published.' }\n else\n format.html { redirect_to edit_page_path(@page), notice: 'Page was successfully created.' }\n end\n format.json { render json: @page, status: :created, location: @page, :only => [:title, :content] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = ContentPage.new :title => t(\"new_page\")\n @page.update_sorting params[:drop_id], params[:position]\n \n render :json => { :text => @page.title, :id => @page.id, :icon => @page.icon, \n :cls => @page.type, :leaf => false, :expanded => true, :allowDrag => true, \n :allowDrop => true, :draggable => true }\n end", "def create\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @source_page.destroy\n respond_to do |format|\n format.html { redirect_to source_pages_url, notice: 'Source page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def new_page\n @vendor = Vendor.find(current_user)\n @page = Page.new\n @page.site_id = params[:site_id]\n @page.template_id = 1\n @page.page_name = \"PAGE\"\n @page.language = \"en\"\n @page.theme_id = 1 \n respond_to do |format|\n if @page.save\n #Construct the path for the destination page file\n @page_path = 'public/sites/' + @vendor.id.to_s + \"/\" + @page.site_id.to_s + \"/\" + @page.id.to_s + '.html' \n File.open(@page_path, \"w+\") do |f|\n f.write(\"<html><head></head><body bgcolor='#E6E6FA'>Page \" + @page.id.to_s + \"</body></html>\") \n end\n #redirect to the view and render the partial\n format.html { redirect_to page_manage_path}\n format.js\n format.json { render json: @page, \n status: :created, location: @page }\n else \n format.html { render action: \"new\" }\n format.json { render json: @page.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def new\n @structure_page = Structure::Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @structure_page }\n end\n end", "def create\n @story_page = StoryPage.new(story_page_params)\n\n respond_to do |format|\n if @story_page.save\n format.html { redirect_to @story_page, notice: 'Story page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @story_page }\n else\n format.html { render action: 'new' }\n format.json { render json: @story_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @oasis_page = OasisPage.new(params[:oasis_page])\n\n respond_to do |format|\n if @oasis_page.save\n format.html { redirect_to @oasis_page, notice: 'Oasis page was successfully created.' }\n format.json { render json: @oasis_page, status: :created, location: @oasis_page }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @oasis_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_pages_list\n @project = AzProject.find(params[:id])\n project_hash = @project.to_az_hash\n pp project_hash\n AzProject.build_from_az_hash(project_hash)\n respond_to do |format|\n format.html { render :text => \"OK\"}\n end\n end", "def create\n @source = Source.new(params[:source])\n\n respond_to do |format|\n if @source.save\n track_activity @source\n format.html { redirect_to @source, notice: 'Source was successfully created.' }\n format.json { render json: @source, status: :created, location: @source }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def assign_pages!\n payload[\"page\"] = document.to_liquid\n payload[\"paginator\"] = (document.pager.to_liquid if document.respond_to?(:pager))\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 respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def create(params)\n put(\"v1/fundraising/pages\", {:basic_auth => true}.merge(params))\n end", "def create\n @page_page = PagePage.new(page_page_params)\n\n respond_to do |format|\n if @page_page.save\n format.html { redirect_to @page_page, notice: 'Page page was successfully created.' }\n format.json { render :show, status: :created, location: @page_page }\n else\n format.html { render :new }\n format.json { render json: @page_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @source = Source.new\n @sources = current_user.sources\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @source }\n end\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n @contribution = @page.contributions.build(:user_id => current_user.id)\n @contribution.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book_page = @book.book_pages.build(params[:book_page])\n\n respond_to do |format|\n if @book_page.save\n format.html { redirect_to book_series_collection_book_book_pages_url(@book_series, @collection, @book), \n notice: 'Book page was successfully created.' }\n format.json { render json: @book_page, status: :created, location: @book_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = current_site.pages.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to quick_page_path(@page), notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def new\n\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def pages\n get(\"v1/event/#{@id}/pages\")\n end", "def create\n @source = Source.new(params[:source])\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to(@source, :notice => 'Source was successfully created.') }\n format.xml { render :xml => @source, :status => :created, :location => @source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @document_page = DocumentPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_page }\n end\n end", "def create\n @key_master.to_page params['page'][:external_id] if params['page'][:external_id].present?\n\n redirect_to root_path\n end", "def create\n @payment_source = PaymentSource.new(params[:payment_source])\n\n respond_to do |format|\n if @payment_source.save\n format.html { redirect_to @payment_source, notice: 'Payment source was successfully created.' }\n format.json { render json: @payment_source, status: :created, location: @payment_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.64984274", "0.63137054", "0.60895956", "0.5994911", "0.5934387", "0.58606017", "0.581993", "0.5813985", "0.5761937", "0.574922", "0.56969917", "0.56501156", "0.5624956", "0.5621818", "0.5608349", "0.55928504", "0.55894256", "0.5567207", "0.5566975", "0.5561011", "0.553516", "0.55284095", "0.5513462", "0.55085075", "0.55006534", "0.54595375", "0.54537535", "0.5437461", "0.54271305", "0.5416872", "0.541393", "0.5406115", "0.5400885", "0.5394871", "0.53898084", "0.5373559", "0.5363861", "0.5358141", "0.5355221", "0.53441393", "0.53421384", "0.53421384", "0.53421384", "0.53421384", "0.53421384", "0.53421384", "0.5335608", "0.5331814", "0.53313506", "0.53254986", "0.5323289", "0.53179294", "0.5303138", "0.53010565", "0.52978957", "0.5296533", "0.52890056", "0.5284236", "0.5284049", "0.52824503", "0.5281915", "0.5275734", "0.5275493", "0.52692515", "0.52690774", "0.5267378", "0.5258087", "0.52508646", "0.5248104", "0.5242092", "0.5241633", "0.5240824", "0.5240824", "0.5240824", "0.5240824", "0.5240824", "0.5235101", "0.5232269", "0.52317", "0.5228276", "0.5221123", "0.5216783", "0.5205326", "0.52029634", "0.5192699", "0.5190088", "0.51843256", "0.5184158", "0.5183683", "0.51807743", "0.5180122", "0.51762986", "0.51745796", "0.5174193", "0.5173854", "0.51712626", "0.5167361", "0.51650554", "0.51650554", "0.51640964" ]
0.7266694
0
PATCH/PUT /source_pages/1 PATCH/PUT /source_pages/1.json
def update respond_to do |format| if @source_page.update(source_page_params) format.html { redirect_to @source_page, notice: 'Source page was successfully updated.' } format.json { render :show, status: :ok, location: @source_page } else format.html { render :edit } format.json { render json: @source_page.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if page_params[:body]\n @page.versions << Version.new(body: page_params[:body], title: page_params[:title]).save\n page_params.delete :body\n end\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to controller: \"pages\", action: \"show\", slug: @page[:page_slug], notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n format.xml { render xml: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:page][:id])\n if current_user.id != @page.owner_id\n not_found\n end\n @page.partial_update(params)\n respond_to do |format|\n format.json {\n render partial: 'pages/page.json'\n }\n end\n end", "def update\n source = Source.find params[:id]\n\n if source.update(raw_html: params[:raw_html])\n respond_to do |format|\n format.json { head :ok }\n end\n else\n respond_to do |format|\n format.json { head :unprocessable_entity }\n end\n end\n end", "def update\r\n @page = Page.find(params[:id])\r\n respond_to do |format|\r\n if @page.update_attributes(params[:page])\r\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\r\n format.json { head :no_content }\r\n target = \"#{Rails.public_path}/#{@page.project_id}/#{@page.page_name}.html\"\r\n File.open(target, \"w\") do |f|\r\n f.write(@page.html)\r\n end\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @page.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @source.update(source_params)\n # We go through this dance to handle changing types from verbatim to other\n @source = @source.becomes!(@source.type.safe_constantize)\n @source.reload # necessary to reload the cached value.\n format.html { redirect_to url_for(@source.metamorphosize), notice: 'Source was successfully updated.' }\n format.json { render :show, status: :ok, location: @source.metamorphosize }\n else\n format.html { render action: 'edit' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n @page.section_id = params[:section_id] unless params[:section_id].nil? \n @page.title = params[:title] unless params[:title].nil? \n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n #ormat.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #Render the object created or errors\n respond_to do |format|\n if @page.update(page_params)\n #Cache bust pages and updated page. With pagination we would only bust the cache of the page that was updated.\n Rails.cache.delete(\"pages\")\n Rails.cache.delete(\"page-#{@page.id}\")\n format.json { render action: 'show', status: :ok, location: api_page_url(@page) }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @sources = args[:sources] if args.key?(:sources)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @sources = args[:sources] if args.key?(:sources)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @sources = args[:sources] if args.key?(:sources)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @sources = args[:sources] if args.key?(:sources)\n end", "def update\n @nested_page = Nested::Page.find(params[:id])\n\n respond_to do |format|\n if @nested_page.update_attributes(params[:nested_page])\n format.html { redirect_to @nested_page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nested_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to @source, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to pages_path, sucess: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to edit_source_path, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @patch_deployments = args[:patch_deployments] if args.key?(:patch_deployments)\n end", "def update\n @document_page = DocumentPage.find(params[:id])\n\n respond_to do |format|\n if @document_page.update_attributes(params[:document_page])\n format.html { redirect_to @document_page, notice: 'Document page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: \"Page was successfully updated. #{undo_link}\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @structure_page = Structure::Page.find(params[:id])\n\n respond_to do |format|\n if @structure_page.update_attributes(params[:structure_page])\n format.html { redirect_to @structure_page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @structure_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n @page.update_attributes(params[:page])\n respond_with(@page, :status => :updated)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @resources = args[:resources] if args.key?(:resources)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @resources = args[:resources] if args.key?(:resources)\n end", "def update\n @page = Page.find(params[:id])\n @page.update_attributes(params[:page])\n respond_with(@page)\n end", "def update\n @page = Page.find(params[:id])\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to pages_path, notice: 'Page was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = current_site.pages.find_by_permalink(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to quick_page_path(@page), notice: 'Page 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: @page.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n track_activity(@source, 'update', @source.previous_changes)\n format.html { redirect_to @source, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to page_path(@page), notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n source = Source.find_by(id: params[:source_id])\n unless source_params[:name] == source.name\n render json: {error: 'You cannot change external api for a source, you must delete that source if you wish to remove it'}, status: :unprocessable_entity\n end\n if source && all_sources.include?(source)\n source.access_token = source_params[:access_token]\n source.account_id = source_params[:account_id]\n if source.save\n render json: { id: source.id, name: source.name, access_token: source.access_token, account_id: source.account_id }, status: :found\n else\n render json: source.errors, status: :unprocessable_entity\n end\n else\n render json: {error: \"could not find source with source id of #{params[:source_id]}\"}, status: :not_found\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @patch_jobs = args[:patch_jobs] if args.key?(:patch_jobs)\n end", "def update\n @page = Page.find(params[:id])\n\n if @page.update_attributes(params[:page])\n respond_to do |format|\n format.json {render json: @page, status: :created }\n format.xml {render xml: @page, status: :created}\n end\n \n else\n respond_to do |format|\n format.json {render json: @page.errors, status: :unprocessable_entity}\n format.xml {render xml: @page.errors, status: :unprocessable_entity}\n end\n end\n end", "def update!(**args)\n @documents = args[:documents] if args.key?(:documents)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @documents = args[:documents] if args.key?(:documents)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @page_info = args[:page_info] if args.key?(:page_info)\n @request_id = args[:request_id] if args.key?(:request_id)\n @resources = args[:resources] if args.key?(:resources)\n @token_pagination = args[:token_pagination] if args.key?(:token_pagination)\n end", "def update\n respond_to do |format|\n if @source.update(source_params)\n format.html { redirect_to edit_source_path(@source), notice: 'Source was successfully updated.' }\n format.json { render :show, status: :ok, location: @source }\n else\n format.html { render :edit }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = current_site.pages.find(params[:id])\n @site = @page.site\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to(@page, :notice => 'Page was successfully updated.') }\n format.json { respond_with_bip(@page) }\n else\n format.html { render :action => \"edit\" }\n format.json { respond_with_bip(@page) }\n end\n end\n end", "def update\n head :no_content\n end", "def update\n head :no_content\n end", "def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @resources = args[:resources] if args.key?(:resources)\n end", "def update!(**args)\n @content = args[:content] if args.key?(:content)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def edit\n respond_with(source)\n end", "def update\n @page = current_cms.pages.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:big_cms_page])\n format.html { render :action => \"edit\" }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @oasis_page = OasisPage.find(params[:id])\n\n respond_to do |format|\n if @oasis_page.update_attributes(params[:oasis_page])\n format.html { redirect_to @oasis_page, notice: 'Oasis page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oasis_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @files = args[:files] if args.key?(:files)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update\n @pages_feature = Page.where(site_id: @site.id, published: true, feature_on_homepage: true).all\n @page_root = Page.where(site_id: @site.id).roots.all\n @title = @page.title\n respond_to do |format|\n session[:return_to] ||= request.referer\n if @page.update(page_params)\n format.html { redirect_to session.delete(:return_to), notice: 'Saved' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book_page = @book.book_pages.find(params[:id])\n\n respond_to do |format|\n if @book_page.update_attributes(params[:book_page])\n format.html { redirect_to book_series_collection_book_book_page_url(@book_series, @collection, @book, @book_page), notice: 'Book page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @page_info = args[:page_info] unless args[:page_info].nil?\n @resources = args[:resources] unless args[:resources].nil?\n @token_pagination = args[:token_pagination] unless args[:token_pagination].nil?\n end", "def update\n\n respond_to do |format|\n if @page_object.update_attributes(params[:page_object])\n flash[:notice] = 'PageObject was successfully updated.'\n format.html { redirect_to(@page_object) }\n format.xml { head :ok }\n format.tson { head :ok }\n else\n render_to_page_object\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page_object, :status => :unprocessable_entity }\n format.tson { render :json => @page_object, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize @page_content.page, :update?\n\n respond_to do |format|\n if @page_content.update(page_content_params)\n format.json { render :show, status: :ok, location: @page_content }\n else\n format.json { render json: @page_content.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n # format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.html { redirect_to action: \"edit\", id: params[:id], notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "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 update\n @page = Page.find(params[:id])\n \n Rails.logger.info \"ID: #{params[:id]}\"\n Rails.logger.info \"BODY: #{params[:page][:body].inspect}\"\n\n # Convert <div> line breaks to <p>\n params[:page][:body] = params[:page][:body].gsub(/\\<div\\>/, '<p>')\n params[:page][:body] = params[:page][:body].gsub(/\\<\\/div\\>/, '</p>')\n params[:page][:body] = params[:page][:body].gsub(/\\<p\\>\\<br\\>\\<\\/p\\>/, '')\n params[:page][:body] = params[:page][:body].gsub(/\\<br\\>/, '')\n \n respond_to do |format|\n if @page.update_attributes(params[:page])\n Rails.logger.info \"UPDATED PAGE!\"\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :json => @page }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.json {render json: @page}\n format.xml {render xml: @page}\n end\n end", "def update\n if @page.update_attributes(params[:page])\n respond_with(@page)\n else\n respond_with(@page)\n end\n end", "def update(options = {})\n\n # Ensure we get extracted_content as well\n options[:include_content] = true\n\n body = { :page => { :uri => self.uri, :options => options } }\n\n api_url = \"/collections/#{self.collection.attributes[:token]}/pages/#{self.identifier}\"\n response = @muddyit.send_request(api_url, :put, {}, body.to_json)\n return Muddyit::Collections::Collection::Pages::Page.new(@muddyit, response['page'].merge!(:collection => self.collection))\n end", "def update!(**args)\n @assets = args[:assets] if args.key?(:assets)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @assets = args[:assets] if args.key?(:assets)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @versions = args[:versions] if args.key?(:versions)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @versions = args[:versions] if args.key?(:versions)\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_page = TestPage.find(params[:id])\n\n respond_to do |format|\n if @test_page.update_attributes(params[:test_page])\n format.html { redirect_to @test_page, notice: 'Test page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @content_source = ContentSource.find(params[:id])\n\n respond_to do |format|\n if @content_source.update_attributes(params[:content_source])\n format.html { redirect_to(@content_source, :notice => 'Content source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @content_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @schemas = args[:schemas] if args.key?(:schemas)\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to admin_subject_pages_path, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @document_links = args[:document_links] if args.key?(:document_links)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @document_links = args[:document_links] if args.key?(:document_links)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n @pages = current_user.pages\n format.html { redirect_to page_url(@page), notice: \"Page was successfully updated.\" }\n format.json { render :show, status: :ok, location: @page }\n flash.now[:notice] = \"Page was successfully updated.\"\n format.turbo_stream { render \"shared/update\", locals: { object: @page, short: @short } }\n\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @source_ref.update(source_ref_params)\n format.html { redirect_to @source_ref, notice: 'Source ref was successfully updated.' }\n format.json { render :show, status: :ok, location: @source_ref }\n else\n format.html { render :edit }\n format.json { render json: @source_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n @source = params[:source]\n\n allowed_hash = {:allow_anonymous => params[:allow_anonymous], :allow_turk => params[:allow_turk], :allow_interstitial => params[:allow_interstitial]}\n params[:project][:meta] = allowed_hash.to_json\n \n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = 'Project was successfully updated.'\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n format.all { render_501 }\n end\n end", "def update\n respond_to do |format|\n if @source_master.update(source_master_params)\n format.html { redirect_to @source_master, notice: \"Source master was successfully updated.\" }\n format.json { render :show, status: :ok, location: @source_master }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @source_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to(@source, :notice => 'Source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to(@source, :notice => 'Source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @page = ContentPage.find(params[:id])\n respond_to do |format|\n if @page.update_attributes(params[:content_page])\n @editingPage = false\n format.html { redirect_to show_content_pages_path(@page.id), notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_content_pages_path(@page.id), alert: 'Unable to update Page successfully.'}\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @patch_job_instance_details = args[:patch_job_instance_details] if args.key?(:patch_job_instance_details)\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @pages_tree[(@page.id).to_s], notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @document_schemas = args[:document_schemas] if args.key?(:document_schemas)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update\n respond_to do |format|\n if @source_file.update(source_file_params)\n format.html { redirect_to @source_file, notice: 'Source file was successfully updated.' }\n format.json { render :show, status: :ok, location: @source_file }\n else\n format.html { render :edit }\n format.json { render json: @source_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page_template = PageTemplate.find(params[:id])\n\n respond_to do |format|\n if @page_template.update_attributes(params[:page_template])\n format.html { redirect_to @page_template, notice: 'Page template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n head :ok\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @verifications = args[:verifications] if args.key?(:verifications)\n end", "def update\n @page_chunk = PageChunk.find(params[:id])\n #TODO: Not sure why \"undefined\" is a key.\n #TODO: multiple editable section on one page not working; the content for the last\n # is always \n @page_chunk.content = params[:content][:undefined][:value]\n @page_chunk.save!\n\n render text: \"\"\n=begin\n respond_to do |format|\n if @page_chunk.update(page_chunk_params)\n format.html { redirect_to @page_chunk, notice: 'Page chunk was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page_chunk.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "def update\n if @page.update_attributes(params[:page])\n respond_to do |format|\n format.json { render :json => @page }\n format.xml { render :xml => @page }\n end\n else\n respond_to do |format|\n format.json { raise Palani::Api::InvalidUpdateOfRecordJSONException }\n format.xml { raise Palani::Api::InvalidUpdateOfRecordXMLException }\n end\n end\n end", "def update\n # @page = Page.new(page_params)\n\n # @page.components.build\n # @page.update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n # looking for a page with a specific id \n @pages = Page.find(params[:id])\n\n # updates with new information\n if @page.update(pages_params)\n redirect_to pages_path\n else \n render :edit \n end\n end", "def update\n\n #find the page with given id\n @page = Page.find(params[:id])\n\n #use updated_at manually, it will update the page table if user hits update button.\n # This may not be trivial, so it may change.\n @page.updated_at = Time.now\n\n #retrieving layout id from params and assigning to a variable\n @layout = @page[:layout_id]\n\n # calling method to find all pages and page parts\n find_pages_and_parts(@layout)\n\n #sends in data in different format\n respond_to do |format|\n\n if @page.update_attributes(params[:page]) #page updated successfully\n\n format.html { redirect_to admin_pages_path, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n\n else #page saving failed, re-renders edit template\n\n format.html { render action: \"edit\", :template => 'mcms_pages/admin/pages/edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n\n end # end if\n\n end # end respond_to block\n\n end", "def update\n @student_source = StudentSource.find(params[:id])\n\n respond_to do |format|\n if @student_source.update_attributes(params[:student_source])\n format.html { redirect_to @student_source, notice: 'Student source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to [:admin, @page], notice: 'Страница успешно создана.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to(pages_path, :notice => 'Page was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n respond_with(page)\n end", "def update\n @sync_page = SyncPage.find(params[:id])\n\n respond_to do |format|\n if @sync_page.update_attributes(params[:sync_page])\n format.html { redirect_to @sync_page, notice: 'Sync page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sync_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find_by_slug(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n @page.update_attribute('published_at', Time.now) if params[:commit] == 'Publish'\n @page.update_attribute('published_at', nil) if params[:commit] == 'Unpublish'\n \n if params[:commit] == 'Publish'\n format.html { redirect_to root_page_path(@page), notice: 'Page was successfully published.' }\n else\n format.html { redirect_to edit_page_path(@page), notice: 'Page was successfully updated.' }\n end\n \n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n @newspage = Newspage.find(params[:id])\n\n respond_to do |format|\n if @newspage.update_attributes(params[:newspage])\n format.html { redirect_to @newspage, notice: 'Newspage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @newspage.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.63405675", "0.6305989", "0.62710017", "0.6133108", "0.6094509", "0.6078191", "0.60213166", "0.6012595", "0.6003819", "0.6003819", "0.6003819", "0.6003819", "0.59964716", "0.59912753", "0.59912425", "0.59846365", "0.59803873", "0.5953242", "0.5950793", "0.59464306", "0.5942639", "0.5927545", "0.5927545", "0.59270513", "0.5918205", "0.591715", "0.59116966", "0.59114456", "0.59114456", "0.58978045", "0.58893275", "0.5875625", "0.5875625", "0.5866615", "0.5856194", "0.58546436", "0.5841996", "0.5841996", "0.58266723", "0.58240527", "0.58205473", "0.58169013", "0.58169013", "0.5814236", "0.5804286", "0.5802471", "0.5793846", "0.5782344", "0.5768218", "0.5756778", "0.57542825", "0.575139", "0.57498235", "0.5748119", "0.5747469", "0.5744902", "0.57231903", "0.57164615", "0.57159406", "0.56937057", "0.5682754", "0.5682754", "0.56802976", "0.56802976", "0.5677451", "0.5677451", "0.5677413", "0.5675466", "0.5669055", "0.5668478", "0.56646186", "0.56646186", "0.5658615", "0.5656275", "0.5656019", "0.56521696", "0.56521285", "0.5642812", "0.5642812", "0.5629259", "0.5626051", "0.5622535", "0.56199044", "0.5617625", "0.5607413", "0.5607062", "0.56050843", "0.5602317", "0.5594372", "0.5591645", "0.5573974", "0.5570813", "0.5566141", "0.55632275", "0.55541617", "0.554694", "0.5542964", "0.5541548", "0.5538727", "0.5538463" ]
0.6900771
0
DELETE /source_pages/1 DELETE /source_pages/1.json
def destroy @source_page.destroy respond_to do |format| format.html { redirect_to source_pages_url, notice: 'Source page was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_page(id)\n @client.raw('delete', \"/content/pages/#{id}\")\n end", "def destroy\r\n @page = Page.find(params[:id])\r\n @page.destroy\r\n File.delete(\"#{Rails.public_path}/#{@page.project_id}/#{@page.page_name}.html\")\r\n respond_to do |format|\r\n format.html { redirect_to pages_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @structure_page = Structure::Page.find(params[:id])\n @structure_page.destroy\n\n respond_to do |format|\n format.html { redirect_to structure_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, :notice => \"Successfully deleted page. #{undo_link}\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n head :no_content\n end", "def destroy\n @jargon_file = JargonFile.find(params[:id])\n @source = @jargon_file.source\n @jargon_file.destroy\n\n respond_to do |format|\n format.html { redirect_to @source }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nested_page = Nested::Page.find(params[:id])\n @nested_page.destroy\n\n respond_to do |format|\n format.html { redirect_to nested_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @oasis_page = OasisPage.find(params[:id])\n @oasis_page.destroy\n\n respond_to do |format|\n format.html { redirect_to oasis_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_page = TestPage.find(params[:id])\n @test_page.destroy\n\n respond_to do |format|\n format.html { redirect_to test_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize_user!\n respond_to do |format|\n format.html { redirect_to sources_path(@source) }\n format.json { head :no_content }\n @source.destroy\n end\n end", "def delete; rest_delete(link('self')); end", "def delete; rest_delete(link('self')); end", "def destroy\n @static_page = StaticPage.find(params[:id])\n @static_page.destroy\n\n respond_to do |format|\n format.html { redirect_to static_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @static_page = StaticPage.find(params[:id])\n @static_page.destroy\n\n respond_to do |format|\n format.html { redirect_to static_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story_page.destroy\n respond_to do |format|\n format.html { redirect_to story_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source.destroy\n respond_to do |format|\n format.html { redirect_to sources_url, notice: 'Source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @document_page = DocumentPage.find(params[:id])\n @document_page.destroy\n\n respond_to do |format|\n format.html { redirect_to document_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @static_page = StaticPage.find(params[:id])\n @static_page.destroy\n\n respond_to do |format|\n format.html { redirect_to static_pages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @admined_page1 = AdminedPage1.find(params[:id])\n @admined_page1.destroy\n\n respond_to do |format|\n format.html { redirect_to admined_page1s_url }\n format.json { head :ok }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.json { render :json => @page }\n format.xml { render :xml => @page }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to report_sources_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @source_file.destroy\n respond_to do |format|\n format.html { redirect_to source_files_url, notice: 'Source file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = current_cms.pages.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(big_cms_pages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @page = Page.find_by_slug(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :ok }\n end\n end", "def destroy\n head :no_content\n end", "def destroy\n head :no_content\n end", "def destroy\n @mypage = Mypage.find(params[:id])\n @mypage.destroy\n\n respond_to do |format|\n format.html { redirect_to mypages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page_chunk.destroy\n respond_to do |format|\n format.html { redirect_to page_chunks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = current_site.pages.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_site_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rcadmin_static_page.destroy\n respond_to do |format|\n flash[:notice] = 'Static page was successfully deleted.'\n format.html { redirect_to rcadmin_static_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @source_ref.destroy\n respond_to do |format|\n format.html { redirect_to source_refs_url, notice: 'Source ref 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 @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_path(page: params[:page], type: params[:type]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @enq_page = EnqPage.find(params[:id])\n @enq_page.destroy\n\n respond_to do |format|\n format.html { redirect_to enq_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = @chapter.pages.find_by_number(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to manga_chapter_url(@manga, @chapter) }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.friendly.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source_web.destroy\n respond_to do |format|\n format.html { redirect_to source_webs_url, notice: 'Source web was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end", "def destroy\n @page_template = PageTemplate.find(params[:id])\n @page_template.destroy\n\n respond_to do |format|\n format.html { redirect_to page_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @content_source = ContentSource.find(params[:id])\n @content_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(content_sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n respond_with(@page, :status => :deleted, :location => pages_path)\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(page_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pageview.destroy\n respond_to do |format|\n format.html { redirect_to pageviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipesource = Recipesource.find(params[:id])\n @recipesource.destroy\n\n respond_to do |format|\n format.html { redirect_to recipesources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@static_content = StaticContent.find(params[:id])\n #@static_content.destroy\n #\n #respond_to do |format|\n # format.html { redirect_to static_contents_url }\n # format.json { head :no_content }\n #end\n end", "def destroy\n Page.find(params[:id]).destroy\n redirect_to pages_path\n end", "def destroy\n @sync_page = SyncPage.find(params[:id])\n @sync_page.destroy\n\n respond_to do |format|\n format.html { redirect_to sync_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n head :no_content\n end", "def destroy\n @page = current_site.pages.find_by_permalink(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n format.js\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @target.destroy\n respond_to do |format|\n format.html { redirect_to after_write_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @historical_source.destroy\n respond_to do |format|\n format.html { redirect_to historical_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_source = StudentSource.find(params[:id])\n @student_source.destroy\n\n respond_to do |format|\n format.html { redirect_to student_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to(admin_pages_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted page: #{@page.title}\")\n end", "def destroy\n @page_fetch = PageFetch.find(params[:id])\n @page_fetch.destroy\n\n respond_to do |format|\n format.html { redirect_to(page_fetches_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @page = @user.pages.find_by_permalink(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_url) }\n format.xml { head :ok }\n end\n end", "def delete_page(page)\n transaction \"delete `#{page.title}'\" do\n store.delete(page.title + '.md')\n end\n end", "def destroy\n @static_page = StaticPage.find(params[:id])\n @static_page.destroy\n\n respond_to do |format|\n format.html { redirect_to(static_pages_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.6957046", "0.6927541", "0.67749083", "0.6774857", "0.6774857", "0.6764738", "0.6729344", "0.6729344", "0.6729344", "0.6729344", "0.6725345", "0.67214984", "0.672082", "0.6704641", "0.66959274", "0.66959274", "0.66959274", "0.66959274", "0.66959274", "0.66959274", "0.66959274", "0.66959274", "0.6688592", "0.66749924", "0.66694355", "0.6665421", "0.666326", "0.666326", "0.666326", "0.66624475", "0.6643213", "0.6610874", "0.6610874", "0.66099495", "0.66099495", "0.66027564", "0.6594327", "0.65905327", "0.65812635", "0.65689886", "0.65580213", "0.6545986", "0.65256757", "0.6515073", "0.6501575", "0.64890456", "0.64890456", "0.648197", "0.6473678", "0.6468552", "0.6464509", "0.6464509", "0.6464509", "0.6464509", "0.6463414", "0.6458612", "0.64574903", "0.64524955", "0.6447354", "0.6432801", "0.6425665", "0.64253694", "0.6418233", "0.64156985", "0.64156985", "0.64156985", "0.64156985", "0.64156985", "0.64156985", "0.64156985", "0.64156985", "0.6399594", "0.6390091", "0.63885975", "0.6388314", "0.6380347", "0.6378127", "0.63773084", "0.63739663", "0.636858", "0.6367445", "0.63621294", "0.63583046", "0.6352736", "0.6349792", "0.6349792", "0.6349792", "0.6349792", "0.6349792", "0.6349792", "0.6349792", "0.6349792", "0.63476104", "0.6347545", "0.6341696", "0.6331613", "0.63313353", "0.63293034", "0.6324203", "0.6320761" ]
0.7453293
0
Use callbacks to share common setup or constraints between actions.
def set_source_page @source_page = SourcePage.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 source_page_params params.require(:source_page).permit(: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 user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n 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 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 user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\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 ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\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 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 url_whitelist; 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 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 permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\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 backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "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 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.6981273", "0.6783789", "0.67460483", "0.6742222", "0.67354137", "0.65934366", "0.65028495", "0.6497783", "0.64826745", "0.6479415", "0.6456823", "0.6440081", "0.63800216", "0.6376521", "0.636652", "0.6319898", "0.6300256", "0.62994003", "0.6293621", "0.6292629", "0.6291586", "0.629103", "0.6282451", "0.6243152", "0.62413", "0.6219024", "0.6213724", "0.62103724", "0.61945", "0.61786324", "0.61755824", "0.6173267", "0.6163613", "0.6153058", "0.61521065", "0.6147508", "0.61234015", "0.61168665", "0.6107466", "0.6106177", "0.6091159", "0.60817343", "0.6071238", "0.6062299", "0.6021663", "0.60182893", "0.6014239", "0.6011563", "0.60080767", "0.60080767", "0.60028875", "0.60005623", "0.59964156", "0.5993086", "0.5992319", "0.5992299", "0.59801805", "0.59676576", "0.59606016", "0.595966", "0.59591126", "0.59589803", "0.5954058", "0.5953234", "0.5944434", "0.5940526", "0.59376484", "0.59376484", "0.5935253", "0.5930846", "0.5926387", "0.59256274", "0.5917907", "0.5910841", "0.590886", "0.59086543", "0.59060425", "0.58981544", "0.5898102", "0.5896809", "0.5895416", "0.58947027", "0.58923644", "0.5887903", "0.58830196", "0.5880581", "0.5873854", "0.58697754", "0.5869004", "0.58669055", "0.5866886", "0.58664906", "0.5864619", "0.58630043", "0.5862495", "0.5861368", "0.5859712", "0.5855544", "0.58551925", "0.5851284", "0.5850602" ]
0.0
-1
GET /admin/furniture/sets GET /admin/furniture/sets.json
def index @admin_furniture_sets = Admin::Furniture::Set.all.paginate(page: params[:page]) respond_to do |format| format.html format.json { render json: @admin_furniture_sets.map { |i| { value: i.id, text: "#{i.name} #{i.config.to_s}" } }, status: :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_admin_furniture_set\n @admin_furniture_set = Admin::Furniture::Set.find(params[:id])\n end", "def index\n @attribute_sets = AttributeSet.all\n render json: @attribute_sets\n end", "def create\n @admin_furniture_set = Admin::Furniture::Set.new(admin_furniture_set_params)\n\n respond_to do |format|\n if @admin_furniture_set.save\n format.html { redirect_to admin_furniture_sets_path, notice: mk_notice(@admin_furniture_set, :name, 'ست مبل', :create) }\n format.json { render json: @admin_furniture_set, status: :created, location: admin_furniture_sets_path }\n else\n format.html { render :new }\n format.json { render json: @admin_furniture_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @fabricsofasets = Fabricsofaset.all\n end", "def index\n @defsets = Defset.all\n end", "def show\n render_json :entry => @set and return\n end", "def show\n render_json :entry => @set and return\n end", "def index\n @set_details = SetDetail.all\n end", "def index\n @set_lists = SetList.all\n end", "def index\n @exercise_sets = ExerciseSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercise_sets }\n end\n end", "def index\n @seta = Setum.all\n end", "def index\n @setors = Setor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @setors }\n end\n end", "def sets\n end", "def show\n @frequent_set = FrequentSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @frequent_set }\n end\n end", "def index\n @sets_and_reps = SetsAndRep.all\n end", "def set_set_list\n @set_list = SetList.find(params[:id])\n end", "def index\n @woodensofasets = Woodensofaset.all\n end", "def show \n @franchise_set = FranchiseSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @franchise_set }\n end\n end", "def index\n @product_sets = ProductSet.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_sets }\n end\n end", "def set_setlist\n @setlist = Setlist.find(params[:id])\n end", "def index\n if show\n show.default_set_lists\n @show_set_lists = show.show_set_lists.all\n @tour = show.tour\n else\n @show_set_lists = ShowSetList.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @show_set_lists }\n format.json { render :json => @show_set_lists }\n end\n end", "def show\n @uset = Uset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uset }\n end\n end", "def set_setlist\n @setlist = Setlist.find(params[:id])\n end", "def index\n @customer_sets = CustomerSet.all\n end", "def index\n #chart = Chart.find(params[:chart_id])\n chart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n data_sets = chart.data_sets.all\n\n respond_with(data_sets) do |format|\n \t#response string in specified format\n format.json { render json: { success: true, data_sets: data_sets } }\n end\n end", "def show_all_sets\n\t\t\tprint_deb \"Showing all Sets:\"\n\t\t\t\n\t\t\tif @working_set\n\t\t\t\tclass_name = get_type(@working_set.first)\n\t\t\t\tmsg = \"%bld%dyel[Working Set]:%clr\\t#{@working_set.count} items\"\n\t\t\t\tmsg += \" of type #{class_name}\" unless @working_set.count < 1\n\t\t\t\tprint_line msg\n\t\t\tend\n\t\t\t\n\t\t\t@sets.each do |name,value| \n\t\t\t\tclass_name = get_type(value.first)\n\t\t\t\tmsg = \"%bld%dyel[#{name}]:%clr\\t#{value.count} items\"\n\t\t\t\tmsg += \" of type #{class_name}\" unless value.count < 1\n\t\t\t\tprint_line msg\n\t\t\tend\t\n\t\tend", "def show\n @setor = Setor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @setor }\n end\n end", "def index\n @shows = Show.all\n response = HTTParty.get('https://api.setlist.fm/rest/1.0/artist/94f8947c-2d9c-4519-bcf9-6d11a24ad006/setlists?p=1', headers: {\"Accept\" => \"application/json\", \"x-api-key\": \"X5zdk_R9xhoRkSxvDUDSV1n_1hlGGSRPwaDq\"})\n results = JSON.parse(response.body)\n results[\"setlist\"].each do |show|\n if Venue.find_by(mbid: show[\"venue\"][\"id\"])\n # do nothing\n else\n @venue = Venue.create(mbid: show[\"venue\"][\"id\"], \n name: show[\"venue\"][\"name\"], \n city: show[\"venue\"][\"city\"][\"name\"],\n state: show[\"venue\"][\"city\"][\"state\"],\n country: show[\"venue\"][\"city\"][\"country\"][\"code\"])\n end\n # do some not have venues? check for this\n if @venue\n @show = Show.create(name: show[\"venue\"][\"name\"], event_date: show[\"eventDate\"], venue_id: @venue.id)\n else\n @show = Show.create(name: show[\"venue\"][\"name\"], event_date: show[\"eventDate\"])\n end\n # FIXME - hardcoded for dead & co with 3\n ArtistShow.create(artist_id: 3, show_id: @show.id)\n show[\"sets\"][\"set\"].each do |set|\n # increment sets by 1 for ordering later\n encore = set[\"encore\"] if set[\"encore\"]\n set_num = 1\n @setlist = Setlist.create(number: set_num, encore: encore, show_id: @show.id)\n set[\"song\"].each do |song|\n if song[\"cover\"]\n if Artist.find_by(mbid: song[\"cover\"][\"mbid\"])\n # do nothing\n else\n @artist = Artist.create(name: song[\"cover\"][\"name\"], sort_name: song[\"cover\"][\"sortName\"], mbid: song[\"cover\"][\"mbid\"])\n end\n end\n if @artist\n @song = Song.create(name: song[\"name\"], artist_id: @artist.id) \n else\n @song = Song.create(name: song[\"name\"])\n end\n SetlistSong.create(song_id: @song.id, setlist_id: @setlist.id, position: 1 )\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_furniture_set.update(admin_furniture_set_params)\n format.html { redirect_to admin_furniture_sets_path, notice: mk_notice(@admin_furniture_set, :name, 'ست مبل', :update) }\n format.json { render json: @admin_furniture_set, status: :ok, location: admin_furniture_sets_path }\n else\n format.html { render :edit }\n format.json { render json: @admin_furniture_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render json: @attribute_set\n end", "def index\n @lookup_sets = LookupSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_sets }\n end\n end", "def import_set\n\n @this_set = Cardset.find_by_short_name(params[:set_code])\n\n import_these_cards_from_this_set(params[:set_code])\n\n respond_to do |format|\n format.js\n end\n\n end", "def index\n @survey_value_sets = SurveyValueSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @survey_value_sets }\n end\n end", "def set_sets_and_rep\n @sets_and_rep = SetsAndRep.find(params[:id])\n end", "def get_set(set_size=2, opts={})\n\t\t\turl = \"api/v2/picks/#{id}\"\n\t\t\t# public and private don't matter since you can use send... :/\n\t\t\tself.class.send(:get_objects, :get, \"results\", url, opts.merge!(set_size: set_size))\n\t\tend", "def render_json_fileset_response( status, filesets = nil )\n render json: API::FilesetListResponse.new( status, filesets ), :status => status\n end", "def list_sets\n puts \"Available sets:\"\n #loops through $current_sets and displays the name of each set\n i=0\n for i in 0..$current_sets.length-1\n puts $current_sets[i].setname\n end\nend", "def index\n @liftsets = Liftset.all\n end", "def test_public_sets\n set_names = File.readlines('data/set_names.txt')\n set_names.each_with_index do |name, index|\n get \"/sets/public/#{index}\"\n assert_equal 200, last_response.status\n assert_includes last_response.body, name \n assert_includes last_response.body, 'Study' \n assert_includes last_response.body, 'table' \n end\n end", "def index\n @classification_fund_sets = ClassificationFund.fetch_data\n end", "def show\n @image_set = ImageSet.find(params[:id])\n\n render json: @image_set\n end", "def total_sets\n Setlist.maximum(:set_id, :conditions => [\"set_id != '9' AND show_id = ?\", id])\n end", "def index\n @subsets = Subset.all\n end", "def set(sets)\n view.update_many(\"$set\" => collect_operations(sets))\n end", "def get_fileset\n\n filesets = batched_get( { id: params[:id] } )\n if filesets.empty?\n render_json_fileset_response(:not_found )\n else\n render_json_fileset_response(:ok, fileset_transform( filesets ) )\n end\n end", "def show\n @setmarkassent = Setmarkassent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @setmarkassent }\n end\n end", "def set_setlist\n @setlist = Setlist.find(params[:setlist_id])\n end", "def set_setlist\n @setlist = Setlist.find(params[:setlist_id])\n end", "def index\n @setid = params[:setid]\n #returns the resource view. Notes that it was passed a set as parameter and not a resource itself.\n @view = session[:application].get(params[:setid]).resources[0].explorator::view\n end", "def index\n @set_genders = SetGender.all\n end", "def set_fabricsofaset\n @fabricsofaset = Fabricsofaset.find(params[:id])\n end", "def set_setum\n @setum = Setum.find(params[:id])\n end", "def new \n @franchise_set = FranchiseSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @franchise_set }\n end\n end", "def show\n @exercise_set = ExerciseSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_set }\n end\n end", "def new\n @frequent_set = FrequentSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @frequent_set }\n end\n end", "def show\n @studentset = Studentset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @studentset }\n end\n end", "def filtered_sets(type)\n self.class.get(sets).select{|set| set['set_type'] == type}\n end", "def get_staging_rule_sets\n get(\"#{url_base}/staging/rule_sets?#{dc}\")[\"data\"]\n end", "def admin_furniture_set_params\n params.require(:admin_furniture_set).permit(:name, :config, :comment)\n end", "def show\n @configuration_set = ConfigurationSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @configuration_set }\n end\n end", "def index\n @choice_sets = ChoiceSet.all\n end", "def create\n @gig_set = GigSet.new(gig_set_params)\n @gig_set.number = (@gig_set.gig.gig_sets.map(&:number).compact.max || 0) + 1\n\n respond_to do |format|\n if @gig_set.save\n format.html { redirect_to edit_gig_path(@gig_set.gig) }\n format.json { redirect_to edit_gig_path(@gig_set.gig) }\n else\n format.html { redirect_to edit_gig_path(@gig_set.gig), error: \"Couldn't add a new set\" }\n format.json { redirect_to edit_gig_path(@gig_set.gig), status: :unprocessable_entity }\n end\n end\n end", "def index\n\t\t@jquery = InitHelper.new( gon )\n\t\t@data_sets = DataSet.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @data_sets }\n\t\tend\n\tend", "def show\n @sample_set = SampleSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample_set }\n end\n end", "def index\n @task_sets = TaskSet.all\n end", "def index\n permitted_to! :inspect, Problem.find(params[:problem_id])\n @test_sets = TestSet.where(:problem_id => params[:problem_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @test_sets }\n end\n end", "def index\n @image_sets = ImageSet.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @image_sets }\n end\n end", "def index\n @skillsets = Skillset.all\n end", "def index\n @skillsets = Skillset.all\n end", "def get_sets\n result = []\n (0..(TAILLE_TAPIS + TAILLE_EXT*self.etendu - 3)).each do |a|\n ((a + 1)..(TAILLE_TAPIS + TAILLE_EXT*self.etendu - 2)).each do |b|\n ((b + 1)..(TAILLE_TAPIS + TAILLE_EXT*self.etendu - 1)).each do |c|\n if (is_a_set?([self.talon[self.tapis[a]], self.talon[self.tapis[b]], self.talon[self.tapis[c]]]))[0]\n result << [a, b, c]\n end\n end\n end\n end\n result\n end", "def record_sets(opt = {})\n client.list_resource_record_sets(opt)&.resource_record_sets\n end", "def current_data_set\n\t\tdata_set_id = get_data_set_id(params[:event_id], params[:data_type])\n\n respond_to do |format|\n format.json { render json: data_set_id.to_json }\n end\n end", "def total_set_cards\n @total = PkCard.where(set: params[:set]).count\n render json: @total\n end", "def create\n @setum = Setum.new(setum_params)\n\n respond_to do |format|\n if @setum.save\n format.html { redirect_to @setum, notice: 'Setum was successfully created.' }\n format.json { render :show, status: :created, location: @setum }\n else\n format.html { render :new }\n format.json { render json: @setum.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @exam_sets = ExamSet.all\n end", "def setlists\n Setlist.where(\"show_id = ? \", id).order(\"set_id ASC, song_order ASC\").all\n end", "def changesets\n @changesets ||= ApiFactory.new 'Repos::Changesets'\n end", "def destroy\n @defset.destroy\n respond_to do |format|\n format.html { redirect_to defsets_url }\n format.json { head :no_content }\n end\n end", "def index\n @set_stations = SetStation.all\n end", "def list\n @collections = Admin::Collection.names\n\n render json: { collections: @collections }\n end", "def set_furniture\n @furniture = Admin::Furniture::Furniture.find(params[:id])\n end", "def entity_sets\n @entity_sets ||= metadata.xpath('//EntitySet').map do |entity|\n [\n entity.attributes['Name'].value,\n entity.attributes['EntityType'].value\n ]\n end.to_h\n end", "def index\n @questionsets = Questionset.all\n end", "def create\n @defset = Defset.new(defset_params)\n\n respond_to do |format|\n if @defset.save\n format.html { redirect_to @defset, notice: 'Defset was successfully created.' }\n format.json { render action: 'show', status: :created, location: @defset }\n else\n format.html { render action: 'new' }\n format.json { render json: @defset.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_show_set\n @show_set = ShowSet.find(params[:id])\n end", "def index\n @delivery_men = DeliveryMan.all\n\n render json: @delivery_men, :each_serializer => ShortDeliveryManSerializer\n end", "def show\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionset }\n end\n end", "def entity_sets\n entity_container.entity_sets\n end", "def entity_sets\n entity_container.entity_sets\n end", "def entity_sets\n entity_container.entity_sets\n end", "def show\n @indicator_set = IndicatorSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicator_set }\n end\n end", "def show\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_set }\n end\n end", "def json_sets_without_image\n ids = []\n JsonSet.all.each do |set|\n if set.json_cards.any?\n if File.exist?(\"/home/deploy/magic/shared/public/#{set.json_cards.first.image_url}\")\n next\n else\n ids << set.id\n end\n elsif set.json_tokens.any?\n if File.exist?(\"/home/deploy/magic/shared/public/#{set.json_tokens.first.image_url}\")\n next\n else\n ids << set.id\n end\n end\n ids\n end\n end", "def index\n @setcompilations = Setcompilation.all\n end", "def create\n @frequent_set = FrequentSet.new(params[:frequent_set])\n\n respond_to do |format|\n if @frequent_set.save\n format.html { redirect_to @frequent_set, notice: 'Frequent set was successfully created.' }\n format.json { render json: @frequent_set, status: :created, location: @frequent_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @frequent_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def fieldsets\n subset_content[:fieldsets] if valid_subset?\n end", "def set_sets_template\n @sets_template = SetsTemplate.find(params[:id])\n end", "def new\n @exercise_set = ExerciseSet.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_set }\n end\n end", "def index\n @supplier_produces = SupplierProduce.all\n # byebug\n render json: @supplier_produces\n # { supplier: @supplier_produces.suppliers, produce: @supplier_produces.produces, season: @supplier_produces.season }\n end", "def index\n # @adm_set = Setting.all\n end" ]
[ "0.7200095", "0.6679486", "0.6573324", "0.656625", "0.65635383", "0.65425754", "0.65425754", "0.64392185", "0.64135927", "0.6381811", "0.6368142", "0.63622004", "0.6189612", "0.61712277", "0.61057353", "0.6084513", "0.6066289", "0.6063458", "0.6038245", "0.60076666", "0.600279", "0.60003686", "0.5987896", "0.5986668", "0.5973363", "0.5972359", "0.59617215", "0.5921442", "0.5893222", "0.5892479", "0.58755624", "0.58697945", "0.5861349", "0.58494717", "0.584306", "0.58234197", "0.5822712", "0.58208245", "0.58183616", "0.58034194", "0.5802637", "0.5800184", "0.57657325", "0.57586455", "0.57535106", "0.574708", "0.57068795", "0.57068795", "0.56918013", "0.5690471", "0.5661477", "0.5658123", "0.56574786", "0.56502646", "0.5645789", "0.5642337", "0.5619998", "0.5612623", "0.5612295", "0.5609838", "0.5578488", "0.5567318", "0.5558663", "0.55509996", "0.55445224", "0.55386776", "0.55236876", "0.552125", "0.552125", "0.55211455", "0.5509543", "0.5507944", "0.5505635", "0.55009824", "0.5488311", "0.5486256", "0.54852885", "0.54825926", "0.5482113", "0.54820275", "0.54801095", "0.54775447", "0.54732376", "0.54684144", "0.54652494", "0.5461276", "0.545695", "0.5450398", "0.5450398", "0.5450398", "0.5450288", "0.5431302", "0.5421203", "0.5409883", "0.54079664", "0.5391423", "0.53888965", "0.5386223", "0.5382579", "0.5379003" ]
0.7806838
0
GET /admin/furniture/sets/1 GET /admin/furniture/sets/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @admin_furniture_sets = Admin::Furniture::Set.all.paginate(page: params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @admin_furniture_sets.map { |i| { value: i.id, text: \"#{i.name} #{i.config.to_s}\" } }, status: :ok }\n end\n end", "def set_admin_furniture_set\n @admin_furniture_set = Admin::Furniture::Set.find(params[:id])\n end", "def create\n @admin_furniture_set = Admin::Furniture::Set.new(admin_furniture_set_params)\n\n respond_to do |format|\n if @admin_furniture_set.save\n format.html { redirect_to admin_furniture_sets_path, notice: mk_notice(@admin_furniture_set, :name, 'ست مبل', :create) }\n format.json { render json: @admin_furniture_set, status: :created, location: admin_furniture_sets_path }\n else\n format.html { render :new }\n format.json { render json: @admin_furniture_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render_json :entry => @set and return\n end", "def show\n render_json :entry => @set and return\n end", "def show\n @frequent_set = FrequentSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @frequent_set }\n end\n end", "def index\n @attribute_sets = AttributeSet.all\n render json: @attribute_sets\n end", "def show \n @franchise_set = FranchiseSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @franchise_set }\n end\n end", "def index\n @fabricsofasets = Fabricsofaset.all\n end", "def index\n @exercise_sets = ExerciseSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercise_sets }\n end\n end", "def index\n @defsets = Defset.all\n end", "def show\n @uset = Uset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uset }\n end\n end", "def index\n @set_details = SetDetail.all\n end", "def index\n @setors = Setor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @setors }\n end\n end", "def update\n respond_to do |format|\n if @admin_furniture_set.update(admin_furniture_set_params)\n format.html { redirect_to admin_furniture_sets_path, notice: mk_notice(@admin_furniture_set, :name, 'ست مبل', :update) }\n format.json { render json: @admin_furniture_set, status: :ok, location: admin_furniture_sets_path }\n else\n format.html { render :edit }\n format.json { render json: @admin_furniture_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @seta = Setum.all\n end", "def show\n @setor = Setor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @setor }\n end\n end", "def new\n @frequent_set = FrequentSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @frequent_set }\n end\n end", "def show\n render json: @attribute_set\n end", "def new \n @franchise_set = FranchiseSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @franchise_set }\n end\n end", "def show\n @image_set = ImageSet.find(params[:id])\n\n render json: @image_set\n end", "def set_furniture\n @furniture = Admin::Furniture::Furniture.find(params[:id])\n end", "def index\n #chart = Chart.find(params[:chart_id])\n chart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n data_sets = chart.data_sets.all\n\n respond_with(data_sets) do |format|\n \t#response string in specified format\n format.json { render json: { success: true, data_sets: data_sets } }\n end\n end", "def show\n @setmarkassent = Setmarkassent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @setmarkassent }\n end\n end", "def show\n @configuration_set = ConfigurationSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @configuration_set }\n end\n end", "def show\n @exercise_set = ExerciseSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_set }\n end\n end", "def index\n @set_lists = SetList.all\n end", "def get_fileset\n\n filesets = batched_get( { id: params[:id] } )\n if filesets.empty?\n render_json_fileset_response(:not_found )\n else\n render_json_fileset_response(:ok, fileset_transform( filesets ) )\n end\n end", "def render_json_fileset_response( status, filesets = nil )\n render json: API::FilesetListResponse.new( status, filesets ), :status => status\n end", "def show\n @sample_set = SampleSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample_set }\n end\n end", "def index\n @product_sets = ProductSet.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_sets }\n end\n end", "def index\n if show\n show.default_set_lists\n @show_set_lists = show.show_set_lists.all\n @tour = show.tour\n else\n @show_set_lists = ShowSetList.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @show_set_lists }\n format.json { render :json => @show_set_lists }\n end\n end", "def show\n @studentset = Studentset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @studentset }\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 index\n @woodensofasets = Woodensofaset.all\n end", "def get_set(set_size=2, opts={})\n\t\t\turl = \"api/v2/picks/#{id}\"\n\t\t\t# public and private don't matter since you can use send... :/\n\t\t\tself.class.send(:get_objects, :get, \"results\", url, opts.merge!(set_size: set_size))\n\t\tend", "def index\n @sets_and_reps = SetsAndRep.all\n end", "def set_furniture\n @furniture = Furniture.find(params[:id])\n end", "def set_furniture\n @furniture = Furniture.find(params[:id])\n end", "def set_fabricsofaset\n @fabricsofaset = Fabricsofaset.find(params[:id])\n end", "def index\n @shows = Show.all\n response = HTTParty.get('https://api.setlist.fm/rest/1.0/artist/94f8947c-2d9c-4519-bcf9-6d11a24ad006/setlists?p=1', headers: {\"Accept\" => \"application/json\", \"x-api-key\": \"X5zdk_R9xhoRkSxvDUDSV1n_1hlGGSRPwaDq\"})\n results = JSON.parse(response.body)\n results[\"setlist\"].each do |show|\n if Venue.find_by(mbid: show[\"venue\"][\"id\"])\n # do nothing\n else\n @venue = Venue.create(mbid: show[\"venue\"][\"id\"], \n name: show[\"venue\"][\"name\"], \n city: show[\"venue\"][\"city\"][\"name\"],\n state: show[\"venue\"][\"city\"][\"state\"],\n country: show[\"venue\"][\"city\"][\"country\"][\"code\"])\n end\n # do some not have venues? check for this\n if @venue\n @show = Show.create(name: show[\"venue\"][\"name\"], event_date: show[\"eventDate\"], venue_id: @venue.id)\n else\n @show = Show.create(name: show[\"venue\"][\"name\"], event_date: show[\"eventDate\"])\n end\n # FIXME - hardcoded for dead & co with 3\n ArtistShow.create(artist_id: 3, show_id: @show.id)\n show[\"sets\"][\"set\"].each do |set|\n # increment sets by 1 for ordering later\n encore = set[\"encore\"] if set[\"encore\"]\n set_num = 1\n @setlist = Setlist.create(number: set_num, encore: encore, show_id: @show.id)\n set[\"song\"].each do |song|\n if song[\"cover\"]\n if Artist.find_by(mbid: song[\"cover\"][\"mbid\"])\n # do nothing\n else\n @artist = Artist.create(name: song[\"cover\"][\"name\"], sort_name: song[\"cover\"][\"sortName\"], mbid: song[\"cover\"][\"mbid\"])\n end\n end\n if @artist\n @song = Song.create(name: song[\"name\"], artist_id: @artist.id) \n else\n @song = Song.create(name: song[\"name\"])\n end\n SetlistSong.create(song_id: @song.id, setlist_id: @setlist.id, position: 1 )\n end\n end\n end\n end", "def current_data_set\n\t\tdata_set_id = get_data_set_id(params[:event_id], params[:data_type])\n\n respond_to do |format|\n format.json { render json: data_set_id.to_json }\n end\n end", "def index\n @survey_value_sets = SurveyValueSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @survey_value_sets }\n end\n end", "def show\n @indicator_set = IndicatorSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicator_set }\n end\n end", "def index\n @classification_fund_sets = ClassificationFund.fetch_data\n end", "def new\n @exercise_set = ExerciseSet.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_set }\n end\n end", "def show\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionset }\n end\n end", "def index\n @lookup_sets = LookupSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_sets }\n end\n end", "def show\n @functional_set = FunctionalSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @functional_set }\n end\n end", "def import_set\n\n @this_set = Cardset.find_by_short_name(params[:set_code])\n\n import_these_cards_from_this_set(params[:set_code])\n\n respond_to do |format|\n format.js\n end\n\n end", "def total_sets\n Setlist.maximum(:set_id, :conditions => [\"set_id != '9' AND show_id = ?\", id])\n end", "def show\n @data_set = DataSet.find(params[:id])\n recur = params.include?(:recur) ? params[:recur] == 'true' : false\n respond_to do |format|\n format.html { redirect_to project_path(@data_set.project) + data_set_path(@data_set) }\n format.json { render json: @data_set.to_hash(recur) }\n end\n end", "def show\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_set }\n end\n end", "def set_set_list\n @set_list = SetList.find(params[:id])\n end", "def new\n @uset = Uset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @uset }\n end\n end", "def show\n @trading_strategy_set = TradingStrategySet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trading_strategy_set }\n end\n end", "def create\n @frequent_set = FrequentSet.new(params[:frequent_set])\n\n respond_to do |format|\n if @frequent_set.save\n format.html { redirect_to @frequent_set, notice: 'Frequent set was successfully created.' }\n format.json { render json: @frequent_set, status: :created, location: @frequent_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @frequent_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @setid = params[:setid]\n #returns the resource view. Notes that it was passed a set as parameter and not a resource itself.\n @view = session[:application].get(params[:setid]).resources[0].explorator::view\n end", "def set_setlist\n @setlist = Setlist.find(params[:id])\n end", "def admin_furniture_set_params\n params.require(:admin_furniture_set).permit(:name, :config, :comment)\n end", "def create\n @gig_set = GigSet.new(gig_set_params)\n @gig_set.number = (@gig_set.gig.gig_sets.map(&:number).compact.max || 0) + 1\n\n respond_to do |format|\n if @gig_set.save\n format.html { redirect_to edit_gig_path(@gig_set.gig) }\n format.json { redirect_to edit_gig_path(@gig_set.gig) }\n else\n format.html { redirect_to edit_gig_path(@gig_set.gig), error: \"Couldn't add a new set\" }\n format.json { redirect_to edit_gig_path(@gig_set.gig), status: :unprocessable_entity }\n end\n end\n end", "def index\n @customer_sets = CustomerSet.all\n end", "def show\n @coin_set = CoinSet.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coin_set }\n end\n end", "def new\n @setor = Setor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @setor }\n end\n end", "def show\n @data_set = DataSet.find(params[:id])\n @mongo_data_set = MongoData.find_by_data_set_id(@data_set.id)\n recur = params.key?(:recur) ? params[:recur].to_bool : false\n respond_to do |format|\n format.html { redirect_to (project_path @data_set.project) + (data_set_path @data_set) }\n format.json { render json: @data_set.to_hash(recur)}\n end\n end", "def show\n @survey_value_set = SurveyValueSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_value_set }\n end\n end", "def index\n @fundamental_settings = Fundamental::Setting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamental_settings }\n end\n end", "def new\n @data_set = DataSet.new\n\n respond_to do |format|\n format.html\n format.json { render json: @data_set.to_hash(false) }\n end\n end", "def index\n permitted_to! :inspect, Problem.find(params[:problem_id])\n @test_sets = TestSet.where(:problem_id => params[:problem_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @test_sets }\n end\n end", "def test_public_sets\n set_names = File.readlines('data/set_names.txt')\n set_names.each_with_index do |name, index|\n get \"/sets/public/#{index}\"\n assert_equal 200, last_response.status\n assert_includes last_response.body, name \n assert_includes last_response.body, 'Study' \n assert_includes last_response.body, 'table' \n end\n end", "def index\n @fretes = Frete.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fretes }\n end\n end", "def set_setlist\n @setlist = Setlist.find(params[:id])\n end", "def index\n @liftsets = Liftset.all\n end", "def show\n @frequencia_setor = Frequencia::Setor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb.erb\n format.xml { render :xml => @frequencia_setor }\n end\n end", "def set_setum\n @setum = Setum.find(params[:id])\n end", "def new\n @configuration_set = ConfigurationSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @configuration_set }\n end\n end", "def index\n @subsets = Subset.all\n end", "def show\n @inventory_clearance_setting = InventoryClearanceSetting.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_clearance_setting }\n end\n end", "def index\n @familia = Familium.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @familia }\n end\n end", "def show\n hub = Hub.find(params[:id])\n respond_to do |format|\n format.json { render :json => hub.warehouses }\n end\n end", "def index\n @facility_totals = FacilityTotal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @facility_totals }\n end\n end", "def set_sets_and_rep\n @sets_and_rep = SetsAndRep.find(params[:id])\n end", "def destroy\n @defset.destroy\n respond_to do |format|\n format.html { redirect_to defsets_url }\n format.json { head :no_content }\n end\n end", "def create \n @franchise_set = FranchiseSet.new(params[:franchise_set])\n\n respond_to do |format|\n if @franchise_set.save\n format.html { redirect_to \"/franchise_sets/\", notice: 'Franchise set was successfully created.' }\n format.json { render json: @franchise_set, status: :created, location: @franchise_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @franchise_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @setum = Setum.new(setum_params)\n\n respond_to do |format|\n if @setum.save\n format.html { redirect_to @setum, notice: 'Setum was successfully created.' }\n format.json { render :show, status: :created, location: @setum }\n else\n format.html { render :new }\n format.json { render json: @setum.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @delivery_men = DeliveryMan.all\n\n render json: @delivery_men, :each_serializer => ShortDeliveryManSerializer\n end", "def create\n @defset = Defset.new(defset_params)\n\n respond_to do |format|\n if @defset.save\n format.html { redirect_to @defset, notice: 'Defset was successfully created.' }\n format.json { render action: 'show', status: :created, location: @defset }\n else\n format.html { render action: 'new' }\n format.json { render json: @defset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @defset.update(defset_params)\n format.html { redirect_to @defset, notice: 'Defset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @defset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @frequent_set = FrequentSet.find(params[:id])\n\n respond_to do |format|\n if @frequent_set.update_attributes(params[:frequent_set])\n format.html { redirect_to @frequent_set, notice: 'Frequent set was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @frequent_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @set_genders = SetGender.all\n end", "def index\n @ef_mentals = EfMental.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_mentals }\n end\n end", "def new\n @show_set_list = show.show_set_lists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @show_set_list }\n end\n end", "def sets\n end", "def list_sets\n puts \"Available sets:\"\n #loops through $current_sets and displays the name of each set\n i=0\n for i in 0..$current_sets.length-1\n puts $current_sets[i].setname\n end\nend", "def show\n @card_set = CardSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_set }\n end\n end", "def show\n @seta = Seta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @seta }\n end\n end", "def index\n @furniture_items = FurnitureItem.all\n end", "def index\n\n get_collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @temples }\n format.js {}\n end\n end", "def index\n @requisitions = Requisition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requisitions }\n end\n end", "def index\n @supplier_produces = SupplierProduce.all\n # byebug\n render json: @supplier_produces\n # { supplier: @supplier_produces.suppliers, produce: @supplier_produces.produces, season: @supplier_produces.season }\n end", "def index\n @faction_assets = FactionAsset.all\n end" ]
[ "0.7776283", "0.726785", "0.6672082", "0.6619293", "0.6619293", "0.6566542", "0.64761645", "0.64090234", "0.63794506", "0.629912", "0.62479687", "0.62447304", "0.62340045", "0.6196485", "0.61648905", "0.60923666", "0.6092361", "0.60875356", "0.60664046", "0.6043717", "0.60318375", "0.6021339", "0.59769946", "0.59149194", "0.5913357", "0.59093446", "0.5907519", "0.58943546", "0.58329356", "0.5832274", "0.5830136", "0.580555", "0.57966655", "0.5789516", "0.5780215", "0.57768947", "0.57718235", "0.5762435", "0.5762435", "0.5757142", "0.57534385", "0.5749043", "0.5747931", "0.5710864", "0.57040435", "0.56975925", "0.56957763", "0.5681969", "0.5675854", "0.5660832", "0.56572", "0.56549776", "0.56527627", "0.56438637", "0.56387913", "0.5630459", "0.5625882", "0.5621156", "0.5609405", "0.55952424", "0.5592732", "0.5588027", "0.55829567", "0.55811775", "0.55790055", "0.5573496", "0.5569418", "0.5568436", "0.5567629", "0.5566705", "0.5565188", "0.5564912", "0.5557529", "0.55384606", "0.55340546", "0.5530798", "0.5526384", "0.5508766", "0.55030257", "0.5502731", "0.5497845", "0.5491565", "0.54880923", "0.5476085", "0.5474181", "0.5467782", "0.5462585", "0.54359925", "0.5431219", "0.54267246", "0.54187053", "0.5411954", "0.540984", "0.53919965", "0.53887475", "0.53864014", "0.5379677", "0.53790087", "0.5372854", "0.5368917", "0.5367758" ]
0.0
-1
POST /admin/furniture/sets POST /admin/furniture/sets.json
def create @admin_furniture_set = Admin::Furniture::Set.new(admin_furniture_set_params) respond_to do |format| if @admin_furniture_set.save format.html { redirect_to admin_furniture_sets_path, notice: mk_notice(@admin_furniture_set, :name, 'ست مبل', :create) } format.json { render json: @admin_furniture_set, status: :created, location: admin_furniture_sets_path } else format.html { render :new } format.json { render json: @admin_furniture_set.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_admin_furniture_set\n @admin_furniture_set = Admin::Furniture::Set.find(params[:id])\n end", "def create\n @setum = Setum.new(setum_params)\n\n respond_to do |format|\n if @setum.save\n format.html { redirect_to @setum, notice: 'Setum was successfully created.' }\n format.json { render :show, status: :created, location: @setum }\n else\n format.html { render :new }\n format.json { render json: @setum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gig_set = GigSet.new(gig_set_params)\n @gig_set.number = (@gig_set.gig.gig_sets.map(&:number).compact.max || 0) + 1\n\n respond_to do |format|\n if @gig_set.save\n format.html { redirect_to edit_gig_path(@gig_set.gig) }\n format.json { redirect_to edit_gig_path(@gig_set.gig) }\n else\n format.html { redirect_to edit_gig_path(@gig_set.gig), error: \"Couldn't add a new set\" }\n format.json { redirect_to edit_gig_path(@gig_set.gig), status: :unprocessable_entity }\n end\n end\n end", "def create\n @defset = Defset.new(defset_params)\n\n respond_to do |format|\n if @defset.save\n format.html { redirect_to @defset, notice: 'Defset was successfully created.' }\n format.json { render action: 'show', status: :created, location: @defset }\n else\n format.html { render action: 'new' }\n format.json { render json: @defset.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @admin_furniture_sets = Admin::Furniture::Set.all.paginate(page: params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @admin_furniture_sets.map { |i| { value: i.id, text: \"#{i.name} #{i.config.to_s}\" } }, status: :ok }\n end\n end", "def create\n @data_set = DataSet.new(data_set_params)\n\n respond_to do |format|\n if @data_set.save\n format.html { redirect_to [:admin, @data_set], notice: 'Data set was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @data_set] }\n else\n format.html { render :new }\n format.json { render json: @data_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def set(sets)\n view.update_many(\"$set\" => collect_operations(sets))\n end", "def create \n @franchise_set = FranchiseSet.new(params[:franchise_set])\n\n respond_to do |format|\n if @franchise_set.save\n format.html { redirect_to \"/franchise_sets/\", notice: 'Franchise set was successfully created.' }\n format.json { render json: @franchise_set, status: :created, location: @franchise_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @franchise_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @frequent_set = FrequentSet.new(params[:frequent_set])\n\n respond_to do |format|\n if @frequent_set.save\n format.html { redirect_to @frequent_set, notice: 'Frequent set was successfully created.' }\n format.json { render json: @frequent_set, status: :created, location: @frequent_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @frequent_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @set_detail = SetDetail.new(set_detail_params)\n\n respond_to do |format|\n if @set_detail.save\n format.html { redirect_to @set_detail, notice: 'Set detail was successfully created.' }\n format.json { render :show, status: :created, location: @set_detail }\n else\n format.html { render :new }\n format.json { render json: @set_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #chart = Chart.find(params[:chart_id])\n chart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n data_set = chart.data_sets.new(params[:data_set])\n data_set.save\n\n respond_with(data_set) do |format|\n if data_set.valid?\n format.json { render json: { success: true, data_sets: data_set } }\n else\n format.json { render json: { success: false, errors: data_set.errors } }\n end\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 create\n\t\t@data_set = DataSet.new(params[:data_set])\n\n\t\trespond_to do |format|\n\t\t\tif @data_set.save\n\t\t\t\tformat.html { redirect_to @data_set, notice: 'Data set was successfully created.' }\n\t\t\t\tformat.json { render json: @data_set, status: :created, location: @data_set }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @data_set.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @sets_and_rep = SetsAndRep.new(sets_and_rep_params)\n\n respond_to do |format|\n if @sets_and_rep.save\n format.html { redirect_to @sets_and_rep, notice: 'Sets and rep was successfully created.' }\n format.json { render :show, status: :created, location: @sets_and_rep }\n else\n format.html { render :new }\n format.json { render json: @sets_and_rep.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @data_set = DataSet.new(params[:data_set])\n\n respond_to do |format|\n if @data_set.save\n format.html { redirect_to @data_set, notice: 'Project data set was successfully created.' }\n format.json { render json: @data_set.to_hash(false), status: :created, location: @data_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @data_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @uset = Uset.new(params[:uset])\n\n respond_to do |format|\n if @uset.save\n format.html { redirect_to @uset, notice: 'Uset was successfully created.' }\n format.json { render json: @uset, status: :created, location: @uset }\n else\n format.html { render action: \"new\" }\n format.json { render json: @uset.errors, status: :unprocessable_entity }\n end\n end\n end", "def admin_furniture_set_params\n params.require(:admin_furniture_set).permit(:name, :config, :comment)\n end", "def sets\n end", "def create\n @exercise_set = ExerciseSet.new(params[:exercise_set])\n\n respond_to do |format|\n if @exercise_set.save\n format.html { redirect_to @exercise_set, notice: 'Exercise set was successfully created.' }\n format.json { render json: @exercise_set, status: :created, location: @exercise_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fabricsofaset = Fabricsofaset.new(fabricsofaset_params)\n\n respond_to do |format|\n if @fabricsofaset.save\n format.html { redirect_to @fabricsofaset, notice: 'Fabricsofaset was successfully created.' }\n format.json { render :show, status: :created, location: @fabricsofaset }\n else\n format.html { render :new }\n format.json { render json: @fabricsofaset.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @question_set = QuestionSet.new(params[:question_set])\n\n respond_to do |format|\n if @question_set.save\n format.html { redirect_to @question_set, notice: 'Question set was successfully created.' }\n format.json { render json: @question_set, status: :created, location: @question_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_set_list\n @set_list = SetList.find(params[:id])\n end", "def set_setlist\n @setlist = Setlist.find(params[:id])\n end", "def set_setlist\n @setlist = Setlist.find(params[:id])\n end", "def create\n @woodensofaset = Woodensofaset.new(woodensofaset_params)\n\n respond_to do |format|\n if @woodensofaset.save\n format.html { redirect_to @woodensofaset, notice: 'Woodensofaset was successfully created.' }\n format.json { render :show, status: :created, location: @woodensofaset }\n else\n format.html { render :new }\n format.json { render json: @woodensofaset.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @attribute_set = AttributeSet.new(attribute_set_params)\n\n respond_to do |format|\n if @attribute_set.save\n format.html { redirect_to @attribute_set, notice: 'Attribute set was successfully created.' }\n format.json { render :show, status: :created, location: @attribute_set }\n else\n format.html { render :new }\n format.json { render json: @attribute_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @questionset = Questionset.new(params[:questionset])\n\n respond_to do |format|\n if @questionset.save\n format.html { redirect_to @questionset, notice: 'Questionset was successfully created.' }\n format.json { render json: @questionset, status: :created, location: @questionset }\n else\n format.html { render action: \"new\" }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @set_list = SetList.new(set_list_params)\n\n respond_to do |format|\n if @set_list.save\n format.html { redirect_to @set_list, notice: 'Set list was successfully created.' }\n format.json { render :show, status: :created, location: @set_list }\n else\n format.html { render :new }\n format.json { render json: @set_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_sets_and_rep\n @sets_and_rep = SetsAndRep.find(params[:id])\n end", "def create\n @functional_set = FunctionalSet.new(params[:functional_set])\n\n respond_to do |format|\n if @functional_set.save\n format.html { redirect_to(@functional_set, :notice => 'Functional set was successfully created.') }\n format.xml { render :xml => @functional_set, :status => :created, :location => @functional_set }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @functional_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @choice_set = ChoiceSet.new(choice_set_params)\n\n respond_to do |format|\n if @choice_set.save\n format.html { redirect_to @choice_set, notice: 'Choice set was successfully created.' }\n format.json { render :show, status: :created, location: @choice_set }\n else\n format.html { render :new }\n format.json { render json: @choice_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_setum\n @setum = Setum.find(params[:id])\n end", "def create\n @studentset = Studentset.new(params[:studentset])\n\n respond_to do |format|\n if @studentset.save\n format.html { redirect_to @studentset, notice: 'Studentset was successfully created.' }\n format.json { render json: @studentset, status: :created, location: @studentset }\n else\n format.html { render action: \"new\" }\n format.json { render json: @studentset.errors, status: :unprocessable_entity }\n end\n end\n end", "def data_set_params\n params.require(:data_set).permit(:name)\n end", "def new_set\r\n @sets[@current_set_name] = @current_set\r\n @current_set = []\r\n end", "def set_setlist\n @setlist = Setlist.find(params[:setlist_id])\n end", "def set_setlist\n @setlist = Setlist.find(params[:setlist_id])\n end", "def create\n @customer_set = current_user.customer_sets.build(customer_set_params)\n\n respond_to do |format|\n if @customer_set.save\n format.html { redirect_to @customer_set, notice: 'Customer set was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer_set }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @questionset = Questionset.new(questionset_params)\n\n respond_to do |format|\n if @questionset.save\n format.html { redirect_to @questionset, notice: 'Questionset was successfully created.' }\n format.json { render :show, status: :created, location: @questionset }\n else\n format.html { render :new }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exam_set = ExamSet.new(exam_set_params)\n\n respond_to do |format|\n if @exam_set.save\n format.html { redirect_to @exam_set, notice: 'Exam set was successfully created.' }\n format.json { render :show, status: :created, location: @exam_set }\n else\n format.html { render :new }\n format.json { render json: @exam_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @seta = Seta.new(params[:seta])\n\n respond_to do |format|\n if @seta.save\n format.html { redirect_to(@seta, :notice => 'Seta was successfully created.') }\n format.xml { render :xml => @seta, :status => :created, :location => @seta }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @seta.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @setor = Setor.new(params[:setor])\n\n respond_to do |format|\n if @setor.save\n format.html { redirect_to @setor, notice: 'Setor was successfully created.' }\n format.json { render json: @setor, status: :created, location: @setor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @setor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_furniture_set.update(admin_furniture_set_params)\n format.html { redirect_to admin_furniture_sets_path, notice: mk_notice(@admin_furniture_set, :name, 'ست مبل', :update) }\n format.json { render json: @admin_furniture_set, status: :ok, location: admin_furniture_sets_path }\n else\n format.html { render :edit }\n format.json { render json: @admin_furniture_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @defsets = Defset.all\n end", "def index\n @fabricsofasets = Fabricsofaset.all\n end", "def set_sets_template\n @sets_template = SetsTemplate.find(params[:id])\n end", "def index\n @attribute_sets = AttributeSet.all\n render json: @attribute_sets\n end", "def import_set\n\n @this_set = Cardset.find_by_short_name(params[:set_code])\n\n import_these_cards_from_this_set(params[:set_code])\n\n respond_to do |format|\n format.js\n end\n\n end", "def create\n @image_set = ImageSet.new(params[:image_set])\n\n respond_to do |format|\n if @image_set.save\n flash[:notice] = 'ImageSet was successfully created.'\n format.html { redirect_to(@image_set) }\n format.xml { render :xml => @image_set, :status => :created, :location => @image_set }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @image_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @label_set = LabelSet.new(label_set_params)\n\n respond_to do |format|\n if @label_set.save\n format.html { redirect_to @label_set, notice: 'Label set was successfully created.' }\n format.json { render :show, status: :created, location: @label_set }\n else\n format.html { render :new }\n format.json { render json: @label_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_fabricsofaset\n @fabricsofaset = Fabricsofaset.find(params[:id])\n end", "def index\n @set_details = SetDetail.all\n end", "def set_detail_params\n params.require(:set_detail).permit(:set_name)\n end", "def create\n raise Pundit::NotAuthorizedError\n @test_set = TestSet.new(permitted_params)\n permitted_to! :create, @test_set\n\n respond_to do |format|\n if @test_set.save\n format.html { redirect_to @test_set, :notice => 'Test set was successfully created.' }\n format.json { render :json => @test_set, :status => :created, :location => @test_set }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @test_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @defset.destroy\n respond_to do |format|\n format.html { redirect_to defsets_url }\n format.json { head :no_content }\n end\n end", "def multiple_new\n @customer_set = CustomerSet.new\n\n respond_to do |format|\n format.html # multiple_new.html.erb\n format.json { render json: @customer_set }\n end\n end", "def attribute_sets=(value)\n @attribute_sets = value\n end", "def new \n @franchise_set = FranchiseSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @franchise_set }\n end\n end", "def new\n @frequent_set = FrequentSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @frequent_set }\n end\n end", "def create\n @subset = Subset.new(subset_params)\n\n respond_to do |format|\n if @subset.save\n format.html { redirect_to @subset, notice: 'Subset was successfully created.' }\n format.json { render action: 'show', status: :created, location: @subset }\n else\n format.html { render action: 'new' }\n format.json { render json: @subset.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @survey_value_set = SurveyValueSet.new(params[:survey_value_set])\n\n respond_to do |format|\n if @survey_value_set.save\n format.html { redirect_to @survey_value_set, notice: 'Survey value set was successfully created.' }\n format.json { render json: @survey_value_set, status: :created, location: @survey_value_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey_value_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_data_set\n @data_set = DataSet.find(params[:id])\n end", "def create\n @indicator_set = IndicatorSet.new(params[:indicator_set])\n\n respond_to do |format|\n if @indicator_set.save\n format.html { redirect_to @indicator_set, notice: 'Indicator set was successfully created.' }\n format.json { render json: @indicator_set, status: :created, location: @indicator_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @indicator_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @skill_set = SkillSet.new(params[:skill_set])\n\n respond_to do |format|\n if @skill_set.save\n format.html { redirect_to @skill_set, notice: 'Skill set was successfully created.' }\n format.json { render json: @skill_set, status: :created, location: @skill_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @skill_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_data_set\n @data_set = DataSet.find(params[:id])\n end", "def set_data_set\n @data_set = DataSet.find(params[:id])\n end", "def create\n @card_set = CardSet.new(card_set_params)\n\n respond_to do |format|\n if @card_set.save\n format.html { redirect_to @card_set, notice: 'Card set was successfully created.' }\n format.json { render :show, status: :created, location: @card_set }\n else\n format.html { render :new }\n format.json { render json: @card_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lookup_set = LookupSet.new(lookup_set_params) #params[:lookup_set])\n\n respond_to do |format|\n if @lookup_set.save\n format.html { redirect_to(@lookup_set, :notice => 'Lookup set was successfully created.') }\n format.xml { render :xml => @lookup_set, :status => :created, :location => @lookup_set }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @shows = Show.all\n response = HTTParty.get('https://api.setlist.fm/rest/1.0/artist/94f8947c-2d9c-4519-bcf9-6d11a24ad006/setlists?p=1', headers: {\"Accept\" => \"application/json\", \"x-api-key\": \"X5zdk_R9xhoRkSxvDUDSV1n_1hlGGSRPwaDq\"})\n results = JSON.parse(response.body)\n results[\"setlist\"].each do |show|\n if Venue.find_by(mbid: show[\"venue\"][\"id\"])\n # do nothing\n else\n @venue = Venue.create(mbid: show[\"venue\"][\"id\"], \n name: show[\"venue\"][\"name\"], \n city: show[\"venue\"][\"city\"][\"name\"],\n state: show[\"venue\"][\"city\"][\"state\"],\n country: show[\"venue\"][\"city\"][\"country\"][\"code\"])\n end\n # do some not have venues? check for this\n if @venue\n @show = Show.create(name: show[\"venue\"][\"name\"], event_date: show[\"eventDate\"], venue_id: @venue.id)\n else\n @show = Show.create(name: show[\"venue\"][\"name\"], event_date: show[\"eventDate\"])\n end\n # FIXME - hardcoded for dead & co with 3\n ArtistShow.create(artist_id: 3, show_id: @show.id)\n show[\"sets\"][\"set\"].each do |set|\n # increment sets by 1 for ordering later\n encore = set[\"encore\"] if set[\"encore\"]\n set_num = 1\n @setlist = Setlist.create(number: set_num, encore: encore, show_id: @show.id)\n set[\"song\"].each do |song|\n if song[\"cover\"]\n if Artist.find_by(mbid: song[\"cover\"][\"mbid\"])\n # do nothing\n else\n @artist = Artist.create(name: song[\"cover\"][\"name\"], sort_name: song[\"cover\"][\"sortName\"], mbid: song[\"cover\"][\"mbid\"])\n end\n end\n if @artist\n @song = Song.create(name: song[\"name\"], artist_id: @artist.id) \n else\n @song = Song.create(name: song[\"name\"])\n end\n SetlistSong.create(song_id: @song.id, setlist_id: @setlist.id, position: 1 )\n end\n end\n end\n end", "def create\n @setlist = Setlist.new(setlist_params)\n\n respond_to do |format|\n if @setlist.save\n format.html { redirect_to setlists_path, notice: \"Setlist was successfully created.\" }\n format.json { render :show, status: :created, location: setlists_path }\n else\n format.html { render :index }\n format.turbo_stream { render turbo_stream: turbo_stream.replace(@setlist, partial: 'posts/form', locals: { setlist: @setlist }) } ## New for this article\n end\n end\n end", "def set_set_item\n @set_item = SetItem.find(params[:id])\n end", "def index\n @set_lists = SetList.all\n end", "def maesb_generate_equip_set\n @maesb_belongs_to_sets = []\n end", "def create\n @card_set = CardSet.new(params[:card_set])\n\n respond_to do |format|\n if @card_set.save\n format.html { redirect_to @card_set, notice: 'Card set was successfully created.' }\n format.json { render json: @card_set, status: :created, location: @card_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @set_item = SetItem.new(set_item_params)\n\n @set_item.vote_count = 0\n @set_item.play_count = 0\n respond_to do |format|\n if @set_item.save\n format.html { redirect_to event_url(params[:event_id]) }\n format.json { render action: 'show', status: :created, location: @set_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @set_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # params[:plan_setting][:contributor]=[params[:plan_setting][:creater]]\n @plan_setting = PlanSetting.new(params[:plan_setting])\n\n respond_to do |format|\n if @plan_setting.save\n @plan_setting.add_to_set(:contributor,params[:plan_setting][:creater])\n format.html { redirect_to @plan_setting, notice: 'Plan setting was successfully created.' }\n format.json { render json: @plan_setting, status: :created, location: @plan_setting }\n else\n format.html { render action: \"new\" }\n format.json { render json: @plan_setting.errors, status: :unprocessable_entity }\n end\n end\n end", "def image_set_params\n params.require(:image_set).permit(:name)\n end", "def test_public_sets\n set_names = File.readlines('data/set_names.txt')\n set_names.each_with_index do |name, index|\n get \"/sets/public/#{index}\"\n assert_equal 200, last_response.status\n assert_includes last_response.body, name \n assert_includes last_response.body, 'Study' \n assert_includes last_response.body, 'table' \n end\n end", "def create\n # Code refactoring that use the relationship between person and Entry Sets\n @entry_set = @current_user.person.entry_sets.build(params[:entry_set])\n\n respond_to do |format|\n if @entry_set.save\n format.json { render json: @entry_set, status: :created, location: @entry_set }\n else\n format.json { render json: @entry_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @project = Project.find(params[:project_id])\n @sample_set = SampleSet.new(params[:sample_set]) \n @sample_set.project_id = @project.id\n respond_to do |format|\n if @sample_set.save\n format.html { redirect_to project_path(@project), notice: 'Sample set was successfully created.' }\n format.json { render json: @sample_set, status: :created, location: @sample_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sample_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_woodensofaset\n @woodensofaset = Woodensofaset.find(params[:id])\n end", "def destroy\n gig = @gig_set.gig\n @gig_set.destroy\n gig.gig_sets.each_with_index do |set, ix|\n set.number = ix + 1\n set.save!\n end\n\n respond_to do |format|\n format.html { redirect_to edit_gig_path(gig) }\n format.json { head :no_content }\n end\n end", "def create\n @setor = Setor.new(params[:setor])\n\n respond_to do |format|\n if @setor.save\n format.html { redirect_to(setors_url) }\n format.xml { render :xml => @setor, :status => :created, :location => @setor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @setor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @workout_set = WorkoutSet.new(workout_set_params)\n\n respond_to do |format|\n if @workout_set.save\n format.html { redirect_to @workout_set, notice: 'Workout set was successfully created.' }\n format.json { render :show, status: :created, location: @workout_set }\n else\n format.html { render :new }\n format.json { render json: @workout_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @coin_set = CoinSet.new(params[:coin_set])\n\n respond_to do |format|\n if @coin_set.save\n format.html { redirect_to root_path, notice: 'Coin set was successfully created.' }\n format.json { render json: @coin_set, status: :created, location: @coin_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @coin_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @setdefault = Setdefault.new(setdefault_params)\n\n respond_to do |format|\n if @setdefault.save\n flash[:success] = 'Default was successfully created.'\n format.html { redirect_to '/' }\n format.json { render :show, status: :created, location: @setdefault }\n else\n format.html { render :new }\n format.json { render json: @setdefault.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_asset_set(client, customer_id)\n # Creates an AssetSet which will be used to link the dynamic page feed assets to a campaign.\n # Creates an operation to add the AssetSet.\n operation = client.operation.create_resource.asset_set do |asset_set|\n asset_set.name = \"My dynamic page feed #{Time.now}\"\n asset_set.type = :PAGE_FEED\n end\n\n # Sends the mutate request.\n response = client.service.asset_set.mutate_asset_sets(\n customer_id: customer_id,\n operations: [operation],\n )\n # Prints some information about the response.\n resource_name = response.results.first.resource_name\n puts \"Created asset set with resource name '#{resource_name}'\"\n\n resource_name\nend", "def fabricsofaset_params\n params.require(:fabricsofaset).permit(:title, :description, :price, :image, :previewo, :previewt, :previewth, :sdescription, :offerprice, :coupon, :brand, :color, :warrenty, :material)\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 set_data_set\n @data_set = DataSet.find_by(:id => params[:dataset_id])\n end", "def index\n @seta = Setum.all\n end", "def create\n @study_set = StudySet.new(user_id: current_user.id, link_id: params[:study_set][:link_id])\n @study_set.entries << Entry.find(params[:study_set][:entry_id])\n\n respond_to do |format|\n if @study_set.save\n if params.has_key? 'save-return'\n format.html { redirect_to current_user, notice: 'Study set was successfully created.' }\n else\n format.html { redirect_to @study_set, notice: 'Study set was successfully created.' }\n format.json { render json: @study_set.entries }\n end\n else\n format.html { render :new }\n format.json { render json: @study_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @sets_and_reps = SetsAndRep.all\n end", "def create\n \tnew_set = MTG::Set.find(params[:set_code])\n\n\tset = MtgSet.create(code: new_set.code, name: new_set.name, year: new_set.release_date)\n\tset.save\n\n\tcard_list = MTG::Card.where(set: params[:set_code]).all\n\tcard_list.each do |card|\n\t\tnew_card = MtgCard.create!(name: card.name, description: card.text, cmc: card.cmc, mtg_set_id: set.id)\n\tend\n\n\tredirect_to '/mtg_card'\n end", "def create\n @workout_set = WorkoutSet.new(params[:workout_set])\n @workout_set.user_id = current_user.id\n\n respond_to do |format|\n if @workout_set.save\n format.html { redirect_to @workout_set, notice: 'Workout set was successfully created.' }\n format.json { render json: @workout_set, status: :created, location: @workout_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @workout_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_set_detail\n @set_detail = SetDetail.find(params[:id])\n end", "def update\n @set.update_attributes({ :data => params[:data] })\n render_json :entry => @set and return\n end", "def update\n @set.update_attributes({ :data => params[:data] })\n render_json :entry => @set and return\n end", "def create\n @ad_set = AdSet.new(params[:ad_set])\n\n respond_to do |format|\n if @ad_set.save\n format.html { redirect_to(@ad_set, :notice => 'Ad set was successfully created.') }\n format.xml { render :xml => @ad_set, :status => :created, :location => @ad_set }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ad_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @exercise_set = ExerciseSet.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_set }\n end\n end" ]
[ "0.67327774", "0.6610808", "0.65066284", "0.6461349", "0.64439315", "0.6375901", "0.63615215", "0.6348379", "0.6286474", "0.62364656", "0.6229341", "0.6219675", "0.6216336", "0.6126095", "0.6113759", "0.6109354", "0.60879743", "0.60840774", "0.60746795", "0.6063196", "0.598247", "0.5974703", "0.59506273", "0.5912652", "0.59115565", "0.58994114", "0.58973897", "0.589215", "0.5866441", "0.5863792", "0.58584803", "0.58561873", "0.5835325", "0.5834251", "0.58249754", "0.5820758", "0.5820758", "0.5811077", "0.58081084", "0.5757426", "0.57494974", "0.57398945", "0.5737556", "0.57083064", "0.56873965", "0.5670099", "0.5645293", "0.56343025", "0.5632444", "0.56321084", "0.56035393", "0.55945665", "0.5587627", "0.5583365", "0.55536157", "0.55370617", "0.55228084", "0.55111265", "0.5509679", "0.5502758", "0.54964465", "0.5484002", "0.54839605", "0.5481728", "0.54800814", "0.54800814", "0.547832", "0.54776967", "0.54760087", "0.5470919", "0.54699594", "0.5467283", "0.54618573", "0.5454296", "0.5452456", "0.5445438", "0.54421186", "0.5421314", "0.5419346", "0.5410876", "0.5407168", "0.54054374", "0.54036796", "0.5397678", "0.53932714", "0.538676", "0.53731316", "0.53729355", "0.53679764", "0.5357577", "0.5357455", "0.5353363", "0.53533536", "0.53369004", "0.53354496", "0.5330892", "0.53299755", "0.53299755", "0.53265125", "0.53214467" ]
0.73800665
0
PATCH/PUT /admin/furniture/sets/1 PATCH/PUT /admin/furniture/sets/1.json
def update respond_to do |format| if @admin_furniture_set.update(admin_furniture_set_params) format.html { redirect_to admin_furniture_sets_path, notice: mk_notice(@admin_furniture_set, :name, 'ست مبل', :update) } format.json { render json: @admin_furniture_set, status: :ok, location: admin_furniture_sets_path } else format.html { render :edit } format.json { render json: @admin_furniture_set.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @defset.update(defset_params)\n format.html { redirect_to @defset, notice: 'Defset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @defset.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_admin_furniture_set\n @admin_furniture_set = Admin::Furniture::Set.find(params[:id])\n end", "def update \n @franchise_set = FranchiseSet.find(params[:id])\n\n respond_to do |format|\n if @franchise_set.update_attributes(params[:franchise_set])\n format.html { redirect_to \"/franchise_sets/\", notice: 'Franchise set was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @franchise_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @set.update_attributes({ :data => params[:data] })\n render_json :entry => @set and return\n end", "def update\n @set.update_attributes({ :data => params[:data] })\n render_json :entry => @set and return\n end", "def update\n respond_to do |format|\n if @data_set.update(data_set_params)\n format.html { redirect_to [:admin, @data_set], notice: 'Data set was successfully updated.' }\n format.json { render :show, status: :ok, location: [:admin, @data_set] }\n else\n format.html { render :edit }\n format.json { render json: @data_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @frequent_set = FrequentSet.find(params[:id])\n\n respond_to do |format|\n if @frequent_set.update_attributes(params[:frequent_set])\n format.html { redirect_to @frequent_set, notice: 'Frequent set was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @frequent_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fabricsofaset.update(fabricsofaset_params)\n format.html { redirect_to @fabricsofaset, notice: 'Fabricsofaset was successfully updated.' }\n format.json { render :show, status: :ok, location: @fabricsofaset }\n else\n format.html { render :edit }\n format.json { render json: @fabricsofaset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @setum.update(setum_params)\n format.html { redirect_to @setum, notice: 'Setum was successfully updated.' }\n format.json { render :show, status: :ok, location: @setum }\n else\n format.html { render :edit }\n format.json { render json: @setum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @set_detail.update(set_detail_params)\n format.html { redirect_to @set_detail, notice: 'Set detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @set_detail }\n else\n format.html { render :edit }\n format.json { render json: @set_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #chart = Chart.find(params[:chart_id])\n chart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n data_set = chart.data_sets.find(params[:id])\n \tdata_set.update_attributes(params[:data_set])\n\n respond_with(data_set) do |format|\n if data_set.valid?\n format.json { render json: { success: true, data_sets: data_set } }\n else\n format.json { render json: { success: false, errors: data_set.errors } }\n end\n end\n end", "def update\n @functional_set = FunctionalSet.find(params[:id])\n\n respond_to do |format|\n if @functional_set.update_attributes(params[:functional_set])\n format.html { redirect_to(@functional_set, :notice => 'Functional set was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @functional_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@data_set = DataSet.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @data_set.update_attributes(params[:data_set])\n\t\t\t\tformat.html { redirect_to @data_set, notice: 'Data set was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @data_set.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @uset = Uset.find(params[:id])\n\n respond_to do |format|\n if @uset.update_attributes(params[:uset])\n format.html { redirect_to @uset, notice: 'Uset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @liftset.update(liftset_params)\n format.html { redirect_to @liftset, notice: 'Liftset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @liftset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n @franchise = @franchise_set.franchises.find(params[:id])\n\n respond_to do |format|\n franchise_set = FranchiseSet.find(params[:franchise_set_id])\n if @franchise.update_attributes(params[:franchise])\n format.html { redirect_to \"/franchise_sets/#{franchise_set.id}/edit\" , notice: 'Franchise was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @franchise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @attribute_set.update(attribute_set_params)\n format.html { redirect_to @attribute_set, notice: 'Attribute set was successfully updated.' }\n format.json { render :show, status: :ok, location: @attribute_set }\n else\n format.html { render :edit }\n format.json { render json: @attribute_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_set = TestSet.find(params[:id])\n permitted_to! :update, @test_set.problem\n respond_to do |format|\n if @test_set.update_attributes(permitted_params)\n format.html { redirect_to @test_set, :notice => 'Test set was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @setlist.update(setlist_params)\n format.html { redirect_to @setlist, notice: \"Setlist was successfully updated.\" }\n format.json { render :show, status: :ok, location: @setlist }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @setlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @gig_set.update(gig_set_params)\n format.html { redirect_to edit_gig_path(@gig_set.gig) }\n format.json { redirect_to edit_gig_path(@gig_set.gig) }\n else\n format.html { redirect_to edit_gig_path(@gig_set.gig), error: \"Couldn't update set\" }\n format.json { redirect_to edit_gig_path(@gig_set.gig), status: :unprocessable_entity }\n end\n end\n end", "def update\n binding.pry\n respond_to do |format|\n if @sets_and_rep.update(sets_and_rep_params)\n format.html { redirect_to @sets_and_rep, notice: 'Sets and rep was successfully updated.' }\n format.json { render :show, status: :ok, location: @sets_and_rep }\n else\n format.html { render :edit }\n format.json { render json: @sets_and_rep.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n if @questionset.update_attributes(params[:questionset])\n format.html { redirect_to @questionset, notice: 'Questionset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n if @question_set.update_attributes(params[:question_set])\n format.html { redirect_to @question_set, notice: 'Question set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @set_list.update(set_list_params)\n format.html { redirect_to @set_list, notice: 'Set list was successfully updated.' }\n format.json { render :show, status: :ok, location: @set_list }\n else\n format.html { render :edit }\n format.json { render json: @set_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @seta = Seta.find(params[:id])\n\n respond_to do |format|\n if @seta.update_attributes(params[:seta])\n format.html { redirect_to(@seta, :notice => 'Seta was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @seta.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @subset.update(subset_params)\n format.html { redirect_to @subset, notice: 'Subset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @subset.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_furniture_set = Admin::Furniture::Set.new(admin_furniture_set_params)\n\n respond_to do |format|\n if @admin_furniture_set.save\n format.html { redirect_to admin_furniture_sets_path, notice: mk_notice(@admin_furniture_set, :name, 'ست مبل', :create) }\n format.json { render json: @admin_furniture_set, status: :created, location: admin_furniture_sets_path }\n else\n format.html { render :new }\n format.json { render json: @admin_furniture_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def admin_furniture_set_params\n params.require(:admin_furniture_set).permit(:name, :config, :comment)\n end", "def update_plant\n @plant.deleted = false\n\n respond_to do |format|\n if set_attributes_from_filemaker(@plant)\n format.json do\n render status: :created,\n json: {\n id: @plant.id,\n botanical_name: @plant.botanical_name,\n alternative_names: @plant.alternative_names,\n updated_at: @plant.updated_at,\n visible: (!@plant.deleted).to_s\n }\n end\n else\n format.json do\n render json: @plant.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update\n @frequencia_setor = Frequencia::Setor.find(params[:id])\n\n respond_to do |format|\n if @frequencia_setor.update_attributes(params[:frequencia_setor])\n format.html { redirect_to(@frequencia_setor, :notice => 'Setor atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @frequencia_setor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @sample_set = SampleSet.find(params[:id])\n @project = Project.find(@sample_set.project_id)\n @sample_set.name = params[:sample_set][:name]\n respond_to do |format|\n if @sample_set.save\n format.html { redirect_to project_path(@project), notice: 'Sample set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sample_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def set(sets)\n view.update_many(\"$set\" => collect_operations(sets))\n end", "def update!(**args)\n @product_sets = args[:product_sets] if args.key?(:product_sets)\n end", "def update\n @setor = Setor.find(params[:id])\n\n respond_to do |format|\n if @setor.update_attributes(params[:setor])\n format.html { redirect_to @setor, notice: 'Setor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @setor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise_set = ExerciseSet.find(params[:id])\n\n respond_to do |format|\n if @exercise_set.update_attributes(params[:exercise_set])\n format.html { redirect_to @exercise_set.workout, notice: 'Exercise set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer_set.update(customer_set_params)\n format.html { redirect_to @customer_set, notice: 'Customer set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lookup_set = LookupSet.find(lookup_set_params) # params[:id])\n\n respond_to do |format|\n if @lookup_set.update(params[:lookup_set], :without_protection => true)\n format.html { redirect_to(@lookup_set, :notice => 'Lookup set was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lookup_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @studentset = Studentset.find(params[:id])\n\n respond_to do |format|\n if @studentset.update_attributes(params[:studentset])\n format.html { redirect_to @studentset, notice: 'Studentset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @studentset.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_fabricsofaset\n @fabricsofaset = Fabricsofaset.find(params[:id])\n end", "def update\n respond_to do |format|\n if @questionset.update(questionset_params)\n format.html { redirect_to @questionset, notice: 'Questionset was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionset }\n else\n format.html { render :edit }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task_set.update(task_set_params)\n format.html { redirect_to @task_set, notice: 'Task set was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_set }\n else\n format.html { render :edit }\n format.json { render json: @task_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @woodensofaset.update(woodensofaset_params)\n format.html { redirect_to @woodensofaset, notice: 'Woodensofaset was successfully updated.' }\n format.json { render :show, status: :ok, location: @woodensofaset }\n else\n format.html { render :edit }\n format.json { render json: @woodensofaset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @exam_set.update(exam_set_params)\n format.html { redirect_to @exam_set, notice: 'Exam set was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_set }\n else\n format.html { render :edit }\n format.json { render json: @exam_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @data_set = DataSet.find(params[:id])\n editUpdate = params[:data_set].to_hash\n hideUpdate = editUpdate.extract_keys!([:hidden])\n success = false\n\n #EDIT REQUEST\n if can_edit?(@data_set)\n success = @data_set.update_attributes(editUpdate)\n end\n\n #HIDE REQUEST\n if can_hide?(@data_set)\n success = @data_set.update_attributes(hideUpdate)\n end\n\n respond_to do |format|\n if @data_set.update_attributes(params[:data_set])\n format.html { redirect_to @data_set, notice: 'DataSet was successfully updated.' }\n format.json { render json: {}, status: :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @data_set.errors.full_messages(), status: :unprocessable_entity }\n end\n end\n end", "def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end", "def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end", "def update\n @setmarkassent = Setmarkassent.find(params[:id])\n\n respond_to do |format|\n if @setmarkassent.update_attributes(params[:setmarkassent])\n format.html { redirect_to @setmarkassent, notice: 'Setmarkassent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @setmarkassent.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 actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\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 respond_to do |format|\n if @data_set_type.update(data_set_type_params)\n format.html { redirect_to @data_set_type, notice: 'Data set type was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_set_type }\n else\n format.html { render :edit }\n format.json { render json: @data_set_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @admin_furniture_sets = Admin::Furniture::Set.all.paginate(page: params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @admin_furniture_sets.map { |i| { value: i.id, text: \"#{i.name} #{i.config.to_s}\" } }, status: :ok }\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 @adm_sets.update(admin_setting_params)\n format.html { redirect_to [:admin, :settings], notice: 'Setting updated.' }\n format.json { render :show, status: :ok, location: @adm_sets }\n else\n format.html { render :edit }\n format.json { render json: @adm_sets.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_furniture\n @furniture = Admin::Furniture::Furniture.find(params[:id])\n end", "def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to [:admin, @chef], notice: t('messages.updated', model:Chef.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chef.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @choice_set.update(choice_set_params)\n format.html { redirect_to @choice_set, notice: 'Choice set was successfully updated.' }\n format.json { render :show, status: :ok, location: @choice_set }\n else\n format.html { render :edit }\n format.json { render json: @choice_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @coin_set = CoinSet.find(params[:id])\n \n respond_to do |format|\n if @coin_set.update_attributes(params[:coin_set])\n # an update should be coming from the coin_set show page.\n format.html { redirect_to @coin_set, notice: 'Coin set was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @coin_set.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 @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @furniture.update(furniture_params)\n format.html { redirect_to @furniture, notice: \"Furniture was successfully updated.\" }\n format.json { render :show, status: :ok, location: @furniture }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @furniture.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n validate_save_and_respond(load_change_set, :edit)\n end", "def update\n validate_save_and_respond(update_change_set, :edit)\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 @product_series = ProductSeries.find(params[:id])\n\n respond_to do |format|\n if @product_series.update_attributes(params[:product_series])\n format.html { redirect_to [:admin, @product_series], notice: 'Product series was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_series.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n if @fabric.update_attributes(params[:fabric])\n format.html { redirect_to @fabric, notice: 'Fabric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fabric.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n prevent_browser_caching\n # update the uploaded images\n update_uploaded_images @furniture, :admin_furniture_furniture\n # if the user removed the cover image? reset the cover index\n @furniture.cover_details[:index] = 0 if ((params[:admin_furniture_furniture][:images_to_delete] and params[:admin_furniture_furniture][:images_to_delete].include? @furniture.cover_details['index']) or @furniture.cover_details['index'].to_i >= @furniture.images.length)\n\n respond_to do |format|\n if @furniture.update(furniture_params)\n format.html { redirect_to redirection_url, notice: 'محصول «<b>%s</b>» با موفقیت ویرایش شد.' %@furniture.name }\n format.json { render json: @furniture, status: :ok, location: redirection_url }\n else\n format.html { render :edit }\n format.json { render json: @furniture.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quantile_setting = QuantileSetting.find(params[:id])\n\n respond_to do |format|\n if @quantile_setting.update_attributes(params[:quantile_setting])\n format.html { redirect_to quantile_settings_path, notice: 'Quantile setting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quantile_setting.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", "def update\n respond_to do |format|\n if @key_set.update(key_set_params)\n format.html { redirect_to @key_set, notice: 'Key set was successfully updated.' }\n format.json { render :show, status: :ok, location: @key_set }\n else\n format.html { render :edit }\n format.json { render json: @key_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @configuration_set = ConfigurationSet.find(params[:id])\n\n respond_to do |format|\n if (params[:commit] == \"Guardar\")\n if @configuration_set.update_attributes(params[:configuration_set])\n format.html { redirect_to configuration_sets_path, notice: 'Configuration set was successfully updated.' }\n format.json { head :no_content }\n else\n @enterprises = Enterprise.includes(:devices).all\n format.html { render \"su_index\" }\n format.json { render json: @configuration_set.errors, status: :unprocessable_entity }\n end\n else\n if (ConfigurationSet.find_by_name(params[:configuration_set][:name]))\n device = Device.find(params[:device_id])\n device.AplicarSet(params[:configuration_set][:name])\n format.html { redirect_to configuration_sets_path, notice: 'Configuration set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to configuration_sets_path, notice: 'No existe ningun Set de Configracion con el nombre ingresado' }\n format.json { head :no_content }\n end\n end\n end\n end", "def update\n @entry_set = EntrySet.find(params[:id])\n @entry_set.update_attributes(params[:entry_set])\n\n render 'show'\n \n end", "def update\n respond_to do |format|\n if @setbreak.update(setbreak_params)\n format.json { respond_with_bip @setbreak }\n else\n format.json { respond_with_bip @setbreak }\n end\n end\n end", "def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = if @resource\n DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user) # update dataset\n else\n DatasetParser.new(hash: params['dataset'], user: @user, id_string: params[:id]) # upsert dataset with identifier\n end\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n @poll_options_set = PollOptionsSet.find(params[:id])\n\n respond_to do |format|\n if @poll_options_set.update_attributes(params[:poll_options_set])\n format.html { redirect_to @poll_options_set, notice: 'Poll options set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poll_options_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @furniture.update(furniture_params)\n format.html { redirect_to @furniture, notice: 'Furniture Has Been Successfully Updated.' }\n format.json { render :show, status: :ok, location: @furniture }\n else\n format.html { render :edit }\n format.json { render json: @furniture.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @indicator_set = IndicatorSet.find(params[:id])\n\n respond_to do |format|\n if @indicator_set.update_attributes(params[:indicator_set])\n format.html { redirect_to @indicator_set, notice: 'Indicator set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @indicator_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @setor = Setor.find(params[:id])\n\n respond_to do |format|\n if @setor.update_attributes(params[:setor])\n format.html { redirect_to(setors_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @setor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @product_set = ProductSet.find(params[:id])\n\t#category = Categories.find(params[:category_id])\n\t#@product_set.category = category\n\t\n respond_to do |format|\n if @product_set.update_attributes(params[:product_set])\n flash[:notice] = 'ProductSet was successfully updated.'\n format.html { redirect_to(admin_product_sets_url) }\n format.xml { head :ok }\n else\n\t\t@categories = Category.find(:all)\n\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @skill_set = SkillSet.find(params[:id])\n\n respond_to do |format|\n if @skill_set.update_attributes(params[:skill_set])\n format.html { redirect_to @skill_set, notice: 'Skill set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @skill_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @data_set.update_attributes(params[:data_set])\n @data_set.set_visibility(current_user, params)\n flash[:notice] = 'DataSet was successfully updated.'\n format.html { redirect_to(@data_set) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @data_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def pro_farm_update\n respond_to do |format|\n activo = params[:pro_far][:activo_produc]\n farmacia_id = session[:farmacia_id]\n id = params[:id]\n ProFar.where(producto_id: id, farmacium_id:farmacia_id).update_all(activo_produc: 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 @dataset.update_attributes(params[:dataset])\n format.html { redirect_to @dataset, notice: 'Dataset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch_namespaced_stateful_set_with_http_info(name, namespace, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.patch_namespaced_stateful_set ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling AppsV1Api.patch_namespaced_stateful_set\"\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && namespace.nil?\n fail ArgumentError, \"Missing the required parameter 'namespace' when calling AppsV1Api.patch_namespaced_stateful_set\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling AppsV1Api.patch_namespaced_stateful_set\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'namespace' + '}', namespace.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'dryRun'] = opts[:'dry_run'] if !opts[:'dry_run'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json-patch+json', 'application/merge-patch+json', 'application/strategic-merge-patch+json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['BearerToken']\n data, status_code, headers = @api_client.call_api(:PATCH, 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 => 'V1StatefulSet')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#patch_namespaced_stateful_set\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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 ingredient.update(ingredient_params)\n render json: ingredient\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 update\n @bruschettum = Bruschettum.find(params[:id])\n @bruschettum.ingredients.clear\n params[:ingredient].each{|ingr|\n @bruschettum.ingredients << Ingredient.find_by_name(ingr)\n }\n\n respond_to do |format|\n if @bruschettum.update_attributes(params[:bruschettum])\n format.html { redirect_to @bruschettum, notice: 'Bruschettum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bruschettum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_attr\n #sanity checks \n @persona = current_persona\n @mediaset = @persona.mediasets.find(params[:id])\n \n respond_to do |format|\n @mediaset.update_attributes( params[:mediaset] )\n format.json{ respond_with_bip(@mediaset) }\n end\n end", "def update\n respond_to do |format|\n if @label_set.update(label_set_params)\n format.html { redirect_to @label_set, notice: 'Label set was successfully updated.' }\n format.json { render :show, status: :ok, location: @label_set }\n else\n format.html { render :edit }\n format.json { render json: @label_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kickoff = Kickoff.find(params[:id])\n\n respond_to do |format|\n if @kickoff.update_attributes(params[:kickoff])\n format.html { redirect_to @kickoff, notice: 'Kickoff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kickoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_furniture\n @furniture = Furniture.find(params[:id])\n end", "def set_furniture\n @furniture = Furniture.find(params[:id])\n end", "def update\n respond_to do |format|\n if @skillset.update(skillset_params)\n format.html { redirect_to @skillset, notice: 'Skillset was successfully updated.' }\n format.json { render :show, status: :ok, location: @skillset }\n else\n format.html { render :edit }\n format.json { render json: @skillset.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 respond_to do |format|\n activo = params[:lab_far][:activo]\n farmacia_id = session[:farmacia_id]\n id = params[:id]\n LabFar.where(laboratorio_id: id, farmacium_id:farmacia_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 @admin_fashion.update(admin_fashion_params)\n format.html { redirect_to @admin_fashion, notice: 'Fashion was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_fashion }\n else\n format.html { render :edit }\n format.json { render json: @admin_fashion.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6689169", "0.6584886", "0.65191376", "0.64569855", "0.64569855", "0.6429768", "0.64217395", "0.6384779", "0.6360191", "0.6352287", "0.6289147", "0.6262751", "0.6127498", "0.60628635", "0.60487837", "0.6036398", "0.60170966", "0.59799767", "0.595065", "0.5946467", "0.5932402", "0.59290445", "0.592003", "0.5914026", "0.5883527", "0.5875342", "0.58649826", "0.58236575", "0.5800223", "0.5790488", "0.57877976", "0.5787306", "0.57810545", "0.5777469", "0.5733611", "0.5727081", "0.57254696", "0.57245004", "0.57165295", "0.5690011", "0.5686275", "0.56847656", "0.5654617", "0.56463605", "0.5645865", "0.56456125", "0.5645111", "0.5643765", "0.5639279", "0.56276155", "0.5611303", "0.5598509", "0.5586972", "0.55823505", "0.55807436", "0.5569802", "0.55628234", "0.5558744", "0.555816", "0.5557262", "0.5549354", "0.55464154", "0.55463094", "0.55387825", "0.5537166", "0.55365443", "0.553008", "0.55290145", "0.5522376", "0.55146414", "0.5512136", "0.5509655", "0.55084425", "0.5498018", "0.54957956", "0.54943717", "0.5487128", "0.5478399", "0.54757404", "0.547168", "0.54710567", "0.5469743", "0.54691106", "0.5466714", "0.5462522", "0.5454766", "0.54486275", "0.5447182", "0.5428489", "0.54281193", "0.54275554", "0.54230267", "0.5422574", "0.5419699", "0.54178935", "0.54178935", "0.5416728", "0.5416487", "0.5407766", "0.5406883" ]
0.7071458
0
DELETE /admin/furniture/sets/1 DELETE /admin/furniture/sets/1.json
def destroy @admin_furniture_set.destroy respond_to do |format| format.html { redirect_to admin_furniture_sets_path, notice: mk_notice(@admin_furniture_set, :name, 'ست مبل', :destroy) } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @defset.destroy\n respond_to do |format|\n format.html { redirect_to defsets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fabricsofaset.destroy\n respond_to do |format|\n format.html { redirect_to fabricsofasets_url, notice: 'Fabricsofaset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy \n @franchise_set = FranchiseSet.find(params[:id])\n @franchise_set.destroy\n\n respond_to do |format|\n format.html { redirect_to franchise_sets_url }\n format.json { head :ok }\n end\n end", "def destroy\n @setum.destroy\n respond_to do |format|\n format.html { redirect_to seta_url, notice: 'Setum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @uset = Uset.find(params[:id])\n @uset.destroy\n\n respond_to do |format|\n format.html { redirect_to usets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @set_detail.destroy\n respond_to do |format|\n format.html { redirect_to set_details_url, notice: 'Set detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @woodensofaset.destroy\n respond_to do |format|\n format.html { redirect_to woodensofasets_url, notice: 'Woodensofaset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @frequent_set = FrequentSet.find(params[:id])\n @frequent_set.destroy\n\n respond_to do |format|\n format.html { redirect_to frequent_sets_url }\n format.json { head :ok }\n end\n end", "def destroy\n @liftset.destroy\n respond_to do |format|\n format.html { redirect_to liftsets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @functional_set = FunctionalSet.find(params[:id])\n @functional_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(functional_sets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @subset.destroy\n respond_to do |format|\n format.html { redirect_to subsets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_set = ExerciseSet.find(params[:id])\n @exercise_set.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @setlist.destroy\n respond_to do |format|\n format.html { redirect_to setlists_url, notice: \"Setlist was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_set = TestSet.find(params[:id])\n permitted_to! :destroy, @test_set\n @test_set.destroy\n\n respond_to do |format|\n format.html { redirect_to test_sets_url }\n format.json { head :ok }\n end\n end", "def destroy\n \t#chart = Chart.find(params[:chart_id])\n \tchart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n \tdata_set = chart.data_sets.find(params[:id])\n \tdata_set.destroy\n\n respond_with(data_set) do |format|\n format.json { render json: { success: data_set.destroyed? } }\n end\n end", "def destroy\n @entry_set = EntrySet.find(params[:id])\n @entry_set.destroy\n\n respond_to do |format|\n format.html { redirect_to entry_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@data_set = DataSet.find(params[:id])\n\t\t@data_set.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to data_sets_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def destroy\n @data_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_sets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sets_and_rep.destroy\n respond_to do |format|\n format.html { redirect_to sets_and_reps_url, notice: 'Sets and rep was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy \n @franchise = @franchise_set.franchises.find(params[:id])\n @franchise.destroy\n\n # respond_to do |format| \n # format.html { redirect_to \"/franchise_sets/#{franchise_set.id}/edit\" }\n # format.json { head :ok }\n # end\n \n respond_to do |format|\n format.json {head :ok}\n end\n \n end", "def destroy\n @studentset = Studentset.find(params[:id])\n @studentset.destroy\n\n respond_to do |format|\n format.html { redirect_to studentsets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @attribute_set.destroy\n respond_to do |format|\n format.html { redirect_to attribute_sets_url, notice: 'Attribute set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @set_list.destroy\n respond_to do |format|\n format.html { redirect_to set_lists_url, notice: 'Set list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @setmarkassent = Setmarkassent.find(params[:id])\n @setmarkassent.destroy\n\n respond_to do |format|\n format.html { redirect_to setmarkassents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam_set.destroy\n respond_to do |format|\n format.html { redirect_to exam_sets_url, notice: 'Exam set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionset = Questionset.find(params[:id])\n @questionset.destroy\n\n respond_to do |format|\n format.html { redirect_to questionsets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer_set.destroy\n respond_to do |format|\n format.html { redirect_to customer_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n gig = @gig_set.gig\n @gig_set.destroy\n gig.gig_sets.each_with_index do |set, ix|\n set.number = ix + 1\n set.save!\n end\n\n respond_to do |format|\n format.html { redirect_to edit_gig_path(gig) }\n format.json { head :no_content }\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 @question_set = QuestionSet.find(params[:id])\n @question_set.destroy\n\n respond_to do |format|\n format.html { redirect_to question_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @coin_set = CoinSet.find(params[:id])\n @coin_set.destroy\n\n respond_to do |format|\n format.html { redirect_to coin_sets_url }\n format.json { head :ok }\n end\n end", "def destroy\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @study_set.destroy\n respond_to do |format|\n format.html { redirect_to study_sets_url, notice: 'Study set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @seta = Seta.find(params[:id])\n @seta.destroy\n\n respond_to do |format|\n format.html { redirect_to(setas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @set_item = SetItem.find(params[:id])\n @set_item.destroy\n respond_to do |format|\n format.html { redirect_to event_url(@set_item.event_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @data_set_type.destroy\n respond_to do |format|\n format.html { redirect_to data_set_types_url, notice: 'Data set type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @configuration_set = ConfigurationSet.find(params[:id])\n @configuration_set.destroy\n\n respond_to do |format|\n format.html { redirect_to configuration_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @setor = Setor.find(params[:id])\n @setor.destroy\n\n respond_to do |format|\n format.html { redirect_to setors_url }\n format.json { head :no_content }\n end\n end", "def delete_set_and_cards\n\n @this_set = Cardset.find_by_short_name(params[:set_code])\n\n @this_set.destroy\n Card.where(set: params[:set_code_upper]).destroy_all\n\n respond_to do |format|\n format.js\n end\n\n end", "def destroy\n @frequencia_setor = Frequencia::Setor.find(params[:id])\n @frequencia_setor.destroy\n\n respond_to do |format|\n format.html { redirect_to(frequencia_setores_url) }\n format.xml { head :ok }\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 @adm_sets.destroy\n respond_to do |format|\n format.html { redirect_to admin_settings_url, notice: 'Setting destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @indicator_set = IndicatorSet.find(params[:id])\n @indicator_set.destroy\n\n respond_to do |format|\n format.html { redirect_to indicator_sets_url }\n format.json { head :no_content }\n end\n end", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def destroy\n @task_set.destroy\n respond_to do |format|\n format.html { redirect_to task_sets_url, notice: 'Task set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mediaset = Mediaset.find(params[:id])\n @mediaset.destroy\n\n respond_to do |format|\n format.html { redirect_to mediasets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n persister.delete(resource: delete_change_set)\n respond_to do |format|\n format.html { redirect_to data_dictionary_fields_url, notice: 'Metadata field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n contest = @data_set.contest\n @data_set.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Data set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sample_set = SampleSet.find(params[:id])\n @project = Project.find(@project_property.project_id)\n @sample_set.destroy\n respond_to do |format|\n format.html { redirect_to sample_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @key_set.destroy\n respond_to do |format|\n format.html { redirect_to key_sets_url, notice: 'Key set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionset.destroy\n respond_to do |format|\n format.html { redirect_to questionsets_url, notice: 'Questionset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @futbolada = Futbolada.find(params[:id])\n @futbolada.destroy\n\n respond_to do |format|\n format.html { redirect_to gestion_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tourney_set.destroy\n respond_to do |format|\n format.html { redirect_to tourney_sets_url, notice: 'Tourney set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\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 @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 @survey_value_set = SurveyValueSet.find(params[:id])\n @survey_value_set.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_value_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @eset.remove_from_scenario\n @eset.destroy\n\n respond_to do |format|\n flash[:notice] = @eset.name + \" successfully deleted.\" \n format.html { redirect_to :controller => 'event_sets', :action => 'index',:project_id =>@project }\n format.xml { head :ok }\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 @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :ok }\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 @point_of_sale.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @game_set.destroy\n respond_to do |format|\n format.html { redirect_to game_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fabric = Fabric.find(params[:id])\n @fabric.destroy\n\n respond_to do |format|\n format.html { redirect_to fabrics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_meta_datum.destroy\n respond_to do |format|\n format.html { redirect_to test_meta_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @choice_set.destroy\n respond_to do |format|\n format.html { redirect_to choice_sets_url, notice: 'Choice set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quantile_setting = QuantileSetting.find(params[:id])\n @quantile_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to quantile_settings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fullassessment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @gene_set_item.destroy\n respond_to do |format|\n format.html { redirect_to gene_set_items_url, notice: 'Gene set item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kata.destroy\n respond_to do |format|\n format.html { redirect_to katas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @familium = Familium.find(params[:id])\n @familium.destroy\n\n respond_to do |format|\n format.html { redirect_to familia_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @consultum = Consultum.find(params[:id])\n @consultum.destroy\n\n respond_to do |format|\n format.html { redirect_to consulta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fluxomatricula = Fluxomatricula.find(params[:id])\n @fluxomatricula.destroy\n\n respond_to do |format|\n format.html { redirect_to fluxomatriculas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dataset_datum.destroy\n respond_to do |format|\n format.html { redirect_to dataset_data_url }\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 @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 destroy\n @fabrica.destroy\n respond_to do |format|\n format.html { redirect_to fabricas_url }\n format.json { head :no_content }\n end\n end", "def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end", "def destroy\n @furniture.destroy\n respond_to do |format|\n format.html { redirect_to furnitures_url, notice: 'Furniture Has Been Successfully Deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @unit_fuel.destroy\n respond_to do |format|\n format.html { redirect_to unit_fuels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product_set = ProductSet.find(params[:id])\n @product_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_product_sets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @historial = Historial.find(params[:id])\n @historial.destroy\n\n respond_to do |format|\n format.html { redirect_to historials_url }\n format.json { head :ok }\n end\n end", "def destroy\r\n @batch = Batch.find(params[:batch_id])\r\n @batch_set.destroy\r\n respond_to do |format|\r\n format.html { redirect_to @batch, notice: 'Batch set was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\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 @unit.destroy\n respond_to do |format|\n format.html { redirect_to new_food_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @expensesbasis.destroy\n respond_to do |format|\n format.html { redirect_to [@post, @expensesbasis], notice: 'Expensesbase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lookup_set = LookupSet.find(params[:id])\n @lookup_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_sets_url) }\n format.xml { head :ok }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @skillset.destroy\n respond_to do |format|\n format.html { redirect_to skillsets_url, notice: 'Skillset 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 authorize! :manage, @selectf\n\n @selectf.destroy\n respond_to do |format|\n format.html { redirect_to [@metric.service, @metric] }\n format.json { head :no_content }\n end\n end", "def destroy\n @tx_land_grants_special_collection.destroy\n respond_to do |format|\n format.html { redirect_to tx_land_grants_special_collections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @label_set.destroy\n respond_to do |format|\n format.html { redirect_to label_sets_url, notice: 'Label set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @skillset.destroy\n respond_to do |format|\n format.html { redirect_to employees_url, notice: 'Skillset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @skillset.destroy\n respond_to do |format|\n format.html { redirect_to skillsets_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.73830193", "0.73089755", "0.73057306", "0.72444504", "0.7239075", "0.703127", "0.70215315", "0.70210385", "0.6936913", "0.69265336", "0.6900119", "0.6896421", "0.68360656", "0.68359584", "0.6817454", "0.6797078", "0.67791826", "0.6774843", "0.6769145", "0.67560476", "0.6744611", "0.6743296", "0.67364085", "0.6728479", "0.6720799", "0.67162067", "0.66944194", "0.6693634", "0.66528296", "0.6648123", "0.66420436", "0.6634751", "0.6631647", "0.6598433", "0.65983254", "0.6596687", "0.65892434", "0.6586168", "0.6581099", "0.65804374", "0.65759623", "0.654792", "0.65471005", "0.6545938", "0.65451807", "0.654463", "0.6540234", "0.65365", "0.6530055", "0.65254635", "0.6519279", "0.65158796", "0.6514516", "0.65133446", "0.6511574", "0.6511574", "0.6485389", "0.64840704", "0.6480111", "0.6477486", "0.647739", "0.64736855", "0.6467112", "0.6467066", "0.646507", "0.6454822", "0.6451917", "0.64505064", "0.64492804", "0.64488405", "0.64447683", "0.644053", "0.64383054", "0.6437043", "0.64312583", "0.6427405", "0.64251506", "0.6421439", "0.64178944", "0.64173096", "0.64141226", "0.6410356", "0.64006263", "0.63983214", "0.63970774", "0.639686", "0.63962334", "0.63961077", "0.63924193", "0.63917273", "0.6390632", "0.6386212", "0.6379078", "0.6378807", "0.63777345", "0.63762647", "0.63754594", "0.63753957", "0.63750875", "0.6374138" ]
0.7371171
1
Use callbacks to share common setup or constraints between actions.
def set_admin_furniture_set @admin_furniture_set = Admin::Furniture::Set.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 admin_furniture_set_params params.require(:admin_furniture_set).permit(:name, :config, :comment) 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
Author: Tae Noppakun Wongsrinoppakun
def merge(left, right) result = [] left_index, right_index = 0, 0 while (left_index < left.length && right_index < right.length) left_element = left[left_index] right_element = right[right_index] if left_element <= right_element result << left_element left_index += 1 else result << right_element right_index += 1 end end # add whatever is left from the left or right to the result if left result += left[left_index..-1] end if right result += right[right_index..-1] end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def schubert; end", "def terpene; end", "def probers; end", "def suivre; end", "def verdi; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def who_we_are\r\n end", "def formation; end", "def romeo_and_juliet; end", "def jack_handey; end", "def zuruecksetzen()\n end", "def stderrs; end", "def schumann; end", "def berlioz; end", "def malts; end", "def villian; end", "def trd; end", "def rossini; end", "def gounod; end", "def king_richard_iii; end", "def anchored; end", "def weber; end", "def bellini; end", "def sn\n end", "def guct\n end", "def nn\n end", "def eplore\n end", "def dh; end", "def refutal()\n end", "def buzzword; end", "def buzzword; end", "def ismn; end", "def herald; end", "def offences_by; end", "def mambo_no_5; end", "def ibu; end", "def intensifier; end", "def celebration; end", "def hd\n \n end", "def blg; end", "def feruchemist; end", "def custom; end", "def custom; end", "def bs; end", "def strain; end", "def r; end", "def r; end", "def operations; end", "def operations; end", "def parslet; end", "def parslet; end", "def parslet; end", "def parslet; end", "def tld; end", "def tld; end", "def tongue_twister; end", "def hiss; end", "def scientist; end", "def how_it_works\r\n end", "def relatorios\n end", "def upc_e; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def mitch_hedberg; end", "def sld; end", "def silly_adjective; end", "def motto; end", "def nasa_space_craft; end", "def lsi; end", "def england\n end", "def spren; end", "def as_you_like_it_quote; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def p15\n\t\nend", "def order; end", "def order; end", "def in_law; end", "def yyerrok; end", "def yyerrok; end", "def implementation; end", "def implementation; end", "def wagner; end", "def romeo_and_juliet_quote; end", "def identify; end", "def poem; end" ]
[ "0.72684675", "0.71683234", "0.710227", "0.70357525", "0.70080054", "0.691233", "0.6758216", "0.6758216", "0.6758216", "0.6758216", "0.6729461", "0.6673361", "0.6635414", "0.6634765", "0.6612209", "0.66120017", "0.6579833", "0.65747154", "0.6561361", "0.6495476", "0.64791137", "0.6435468", "0.6406795", "0.64038384", "0.63554716", "0.6312913", "0.6292694", "0.6289887", "0.6263534", "0.62490875", "0.61898637", "0.61501366", "0.6135312", "0.61341226", "0.61341226", "0.6125296", "0.61181265", "0.60811", "0.60775596", "0.6071917", "0.60639596", "0.6052943", "0.60468453", "0.60448384", "0.6042269", "0.60230213", "0.60230213", "0.60143256", "0.60128856", "0.6010204", "0.6010204", "0.6001593", "0.6001593", "0.5996846", "0.5996846", "0.5996846", "0.5996846", "0.59940547", "0.59940547", "0.599053", "0.5982462", "0.59682024", "0.5959633", "0.5951836", "0.5940593", "0.5933684", "0.5933684", "0.5933684", "0.5933684", "0.5933684", "0.5933684", "0.5919711", "0.5912623", "0.59052527", "0.58968794", "0.58951354", "0.58877987", "0.5887773", "0.5867315", "0.5857694", "0.5850374", "0.5850374", "0.5850374", "0.5850374", "0.5850374", "0.5850374", "0.5850374", "0.5850374", "0.5850374", "0.5839421", "0.5834427", "0.5834427", "0.58319336", "0.58286744", "0.58286744", "0.5810302", "0.5810302", "0.58055735", "0.5793891", "0.5791621", "0.5787341" ]
0.0
-1
The create_empty_field method creates a twodimensional array. One comprising the rows of the field matrix, and the other the columns.
def create_empty_field @field_matrix = Array.new(length) { Array.new(width, ' . ') } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_empty(rows, columns)\n @rch = Array.new(rows)\n @gch = Array.new(rows)\n @bch = Array.new(rows)\n \n 0.upto rows-1 do |r|\n @rch[r] = Array.new(columns, 0)\n @gch[r] = Array.new(columns, 0)\n @bch[r] = Array.new(columns, 0)\n end \n end", "def build_minefield\n @field = []\n @row_count.times do\n row = []\n @column_count.times do\n row << Cell.new\n end\n @field << row\n end\n end", "def createField(rows,columns)\n\t\t@rows = rows\n\t\t@columns = columns\n\t\t@field = Array.new(rows) {Array.new(columns,Cell.new)}\n\t\tself\n\tend", "def generate_field\n field_rows = []\n (Field::ROWS - 3).times do\n field_rows << Row.new\n end\n field_rows << Row.new([0,3,4,5,6])\n field_rows << Row.new([0,3,4,5,6])\n field_rows << Row.new([0,3,4,5,6])\n Field.new field_rows\n end", "def create_grid\n grid = Array.new(6, Array.new(7, BLANK))\n end", "def create_matrix\n (0...@height).to_a.map {|element| [0]*@width}\n end", "def zeroBoard(nRows, nCols)\r\n Array.new(nRows) {Array.new(nCols, 0)}\r\n end", "def create_game_field_array\r\n\t\r\n\t\ti=0\r\n\t\twhile i < 8 do\r\n\t\t\tj=0\r\n\t\t\t\r\n\t\t\twhile j < 8 do\r\n\t\t\t #Copy the \".\" object in the actual Position of the 2 dimensional Array \r\n\t \t @nha[i][j] =\".\"\t\t\r\n\t\t\t\tj+=1\t\t\r\n\t\t\tend\r\n\t\t\ti+=1\r\n\t\tend\r\n\t\treturn true\r\n\tend", "def create_cells\n (0...rows).each do |r|\n (0...columns).each do |c|\n @fields[r][c] = Cell.new(r, c)\n end\n end\n end", "def create_empty_array\n @outcome_array = Array.new(find_number_of_rows+1) { Array.new(find_number_of_columns+1) }\nend", "def create_board\n cols = Array.new(7) { Array.new(6, 0) }\n cols\n end", "def create_restricted_board(without_field)\n m_temp = *@b_nl\n\n all_numbered_tiles.each do |x,y|\n next if ((x == without_field[0]) && (y == without_field[1]))\n up = [x-1,y]\n down = [x+1,y]\n left = [x,y-1]\n right = [x,y+1]\n\n numbered_fields = [up,right,down,left].reject{|a,b| ((a < 0) || (b < 0) || (a > @row_count-1) || (b > @col_count-1))}.uniq + [[x,y]]\n\n numbered_fields.each do |i,j|\n begin\n m_temp[i][j] = 1\n rescue\n binding.pry\n raise\n end\n end\n end\n\n Matrix[*m_temp]\n end", "def create\n (0..7).each do |row|\n @board << []\n (0..7).each do |col| \n @board[row] << \"[ ]\"\n end\n end\n end", "def initialise_cell_array\n\t\t@cells = []\n\t\t@room_map = {}\n\t\t@corridor_map = {}\n\t\t@corridor_seeds = []\n\t\t(0..width).each do |i|\n\t\t\t@cells[i] = []\n\t\t\t(0..height).each do |j|\n\t\t\t\t@cells[i][j] = Cell.new(i,j, Cell::UNALLOCATED)\n\t\t\tend\n\t\tend\n\tend", "def create_work_matrix(array)\n array[1..-2].each_with_object([]) do |line, arr|\n line.gsub!(/\\s/, '0')\n arr << line[1..-2].chars\n end.to_a\n end", "def empty_puzzle\n result = []\n @amount_row.times do |index|\n result << [0]*@amount_column\n end\n result\n end", "def initialise_cell_array\n @cells = []\n @room_map = {}\n @corridor_map = {}\n @corridor_seeds = []\n (0..width).each do |i|\n @cells[i] = []\n (0..height).each do |j|\n @cells[i][j] = Cell.new(i, j, Cell::UNALLOCATED)\n end\n end\n end", "def create_matrix\n rows_affected = []\n columns_affected = []\n\n # converting from string to int\n @rows_affected.each do |row|\n rows_affected << row.to_i\n end\n @columns_affected.each do |column|\n columns_affected << column.to_i\n end\n\n max_rows = rows_affected.max\n max_columns = columns_affected.max\n\n # round up to odd num\n if max_rows % 2 == 0\n max_rows = max_rows + 1\n end\n if max_columns % 2 == 0\n max_columns = max_columns + 1\n end\n\n @matrix = Array.new(max_rows)\n for index in 0...max_rows\n @matrix[index] = Array.new(max_columns)\n end\n\n # initialize matrix with 0s\n for i in 0...max_rows\n for j in 0...max_columns\n @matrix[i][j] = 0\n end\n end\n\n @number_of_rows = @matrix.size\n @number_of_columns = @matrix[0].size\n end", "def get_blank_row\n\t\tblank_row = []\n\t\tMastermind::BOARD_WIDTH.times { blank_row << Mastermind::COLORS[:blank] }\n\t\tblank_row\n\tend", "def create_matrix\n @long.times do |long|\n @matriz.push([])\n @width.times do |_width|\n @matriz[long].push([' . ', ' * '].sample)\n end\n end\n kill_cells_in_borders\n end", "def initialize\n\t\t\t@empty_cell = '_'\n\t\t\t@board = Array.new(3) {Array.new(3,@empty_cell)}\n\t\tend", "def new_matrix(row_dimension, column_dimension)\n Array.new(row_dimension) do\n Array.new(column_dimension) do\n @cell = [' ', 'X'].sample\n end\n end\nend", "def create_board\n b = Hash.new\n for i in 1..7\n for j in 1..6\n b[[i,j]] = @empty_sign\n end\n end\n return b\n end", "def generate_grid\n grid = []\n @y.times do\n row = []\n @x.times do\n row << nil\n end\n grid << row\n end\n grid\n end", "def initMatrix(a)\n\t\tfor i in 0..5\n\t\tcolumn = []\n\t\ta[i] = column\n\t\t\tfor j in 0..5\n\t\t\tcolumn[j] = \" \"\n\t\t\tend\n\t\tend\n\treturn a\t\n\tend", "def new_zeros\n self.class.zeros(*shape)\n end", "def make_grid\n @grid = Array.new(4){Array.new(4)}\n end", "def fill_board\n MAXY.times do |t|\n @board << Array.new(MAXX, 0) if @board[t].nil?\n end\n\n @board.map! do |row|\n row << [0] * (MAXX - row.size)\n row.flatten\n end\n end", "def initiate_grid\n new_grid = []\n @width.times do |x|\n new_grid[x] = []\n @height.times do |y|\n new_grid[x][y] = 0\n end\n end\n new_grid\n end", "def matrix(fill_value = -1)\n Matrix[*@stats.pad(fill_value).each_slice(7).to_a.transpose]\n end", "def fill_up_empty_fields\n (0..(PANELS_COUNT-1)).each do |panel_no|\n (0..(FIELD_SIZE-1)).each do |row_no|\n (0..(FIELD_SIZE-1)).each do |column_no|\n # if field is empty choose a random indeference and put it in\n if @panels.field([panel_no, row_no, column_no]).class_name.empty?\n @panels.set_field([panel_no, row_no, column_no],\n INDEFERENCES[rand(INDEFERENCES.count)])\n end\n end\n end\n end\n end", "def create_array_new(size)\n Array.new(size) { Array.new(size) { '0' } }\nend", "def initialize_blanks\n each_with_index do |blank_space, row, col|\n next unless blank_space == '-'\n blank_space = Element.new\n blank_space.possibleNumbers = []\n blank_space.relativeNumbers = []\n self[row, col] = blank_space\n end\n end", "def create_grid\n grid = Array.new(8) { Array.new(8) { [] } }\n grid.map! do |row|\n if grid.index(row).even?\n row.each { |space| row.index(space).even? ? space << 'white' : space << 'black' }\n else\n row.each { |space| row.index(space).even? ? space << 'black' : space << 'white' }\n end\n row.map! do |space|\n space << [grid.index(row), row.index(space)]\n end\n end\n grid.reverse\n end", "def multidimArray\n # fill multidimensional\n puts \"----------- Multi-dimensional arrays -------------- \"\n empty_table = Array.new(3) { Array.new(3) }\n Array({:a => \"a\", :b => \"b\"}) #=> [[:a, \"a\"], [:b, \"b\"]]\n number_array = [ [1,2,3], [4,5,6] ]\n puts number_array.to_s\nend", "def create_board\n\t\t8.times{|x| @board.push([nil,nil,nil,nil,nil,nil,nil,nil])}\n\t\tpopulate_board\n\tend", "def clearcolumns\r\n\t\t\t@matrix = []\r\n\t\t\t@matrix[0] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[1] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[2] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[3] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[4] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[5] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\tend", "def default_grid\n Array.new(3) { Array.new(3) {Cell.new} }\n end", "def clear\n @field.each_index { |i| @field[i] = 0 }\n end", "def initialize_matrix(rows, columns)\n # create the matrix using the rows and columns\n matrix = Array.new(rows){Array.new(columns)}\n\n # initialize the matrix\n rows.times do |row|\n columns.times do |column|\n matrix[row][column] = 1\n end\n end\n\n return matrix\nend", "def build_field\n return unless random_build\n (0..height).each do |row_id|\n build_row(row_id)\n end\n end", "def initialize_matrix(rows, columns)\n # create the matrix using the rows and columns\n matrix = Array.new(rows){Array.new(columns)}\n\n # initialize the matrix\n rows.times do |row|\n columns.times do |column|\n matrix[row][column] = 1\n end\n end\n return matrix\nend", "def print_filled_field\n field.create_empty_field\n\n # Add an apple to the field.\n field.field_matrix[apple.vertical_location][apple.horizontal_location] = ' o '\n\n # Add a snake to the field.\n snake.snake_matrix.each do |part|\n field.field_matrix[part.first][part.last] = ' x '\n end\n\n print_field\n end", "def empty\n # On itère dans la matrice comme en C de 0 à Nb colonne -1 (Faut faire gaffe au -1)\n\t\t0.upto(@rows-1) do |row|\n\t\t\t0.upto(@cols-1) do |col|\n\t\t\t\t@map[row][col] = Case.create(0)\n\t\t\tend\n\t\tend\n return nil\n\tend", "def grid(n, m)\n Array.new(n) { Array.new(n) } # If you attempted to write this as Array.new(n, Array.new(m)) the contents would be repeated for each array rather\nend", "def create_board(array)\n num = array.length\n board = Array.new(num) { Array.new(num, false) }\n array.each_with_index { |board_position, row| board[row][board_position - 1] = true }\n board\nend", "def nilified_row\n (@nilified_row ||= Array.new(size)).dup\n end", "def initialize (width=7)\n @grid = Array.new(width) {[]}\n\n end", "def fill_board(array)\n # puts array.inspect\n \n empty_board = BoardLoader.empty_board\n b = []\n \n count = 0\n empty_board.each_index do |row|\n b[row] = []\n empty_board[row].each_index do |column|\n if empty_board[row][column] == BLANK_SPACE\n if count < array.length\n b[row][column] = array[count]\n count += 1\n if count == array.length\n $last_spot = [row, column]\n end\n else\n b[row][column] = BLANK_SPACE\n end\n else\n b[row][column] = empty_board[row][column]\n end\n end\n end\n \n if $last_spot.nil?\n $last_spot = [empty_board.length-1, empty_board[0].length-1]\n end\n \n \n b\n end", "def initialize\n @map = []\n 8.times do |x|\n row = []\n 8.times { |y| row << nil }\n @map << row\n end\n end", "def empty_rows\n rows = [2, 3, 4, 5]\n\n rows.each do |row|\n @grid[row].map! { EmptyPiece.new }\n end\n end", "def setup_board!\n\t\t@board = Array.new($dimensions[:y]){ Array.new($dimensions[:x]) {:empty} }\n\tend", "def make_board\n board = Array.new(8) { Array.new(8) { Array.new(2) } }\n board.each_with_index do |row, row_i|\n row.each_with_index { |column, column_i| column[0], column[1] = row_i, column_i }\n end\n end", "def initialize(row_size=3)\n @row_size = row_size\n @board = Array.new(@row_size) {Array.new(@row_size, 0)}\n end", "def zero n\r\n rows_x = []\r\n n.times { rows_x << [0]*n }\r\n Matrix[ *rows_x ]\r\n end", "def gen_array(grid_size)\n\t\ti = 0\n\t\twhile i < grid_size do\n\t\t\t@board_display.push(0)\n\t\t\ti += 1\n\t\tend\n\tend", "def initialize(filled = true, rows = nil)\n @grid = (rows.nil?) ? Array.new(8) { Array.new(8) } : rows\n\n fill_rows if filled and rows.nil?\n end", "def createBoard\n @board = Array.new(row.to_i) {Array.new(column.to_i) {\"-\"}}\n @bufferBoard = Array.new(row.to_i) {Array.new(column.to_i) {\"-\"}}\n \n #loop through board and fill it with file data \n #line by line\n for i in 0..(row.to_i - 1)\n k = 0\n unless input.size == 0\n input.shift.split(\"\").each do |val|\n board[i][k] = (val == \"*\" ? \"*\" : \" \")\n k = k + 1;\n end\n end\n \n #if input file does not match the array dim \n #then fill it with blanks\n while k < (column.to_i ) do\n board[i][k] = \" \"\n k = k + 1\n end\n end\n end", "def generate_matrix\n [].tap { |a| 25.times { a << 'X' } }.each_slice(5).to_a\n end", "def create_row(r)\n row = Array.new\n self.board.each { |a|\n row << a[r]\n }\n row\n end", "def initialize\n @grid = []\n (0..5).each do |row|\n @grid[row] = []\n (0..6).each do |col|\n @grid[row][col] = \"_ \"\n end\n end\n end", "def empty_board_cells\n empty_board = []\n board.board_hash.each_pair do |key, value|\n if value.empty?\n empty_board << key\n end\n end\n empty_board\n end", "def create_board(size)\n return (0...size).map{|b| (0...size).map{|bb| 0}}\n end", "def empty_spaces\n\t\t\tempty_spaces = []\n\n\t\t\t@board.each_with_index do |outer, row|\n\n\t\t\t\touter.each_with_index do |inner, col|\n\n\t\t\t\t\tif inner == fill_char\n\t\t\t\t\t\n\t\t\t\t\t\tspace = [row, col]\n\n\t\t\t\t\t\tempty_spaces <<\tspace\n\n\t\t\t\t\tend\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\tempty_spaces\n\t\tend", "def fill_temp_grid\n temp_width = @width + 2\n temp_height = @height + 2\n\n temp_width.times do |x|\n @temp_grid[x] = []\n temp_height.times do |y|\n @temp_grid[x][y] = 0\n end\n end\n end", "def handle_empty_arrays\n @fields = {}.with_indifferent_access if @fields.length == 0\n @link_fields = {}.with_indifferent_access if @link_fields.length == 0\n end", "def handle_empty_arrays\n @fields = {}.with_indifferent_access if @fields.length == 0\n @link_fields = {}.with_indifferent_access if @link_fields.length == 0\n end", "def blank_board\n\t\tblank_board = []\n\t\tMastermind::MAX_GUESSES.times do\n\t\t\tblank_board << get_blank_row\n\t\tend\n\t\tblank_board\n\tend", "def reset!\n # can't set it to cells for some reason\n @cells = Array.new(grid_size) { Array.new(grid_size, \" \")}\n end", "def matrix(input)\n # shortcut for making matrix\n #array = Array.new(input[0].length) {Array.new}\n new_array= []\n \n #creating structure\n #get number of columns to create number of rows\n input[0].length.times do\n new_array.push([]) \n end\n puts \"new_array #{new_array}\"\n\n i = 0 \n # i represents col for input\n # i represents row for new_array\n # [row][col]\n # input[j][i]\n # new_array[i][j]\n while i < input[0].length\n j = 0 \n # j represents row for input\n # j represents col for new_array\n # [row][col]\n # input[j][i]\n # new_array[i][j]\n while j < input.length\n \n value = input[j][i]\n #puts \"value #{input[j][i]}\"\n new_array[i].push(value) #i represents column, adding values into columns\n j += 1\n end\n # puts \"new_array #{new_array}\"\n i += 1\n end\n return new_array\nend", "def init_board(n, def_val)\n\t\tArray.new(n) { Array.new(n) { def_val } }\n\tend", "def clear_full_rows\n\n\t\t# Clear all rows that are full\n\t\t@collision_map.each_with_index do |row, index|\n\t\t\t@collision_map.delete_at(index) if is_row_full?(row)\n\t\tend\n\n\t\tcleared_rows = @size_y - @collision_map.size\n\n\t\t# Create empty rows until the field is back to its original size\n\t\twhile @collision_map.size < @size_y\n\t\t\t@collision_map.unshift( Array.new(@size_x) { |i| { value: false, color: nil }})\n\t\tend\t\t\n\n\t\treturn cleared_rows\n\tend", "def initialize\n\t\t@rows = 8\n\t\t@cols = 8\n\t\t@grid = Array.new(rows) { Array.new(cols) }\n\tend", "def unfilled_columns\n @cells[0].each_with_object([]).with_index do |(cell, nonFull_columns), idx|\n nonFull_columns << idx if cell.eql?(' ')\n end\n end", "def create_empty_board(position)\n 9.times { |i| position[i] = \" \"}\nend", "def blank_column\n blank_col = '<div class=\"crossbeams-col\"><!-- BLANK COL --></div>'\n @nodes << OpenStruct.new(render: blank_col)\n end", "def initialize_board\n board = Array.new(8) {Array.new(8)}\n populate_board(board)\n end", "def initialize\n @cells = Array.new(9,\" \")\n end", "def to_empty\n table.dup.tap do |t|\n t.rows.each do |r, row|\n row.each do |c, cell|\n row.fill(c, Table::Cell::Empty.new(cell))\n end\n end\n end\n end", "def empty_spots(board)\n empties = []\n (0..2).each do |row|\n (0..2).each do |col| \n empties << [row,col] if @board.empty?([row,col])\n end\n end\n empties\n end", "def create_grid_from_size(size_arr)\n rows = size_arr[0]\n columns = size_arr[1]\n Array.new(rows) { Array.new(columns) }\n end", "def default_grid\n Array.new(7) { Array.new(6) { Cell.new } }\n end", "def prepare_grid\n\t\tArray.new(rows) do |row|\n\t\t\tArray.new(columns) do |col|\n\t\t\t\tCell.new(row, col)\n\t\t\tend\n\t\tend\n\tend", "def init_create\n init_dict()\n @grid = Array.new(self.size) { Array.new(self.size, nil) }\n init_first_word()\n self.finished = false\n end", "def initialize\n super\n self.board = Array.new(3).map{[nil, nil, nil]}\n end", "def reset!\n self.cells = Array.new(9, \" \")\n end", "def reset!\n self.cells = Array.new(9, \" \")\n end", "def reset!\n self.cells = Array.new(9, \" \")\n end", "def reset!\n self.cells = Array.new(9, \" \")\n end", "def build_sample\n sample = Array.new(8) {Array.new(8)}\n sample[0][0] = King.new(0, 0, 0)\n sample[7][7] = King.new(7, 7, 1)\n sample[0][4] = Rook.new(0, 4, 1)\n sample[4][0] = Rook.new(4, 0, 1)\n sample[4][4] = Bishop.new(4, 4, 1)\n sample\nend", "def setup_with_dims(rows, cols)\n raise \"Invalid dims provided for setting up matrix: #{rows} x #{cols}\" unless rows > 0 && cols > 0\n \n @rows = rows\n @cols = cols\n @fm = Array.new(rows*cols) {|i| 0 }\n end", "def initialize_board(input)\n board = Array.new(9) {Array.new(9) {Array.new(10, 0)}}; \n for y in (0...9)\n for x in (0...9)\n board[y][x][0] = Integer(input[y*9+x]) \n for p in (1...10)\n if board[y][x][0] == 0\n board[y][x][p] = p\n else\n board[y][x][p] = 0\n end\n end\n end\n end\n return board\n end", "def initialize(fill_board = true)\n @sentinel = Null_piece.instance\n\n @rows = Array.new(8) { Array.new(8, @sentinel) }\n\n fill_board_tiles if fill_board\n end", "def reset!\n @cells = Array.new(9, \" \")\n end", "def reset!\n @cells = Array.new(9, \" \")\n end", "def reset!\n @cells = Array.new(9, \" \")\n end", "def reset!\n @cells = Array.new(9, \" \")\n end", "def initialize_table\n @total_rows.times do |row|\n row_array = Array.new(@total_columns, \"\")\n @reconstructed_table.push(row_array)\n end\n end", "def blank_matrix(matrix)\n matrix.map do |element_array|\n element_array.map {|element| element = 1 ? element = 0 : element = 0 }\n end\n end", "def initialize\n @cells = Array.new(9, \" \")\n end" ]
[ "0.70820487", "0.66334695", "0.6446492", "0.6395312", "0.6320942", "0.6164173", "0.6158884", "0.60545313", "0.6025009", "0.6024148", "0.5955401", "0.59196055", "0.58140385", "0.57603955", "0.57594323", "0.56994426", "0.56843936", "0.56590635", "0.5637313", "0.56159085", "0.56010723", "0.55660546", "0.5544956", "0.5534662", "0.5522785", "0.54863065", "0.5478883", "0.5407266", "0.53871137", "0.53686285", "0.5365685", "0.53441924", "0.5327483", "0.53189147", "0.5304106", "0.52926", "0.5287067", "0.52870154", "0.5268717", "0.5268208", "0.52676105", "0.52639914", "0.52605313", "0.52596974", "0.52424765", "0.52353376", "0.5229215", "0.5225557", "0.5221961", "0.5211727", "0.5201543", "0.5198363", "0.5196795", "0.5187273", "0.5183037", "0.5182056", "0.5174093", "0.51527315", "0.514693", "0.5145167", "0.5139654", "0.5122519", "0.51214087", "0.5103934", "0.5103623", "0.5102886", "0.5102886", "0.50985193", "0.5094815", "0.5094517", "0.5090621", "0.5088947", "0.5079097", "0.5078699", "0.50602007", "0.50571215", "0.5040037", "0.50056016", "0.49990723", "0.49946907", "0.49937654", "0.4978274", "0.49732417", "0.49666068", "0.49578106", "0.49567142", "0.49567142", "0.49567142", "0.49567142", "0.49557537", "0.49515048", "0.49507234", "0.4948851", "0.4939132", "0.4939132", "0.4939132", "0.4939132", "0.49339303", "0.49284872", "0.4928192" ]
0.8642803
0
The create_snake method creates a twodimensional array. The inner array consists of the horizontal and vertical location of each snake part.
def create_snake vertical_position = location[0] horizontal_position = location[1] @snake_matrix = Array.new(size) { |part_index| [vertical_position, horizontal_position + part_index] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateBoard(snakes, foods)\n board = Hash.new(BLANK_VALUE); # Using a hash because inserts are O(1), and it sets default values for all coordinates\n \n # Process each of the snakes\n snakes.each do |snake|\n id = snake[\"id\"]\n health = snake[\"health_points\"]\n coords = snake[\"coords\"]\n length = coords.length\n \n for i in 0..(coords.length-1)\n # Check that this isn't already the head (when the snake starts, all body segments are on top of its head)\n if board[[coords[i][0], coords[i][1]]] != BLANK_VALUE\n next\n end\n \n # Add the tail attribute if valid\n isTailThatWillMoveNextTurn = false\n if i == coords.length-1 and coords[i] != coords[i-1]\n isTailThatWillMoveNextTurn = true\n end\n \n segment = SnakeSegment.new(id, i, length, health, isTailThatWillMoveNextTurn)\n board[[coords[i][0], coords[i][1]]] = segment\n end\n end\n \n # Process all of the food locations\n foods.each do |food|\n board[[food[0], food[1]]] = FOOD_VALUE\n end\n \n return board\nend", "def draw\n # snake head\n Image.new('img/SnakeHead.png',\n x: head[0] * GRID_SIZE,\n y: head[1] * GRID_SIZE)\n # snake tail\n @positions[0..-2].each do |position|\n Circle.new(x: position[0] * GRID_SIZE + GRID_SIZE / 2,\n y: position[1] * GRID_SIZE + GRID_SIZE / 2,\n radius: GRID_SIZE / 2 - 1,\n color: 'blue')\n end\n end", "def draw\n opacity = 0.4\n @position.reverse.each do |pos|\n opacity *= 0.8\n Square.new(x: pos[0] * GRID_SIZE, y: pos[1] * GRID_SIZE, size: NODE_SIZE, color: @snake_color, z: @z) # the regular snake\n Square.new(x: pos[0] * GRID_SIZE, y: pos[1] * GRID_SIZE, size: NODE_SIZE, color: 'white' , opacity: opacity, z: @z + 1) # a lighting effect\n end\n end", "def create\n (0..7).each do |row|\n @board << []\n (0..7).each do |col| \n @board[row] << \"[ ]\"\n end\n end\n end", "def make_board\n board = Array.new(8) { Array.new(8) { Array.new(2) } }\n board.each_with_index do |row, row_i|\n row.each_with_index { |column, column_i| column[0], column[1] = row_i, column_i }\n end\n end", "def create_board\n cols = Array.new(7) { Array.new(6, 0) }\n cols\n end", "def create_grid(board_array)\n\t# split into triplets\n\ttriplets_array = []\n board_array.each { |array| triplets_array << array.each_slice(3).to_a }\n\n # shuffle the triplets\n shuffle_container = [[], [], []]\n 9.times do |row|\n 3.times do |column|\n current_array = triplets_array[row][column]\n shuffle_container[column] << current_array\n end\n end\n\n # flatten and re-split\n final_array = []\n shuffle_container.flatten.each_slice(9) { |array| final_array << array }\n\n return final_array\nend", "def make_maze\n\tk = 0\n\t\tfor i in 0 ..@height*2\n\t\t\tfor j in 0 ..@width*2\n\t\t\t\t@maze[i][j] = @array[k]\n\t\t\t\tprint @maze[i][j]\n\t\t\t\tk += 1\n\t\t\tend\n\t\t\tputs \"\"\n\t\tend\n\tend", "def create_grid\n grid = Array.new(6, Array.new(7, BLANK))\n end", "def create_starting_positions\n\t\t[Point.new(BOARD_WIDTH/4, BOARD_HEIGHT/4),\n \t\tPoint.new(3 * BOARD_WIDTH/4, 3 * BOARD_HEIGHT/4),\n\t\tPoint.new(3 * BOARD_WIDTH/4, BOARD_HEIGHT/4),\n\t\tPoint.new(BOARD_WIDTH/4, 3 * BOARD_HEIGHT/4)]\n\tend", "def snail(array)\n return Array.new if array == [[]]\n\n # step_map is an array saying how many\n # steps to take before each turn\n step_map = Array.new\n (1 .. array.length).to_a.reverse.each do |i|\n step_map << i\n step_map << i\n end\n step_map.shift\n\n result = Array.new\n direction = :East\n y = 0\n x = -1\n\n step_map.each do |steps|\n steps.times do\n case direction\n when :East\n x += 1\n when :West\n x -= 1\n when :South\n y += 1\n when :North\n y -= 1\n end\n\n result << array[y][x]\n end\n\n direction = turnFrom direction\n end\n\n result\nend", "def initialize(snake_static)\r\n # number of bits in the bitvector\r\n @length = snake_static.count(\"X\")\r\n \r\n @to_board = lambda do |snake|\r\n # build board (2d array with n times n size, where n = 2*snake.length + 1)\r\n board = []\r\n (2 * snake.length + 1).times do\r\n board << Array.new(2 * snake.length + 1, ' ')\r\n end\r\n \r\n p = Point.new(snake.length, snake.length)\r\n dir = Point.new(1,0)\r\n max = p.dup\r\n min = p.dup\r\n \r\n snake.each_char do |c|\r\n # exit if current position is not blank\r\n return nil if board[p.y][p.x] != ' '\r\n # set current position\r\n board[p.y][p.x] = c\r\n # compute next position\r\n dir.rotate!(c)\r\n p += dir\r\n # update min and max\r\n max = Point.max(max, p)\r\n min = Point.min(min, p)\r\n end \r\n #set last position\r\n return nil if board[p.y][p.x] != ' '\r\n board[p.y][p.x] = 'X'\r\n \r\n minimized_board = []\r\n min.y.upto(max.y) do |y|\r\n minimized_board[y - min.y] = []\r\n min.x.upto(max.x) do |x|\r\n minimized_board[y - min.y][x - min.x] = board[y][x]\r\n end\r\n end\r\n \r\n minimized_board\r\n end\r\n \r\n @to_string = lambda do |value|\r\n configuration = (\"%.#{length}b\" % value).reverse.split(\"\")\r\n directions = ['R', 'L']\r\n direction = 0\r\n snake = snake_static.split(\"\")\r\n \r\n snake.each_with_index do |c, i|\r\n if c == 'X'\r\n if configuration.pop == '1'\r\n direction = 1 - direction\r\n end\r\n snake[i] = directions[direction]\r\n end\r\n end\r\n \r\n snake.join(\"\")\r\n end\r\n \r\n flood_fill = lambda do |board, x, y|\r\n if board[y] && board[y][x] == ' '\r\n board[y][x] = 'o'\r\n \r\n flood_fill.call(board, x+1, y)\r\n flood_fill.call(board, x, y+1)\r\n flood_fill.call(board, x-1, y)\r\n flood_fill.call(board, x, y-1)\r\n end\r\n end\r\n \r\n # energy function that returns energy of a bitvector\r\n # (the lower the number, the fitter the bitvector)\r\n \r\n @energy_a = lambda do |value|\r\n snake = @to_string.call(value)\r\n board = @to_board.call(snake)\r\n \r\n return Float::INFINITY unless board\r\n \r\n width = board[0].length\r\n height = board.length\r\n Math.sqrt(width*width + height*height)\r\n end\r\n \r\n @energy_b = lambda do |value|\r\n snake = @to_string.call(value)\r\n board = @to_board.call(snake)\r\n \r\n return Float::INFINITY unless board\r\n \r\n width = board[0].length\r\n height = board.length\r\n \r\n 1.upto(width-1) { |x| flood_fill.call(board, x, 0) }\r\n 1.upto(height-1) { |y| flood_fill.call(board, width-1, y) }\r\n (width-2).downto(0) { |x| flood_fill.call(board, x, height-1) }\r\n (height-2).downto(0) { |y| flood_fill.call(board, 0, y) }\r\n \r\n holes = board.map { |x| x.join('') }.join('').count(' ')\r\n holes = Float::INFINITY if holes == 0\r\n holes\r\n end\r\n \r\n # energy function which uses energy_b to maximize the holes\r\n @energy_c = lambda do |value|\r\n e_b = @energy_b.call(value)\r\n return 0 if e_b == Float::INFINITY\r\n -e_b\r\n end\r\n end", "def moveSnakeInBoard(board, snakeId, headXPosition, headYPosition)\n snake = snakes[snakeId]\n \n # Perform a deep clone\n boardClone = Marshal.load(Marshal.dump(board))\n \n boardClone[[headXPosition, headYPosition]] = SnakeSegment.new(snakeId, 0, snake.totalLength, snake.health)\n for i in 0..(snake.totalLength - 2)\n boardClone[snake.coords[i]].segmentNum += 1\n end\n if snake.coords[snake.totalLength - 2] != snake.coords[snake.totalLength - 1]\n boardClone[snake.coords[snake.totalLength-1]] = BLANK_VALUE\n end\n \n return boardClone\nend", "def board_creator()\n board = []\n 10.times do |x|\n board << Array.new\n 10.times do |y|\n board[x] << \"sea #{x} #{y}\"\n end\n end\n return board\nend", "def create_board\n\t\t@board = Hash.new\n\t\t(0..7).each do |x|\n\t\t\t@board[x] = []\n\t\t\t(0..7).each do |y|\n\t\t\t\t@board[x][y] = Square.new([x, y])\n\t\t\tend\n\t\tend\n\tend", "def create_grid\n spaces = create_spaces\n assign_spaces_to_rows.map do |row|\n row.each.with_index do |coordinates, index|\n row[index] = {coordinates => spaces[coordinates]}\n end\n end\n end", "def generate_board\n board_array = @board_string.split(\"\")\n @board = Array.new(9){board_array.shift(9)}\n for row in 0...@board.length\n for col in 0...@board.length\n @board[row][col] = Square.new(@board[row][col], row, col)\n end\n end\n create_starting_numbers\n @board\n end", "def create_position_array()\n array_2D = []\n array_1D = []\n\n (0...@row).each_with_index do |value, row_index|\n (0...@col).each_with_index { |value, col_index| array_1D.append(value+(row_index*@col)) }\n array_2D.append(array_1D)\n array_1D = []\n end\n\n return array_2D\n end", "def create_board(x)\r\n @board = Array.new\r\n x.times do\r\n @board.push(\"_\")\r\n end\r\n end", "def make_grid\n @grid = Array.new(4){Array.new(4)}\n end", "def create_grid\n grid = Array.new(8) { Array.new(8) { [] } }\n grid.map! do |row|\n if grid.index(row).even?\n row.each { |space| row.index(space).even? ? space << 'white' : space << 'black' }\n else\n row.each { |space| row.index(space).even? ? space << 'black' : space << 'white' }\n end\n row.map! do |space|\n space << [grid.index(row), row.index(space)]\n end\n end\n grid.reverse\n end", "def create_grid_from_size(size_arr)\n rows = size_arr[0]\n columns = size_arr[1]\n Array.new(rows) { Array.new(columns) }\n end", "def draw_new\n\t @board=Array.new(@y) {Array.new(@x){'*'}}\n\t \n end", "def initialize(width = 6, height = 7)\n @width = width\n @height = height \n \n @last_insert_x = 0\n @last_insert_y = 0\n @game_started = false\n\t\n @assignment = Array.new width\n\n width.times do |x|\n @assignment[x] = Array.new height\n end\n end", "def make_grid()\n grid = Array.new(GRID_SIZE) { Array.new(GRID_SIZE) }\n ## Build init grid\n x = 1\n y = 1\n File.readlines(FILENAME).each do |line|\n x = 1\n line.chars.each do |char|\n grid[y][x] = char\n x += 1\n end\n y += 1\n end\n grid\nend", "def create_new_players_moves_array\n player_moves = Array.new(2) { Array.new }\n player_moves[0] = @data[0].dup\n player_moves[1] = @data[1].dup\n return player_moves\n end", "def create_board\n temp_index = 0\n temp_column1 = Array.new(4) { 'O' }\n temp_column2 = Array.new(4) { 'O' }\n @board = []\n 10.times do\n @board << [temp_column1, temp_column2, \"Turn:#{temp_index += 1}\"]\n end\n @board\n end", "def create_board(array)\n num = array.length\n board = Array.new(num) { Array.new(num, false) }\n array.each_with_index { |board_position, row| board[row][board_position - 1] = true }\n board\nend", "def initialize(signature)\n\t\tself.signature=signature\n\t\tself.squares=[]\n\t\t\n\t\ttemp_snake=Snake.new(signature)\n\n\t\ttemp_snake.squares.length.times do |i|\n\t\t\tif i==0 or i==(temp_snake.squares.length-1)\n\t\t\t\tsquares << :bridge\n\t\t\telse\n\t\t\t\tif on_same_line(temp_snake.squares[i-1].coords,temp_snake.squares[i+1].coords)\n\t\t\t\t\tsquares << :bridge\n\t\t\t\telse\n\t\t\t\t\tsquares << :joint\n\t\t\t\tend\n\t\t\tend\t\t\t\n\t\tend\n\tend", "def create_board\n\n 8.times do |row|\n 8.times do |col|\n new_cell = Cell.new([col + 1, row + 1])\n @@cells.push(new_cell)\n end\n end\n\n end", "def grid(n, m)\n Array.new(n) { Array.new(n) } # If you attempted to write this as Array.new(n, Array.new(m)) the contents would be repeated for each array rather\nend", "def create_positions\n (1..GAME_BOARD_LENGTH).each do |y|\n (1..GAME_BOARD_LENGTH).each do |x|\n self.positions.new(x: x, y: y)\n end\n end\n set_ships\n save\n end", "def create_game_field_array\r\n\t\r\n\t\ti=0\r\n\t\twhile i < 8 do\r\n\t\t\tj=0\r\n\t\t\t\r\n\t\t\twhile j < 8 do\r\n\t\t\t #Copy the \".\" object in the actual Position of the 2 dimensional Array \r\n\t \t @nha[i][j] =\".\"\t\t\r\n\t\t\t\tj+=1\t\t\r\n\t\t\tend\r\n\t\t\ti+=1\r\n\t\tend\r\n\t\treturn true\r\n\tend", "def create_board(size, num_mines)\n\t\tfinal_board = []\n\t\t# Create outer loop\n\t\t1.upto(size) do |row|\n\t\t\trow_buffer = []\n\t\t\t# Create inner loop\n\t\t\t1.upto(size) do |column|\n\t\t\t\trow_buffer << Square.new([column,((size+1)-row)], size)\n\t\t\tend\n\t\t\t# Once each row is composed add it to \n\t\t\t# the final board.\n\t\t\tfinal_board << row_buffer\n\t\tend\n\t\tset_mines(final_board, num_mines) # Now that we have the board, lets add some mines\n\t\tfinal_board\n\tend", "def initialize(color, player)\n xpos = if player == 1\n GRID_WIDTH * 2 / 3\n else\n GRID_WIDTH / 3\n end\n @position = [[xpos, GRID_HEIGHT - 3], [xpos, GRID_HEIGHT - 4], [xpos, GRID_HEIGHT - 5]]\n # @position = [[xpos, GRID_HEIGHT - 3], [xpos, GRID_HEIGHT - 4]]\n @direction = 'up'\n @growing = @turned = false\n @snake_color = color\n @z = 0\n end", "def create_row(r)\n row = Array.new\n self.board.each { |a|\n row << a[r]\n }\n row\n end", "def initiate_grid\n new_grid = []\n @width.times do |x|\n new_grid[x] = []\n @height.times do |y|\n new_grid[x][y] = 0\n end\n end\n new_grid\n end", "def generate_grid\n grid = []\n @y.times do\n row = []\n @x.times do\n row << nil\n end\n grid << row\n end\n grid\n end", "def create\n for i in 1 .. (@canvas_height - 1) do\n @buffer.append(i, \" \" * (@canvas_width - 1))\n end\n end", "def place_snake_head(position, move_over_tunnel)\n snake_part = SnakePart.new(@head)\n @world[@head] = snake_part\n @head = position\n @world[position] = SnakeHead.new(position)\n\t\t\t@world[position].set_over_tunnel(move_over_tunnel)\n @body.unshift @head\n end", "def create_board\n\t\t8.times{|x| @board.push([nil,nil,nil,nil,nil,nil,nil,nil])}\n\t\tpopulate_board\n\tend", "def make_pieces(first_position, color, rows, direction)\n switch = Hash[1, 0, 0, 1]\n start_column = first_position[1]\n start_row = first_position[0]\n num_pieces = size/2\n rows.times do |row_num|\n num_pieces.times do |col_num|\n col_num *= 2\n position = [start_row + (row_num * direction), start_column + col_num]\n Piece.new(position, self, color)\n end\n start_column = switch[start_column]\n end\n end", "def build_grid\n x = 0\n 10.times do\n row = []\n y = 0\n 10.times do\n row.push({display: \"~~\", ship: false, coord: [x, y]})\n y += 1\n end\n self.grid << row\n x += 1\n end\n p self.grid\n end", "def initialize\n @grid = []\n (0..5).each do |row|\n @grid[row] = []\n (0..6).each do |col|\n @grid[row][col] = \"_ \"\n end\n end\n end", "def make_first_row \n counter_first_half = 0\n counter_second_half = 1\n (1..t).each do |i| \n if i <= m\n if @is_odd\n @rounds[counter_first_half][0] = \"#{i}\"\n counter_first_half += 2\n else\n @rounds[counter_first_half][0] = \"#{i}-#{n}\"\n counter_first_half += 2\n end\n elsif i > @m and i != @n\n if @is_odd\n @rounds[counter_second_half][0] = \"#{i}\"\n counter_second_half += 2 \n else\n @rounds[counter_second_half][0] = \"#{n}-#{i}\"\n counter_second_half += 2\n end\n end\n end\n end", "def create_board(size)\n return (0...size).map{|b| (0...size).map{|bb| 0}}\n end", "def make_game_board\n i = 0\n while i < @word.length - 2\n @underscore_array << \"_\"\n i += 1\n end\n @state_of_board = @underscore_array\n end", "def build_sample\n sample = Array.new(8) {Array.new(8)}\n sample[0][0] = King.new(0, 0, 0)\n sample[7][7] = King.new(7, 7, 1)\n sample[0][4] = Rook.new(0, 4, 1)\n sample[4][0] = Rook.new(4, 0, 1)\n sample[4][4] = Bishop.new(4, 4, 1)\n sample\nend", "def create_shape\n id = rand 7\n @cur_y = 0\n @cur_x = 5\n @shape = SHAPES[id].dup\n end", "def default_grid\n array = Array.new(8) { Array.new(8) }\n\n array[0][0] = Rook.new('white', [0,0], 'slide')\n array[1][0] = Knight.new('white', [1,0], 'step')\n array[2][0] = Bishop.new('white', [2,0], 'slide')\n array[3][0] = Queen.new('white', [3,0], 'slide')\n array[4][0] = King.new('white', [4,0], 'step')\n array[5][0] = Bishop.new('white', [5,0], 'slide')\n array[6][0] = Knight.new('white', [6,0], 'step')\n array[7][0] = Rook.new('white', [7,0], 'slide')\n array[0..7].each_with_index { |column, index| \n column[1] = Pawn.new('white', [index,1], 'step') }\n\n array[0][7] = Rook.new('black', [0,7], 'slide')\n array[1][7] = Knight.new('black', [1,7], 'step')\n array[2][7] = Bishop.new('black', [2,7], 'slide')\n array[3][7] = Queen.new('black', [3,7], 'slide')\n array[4][7] = King.new('black', [4,7], 'step')\n array[5][7] = Bishop.new('black', [5,7], 'slide')\n array[6][7] = Knight.new('black', [6,7], 'step')\n array[7][7] = Rook.new('black', [7,7], 'slide')\n array[0..7].each_with_index { |column, index| \n column[6] = Pawn.new('black', [index,6], 'step') }\n\n array\n end", "def tile_board\n @board_array.each_with_index do |row_array, row|\n 10.times{|column| row_array << Tile.new(row,column)}\n end\n end", "def grid(n, m)\n arr = Array.new(n) { Array.new(m, :N) }\n arr\nend", "def createBoard\n @board = Array.new(row.to_i) {Array.new(column.to_i) {\"-\"}}\n @bufferBoard = Array.new(row.to_i) {Array.new(column.to_i) {\"-\"}}\n \n #loop through board and fill it with file data \n #line by line\n for i in 0..(row.to_i - 1)\n k = 0\n unless input.size == 0\n input.shift.split(\"\").each do |val|\n board[i][k] = (val == \"*\" ? \"*\" : \" \")\n k = k + 1;\n end\n end\n \n #if input file does not match the array dim \n #then fill it with blanks\n while k < (column.to_i ) do\n board[i][k] = \" \"\n k = k + 1\n end\n end\n end", "def represent\n # grid_array will be an array of strings that represent our grid in NxN format\n grid_array=[]\n @h.times{|r| grid_array<<@grid[r*@w,@w].split('')*' '}\n grid_array\n end", "def build_row(row_id)\n (0..width).each do |col_id|\n cells.create(y: row_id, x: col_id, random_alive: true)\n end\n end", "def initializeMaze(size)\n return Array.new(size[0] + 1){Array.new(size[1] + 1, '#')}\nend", "def place_knights\r\n $board[1][0] = Knight.new('white')\r\n\t\t$board[6][0] = Knight.new('white')\r\n\t\t$board[1][7] = Knight.new('black')\r\n\t\t$board[6][7] = Knight.new('black')\r\n end", "def rect(a, b, screen)\n screen[0...b].each do |row|\n row[0...a] = (\"#\"*a).split(\"\")\n end\n\n screen\nend", "def generate_grid x = @x, y = @y\n new_grid = []\n\n y.times { new_grid << [] }\n new_grid.each do |array|\n x.times do\n array << []\n end\n end\n end", "def create_shifts\n\tself.shifts=[]\n\tif self.locations.size==0\n\t self.locations=self.area.locations\n\tend\n\tst=self.shifttimes \n \tst.each do |t|\n\t\tself.locations.each do |l|\n\t\t\n\t\t\tshift=Shift.new\n\t\t\tshift.location=l\n\t\t\tshift.start=t\n\t\t\tself.shifts << shift\n\t\tend\n \tend\n end", "def start_grid\n Array.new(@lines) { Array.new(@columns) { Cell.new } }\n end", "def generateSnakesLookup(snakes)\n snakesLookup = Hash.new\n \n # Process each of the snakes\n snakes.each do |snake|\n id = snake[\"id\"]\n health = snake[\"health_points\"]\n coords = snake[\"coords\"]\n \n snakeLookup = Snake.new(coords.length, health, coords)\n snakesLookup[id] = snakeLookup\n end\n \n return snakesLookup\nend", "def create_side_by_side_example\n # Resize the original image to 40% of the size.\n Commander.run!(\"convert #{@dir}/original.miff\",\n \"-resize 40%\",\n \"#{@dir}/original_smaller.miff\")\n\n # Resize the singing image to 40% of the size.\n Commander.run!(\"convert\",\n Songster.output_folder.join(\"#{@fname}-singing.gif\").to_s,\n \"-resize 40%\",\n \"#{@dir}/singing_smaller.miff\")\n\n # Put two closed mouth side by side.\n Commander.run!(\"convert\",\n \"#{@dir}/original_smaller.miff #{@dir}/original_smaller.miff\",\n \"+append\",\n \"#{@dir}/sidebyside_closed.miff\")\n\n # Put a closed and opened mouth side by side.\n Commander.run!(\"convert\",\n \"#{@dir}/singing_smaller.miff\",\n \"+append\",\n \"#{@dir}/sidebyside_opened.miff\")\n\n Commander.run!(\"convert -loop 0 -delay 30\",\n \"#{@dir}/sidebyside_closed.miff #{@dir}/sidebyside_opened.miff\",\n Songster.debug_folder.join(\"#{@fname}-sidebyside.gif\").to_s)\n end", "def build_square size\n #starting positions\n x,y = size/2,0\n\n # build square\n (1..size**2).inject(Array.new(size){[]}) do |arr,i|\n\n # store current number in square\n arr[y][x] = i\n\n # move up and left\n x = (x+1)%size\n y = (y-1)%size\n\n # undo move and move down if space is taken\n if arr[y][x]\n y = (y+2)%size\n x = (x-1)%size\n end\n arr\n end\n end", "def getSegments (xStart, xEnd, yStart, yEnd, board)\n\n\tsegBoard = Array.new\n\tind = 0\n\tfor i in xStart..xEnd\n\t\tfor j in yStart..yEnd\n\t\t\tsegBoard[ind] = board[j][i]\n\t\t\tind+=1\n\t\tend\n\tend \n\n\treturn segBoard\n\nend", "def square_arrays\n squares = []\n org_row = 0\n org_col = 0\n (0..8).each do |i|\n squares[i] = []\n (org_row..org_row+2).each do |k|\n (org_col..org_col+2).each do |j|\n squares[i].push(@board[k][j])\n end \n end\n if org_row == 6\n org_col += 3 \n org_row = 0\n else\n org_row += 3 \n end\n end \n squares\n end", "def initialize\n @board = Array.new(3) { Array.new(3) }\n end", "def initialize\n @board = Array.new(3) { Array.new(3) }\n end", "def nest_array(board)\n nested_board = []\n 9.times { nested_board << board.slice!(0..8)}\n return nested_board\nend", "def generate_board\n [0, 1, 2].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :B) if offset.odd?\n end\n end\n\n [5, 6, 7].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :W) if offset.odd?\n end\n end\n end", "def coordinates\n arr = []\n (0...@size).each do |row|\n (0...@size).each do |column|\n arr << Coordinate.new(x: row,y: column)\n end\n end\n arr\n end", "def setup_board!\n\t\t@board = Array.new($dimensions[:y]){ Array.new($dimensions[:x]) {:empty} }\n\tend", "def init_create\n init_dict()\n @grid = Array.new(self.size) { Array.new(self.size, nil) }\n init_first_word()\n self.finished = false\n end", "def grid\n \t\t\tfinal, y = Array.new, 0\n \t\t\t@@axis.fetch(:y).times do\n \t\t\t\tfinal[y], x = Array.new, 0\n \t\t\t\t@@axis.fetch(:x).times do\n \t\t\t\t\tfinal[y][x] = init_coord(x, y)\n \t\t\t\t\tx += 1\n \t\t\t\tend\n \t\t\t\ty += 1\n\t\t\tend\n\t\t\tfinal.reverse\n\t\tend", "def move\n # removing first element from the snake body\n unless @is_growing\n # list.shift removes the first element within a list\n @positions.shift\n end\n # after growing, snake should stop growing, it grows one at a time\n @is_growing = false\n # reading direction\n case @direction\n when 'down'\n # push insert an element in last position of the list\n # adding one to y in snake head\n @positions.push([head[0],\n (head[1] + 1) % GRID_HEIGHT])\n when 'up'\n @positions.push([head[0],\n (head[1] - 1) % GRID_HEIGHT])\n when 'left'\n @positions.push([(head[0] - 1) % GRID_WIDTH,\n head[1]])\n when 'right'\n @positions.push([(head[0] + 1) % GRID_WIDTH,\n head[1]])\n else\n puts 'error: another key inside case else'\n end\n end", "def create_inner_arrays(array)\n size = array.size\n array = [array.first((size + 1) / 2), array.last(size / 2)]\nend", "def moveSnakeInSnakesLookup(snakes, snakeId, headXPosition, headYPosition)\n snake = snakes[snakeId]\n \n # Perform a deep clone\n snakesClone = Marshal.load(Marshal.dump(snakes))\n snakeClone = Marshal.load(Marshal.dump(snake))\n \n for i in 1..(snakeClone.coords.length - 1)\n snakeClone.coords[i] = snakeClone.coords[i-1]\n end\n snakeClone.coords[0] = [headXPosition, headYPosition]\n snakesClone[snakeId] = snakeClone\n \n return snakesClone\nend", "def new_board\n board = []\n 8.times do |row|\n board << case row\n when 0\n add_back_row(\"white\", row)\n when 1\n add_pawn_row(\"white\", row)\n when 6\n add_pawn_row(\"black\", row)\n when 7\n add_back_row(\"black\", row)\n else\n Array.new(8)\n end\n end \n board\n end", "def make_board\n @board = []\n index = 0\n while index < @word.length\n @board << \"___ \"\n index += 1\n end\n return @board\n end", "def generate(north_west_corner,south_east_corner)\n\t\tn_y,n_x=north_west_corner.position\n\t\ts_y,s_x=south_east_corner.position\n\t\tsplit_point=Point.new(rand(n_y+2..s_y-2),rand(n_x+2..s_x-2),'wall')\n\t\tif(split_point.x==nil or split_point.y==nil)\n\t\t\treturn @map\n\t\tend\n\t\tgenerate_walls(split_point,north_west_corner,south_east_corner)\n\t\tpoint_array=middle_points(north_west_corner,south_east_corner,split_point)\t\n\t\tpoint_array.each_slice(2) {|a|\n\t\t\tgenerate(a[0],a[1])\n\t\t}\n\tend", "def generateBoard()\n board = []\n\n (1..@board.rows).each do |r|\n row = []\n (1..@board.cols).each { |c| row.push('X') }\n board.push(row)\n end\n\n board\n end", "def initialize(size)\n @board = Array.new(size) {Array.new(size){ '*' } }\n end", "def initialize( w=DEFAULT_WIDTH, h=DEFAULT_HEIGHT, s=DEFAULT_SEED )\n \t @width = w\n\t @height = h\n\t @seed = s\n\n\t srand(@seed)\n\n\t @grid = Array.new(h) { Array.new(w,0) }\n end", "def _get_square_starting_points()\n square_starting_points = []\n row_index = 0\n column_index = 0\n 3.times do\n 3.times do\n square_starting_points << [row_index, column_index]\n column_index += 3\n end\n row_index += 3\n column_index = 0\n end\n square_starting_points\n end", "def generate_surrounding_spaces(x, y)\n surround_array = []\n# Loop over 3x3 grid\n for i in x-1..x+1\n for j in y-1..y+1\n # Exclude the center square and ones not on the grid\n if ((i==x) && (j==y)) || !is_on_grid(i,j)\n next\n end\n surround_array.push([j, i])\n end\n end\n\n return surround_array\nend", "def gen_array(grid_size)\n\t\ti = 0\n\t\twhile i < grid_size do\n\t\t\t@board_display.push(0)\n\t\t\ti += 1\n\t\tend\n\tend", "def place x, y, horizontal\n if @ship_holes.empty?\n @length.times do |a, b| \n @ship_holes << Hole.new(x,y)\n if horizontal \n x += 1\n else\n y += 1\n end\n end\n end\n end", "def create_piece\n @in_play = @current_piece.new(@object_array, @window)\n\n # Create the ghost piece give the piece in play\n calculate_ghost_piece\n end", "def initialize\n @array = []\n x,y = 0,0\n while x < 8\n while y < 8\n @array << [x,y]\n y += 1\n end\n x += 1\n y = 0\n end\n @array\n end", "def create(sketch, args)\n require_relative '../jruby_art/creators/creator'\n return Processing::Inner.new.create!(sketch, args) if @options.inner\n return Processing::ClassSketch.new.create!(sketch, args) if @options.wrap\n return Processing::EmacsSketch.new.create!(sketch, args) if @options.emacs\n Processing::BasicSketch.new.create!(sketch, args)\n end", "def create_inputs\n @inputs = Array.new(@max_size) do |i|\n add_text(base_x + i * delta_x, base_y + delta_y, delta_x, delta_y, NO_CHAR, 1)\n end\n end", "def generate_coordinates\n coordinates = []\n (0..@column_count - 1).to_a.each do |i|\n (0..@row_count - 1).to_a.each do |j|\n coordinates << {x: i, y: j, z: 0}\n end\n end\n coordinates\n end", "def initialize(size = 10)\n @size = size\n @ship_squares = []\n @squares = Array.new(size) do |y|\n Array.new(size) { |x| Square.new(self, x, y) }\n end\n end", "def create_board\n board = []\n\n for x in 0..7\n board[x] = []\n for y in 0..7\n \t board[x] << Node.new(x,y)\n end\n end\n board\nend", "def board_creator\n def row_gen\n [rand(16), rand(15..31), rand(30..46), rand(45..61), rand(60..76)]\n end\n [row_gen,row_gen,[rand(16), rand(16..30), 'X', rand(46..60), rand(61..75)],row_gen,row_gen].each { |row| p row.join ' ' }\nend", "def draw\n @positions.each do |position|\n Square.new(x: position[0] * GRID_SIZE, y: position[1] * GRID_SIZE,\n size: GRID_SIZE - 1, color: 'white')\n end\n end", "def board_2d\n # slice the array into groups of 4 to create 2d-array\n @board.enum_slice(4).to_a\n end", "def create_matrix\n (0...@height).to_a.map {|element| [0]*@width}\n end", "def test_it_can_create_cpu_coordinates_array\n game_play = GamePlay.new\n\n assert_equal Array, game_play.create_cpu_coordinate_array_cruiser.class\n assert_equal Array, game_play.create_cpu_coordinate_array_sub.class\n end", "def create_skew(*args)\n end" ]
[ "0.559691", "0.5436912", "0.53852457", "0.52831507", "0.5283077", "0.5275853", "0.5139459", "0.50608563", "0.4997969", "0.49952617", "0.49791288", "0.49766687", "0.49289423", "0.49251834", "0.4895927", "0.48665184", "0.4855412", "0.48459503", "0.48370662", "0.48353174", "0.48170102", "0.47923857", "0.4780287", "0.47796336", "0.47756478", "0.47703716", "0.47546533", "0.47458628", "0.47350305", "0.47340035", "0.4707159", "0.4688572", "0.46854123", "0.46847993", "0.4681792", "0.46736303", "0.46241707", "0.4593287", "0.45849147", "0.4583756", "0.45583978", "0.45487675", "0.4536708", "0.45355707", "0.45274982", "0.4526574", "0.45258287", "0.4525494", "0.45115924", "0.45100984", "0.44971848", "0.44933948", "0.4488219", "0.44879845", "0.4466809", "0.4466696", "0.4461318", "0.44601783", "0.44550493", "0.44499716", "0.44472748", "0.44423932", "0.44416717", "0.44371858", "0.4437003", "0.44250548", "0.44209737", "0.44209737", "0.44155663", "0.44147182", "0.44112846", "0.44025517", "0.43972513", "0.43972033", "0.43868813", "0.43832585", "0.43773845", "0.43765613", "0.43688023", "0.4366881", "0.43667537", "0.4356793", "0.43542373", "0.4331937", "0.43276814", "0.43171793", "0.4315105", "0.43100855", "0.43034035", "0.4299428", "0.42965353", "0.42948997", "0.42902058", "0.428155", "0.42799938", "0.42722356", "0.4268952", "0.42609784", "0.42589316", "0.42583388" ]
0.81987625
0
The head of the snake is always the first array of the snake matrix.
def locate_head snake_matrix.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def head\n \t@array[0]\n end", "def create_snake\n vertical_position = location[0]\n horizontal_position = location[1]\n @snake_matrix = Array.new(size) { |part_index| [vertical_position, horizontal_position + part_index] }\n end", "def locate_body\n snake_matrix[1..-1]\n end", "def make_first_row \n counter_first_half = 0\n counter_second_half = 1\n (1..t).each do |i| \n if i <= m\n if @is_odd\n @rounds[counter_first_half][0] = \"#{i}\"\n counter_first_half += 2\n else\n @rounds[counter_first_half][0] = \"#{i}-#{n}\"\n counter_first_half += 2\n end\n elsif i > @m and i != @n\n if @is_odd\n @rounds[counter_second_half][0] = \"#{i}\"\n counter_second_half += 2 \n else\n @rounds[counter_second_half][0] = \"#{n}-#{i}\"\n counter_second_half += 2\n end\n end\n end\n end", "def whats_in_front\n @array[0]\n end", "def head\n self.segments.to_a.find{|t| t.nominal}\n end", "def head\n if @head.nil?\n nil\n else\n at_index(0)\n end\n end", "def skeleton; @skeletons.first; end", "def corner_first(board, marker)\n\t\tif first_move == true\n\t\t\tboard[0] = marker\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "def first_line_in_view()\n\t\tcoord_to_line_num(contents_y)\n\tend", "def first\n @head\n end", "def corner_first(board, marker)\r\n\t\tif first_move == true\r\n\t\t\tboard[0] = marker\r\n\t\telse\r\n\t\t\tfalse\r\n\t\tend\r\n\tend", "def row_first\n\t\t\trow_value * 9\n\t\tend", "def first_row\n @first_row ||= first_last_row_col[:first_row]\n end", "def dangerous_snake_head(bram, other_snake)\n other_snake.length >= bram.length ? other_snake.possible_heads : []\nend", "def head\n @positions.last\n end", "def head\n @positions.last\n end", "def head\n ->(xs) { xs[0] }\n end", "def rows\n shape[0]\n end", "def get_start(processed_maze)\n # start_horizontal; start_vertical = nil\n processed_maze.each_with_index do |row, vertical_index|\n row.each_with_index do |item, horizontal_index|\n if item == 'o'\n @start_vertical = vertical_index\n @start_horizontal = horizontal_index\n end\n end\n end\n end", "def first\r\n self[0]\r\n end", "def first\n self[0]\n end", "def line_start(matrix_elements = [0])\n return self if self[matrix_elements[0]] == 0\n beginning = self.dup\n matrix_elements.each { |dimension| beginning[dimension] = 0 }\n beginning\n end", "def x\n head[0]\n end", "def x\n head[0]\n end", "def build_first_row(board)\n (0..7).each do |col|\n if col.zero?\n board[1][col] = BoardSquare.new('cyan', Rook.new('white'), 1)\n elsif col == 7\n board[1][col] = BoardSquare.new('magenta', Rook.new('white'))\n elsif col == 1\n board[1][col] = BoardSquare.new('magenta', Knight.new('white'))\n elsif col == 6\n board[1][col] = BoardSquare.new('cyan', Knight.new('white'))\n elsif col == 2\n board[1][col] = BoardSquare.new('cyan', Bishop.new('white'))\n elsif col == 5\n board[1][col] = BoardSquare.new('magenta', Bishop.new('white'))\n elsif col == 3\n board[1][col] = BoardSquare.new('magenta', King.new('white'))\n elsif col == 4\n board[1][col] = BoardSquare.new('cyan', Queen.new('white'))\n end\n end\n board\n end", "def first\n self.slice(0)\n end", "def start_board\n @start_node.board.dup\n end", "def first\n self[0]\n end", "def first\n self[0]\n end", "def node_first\n @head\n end", "def main_diagonal\n (0...@game.rows).collect { |i| @game.board.board[i][i] }\n end", "def first\n @head.val\n end", "def place_snake_head(position, move_over_tunnel)\n snake_part = SnakePart.new(@head)\n @world[@head] = snake_part\n @head = position\n @world[position] = SnakeHead.new(position)\n\t\t\t@world[position].set_over_tunnel(move_over_tunnel)\n @body.unshift @head\n end", "def head\n return @positions.last\n end", "def first\n return @front.head unless @front.empty?\n @rear.last # memoize?\n end", "def first_element(my_first_element)\n my_first_element = @taylor_swift[1-1]\nend", "def tail\n board[snake[-1][0]].insert(snake[-1][1], nil)\n board[snake[-1][0]].delete_at(snake[-1][1]+1)\n end", "def first_line\n line_from_ip(0)\n end", "def lay_card\n @hand.shift\n end", "def head\n nil\n end", "def first(n = nil)\n if n\n self[0,n]\n else\n self[0]\n end\n end", "def moveSnakeInBoard(board, snakeId, headXPosition, headYPosition)\n snake = snakes[snakeId]\n \n # Perform a deep clone\n boardClone = Marshal.load(Marshal.dump(board))\n \n boardClone[[headXPosition, headYPosition]] = SnakeSegment.new(snakeId, 0, snake.totalLength, snake.health)\n for i in 0..(snake.totalLength - 2)\n boardClone[snake.coords[i]].segmentNum += 1\n end\n if snake.coords[snake.totalLength - 2] != snake.coords[snake.totalLength - 1]\n boardClone[snake.coords[snake.totalLength-1]] = BLANK_VALUE\n end\n \n return boardClone\nend", "def first(arr)\n return arr[0]\nend", "def set_starting_position\n start_rows = find_possible_centers(@matrix.length)\n start_columns = find_possible_centers(@matrix[0].length)\n determine_center_position(start_rows, start_columns)\nend", "def using_first(array)\narray.first\nend", "def caar; first.first end", "def check_left_diagonal\n if @game_array[0][0] == @game_array[1][1] &&\n @game_array[0][0] == @game_array[2][2] &&\n !@game_array[0][0].nil?\n\n @game_array[0][0]\n end\n end", "def first\n @poss[0]\n end", "def head\n @values[0]\n end", "def first\n all[0]\n end", "def graph_first_line\n array = [\"exercise\"]\n self.most_reps.times do |n|\n array << \"set #{n+1}\" \n array << 'string'\n end\n array\n end", "def diagonal_left\n end", "def array_start\n []\n end", "def first_item(elective_array)\n return elective_array[0]\nend", "def first_line; end", "def first_line; end", "def first_line; end", "def first_line; end", "def first_line; end", "def first_line; end", "def first_line; end", "def first_line; end", "def first_line; end", "def first_line; end", "def side\n pick_empty([ [0, 1], [1, 0], [1, 2], [2, 1] ])\n end", "def top_left\n row, col = @position\n return [row - 1, col - 1] unless row - 1 < 0 || col - 1 < 0\n []\n end", "def first_column\n @first_column ||= first_last_row_col[:first_column]\n end", "def using_first(array)\n first_element=array.first\nend", "def normal\n first\n end", "def head_node\n return nil unless valid?\n\n head_node = @nodes.select { |n| n.is_shadow? }.compact\n \n # TODO: is the last guard necessary?\n head_node.empty? ? nil : head_node[0]\n end", "def snake_or_ladder(board_size)\n start = random_cell_value(board_size)\n ending = random_cell_value(board_size)\n return {start=>ending} unless start == ending\n snake_or_ladder(board_size) \n end", "def head() slot(:head) end", "def assign_new_head(beats)\n @head = Node.new(beats[0])\n beats.shift\n end", "def first_element(array)\n array[0]\nend", "def breadth_first(a=[])\n unless a.length == 0\n s = []\n a.each do |z|\n if z.key?('v')\n print \"#{z['v']} \"\n s.push(z['l'])\n s.push(z['r'])\n end\n end\n breadth_first(s)\n end\n \nend", "def draw\n # snake head\n Image.new('img/SnakeHead.png',\n x: head[0] * GRID_SIZE,\n y: head[1] * GRID_SIZE)\n # snake tail\n @positions[0..-2].each do |position|\n Circle.new(x: position[0] * GRID_SIZE + GRID_SIZE / 2,\n y: position[1] * GRID_SIZE + GRID_SIZE / 2,\n radius: GRID_SIZE / 2 - 1,\n color: 'blue')\n end\n end", "def initialize(signature)\n\t\tself.signature=signature\n\t\tself.squares=[]\n\t\t\n\t\ttemp_snake=Snake.new(signature)\n\n\t\ttemp_snake.squares.length.times do |i|\n\t\t\tif i==0 or i==(temp_snake.squares.length-1)\n\t\t\t\tsquares << :bridge\n\t\t\telse\n\t\t\t\tif on_same_line(temp_snake.squares[i-1].coords,temp_snake.squares[i+1].coords)\n\t\t\t\t\tsquares << :bridge\n\t\t\t\telse\n\t\t\t\t\tsquares << :joint\n\t\t\t\tend\n\t\t\tend\t\t\t\n\t\tend\n\tend", "def set_first_row_column(row = 0, col = 0)\n row = RowMax - 1 if row > RowMax - 1\n col = ColMax - 1 if col > ColMax - 1\n\n @first_row = row\n @first_col = col\n end", "def get_first\n @head == nil ? nil : @head.data\n end", "def using_first(array)\n array.first\nend", "def using_first(array)\n array.first\nend", "def using_first(array)\n array.first\nend", "def using_first(array)\n array.first\nend", "def first?\n index == 0\n end", "def first?\n index == 0\n end", "def first?\n index == 0\n end", "def first; end", "def first; end", "def head\n return @head\n end", "def head(number)\n number.first\nend", "def first_element_with_array_methods\n @taylor_swift.index (0)\n end", "def game_board_header\n puts \" 1 2 3 4 5 6 7 8 9 10\"\n puts \" -----------------------------------------\"\n end", "def start_of_first_scene(script)\n script = script.split(\"\\n\") if script.is_a?(String)\n line_index = 0\n loop do\n line = script[line_index]\n break unless line\n break if line =~ /[A-Za-z]/\n line_index += 1\n end\n line_index += 1 if line_index < script.size # And ignore the name of the play\n line_index\n end", "def y\n head[1]\n end", "def y\n head[1]\n end", "def just_first\n first.split(' ')[0]\n end", "def start; @sequence[0]; end", "def first\n end", "def initial_particle_assignment\r\n array = 0.upto(@length - 1).to_a\r\n array = array.shuffle\r\n (0..@length - 1).each do |x|\r\n student = array[x]\r\n @position[student][x % @teams] = 1\r\n end\r\n end" ]
[ "0.6615536", "0.6392241", "0.6260439", "0.6030301", "0.5941435", "0.5924791", "0.5765357", "0.57424206", "0.5741144", "0.5737481", "0.5735287", "0.57323253", "0.57045335", "0.5687292", "0.5656422", "0.56228673", "0.56228673", "0.5620292", "0.5605041", "0.55769813", "0.5551065", "0.5502671", "0.55006105", "0.5498932", "0.5498932", "0.5487763", "0.5481314", "0.5459271", "0.5457045", "0.5457045", "0.5440139", "0.5423877", "0.54197955", "0.54120004", "0.5392934", "0.53725374", "0.53599155", "0.5354427", "0.5353656", "0.534749", "0.5345283", "0.53326684", "0.5314068", "0.5312682", "0.5306974", "0.5299464", "0.5294166", "0.52837384", "0.527781", "0.5269836", "0.5269618", "0.52580386", "0.5248623", "0.5234901", "0.5225828", "0.52248967", "0.52248967", "0.52248967", "0.52248967", "0.52248967", "0.52248967", "0.52248967", "0.52248967", "0.52248967", "0.52248967", "0.52223927", "0.52065194", "0.5205084", "0.52028036", "0.5190078", "0.5189789", "0.5181492", "0.5181326", "0.51721394", "0.51704943", "0.5154085", "0.51451015", "0.51412874", "0.51338977", "0.5132496", "0.5128449", "0.5128449", "0.5128449", "0.5128449", "0.51276124", "0.51276124", "0.51213235", "0.51201195", "0.51201195", "0.51105344", "0.5109522", "0.50880975", "0.50780594", "0.5076652", "0.5074136", "0.5074136", "0.507371", "0.50697887", "0.5058972", "0.50546837" ]
0.805979
0
The body consists of all the arrays in the snake matrix except the first one.
def locate_body snake_matrix[1..-1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(body)\n lines = body.split(\"\\n\")\n width = lines.first.length\n number_of_syms_to_wrap = (Dimensions::WIDTH - width) / 2\n syms_string = Citizen::DEAD * number_of_syms_to_wrap\n horiz_wrapped = lines.map { |line| syms_string + line + syms_string }\n\n matrix = horiz_wrapped.map { |row| row.split(\"\") }\n height = matrix.size\n\n number_of_row_wraps = (Dimensions::HEIGHT - height) / 2\n dead_row = (Citizen::DEAD * Dimensions::WIDTH).split(\"\")\n number_of_row_wraps.times do\n matrix = [dead_row] + matrix + [dead_row]\n end\n matrix.map(&:join).join(\"\\n\")\n end", "def body\n return @position.pop()\n end", "def body_part\n [\"heart\", \"eye\", \"stomach\", \"neck\", \"leg\", \"shoulder\", \"chest\"].sample\nend", "def body\n @segment[%r(^.*?\\n(.*)$)m, 1]\n end", "def create_snake\n vertical_position = location[0]\n horizontal_position = location[1]\n @snake_matrix = Array.new(size) { |part_index| [vertical_position, horizontal_position + part_index] }\n end", "def quick_body\n @raw[1..-1] || \"\"\n end", "def message body\r\n checksum = body.reduce(0) { |a, byte| a ^ byte }\r\n \r\n [\r\n STX,\r\n *(body + [checksum]).map { |byte|\r\n # Escape special bytes in a message.\r\n # @see \"London DI Kit.pdf\" page 4\r\n SPECIAL_BYTES.include?(byte) ? [ESC, byte + 0x80] : byte\r\n }.flatten,\r\n ETX\r\n ]\r\nend", "def body\n\n @r = rand(3)\n if @r == 1 \n \"\\n\\n\" + get_content('Intro', 'component') + \" \" + \n get_content(@emphasis, \"emphasis\") + \"\\n\\n\" +\n get_content(@ideologyKey, \"ideology\") + \"\\n\\n\" +\n if @geography != \"Other\" \n get_content(@geography, \"geography\") \n end \n elsif @r == 2 \n \"\\n\\n\" + get_content('Intro', 'component') + \" \" +\n get_content(@ideologyKey, \"ideology\") +\n \"\\n\\n\" + get_content(@emphasis, \"emphasis\") +\n\tif @geography != \"Other\" \n\t\"\\n\\n\" + get_content(@geography, \"geography\") \n\tend \n else \n\t \"\\n\\n\" + get_content('Intro', 'component') + \" \" +\n\t get_content(@emphasis, \"emphasis\") +\n\t if @geography != \"Other\" \n\t \"\\n\\n\" + get_content(@geography, \"geography\") \t\t \n\t end +\n\t \"\\n\\n\" + get_content(@ideologyKey, \"ideology\")\n end \t\nend", "def matrix\n end", "def transform_body(body)\n return [] if body.blank?\n lines = body.respond_to?(:lines) ? body.lines : body.split(\"\\n\")\n lines.map(&:strip)\n end", "def summarize_bodies(parts)\n return parts.map do |p|\n p[\"body\"] = \"Body summary - length #{p[\"body\"].length}\"\n p\n end\n end", "def in_body?(snake_body, cell)\n snake_body.keep_if { |body| body[:x] == cell[:x] && body[:y] == cell[:y] }\n return snake_body.length > 0\nend", "def body()\n #This is a stub, used for indexing\n end", "def bake\n return unbake unless @data\n @baked_lines = []\n @data.ysize.times do |i|\n line = ''\n @data.xsize.times do |j|\n line << @tileset.fetch(@data[j, i], @default)\n end\n @baked_lines << line\n end\n end", "def localCelestialBodies\n\t\tret = []\n\t\t@db.hgetall('sgt-system:' + @id + ':bodies').each do |coords, bid|\n\t\t\tret.push(getCelestialBody(@db, bid))\n\t\tend\n\t\tret\n\tend", "def bodyClause (cs)\n cs.drop(1)\nend", "def exercise_1113 (matrix)\n end", "def pan_body()\n self.zip((?a..?z).to_a).collect do |n, c|\n sprintf(\" %s%s %c%s\", \\\n (c==?z ? \"and \" : \"\"), \\\n n.to_en, c, \\\n (n>1) ? \"'s\" : \"\")\n end\n end", "def reset_body\n mixin({\n line_height: 1\n })\n end", "def body_parts\n\t @part.getCount.times.map do |index|\n\t\tpart = @part.getBodyPart(index)\n\t\tnext(BodyPart.new(part, self)) \\\n\t\t unless @message.is_a?(javax.mail.Multipart)\n\t\tMultipart.new(part, self)\n\t end\n\tend", "def distantCelestialBodies\n\t\tret = []\n\t\t@db.hgetall('sgt-system:' + @id + ':distantbodies').each do |coords, bid|\n\t\t\tret.push(getCelestialBody(@db, bid))\n\t\tend\n\t\tret\n\tend", "def get\n (0...@column_size).each {|observation| process_line(observation) }\n @body\n end", "def mk_body\n skills = @skills.join(', ')\n skills += \", m.v.\" if @skills.length > 1\n\n body = \"Jeg søger stillingen som #{@position} i jeres virksomhed.\\n\"\n body += \"Jeg føler min erfaring inden for brugen af #{skills} kunne gavne jer.\\n\" unless @skills.nil?\n body += \"#{@extra}\\n\" unless @extra.nil?\n return body\n end", "def render\n render = Array.new(@towers)\n \n @board.each_with_index do |tower, i|\n render[i] = [\" \"] * (@towers - tower.length) + tower\n end\n \n puts \"__________\"\n puts \"\\nTOWERS OF HANOI\\n\"\n \n render.transpose.each do |row|\n puts \" \" + row.join(\" \")\n end\n \n puts \"--- \" * @towers \n puts \" \" + (1..@towers).to_a.join(\" \")\n puts \"\\n\\n\"\n end", "def body\n nil\n end", "def array\n\t\treturn @hand_contents\n\tend", "def body\n \"\"\n end", "def body\n \"\"\n end", "def rows\n shape[0]\n end", "def body\n ''\n end", "def reset\n\t\t@board = Array.new(3) {Array.new(3,\" \")}\n\tend", "def body\n @body ||= begin\n body = \"\"\n while chunk = readpartial\n body << chunk\n end\n body\n end\n end", "def displayemptyframe\r\n\t\t\t@matrix = []\r\n\t\t\t@matrix[0] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[1] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[2] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[3] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[4] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[5] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\ttitle = \" 1 2 3 4 5 6 7 \"\r\n\t\t\trowdivider = \"+-+-+-+-+-+-+-+\"\r\n\t\t\trowempty = \"|_|_|_|_|_|_|_|\"\r\n\t\t\t@output.puts(\"#{title}\")\r\n\t\t\t@output.puts(\"#{rowdivider}\")\r\n\t\t\t\r\n\t\t\tfor i in 1..6\r\n\t\t\t\t@output.puts(\"#{rowempty}\")\r\n\t\t\tend\r\n\t\tend", "def render\n @board_array.each_with_index do |row, row_index|\n row.each_with_index do |cell, col_index|\n if @position_hash[[row_index, col_index]].hidden\n print '______'\n else\n print cell.to_s\n end\n end\n print \"\\n\"\n end\n end", "def index\n @celestial_bodies = CelestialBody.all\n end", "def locate_head\n snake_matrix.first\n end", "def body\n buffer = ''\n\n each { |chunk| buffer << chunk }\n return buffer\n end", "def display_dummy\n\t\tdummy_board = Array.new(3) {Array.new(3)}\n\t\tputs \"\\n\"\n\t\tputs \" 1 | 2 | 3 \"\n\t\tputs \"-----------\"\n\t\tputs \" 4 | 5 | 6 \"\n\t\tputs \"-----------\"\n\t\tputs \" 7 | 8 | 9 \"\n\t\tputs \"\\n\"\n\tend", "def draw_skeleton(userId)\n stroke_weight(3)\n\n # to get the 3d joint data\n drawLimb(userId, SimpleOpenNI::SKEL_HEAD, SimpleOpenNI::SKEL_NECK);\n\n drawLimb(userId, SimpleOpenNI::SKEL_NECK, SimpleOpenNI::SKEL_LEFT_SHOULDER);\n drawLimb(userId, SimpleOpenNI::SKEL_LEFT_SHOULDER, SimpleOpenNI::SKEL_LEFT_ELBOW);\n drawLimb(userId, SimpleOpenNI::SKEL_LEFT_ELBOW, SimpleOpenNI::SKEL_LEFT_HAND);\n\n drawLimb(userId, SimpleOpenNI::SKEL_NECK, SimpleOpenNI::SKEL_RIGHT_SHOULDER);\n drawLimb(userId, SimpleOpenNI::SKEL_RIGHT_SHOULDER, SimpleOpenNI::SKEL_RIGHT_ELBOW);\n drawLimb(userId, SimpleOpenNI::SKEL_RIGHT_ELBOW, SimpleOpenNI::SKEL_RIGHT_HAND);\n\n drawLimb(userId, SimpleOpenNI::SKEL_LEFT_SHOULDER, SimpleOpenNI::SKEL_TORSO);\n drawLimb(userId, SimpleOpenNI::SKEL_RIGHT_SHOULDER, SimpleOpenNI::SKEL_TORSO);\n\n drawLimb(userId, SimpleOpenNI::SKEL_TORSO, SimpleOpenNI::SKEL_LEFT_HIP);\n drawLimb(userId, SimpleOpenNI::SKEL_LEFT_HIP, SimpleOpenNI::SKEL_LEFT_KNEE);\n drawLimb(userId, SimpleOpenNI::SKEL_LEFT_KNEE, SimpleOpenNI::SKEL_LEFT_FOOT);\n\n drawLimb(userId, SimpleOpenNI::SKEL_TORSO, SimpleOpenNI::SKEL_RIGHT_HIP);\n drawLimb(userId, SimpleOpenNI::SKEL_RIGHT_HIP, SimpleOpenNI::SKEL_RIGHT_KNEE);\n drawLimb(userId, SimpleOpenNI::SKEL_RIGHT_KNEE, SimpleOpenNI::SKEL_RIGHT_FOOT); \n\n # draw body direction\n bodyDir = PVector.new(0,0,0)\n bodyCenter = PVector.new(0,0,0)\n getBodyDirection(userId,bodyCenter,bodyDir)\n \n bodyDir.mult(200); # 200mm length\n bodyDir.add(bodyCenter);\n \n stroke(255,200,200);\n line(bodyCenter.x,bodyCenter.y,bodyCenter.z,\n bodyDir.x ,bodyDir.y,bodyDir.z);\n\n stroke_weight(1)\n \nend", "def raw_body\n @raw_body ||= @raw[(raw_command.length + 1)..-1] || \"\"\n end", "def rect(a, b, screen)\n screen[0...b].each do |row|\n row[0...a] = (\"#\"*a).split(\"\")\n end\n\n screen\nend", "def show_body\n brows = []\n current_context[0][:body].map do |hash|\n hash.each do |_key , _val|\n _val = _val.scan(/.{100}/).join(\"\\n\") if _val.size > 150 # This line To fix table layout\n\n brows << [\"#{_key}\".green, \"#{_val}\".white]\n brows << :separator\n end\n end\n\n return brows\n end", "def initialize\n @board = Array.new(3) { Array.new(3) }\n end", "def initialize\n @board = Array.new(3) { Array.new(3) }\n end", "def initialize\n @board = Array[]\n initializeTop\n initializeMiddle\n initializeBottom\n end", "def hidden_ships_grid\n new_grid = @grid.map do |subarray|\n subarray.map do |ele|\n if ele == :S \n ele = :N \n else\n ele\n end\n end \n end\n new_grid\n end", "def matriz_mensaje\n @m_mensaje=Array.new(4){Array.new(4,'')}\n i,j,contador=0,0,0\n @m.each do |x|\n if(contador==4)\n contador=0\n i=0\n j+=1\n end\n @m_mensaje[i][j] = x\n #p a[i][j]\n i+=1\n contador+=1\n end\n @m_mensaje\n\n end", "def get_first_array_elements(body, parts)\n part_count = 0\n parts.each do |part|\n part_count += 1\n body[full_part] = body[full_part][0] if body[full_part].is_a?(Array)\n end\n return body\nend", "def tail\n board[snake[-1][0]].insert(snake[-1][1], nil)\n board[snake[-1][0]].delete_at(snake[-1][1]+1)\n end", "def body\n lines = ''\n in_head = true\n File.open(@file).each_line do |line|\n in_head = false if in_head and line.chomp.empty?\n lines << line unless in_head\n end\n return lines\n end", "def body\n content.gsub(/\\s*---\\s*/, \"\\n\\n\")\n end", "def short_body\n if body.size > 15\n body[0..15]\n else\n body\n end\n end", "def on_array(*body)\n @last_sexp =\n super(*body).tap do |sexp|\n next unless SPECIAL_LITERALS.include?(body.dig(0, :type))\n\n comments = sexp.dig(:body, 0).delete(:comments)\n sexp.merge!(comments: comments) if comments\n end\n end", "def body\n if defined? @body\n @body\n else\n Null\n end\n end", "def main_diagonal\n (0...@game.rows).collect { |i| @game.board.board[i][i] }\n end", "def body\n @raw\n end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def initialize_matrix!\n @matrix = config.map do |_hand, minimum_position|\n minimum_position\n end.each_slice(13).to_a\n end", "def reset!\n # @cells = Array.new(9, \" \")\n self.cells = [\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"]\n end", "def seperate_body()\n\t\t@stream.split(\"\\n\\n\", 2)[1]\n\tend", "def body_math_index\n weight / (height * height)\n end", "def possible_body(path)\n if @length > path.length\n path.reverse + @body.drop(1).first(@length - path.length)\n elsif @length < path.length\n path.last(@length)\n else\n path\n end\n end", "def array_nl()\n #This is a stub, used for indexing\n end", "def create_body\n @body = @suntime_text.text.concat(\"\\n\")\n @body.concat(@temperature_text.text).concat(\"\\n\")\n @body.concat(@wind_text.text).concat(\"\\n\")\n @body.concat(@rain_text.text)\n nil\n end", "def empty_puzzle\n result = []\n @amount_row.times do |index|\n result << [0]*@amount_column\n end\n result\n end", "def matrix_row\n return [ self.run, self.rise * -1, (p1.y * self.run - self.rise*p1.x)]\n end", "def render\n arr = Array.new(4) { Array.new(4) }\n # arr1 = Array.new(4) { Array.new(4) }\n # @grid.each_with_index do |row, i|\n # row.each_with_index do |card, j|\n # #arr[i][j] = card.face_up ? card.face_value : 0\n # arr1[i][j] = card.face_value\n # end\n # p arr1[i]\n # end\n\n @grid.each_with_index do |row, i|\n row.each_with_index do |card, j|\n arr[i][j] = card.face_up ? card.face_value : 0\n end\n p arr[i]\n end\n arr\n end", "def carve_passages\n\t\t@height.times do |y|\n\t\t\t@width.times do |x|\n\t\t\t\t# \n\t\t\t\t# Render updates of the maze on a \"cell-by-cell\" basis\n\t\t\t\t#\n\t\t\t\tif @animate\n\t\t\t\t\tdisplay(x,y)\n\t\t\t\t\tsleep @delay\n\t\t\t\tend\n\n\t\t\t\tdirs = []\n\t\t\t\tdirs << @@N if y > 0\n\t\t\t\tdirs << @@W if x > 0\n\n\t\t\t\tif ( dir = dirs[rand(dirs.length)] ) \n\t\t\t\t\tdx,dy = x + @@DX[dir], y + @@DY[dir]\n\t\t\t\t\t@grid[y][x] |= dir\n\t\t\t\t\t@grid[dy][dx] |= @@OPPOSITE[dir]\n\t\t\t\tend\t\n\t\t\tend\n\t\tend\n\n\t\t#\n\t\t# Make one final call to \"update\" to display last cell\n\t\t#\n\t\tif @animate\n\t\t\tdisplay(-1,-1)\n\t\tend\n\tend", "def transform_initialboard(lines)\n board = []\n 9.times do |i|\n line = []\n 9.times do |j|\n line << lines[j][8 - i]\n end\n board << line\n end\n { 'preset' => 'OTHER', 'data' => { 'board' => board } }\n end", "def body\n @raw.split(header)[1]\n end", "def create_matrix\n @long.times do |long|\n @matriz.push([])\n @width.times do |_width|\n @matriz[long].push([' . ', ' * '].sample)\n end\n end\n kill_cells_in_borders\n end", "def create_board\n cols = Array.new(7) { Array.new(6, 0) }\n cols\n end", "def diagonalize\n text_lines = @text_lines ; @text_lines = [ ]\n sltn_lines = @sltn_lines ; @sltn_lines = [ ]\n text_lines.each_with_index do |line, i|\n line.split('').each_with_index do |char, j|\n (@text_lines[i+j] ||= '') << char\n (@sltn_lines[i+j] ||= '') << sltn_lines[i][j]\n end\n end\n end", "def body\n part('body')\n end", "def image_board\n\t\t(0...@width).map do |i|\n\t\t\t(0...@height).map do |j|\n\t\t\t\t# ([1]*3+[0]*7)[rand 10]\n\t\t\t\trand 2\n\n\n\t\t\t\t# rand 2\n\t\t\tend\n\t\tend\n\tend", "def body\n return \"\"\n end", "def remove_lines\n @deleted_indexes = []\n\n # Loop though each line of the board array\n @object_array.each_with_index do |line, i|\n # if the line has a 0 in it, its not solid and should be ignored\n next if line.include?(0)\n\n # Add 0.5 to the lines_cleared tally (one line is two array rows thick)\n @lines_cleared += 0.5\n\n # Add the index of the solid line to the deleted_indexes array\n @deleted_indexes << i\n end\n\n # Delete rows from the board array at the index values in the deleted_indexes array\n @deleted_indexes.reverse.each { |i| @object_array.delete_at(i) }\n\n # Add rows of zeros to the top of the board array to replace the deleted lines\n @object_array = Array.new(@deleted_indexes.length) { [0] * @game_board_width } + @object_array\n\n @deleted_indexes\n end", "def body\n ret = read_attribute(:body)\n if ret.nil?\n return ret\n end\n ret = ret.strip\n ret = ret.gsub(/(?:\\n\\s*){2,}/, \"\\n\\n\") # remove excess linebreaks that unnecessarily space it out\n ret\n end", "def body_list\n self.body.unshift :rlist\n end", "def initialize(snake_static)\r\n # number of bits in the bitvector\r\n @length = snake_static.count(\"X\")\r\n \r\n @to_board = lambda do |snake|\r\n # build board (2d array with n times n size, where n = 2*snake.length + 1)\r\n board = []\r\n (2 * snake.length + 1).times do\r\n board << Array.new(2 * snake.length + 1, ' ')\r\n end\r\n \r\n p = Point.new(snake.length, snake.length)\r\n dir = Point.new(1,0)\r\n max = p.dup\r\n min = p.dup\r\n \r\n snake.each_char do |c|\r\n # exit if current position is not blank\r\n return nil if board[p.y][p.x] != ' '\r\n # set current position\r\n board[p.y][p.x] = c\r\n # compute next position\r\n dir.rotate!(c)\r\n p += dir\r\n # update min and max\r\n max = Point.max(max, p)\r\n min = Point.min(min, p)\r\n end \r\n #set last position\r\n return nil if board[p.y][p.x] != ' '\r\n board[p.y][p.x] = 'X'\r\n \r\n minimized_board = []\r\n min.y.upto(max.y) do |y|\r\n minimized_board[y - min.y] = []\r\n min.x.upto(max.x) do |x|\r\n minimized_board[y - min.y][x - min.x] = board[y][x]\r\n end\r\n end\r\n \r\n minimized_board\r\n end\r\n \r\n @to_string = lambda do |value|\r\n configuration = (\"%.#{length}b\" % value).reverse.split(\"\")\r\n directions = ['R', 'L']\r\n direction = 0\r\n snake = snake_static.split(\"\")\r\n \r\n snake.each_with_index do |c, i|\r\n if c == 'X'\r\n if configuration.pop == '1'\r\n direction = 1 - direction\r\n end\r\n snake[i] = directions[direction]\r\n end\r\n end\r\n \r\n snake.join(\"\")\r\n end\r\n \r\n flood_fill = lambda do |board, x, y|\r\n if board[y] && board[y][x] == ' '\r\n board[y][x] = 'o'\r\n \r\n flood_fill.call(board, x+1, y)\r\n flood_fill.call(board, x, y+1)\r\n flood_fill.call(board, x-1, y)\r\n flood_fill.call(board, x, y-1)\r\n end\r\n end\r\n \r\n # energy function that returns energy of a bitvector\r\n # (the lower the number, the fitter the bitvector)\r\n \r\n @energy_a = lambda do |value|\r\n snake = @to_string.call(value)\r\n board = @to_board.call(snake)\r\n \r\n return Float::INFINITY unless board\r\n \r\n width = board[0].length\r\n height = board.length\r\n Math.sqrt(width*width + height*height)\r\n end\r\n \r\n @energy_b = lambda do |value|\r\n snake = @to_string.call(value)\r\n board = @to_board.call(snake)\r\n \r\n return Float::INFINITY unless board\r\n \r\n width = board[0].length\r\n height = board.length\r\n \r\n 1.upto(width-1) { |x| flood_fill.call(board, x, 0) }\r\n 1.upto(height-1) { |y| flood_fill.call(board, width-1, y) }\r\n (width-2).downto(0) { |x| flood_fill.call(board, x, height-1) }\r\n (height-2).downto(0) { |y| flood_fill.call(board, 0, y) }\r\n \r\n holes = board.map { |x| x.join('') }.join('').count(' ')\r\n holes = Float::INFINITY if holes == 0\r\n holes\r\n end\r\n \r\n # energy function which uses energy_b to maximize the holes\r\n @energy_c = lambda do |value|\r\n e_b = @energy_b.call(value)\r\n return 0 if e_b == Float::INFINITY\r\n -e_b\r\n end\r\n end", "def clone_body\n clone.mark_head(false)\n end", "def render_board\n puts ''\n puts ' | |'\n puts \" #{@squares[1]} | #{@squares[2]} | #{@squares[3]}\"\n puts ' | |'\n puts '-------------------'\n puts ' | |'\n puts \" #{@squares[4]} | #{@squares[5]} | #{@squares[6]}\"\n puts ' | |'\n puts '-------------------'\n puts ' | |'\n puts \" #{@squares[7]} | #{@squares[8]} | #{@squares[9]}\"\n puts ' | |'\n puts ''\n end", "def sets\n rows = @board.each_slice(9).to_a # rows\n cols = rows.transpose\n (rows + cols + boxes).each do |set|\n set.delete(\"0\")\n end\n end", "def body\n @chunk\n end", "def hidden_ships_grid\n hidden = Array.new(@grid.size) { [] }\n (0...@grid.size).each do |i|\n (0...@grid.size).each do |j|\n chit = self[[i, j]] == :S ? :N : self[[i, j]]\n hidden[i] << chit\n end\n end\n hidden\n end" ]
[ "0.6045197", "0.57564586", "0.56901485", "0.5560798", "0.5486362", "0.54608446", "0.54469013", "0.5420796", "0.535777", "0.53464717", "0.5326325", "0.5324661", "0.5300899", "0.5185273", "0.5157756", "0.51539254", "0.5135978", "0.5132808", "0.5107401", "0.508262", "0.5069615", "0.50687814", "0.5066726", "0.50602067", "0.50576264", "0.50574106", "0.5043262", "0.5043262", "0.5030954", "0.5028224", "0.50249845", "0.50218725", "0.50202614", "0.50102925", "0.49958634", "0.49946356", "0.4993028", "0.49925718", "0.49876353", "0.49855125", "0.49687132", "0.49655068", "0.49634", "0.49634", "0.49598324", "0.49484456", "0.49480608", "0.49466363", "0.49455902", "0.49455464", "0.4943887", "0.4943115", "0.49426046", "0.49308315", "0.49192727", "0.49018314", "0.49012536", "0.49012536", "0.49012536", "0.49012536", "0.49012536", "0.49012536", "0.49012536", "0.49012536", "0.49012536", "0.49012536", "0.49012536", "0.49012536", "0.49012536", "0.49012536", "0.49012536", "0.49012536", "0.4900214", "0.48788455", "0.48730952", "0.48726004", "0.48681912", "0.48680028", "0.48660424", "0.48537922", "0.48500293", "0.48485297", "0.48432228", "0.4842094", "0.48265636", "0.48152837", "0.4812392", "0.48117822", "0.48058042", "0.48049596", "0.48042136", "0.48020017", "0.4796857", "0.47966036", "0.4793957", "0.4789456", "0.47893867", "0.47890827", "0.47880384", "0.4787029" ]
0.7060849
0
Inputs a new vertical location for the head of the snake in order to simulate vertical movement.
def update_head_vertical_location(row) locate_head[0] = row end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drive_north(direction)\n if direction == 'N'\n @new_vertical_position = take_input[3].to_i\n @new_vertical_position += 1\n @current_position = \"#{take_input[2].to_i},#{@new_vertical_position}\"\n end\n end", "def drive_south(direction)\n if direction == 'S'\n @new_vertical_position = take_input[3].to_i\n @new_vertical_position -= 1\n @current_position = \"#{take_input[2].to_i},#{@new_vertical_position}\"\n end\n end", "def vertical_move\n @initial_pos[0] == @final_pos[0] \n end", "def move\n position_after_move = @position.new_coordinates_for_step_size(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n #ignore the command if robot is being out off tabletop\n if(@table_top.has_within_bounds?(position_after_move))\n @position = @position.new_coordinates_for(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n end\n end", "def move_up\n\t\t# if the horse isn't yet at the top of the screen move it up 20\n\t\tif @y > 0\n\t\t\t@y = @y -20\n\t\tend\n\tend", "def _rl_move_vert(to)\r\n if (@_rl_last_v_pos == to || to > @_rl_screenheight)\r\n return\r\n end\r\n\r\n if ((delta = to - @_rl_last_v_pos) > 0)\r\n @rl_outstream.write(\"\\n\"*delta)\r\n @rl_outstream.write(\"\\r\")\r\n @_rl_last_c_pos = 0\r\n else\r\n if(@_rl_term_up)\r\n @rl_outstream.write(@_rl_term_up*(-delta))\r\n end\r\n end\r\n @_rl_last_v_pos = to # Now TO is here\r\n end", "def place_snake_head(position, move_over_tunnel)\n snake_part = SnakePart.new(@head)\n @world[@head] = snake_part\n @head = position\n @world[position] = SnakeHead.new(position)\n\t\t\t@world[position].set_over_tunnel(move_over_tunnel)\n @body.unshift @head\n end", "def drive_east(direction)\n if direction == 'E'\n @new_horizontal_position = take_input[2].to_i\n @new_horizontal_position += 1\n @current_position = \"#{@new_horizontal_position},#{take_input[3].to_i}\"\n end\n end", "def move\n # removing first element from the snake body\n unless @is_growing\n # list.shift removes the first element within a list\n @positions.shift\n end\n # after growing, snake should stop growing, it grows one at a time\n @is_growing = false\n # reading direction\n case @direction\n when 'down'\n # push insert an element in last position of the list\n # adding one to y in snake head\n @positions.push([head[0],\n (head[1] + 1) % GRID_HEIGHT])\n when 'up'\n @positions.push([head[0],\n (head[1] - 1) % GRID_HEIGHT])\n when 'left'\n @positions.push([(head[0] - 1) % GRID_WIDTH,\n head[1]])\n when 'right'\n @positions.push([(head[0] + 1) % GRID_WIDTH,\n head[1]])\n else\n puts 'error: another key inside case else'\n end\n end", "def move_up(lines=1)\n self.y -= CONSOLE_LINE_HEIGHT * lines\n end", "def move_south\n @y -= 1\n end", "def move_vertically\n @vy += 1\n\n # Vertical movement\n if @vy > 0 && @y < 500 # TODO set externally\n @vy.times { @y += 1 }\n end\n if @vy < 0\n (-@vy).times { @y -= 1 }\n end\n end", "def update_position!(next_move)\n table.x = next_move[:x]\n table.y = next_move[:y]\n end", "def create_snake\n vertical_position = location[0]\n horizontal_position = location[1]\n @snake_matrix = Array.new(size) { |part_index| [vertical_position, horizontal_position + part_index] }\n end", "def move\n @position.shift unless @growing\n case @direction\n when 'down'\n @position.push(new_coords(head[0], head[1] + 1))\n when 'up'\n @position.push(new_coords(head[0], head[1] - 1))\n when 'left'\n @position.push(new_coords(head[0] - 1, head[1]))\n when 'right'\n @position.push(new_coords(head[0] + 1, head[1]))\n end\n @growing = @turned = false\n end", "def move\n @tail = @location\n closest_food = detect_closest_food\n @location = calculate_next_location(closest_food)\n\n end", "def move\n\t\t# move 5px to the left\n\t @x = @x - 5\n\t # move up or down based on the Y velocity\n\t @y = @y + @vy\n\tend", "def test_can_move_south\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :SOUTH, 1, 2)\n\n assert_equal(:SOUTH, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(1, 2))\n\n @robot.move\n assert_equal(1, @robot.x, \"X position should be 1 (not changed)\")\n assert_equal(1, @robot.y, \"Y position should be 1 (moved 1 south)\")\n assert_equal(:SOUTH, @robot.direction, \"Direction should be :SOUTH (not changed)\")\n assert_equal(\"M\", @robot.get_path_value(1, 1))\n end", "def move\n @positions.shift\n case @direction\n when 'down'\n @positions.push(new_coords(head[0], head[1] + 1))\n when 'up'\n @positions.push(new_coords(head[0], head[1] - 1))\n when 'left'\n @positions.push(new_coords(head[0] - 1, head[1]))\n when 'right'\n @positions.push(new_coords(head[0] + 1, head[1]))\n end\n end", "def move_east\n @x += 1\n end", "def move_down(lines=1)\n self.y += CONSOLE_LINE_HEIGHT * lines\n end", "def move_up\n current_y = position[0] - 1\n position[0] = (current_y < 0 ) ? (width-1) : current_y\n end", "def move_up(n)\n self.y += n\n end", "def place\n next_move = {x: command.arguments[:x], y: command.arguments[:y]}\n if inside_table?(next_move_x_y(next_move, false))\n update_position!(next_move_x_y(next_move, false))\n update_direction!\n else\n almost_die\n end\n end", "def move_up\r\n if @y + @vel_y > GAME_PRESET[\"player_move_up\"]\r\n @y -= @vel_y\r\n end\r\n end", "def reflect_vertical\r\n self.v[:y] = -self.v[:y]\r\n end", "def move\n case self.direction\n when 'NORTH'\n self.y += 1 unless self.y == @table.y\n when 'EAST'\n self.x += 1 unless self.x == @table.x\n when 'SOUTH'\n self.y -= 1 unless self.y == 0\n when 'WEST'\n self.x -= 1 unless self.x == 0\n end\n end", "def move_down\r\n if @y + @vel_y < SCREEN_HEIGHT - GAME_PRESET[\"player_move_down\"]\r\n @y += @vel_y\r\n end\r\n end", "def move\n case @direction\n when \"n\"\n @y_axis += 1\n when \"e\"\n @x_axis += 1\n when \"s\"\n @y_axis -= 1\n when \"w\"\n @x_axis -= 1\n end\n end", "def update_move\n self.x = screen_x\n self.y = screen_y\n update_move_arch if @type == Arched\n end", "def move\n\t\t@x += 0\n\t\t@y += @vel\n\tend", "def move(vpoint)\n @position += vpoint\n end", "def test_can_not_move_south\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :SOUTH, 1, 0)\n\n assert_equal(:SOUTH, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(1, 0))\n\n @robot.move\n assert_equal(1, @robot.x, \"X position should be 1 (not changed)\")\n assert_equal(0, @robot.y, \"Y position should be 0 (not changed)\")\n assert_equal(:SOUTH, @robot.direction, \"Direction should be :SOUTH (not changed)\")\n assert_equal(\"P\", @robot.get_path_value(1, 0))\n end", "def move_to(x, y); end", "def place_command_proceed\n @robot.place(@x_position.to_i, @y_position.to_i, @vector.to_s.strip)\n end", "def move_position\n @x += @velocity_x\n @y += @velocity_y\n end", "def move_up(params)\n get_moved_id(params)\n get_selected_vines\n currentIndex = @selected_vines.find_index @vid\n if currentIndex == 0\n newIndex = @selected_vines.count - 1\n else\n newIndex = currentIndex - 1\n end\n @selected_vines = @selected_vines.insert(newIndex, @selected_vines.delete_at(currentIndex))\n session[:selected_vines] = @selected_vines\n end", "def update_snake_direction\n if Gosu.button_down?(Gosu::KB_RIGHT) && @snake.direction != \"left\"\n @snake.direction = \"right\"\n elsif Gosu.button_down?(Gosu::KB_DOWN) && @snake.direction != \"up\"\n @snake.direction = \"down\"\n elsif Gosu.button_down?(Gosu::KB_LEFT) && @snake.direction != \"right\"\n @snake.direction = \"left\"\n elsif Gosu.button_down?(Gosu::KB_UP) && @snake.direction != \"down\"\n @snake.direction = \"up\"\n end\n end", "def move\n\t\tif @direction == \"N\"\n\t\t\t@y += 1\n\t\telsif @direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif @direction == \"E\"\n\t\t\t@x += 1\n\t\telsif @direction == \"S\"\n\t\t\t@y -= 1\n\t\tend\n\tend", "def move\n case @direction\n when \"N\"\n @y_coord += 1\n when \"S\"\n @y_coord -= 1\n when \"W\"\n @x_coord += 1\n when \"E\"\n @x_coord -= 1\n end\n end", "def update_pos( dt )\n @px += @vx * dt\n @py += @vy * dt\n @rect.center = [@px, @py]\n end", "def home\n pen_up\n self.xy = ORIGIN\n self.heading = 0.0\n end", "def move\n move_by get_incremental_position_for_velocity if (any_velocity?)\n decrease_velocity\n @has_increased_velocity_for = {\n x: false,\n y: false\n }\n @velocity_deltatime.update\n end", "def move\n case @facing\n when \"north\"\n @posY += 1 if @posY+1 < @table.width\n when \"east\"\n @posX += 1 if @posX+1 < @table.height\n when \"south\"\n @posY -= 1 if @posY-1 >= 0\n when \"west\"\n @posX -= 1 if @posX-1 >= 0\n end\n end", "def move\n case @toy_direction\n when \"NORTH\"\n new_place = [@toy_place[0], @toy_place[1] + 1]\n when \"EAST\"\n new_place = [@toy_place[0] + 1, @toy_place[1]]\n when \"SOUTH\"\n new_place = [@toy_place[0], @toy_place[1] - 1]\n when \"WEST\"\n new_place = [@toy_place[0] - 1, @toy_place[1]]\n end\n place_robot(new_place, @toy_direction)\n end", "def move_cursor_to(new_y)\n self.y = new_y + bounds.absolute_bottom\n end", "def go_up\n if !self.viewport.nil?\n if $imported[\"H87_SmoothMovements\"]#.nil? && $imported[\"H87_SmoothMovements\"] >= 1.1\n self.viewport.smooth_move(view_x, view_y)\n else\n self.viewport.rect.y = view_y\n end\n end\n end", "def test_can_move_north\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :TEST)\n\n assert_equal(:NORTH, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(0, 0))\n\n @robot.move\n assert_equal(0, @robot.x, \"X position should be 0 (not changed)\")\n assert_equal(1, @robot.y, \"Y position should be 1 (moved 1 north)\")\n assert_equal(:NORTH, @robot.direction, \"Direction should be :NORTH (not changed)\")\n assert_equal(\"M\", @robot.get_path_value(0, 1))\n end", "def execute\n return unless @robot.placed?\n\n original_position = @robot.position\n new_position = original_position.dup\n new_position.move\n\n @robot.position = new_position if @table.position_valid?(new_position)\n end", "def move\n\n if @position != []\n if @position[2] == \"EAST\"\n @position[0] += 1\n elsif @position[2] == \"WEST\"\n @position[0] -= 1\n elsif @position[2] == \"NORTH\"\n @position[1] += 1\n elsif @position[2] == \"SOUTH\"\n @position[1] -= 1\n end\n check_position()\n else\n puts \"Invalid Command!!.\\nPlease execute command (place) to place the robot on the table.\"\n end\n @position\nend", "def update_position\n end", "def update_position\n end", "def update_position\n end", "def move_down\n\t\tmove([0,1])\n\tend", "def place_robot(x,y,name)\n if (0..max_length).include?(x) && (0..max_height).include?(y)\n self.robot_position[name] = [x,y]\n end\n end", "def place(x, y, heading_symbol)\n heading = Heading.create(heading_symbol)\n valid_location = @board.safe_location(x, y)\n if valid_location && heading\n @state.unshift(Robot.new(x,y,heading))\n else\n puts \"Invalid heading: #{heading}\" if heading.nil?\n puts \"Invalid location: (#{x}, #{y}). Must be between (0, 0) and (#{@width}, #{@height})\" unless valid_location\n end\n self\n end", "def move\n case @direction\n when \"N\" then @y += 1 unless @y + 1 > @plateau.y || @@rover_locations.values.include?([@x, @y + 1])\n when \"E\" then @x += 1 unless @x + 1 > @plateau.x || @@rover_locations.values.include?([@x + 1, @y])\n when \"S\" then @y -= 1 unless @y - 1 < 0 || @@rover_locations.values.include?([@x, @y -1])\n when \"W\" then @x -= 1 unless @x - 1 < 0 || @@rover_locations.values.include?([@x -1, @x])\n end\n @@rover_locations[@id.to_sym] = [@x, @y]\n end", "def test_can_move_east\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :EAST, 1, 2)\n\n assert_equal(:EAST, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(1, 2))\n\n @robot.move\n assert_equal(2, @robot.x, \"X position should be 2 (moved 1 east)\")\n assert_equal(2, @robot.y, \"Y position should be 2 (not changed)\")\n assert_equal(:EAST, @robot.direction, \"Direction should be :EAST (not changed)\")\n assert_equal(\"M\", @robot.get_path_value(2, 2))\n end", "def move\n @x = (@x + @x_velocity) % Window.width\n @y = (@y + @y_velocity) % Window.height\nend", "def update_head_horizontal_location(column)\n locate_head[1] = column\n end", "def move\n @leading_x = coordinate_array[0]\n @leading_y = coordinate_array[1]\n end", "def move\n \n end", "def move\n \n end", "def move\n ##incrementing or decrementing eg. current_direction W,\n ##position_x decrementing by 1 (-=1)\n if @current_direction == \"N\"\n @position_y += 1\n puts \"#{@position_y}\"\n elsif @current_direction == \"E\"\n @position_x += 1\n elsif @current_direction == \"W\"\n @position_x -= 1\n elsif @current_direction == \"S\"\n @position_y -= 1\n end\n\n end", "def move_home_y\n @target_y = 0\n start_command('F12', true, false)\n end", "def move_down(params)\n get_moved_id(params)\n get_selected_vines\n currentIndex = @selected_vines.find_index @vid\n if currentIndex == @selected_vines.count - 1\n newIndex = 0\n else\n newIndex = currentIndex + 1\n end\n @selected_vines = @selected_vines.insert(newIndex, @selected_vines.delete_at(currentIndex))\n session[:selected_vines] = @selected_vines\n end", "def moveUp\n if @y > 1\n call Screen.setColor(false)\n call Screen.drawRectangle(@x, (@y + @size) - 1, @x + @size, @y + @size)\n let @y = @y - 2\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, @y, @x + @size, @y + 1)\n end\n end", "def move\n check_placed\n new_position = case facing\n when :north then @position.inc_y\n when :south then @position.dec_y\n when :east then @position.inc_x\n when :west then @position.dec_y\n end\n check_position(new_position)\n @position = new_position\n end", "def pedestal(view, time)\n direction = Geom::Vector3d.new(0,0,1)\n direction.reverse! if( (@keys & DOWN_ARROW) != 0 )\n self.move(view, time, direction, @speedy)\nend", "def move_home_y\n Status.current.info_target_y = 0\n @ramps_arduino.execute_command('F12', true, false)\n end", "def test_can_not_move_north\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :TEST, 1, 5)\n\n assert_equal(:NORTH, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(1, 5))\n\n @robot.move\n assert_equal(1, @robot.x, \"X position should be 1 (not changed)\")\n assert_equal(5, @robot.y, \"Y position should be 5 (not changed)\")\n assert_equal(:NORTH, @robot.direction, \"Direction should be :NORTH (not changed)\")\n assert_equal(\"P\", @robot.get_path_value(1, 5))\n end", "def move_up\n unless @value.eql? 1\n @y -= 50\n @value -= 1\n end\n end", "def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end", "def move_down(n)\n self.y -= n\n end", "def newposition(input, player)\r\n input = input.to_i\r\n cells[input -1] = player.token\r\n end", "def move\n\t\tcase @car.orientation\n\t\t\twhen 0 \n\t\t\t\t@car.y += 1\n\t\t\twhen 2\n\t\t\t\t@car.y -= 1\n\t\t\twhen 1\n\t\t\t\t@car.x += 1\n\t\t\twhen 3\n\t\t\t\t@car.x -= 1\n\t\tend\n\tend", "def test_can_not_move_east\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :EAST, 5, 2)\n\n assert_equal(:EAST, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(5, 2))\n\n @robot.move\n assert_equal(5, @robot.x, \"X position should be 5 (not changed)\")\n assert_equal(2, @robot.y, \"Y position should be 2 (not changed)\")\n assert_equal(:EAST, @robot.direction, \"Direction should be :EAST (not changed)\")\n assert_equal(\"P\", @robot.get_path_value(5, 2))\n end", "def move\n case @current_rotation\n when ToyEnums::NORTH\n @position_y +=1\n when ToyEnums::SOUTH\n @position_y -=1\n when ToyEnums::EAST\n @position_x +=1\n when ToyEnums::WEST\n @position_x -=1\n else\n\n end\n end", "def up(robot, robot_positions)\n move_vertical(robot, robot_positions, :up)\n end", "def move(args)\n return if !@is_robot_availabe\n case @direction\n when \"NORTH\"\n if @pos_y + STEP <= TABLE_Y\n @pos_y += STEP\n return\n end\n \n when \"EAST\"\n if @pos_x + STEP <= TABLE_X\n @pos_x += STEP\n return\n end\n \n when \"SOUTH\"\n if @pos_y - STEP >= 0\n @pos_y -= STEP\n return\n end\n \n when \"WEST\"\n if @pos_x - STEP >= 0\n @pos_x -= STEP\n return\n end\n \n end\n puts \"Warning: Robot cannot move towards #{@direction} anymore. \"\n # return \"MOVE\" #for test\n end", "def update_move_arch\n update_zvect\n self.y -= (Math::sin(@index/@div.to_f)*@high/8) \n end", "def update\n @loc += vel\n end", "def move()\n case @mov_dir\n when :right\n if @coord_x == @max_x\n @max_x += 1 # Moving out of bounds. No need to do anything because Ruby rocks! :P\n end\n @coord_x += 1\n \n when :up\n if @coord_y == 0\n @map.unshift [] # Moving out of bounds. Adds a new line to the top\n @max_y += 1\n else\n @coord_y -= 1\n end\n \n when :down\n if @coord_y == @max_y\n @max_y += 1\n @map.push [] # Moving out of bounds. Adds a new line to the bottom\n end\n @coord_y += 1\n \n when :left\n if @coord_x == 0\n @map.each do |a| # Moving out of bounds. Adds a new line to the left\n a.unshift ' ' \n end\n @max_x += 1\n else\n @coord_x -= 1\n end\n end\n end", "def moveto(x, y)\n super\n center(x, y)\n make_encounter_count\n vehicle.refresh if vehicle\n @followers.synchronize(x, y, direction)\n end", "def moving!\n end", "def move_y(val)\n update(val, x)\n apply_pos\n end", "def move(direction)\n \n end", "def move; end", "def move; end", "def move\n case @direction\n when \"N\"\n @coord_y += 1\n when \"S\"\n @coord_y -= 1\n when \"E\"\n @coord_x += 1\n else\n @coord_x -= 1\n end #end of case\nend", "def move_home_y\n @axis_y.move_home()\n @axis_y.disable_motor()\n end", "def move_robot_forward details\r\n\tif(details.f == 1 and details.y<5)\r\n\t\tdetails.y += 1\r\n\telsif(details.f == 2 and details.x<5)\r\n\t\tdetails.x += 1\r\n\telsif(details.f == 3 and details.y>0)\r\n\t\tdetails.y -= 1\r\n\telsif(details.f == 4 and details.x>0)\r\n\t\tdetails.x -= 1\r\n\telse\r\n\t\tprint(\"\\nRobot will fall off the table. Aborting movement.\")\r\n\tend\r\n\tdetails\r\nend", "def move_down(window)\n\t\t# if the horse isn't yet at the bottom of the screen move it down 20\n\t\tif @y < window.height - @image.height\n\t\t\t@y = @y +20\n\t\tend\n\tend", "def moveTo x, y\n\n\tend", "def move(delta)\n new_x = self.location.x + (self.vel.x * delta)\n new_y = self.location.y + (self.vel.y * delta)\n new_point = Point.new(new_x, new_y)\n self.with_location(new_point)\n end", "def move(forward)\n if @direction == \"N\"\n if @y + 1 < @@ymax\n @y += 1\n else\n puts \"Nice try sucker\"\n end\n elsif @direction == \"S\"\n if @y - 1 > @@ymin\n @y -= 1\n else\n puts \"Nice try sucker\"\n end\n elsif @direction ==\"E\"\n if @x + 1 < @@xmax\n @x += 1\n else\n puts \"Nice try sucker\"\n end\n elsif @direction == \"W\"\n if @x - 1 > @@xmin\n @x -= 1\n else\n puts \"Nice try sucker\"\n end\n else\n puts \"Where in the world are you?\"\n end\nend", "def move\n if @placed\n position = @face.move(@x, @y)\n x = position[0]\n y = position[1]\n if @table.validate(x, y)\n @x = x\n @y = y\n end\n end\n end", "def move(x, y)\n ConsoleGlitter.escape(\"#{y};#{x}H\")\n end", "def kick_wall(wall)\n wall.moveTo(@new_x, @new_y)\n #or wall.moveTo(:direction)\n end", "def move\n @x += @vel_x\n @y += @vel_y\n @spin += @vel_spin\n end" ]
[ "0.64822805", "0.6401371", "0.6248239", "0.624367", "0.6123787", "0.6019974", "0.59909135", "0.5954613", "0.5932502", "0.59165704", "0.59119767", "0.5907792", "0.5901807", "0.5766312", "0.5715978", "0.570548", "0.5704298", "0.5703543", "0.56974417", "0.56637496", "0.56380445", "0.56265384", "0.562463", "0.56174344", "0.5600029", "0.5598737", "0.55942047", "0.55484134", "0.5542183", "0.5541226", "0.55283004", "0.5515725", "0.550667", "0.55008584", "0.54960495", "0.5495973", "0.54743856", "0.54715353", "0.5471454", "0.54588836", "0.54533094", "0.5449786", "0.5443594", "0.544204", "0.54330885", "0.5429347", "0.5424865", "0.54221195", "0.54194945", "0.54165506", "0.54113", "0.54113", "0.54113", "0.54097646", "0.53891295", "0.53793174", "0.53751254", "0.5374789", "0.5363723", "0.53625154", "0.5359496", "0.5348528", "0.5348528", "0.5342087", "0.53369117", "0.5323464", "0.5322008", "0.5318998", "0.5317032", "0.53144795", "0.53128827", "0.529528", "0.529174", "0.52869004", "0.5285922", "0.5285721", "0.5280884", "0.5279426", "0.5277378", "0.52713597", "0.5260721", "0.5260495", "0.52598083", "0.525726", "0.52546746", "0.5252325", "0.52413607", "0.5239456", "0.5239456", "0.52383745", "0.5221143", "0.5220127", "0.52117294", "0.5208362", "0.5207484", "0.5203781", "0.52029425", "0.5202492", "0.5195531", "0.51926416" ]
0.6347748
2
Inputs a new horizontal location for the head of the snake in order to simulate horizontal movement.
def update_head_horizontal_location(column) locate_head[1] = column end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_snake_head(position, move_over_tunnel)\n snake_part = SnakePart.new(@head)\n @world[@head] = snake_part\n @head = position\n @world[position] = SnakeHead.new(position)\n\t\t\t@world[position].set_over_tunnel(move_over_tunnel)\n @body.unshift @head\n end", "def drive_north(direction)\n if direction == 'N'\n @new_vertical_position = take_input[3].to_i\n @new_vertical_position += 1\n @current_position = \"#{take_input[2].to_i},#{@new_vertical_position}\"\n end\n end", "def drive_west(direction)\n if direction == 'W'\n @new_horizontal_position = take_input[2].to_i\n @new_horizontal_position -= 1\n @current_position = \"#{@new_horizontal_position},#{take_input[3].to_i}\"\n end\n end", "def move\n # removing first element from the snake body\n unless @is_growing\n # list.shift removes the first element within a list\n @positions.shift\n end\n # after growing, snake should stop growing, it grows one at a time\n @is_growing = false\n # reading direction\n case @direction\n when 'down'\n # push insert an element in last position of the list\n # adding one to y in snake head\n @positions.push([head[0],\n (head[1] + 1) % GRID_HEIGHT])\n when 'up'\n @positions.push([head[0],\n (head[1] - 1) % GRID_HEIGHT])\n when 'left'\n @positions.push([(head[0] - 1) % GRID_WIDTH,\n head[1]])\n when 'right'\n @positions.push([(head[0] + 1) % GRID_WIDTH,\n head[1]])\n else\n puts 'error: another key inside case else'\n end\n end", "def move\n @leading_x = coordinate_array[0]\n @leading_y = coordinate_array[1]\n end", "def place(x, y, heading_symbol)\n heading = Heading.create(heading_symbol)\n valid_location = @board.safe_location(x, y)\n if valid_location && heading\n @state.unshift(Robot.new(x,y,heading))\n else\n puts \"Invalid heading: #{heading}\" if heading.nil?\n puts \"Invalid location: (#{x}, #{y}). Must be between (0, 0) and (#{@width}, #{@height})\" unless valid_location\n end\n self\n end", "def move\n @position.shift unless @growing\n case @direction\n when 'down'\n @position.push(new_coords(head[0], head[1] + 1))\n when 'up'\n @position.push(new_coords(head[0], head[1] - 1))\n when 'left'\n @position.push(new_coords(head[0] - 1, head[1]))\n when 'right'\n @position.push(new_coords(head[0] + 1, head[1]))\n end\n @growing = @turned = false\n end", "def move_left\n\t\t# if the horse isn;t yet at the left of of the screne move it left 20\n\t\tif @x > 0\n\t\t\t\t@x = @x -20\n\t\tend\n\tend", "def create_snake\n vertical_position = location[0]\n horizontal_position = location[1]\n @snake_matrix = Array.new(size) { |part_index| [vertical_position, horizontal_position + part_index] }\n end", "def move\n @positions.shift\n case @direction\n when 'down'\n @positions.push(new_coords(head[0], head[1] + 1))\n when 'up'\n @positions.push(new_coords(head[0], head[1] - 1))\n when 'left'\n @positions.push(new_coords(head[0] - 1, head[1]))\n when 'right'\n @positions.push(new_coords(head[0] + 1, head[1]))\n end\n end", "def move_lower\n movement { self.position += 1 }\n end", "def update_head_vertical_location(row)\n locate_head[0] = row\n end", "def home\n pen_up\n self.xy = ORIGIN\n self.heading = 0.0\n end", "def update_position!(next_move)\n table.x = next_move[:x]\n table.y = next_move[:y]\n end", "def move_west\n @x -= 1\n end", "def move_ahead\n @posx, @posy = coords_ahead\n activate\n end", "def set_left_start_point\n @leading_x = 0\n @leading_y = find_left_entry\n end", "def move_east\n @x += 1\n end", "def move\n position_after_move = @position.new_coordinates_for_step_size(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n #ignore the command if robot is being out off tabletop\n if(@table_top.has_within_bounds?(position_after_move))\n @position = @position.new_coordinates_for(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n end\n end", "def move_forward\n case @orientation\n when :north\n @position.y_coordinate += 1\n when :east\n @position.x_coordinate += 1\n when :south\n @position.y_coordinate -= 1\n when :west\n @position.x_coordinate -= 1\n end\n end", "def move_left\n # @dx = -8\n @x -= 8\n end", "def start_hmove(register_value)\n @ticks_added = 0\n @movement_required = !ticks_to_add(register_value).zero?\n end", "def move(x, y)\n ConsoleGlitter.escape(\"#{y};#{x}H\")\n end", "def test_can_move_north\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :TEST)\n\n assert_equal(:NORTH, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(0, 0))\n\n @robot.move\n assert_equal(0, @robot.x, \"X position should be 0 (not changed)\")\n assert_equal(1, @robot.y, \"Y position should be 1 (moved 1 north)\")\n assert_equal(:NORTH, @robot.direction, \"Direction should be :NORTH (not changed)\")\n assert_equal(\"M\", @robot.get_path_value(0, 1))\n end", "def move_straight(step, x)\n comp(:position).add!(x * step)\n on_move\n end", "def kick_wall(wall)\n wall.moveTo(@new_x, @new_y)\n #or wall.moveTo(:direction)\n end", "def move_up\n\t\t# if the horse isn't yet at the top of the screen move it up 20\n\t\tif @y > 0\n\t\t\t@y = @y -20\n\t\tend\n\tend", "def update_move\n self.x = screen_x\n self.y = screen_y\n update_move_arch if @type == Arched\n end", "def move\n\t\tif @direction == \"N\"\n\t\t\t@y += 1\n\t\telsif @direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif @direction == \"E\"\n\t\t\t@x += 1\n\t\telsif @direction == \"S\"\n\t\t\t@y -= 1\n\t\tend\n\tend", "def move\n\t\t# move 5px to the left\n\t @x = @x - 5\n\t # move up or down based on the Y velocity\n\t @y = @y + @vy\n\tend", "def determine_heading(new_position)\n case $track[[new_position[0], new_position[1]]]\n when \"\\\\\"\n if @direction == :right || @direction == :left\n turn_right\n else\n turn_left\n end\n when \"/\"\n if @direction == :right || @direction == :left\n turn_left\n else\n turn_right\n end\n when \"+\"\n # turn order goes left -> straight -> right\n if @last_turn_direction == :right\n @last_turn_direction = :left\n turn_left\n elsif @last_turn_direction == :left\n @last_turn_direction = :straight\n # no turn necessary\n else # last turn was straight\n @last_turn_direction = :right\n turn_right\n end\n end\n end", "def move(forward)\n if @direction == \"N\"\n if @y + 1 < @@ymax\n @y += 1\n else\n puts \"Nice try sucker\"\n end\n elsif @direction == \"S\"\n if @y - 1 > @@ymin\n @y -= 1\n else\n puts \"Nice try sucker\"\n end\n elsif @direction ==\"E\"\n if @x + 1 < @@xmax\n @x += 1\n else\n puts \"Nice try sucker\"\n end\n elsif @direction == \"W\"\n if @x - 1 > @@xmin\n @x -= 1\n else\n puts \"Nice try sucker\"\n end\n else\n puts \"Where in the world are you?\"\n end\nend", "def moveLeft(dist)\n @body.p.x -= dist\n end", "def move(io_h)\n if io_h[:left]\n @x -= 10\n end\n if io_h[:right]\n @x += 10\n end\n if io_h[:up]\n @y -= 10\n end\n if io_h[:down]\n @y += 10\n end\n \n @x %= 640\n @y %= 480\n end", "def locate_head\n snake_matrix.first\n end", "def move\n case @direction\n when \"N\" then @y += 1 unless @y + 1 > @plateau.y || @@rover_locations.values.include?([@x, @y + 1])\n when \"E\" then @x += 1 unless @x + 1 > @plateau.x || @@rover_locations.values.include?([@x + 1, @y])\n when \"S\" then @y -= 1 unless @y - 1 < 0 || @@rover_locations.values.include?([@x, @y -1])\n when \"W\" then @x -= 1 unless @x - 1 < 0 || @@rover_locations.values.include?([@x -1, @x])\n end\n @@rover_locations[@id.to_sym] = [@x, @y]\n end", "def move\n case @direction\n when \"n\"\n @y_axis += 1\n when \"e\"\n @x_axis += 1\n when \"s\"\n @y_axis -= 1\n when \"w\"\n @x_axis -= 1\n end\n end", "def move\n @x = (@x + @x_velocity) % Window.width\n @y = (@y + @y_velocity) % Window.height\nend", "def move\n case @direction\n when \"N\"\n @y_coord += 1\n when \"S\"\n @y_coord -= 1\n when \"W\"\n @x_coord += 1\n when \"E\"\n @x_coord -= 1\n end\n end", "def turn_left\n case @heading\n when 'W' then @heading = 'S'\n when 'E' then @heading = 'N'\n when 'N' then @heading = 'W'\n when 'S' then @heading = 'E'\n end\n end", "def advance_position\n case @direction\n when :up\n new_position = [@position[0], @position[1] - 1]\n determine_heading(new_position)\n @position = new_position\n when :down\n new_position = [@position[0], @position[1] + 1]\n determine_heading(new_position)\n @position = new_position\n when :left\n new_position = [@position[0] - 1, @position[1]]\n determine_heading(new_position)\n @position = new_position\n when :right\n new_position = [@position[0] + 1, @position[1]]\n determine_heading(new_position)\n @position = new_position\n end\n @position\n end", "def move_left\n\t\tmove([-1,0])\n\tend", "def move_left\n left_tile = C[@location.first, @location.second - 1]\n move_to(left_tile)\n end", "def start_movement\n end", "def drive_east(direction)\n if direction == 'E'\n @new_horizontal_position = take_input[2].to_i\n @new_horizontal_position += 1\n @current_position = \"#{@new_horizontal_position},#{take_input[3].to_i}\"\n end\n end", "def move\n case self.direction\n when 'NORTH'\n self.y += 1 unless self.y == @table.y\n when 'EAST'\n self.x += 1 unless self.x == @table.x\n when 'SOUTH'\n self.y -= 1 unless self.y == 0\n when 'WEST'\n self.x -= 1 unless self.x == 0\n end\n end", "def interpret_move(command)\n ensure_placed\n @robot.move_forward\n end", "def move_left\n left_tile = Couple.new(@location.first, @location.second - 1)\n move_to(left_tile)\n end", "def how_to_move_a_sprite args\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: 42,\n y: 46, text: \"Use Arrow Keys\",\n alignment_enum: 1)\n\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: 42,\n y: 41, text: \"Or WASD\",\n alignment_enum: 1)\n\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: 42,\n y: 36, text: \"Or Click\",\n alignment_enum: 1)\n\n # set the initial values for x and y using ||= (\"or equal operator\")\n args.state.ship.x ||= 0\n args.state.ship.y ||= 0\n\n # if a mouse click occurs, update the ship's x and y to be the location of the click\n if args.nokia.mouse_click\n args.state.ship.x = args.nokia.mouse_click.x\n args.state.ship.y = args.nokia.mouse_click.y\n end\n\n # if a or left arrow is pressed/held, decrement the ships x position\n if args.nokia.keyboard.left\n args.state.ship.x -= 1\n end\n\n # if d or right arrow is pressed/held, increment the ships x position\n if args.nokia.keyboard.right\n args.state.ship.x += 1\n end\n\n # if s or down arrow is pressed/held, decrement the ships y position\n if args.nokia.keyboard.down\n args.state.ship.y -= 1\n end\n\n # if w or up arrow is pressed/held, increment the ships y position\n if args.nokia.keyboard.up\n args.state.ship.y += 1\n end\n\n # render the sprite to the screen using the position stored in args.state.ship\n args.nokia.sprites << {\n x: args.state.ship.x,\n y: args.state.ship.y,\n w: 5,\n h: 5,\n path: 'sprites/monochrome-ship.png',\n # parameters beyond this point are optional\n angle: 0, # Note: rotation angle is denoted in degrees NOT radians\n r: 255,\n g: 255,\n b: 255,\n a: 255\n }\nend", "def horizontals_push\n @htop += 1\n end", "def move_horizontally(move_x)\n if move_x > 0\n @dir = :right\n move_x.times { @x += 1 }\n end\n if move_x < 0\n @dir = :left\n (-move_x).times { @x -= 1 }\n end\n end", "def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end", "def move(direction, grow = false)\n\n # Move head and body\n case direction\n when 'N'\n new_position = { x: position[0][:x], y: (position[0][:y] - 1) }\n when 'S'\n new_position = { x: position[0][:x], y: (position[0][:y] + 1) }\n when 'E'\n new_position = { x: (position[0][:x] + 1), y: position[0][:y] }\n when 'W'\n new_position = { x: (position[0][:x] - 1), y: position[0][:y] }\n else\n raise Exception, 'Incorrect direction for move'\n end\n\n # Prevent snek to move to itself. But snek can move to it's tail if it isn't grow AND snek longer than 2 cells\n (0..(position.length - 2)).each do |i|\n if position[i][:x] == new_position[:x] && position[i][:y] == new_position[:y]\n raise Exception, 'Snek tries to go to itself'\n end\n end\n\n # Can't eat self tail\n if grow && position.last[:x] == new_position[:x] && position.last[:y] == new_position[:y]\n raise Exception, 'Snek tries to go to its tail'\n end\n\n # Add new position of the head\n @position.unshift new_position\n\n # If not grow, pull tail forward (otherwise leave it at place, because of growth)\n unless grow\n @position.pop\n end\n\n Rails.logger.info \"Move: snek ##{@snek.id}. Length: #{@position.length}. Grow: #{grow}\"\n\n nil\n end", "def move\n\t\t@x += 0\n\t\t@y += @vel\n\tend", "def test_can_move_west\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :WEST, 5, 5)\n\n assert_equal(:WEST, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(5, 5))\n\n @robot.move\n assert_equal(4, @robot.x, \"X position should be 4 (moved 1 east)\")\n assert_equal(5, @robot.y, \"Y position should be 5 (not changed)\")\n assert_equal(:WEST, @robot.direction, \"Direction should be :WEST (not changed)\")\n assert_equal(\"M\", @robot.get_path_value(4, 5))\n end", "def go_ahead(steps,width=1)\n x0 = @pos.x\n y0 = @pos.y\n x1 = (@pos.x + steps*Math.cos(@angle)).round()\n y1 = (@pos.y - steps*Math.sin(@angle)).round()\n if (@down)\n animiere(3) {\n TkcLine.new( Leinwand.gib_einzige_instanz(),x0,y0,x1,y1,:fill => :black, :width => [1,width] .max()) }\n end\n @pos = Point.new(x1,y1)\n end", "def step\n newHead = [head.first,head.last]\n case direction\n when :left\n newHead[1] -= 1\n when :right\n newHead[1] += 1\n when :up\n newHead[0] -= 1\n when :down\n newHead[0] += 1\n end\n parts.unshift(newHead)\n parts.pop\n end", "def move_to(x, y); end", "def interpret_left(command)\n ensure_placed\n @robot.rotate_left\n end", "def move_lower_left\n unless @direction_fix\n @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)\n end\n if (passable?(@x, @y, 2) && passable?(@x, @y + 1, 4)) ||\n (passable?(@x, @y, 4) && passable?(@x - 1, @y, 2)) # 8 a la place de 2 sur les deux lignes\n move_follower_to_character\n @x -= 1\n @y += 1\n if @follower && $game_variables[Yuki::Var::FM_Sel_Foll] == 0\n @memorized_move = :move_lower_left\n @follower.direction = @direction\n end\n movement_process_end(true)\n increase_steps\n end\n end", "def make_move(x, y, player)\n\n\tp = tokenize(player)\n\tcase y\n\twhen 1\n\t\trow = $row3\n\twhen 2\n\t\trow = $row2\n\twhen 3\n\t\trow = $row1\n\tend \n\n\ttarget = row[x-1] if x == 1\n\ttarget = row[x] if x == 2\n\ttarget = row[x+1] if x == 3\n\n\tif target != \" \"\n\t\traise NoMethodError\n\telse \n\t\tputs \"#{$current_player} moved to (#{x},#{y})!\"\n\t\trow[x-1] = p if x == 1\n\t\trow[x] = p if x == 2\n\t\trow[x+1] = p if x == 3\n\t\tprint_board\n\tend \nend", "def player_move\n puts \"ENTER YOUR SHOSEN LOCATION BETWEEN 1..9\"\n @position = gets.chomp.to_i\n end", "def move_position\n @x += @velocity_x\n @y += @velocity_y\n end", "def place\n next_move = {x: command.arguments[:x], y: command.arguments[:y]}\n if inside_table?(next_move_x_y(next_move, false))\n update_position!(next_move_x_y(next_move, false))\n update_direction!\n else\n almost_die\n end\n end", "def forward_move\n case @facing\n when 'NORTH'\n @y += 1\n when 'SOUTH'\n @y -= 1\n when 'EAST'\n @x += 1\n when 'WEST'\n @x -= 1\n end\n self\n end", "def move(forward)\n moves = [0, forward ? 1 : -1]\n moves.reverse! if @hor\n new_coord = @coord.add(moves + moves)\n set!(new_coord[0], new_coord[1], @hor)\n end", "def walk\n case @direction\n when 'N'\n @y += 1\n when 'W'\n @x += 1\n when 'S'\n @y -= 1\n when 'E'\n @x -= 1\n end\n end", "def move_forward\n\t\tnew_position = forward_position\n\t\t@x = new_position[0]\n\t\t@y = new_position[1]\n\tend", "def update_snake_direction\n if Gosu.button_down?(Gosu::KB_RIGHT) && @snake.direction != \"left\"\n @snake.direction = \"right\"\n elsif Gosu.button_down?(Gosu::KB_DOWN) && @snake.direction != \"up\"\n @snake.direction = \"down\"\n elsif Gosu.button_down?(Gosu::KB_LEFT) && @snake.direction != \"right\"\n @snake.direction = \"left\"\n elsif Gosu.button_down?(Gosu::KB_UP) && @snake.direction != \"down\"\n @snake.direction = \"up\"\n end\n end", "def exec_head(cmds)\n @tape.move(cmds[:head]) if cmds[:head]\n end", "def move\n case @facing\n when \"north\"\n @posY += 1 if @posY+1 < @table.width\n when \"east\"\n @posX += 1 if @posX+1 < @table.height\n when \"south\"\n @posY -= 1 if @posY-1 >= 0\n when \"west\"\n @posX -= 1 if @posX-1 >= 0\n end\n end", "def move # takes (x, y, direction) from Rover\n\t\tif direction == \"N\"\n\t\t\t@y += 1\n\t\telsif direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif direction == \"S\"\n\t\t\t@y -= 1\n\t\telsif direction == \"E\"\n\t\t\t@x += 1\n\t\telse \n\t\t\treturn \"The input direction enterned is wrong\"\n\t\tend\n\tend", "def move_robot_forward details\r\n\tif(details.f == 1 and details.y<5)\r\n\t\tdetails.y += 1\r\n\telsif(details.f == 2 and details.x<5)\r\n\t\tdetails.x += 1\r\n\telsif(details.f == 3 and details.y>0)\r\n\t\tdetails.y -= 1\r\n\telsif(details.f == 4 and details.x>0)\r\n\t\tdetails.x -= 1\r\n\telse\r\n\t\tprint(\"\\nRobot will fall off the table. Aborting movement.\")\r\n\tend\r\n\tdetails\r\nend", "def reflect_horizontal\r\n self.v[:x] = -self.v[:x]\r\n end", "def move\n case @rover_facing\n when 'N'\n @coordinates[1] += 1\n when 'E'\n @coordinates[0] += 1\n when 'S'\n @coordinates[1] -= 1\n when 'W'\n @coordinates[0] -= 1\n end\n end", "def move_home_x\n @axis_x.move_home()\n @axis_x.disable_motor()\n end", "def move\n @tail = @location\n closest_food = detect_closest_food\n @location = calculate_next_location(closest_food)\n\n end", "def move\n \n end", "def move\n \n end", "def move(player, x, y)\n\n end", "def execute\n return unless @robot.placed?\n\n original_position = @robot.position\n new_position = original_position.dup\n new_position.move\n\n @robot.position = new_position if @table.position_valid?(new_position)\n end", "def move\n if @direction.north? then @y += 1\n elsif @direction.south? then @y -= 1\n elsif @direction.east? then @x += 1\n elsif @direction.west? then @x -= 1\n end\n return self\n end", "def moving!\n end", "def test_left_wrap\n rover = MarsRover.new(0,0,'N', world=World.new(5,5))\n rover.command('LF')\n assert_equal([4,0,'W'], rover.position)\n end", "def moveLeft\n if @x > 1\n call Screen.setColor(false)\n call Screen.drawRectangle((@x + @size) - 1, @y, @x + @size, @y + @size)\n let @x = @x - 2\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, @y, @x + 1, @y + @size)\n end\n end", "def moveLeft(distance)\n @x = @x - distance\n @image.x = @x\n end", "def moveLeft(distance)\n @x = @x - distance\n @image.x = @x\n end", "def place_horizontal(symbol, length)\n\t\tx = Random.rand(10 - length)\n\t\ty = Random.rand(10)\n\t\tcoords = []\n\t\t(0..length-1).each do |offset|\n\t\t\tx_offset = x + offset\n\t\t\tif !@grid[x_offset][y].nil?\n\t\t\t\treturn false\n\t\t\telse\n\t\t\t\tcoords << [x_offset, y]\n\t\t\tend\n\t\tend\n\t\tcoords.each do |c|\n\t\t\t@grid[c[0]][c[1]] = symbol\n\t\tend\n\t\treturn true\n\tend", "def move(direction)\n @old = @pos\n @pos += direction\n end", "def cursor_to_input_line\n setpos(input_line, 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 move\n case @direction\n when \"N\"\n @coord_y += 1\n when \"S\"\n @coord_y -= 1\n when \"E\"\n @coord_x += 1\n else\n @coord_x -= 1\n end #end of case\nend", "def draw_horizontal(line, start_char, end_char)\n start_char.upto(end_char) { |char_idx| @lines[line][char_idx] = PATH_CHAR } \n end", "def move\n\t\treturn \"INVALID COMMANDS, YOU CAN NOT MAKE THE ROBOT FALL OFF THE TABLE\" unless is_valid_move?\n\t\tcase @direction\n\t\twhen \"east\"\n\t\t\t@x_coordinate += 1\n\t\twhen \"west\"\n\t\t\t@x_coordinate -= 1\n\t\twhen \"south\"\n\t\t\t@y_coordinate -= 1\n\t\twhen \"north\"\n\t\t\t@y_coordinate += 1\n\t\telse\n\t\tend\n\t\ttrue\n\tend", "def move\n if @placed\n position = @face.move(@x, @y)\n x = position[0]\n y = position[1]\n if @table.validate(x, y)\n @x = x\n @y = y\n end\n end\n end", "def move(y, x)\n update(y, x)\n apply_pos\n end", "def move_home_x\n Status.current.info_target_x = 0\n @ramps_arduino.execute_command('F11', true, false)\n end", "def move(direction)\n \n end", "def move_party_horn\n\t\tif face_left?\n\t\t\t@party_horn.x = @x + \n\t\t\t\t\t\t\t(TILE_WIDTH/4 - PartyHorn::PARTY_HORN_TILE_WIDTH)\n\t\telse\n\t\t\t@party_horn.x = @x + 3 * TILE_WIDTH/4\n\t\tend\n\t\t@party_horn.y = @y + 3 * TILE_HEIGHT/5\n\t\t@party_horn.angle = @angle\n\tend", "def player_move\n\t \tvalid_move = false\n\t \twhile !valid_move\n\t \t\tdisplay_game\n\t \t\trow_choice = 0\n\t \t\tstick_choice = 0\n\t\t # get the user selections\n\t\t valid_input = false\n\t\t puts \"Enter the row (1-#{@current_config.length}): \"\n\t\t row_choice = gets.chomp.to_i - 1\n\t\t puts \"Enter the number of sticks (1-#{@current_config[row_choice]}): \"\n\t\t stick_choice = gets.chomp.to_i \n\t\t valid_move = validate_move row_choice, stick_choice, true # validate selections\n\t \tend\n\tend" ]
[ "0.6946604", "0.6375601", "0.6283084", "0.62432504", "0.6208301", "0.61988574", "0.60296035", "0.597656", "0.59712136", "0.5886565", "0.5885008", "0.58384776", "0.5766133", "0.57548666", "0.5736572", "0.573319", "0.5715742", "0.5711953", "0.57048", "0.5672593", "0.5661368", "0.5649081", "0.5628138", "0.56112766", "0.56078327", "0.56073886", "0.56068707", "0.56019264", "0.5595513", "0.5583445", "0.5569962", "0.55569017", "0.5544576", "0.5542626", "0.5518508", "0.5501675", "0.55002433", "0.5499203", "0.5496709", "0.5482285", "0.548018", "0.5480095", "0.5476706", "0.54645336", "0.5429203", "0.54224306", "0.5420391", "0.54181904", "0.5382797", "0.53801286", "0.5378568", "0.5377821", "0.5375462", "0.5370739", "0.5365821", "0.5355465", "0.53552806", "0.53519344", "0.534158", "0.53302956", "0.53275543", "0.5325462", "0.53224283", "0.53209233", "0.5318283", "0.531679", "0.53020906", "0.5299132", "0.5294821", "0.5291005", "0.5290933", "0.5286565", "0.52857053", "0.52784157", "0.52756274", "0.5275128", "0.52716166", "0.52701247", "0.52701247", "0.5268006", "0.52490413", "0.5239688", "0.52378255", "0.5236897", "0.5234095", "0.52071077", "0.52071077", "0.52001333", "0.51934075", "0.5191885", "0.5191704", "0.5188358", "0.5186176", "0.5183623", "0.51824135", "0.51797247", "0.5177461", "0.5176045", "0.5173914", "0.5173583" ]
0.65042645
1
The print_filled_field method first creates an empty field and then adds a snake matrix and an apple to that empty field matrix and prints the result.
def print_filled_field field.create_empty_field # Add an apple to the field. field.field_matrix[apple.vertical_location][apple.horizontal_location] = ' o ' # Add a snake to the field. snake.snake_matrix.each do |part| field.field_matrix[part.first][part.last] = ' x ' end print_field end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_empty_field\n @field_matrix = Array.new(length) { Array.new(width, ' . ') }\n end", "def printBoard\n\t\tprint(\"#{@field[0].value} | #{@field[1].value} | #{@field[2].value}\\n---------\\n#{@field[3].value} | #{@field[4].value} | #{@field[5].value}\\n---------\\n#{@field[6].value} | #{@field[7].value} | #{@field[8].value}\")\n\tend", "def draw\n\t\tfield.each do |arr|\n\t\t\tarr.each { |i| print \" #{i} \".black.bg_cyan }\n\t\t\tputs\n\t\tend\n\tend", "def draw_game_field\n\t\tsystem 'clear'\n\t\tputs \"My field:\".green.bold\n\t\t@human.field.draw\n\t\tputs \"\\nComputer's moves:\".blue.bold\n\t\t@computer.draw_opponent_field_map\n\t\tputs \"\\nMy moves:\".blue.bold\n\t\t@human.draw_opponent_field_map\n\tend", "def displayemptyframe\r\n\t\t\t@matrix = []\r\n\t\t\t@matrix[0] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[1] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[2] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[3] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[4] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[5] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\ttitle = \" 1 2 3 4 5 6 7 \"\r\n\t\t\trowdivider = \"+-+-+-+-+-+-+-+\"\r\n\t\t\trowempty = \"|_|_|_|_|_|_|_|\"\r\n\t\t\t@output.puts(\"#{title}\")\r\n\t\t\t@output.puts(\"#{rowdivider}\")\r\n\t\t\t\r\n\t\t\tfor i in 1..6\r\n\t\t\t\t@output.puts(\"#{rowempty}\")\r\n\t\t\tend\r\n\t\tend", "def start\n fill_field\n output\n end", "def fill_field\n SHIPS.each { |size| put_ship(size) }\n end", "def generate_empty_board\n puts \" 1 2 3\"\n puts \" A #{a1 = ' '} | #{a2 = ' ' } | #{a3 = ' '} \"\n puts separator = \" \"*4 + \"─\"*11\n puts \" B #{b1 = ' '} | #{b2 = ' '} | #{b3 = ' '} \"\n puts separator\n puts \" C #{c1 = ' '} | #{c2 = ' '} | #{c3 = ' '} \"\n end", "def build_minefield\n @field = []\n @row_count.times do\n row = []\n @column_count.times do\n row << Cell.new\n end\n @field << row\n end\n end", "def display_dummy\n\t\tdummy_board = Array.new(3) {Array.new(3)}\n\t\tputs \"\\n\"\n\t\tputs \" 1 | 2 | 3 \"\n\t\tputs \"-----------\"\n\t\tputs \" 4 | 5 | 6 \"\n\t\tputs \"-----------\"\n\t\tputs \" 7 | 8 | 9 \"\n\t\tputs \"\\n\"\n\tend", "def show_field( name, val, indent )\n return if val.nil?\n return if val.respond_to?( :empty? ) && val.empty?\n puts \"#{indent}#{name} => #{val}\"\n end", "def print_game_field()\r\n\r\n i=0\r\n print \"| \"\r\n while i < 8 do\r\n\t \r\n\t print_row( i)\r\n # puts \" |\" \r\n\t#\t puts \"|---|---|---|---|---|---|---|---|\" \r\n\tputs\r\n\t \tprint \"| \" \r\n \r\n i+=1\r\n \r\n end\r\n \r\n puts \"1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |\"\t \t\r\n return true\r\n\tend", "def print\n @maze[:matrix].each do |line|\n puts line.join\n end\n end", "def print_fields\r\n\t\tputs \"name: #{@name}\"\r\n\t\tputs \"num_billcoins: #{@num_billcoins}\"\r\n\t\tputs \"\"\r\n\tend", "def show_blank(p)\r\n set_cursor p\r\n print Normal\r\n print \" \"*@disks + \"|\" + \" \"*@disks\r\n update\r\n end", "def make_blanks\r\n\t#make an array with \"_ \" pushed in the length times. Every time its printed use join method\r\n\t\t@wordlength.times do |x|\r\n\t\t\t@blanks << \"_ \"\r\n\t\tend\r\n\tend", "def clear\n @field.each_index { |i| @field[i] = 0 }\n end", "def fill_up_empty_fields\n (0..(PANELS_COUNT-1)).each do |panel_no|\n (0..(FIELD_SIZE-1)).each do |row_no|\n (0..(FIELD_SIZE-1)).each do |column_no|\n # if field is empty choose a random indeference and put it in\n if @panels.field([panel_no, row_no, column_no]).class_name.empty?\n @panels.set_field([panel_no, row_no, column_no],\n INDEFERENCES[rand(INDEFERENCES.count)])\n end\n end\n end\n end\n end", "def fill_box(box)\n\t\t@current_player.boxes_filled.push(box)\n\t\t@board_status[box] = \" #{@current_player.marker} \"\n\tend", "def show_blanks\n\t\t@result_array = \"_\"*@word_array.length\n\t\tputs @result_array\n\tend", "def show_blanks\n\t\t@result_array = \"_\"*@word_array.length\n\t\tputs @result_array\n\tend", "def print\n # Special handling: print the top line.\n line = \"+\"\n for x in (0...@width)\n line.concat(x == @start_x && @start_y == 0 ? \" +\" : \"---+\")\n end\n puts line\n \n # For each cell, print the right and bottom wall, if it exists.\n for y in (0...@height)\n if y == @start_y && @start_x == 0 then\n line = \" \"\n else\n line = \"|\"\n end\n for x in (0...@width)\n line.concat(\" \")\n line.concat(@vertical_walls[y][x] != :open ? \"|\" : \" \")\n end\n puts line\n \n line = \"+\"\n for x in (0...@width)\n line.concat(@horizontal_walls[y][x] != :open ? \"---+\" : \" +\")\n end\n puts line\n end\n end", "def printTestInput( fp )\n\t\tif @col_names then\n\t\t\t# Need a place holder (or empty field) \n\t\t\tif @has_row_names then\n\t\t\t\tfp.printf( \"%s\\t%s\", randomChoice() ? \"X\" : \"\", @col_names[0] )\n\t\t\telse\n\t\t\t\tfp.print( @col_names[0] )\n\t\t\tend\n\t\t\t@col_names.each_index do |i|\n\t\t\t\tfp.printf( \"\\t%s\", @col_names[i] ) if i > 0\n\t\t\tend\n\t\t\tfp.print( \"\\n\" )\n\t\tend\n\t\t@rows.each do |row|\n\t\t\trow.printTestInput( fp )\n\t\tend\n\tend", "def display_blank_board() \n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend", "def pad_field(*fields)\n fields.each do |field|\n unless self[field].size % 4 == 0\n self[field] << \"\\x00\" * (4 - (self[field].size % 4))\n end\n end\n end", "def put_fv_as_row(fields, field)\n max_ksize = fields.keys.map(&:size).max\n max_vsize = fields.values.map(&:size).max\n puts \"| %#{max_ksize}s | %#{max_vsize}s |\" % [field, fields[field]]\nend", "def print_board(board)\n board.rows.times do |row|\n print \"|\"\n\n board.columns.times do |column|\n piece = board.at(row, column)\n\n if piece == nil\n piece = \" \" # Display empty cells as spaces\n end\n\n print \"#{piece}|\"\n end\n\n print \"\\n\"\n end\n\nend", "def display_board\n puts \" #{@letter[0]} | #{@letter[1]} | #{@letter[2]} \"\n puts \" -------------\"\n puts \" #{@number[0]}| #{@board_array[0]} | #{@board_array[1]} | #{@board_array[2]} |\"\n puts \" |-----------|\"\n puts \" #{@number[1]}| #{@board_array[3]} | #{@board_array[4]} | #{@board_array[5]} |\"\n puts \" |-----------|\"\n puts \" #{@number[2]}| #{@board_array[6]} | #{@board_array[7]} | #{@board_array[8]} |\"\n puts \" ------------\"\n end", "def generate_field\n field_rows = []\n (Field::ROWS - 3).times do\n field_rows << Row.new\n end\n field_rows << Row.new([0,3,4,5,6])\n field_rows << Row.new([0,3,4,5,6])\n field_rows << Row.new([0,3,4,5,6])\n Field.new field_rows\n end", "def print_empty_line\n print_in_same_line(\" \")\n end", "def print_board\n horizontal_rule = \" -------------\"\n row_one = \" 1 2 3 \"\n row_two = \" a | #{@array[0][0]} | #{@array[0][1]} | #{@array[0][2]} |\"\n row_three = \" b | #{@array[1][0]} | #{@array[1][1]} | #{@array[1][2]} |\"\n row_four = \" c | #{@array[2][0]} | #{@array[2][1]} | #{@array[2][2]} |\"\n \n print row_one + \"\\n\", row_two + \"\\n\", horizontal_rule + \"\\n\", \n row_three + \"\\n\", horizontal_rule + \"\\n\", row_four + \"\\n\"\n end", "def display\n puts \"+-------------------+\"\n\n for row in 0..BOARD_MAX_INDEX\n print '|'\n for col in 0..BOARD_MAX_INDEX\n s=@board[row][col]\n if s==EMPTY_POS\n print col+(row*3)+1\n else\n print s\n end\n print \"|\"\n end\n puts \"\"\n end\n print \"\\n+--------------+\"\n\n end", "def print_board\n\t\tputs \"**********************************\"\n\t\tputs \"| ♔ ♚ ♕ ♛ ♖ ♜ ♗ ♝ ♘ ♞ ♙ ♟ |\"\n\t\tputs \"| Actual board |\"\n\t\tputs \"| ♔ ♚ ♕ ♛ ♖ ♜ ♗ ♝ ♘ ♞ ♙ ♟ |\"\n\t\tputs \"**********************************\"\n\t\t@board.each_index do |i|\n\t\t\t@board[i].each_index do |y|\n\t\t\t\tif y == 0\n\t\t\t\t\tprint 8 - i\n\t\t\t\tend\n\n\t\t\t\tif @board[i][y] == nil\n\t\t\t\t\tprint \"#{@board[i][y]} --\"\n\t\t\t\telse\n\t\t\t\t\tprint \" #{@board[i][y].piecename}\"\n\t\t\t\tend\n\n\t\t\tend\n\t\t\tputs \"\\n\"\n\t\tend\n\t\tputs \" a b c d e f g h\"\n\t\tputs \"\\n\\n\\n\\n\"\n\tend", "def print_fields\r\n\t\tputs \"from_address: #{@from_address}\"\r\n\t\tputs \"to_address: #{@to_address}\"\r\n\t\tputs \"num_billcoins: #{@num_billcoins}\"\r\n\t\tputs \"\"\r\n\tend", "def clear\n @my_field.set!(@len, @coord[0], @coord[1], @hor)\n end", "def print_fields(field_array)\n\tfield_array.each do |el|\n\t\tif el.is_a?(Nokogiri::XML::Comment)\n\t\t\tputs '-' * 80\n\t\t\tputs el\n\t\tend\n\t\tif el.is_a?(Nokogiri::XML::Element)\n\t\t\tputs el.attributes['name'].value\n\t\t\tputs 'Optional' if el.attributes['nillable']\n\t\tend\n\tend\nend", "def print\n # Special handling: print the top line.\n line = '#'\n for x in (0...@width)\n line.concat(x == @start_x ? ' #' : '####')\n end\n puts line\n\n # For each cell, print the right and bottom wall, if it exists.\n for y in (0...@height)\n line = '#'\n for x in (0...@width)\n line.concat(@path[y][x] ? \" o \" : \" \")\n line.concat(@vertical_walls[y][x] ? '#' : \" \")\n end\n puts line\n\n line = '#'\n for x in (0...@width)\n line.concat(@horizontal_walls[y][x] ? '####' : ' #')\n end\n puts line\n end\n end", "def drawBoard() \n #1. prepare the default board\n @height.times do |y|\n @width.times do |x|\n print EMPTY_MARKER\n end\n puts\n end\t\n @squares = []\n @width.times do |x|\n column = []\n @height.times do |y|\n column << EMPTY_MARKER\n end\n @squares << column\n end\t\n # 2. fill the mine marker\n @mines.each do |mine|\n x,y = mine\n @squares[x][y] = MINE_MARKER\n end\t\t\n #puts @squares;\n\n end", "def fill\n \t@fill\n end", "def clear(row, col)\n if !@field[row][col].contains_mine?\n @field[row][col].reveal!\n if row == 0 && col == 0\n if !@field[row][col + 1].contains_mine? && !@field[row + 1][col].contains_mine? && !@field[row + 1][col + 1].contains_mine?\n @field[row][col + 1].reveal!\n @field[row + 1][col].reveal!\n @field[row + 1][col + 1].reveal!\n end\n elsif row == 0 && col == @column_count - 1\n if !@field[row][col - 1].contains_mine? && !@field[row + 1][col - 1].contains_mine? && !@field[row + 1][col].contains_mine? &&\n @field[row][col - 1].reveal!\n @field[row + 1][col - 1].reveal!\n @field[row + 1][col].reveal!\n end\n elsif row == @row_count - 1 && col == 0\n if !@field[row][col + 1].contains_mine? && !@field[row - 1][col + 1].contains_mine? && !@field[row - 1][col].contains_mine? &&\n @field[row][col + 1].reveal!\n @field[row - 1][col + 1].reveal!\n @field[row - 1][col].reveal!\n end\n elsif row == @row_count - 1 && col == @column_count - 1\n if !@field[row][col - 1].contains_mine? && !@field[row - 1][col - 1].contains_mine? && !@field[row - 1][col].contains_mine? &&\n @field[row][col - 1].reveal!\n @field[row - 1][col - 1].reveal!\n @field[row - 1][col].reveal!\n end\n elsif row == 0\n if !@field[row][col - 1].contains_mine? && !@field[row][col + 1].contains_mine? && !@field[row + 1][col - 1].contains_mine? && !@field[row + 1][col].contains_mine? && !@field[row + 1][col + 1].contains_mine? &&\n @field[row][col - 1].reveal!\n @field[row][col + 1].reveal!\n @field[row + 1][col - 1].reveal!\n @field[row + 1][col].reveal!\n @field[row + 1][col + 1].reveal!\n end\n elsif col == 0\n if !@field[row - 1][col].contains_mine? && !@field[row - 1][col + 1].contains_mine? && !@field[row][col + 1].contains_mine? && !@field[row - 1][col].contains_mine? && !@field[row - 1][col + 1].contains_mine? &&\n @field[row - 1][col].reveal!\n @field[row - 1][col + 1].reveal!\n @field[row][col + 1].reveal!\n @field[row - 1][col].reveal!\n @field[row - 1][col + 1].reveal!\n end\n elsif row == @row_count - 1\n if !@field[row][col - 1].contains_mine? && !@field[row][col + 1].contains_mine? && !@field[row - 1][col - 1].contains_mine? && !@field[row - 1][col].contains_mine? && !@field[row - 1][col + 1].contains_mine? &&\n @field[row][col - 1].reveal!\n @field[row][col + 1].reveal!\n @field[row - 1][col - 1].reveal!\n @field[row - 1][col].reveal!\n @field[row - 1][col + 1].reveal!\n end\n elsif col == @column_count - 1\n if !@field[row - 1][col].contains_mine? && !@field[row - 1][col - 1].contains_mine? && !@field[row][col - 1].contains_mine? && !@field[row - 1][col].contains_mine? && !@field[row - 1][col - 1].contains_mine? &&\n @field[row - 1][col].reveal!\n @field[row - 1][col - 1].reveal!\n @field[row][col - 1].reveal!\n @field[row - 1][col].reveal!\n @field[row - 1][col - 1].reveal!\n end\n elsif row > 0 && row < @row_count && col > 0 && col < @column_count\n adjacent_cells(row, col).each do |cell|\n if !cell.contains_mine?\n cell.reveal!\n end\n end\n end\n else @field[row][col].reveal!\n end\n end", "def display_board\n cell = \" \"\n print cell+\"|\"+cell+\"|\"+cell+\"\\n-----------\\n\"+cell+\"|\"+cell+\"|\"+cell+\"\\n-----------\\n\"+cell+\"|\"+cell+\"|\"+cell+\"\\n\"\n\nend", "def display\n empty_line\n puts \" | |\"\n puts \" #{@squares[1]} | #{@squares[2]} | #{@squares[3]} \"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{@squares[4]} | #{@squares[5]} | #{@squares[6]} \"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{@squares[7]} | #{@squares[8]} | #{@squares[9]} \"\n puts \" | |\"\n empty_line\n end", "def show_fill_level\n puts \"You have #{@fill_level}g left in your #{@name} cereal box\"\n end", "def display_board\n cell = \" \"\n divider = \"|\"\n demarcator = \"\"\n 11.times { demarcator << \"-\" }\n row = cell + divider + cell + divider + cell\n\n puts row\n puts demarcator\n puts row\n puts demarcator\n puts row\nend", "def new_field\n # You can add fields of choice to your farm by specifying their type (eg. \"corn\") and their total area in hectares (eg. 100).\n print 'What type of crop? '\n crop_type = gets.chomp\n print 'How many hectares? '\n crop_hectares = gets.to_i\n #binding.pry\n print 'How much food will it produce per hectare? '\n food_per_hectare = gets.to_i\n Crop.new_field(crop_type, crop_hectares, food_per_hectare)\n end", "def pretty_print(q = nil) #:nodoc:\n dim = @orientation == :row ? 1 : 0\n\n arr = (0...shape[dim]).inject(Array.new){ |a, i| a << self[i] }\n\n if q.nil?\n puts \"[\" + arr.join(\"\\n\") + \"]\"\n else\n q.group(1, \"\", \"\\n\") do\n q.seplist(arr, lambda { q.text \" \" }, :each) { |v| q.text v.to_s }\n end\n end\n end", "def show_board(board_hash)\n five_spaces = \"#{\" \"*5}\"\n five_dashes = \"#{\"-\"*5}\"\n empty_line = \"#{five_spaces}|#{five_spaces}|#{five_spaces}\"\n divider_line = \"#{five_dashes}+#{five_dashes}+#{five_dashes}\"\n pipe = \" | \"\n row1 = \" #{board_hash[\"1\"]}#{pipe}#{board_hash[\"2\"]}#{pipe}#{board_hash[\"3\"]} \"\n row2 = \" #{board_hash[\"4\"]}#{pipe}#{board_hash[\"5\"]}#{pipe}#{board_hash[\"6\"]} \"\n row3 = \" #{board_hash[\"7\"]}#{pipe}#{board_hash[\"8\"]}#{pipe}#{board_hash[\"9\"]} \"\n puts empty_line\n puts row1\n puts empty_line\n puts divider_line\n puts empty_line\n puts row2\n puts empty_line\n puts divider_line\n puts empty_line\n puts row3\n puts empty_line\nend", "def print_board\n puts \"\\n[#{@spaces[1]}][#{@spaces[2]}][#{@spaces[3]}]\\n[#{@spaces[4]}][#{@spaces[5]}][#{@spaces[6]}]\\n[#{@spaces[7]}][#{@spaces[8]}][#{@spaces[9]}]\\n\\n\"\n end", "def boardprint\n p @board\n puts \"#{@words}\" + \" words\"\n puts \"#{@phraseletters}\" + \" letters overall\"\n puts \"#{guess_count}\" + \" guesses made / \"\"#{@guesses_remaining}\" + \" guesses remaining\"\n puts \"#{@remaining}\" + \" letters remaining\"\n end", "def display_board(board)\n filled_board = []\n board = board.each_slice(3).to_a\n board.each do |a|\n filled_board << a.join(\" | \")\n end\n for row in (0..filled_board.length-1)\n if row > 0\n print \"-----------\\n\"\n end\n print \" \" + filled_board[row] + \" \\n\"\n end\n nil\nend", "def draw_blank\n puts \"[ o ] [ o ] [ o ] [ o ]\\n\\n\"\n end", "def place_ships_on_the_field ships, field\n\t\tships.each do |ship|\n\t\t\tif ship.to_i == 10 then field[ship] = Symbols::SHIP + ' '\n\t\t\telse field[ship] = Symbols::SHIP\n\t\t\tend\n\t\tend\n\tend", "def print_board\n 6.times do |y|\n y = 5 - y # To print from top to bottom\n 7.times do |x|\n if @board[[x, y]] == nil\n x == 6 ? (puts \"( )\") : (print \"( )\")\n else\n # Prints only the 3 first letters of each color to keep board alignment\n x == 6 ? (puts \"(#{@board[[x, y]].color[0, 3]})\") : (print \"(#{@board[[x, y]].color[0, 3]})\")\n end\n end\n end\n end", "def print_maze\n # Special handling: print the top line.\n puts @columns.times.inject(\"+\") {|str, x| str << \"---+\" }\n\n # For each cell, print the right and bottom wall, if it exists.\n @rows.times do |y|\n line = @columns.times.inject(\"|\") do |str, x|\n str << (@path[x][y] ? \" * \" : \" \") << (@vertical_walls[x][y] ? \"|\" : \" \")\n end\n puts line\n puts @columns.times.inject(\"+\") {|str, x| str << (@horizontal_walls[x][y] ? \"---+\" : \" +\")}\n end\n end", "def print\n\t\tif self.length == 0\n\t\t\tputs \"empty\"\n\t\telse\n\t\t\tself.full_scan { |item| puts item.data }\n\t\tend\n\tend", "def print\n\t\tif self.length == 0\n\t\t\tputs \"empty\"\n\t\telse\n\t\t\tself.full_scan { |item| puts item.data }\n\t\tend\n\tend", "def display\n print(\"Card: #{@id} \")\n print(\"Number: #{@number} \")\n print(\"Color: #{@color} \")\n print(\"Shape: #{@shape} \")\n puts(\"Shade: #{@shade}\")\n end", "def print\n unless success?\n return nil\n end\n nlen = \"Name\".length\n clen = \"Craft\".length\n @data['people'].each do |p|\n nlen = p['name'].length > nlen ? p['name'].length : nlen\n clen = p['craft'].length > clen ? p['craft'].length : clen\n end\n\n print_header(nlen, clen)\n @data['people'].each do |p|\n print_line(nlen, p['name'], clen, p['craft'])\n end\n end", "def create_empty_board(position)\n 9.times { |i| position[i] = \" \"}\nend", "def print\n displayBoard = []\n @board.each_with_index { |elem, index|\n if index % @columns == 0\n displayBoard.push(\"\\n\")\n end\n displayBoard.push(elem)\n }\n puts displayBoard.join\n end", "def print\n board_print = \"\"\n\n for x in 0..@matrix.length - 1\n for y in 0..@matrix[x].length - 1\n if @matrix[x][y] == \"KK\"\n board_print << @matrix[x][y]\n else\n board_print << format('%02d', @matrix[x][y]).to_s\n end\n\n board_print << \" \"\n end\n\n board_print << \"\\n\"\n end\n\n board_print << \"\\n\"\n puts board_print\n end", "def print_board\r\n\t\t@board_array.each do |char|\r\n\t\t\tprint \"#{char} \"\r\n\t\tend\r\n\t\tputs \"\"\r\n\t\t@board_array\r\n\tend", "def display_board\n display = \" a b c d e f g h \\n\"\n @board.each_with_index do |arr, i|\n line = \"#{i + 1} \"\n arr.each do |hash|\n hash[:piece].nil? ? line += \"#{hash[:base]} \" : line += \"#{hash[:piece].name} \"\n end\n line += \"\\n\"\n display += line\n end\n display\n end", "def print_in_box(message)\n horizontal_rule = \"+#{'-' * (message.size + 2)}+\"\n empty_line = \"|#{' ' * (message.size + 2)}|\"\n\n puts horizontal_rule\n puts empty_line\n puts \"| #{message} |\"\n puts empty_line\n puts horizontal_rule\nend", "def print_in_box(message)\n horizontal_rule = \"+#{'-' * (message.size + 2)}+\"\n empty_line = \"|#{' ' * (message.size + 2)}|\"\n\n puts horizontal_rule\n puts empty_line\n puts \"| #{message} |\"\n puts empty_line\n puts horizontal_rule\nend", "def render\n print \"\\n\"\n @board.each do |row|\n row.each do |col|\n print \"#{col.nil? ? '.' : col} \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end", "def status\n @@fields_on_farm.each do |field|\n puts \"#{field.crop.capitalize} field is #{field.field_size} hectares.\"\n end\n puts \"The farm has #{@@total_harvested} harvested food so far.\"\n end", "def filled?\n !!self[:filled]\n end", "def print_board\n dic = {0 => @slot.empty, 1 => @slot.cross, 2 => @slot.circle}\n dic[1], dic[2] = [@slot.circle, @slot.cross] if @@cpt_game.even?\n printed_board = []\n @board.board.each do |k,v|\n row = []\n v.each { |num| row << dic[num] }\n printed_board << row\n end\n print_board_array(printed_board)\n end", "def print\n\t\t\tself.each do |item|\n\t\t\t\titem.p( @colsizes, @align, @padding )\n\t\t\tend\n\t\tend", "def the_board\n puts \" --------------\" \n puts \"| #{@A1} | #{@A2} | #{@A3} |\"\n puts \"|--------------|\"\n puts \"| #{@B1} | #{@B2} | #{@B3} |\"\n puts \"|--------------|\"\n puts \"| #{@C1} | #{@C2} | #{@C3} |\"\n puts \" --------------\"\n end", "def show()\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs (@@board[7] + '\t|\t' + @@board[8] + '\t|\t' + @@board[9])\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[4] + '\t|\t' + @@board[5] + '\t|\t' + @@board[6])\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[1] + '\t|\t' + @@board[2] + '\t|\t' + @@board[3])\n\t\tputs (' \t|\t' + ' \t|\t')\n\tend", "def render()\n print \" \"\n (0...@size).each do |col|\n print (col).to_s + \" \"\n end\n puts\n\n (0...@size).each do |row|\n (-1...@size).each do |col|\n print col == -1 ? row : card([row, col]).display\n print \" \"\n end\n puts\n end\n end", "def display_board\n row_1 = (\" | | \")\n border_1= \"-----------\"\n puts row_1\n puts border_1\n puts row_1\n puts border_1\n puts row_1\nend", "def print\n @cell_board.each do |row|\n string_row_separator = '-'\n string_row = '|'\n row.each do |element|\n string_row += \" #{element.to_s} |\"\n string_row_separator += '----'\n end\n puts string_row\n puts string_row_separator\n end\n end", "def populate\n spots = @spaces.length**2\n asteroids = (spots * 0.3).round\n gravity_wells = (spots * 0.1).round\n empty_space = (spots * 0.6 ).round\n\n asteroids.times {fill_spot('A')}\n gravity_wells.times {fill_spot('G')}\n #Because we fill two empty space with start, end marks\n empty_space.times {fill_spot('.')}\n end", "def display\r\n\t\t\ti = 0\r\n\t\t\t@dims.times do\r\n\t\t\t\tgamelog \"Floor \"+i.to_s\r\n\t\t\t\tsuper(i)\r\n\t\t\t\ti += 1\r\n\t\t\tend\r\n\t\tend", "def render\n @board.each.with_index do |row, y|\n row.each.with_index do |item, x|\n chr = item.nil? ? \" \" : item\n print \" #{chr} \"\n print \"|\" unless x == row.size - 1\n end\n print \"\\n-----------\\n\" unless y == @board.size - 1\n end\n print \"\\n\"\n end", "def print_board\n puts\n @board.each_with_index do |row, index|\n print \" \"\n row.each_with_index do |element, index|\n print \" \" + element.to_s.center(3, \" \") + \" \"\n if(index < row.length - 1)\n print \"|\"\n else\n print \"\\n\"\n end\n end\n\n if(index < @board.length - 1)\n print \" \"\n row.each_with_index do |element, index|\n print \"-----\"\n if(index < row.length - 1)\n print \"+\"\n else\n print \"\\n\"\n end\n end\n end\n end\n puts\n end", "def draw_text_field\n setpos(divider_line, 0)\n attron(color_pair(COLOR_WHITE) | A_NORMAL) {\n addstr(\"Current Room:#{@currentRoom} #{(@joinedRooms.delete(@currentRoom)).to_a}\" + \" \" * cols)\n }\n cursor_to_input_line\n clrtoeol\n end", "def print\n\t\tif self.length == 0\n\t\t\tputs \"empty\"\n\t\telse\n\t\t\tself.each { |item| puts item.data }\n\t\tend\n\tend", "def display_board\n puts \" \" \"|\" \" \" \"|\" \" \"\n puts \"-----------\"\n puts \" \" \"|\" \" \" \"|\" \" \"\n puts \"-----------\"\n puts \" \" \"|\" \" \" \"|\" \" \"\nend", "def print_board_array(array)\n dic_letter = {0 => 'A', 1 => 'B', 2 => 'C'}\n # Première ligne\n puts \" \" * 3 + \"1\".center(@slot.w) + \" \" + \"2\".center(@slot.w) \\\n + \" \" + \"3\".center(@slot.w) + \"\\n\\n\"\n array.each_with_index do |row, i|\n # Parcours ligne par ligne les 3 cases (slot) d'une ligne (1/2/3)\n @slot.h.times do |j|\n # Print the 3 characters (blank, or A/B/C)\n (j == @slot.h / 2) ? (print \" #{dic_letter[i]} \") : (print \" \" * 3)\n # Parcours tous les slots d'une ligne et lit \"sa\" ligne j\n row.each_with_index do |cell, k|\n print cell[j]\n k == 2 ? (print \"\\n\") : (print \"|\")\n end\n end\n # Separator between each row\n puts ' ' * 3 + '-' * (@slot.w + 1 + @slot.w + 1 + @slot.w) if i < 2\n end\n puts \"\\n\\n\"\n end", "def fill_spec\n zeros = count_zeros # how many to fill\n begin\n last_zeros = zeros\n (0..8).each{|i|\n (0..8).each{|j|\n next if @board[i][j] != 0 # skip filled spaces\n choices = find_choices(i, j)\n raise \"Illegal Board #{i+1} #{j+1}\" if choices.length == 0\n @board[i][j] = choices[0] if choices.length == 1\n }\n }\n zeros = count_zeros\n # if filled some, possibly others are now fully specified\n end while ((zeros > 0) && (last_zeros > zeros))\n end", "def zero_out_board\n @p.each { |k, v| @p[k] = ' '}\n draw_board(true)\n end", "def clear\n @@fields.each do |field|\n self.instance_variable_set(\"@\"+field.to_s,nil)\n end\n end", "def print_board\n col_numbers = [' ']\n (1..8).each do |row|\n row_items = []\n\n col_numbers << ' ' + row.to_s + ' '\n row_items << row\n \n (1..8).each do |col|\n row_items << @board[[row,col]].console_rep\n end\n\n puts row_items.join(' ')\n end\n puts col_numbers.join(' ')\n end", "def printCard\n \"#{@color[0]}#{@fillType[0]}#{@shapeType[0]}#{@numberOfSymbols[0]}\"\n end", "def display_board\n cell_one = \" \"\n cell_two = \" \"\n cell_three = \" \"\n cell_four = \" \"\n cell_five = \" \"\n cell_six = \" \"\n cell_seven = \" \"\n cell_eight = \" \"\n cell_nine = \" \"\n divider = \"|\"\n row = \"-----------\"\n puts cell_one + divider + cell_two + divider + cell_three\n puts row\n puts cell_four + divider + cell_five + divider + cell_six\n puts row\n puts cell_seven + divider + cell_eight + divider + cell_nine\nend", "def print_board\n\n\t\t@board.each_with_index do |row, i|\n\n\t\t\trow.each do |space|\n\n\t\t\t\tprint \"|#{space}|\"\n\n\t\t\tend\n\n\t\t\tif i == 2\n\t\t\t\tputs \"\"\n\t\t\telse\n\t\t\t\tputs \"\"\n\t\t\t\tputs \"---------\"\n\t\t\tend\n\n\t\tend\n\n\tend", "def game_board_header\n puts \" 1 2 3 4 5 6 7 8 9 10\"\n puts \" -----------------------------------------\"\n end", "def display\n system('clear')\n border\n puts table\n border\n end", "def render_board\n puts ''\n puts ' | |'\n puts \" #{@squares[1]} | #{@squares[2]} | #{@squares[3]}\"\n puts ' | |'\n puts '-------------------'\n puts ' | |'\n puts \" #{@squares[4]} | #{@squares[5]} | #{@squares[6]}\"\n puts ' | |'\n puts '-------------------'\n puts ' | |'\n puts \" #{@squares[7]} | #{@squares[8]} | #{@squares[9]}\"\n puts ' | |'\n puts ''\n end", "def draw\n puts \"*\" * (@cells.first.size + 2)\n @cells.each do |row|\n puts \"|\" + row.map { |column_value| column_value == 0 ? \" \" : \"#\" }.join + \"|\"\n end\n puts \"*\" * (@cells.first.size + 2)\n end", "def free_fields\n free_pieses(@battle_field) + free_pieses(@battle_field.transpose)\n end", "def print_board\n print to_s\n # @board.each do |row|\n # row.each do |square|\n # print \" #{square.number} \"\n # end\n # puts \"\"\n # end\n end", "def print_board\n for num in 0..4 do\n print \" \" + @top_row[num].to_s + \" \"\n end\n puts \"\"\n for num in 0..4 do\n puts \"#{@left_column[num].to_s} #{@board[num]}\"\n end\nend", "def show_board\n \tputs \"-\"*16\n \tputs \"| #{@case_array[0].symbol} | #{@case_array[1].symbol} | #{@case_array[2].symbol} |\"\n \tputs \"-\"*16\n \tputs \"| #{@case_array[3].symbol} | #{@case_array[4].symbol} | #{@case_array[5].symbol} |\"\n \tputs \"-\"*16\n \tputs \"| #{@case_array[6].symbol} | #{@case_array[7].symbol} | #{@case_array[8].symbol} |\"\n \tputs \"-\"*16\n\tend", "def print_board(positions) # positions is a hash\n clear_screen\n puts\n puts \" #{positions[:a]} | #{positions[:b]} | #{positions[:c]} \"\n puts \"----+----+----\"\n puts \" #{positions[:d]} | #{positions[:e]} | #{positions[:f]} \"\n puts \"----+----+----\"\n puts \" #{positions[:g]} | #{positions[:h]} | #{positions[:i]} \"\n puts\nend", "def print\n puts \"\"\n puts \"\"\n puts \"Generation #{@generation}\"\n puts \"#{@grid.rows} x #{@grid.cols}\"\n @grid.print()\n end" ]
[ "0.661401", "0.63582236", "0.5811382", "0.5731705", "0.55386865", "0.5459447", "0.53989077", "0.5376416", "0.53698087", "0.5324373", "0.5308976", "0.5268991", "0.5263823", "0.52599996", "0.52457297", "0.52441037", "0.52192646", "0.5218089", "0.51920444", "0.51861054", "0.51861054", "0.518541", "0.51781034", "0.51667607", "0.5127141", "0.51262003", "0.51143587", "0.50985545", "0.50976175", "0.5092193", "0.50919026", "0.5088172", "0.50790024", "0.5077868", "0.5072773", "0.50642484", "0.5056114", "0.5051998", "0.5037163", "0.5000871", "0.4983632", "0.49773285", "0.49632007", "0.4959121", "0.4954932", "0.49419686", "0.4940679", "0.4937134", "0.49365893", "0.49317658", "0.49193147", "0.49182475", "0.4899992", "0.48964056", "0.48927584", "0.48927584", "0.48823518", "0.48734626", "0.4872724", "0.48723656", "0.48649862", "0.48526818", "0.48523137", "0.484105", "0.484105", "0.4833439", "0.48163447", "0.4809138", "0.48087668", "0.48062074", "0.4805906", "0.48047677", "0.4793818", "0.47914475", "0.47889122", "0.47880176", "0.47817343", "0.47804284", "0.4777208", "0.47770527", "0.47759682", "0.47757232", "0.4775276", "0.47726348", "0.47704133", "0.4769539", "0.47681242", "0.4757013", "0.47519392", "0.4751226", "0.47506747", "0.47484642", "0.47327825", "0.47313753", "0.47272584", "0.4726247", "0.47196156", "0.47102237", "0.47083798", "0.47025758" ]
0.9337237
0
The animate_game method prints the filled field first, then it allows the user to change the snake's direction, then moves the snake one frame, and finally checks for conditions that change the circumstances of the game. All of this is done repeatedly until the game ends.
def animate_game begin Curses.stdscr.keypad = true Curses.noecho Curses.curs_set(0) Curses.timeout = 0 loop do print_filled_field # Add a sleep method with a value of 0.1 to prevent the snake from # moving too fast. Adjust the value of sleep to speed up or slow down # the game. sleep(0.1) snake.change_direction snake.move_one_frame check_game_conditions end ensure Curses.close_screen end print_end_screen end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play_round\n system(\"clear\")\n @board.render\n puts\n full_move = self.get_full_move\n pos = self.get_position(full_move)\n action = self.get_action(full_move)\n while action.downcase == \"e\" && !(self.valid_flip?(pos))\n self.display_unflag_message\n full_move = self.get_full_move\n pos = self.get_position(full_move)\n action = self.get_action(full_move)\n end\n action.downcase == \"e\" ? @board[pos].reveal : @board[pos].toggle_flag\n @board.reveal_bombs if @board.is_a_bomb?(pos) && @board[pos].revealed\n end", "def animation\n x = -1\n y = -1\n a = -1\n b = -1\n player_movement = (@player_pos[-2] - @player_pos[-1]) / 5\n computer_movement = (@computer_pos[-2] - @computer_pos[-1]) / 5\n player_movement2 = (@player_pos[-2] - @player_pos[-1]) / 3\n computer_movement2 = (@computer_pos[-2] - @computer_pos[-1]) / 3\n # run only if the player wins the game\n if @player_pos[-1] == 0\n 3.times do\n system('clear')\n if player_movement == 1\n @level1_string[@player_pos[-2] + player_movement2 * a + 1] = \"\\u{1f4b0}\"\n @level1_string[@player_pos[-2] + player_movement2 * a + 2] = \" \"\n @level1_string[@player_pos[-2] + player_movement2 * a + 3] = \" \"\n @level1_string[@player_pos[-2] + player_movement2 * a] = @player\n @level1_string[2] = @goal\n @level1_string[52] = @start\n end\n if computer_movement == 1\n @level1_string[@computer_pos[-2] + computer_movement2 * b + 1] = \" \"\n @level1_string[@computer_pos[-2] + computer_movement2 * b + 2] = \"\\u{1f4a8}\"\n @level1_string[@computer_pos[-2] + computer_movement2 * b + 3] = \" \"\n @level1_string[@computer_pos[-2] + computer_movement2 * b] = @computer\n @level1_string[2] = @goal\n @level1_string[52] = @start\n end\n insert_sky\n puts @level1_string\n insert_landscape\n a -= 1\n b -= 1\n sleep 0.07\n end\n system('clear')\n @computer_pos[-1] = \"\\u{1f4a5}\"\n @player_pos[-1] = @goal\n insert_sky\n puts @level1_string\n insert_landscape\n system (\"say Congratulations! You have successfully escaped with the cash!\")\n sleep 2\n str = \"\"\n 700.times do\n system('clear')\n str += \"\\u{1f4b0} \"\n puts str\n sleep 0.005\n end\n throw :exit\n end\n # move the player/computer 5 blocks for each correct answer\n 5.times do\n system('clear')\n if player_movement == 1\n @level1_string[@player_pos[-2] + player_movement * x + 1] = \"\\u{1f4b0}\"\n @level1_string[@player_pos[-2] + player_movement * x + 2] = \" \"\n @level1_string[@player_pos[-2] + player_movement * x + 3] = \" \"\n @level1_string[@player_pos[-2] + player_movement * x] = @player\n @level1_string[2] = @goal\n @level1_string[52] = @start\n end\n if computer_movement == 1\n @level1_string[@computer_pos[-2] + computer_movement * y + 1] = \" \"\n @level1_string[@computer_pos[-2] + computer_movement * y + 2] = \"\\u{1f4a8}\"\n @level1_string[@computer_pos[-2] + computer_movement * y + 3] = \" \"\n @level1_string[@computer_pos[-2] + computer_movement * y] = @computer\n @level1_string[2] = @goal\n @level1_string[52] = @start\n end\n insert_sky\n puts @level1_string\n insert_landscape\n x -= 1\n y -= 1\n sleep 0.07\n end\n @level1_string[@computer_pos[-2] + computer_movement * y + 3] = \" \"\n # run only if player loses to computer\n if @player_pos[-1] == @computer_pos[-1]\n explosion_animation\n system (\"say Boom Boom Boom\")\n sleep 2\n str = \"\"\n 700.times do\n system('clear')\n str += \"\\u{2620} \"\n puts str\n sleep 0.005\n end\n throw :exit\n else\n system('clear')\n insert_sky\n @level1_string[52] = @start\n puts @level1_string\n insert_landscape\n end\n end", "def play_game\n loop do\n puts \"\\n\\n\"\n display_board\n player_turn\n check_game_status\n end\n end", "def step\n if @game_over\n game_over!\n @event_handler.update\n else\n # background for playing field and hud\n @screen.fill :black\n @screen.fill [50,50,50], Rect.new(Configuration.screen[:hud_rect])\n\n @event_handler.update\n @hud.update @clock.framerate.ceil, @round, @enemies.length, @money, @lives+1, @round_timer\n\n update_timer\n restock_enemies! if @restock_enemies > 0\n\n @the_path.draw @screen # Draw the enemy path.\n @enemies.draw @screen # Draw the enemies.\n @towers.draw @screen # Draw all set towers.\n @grid_highlighter.draw @screen # Draw the nifty semi-transparent highlighter below the mouse.\n @hud.draw @screen # draw the HUD\n end\n\n @screen.update() # Refresh the screen.\n end", "def play_round\n puts \"---D I N G ! N E W R O U N D !---\"\n @round_over = false\n take_turn(self.current_player) until @round_over\n if @round_over\n @fragment = \"\"\n self.display_standings\n sleep 5\n system(\"clear\")\n end\n end", "def play\n @board.display\n while true\n\n # begin\n coords = get_input\n perform_move(coords) if valid_move_sequence?(coords)\n @board.display\n # rescue ArgumentError => e\n # puts \"Could not execute move sequence.\"\n # puts \"Error was: #{e.message}\"\n #\n # end\n\n end\n end", "def start_game\n puts 'GAME STARTED'\n until @is_game_over\n @count_turns += 1\n @board.draw_board\n @board.update_board(@controller.get_input)\n game_over?\n end\n puts @count_turns\n end_game\n end", "def play_manual\n first_move = true\n Display.clear_screen\n Display.draw_board(@cur_board, @player_white, @player_black)\n puts \"Starting Position\"\n\n while (true)\n case Display.man_menu\n when \"n\"\n if \"#{@turn}#{@player_to_move}\" != @data[\"moves\"].keys[-1]\n !first_move ? increment_game : first_move = false\n play_turn\n else\n puts \"End of Game, Can't go forward\"\n sleep(1)\n end\n when \"b\"\n if \"#{@turn}#{@player_to_move}\" == \"1w\"\n if (first_move)\n puts \"Start of Game, Can't go back\"\n sleep(1)\n else\n first_move = true\n reset_game\n end\n else\n change_turn\n @turn -=1 if player_to_move == \"b\"\n fast_forward(\"#{@turn}#{@player_to_move}\")\n end\n when \"goto\"\n move = Display.get_move\n valid = validate_move(move)\n begin\n if valid\n first_move = false\n fast_forward(move)\n else raise InputError end\n rescue InputError => e\n puts e.message\n sleep(2)\n end\n when \"exit\"\n exit\n end\n Display.clear_screen\n if first_move\n Display.draw_board(@cur_board, @player_white, @player_black)\n puts \"Starting Position\"\n else\n view_turn\n end\n\n if \"#{@turn}#{@player_to_move}\" == @data[\"moves\"].keys[-1] then Display.game_end_ui(determine_winner) end\n end\n end", "def frame_loop\n row = @pos[0]; col = @pos[1]\n @subturn_frames.times do |frame| # subsubturn\n test_pos = get_move(@pos)\n break if @quit_flag == true\n\n if test_pos\n @logger.info(\"@pos: #{@pos}, test_pos: #{test_pos}\")\n test_grid = @turn_state.mcopy.collide(@tet, test_pos.mcopy)\n # @logger.info(test_grid.to_s)\n unless test_grid.nil?\n @pos = test_pos.mcopy\n @grid = test_grid.mcopy\n end\n @logger.info(\"TWO @pos: #{@pos}, test_pos: #{test_pos}\")\n draw(\"T: #{@turn}, ST: #{@subturn}, F: #{frame}, m: #{@move}, p: #{@pos}, score: #{@score}\") # call only if moved\n @move = nil\n # if reaches bottom, next turn\n #\n end\n STDIN.raw!\n sleep @frame_time\n end\n end", "def player_move\n player_position = gets.chomp\n player_position = player_position.split(' ')\n if player_position[0] == 'flag'\n flag_map(player_position[1], player_position[2])\n elsif player_position[0] == 'unflag'\n unflag_map(player_position[1], player_position[2])\n else\n player_choice(player_position[0], player_position[1])\n end\n display_board\n \n show_board if game_over == true \n\n end", "def play_full_game\n Display.clear_screen\n Display.draw_board(@cur_board, @player_white, @player_black)\n Display.game_start_ui\n fast_forward(@data[\"moves\"].keys[-1], true)\n Display.draw_board(@cur_board, @player_white, @player_black)\n Display.game_end_ui(determine_winner)\n end", "def draw(animate = false, fps = 2)\n build_steps unless @built\n @steps.each do |step|\n draw_square(*step)\n if animate\n print \"\\033c\" # clear the screen\n puts self\n sleep(1.0 / fps)\n end\n end\n\n puts self unless animate\n end", "def play_loop\n puts \"Welcome to our game of Chess.\"\n puts \"You make moves by typing in the coordinate that you wish to move from, followed by the coordinate you're moving to\"\n\n turn = :white\n\n until board.checkmate?(turn)\n white_turn = turn == :white\n player = white_turn ? @white : @black\n puts self.board\n puts \"#{turn.to_s.capitalize}'s turn\".bold\n begin\n input = player.play_turn\n\n case input[:action]\n when :save\n save\n when :load\n load\n else\n board.is_color?(input[:start_pos],turn)\n self.board.move(input[:start_pos], input[:end_pos])\n end\n rescue InvalidMoveException => e\n puts e.message\n retry\n end\n turn = white_turn ? :black : :white\n end\n\n if board.checked?(:black)\n puts \"Checkmate! White Wins!\".bold\n elsif board.checked?(:white)\n puts \"Checkmate! Black Wins!\".bold\n else\n puts \"Stalemate. No one wins!\".bold\n end\n end", "def game_frame(states)\n clear\n \n states.each do |state|\n output \"%s%s\" % [state.player.name, (%{ - \"#{state.player.taunt}\"} if state.player.respond_to?(:taunt) && state.player.taunt.to_s.length > 0)]\n output state.current_pattern\n output \"Correct: #{state.correct_guesses.join(' ')}\"\n output \"Incorrect: #{state.incorrect_guesses.join(' ')}\"\n output Gallows.stages[state.incorrect_guesses.count]\n blank_line\n end\n end", "def play_game\r\n\r\n player = \"X\" #Make Player X the default player for each\r\n #new game\r\n \r\n noOfMoves = 0 #Reset the value of the variable used to\r\n #keep track of the total number of moves\r\n #made in a game\r\n\r\n #Clear out the game board to get it ready for a new game\r\n clear_game_board\r\n\r\n loop do #Loop forever\r\n\r\n Console_Screen.cls #Clear the display area\r\n \r\n #Call on the method that displays the game board and\r\n #collects player moves\r\n square = display_game_board(player)\r\n \r\n #Assign the selected game board square to the player\r\n #that selected it\r\n $A1 = player if square == \"A1\" \r\n $A2 = player if square == \"A2\" \r\n $A3 = player if square == \"A3\" \r\n $B1 = player if square == \"B1\" \r\n $B2 = player if square == \"B2\" \r\n $B3 = player if square == \"B3\" \r\n $C1 = player if square == \"C1\" \r\n $C2 = player if square == \"C2\" \r\n $C3 = player if square == \"C3\" \r\n\r\n #Keep count of the total number of moves that have\r\n #been made\r\n noOfMoves += 1\r\n\r\n #Call on the method that is responsible for \r\n #determining if the game has been won\r\n winner = check_results(player)\r\n \r\n #See is player X has won\r\n if winner == \"X\" then\r\n #Call on the method that displays the game final\r\n #results\r\n display_game_results(\"Player X Wins!\")\r\n #Keep count of the total number of wins that $xWins has\r\n $xWins += 1\r\n break #Terminate the execution of the loop\r\n end\r\n \r\n #See if player O has won\r\n if winner == \"O\" then\r\n #Call on the method that displays the game final\r\n #results\r\n display_game_results(\"Player O Wins!\")\r\n #Keep count of the total number of wins that $oWins has\r\n $oWins += 1\r\n break #Terminate the execution of the loop\r\n end \r\n \r\n #See if the game has ended in a tie\r\n if noOfMoves == 9 then\r\n #Call on the method that displays the game final\r\n #results\r\n display_game_results(\"Tie\")\r\n break #Terminate the execution of the loop\r\n end\r\n \r\n #If the game has not ended, switch player turns and\r\n #keep playing\r\n if player == \"X\" then\r\n player = \"O\"\r\n else\r\n player = \"X\"\r\n end\r\n \r\n end\r\n \r\n end", "def continue_game\n\t\thandle_no_set\n\t\tuntil @is_end\n\t\t\tshow_progress\n\t\t\tshow_hand\n\t\t\tuser_input = get_user_cards\n\t\t\tupdate user_input\n\t\t\thandle_no_set\n\t\tend\n\tend", "def game\n game_mode \n set_solution\n until (@turns_left < 1 || @winner)\n guess\n checker\n @turns_left -= 1\n status\n end\n end", "def play_game\n \twhile true\n \t\t@view.display_game_state(@word, @misses, @hits, @guesses_left)\n \t\tbreak if game_over?\n \t\tguess = get_guess\n \t\tbreak if guess == :save\n \t\tupdate_game_state guess\n \tend\n \tsave_game if guess == :save\n\tend", "def play\n\n while @game_complete == false\n\n # starting game text to help the player create a mental picture of the environment\n @new_player_name = \"Mr Developer\" if @debug\n player_set_up unless @debug || @starting_game_text == false\n puts starting_game_text unless @debug || @starting_game_text == false\n @starting_game_text = false\n \n slow_type(\"\\nYou are in #{find_room_by_id(@current_room_id).name}\")\n main_menu = TTY::Prompt.new\n\n choices = [\n { name: 'Move Player', value: 1 },\n { name: 'Look At', value: 2 },\n { name: 'Pick Up', value: 3 },\n { name: 'Use Item', value: 4 },\n { name: 'Talk To', value: 5 },\n { name: 'Quit', value: 6 },\n ]\n attr = main_menu.select(slow_type(\"What would you like to do?\"), choices)\n\n # gets user input\n \n if attr == 1\n player_move\n \n elsif attr == 2\n look_at\n\n elsif attr == 3\n pick_up\n\n elsif attr == 4\n use_item\n\n elsif attr == 5\n talk_to\n \n else attr == 6\n @game_complete = true\n end\n\n end\n end", "def game_loop\n puts @game.to_s\n puts \"It is #{current_player()}'s turn.\"\n move = receive_move()\n from = move.first #something like A2\n to = move.last #something like B3\n is_valid = @game.is_valid?(from, to, @turn_num) #can the current player move a piece from->to?\n until is_valid\n move = receive_move()\n from = move.first\n to = move.last\n piece = @game.piece_at(from) #what is the current piece?\n puts \"You have selected a #{piece.type.to_s.upcase} at #{from} to move to #{to}.\"\n is_valid = @game.is_valid?(from, to, @turn_num)\n puts \"Sorry. not a legal move. please choose again.\" unless is_valid\n end\n puts \"Moving from #{from} to #{to}.\"\n @game.make_move(from, to)\n puts @game.to_s\n nil\n end", "def game_play\n until game_over\n graphic\n guess\n end\n end", "def game_over\n puts \" ██████╗ █████╗ ███╗ ███╗███████╗\"\n sleep(1)\n puts \"██╔════╝ ██╔══██╗████╗ ████║██╔════╝\"\n sleep(1)\n puts \"██║ ███╗███████║██╔████╔██║█████╗ \"\n sleep(1)\n puts \"██║ ██║██╔══██║██║╚██╔╝██║██╔══╝ \"\n sleep(1)\n puts \"╚██████╔╝██║ ██║██║ ╚═╝ ██║███████╗\"\n sleep(1)\n puts \"╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝\"\n sleep(1)\n puts \" \"\n sleep(1)\n puts \"██████╗ ██╗ ██╗███████╗██████╗ \"\n sleep(1)\n puts \"██╔═══██╗██║ ██║██╔════╝██╔══██╗ \"\n sleep(1)\n puts \"██║ ██║██║ ██║█████╗ ██████╔╝ \"\n sleep(1)\n puts \"██║ ██║╚██╗ ██╔╝██╔══╝ ██╔══██╗ \"\n sleep(1)\n puts \"╚██████╔╝ ╚████╔╝ ███████╗██║ ██║ \"\n sleep(1)\n puts \"╚═════╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝ \"\n sleep(1)\n\n\n exit(0)\nend", "def play\n until board.king_in_checkmate?(:white) || board.king_in_checkmate?(:black) || board.stalemate?\n display.render\n input = get_start\n @board.piece_in_hand = @board[input]\n make_move(input)\n @board.switch_players!\n end\n display.render\n if board.king_in_checkmate?(:white)\n puts \"White is in Checkmate\\nBlack wins!\"\n elsif board.king_in_checkmate?(:black)\n puts \"Black is in Checkmate\\nWhite wins!\"\n else\n puts \"Stalemate!\"\n end\n rescue BadInputError, BadMoveError\n @board.drop_piece\n retry\n end", "def draw\n\n\t # \n\t # Clear the screen.\n\t #\n\t print \"\\e[2J\"\n\t if not @animate\n\t \n\t # \n\t\t# Move to upper left and defer to superclass\n\t\t#\t\t\n\t print \"\\e[H\"\n\t\tsuper()\n\t else\n\t\t#\n\t\t# If we are animating, clear the screen and start carving!\n\t\t#\n\t\tcarve_passage_from(0,0)\n\n\t\t#\n\t\t# Output maze metadata\n\t\t#\n\t\tputs metadata\n\t end\n\tend", "def play\n while true\n current_player.en_passant = false\n board.formatted_grid\n if check_for_check\n if check_for_checkmate\n puts \"Checkmate!\"\n else\n puts \"Check!\"\n end\n end\n x, y = prompt_selection\n puts \"\"\n puts ask_move\n x_end, y_end = get_move\n if x_end == \"back\"\n board.clear_board\n play\n end\n while board.valid_place?(x_end, y_end) == false\n puts \"Invalid option! Try again:\"\n x_end, y_end = get_move\n board.valid_place?(x_end, y_end)\n end\n #check for en passant\n if board.get_cell_piece(x, y).type == \"pawn\" && y_end - y == 2\n current_player.en_passant = true\n elsif board.get_cell_piece(x, y).type == \"pawn\" && y - y_end == 2\n current_player.en_passant = true\n end\n\n #check for promotion\n if board.get_cell_piece(x, y).type == \"pawn\" && board.get_cell_piece(x, y).color == \"white\" && y_end == 0\n promote(x, y)\n elsif board.get_cell_piece(x, y).type == \"pawn\" && board.get_cell_piece(x, y).color == \"black\" && y_end == 7\n promote(x, y)\n end\n\n #check for castling\n if board.get_cell_piece(x, y).type == \"king\" && x_end - x == 2\n board.piece_move(x + 3, y, x + 1, y)\n board.set_cell_color(x + 2, y, \"red\")\n elsif board.get_cell_piece(x, y).type == \"king\" && x - x_end == 2\n board.piece_move(x - 4, y, x - 1, y)\n board.set_cell_color(x - 2, y, \"red\")\n end\n #check if taking an opponent's piece\n if is_taking_piece?(x_end, y_end) \n hash_value = other_player.pieces_left.key([x_end, y_end])\n current_player.pieces_left[hash_value] = [x_end, y_end]\n other_player.pieces_left.delete(hash_value)\n\n board.piece_move(x, y, x_end, y_end)\n else\n hash_value = current_player.pieces_left.key([x, y])\n current_player.pieces_left[hash_value] = [x_end, y_end]\n board.piece_move(x, y, x_end, y_end)\n end\n #if board.game_over\n #puts game_over_message\n #board.formatted_grid\n #return\n #else\n switch_players\n #end\n end\n end", "def play\n until game_over\n start_new_turn\n show_board\n make_move @current_player\n end\n show_board\n puts \"#{game_over} wins!\"\n end", "def run_game\n start_game\n new_board\n while true\n print_grid\n tour_joueur1\n tour_joueur2\n end\nend", "def play_game2\r\n\r\n player = \"O\" #Make Player O the default player for each\r\n #new game\r\n \r\n noOfMoves = 0 #Reset the value of the variable used to\r\n #keep track of the total number of moves\r\n #made in a game\r\n\r\n #Clear out the game board to get it ready for a new game\r\n clear_game_board\r\n\r\n loop do #Loop forever\r\n\r\n Console_Screen.cls #Clear the display area\r\n \r\n #Call on the method that displays the game board and\r\n #collects player moves\r\n square = display_game_board(player)\r\n \r\n #Assign the selected game board square to the player\r\n #that selected it\r\n $A1 = player if square == \"A1\" \r\n $A2 = player if square == \"A2\" \r\n $A3 = player if square == \"A3\" \r\n $B1 = player if square == \"B1\" \r\n $B2 = player if square == \"B2\" \r\n $B3 = player if square == \"B3\" \r\n $C1 = player if square == \"C1\" \r\n $C2 = player if square == \"C2\" \r\n $C3 = player if square == \"C3\" \r\n\r\n #Keep count of the total number of moves that have\r\n #been made\r\n noOfMoves += 1\r\n\r\n #Call on the method that is responsible for \r\n #determining if the game has been won\r\n winner = check_results(player)\r\n \r\n #See is player X has won\r\n if winner == \"X\" then\r\n #Call on the method that displays the game final\r\n #results\r\n display_game_results(\"Player X Wins!\")\r\n #Keep count of the total number of wins that $xWins has\r\n $xWins += 1\r\n break #Terminate the execution of the loop\r\n end\r\n \r\n #See if player O has won\r\n if winner == \"O\" then\r\n #Call on the method that displays the game final\r\n #results\r\n display_game_results(\"Player O Wins!\")\r\n #Keep count of the total number of wins that $oWins has\r\n $oWins += 1\r\n break #Terminate the execution of the loop\r\n end \r\n \r\n #See if the game has ended in a tie\r\n if noOfMoves == 9 then\r\n #Call on the method that displays the game final\r\n #results\r\n display_game_results(\"Tie\")\r\n break #Terminate the execution of the loop\r\n end\r\n \r\n #If the game has not ended, switch player turns and\r\n #keep playing\r\n if player == \"X\" then\r\n player = \"O\"\r\n else\r\n player = \"X\"\r\n end\r\n \r\n end\r\n \r\n end", "def starting_animation\n x = 49\n string = \" \" * 2 + @goal + \" \" * 46 + @player + \"\\u{1f4b0} \" + @start\n 9.times do\n system('clear')\n insert_sky\n string[x-1] = @player\n string[x] = \"\\u{1f4b0}\"\n string[x+1] = \" \"\n string[x+2] = \" \"\n puts string\n insert_landscape\n x -= 1\n sleep 0.1\n end\n end", "def step\n # Clear the screen.\n @screen.fill( :black )\n \n # Fetch input events, etc. from SDL, and add them to the queue.\n @queue.fetch_sdl_events\n \n # Tick the clock and add the TickEvent to the queue.\n @queue << @clock.tick\n \n # Process all the events on the queue.\n @queue.each do |event|\n handle( event )\n end\n \n # Draw the ship in its new position.\n @ship.draw( @screen )\n \n # Refresh the screen.\n @screen.update()\n end", "def play_game\n @board.print_board\n until @quit || @restart || gameover?\n cell = take_turn(@current_player)\n if !cell.nil?\n coordinates = get_coordinates(cell)\n change_board(coordinates) if valid_cell?(coordinates)\n end\n @current_player = switch_player(@current_player)\n @board.print_board unless @restart || @quit\n end\n reset_board if @restart\n ending_screen if gameover?\n\n end", "def mark_position\n \t@game_board.print_board\n\t\tprintf \"Make your move: \"\n\t\tinput = gets.chomp\n\t\tfrom = input[0..1]\n\t\tto = input[2..3]\n\n\t\tuntil input.length == 4 && @game_board.update_board(from, to, @color)\n\t\t\tputs \"#{input} is either not a valid input or unavailable. Please try again.\"\n\t\t\tprintf \"Make your move: \"\n\t\t\tinput = gets.chomp\n\t\t\tfrom = input[0..1]\n\t\t\tto = input[2..3]\n\t\tend\n end", "def start_game\n loop do\n display_board\n turn\n position_available ? player_positions : turn\n (display_board; p \"#{@player} wins!\"; break) if win_game\n (display_board; p \"Draw\"; break) if draw\n next_player\n end\n end", "def play\n loop do\n prep_game\n loop do\n current_player_moves\n break if board.someone_won? || board.full?\n board.clear_screen_and_display_board(players) if human_turn?\n end\n display_result\n break unless play_again?\n reset\n end\n display_goodbye_message\n end", "def move(direction) \n # Exit map check\n if direction == 'up' && @pos_y == 2 && @pos_x == 1\n ProfBirchHome.new(@player, 'top').begin\n # If interacting with Prof Birch Child in first time instance, do a speech & animation\n elsif @player.profbirchhomeupstairs == 'first' \n if (direction == 'up' && @pos_y == 8 && @pos_x == 3) || (direction == 'right' && @pos_y ==7 && @pos_x == 2) || (direction == 'left' && @pos_x == 2 && @pos_y == 9)\n slowly(\"POKEMON fully restored!\\nItems ready, and... Huh?\")\n reset_map\n slowly(\"Huh? Who... Who are you?\")\n reset_map\n slowly(\"... ... ... ... ... ... ... ...\\n... ... ... ... ... ... ... ...\")\n reset_map\n slowly(\"Oh, you're #{ @player.name }.\\nSo your move was today.\")\n reset_map\n slowly(\"Um... I'm #{ @player.other_name }.\\nGlad to meet you!\")\n reset_map\n slowly(\"I...\\nI have this dream of becoming friends\")\n slowly(\"with POKEMON all over the world.\")\n reset_map\n slowly(\"I... I heard about you, #{ @player.name }, from\\nmy dad, PROF. BIRCH.\")\n reset_map\n slowly(\"I was hoping that you would be nice,\\n#{ @player.name }, and that we could be friends.\")\n reset_map\n slowly(\"On, this is silly, isn't it?\\nI... I've just met you, #{ @player.name }.\")\n reset_map\n slowly(\"Eheheh...\")\n reset_map\n slowly(\"Oh, no! I forgot!\")\n reset_map\n slowly(\"I was supposed to go help Dad catch\\nsome wild POKEMON!\")\n reset_map\n slowly(\"#{ @player.name }, I'll catch you later!\")\n @map[2][8] = 'S'\n if @pos_y != 7\n print_map\n @map[2][7] = 'other_icon'\n reset_map 0.5\n @map[2][7] = 'S'\n @map[2][6] = 'other_icon'\n reset_map 0.5\n else\n @map[3][8] = 'other_icon'\n reset_map 0.5\n @map[3][8] = 'S'\n @map[3][7] = 'other_icon'\n reset_map 0.5\n @map[3][7] = 'S'\n @map[3][6] = 'other_icon'\n reset_map 0.5\n @map[3][6] = 'S'\n @map[2][6] = 'other_icon'\n reset_map 0.5\n end\n @map[2][6] = 'S'\n @map[2][5] = 'other_icon'\n reset_map 0.5\n @map[2][5] = 'S'\n @map[2][4] = 'other_icon'\n reset_map 0.5\n @map[2][4] = 'S'\n @map[2][3] = 'other_icon'\n reset_map 0.5\n @map[2][3] = 'S'\n @map[2][2] = 'other_icon'\n reset_map 0.5\n @map[2][2] = 'S'\n @map[1][2] = 'other_icon'\n reset_map 0.5\n @map[1][2] = 'S'\n reset_map 0.5\n @player.profbirchhomeupstairs = 'second'\n @player.littleroot = 'third'\n end\n end\n super\n end", "def make_move(move_array)\n if move_array == ['F']\n puts ''\n puts 'Enter flag row, col: '\n print '> '\n\n begin\n flag_coord = gets.chomp.strip.split(',').map(&:to_i)\n if !in_bounds?(flag_coord[0], flag_coord[1])\n raise ArgumentError, 'Entered OOB flag coordinates!'\n else\n @board[flag_coord[0]][flag_coord[1]].toggle_flag\n end\n rescue => e\n puts e\n end\n else\n if !in_bounds?(move_array[0], move_array[1])\n puts 'Entered OOB coordinates!'\n else\n move = @board[move_array[0]][move_array[1]]\n move.toggle_visibility\n if move.is_a_mine?\n render\n puts 'You lose!'\n exit\n end\n autoclear(move_array[0], move_array[1]) if move.adjacent_mines == 0\n end\n end\n end", "def draw\n\t\t# \n\t\t# Clear the screen.\n\t\t#\n\t\tprint \"\\e[2J\"\n\n\t\tif not @animate\n\n\t\t\t# \n\t\t\t# Move to upper left and defer to superclass.\t\t\t\n\t\t\t#\n\t\t\tprint \"\\e[H\"\n\t\t\tsuper()\n\n\t\telse\n\t\t\t#\n\t\t\t# If we are animating, clear the screen and start carving!\n\t\t\t#\n\t\t\tcarve_passages\n\t\tend\n\tend", "def update_snake_direction\n if Gosu.button_down?(Gosu::KB_RIGHT) && @snake.direction != \"left\"\n @snake.direction = \"right\"\n elsif Gosu.button_down?(Gosu::KB_DOWN) && @snake.direction != \"up\"\n @snake.direction = \"down\"\n elsif Gosu.button_down?(Gosu::KB_LEFT) && @snake.direction != \"right\"\n @snake.direction = \"left\"\n elsif Gosu.button_down?(Gosu::KB_UP) && @snake.direction != \"down\"\n @snake.direction = \"up\"\n end\n end", "def play\n \n puts \"#{current_player.to_s} has randomly been selected as the first player\"\n puts \"pls enter a number between 1 and 9 to make your move\"\n\n board.formatted_grid\n \n invalid_stdout = \"Ignoring this invalid step, pls try again.\"\n while human_move = gets.chomp\n valid_step = false\n if human_move =~ /\\d/ #only 1-9 number\n x, y = human_move_to_coordinate(human_move)\n valid_step = board.set_cell(x, y, current_player)\n end\n \n #ignore those invalid steps\n unless valid_step \n puts invalid_stdout\n next\n end\n\n if board.game_over\n puts game_over_message\n # board.formatted_grid\n return\n else\n switch_players\n puts solicit_move\n end\n end\n end", "def show_draw\n puts 'No more avalaible spaces, consider it a draw'\n puts 'The game will be re-started'\n puts 'loading................'\n puts 'Press any key to continue'\nend", "def game_turns\n system(\"clear\")\n until @game.game_over?\n # render both boards\n puts \"COMPUTER BOARD\".center(40, \"=\") # change this to make it dynamic according to board size\n puts @game.computer_board.render\n puts \"PLAYER BOARD\".center(40, \"=\")\n puts @game.player_board.render(true)\n # instruct player to enter coordinate to shoot\n puts \"Enter the coordinate for your shot:\"\n # get user input\n user_input = nil\n loop do\n user_input = gets.chomp.upcase\n if @game.computer_board.valid_coordinate?(user_input) && !@game.computer_board.cell_fired_upon?(user_input)\n @game.computer_board.fire_upon_cell(user_input)\n break\n elsif @game.computer_board.valid_coordinate?(user_input) && @game.computer_board.cell_fired_upon?(user_input)\n puts \"You already fired upon that coordinate. Please try again:\"\n else\n puts \"That was not a valid coordinate. Use the syntax: A1\"\n end\n end\n # computer randomly fires at player board\n if @game.computer_hunting == true\n # randomly select an adjacent coord to previous hit\n chosen_adjacent_shot = @game.player_board.adjacent_coords(@game.most_recent_hit).sample\n @game.player_board.fire_upon_cell(chosen_adjacent_shot)\n @game.player_board.previous_computer_shot = chosen_adjacent_shot\n else\n @game.player_board.fire_upon_random_cell\n end\n # computer checks result of shot to see if it should be hunting nearby\n if @game.player_board.cells[@game.player_board.previous_computer_shot].render == \"H\"\n @game.computer_hunting = true\n @game.most_recent_hit = @game.player_board.previous_computer_shot\n elsif @game.player_board.cells[@game.player_board.previous_computer_shot].render == \"X\"\n @game.computer_hunting = false\n end\n # display results of both players' shots\n puts \"Your shot on #{user_input} #{@game.computer_board.shot_result(user_input)}.\"\n puts \"My shot on #{@game.player_board.previous_computer_shot} #{@game.player_board.shot_result(@game.player_board.previous_computer_shot)}.\"\n end\n end", "def play_round\n take_turn\n puts \"Current word: #{@fragment}\"\n if losses(current_player) == true\n record(current_player)\n score_board\n end\n next_player!\n end", "def start_game\n\n puts \"Who is playing as red?\"\n player_one = gets.chomp\n puts \"\\nWho is playing as blue?\"\n player_two = gets.chomp\n new_game = Gameboard.new(player_one, player_two)\n\n while new_game.game_live\n new_game.make_move\n end\n\n # Prompt to return to main menu\n return_prompt\nend", "def play_round\n unless @continuing_saved_game == true\n reset_round_stats\n set_word_arrays\n end\n show_round_status # @continuing_saved_game reset to false here\n until @round_over\n guess = guess_letter\n break if guess == \"SAVE\" || guess == \"EXIT\"\n update_round(guess)\n check_round_over?\n update_score if @round_over == true\n show_round_status\n end\n end", "def start_game\n # Infinite loop\n while\n # Draw the board on the terminal\n @board.print_board\n # Ask the player to choose where to draw the symbol\n @active_player.choose_spot\n # Check if the current player won\n if @board.check_win(@active_player.player_symbol)\n @board.print_board\n puts 'Has ganado'\n @active_player.victory\n # Ask if the player wants to play again\n play_again\n # If not, the loop is broken\n break\n else\n # Check if there is a draw\n if @board.check_draw\n puts 'Empate'\n play_again\n break\n end\n # If there isn't a draw the game switch the current player\n switch_player\n end\n end\n end", "def game_loop\n\t\tuntil @board.check_for_winner || @board.no_more_moves\n\t\t\tputs \"Player #{@next_player.token}, it's your turn.\"\n\t\t\tputs @board\n\t\t\tplay_legal_location\n\t\t\tswitch_player\n\t\tend\n\t\tputs @board\n\t\tputs \"Game over!\"\n\t\tif @board.check_for_winner\n\t\t\tputs \"#{@board.check_for_winner} won\"\n\t\telse\n\t\t\tputs \"It's a tie\"\n\t\tend\n\tend", "def move\n # removing first element from the snake body\n unless @is_growing\n # list.shift removes the first element within a list\n @positions.shift\n end\n # after growing, snake should stop growing, it grows one at a time\n @is_growing = false\n # reading direction\n case @direction\n when 'down'\n # push insert an element in last position of the list\n # adding one to y in snake head\n @positions.push([head[0],\n (head[1] + 1) % GRID_HEIGHT])\n when 'up'\n @positions.push([head[0],\n (head[1] - 1) % GRID_HEIGHT])\n when 'left'\n @positions.push([(head[0] - 1) % GRID_WIDTH,\n head[1]])\n when 'right'\n @positions.push([(head[0] + 1) % GRID_WIDTH,\n head[1]])\n else\n puts 'error: another key inside case else'\n end\n end", "def update\n if @board.recheck\n #@board.compact_pieces\n @board.clear_matches\n elsif @board.pieces_removed != 0\n adjust_score(@board.pieces_removed)\n @board.pieces_removed = 0 \n #end game if no legal moves left \n if not @board.any_moves?\n stop_anim\n stop_update\n stop_timer\n @game_over = true\n draw\n $app.alert(\"Game over: no more moves\")\n end \n end\n #end game if out of time\n if @time_remaining && (@time_remaining < 0)\n stop_anim\n stop_update\n stop_timer\n @game_over = true\n draw\n $app.alert(\"Game over: out of time.\") \n end\n end", "def draw\n o = 0\n # repeats the proces n times so as to print every row in the array\n @board.size.times do\n print @board[o, 1]\n puts\n o += 1\n end\n puts \"\\nPress 'q' to exit or the WASD keys to move\"\n end", "def draw\n opacity = 0.4\n @position.reverse.each do |pos|\n opacity *= 0.8\n Square.new(x: pos[0] * GRID_SIZE, y: pos[1] * GRID_SIZE, size: NODE_SIZE, color: @snake_color, z: @z) # the regular snake\n Square.new(x: pos[0] * GRID_SIZE, y: pos[1] * GRID_SIZE, size: NODE_SIZE, color: 'white' , opacity: opacity, z: @z + 1) # a lighting effect\n end\n end", "def play\n game_introductions\n\n loop do\n set_markers_and_first_mover\n\n loop do\n clear_screen_and_display_board\n loop_of_player_moves\n display_result\n break if someone_won_match?\n display_play_again_message\n reset\n end\n\n clear\n display_champion\n break unless rematch?\n reset_game_data\n end\n\n display_goodbye_message\n end", "def play_round\n puts @game_word + \"\\n\\n\"\n guess = @curr_player.get_guess\n if correct_guess?(guess)\n @curr_player.correct_guesses += [guess]\n else\n @curr_player.guesses_remaining -= 1\n @curr_player.incorrect_guesses += [guess]\n end\n puts \"#{@curr_player.name}'s' incorrect guesses: #{@curr_player.incorrect_guesses}\"\n puts \"#{@curr_player.name}'s guesses remaining: #{@curr_player.guesses_remaining}\"\n puts \"#{@curr_player.name}'s available points: #{@curr_player.correct_guesses.length * @secret_word.length}\"\n puts \"#{@curr_player.name}'s flower: \"\n puts File.read(\"flower#{@curr_player.guesses_remaining}.txt\")\n puts \"_____________________________________\"\n puts \"\\n\\n\"\n @curr_player_index = (@curr_player_index + 1) % 2\n @curr_player = @players[@curr_player_index]\n end", "def play_game\n puts \"Welcome to Tic Tac Toe (#{@dim} x #{@dim})!\"\n catch :game_end do\n while(moves)\n print_board\n @players.each do |player|\n # p moves\n square_number = player.move(moves)\n set_move(player, square_number)\n # Checks if player just won with their last move\n if(won?(player, square_number))\n print_board\n display_win_message(player)\n throw :game_end\n end\n end\n end\n puts \"Amazing, a tie game!\"\n throw :game_end\n end\n\n print \"Do you want to play again? [y/n] \"\n answer = gets.chomp\n if(answer[0] == \"y\" || answer[0] == \"Y\")\n clear_board\n print_board\n play_game\n else\n puts \"Bye!\"\n end\n end", "def display_game_board(player)\r\n \r\n move = \"\" #Assign a default value\r\n \r\n loop do #Loop forever\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n #Display the game board\r\n puts \"\\t\\t\\tWelcome to the Ruby Tic-Tac-Toe Game! \" +\r\n \"\\n\\n\\n\\n\"\r\n puts \"\\t\\t\\t 1 2 3\\n\" \r\n puts \"\\t\\t\\t | |\"\r\n puts \"\\t\\t\\t A #{$A1} | #{$A2} | #{$A3}\"\r\n puts \"\\t\\t\\t | |\"\r\n puts \"\\t\\t\\t ---------------------\"\r\n puts \"\\t\\t\\t | |\"\r\n puts \"\\t\\t\\t B #{$B1} | #{$B2} | #{$B3}\"\r\n puts \"\\t\\t\\t | |\"\r\n puts \"\\t\\t\\t ---------------------\"\r\n puts \"\\t\\t\\t | |\"\r\n puts \"\\t\\t\\t C #{$C1} | #{$C2} | #{$C3}\"\r\n puts \"\\t\\t\\t | |\"\r\n \r\n #Prompt the player to enter a move\r\n print \"\\n\\n\\n\\n\\nPlayer \" + player + \"'s turn. \" +\r\n \"Please enter your move: \"\r\n \r\n move = STDIN.gets #Collect the player's move\r\n move.chop! #Remove the end of line marker\r\n move = move.upcase #Convert to uppercase\r\n\r\n #user enters \"H\" as hidden cheat to display statistics\r\n if move == \"H\"\r\n puts display_statistics\r\n end\r\n\r\n #user enters \"M\" to load wikipedia instructions page\r\n if move == \"M\"\r\n puts display_wikipedia\r\n end\r\n\r\n #Terminate the loop if a valid move was entered\r\n if move.length == 2 then #Must be at 2 character long\r\n if move =~ /[A-C][1-3]/i #Must be A1, A2, A3, B1, \r\n #B2, B3, C1, C2, or C3\r\n #Call method responsible for determining if the \r\n #board square was available \r\n validMove = validate_player_move(move) \r\n if validMove == true #The move was valid \r\n break #Terminate the execution of the loop\r\n else\r\n #display_error method\r\n display_error\r\n end\r\n else\r\n #display_error method\r\n display_error\r\n end\r\n else\r\n #display_error method\r\n display_error\r\n end\r\n\r\n end\r\n \r\n return move #Return the player's move back to the\r\n #calling statement\r\n \r\n end", "def play\n start = Time.now\n until @board.won?\n @player ? round_player : round_ai\n @attempts += 1\n sleep(2)\n system(\"cls\")\n @board.render\n end\n finish = Time.now\n time_to_finish = finish - start\n declare_win(time_to_finish)\n end", "def update_standings\n system(\"clear\")\n puts \"#{previous_player} spelled #{fragment}.\"\n puts \"#{previous_player} gets a letter!\"\n\n losses[previous_player] += 1\n\n if losses[previous_player] == MAX_LOSS_COUNT\n puts \"#{previous_player} has been eliminated!\"\n end\n\n display_standings\n\n sleep(2)\n end", "def play_game\n @player = ask_for_player\n position = Board.new\n while !position.end?\n puts position\n puts\n idx = @player == \"human\" ? ask_for_move(position) : position.best_move\n position.move(idx)\n @player = other_player\n end\n puts position\n if position.blocked?\n puts \"tie\\nDo you want to play again?\"\n puts \"Y/n\"\n ans = gets.chomp\n return replay_game if ans == \"Y\"\n puts \"Thanks for play our game\" if ans == \"n\"\n else\n puts \"winner: #{other_player}\\nDo you want to play again?\"\n puts \"Y/n\"\n ans = gets.chomp\n return replay_game if ans == \"Y\"\n puts \"Thanks for play our game\" if ans == \"n\"\n end\n end", "def play_game\n loop do\n @turn += 1\n puts '########################################'\n puts \"Turn #{@turn}:\"\n puts '########################################'\n @players.each do |p|\n puts ''\n p.turn\n next unless !@is_final_round && p.score >= 3000\n @is_final_round = true\n final_round(p)\n break\n end\n\n break if @is_final_round\n end\n end", "def play_round\n @fragment = \"\"\n welcome\n\n until round_over?\n take_turn\n next_player!\n end\n\n update_standings\n end", "def after_battle_effect\n case $game_process\n when 0\n framed_narration('After having a quick break in the tent, you felt refreshed.(HP restored)')\n @player[:hp] = 45\n when 1\n framed_narration('You had a BBQ around the campfire and felt energised to move on. (HP restored)')\n @player[:hp] = 45\n when 2\n framed_narration('Donkey Kong fainted, and the illusion of the Jungle was expelled.')\n next_line\n framed_narration('Congrats! you have completed the game!')\n next_line\n framed_narration('Thanks for playing! See you in the future!')\n next_line\n framed_narration('-- Mark Huang')\n exit\n end\n end", "def game_round\n phrases = @phrasearr.dup\n @difficulty[3].times do\n clear\n phrase = selector(phrases)\n display_to_user(phrase)\n phrases = deleter(phrase, phrases)\n end\n\n clear\n prompt = selector(@promptarr)\n display_to_user(prompt)\n input = timed_input\n print @cursor.hide\n scorer(checker(input, prompt))\n deleter(prompt, @promptarr)\n\n check_score\n end", "def play\n welcome\n loop do\n #lines 17-19 are my favorite\n until @game_board.drop_token(@current_player.get_move_column,@current_player.game_token) do \n puts \"Column full! Please choose another column!\"\n binding.pry\n print \">\"\n end\n @game_board.board_render\n swap_players\n end\n end", "def player_move\n\t \tvalid_move = false\n\t \twhile !valid_move\n\t \t\tdisplay_game\n\t \t\trow_choice = 0\n\t \t\tstick_choice = 0\n\t\t # get the user selections\n\t\t valid_input = false\n\t\t puts \"Enter the row (1-#{@current_config.length}): \"\n\t\t row_choice = gets.chomp.to_i - 1\n\t\t puts \"Enter the number of sticks (1-#{@current_config[row_choice]}): \"\n\t\t stick_choice = gets.chomp.to_i \n\t\t valid_move = validate_move row_choice, stick_choice, true # validate selections\n\t \tend\n\tend", "def start\r\n initialize_game\r\n until @game.over?\r\n take_turn\r\n end\r\n print_outcome\r\n end", "def start_game\n new_game = Game.new\n\n return statuses('You did not press 1') if welcome == false\n\n new_game.set_players\n\n # maximum number of moves a player can make\n\n gameon = true\n\n while gameon\n new_game.new_board.clear_board\n maximum_moves = 9\n loop do\n statuses('Let the game begin') if maximum_moves == 9\n\n current_player = ''\n\n # displays current board state\n display_board(new_game.new_board.my_board)\n\n if maximum_moves.even?\n # signifies first players turn to play in loop thus ensuring each loops per player\n current_player_id = new_game.player1.player_id\n current_player = new_game.player1.player_name\n else\n current_player_id = new_game.player2.player_id\n current_player = new_game.player2.player_name\n end\n\n position = enter_position(current_player, current_player_id)\n new_game.new_board.input_position(position, current_player_id)\n\n # checks for true in results\n if new_game.new_board.results\n display_board(new_game.new_board.my_board)\n statuses(\"#{current_player} has won\")\n break\n end\n\n statuses('The game is a draw') if maximum_moves == 1\n\n break if maximum_moves == 1\n\n maximum_moves -= 1\n end\n statuses('Press N to start a new game or any key to quit ')\n choice = gets.chomp.downcase\n gameon = choice == 'n'\n end\nend", "def move\n if $window.button_down?(Gosu::KbD)\n @facing = :right\n @x += speed unless out_of_bounds?(@x + speed, @y)\n end\n \n if $window.button_down?(Gosu::KbA)\n @facing = :left\n @x -= speed unless out_of_bounds?(@x - speed, @y)\n end\n \n if $window.button_down?(Gosu::KbW)\n @facing = :up\n @y -= speed unless out_of_bounds?(@x, @y - speed)\n end\n \n if $window.button_down?(Gosu::KbS)\n @facing = :down\n @y += speed unless out_of_bounds?(@x, @y + speed)\n end\n \n sprinting?\n end", "def finish\n\t\t@frame = @frame + 1\n\t\tdone = false\n\t\tif @frame % 120 == 0 \n\t\t\tdone = !@dialogueText.next\n\t\tend\n\t\tif done\n\t\t\t@frame = 0\n\t\t\t@nextGameState = @map\n\t\telse\n\t\t\t@dialogueText.draw\n\t\tend\n\tend", "def play\r\n\r\n # loop that runs until puzzle is solved\r\n b = Board.new\r\n\r\n b.populate_array(\"sudoku1.txt\")\r\n\r\n # inside loop:\r\n until b.solved?\r\n # clear screen\r\n system \"clear\"\r\n # ascii title splash\r\n b.splash \r\n # render board\r\n b.render\r\n # get position and value from the player, update position and value\r\n b.update_position\r\n end\r\n\r\n end", "def run_game\n\t\tif @player_turn == nil\n\t\t\tputs \"white team name:\"\n\t\t\ta = gets.chomp\n\t\t\tputs \"black team name:\"\n\t\t\tb = gets.chomp\n\t\tend\n\t\t@player1 = Player.new(:white, a)\n\t\t@player2 = Player.new(:black, b)\n\t\t@player_turn == nil ? player_turn = @player1 : player_turn = @player_turn\n\t\t@check == nil ? check = false : check = @check\n\t\t#If there are no possible moves, either checkmate or stalemate\n\t\twhile @board.any_possible_moves?(player_turn.color, check)\n\t\t\t\n\t\t\t@check = check\n\t\t\t@player_turn = player_turn\n\n\t\t\tchoose_move(player_turn, check)\n\t\t\t\n\t\t\tcheck = @check\n\t\t\tplayer_turn = @player_turn\n\t\t\t\n\t\t\tif @viable_move == true\n\t\t\t\tplayer_turn = switch_player(player_turn)\n\t\t\t\t@board.turn_off_en_passant(player_turn.color)\n\t\t\tend\n\t\t\t@board.cause_check(player_turn.color, check) == true ? check = true : check = false\n\t\tend\n\t\t#Decides end of game: checkmate or stalemate\n\t\tif check == true\n\t\t\t@board.display(player_turn, check)\n\t\t\tprint \"#{player_turn.name} can no longer make a move! CHECKMATE! \\n\"\n\t\t\tprint \"#{switch_player(player_turn).name} WINS!!!\"\n\t\telse\n\t\t\tprint \"This contest ends in a stalemate.\"\n\t\tend\n\tend", "def update_graphics\n case @animation_state\n when 0\n animation_phase_1\n when 1\n if $pokemon_party.nuzlocke.enabled? && !@graveyard.empty?\n animation_phase_2\n else\n @animation_state += 1\n end\n when 2\n animation_phase_3\n when 3\n # Every animation is finished so there's only two things to update\n update_turning_ball\n update_end_stars_anim\n end\n end", "def play_turn\n board.render\n pos = get_pos\n decision = get_decision\n if decision == \"r\"\n board.reveal(pos)\n elsif decision == \"f\"\n board.flag(pos)\n else\n @saved_board = board.to_yaml\n end\n end", "def turn \n\t\tputs \"\"\n\t\tputs current_player + \", Enter a square to take:\"\n\t\tindex = gets.strip\n\t\tindex = input_to_index(index)\n\t\tif valid_move?(index)\n\t\t\tmove(index, current_player)\n\t\telse \n\t\t\tputs \"Invald space, try again\" \n\t\tend\n\tend", "def run\n while(!@game_over)\n valid_input = false\n input_column = -1\n \n display_board\n puts \">>> Player #{@player}'s turn.\"\n \n # Repeatedly prompts the user for input until valid input is given\n while(!valid_input)\n input_column = prompt\n \n # Requests input again if the input given is invalid\n valid_input = true if((0..6).include? input_column)\n if(!valid_input)\n puts \"Invalid input! Please try again.\"\n next\n end\n \n # Requests input again if the specified column is already full\n valid_insertion = insert_at(input_column, @player)\n if(!valid_insertion)\n puts \"\\nERROR: The column is already full! Please try again.\" \n valid_input = false\n end\n end\n \n # Check to see if game is won\n break if(win_condition_met?(@player))\n \n # Swap players after each turn\n if(@player == 1)\n @player = 2\n elsif(@player == 2)\n @player = 1\n end\n \n end\n \n display_board\n puts \">>> Player #{@player} has won!!! <<<\"\n end", "def move(forward)\n if @direction == \"N\"\n if @y + 1 < @@ymax\n @y += 1\n else\n puts \"Nice try sucker\"\n end\n elsif @direction == \"S\"\n if @y - 1 > @@ymin\n @y -= 1\n else\n puts \"Nice try sucker\"\n end\n elsif @direction ==\"E\"\n if @x + 1 < @@xmax\n @x += 1\n else\n puts \"Nice try sucker\"\n end\n elsif @direction == \"W\"\n if @x - 1 > @@xmin\n @x -= 1\n else\n puts \"Nice try sucker\"\n end\n else\n puts \"Where in the world are you?\"\n end\nend", "def read_turn\n ret=false\n rd=@stdin.gets.strip\n\n if rd=='end'\n #@turn_number=:game_over\n\n rd=@stdin.gets.strip\n _, players = *rd.match(/\\Aplayers (\\d+)\\Z/)\n @players = players.to_i\n\n rd=@stdin.gets.strip\n _, score = *rd.match(/\\Ascore (\\d+(?: \\d+)+)\\Z/)\n @score = score.split(' ').map{|s| s.to_i}\n\n ret=true\n else\n _, num = *rd.match(/\\Aturn (\\d+)\\Z/)\n @turn_number=num.to_i\n log \"Starting turn #{@turn_number}\"\n @start_time = Time.now.to_f\n end\n\n # reset the map data\n Square.reset!\n log \"Reset map data\"\n\n # update the expected position of each ant - as a side-effect,\n # also updates the Square -> Ant links\n Ant.advance_turn!\n log \"Advanced all ant positions\"\n\n until((rd=@stdin.gets.strip)=='go')\n _, type, row, col, owner = *rd.match(/(w|f|h|a|d) (\\d+) (\\d+)(?: (\\d+)|)/)\n row, col = row.to_i, col.to_i\n owner = owner.to_i if owner\n\n square = Square.at(row, col)\n\n case type\n when 'w'\n square.destroy!\n when 'f'\n if square.has_food?\n square.item.sense!\n else\n food = Food.new(square)\n log \"Sensed #{food}\"\n end\n when 'h'\n if square.has_hill?\n square.item.sense!\n else\n hill = Hill.new(owner, square)\n log \"Sensed #{hill}\"\n end\n when 'a', 'd'\n alive = (type == 'a')\n\n if owner == 0\n ant = square.ant\n\n if ant.nil?\n if square.has_hill? && square.item.mine?\n ant = Ant.new(square)\n log \"Sensed new #{ant}\"\n else\n # maybe a newborn ant, but I haven't received the hill message yet?\n # it looks like hill messages always come first, but that may not be guaranteed\n raise \"[BUG] no record of my ant at #{square}\"\n end\n else\n log \"Sensed exisiting #{ant}\"\n end\n\n ant.die! unless alive\n else\n if square.has_enemy_ant?\n square.item.sense!\n else\n enemy_ant = EnemyAnt.new(owner, square)\n log \"Sensed #{enemy_ant}\"\n end\n end\n when 'r'\n # pass\n else\n warn \"unexpected: #{rd}\"\n end\n end\n\n # clean up missing items\n Item.all.each(&:destroy_if_unsensed!)\n\n log \"Got go! signal from game\"\n\n return ret\n end", "def play\n player = 1\n\n welcome_comment\n\n while (check_game_end == false) do\n display\n puts \"Player #{player} turn: \"\n player_input = gets.chop\n while (!check_input(player_input)) do\n player_input = gets.chop\n end\n mark(player_input)\n #switch player after input\n player == 1 ? player += 1 : player -=1\n end\n\n display\n puts \"Game Over\"\n end", "def turn\n move_input = current_player.move\n if !board.valid_move?(move_input) # if #valid_move false\n puts \"That is not a valid move. Please try again.\\n\"\n turn\n else\n board.update(move_input,current_player)\n board.display\n end\n end", "def play\n\n @board.render(clear=true)\n until @board.won? \n\n # should call reveal two time\n guess_1 = @board.reveal # gonna get position guess from the user and return the value\n @board.render(clear=true)\n guess_2 = @board.reveal # gonna get position guess from the user and return the value\n @board.render(clear=true)\n \n if guess_1 == guess_2\n puts \"It's a match!\" \n else\n # reset the board - set all card to face_up == false\n puts \"Try Again!\"\n @board.reset \n end\n sleep 3\n \n @board.render(clear=true)\n end\n end", "def play\n until over?\n @board.display\n turn\n end\n @board.display\n puts draw? ? \"Cat's Game!\" : \"Congratulations #{winner}!\"\n end", "def play_out\n begin\n make_move(choose_move) until @minefield.clear?\n DISPLAY.call 'Victory!'\n rescue TrippedMineError\n DISPLAY.call 'Boom!'\n return false\n end\n true\n end", "def play\n \t@fragment = \"\"\n until @losses.keys.length == 1\n system(\"clear\")\n update_status\n play_round\n check_status\n puts \"Next round in 5 seconds...\".bold\n sleep(5)\n end\n final_status\n end", "def game_loop\n end", "def play\n puts\n puts \"How good is your memory? Let's play a memory game.\"\n puts \"Match the cards!\"\n puts\n sleep(3)\n until game_over?\n board.render\n #get_pos from the player\n begin \n make_guess(get_player_input)\n rescue => exception\n puts \"Select a card that hasn't been flipped\"\n retry\n end\n \n end\n puts \"I guess your memory is pretty good :D\"\n end", "def moveMan(oldX,oldY,newX,newY)\n @levelArr[newY][newX]='@'\n @levelArr[oldY][oldX]=' '\n #replace the box goals if they were overwritten by the above lines of code\n replenishBoxGoals\nend", "def update\n @player.shape.body.reset_forces\n\n 6.times do\n if button_down? Gosu::KbLeft or button_down? Gosu::GpLeft then\n @player.move_left\n end\n if button_down? Gosu::KbRight or button_down? Gosu::GpRight then\n @player.move_right\n end\n #if button_down? Gosu::KbUp or button_down? Gosu::GpRight then\n # @player.shape.body.a += 0.1\n #\n # puts @player.shape.body.a.inspect\n #end\n #if button_down? Gosu::KbDown or button_down? Gosu::GpRight then\n # @player.shape.body.a -= 0.1\n # puts @player.shape.body.a.inspect\n #end\n\n\n @space.step 1.0/10.0\n end\n end", "def play\n\t\tshow\n\t\twhile true\n\t\t\trow, col = input\n\t\t\tupdate row, col\n\t\t\tshow\n\n\t\t\tif is_a_winner?\n\t\t\t\tputs \"Player #{@player} won!\"\n\t\t\t\tbreak\n\t\t\telsif is_a_tie?\n\t\t\t\tputs \"Game is tied!\"\n\t\t\t\tbreak\n\t\t\tend\n\n\t\t\tswitch_players\n\t\tend\n\tend", "def move_from\r\n puts ''\r\n cols = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']\r\n rows = [1, 2, 3, 4, 5, 6, 7, 8]\r\n counter = 0; x = ''; y = ''\r\n until counter == 1\r\n print \"Enter starting coordinates: \" \r\n coordinate = STDIN.gets.chomp\r\n if coordinate == 'save' or coordinate == 'Save' or coordinate == 'S'\r\n save_game\r\n puts 'PROGRESS SAVED!'\r\n end\r\n if coordinate == 'exit' or coordinate == 'Exit' or coordinate == 'E'\r\n counter += 1\r\n save_game\r\n puts \"Exits and saves!\"\r\n throw :finish\r\n end\r\n x = coordinate[0]; y = coordinate[1].to_i\r\n counter+=1 if ((cols.include? x) && (rows.include? y))\r\n end\r\n start = []\r\n start[0] = cols.index(x)\r\n start[1] = rows.index(y)\r\n start \r\n end", "def update\n if @step_count == 20 # 3 times / s\n @board.step!\n @step_count = 0\n else\n @step_count += 1\n end\n end", "def turn\n\t\toutputStatus\n\t\tif @guesses_left < 10\n\t\t\tsaveGame if save?\n\t\tend\n\t\tletter = getLetter\n\t\tif checkLetter(letter)\n\t\t\treplaceLetter(letter)\n\t\telse\n\t\t\twrongGuess(letter)\n\t\tend\n\tend", "def play_round\n print_board\n\n until won?\n begin\n new_turn\n location = gets.chomp\n\n # End the game if the player inputs it\n return -1 if %w[quit exit q].include?(location)\n\n next unless validate_location(location)\n rescue OccupiedSlotError\n puts \"#{location} is already filled. Please choose another location.\"\n\n # Increment to let the same player try again.\n increment_player_idx\n retry\n ensure\n print_board\n end\n\n next unless @free_slots.zero? && !won?\n\n puts \"Looks like it's a draw! Press enter to play again.\"\n clear_board\n next\n end\n\n # Reset the board at the end of the game\n clear_board\n\n # Increment the number of games played\n @num_games_played += 1\n\n # Increment score and return winning player\n @players[@current_player_idx].increment_score\n @players[@current_player_idx]\n end", "def play\n over = false\n\n until over\n display_score\n @board.render\n @guesses = []\n prompt\n if same_card?(@guesses[0], @guesses[1])\n puts \"you got it! Go again!\"\n @guesses[0].reveal_card\n @guesses[1].reveal_card\n @score[current_player] += 1\n else\n @guesses[0].hide\n @guesses[1].hide\n puts \"you suck! Go #{previous_player} is up.\"\n next_player!\n end\n\n\n over = true if board.won?\n end\n end", "def play_game\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n #Call on the method responsible for collecting the player's move\r\n playerMove = get_player_move\r\n \r\n #Call on the method responsible for generating the computer's move\r\n computerMove = get_computer_move\r\n \r\n #Call on the method responsible for determining the results of the game\r\n result = analyze_results(playerMove, computerMove)\r\n \r\n #Call on the \r\n gameCount = game_count\r\n\r\n #Call on the method responsible for displaying the results of the game\r\n display_results(playerMove, computerMove, result)\r\n \r\n end", "def play_game\n\tputs \"debug: in play_game\"\n\n\tplayer_hand = []\t\t\t# Contains the player's cards\n\tdealer_hand = []\t\t\t# Contains the dealer's cards\n\n\t# Reset the deck\n\t$card_deck = $cards.keys\t\n\t#puts card_deck\n\n\t# Deal the cards\n\tdeal_cards(player_hand, dealer_hand)\n\tdealer_turn = false\n\n\tdisplay_hands(player_hand, dealer_hand, dealer_turn)\n\n\twhile true\t# Play until the game is over\n\t\tcommand = get_user_command(game_started=true)\n\n\t\tcase command\n\t\twhen 'H'\n\t\t\t# Deal another card\n\t\t\tdeal_card(player_hand)\n\t\t\n\t\twhen 'S'\n\t\t\t# Player is done betting\n\t\t\tplay_dealer_hand(dealer_hand)\n\t\tend\n\tend\n\nend", "def run\n start_key = self.display_instructions\n exit if start_key.downcase == \"q\"\n self.play_round until @board.won? || @board.lost?\n @board.lost? ? self.display_loss : self.display_win\n end", "def game_loop\n end", "def game_play\n find_word\n board\n load_game?\n if @confirm != 'y'\n game_intro\n end \n until game_end? || @incorrect_guess == 8 \n #p @the_word\n guess\n incorrect_guess?\n hang_man_figure\n update_board\n save?\n end\n if game_end? != true\n puts \"\\n\" * 100\n hang_man_figure\n update_board\n puts \"SORRY, YOU LOST!!\" \n puts \"\\n\"\n puts \"The word was....#{@the_word.upcase}!!\"\n exit\n elsif game_end? == true\n puts \"\\n\" * 100\n hang_man_figure\n update_board\n puts \"OMG!\"\n puts \"#{@the_word.upcase} is the word!\"\n puts \"YOU WIN!!! =)\"\n puts \"******!*******!*****!*******!*****!*****!\"\n exit\n end\nend", "def menu game\n puts `clear`\n puts \"dBBBBb dB dBBBBBP dBBBBBP dBP dBBBBP dBBBBP dBP dBP dBP dBBBBBb\"\n puts \"dB dP BBB dBP dBP dBP dP dBP dBP dBP dBP dB BP\"\n puts \"dBBBK dBBBBB dBP dBP dBP dBBP `BBBBb dBBBBBP dBP dBBBP'\"\n puts \"dB db dBP BB dBP dBP dBP dP dBP dBP dBP dBP dBP\"\n puts \"dBBBBP' dBB BBB dBP dBP dBBBBP dBBBBP dBBBBP' dBP dBP dBP dBP\"\n puts\n game.show_board\n puts\n puts \" . Unknown * Hit [#{game.misses}] - Misses [#{game.hits}]\"\n puts\n puts \" MAIN MENU\"\n puts\n puts \"1 - New Game\"\n puts !game.showship ? \"2 - Show Ships (CHEATER!)\" : \"2 - Hide Ships\"\n puts \"3 - build ship\"\n puts \"99 - Exit this App\"\n puts \"A..Z## ( A-J is Column 1-10 Row) Shoot at Ship\"\n puts\n print \"Enter Menu Choice[1..2 99 ]:\"\n\n return gets.chomp\n end", "def game_loop(game, word)\n game.update_screen(word)\n\n until game.correct_positions.all? { |position| position == true }\n special_result = game.read_and_validate_input(word)\n break if special_result == 'QUIT'\n\n if special_result == 'SAVE'\n game.save_game(word)\n break\n end\n\n if special_result == 'WORD'\n correct = game.guess_word(word)\n if correct\n puts \"\\n\\nCongratulations! You won!\"\n game.update_screen(word, true)\n break\n else\n puts \"\\nYou were wrong :(\"\n game.update_screen(word)\n next\n end\n end\n\n if special_result == 'GAMEOVER'\n puts \"\\n\\nYour man has fallen to his doom :(\"\n puts \"The Word was #{word}\\n\"\n puts 'Game over..'.red\n break\n end\n\n system('clear')\n game.update_screen(word)\n end\nend", "def turn\n input = current_player.move(board)\n\n if board.valid_move?(input)\n board.update(input, current_player)\n board.display\n else\n turn\n end\n end", "def play_game\n puts \"---------------------------------------------\"\n puts \"-----EVEN AND ODDS: A coin matching game-----\" \n puts \"---------------------------------------------\"\n puts \"----Given the string: HHHHHTTTTT, can you----\"\n puts \"----successfully move pairs of letters to----\"\n puts \"----change the string into the following:----\"\n puts \"----------HTHTHTHTHT or THTHTHTHTH-----------\"\n puts \"---------------------------------------------\"\n puts \"--------Here's the initial string:-----------\"\n puts \"---------------------------------------------\"\n puts \"\\n\\n\"\n 5.times{\n handle_input\n }\n check_win_condition\nend" ]
[ "0.67010206", "0.65362626", "0.6392625", "0.6264252", "0.6247824", "0.6225483", "0.6129233", "0.61152434", "0.61150825", "0.6097484", "0.6056181", "0.60507953", "0.60471624", "0.6033415", "0.60294855", "0.6014623", "0.6007933", "0.6002501", "0.5996959", "0.5987343", "0.59614754", "0.5956455", "0.5945665", "0.5943558", "0.5934967", "0.59319174", "0.5915985", "0.5903518", "0.5894463", "0.588542", "0.58838946", "0.5873187", "0.58678055", "0.58628106", "0.5862025", "0.5852848", "0.58433074", "0.5840712", "0.58357275", "0.58276695", "0.58243036", "0.5822063", "0.58073485", "0.5805318", "0.5796079", "0.5795657", "0.5794949", "0.5785702", "0.5765821", "0.5765395", "0.57590014", "0.5753245", "0.57504284", "0.57408977", "0.57373685", "0.57179934", "0.5709913", "0.5706593", "0.5705956", "0.57023895", "0.5700211", "0.5696102", "0.56917036", "0.5690855", "0.5690548", "0.5687284", "0.56843936", "0.56812745", "0.5661135", "0.5645899", "0.5644274", "0.56403136", "0.5639164", "0.5636437", "0.5635586", "0.56336427", "0.56323993", "0.56283647", "0.56201386", "0.5619812", "0.5617164", "0.56138974", "0.56135213", "0.5595966", "0.5590347", "0.5588803", "0.55867463", "0.5586362", "0.5584694", "0.5584467", "0.55836886", "0.55810475", "0.55762064", "0.55743897", "0.55681735", "0.556471", "0.5563369", "0.5562471", "0.5558132", "0.55523866" ]
0.8708741
0
This method only takes care of creating the new membership, please use Membershiprenew! directly.
def renew!(attrs = {}) unless Delivery.during_year(@fiscal_year).any? raise MissingDeliveriesError, 'Deliveries for the renewed fiscal year are missing.' end new_membership = Membership.new(renewed_attrs(attrs)) renew_complements(new_membership, attrs) if membership.basket_size_id != new_membership.basket_size_id new_membership.baskets_annual_price_change = nil new_membership.activity_participations_demanded_annualy = nil new_membership.activity_participations_annual_price_change = nil end if basket_complements_changed?(new_membership) new_membership.basket_complements_annual_price_change = nil end new_membership.save! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @membership = Membership.new(params[:membership])\n @membership.user_id = current_user.id\n if @membership.save\n end\n end", "def create\n @membership = @website.memberships.new(membership_params)\n @membership.user.no_password = true\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership, notice: 'Membership was successfully created.' }\n format.json { render action: 'show', status: :created, location: @membership }\n else\n format.html { render action: 'new' }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @pending_membership = PendingMembership.new(club_id: params[:user][:pending_membership][:club_id])\n\n params[:user].delete(\"pending_membership\")\n\n @user = User.new(params[:user])\n @possible_memberships = PendingMembership.where(user_email: @user.email)\n\n if @possible_memberships.length > 0 && @user.save\n new_user = User.last\n @membership = Membership.new\n @membership.user_id = new_user.id\n @membership.club_id = @possible_memberships.first.club_id\n @possible_memberships.first.destroy\n @membership.save\n session[:user_id] = @user.id\n redirect_to @user, notice: 'Account and membership successfuly created.'\n elsif @user.save\n @pending_membership.user_id = @user.id \n @pending_membership.user_first_name = @user.first_name\n @pending_membership.user_last_name = @user.last_name\n @pending_membership.user_email = @user.email\n @pending_membership.save\n UserMailer.admin_verification(@pending_membership).deliver\n UserMailer.welcome(@user).deliver\n session[:user_id] = @user.id\n redirect_to @user, notice: 'Account successfuly created.' \n else\n # needed for render 'new' in case of form errors \n @user.pending_memberships.build\n render action: \"new\"\n end\n end", "def create\n super\n resource.update(password: params[:password], password_confirmation: params[:password_confirmation], member_id: SecureRandom.alphanumeric(6))\n post_gmo_with_create_member(resource)\n end", "def create_membership\n member = Member.new(squad: @squad, user: current_user, membership: 'owner')\n member.save(validate: false)\n end", "def generate_membership\n Membership.create(taller_id: id, role_id: Role.propietario.id, usuario_id: owner_id, current: true)\n Role.administrador\n Role.operador\n Role.propietario\n end", "def create_membership_request\n member = Member.new(squad: @squad, user: current_user, membership: 'request')\n member.save(validate: false)\n end", "def create_invitiation_token\n membership_token = Membership.new_token\n update_attribute(:invitiation_token, membership_token)\n end", "def create\n\n @user = current_user\n if @user.is_admin? and not session[:express_token]\n # Make a new membership.\n @membership = Membership.new(membership_params)\n @membership.purchase_date = DateTime.now\n payment_complete = true\n else\n # Do the PayPal purchase\n payment_complete = false\n notice_message_for_user = \"Something went wrong, sorry!\"\n @user = current_user\n @membership = @user.memberships.build(:valid_from => (@user.last_membership.try(:expiry_date) or DateTime.now), :duration => session[:express_purchase_membership_duration], :purchase_date => DateTime.now)\n\n if session[:express_autodebit]\n # It's an autodebit, so set that up\n # 1. setup autodebit by requesting payment\n ppr = PayPal::Recurring.new({\n :token => session[:express_token],\n :payer_id => session[:express_payer_id],\n :amount => (session[:express_purchase_price] / 100),\n :ipn_url => \"#{payment_notifications_url}\",\n :currency => 'AUD',\n :description => session[:express_purchase_description]\n })\n response_request = ppr.request_payment\n logger.info \"XXXXXXXXXXXX\"\n logger.info response_request.to_json\n # raise \"Response denied\"\n logger.info \"XXXXXXXXXXXX\"\n\n if response_request.approved?# and response_request.completed?\n # 2. create profile & save recurring profile token\n # Set :period to :daily and :frequency to 1 for testing IPN every minute\n ppr = PayPal::Recurring.new({\n :token => session[:express_token],\n :payer_id => session[:express_payer_id],\n :amount => (session[:express_purchase_price] / 100),\n :currency => 'AUD',\n :description => session[:express_purchase_description],\n :frequency => session[:express_purchase_membership_duration], # 1,\n :period => :monthly, # :daily,\n :reference => \"#{current_user.id}\",\n :ipn_url => \"#{payment_notifications_url}\",\n :start_at => (@membership.valid_from + session[:express_purchase_membership_duration].months), # Time.now\n :failed => 1,\n :outstanding => :next_billing\n })\n\n response_create = ppr.create_recurring_profile\n if not(response_create.profile_id.blank?)\n @membership.paypal_profile_id = response_create.profile_id\n # If successful, update the user's membership date.\n # update_membership_expiry_date\n # Reset refund if they had one in the past\n @membership.refund = nil\n\n # TODO: Background task\n # TODO: Check paypal recurring profile id still valid\n # TODO: Setup future update_membership_expiry_date\n\n # Save the PayPal data to the @membership model for receipts\n save_paypal_data_to_membership_model\n payment_complete = true\n else\n # Why didn't this work? Log it.\n logger.warn \"create_recurring_profile failed: #{response_create.params}\"\n end\n else\n # Why didn't this work? Log it.\n logger.warn \"request_payment failed: #{response_request.params}\"\n notice_message_for_user = response_request.params[:L_LONGMESSAGE0]\n raise \"Request payment failed\"\n end\n else\n # It's a single purchase so make the PayPal purchase\n response = EXPRESS_GATEWAY.purchase(session[:express_purchase_price], express_purchase_options)\n\n if response.success?\n # If successful, update the user's membership date.\n # update_membership_expiry_date\n logger.info \"Paypal is happy!\"\n save_paypal_data_to_membership_model\n payment_complete = true\n else\n # The user probably hit back and refresh or paypal is broken.\n logger.info \"Paypal is sad.\"\n logger.warn response.params\n notice_message_for_user = response.message\n # redirect_to user_path(current_user), notice: response.message\n # return\n end\n end\n\n end\n\n respond_to do |format|\n if payment_complete and @membership.save\n format.html { redirect_to user_path(@user), notice: 'Membership was successfully created.' }\n format.json { render action: 'show', status: :created, location: @membership }\n else\n logger.info \"Uh oh, couldn't save.......\"\n raise \"couldn't save.\"\n format.html { render action: 'index', notice: @membership.errors }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # TODO: test if \"user_established_at\" and \"network_established_at\" can be hacked (ie: set) through API calls,\n # thereby creating memberships that are already 'accepted' at creation.\n user = User.find_by_id(params[:membership][:user_id])\n if user.nil?\n render_404(\"User not found.\")\n elsif !Membership.find_by_user_id_and_network_id(params[:membership][:user_id], params[:membership][:network_id]) ||\n Network.find(params[:membership][:network_id]).owner?(user)\n\n @membership = Membership.new(params[:membership])\n\n @membership.user_established_at = nil\n @membership.network_established_at = nil\n if @membership.message.blank?\n @membership.message = nil\n end\n \n respond_to do |format|\n\n if @membership.save\n # Take into account network's new member policy setting\n if (@membership.network.open?)\n @membership.accept!\n \n begin\n user = @membership.user\n network = @membership.network\n Notifier.deliver_auto_join_group(user, network, base_host) if network.administrators(true).any? {|a| a.send_notifications?}\n rescue\n logger.error(\"ERROR: failed to send email notification for auto join group. Membership ID: #{@membership.id}\")\n end\n \n flash[:notice] = 'You have successfully joined the Group.'\n elsif (@membership.network.membership_by_request?)\n @membership.user_establish!\n \n begin\n user = @membership.user\n network = @membership.network\n Notifier.deliver_membership_request(user, network, @membership, base_host) if network.administrators(true).any? {|a| a.send_notifications?}\n rescue Exception => e\n logger.error(\"ERROR: failed to send Membership Request email notification. Membership ID: #{@membership.id}\")\n logger.error(\"EXCEPTION:\" + e)\n end\n \n flash[:notice] = 'Membership was successfully requested.'\n end\n\n format.html { redirect_to user_membership_path(current_user.id, @membership) }\n else\n format.html { render :action => \"new\" }\n end\n end\n else\n respond_to do |format|\n flash[:error] = \"Membership not created (already exists)\"\n format.html { render :action => \"new\" }\n end\n end\n end", "def new\n @user = User.new\n @user.email = @membership.recipient_email if @membership\n end", "def create\n @membership = Membership.find_or_create_by_user_id_and_group_id(params[:membership][:user_id], params[:group_id])\n\n if params[:autoconfirm]\n @membership.update_attributes(:level => Membership::LEVELS[:regular])\n else\n @membership.update_attributes(:level => Membership::LEVELS[:pending])\n end\n \n auth!\n\n respond_to do |format|\n if @membership.save\n process_notification(@membership, {:level => @membership.level_name, :adder => current_user.id}, :action => 'create', :owner => @membership.user, :recipient => @membership.group)\n format.html { redirect_to(edit_group_path(@group), :notice => t(:membership_created)) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { redirect_to @group }\n format.xml { render :xml => @membership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n ActiveRecord::Base.transaction do\n @membership = @member.memberships.build(membership_params)\n @plan = Plan.find(params[:membership][:plan_id])\n coupon = params[:membership][:coupon].present? ? params[:membership][:coupon] : nil\n @trial_period_end = params[:membership][:trial_period_days].present? ? set_trial_period_end_date : 'now'\n\n if params[:membership][:payment_type] == 'Stripe'\n stripe_sub = Stripe::Subscription.create(\n customer: @member.stripe_id,\n trial_end: @trial_period_end,\n coupon: coupon,\n :items => [\n {\n :plan => @plan.stripe_id,\n },\n ]\n )\n\n @membership.stripe_sub_id = stripe_sub.id\n @membership.next_invoice_date = Time.at(stripe_sub.current_period_end).to_datetime\n @membership.start_date = set_start_date\n elsif @plan.stripe_id.present?\n @stripe_plan = Stripe::Plan.retrieve(@plan.stripe_id)\n start_date = set_start_date\n plan_interval = @stripe_plan.interval\n plan_interval_count = @stripe_plan.interval_count\n next_date = case plan_interval\n when 'day'\n start_date + plan_interval_count.days\n when 'week'\n start_date + plan_interval_count.weeks\n when 'month'\n start_date + plan_interval_count.months\n when 'year'\n start_date + plan_interval_count.years\n end\n @membership.next_invoice_date = next_date\n end\n\n respond_to do |format|\n if @membership.save!\n format.html { redirect_to @member, notice: 'Membership was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @membership = Membership.new(params[:membership])\n @membership.member = current_member\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to sub_clubs_path, :notice => 'You requested membership.' }\n format.json { render :json => @membership, :status => :created, :location => @membership }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @membership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n success = false\n no_success_message = \"\"\n \n # find the epicenter membership that the user wants\n @membership = Membership.find(params[:membership_id])\n membershipcard = current_user.get_membershipcard( @epicenter )\n\n # subscription to \"new circle movement\"\n if @epicenter == @mother\n flash[:warning] = 'This option is no longer active'\n redirect_path = epicenter_path(@epicenter)\n \n # subscription to all other epicenters\n else \n puts \"create non-NCM Epicenter subscription\"\n stripe_customer = false\n \n success = @epicenter.validate_and_pay_new_membership( current_user, @membership )\n unless success\n no_success_message = \"Du har ikke nok beholdning og/eller månedlig tilførsel af #{@epicenter.mother.fruittype.name}\"\n end\n end\n\n if success\n if @epicenter == @mother\n current_user.name = params['stripeBillingName']\n splitted_name = current_user.name.split(' ')\n if splitted_name.length > 2\n current_user.last_name = splitted_name[-1]\n current_user.first_name = current_user.name.strip().gsub(current_user.last_name, '')\n elsif splitted_name == 2\n current_user.first_name = splitted_name[0]\n current_user.last_name = splitted_name[1]\n else\n current_user.first_name = splitted_name[0]\n end\n current_user.save\n end\n\n @epicenter.make_membershipcard( current_user, @membership, stripe_customer )\n @epicenter.make_member( current_user )\n @epicenter.harvest_time_for( current_user )\n\n log_details = { membership: @membership.name }\n EventLog.entry(current_user, @epicenter, NEW_MEMBERSHIP, log_details, LOG_COARSE)\n\n @request = session[:new_ncm_membership]\n if stripe_customer and @request \n @child = Epicenter.find_by_slug(@request['epicenter_id'])\n @child_membership = @child.memberships.find(@request['membership_id'])\n\n session.delete(:new_ncm_membership)\n\n if @child.validate_and_pay_new_membership( current_user, @child_membership )\n @child.make_membershipcard( current_user, @child_membership, false )\n @child.make_member( current_user )\n @child.harvest_time_for( current_user )\n log_details = { membership: @child_membership.name }\n EventLog.entry(current_user, @child, NEW_MEMBERSHIP, log_details, LOG_COARSE)\n end\n end\n\n if @child\n if current_user.has_member_tshirt?(@child)\n flash[:success] = \"Welcome. You are now a member of #{@child.name} and #{@epicenter.name}\"\n redirect_path = epicenter_path(@child)\n else\n flash[:success] = \"Welcome. You are now a member of #{@child.name}. BUT NOT #{@epicenter.name}\"\n redirect_path = epicenter_path(@epicenter)\n end\n else\n flash[:success] = \"Welcome. You are now a member af #{@epicenter.name}\"\n redirect_path = epicenter_path(@epicenter)\n end\n else\n flash[:warning] = no_success_message\n redirect_path = new_epicenter_subscription_path(@epicenter)\n end\n\n\n redirect_to redirect_path\n end", "def create\n\t\t@membership = Membership.new(params[:membership])\n\n\t\trespond_to do |format|\n\t\t\tif @membership.save\n\t\t\t\tformat.html { redirect_to(@membership, :notice => 'Membership was successfully created.') }\n\t\t\t\tformat.xml\t{ render :xml => @membership, :status => :created, :location => @membership }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml\t{ render :xml => @membership.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @membership = Membership.where(user_id: params[:membership][:user_id], group_id: params[:group_id]).first_or_create\n\n if params[:autoconfirm] || current_user.is_admin?\n @membership.update_attributes(level: Membership::LEVELS[:regular])\n else\n @membership.update_attributes(level: Membership::LEVELS[:pending])\n end\n\n @membership.perms[:screen] = params[:screen]\n @membership.perms[:feed] = params[:feed]\n\n auth!\n\n respond_to do |format|\n if @membership.save\n process_notification(@membership, {}, process_notification_options({\n params: {\n level: @membership.level_name,\n member_id: @membership.user.id,\n member_name: @membership.user.name,\n group_id: @membership.group.id,\n group_name: @membership.group.name\n },\n recipient: @membership.group}))\n if can? :update, @group\n format.html { redirect_to(manage_members_group_path(@group), notice: t(:membership_created)) }\n else\n format.html { redirect_to(group_path(@group), notice: t(:membership_applied_for)) }\n end\n format.xml { render xml: @group, status: :created, location: @group }\n else\n if can? :update, @group\n format.html { redirect_to manage_members_group_path(@group) }\n else\n format.html { redirect_to group_path(@group) }\n end\n format.xml { render xml: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @membership = @member.memberships.build(membership_params)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership.member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user\n @membership_application = @user.build_membership_application(membership_application_params)\n @user.update_attribute(:guest, false)\n @user.update_attribute(:member, true)\n\n if @membership_application.membership == \"Gold\"\n @user.update_attribute(:shareholder, true)\n end\n\n respond_to do |format|\n if @membership_application.save\n format.html { redirect_to @membership_application, notice: 'Membership application was successfully created.' }\n format.json { render :show, status: :created, location: @membership_application }\n else\n format.html { render :new }\n format.json { render json: @membership_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \t@site = Site.find(params[:membership][:site_id])\n \t@o = [('a'..'z'),('A'..'Z'), (0..9)].map{|i| i.to_a}.flatten\n\t\t@pw = (0...8).map{ @o[rand(@o.length)] }.join\n\n \tif current_company.users.find_by_email(params[:email]).nil?\n \t\t@user = User.new(:email => params[:email])\n \t\t@user.password = @pw\n \t\t@user.password_confirmation = @pw\n \t\t@user.company = current_company\n \t\t# This should probably have additional logic and not allow any user to become a manager...\n \t\tif params[:membership][:role] == \"manager\"\n \t\t\t@user.manager = 1\n \t\tend\n \telse\n \t\t@user = current_company.users.find_by_email!(params[:email]) \t\t\n \tend\n\n @membership.site = @site\n @membership.user = @user\n @membership.role = params[:membership][:role]\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership, notice: 'Membership was successfully created.' }\n format.json { render json: @membership, status: :created, location: @membership }\n else\n format.html { render action: \"new\" }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @membership = current_member.current_year_membership.dup\n @membership.renewal_decision = params[:decision]\n set_basket_complements\n\n redirect_to members_member_path unless @membership&.renewal_opened?\n end", "def create\n #sanity checks, can only modify memberships that you own\n if params[:user_id].to_i != current_user.id then\n render json: {message:'You do not own the membership list'}, :status => :unprocessable_entity\n return\n end\n\n #ensure the membership params is there\n unless params.has_key? :memberships then\n #render json: {message:'memberships list not found'}, :status => :unprocessable_entity\n #return\n #this could me no membership at all\n params[:memberships] = {}\n end\n\n #set the new memberships state\n current_user.set_memberships params[:memberships]\n\n render json: {\n message:'message received from server',\n memberships:User.find(params[:user_id]).memberships.map{ |x| x.attributes.merge({club_name: x.club_name})}\n }\n end", "def new\n\t\t@membership = Membership.new\n\t\t@membership.members.build\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @membership }\n\t\tend\n\tend", "def new\n if @network\n @membership = Membership.new(:user_id => current_user.id, :network_id => @network.id)\n else\n @membership = Membership.new(:user_id => current_user.id)\n end\n end", "def gym_sign_up(gym, membership_cost)\n Membership.new(gym, self, membership_cost)\n end", "def singup (gym, cost)\n new_memebership = Membership.new(cost , self, gym)\n end", "def create\n @membership = Adhocracy::Membership.new(membership_params)\n\n if @membership.save\n render json: @membership, status: :created, location: api_v1_membership_path(@membership)\n else\n render_validation_errors @membership.errors\n end\n end", "def sign_up(gym, cost)\n Membership.new(self, gym, cost)\n\n end", "def create\n _user_not_anonymous\n @user = CwaIpaUser.new\n @project = Project.find(Redmine::Cwa.project_id)\n\n if !params[:saa] \n flash[:error] = \"Please indicate that you accept the system access agreement\"\n redirect_to :action => :index\n return\n end\n\n if !params[:tos]\n flash[:error] = \"Please indicate that you accept the terms of service\"\n redirect_to :action => :index\n return\n end\n\n # TODO \n # 1. Call REST to messaging service to notify about account creation\n # 2. Add user to research-computing project\n @user.passwd = params['netid_password']\n\n begin\n @user.create\n rescue Exception => e\n flash[:error] = \"Registration failed: \" + e.to_s\n else\n logger.info \"Account #{@user.uid.first} provisioned in FreeIPA\"\n\n # Add them to the project... allows notifications\n @project.members << Member.new(:user => User.current, :roles => [Role.find_by_name(\"Watcher\")])\n\n CwaMailer.activation(@user).deliver\n\n flash[:notice] = 'You are now successfully registered!'\n end\n redirect_to :action => :index\n end", "def renew\n network = Network.new membership_network\n self.ip_address = network.next\n end", "def new\n\t\traise\n\t\t@membership = Membership.create(user_id: session[:user_id], group_id: session[:false_id], admin: false)\n\t\t@membership.save\n\t\traise\n\t\t#redirect_to 'groups'\n\tend", "def create\n @user = GetUserInfo.run(membership_params)\n if @user == :no_github_user\n session[:new_member_msg] = :no_github_user\n session[:new_member_id] = membership_params['nickname']\n redirect_to class_group_memberships_url\n return\n end\n if membership_params['teacher'] == 'on'\n kind = 'teacher'\n else \n kind = 'student'\n end\n @membership = Membership.new(\n user_id: @user.id,\n kind: kind,\n class_group_id: @class_group.id)\n respond_to do |format|\n if @membership.save\n session[:new_member_msg] = :successful_save\n session[:new_member_id] = @user.id\n format.html { redirect_to class_group_memberships_url, notice: 'Membership was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @member = Member.new(params[:member]) \n if @member.save\n \n require 'aweber'\n @oauth = AWeber::OAuth.new('Ak8Buwis5Q1j0OwvVZ4eJROe','TjtgHED5PIYPqS85ZgBekIf9jol1PgpUEpETmrV9')\n @oauth.authorize_with_access('Agvk8sGM8K4XFU2axg2d9z2j', 'qcAyJIPah2lBKcqrU85IviuOXjC0gLtYx0koG115')\n @aweber = AWeber::Base.new(@oauth)\n @account = @aweber.account\n\n new_subscriber = {}\n new_subscriber[\"email\"] = params[:member][:email]\n new_subscriber[\"name\"] = params[:member][:username] \n @account.lists.find_by_name(\"cpclist\").subscribers.create(new_subscriber)\n \n \n insert_id = @member.id\n random_string = SecureRandom.hex(5)\n Member.find(insert_id).update_attribute(:random_code, random_string)\n\n flash[:success] = \"Member was successfully created.\"\n session[:user_id] = insert_id\n redirect_to root_url\n #render 'home/index'\n\n flash[:success] = \"\";\n\n #render :partial => 'home/index', :locals => { :success => flash[:success] }\n else\n render 'home/index'\n end\n end", "def create\n @membership.save_with_payment!(params[:card_id])\n MembershipNotifier.new(user: @user, membership: @membership).notify_new\n\n redirect_to user_membership_path(@user, @membership), notice: t('.payment_successful')\n rescue => err\n flash.now[:alert] = ErrorNotifier.notify(err)\n\n prepare_new_form\n render action: 'new'\n end", "def create\n @member = Member.new(member_params)\n @member.phone = nil if @member.phone == \"+375\"\n\n if @member.site_user.blank?\n @member.site_user = nil\n end\n\n @member.join_date = Date.today if @member.join_date.blank?\n @member.card_number = Member.last_card_number + 1 if @member.card_number.blank?\n\n respond_to do |format|\n if @member.save\n CrmMailer.with(member: @member).greet_new_member.deliver_later\n\n format.html { redirect_to member_pay_path(@member), notice: 'Участник успешно зарегистрирован' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @membership = @organization.memberships.build(membership_params.merge(creator: authed_user))\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership, notice: 'Membership was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_and_invite\n puts \"MembersController#create_and_invite\"\n # Convert month/year params to date\n params[:joined_at] = \"#{params[:joined_at_y]}-#{params[:joined_at_m]}-1\".to_date\n # Left_at should be the first of next month. A member who's left_at is set to 1st of August will\n # only pay for July.\n params[:left_at] = \"#{params[:left_at_y]}-#{params[:left_at_m]}-1\".to_date.next_month #.end_of_month\n \n # Invite a new member or add an existing to a project\n if params[:invite_or_add] == \"add\"\n # Add to existing project\n @member = Member.find(params[:member][:id])\n # Add member to existing project\n existing_project = Project.find(params[:project_id])\n puts \"Assign project '#{existing_project.name}' (#{params[:project_id]}) with admin #{existing_project.admin_id}, to member '#{@member.name}'.\"\n project_name = existing_project.name\n if existing_project.admin_id == current_member.id\n # Make sure that current member is admin of the project.\n @member.projects << existing_project\n membership = @member.memberships.where(\"project_id = ?\", existing_project.id)\n membership.update(joined_at: params[:joined_at], left_at: params[:left_at])\n @member.save\n \n # Member saved to db. Send invitiation email.\n if params[:send_invitation]\n @member.send_invitation_email sender: current_member, project: existing_project\n flash[:info] = \"Invitation email sent to #{@member.email} from #{current_member.name}. Invited to project #{existing_project.name}.\"\n end\n\n set_current_project_id existing_project.id\n redirect_to root_path and return\n else\n cancel_invite \"NOT PROJECT ADMIN. Member #{current_member.id} is not #{existing_project.admin_id}.\"\n return false\n end\n else\n # Create new and add to existing/newly created project\n # Init Member\n @member = Member.new(member_params)\n if @member.save\n # Saved member (along with project) to database\n puts \"Saved member #{@member.name} to db.\"\n # Choose an existing project or create a new?\n if params[:new_or_existing] == \"new\" && !params[:project][:name].blank?\n # Logged in member wants to create a new project\n project_name = params[:project][:name]\n params[:project][:admin_id] = current_member.id\n if current_member.projects.where(\"admin_id = ? AND name = ?\", current_member.id, project_name).empty?\n # Member is not the admin of a project with this name, create it\n puts \"Will create new Project: '#{project_name}'\"\n # Create project\n puts \"Assign project '#{project_name}' to member '#{@member.name}\"\n puts \"Assign project admin privileges to current member '#{current_member.name}\"\n current_member.projects.build(project_params)\n current_member.save\n else\n flash[:danger] = \"A project named '#{project_name}' already exists. Choose another name.\"\n puts \"A project named '#{project_name}' already exists. Choose another name.\"\n cancel_invite \"PROJECT ALREADY EXISTS\"\n return false\n end\n elsif params[:new_or_existing] == \"existing\" && params[:project_id] != \"0\"\n # Add member to existing project\n existing_project = Project.find(params[:project_id])\n p existing_project\n puts \"Assign project '#{existing_project.name}' (#{params[:project_id]}) with admin #{existing_project.admin_id}, to member '#{@member.name}'.\"\n project_name = existing_project.name\n if existing_project.admin_id == current_member.id\n # Make sure that current member is admin of the project.\n @member.projects << existing_project\n else\n cancel_invite \"NOT PROJECT ADMIN. Member #{current_member.id} is not #{existing_project.admin_id}.\"\n return false\n end\n else\n flash[:danger] = \"Enter a name for a new Project or choose an existing one.\"\n puts \"Enter a name for a new Project or choose an existing one.\"\n cancel_invite \"NO NEW PROJECT NAME or NO PROJECT SELECTED\"\n return false\n end\n @member.current_project_id = params[:project_id]\n @member.save\n\n project = @member.projects.find_by(name: project_name)\n unless project.nil?\n membership = @member.memberships.where(\"project_id = ?\", project.id)\n membership.update(joined_at: params[:joined_at], left_at: params[:left_at])\n @member.save\n\n if project.rents.empty?\n project.rents.create(amount: params[:monthly_rent], due_date: project.start_date.prev_month.change(day: 25))\n end\n end\n\n # Member saved to db. Send invitiation email.\n if params[:send_invitation]\n @member.send_invitation_email sender: current_member, project: project\n flash[:info] = \"Invitation email sent to #{@member.email} from #{current_member.name}. Invited to project #{project_name}.\"\n end\n set_current_project_id project.id\n redirect_to root_path\n else\n flash[:danger] = \"#{@member.name} could not be saved.\"\n p @member.errors.messages\n @projects = current_member.projects.where(admin_id: current_member.id)\n render 'invite'\n end\n end\n\n end", "def on_membership_change(opts={}, &blk)\n MembershipSubscription.new(self, opts, blk).tap do |ms|\n # the watch is registered in create!\n synchronize { @membership_subscriptions << ms }\n end\n end", "def create\n unless current_user.nil?\n #mallissa:\n #@membership = Membership.new(membership_params)\n #@membership.user = current_user\n @membership = Membership.new params.require(:membership).permit(:beer_club_id)\n @membership.user = current_user\n @membership.confirmed = false\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership.beer_club, notice: \"You're application for #{@membership.beer_club.name} has been sent! Sit still and wait for confirmation.\" }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end \n else raise #kirjautumaton juuseri yrittää liittyä klubiin\n end \n end", "def create\n member_attr = sign_up_params[:member_attributes]\n if validate_email(sign_up_params[:email])\n member_attr[:institution_id] = get_institute(sign_up_params[:email])\n member_attr[:role_id] = Role.find_by(name: 'Pending').id\n member_attr[:account_privacy_id] = 1\n member = Member.new(member_attr)\n user =\n User.new(email: sign_up_params[:email],\n password: sign_up_params[:password],\n password_confirmation: sign_up_params[:password_confirmation],\n last_sign_in_at: Time.now)\n if member.valid? && !member[:name].empty?\n create_transaction(member, user)\n else\n render 'missing_fields'\n return\n end\n else\n render 'invalid_email'\n return\n end\n end", "def new_membership(cost, gym)\n Membership.new(cost, gym, self)\n end", "def new\n @user = User.new\n @user.pending_memberships.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def sign_up (gym, cost) \n Membership.new(cost, gym, self)\n end", "def sign_up(cost,gym)\n Membership.new(self,gym,cost)\n end", "def sign_up(gym, cost)\n Membership.new(self, gym, cost)\n end", "def new_member(cost, gym)\n Membership.new(cost, self, gym)\n end", "def create\n group_id = params[:group_id]\n user = User.find(params[:user_id])\n group = Group.find_by_id(group_id)\n if user.is_admin || group.creator == current_user\n role = Role.find_by_rolename('group_admin')\n else\n role = Role.find_by_rolename('user')\n end\n \n is_authorized = false\n\n if group.private\n if user.is_admin || group.creator == current_user\n is_authorized = true\n end\n else\n is_authorized = true\n end \n\n @membership = Membership.create({:group_id => params[:group_id], \n :user_id => user.id,\n :role_id => role.id,\n :authorized => is_authorized})\n if @membership.save\n respond_to do |format|\n format.html { redirect_to group_path(group_id) }\n format.xml { render :xml => @membership, :status => :created } \n format.json { render :json => @membership, :status => :created } \n end\n else\n respond_to do |format|\n format.html { redirect_to group_path(group_id) }\n format.xml { render :xml => @membership.errors, :status => :unprocessable_entity }\n format.json { render :json => @membership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @membership = Membership.new(params[:membership])\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership, notice: 'Membership was successfully created.' }\n format.json { render json: @membership, status: :created, location: @membership }\n else\n format.html { render action: \"new\" }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def addmember\n\t\t@member=User.new\n\t\tend", "def create\n @membership = Membership.new(membership_params)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership, notice: \"Membership was successfully created.\" }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Init Member\n @member = Member.new(member_params)\n @member.invited = true\n if @member.save\n flash[:info] = \"Registration successful!\"\n @member.send_activation_email\n render 'activate'\n else\n render 'new'\n end\n end", "def new\n @account = Account.new\n @account.memberships.build.build_user\n @plans = Plan.all\n end", "def create\n if current_user.tribal_membership.nil?\n @tribal_membership = TribalMembership.create(tribe_id:params[:tribe_id], user_id:current_user.id)\n else\n @tribal_membership = current_user.tribal_membership\n @tribal_membership.update(tribal_membership_params)\n end\n\n respond_to do |format|\n if @tribal_membership.save\n format.html { redirect_to contrib_campsites_path, notice: 'Tribal membership was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tribal_membership }\n else\n format.html { redirect_to new_tribal_membership_path }\n format.json { render json: @tribal_membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @purchase = Purchase.new purchase_attributes\n if @purchase.save\n @ok = true\n renewed = Purchase.find_by_id params[:renewed_id]\n if renewed\n renewed.users.each do |u|\n u.purchase_id = @purchase.id\n u.save\n Notification.send_to(\n u.id,\n I18n.t('notifications.account.renewed.title'),\n I18n.t('notifications.account.renewed.message', :expiration_date => TimeConvert.to_string(@purchase.expiration_date)),\n ''\n )\n end\n renewed.expiration_date = Time.zone.now\n renewed.save\n end\n else\n @ok = false\n @errors = @purchase.errors.messages.keys\n @errors << :ssn_code if @errors.include?(:base)\n end\n end", "def create\n @club=Club.find(session[:current_club])\n @title=\"Sign up\"\n logout_keeping_session!\n @member = @club.members.build(params[:member])\n success = @member && @member.save\n \n \n if success\n session[:current_club]=nil\n # Member dem Club zuordnen\n # @club.members << @member\n flash[:success] = \"Member created for #{@club.name}\"\n redirect_to(login_path)\n else\n flash.now[:error] = \"We couldn't set up that account, sorry. Please try again, or contact an admin. \"\n render :action => 'new'\n end\n \n end", "def set_membership\n @membership = Membership.find(params[:id])\n end", "def signup(gym, cost, lifter)\n membership = Membership.new(gym, cost)\n self.membership << gym\n end", "def new\n @mem = Member.find(params[:id])\n @user = User.new\n if session[:current_user_super_admin]\n @roles = Role.find(:all)\n else\n @roles = Role.find(:all, :conditions => [\"id <> 1\"])\n end\n @mem_emailid = @mem.emailid\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def create\n\n @tea_club = TeaClub.new(tea_club_params)\n\n respond_to do |format|\n\n if @tea_club.save\n\n membership = Membership.new(:tea_club_id => @tea_club.id, :confirmed => true)\n current_user.memberships << membership\n membership.save\n\n format.html { redirect_to @tea_club, notice: 'Tea club was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tea_club }\n\n else\n format.html { render action: 'new' }\n format.json { render json: @tea_club.errors, status: :unprocessable_entity }\n end\n\n end\n end", "def create\n #@account_member = AccountMember.new(params[:account_member])\n #@account = Account.find(params[:id])\n #authorize! :admin_team, @account\n if @account.user_count <= @account.account_members.count\n redirect_to account_account_members_path(@account), :notice => \"Unable to add another user. Increase number of account users to add.\"\n else\n email = params[:email]\n user = User.find_by_email(email)\n if user.nil?\n @account.account_members.create( :email => email )\n else\n m = @account.account_members.create( :email => email)\n m.user = user # REVIEW Is this safe?\n m.save\n end\n # respond_to do |format|\n # if @account_member.save\n # format.html { redirect_to @account_member, notice: 'Account member was successfully created.' }\n # format.json { render json: @account_member, status: :created, location: @account_member }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @account_member.errors, status: :unprocessable_entity }\n # end\n # end\n redirect_to account_account_members_path(@account), :notice => \"Team member with email #{email} was successfully created.\"\n \n end\n\n end", "def create\n @membership = Membership.new(membership_params)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to community_memberships_path(@community), notice: 'Community membership was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def issue_membership_number\n self.membership_number = self.membership_number.blank? ? get_next_membership_number : self.membership_number\n end", "def set_membership\n @membership = Membership.find(params[:id])\n @plan = Plan.find_by_name('Premium')\n end", "def create\n @user = User.new(user_params) # Not the final implementation!\n if @user.save\n @user.send_activation_email\n \n if params[:user][:membership_level_id] == \"1\"\n flash[:info] = \"Please check your email to activate your account.\"\n redirect_to root_url\n elsif params[:user][:membership_level_id] == \"2\"\n redirect_to generate_url(\"https://techscreen-net.chargify.com/subscribe/g7zjvxxj/bronze\", \n {reference: \"4RKzhs3YJMNAAV2v7Zo\" + @user.id.to_s})\n elsif params[:user][:membership_level_id] == \"3\"\n redirect_to generate_url(\"https://techscreen-net.chargify.com/subscribe/vryykwj4/gold\", \n {reference: \"4RKzhs3YJMNAAV2v7Zo\" + @user.id.to_s})\n elsif params[:user][:membership_level_id] == \"4\"\n redirect_to generate_url(\"https://techscreen-net.chargify.com/subscribe/zhksdhbm/platinum\", \n {reference: \"4RKzhs3YJMNAAV2v7Zo\" + @user.id.to_s})\n end\n \n else\n render 'new'\n end\n end", "def set_membership\n @membership = Membership.find(params[:id])\n end", "def set_membership\n @membership = Membership.find(params[:id])\n end", "def set_membership\n @membership = Membership.find(params[:id])\n end", "def set_membership\n @membership = Membership.find(params[:id])\n end", "def set_membership\n @membership = Membership.find(params[:id])\n end", "def set_membership\n @membership = Membership.find(params[:id])\n end", "def set_membership\n @membership = Membership.find(params[:id])\n end", "def set_membership\n @membership = Membership.find(params[:id])\n end", "def set_membership\n @membership = Membership.find(params[:id])\n end", "def create\n if params[:dont_fill_this_in]\n return redirect_to(new_member_path) \n end\n\n @member = Member.new(params[:member])\n\n if logged_in? && current_user.admin?\n @member.admin = params[:member][:admin]\n end\n\n if params[:member_password] == params[:member_verify_password]\n @member.password = params[:member_password]\n else\n flash[:notice] = \"ERROR: Passwords were not the same.\"\n render :action => \"new\"\n return false\n end\n\n respond_to do |format|\n if @member.save\n flash[:notice] = 'Member was successfully created.'\n format.html { redirect_to(member_path(@member)) }\n format.xml { render :xml => @member, :status => :created, :location => @member }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @member.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n if params[:membership][:user_username]\n params[:membership][:user_id] = User.find_by_username(params[:membership].delete('user_username')).try!(:id)\n end\n\n @membership = @project.memberships.create(membership_params)\n respond_with @project, @membership\n end", "def create\n @member = Member.where(email: params[:member][:email]).first\n if @member\n @member.active = true\n @member.update(member_params)\n else\n @member = Member.new(member_params)\n end\n respond_to do |format|\n if @member.save\n Notify.welcome_email(@member).deliver_now\n if current_user.nil?\n log_in @member\n is_admin?\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n end\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def new\n @member = Member.new\n # set the initial data for member\n @member.role = MemberRole.general_role\n @member.account = current_member.account\n end", "def create\n @account = Account.find params[:account_id]\n @person = Person.find :first, :joins => :emails, :conditions => ['emails.email = ?', params[:email]]\n if @person\n @account_membership = AccountMembership.new( :person => @person, :account => @account)\n else\n @account_membership = AccountMembership.new\n end\n\n respond_to do |format|\n if @account_membership.save\n flash[:notice] = 'Person was successfully invited.'\n format.html { redirect_to(@account) }\n format.xml { render :xml => @account_membership, :status => :created, :location => @account_membership }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account_membership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def welcome\n @membership = Membership.find(params['subscription_id'])\n end", "def new\n @member = Member.new\n \n end", "def make_current_member\n start_membership_on(date: Date.current) unless current_member?\n end", "def create\n\n @user = User.where(firstName: params[:user][:firstName]).first\n @loop = Loop.find(params[:loop_id])\n\n if @user\n lm = @user.loop_memberships.build(loop_id: @loop.id)\n lm.status = \"pending\"\n lm.author_id = current_user.id\n lm.save\n flash[:success] = \"invitation sent\"\n redirect_to loop_path(@loop)\n else \n flash[:error] = \"error with invitation\"\n redirect_to loop_path(@loop)\n end\n\n end", "def create\n @membership = Membership.new(membership_params)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to groups_path, notice: 'User was successfully added to group.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n user = User.where(:invite_token => params[:id], :status => \"invitee\").first\n role = user.roles.first\n if current_user\n role.user_id = current_user.id\n role.join_crewhmanship_or_membership!\n role.save\n user.delete\n end\n redirect_to role.course, :notice => \"Ticket claimed successfully!\"\n end", "def create\n fname = \"#{self.class.name}.#{__method__}\"\n super\n user=User.find_by_email(reg_params[:email])\n pars={}\n unless user.nil?\n pars[:name]=params[:user][:name]\n pars[:role]=params[:user][:role]\n user.update(pars) \n else\n user=User.new(params[:user])\n end\n LOG.debug(fname) {\"************************ current_user=#{user.inspect}\"}\n end", "def create_user\n user = User.where(email: user_email)\n if user.blank? # new user\n @user = create_new_user\n church = nil\n if affiliation.blank?\n church = create_affiliation_from_church\n else\n church = Affiliation.find(self.affiliation)\n end\n @user.affiliation = church\n church.users << @user\n @user.save\n\n guest = Role.find_by_name(\"Guest\").id \n @user.role_ids=[guest]\n self.user_id = @user.id\n end\n end", "def new_member_path_for membership\n\t\tnew_member_path + \"?membership_id=#{membership.id}\"\n\tend", "def newacct\r\n @user = User.new\r\n @user.user_type=\"m\"\r\n return @user\r\n end", "def activate\n @membership.activate!\n @membership.generate_dues_invoice!\n _user = @membership.user\n _user.roles = [:member]\n _user.save\n flash[:success] = \"Successfully activated #{ @membership.user.full_name }\"\n redirect_to '/'\n end", "def new\n\t\t@member = Member.new(:membership_id => params[:membership_id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @member }\n\t\tend\n\tend", "def create\n @lab_membership = LabMembership.new(params[:lab_membership])\n @user = @lab_membership.user\n\n respond_to do |format|\n if @lab_membership.save\n flash[:notice] = 'LabMembership was successfully created.'\n format.html { redirect_to( user_lab_memberships_path(@user) ) }\n format.xml { render :xml => @lab_membership, :status => :created, :location => @lab_membership }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lab_membership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n \n @membership_record = MembershipRecord.new(membership_record_params)\n\n respond_to do |format|\n if @membership_record.save\n format.html { redirect_to @membership_record, notice: 'Membership record was successfully created.' }\n format.json { render :show, status: :created, location: @membership_record }\n else\n format.html { render :new }\n format.json { render json: @membership_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = Member.new(user_params)\n if user.save\n code = user.id + 24523009\n user.update(affiliate_code: code)\n MemberupJob.set(wait: 20.seconds).perform_later(user)\n sign_in(user)\n render json: user,serializer: Api::V1::MembersSerializer, :status => 201\n else\n render json: \"errors\", :status => 422\n end \n end", "def set_membership\n @membership = Membership.friendly.find(params[:id])\n end", "def update\n success = false\n \n old_membership = current_user.membership_for(@epicenter)\n new_membership = Membership.find(params[:id])\n upgrade = new_membership.monthly_fee > old_membership.monthly_fee\n\n membershipcard = current_user.get_membershipcard( @epicenter )\n\n # change subscription for \"new circle movement\"\n if @epicenter == @mother \n redirect_path = nil\n\n # subscription is nil if bank member of if we have stripe info but no active subsctiptions\n if membershipcard.payment_id == 'bank'\n subscription = nil\n else\n customer = Stripe::Customer.retrieve( membershipcard.payment_id ) rescue nil\n subscription = customer.subscriptions.first rescue nil\n end\n\n # if we have active subscription we can simply change it\n if subscription\n # change user's subscription\n subscription.plan = new_membership.payment_id.to_s\n \n # if success and upgrade, charge additional payment\n if subscription.save\n success = true\n\n if upgrade\n today = Date.today\n diff_amount = new_membership.monthly_fee - old_membership.monthly_fee\n days_in_month = Time.days_in_month(today.month, today.year)\n days_left_in_month = days_in_month - today.day + 1\n percent_left = days_left_in_month / days_in_month.to_f\n\n # only charge for changes if there are more than 5% of days left in month and user is not in \"trialing\" subscription\n if (percent_left > 0.05 and subscription.status != 'trialing')\n charge_amount = [diff_amount * percent_left, 25].max.round\n payment = Stripe::Charge.create(\n :amount => charge_amount * 100,\n :currency => 'dkk',\n :customer => customer.id,\n :description => \"Membership change from #{old_membership.name} to #{new_membership.name}\"\n )\n end\n end\n\n current_user.membershipcards.each do |card|\n card.update_valid_supply\n end\n else\n no_success_message = \"Der skete desvære en fejl. Betalingen blev ikke gennemført (subs171)\"\n end\n\n # otherwise we need to create a new credit card subscription\n # the user does not have an active subscription but we have stripe info, so we delete it\n else\n if customer\n customer.delete\n end\n if membershipcard.payment_id != 'bank'\n membershipcard.payment_id = 'upgrade'\n end\n membershipcard.save\n\n redirect_path = new_epicenter_subscription_path(@epicenter)\n end\n\n # change subscription to all other epicenters\n else \n success = @epicenter.validate_and_pay_new_membership( current_user, new_membership )\n unless success \n no_success_message = \"Du har ikke nok beholdning og/eller månedlig tilførsel af #{@epicenter.mother.fruittype.name}\"\n end\n end\n\n\n # if we have success we can update the users membershipcard\n if success\n # update membershipcard\n membershipcard.membership_id = new_membership.id\n membershipcard.valid_payment = true\n membershipcard.update_valid_supply\n\n puts \"--------------------------------\"\n puts \"new membership\", membershipcard.membership.monthly_gain\n\n if membershipcard.save\n log_details = { from: old_membership.name, to: new_membership.name }\n EventLog.entry(current_user, @epicenter, MEMBERSHIP_CHANGE, log_details, LOG_COARSE)\n\n # only add fruits if upgrading\n if upgrade\n @epicenter.harvest_time_for(current_user)\n end\n\n flash[:success] = \"Du er nu #{new_membership.name} medlem af #{@epicenter.name}\" \n else \n flash[:error] = \"Der skete desværre en fejl (142). Kontakt venligst NCM\"\n end\n redirect_path = epicenter_path(@epicenter)\n \n # otherwise, if we don't have a redirect already (change from bank to credit card)\n # display error to user\n else\n if not redirect_path\n membershipcard.valid_payment = false\n membershipcard.save\n\n flash[:warning] = no_success_message\n redirect_path = epicenter_subscriptions_path(@epicenter)\n end\n end\n\n redirect_to redirect_path\n end", "def create\n @membership_type = MembershipType.new(params[:membership_type])\n @member_category = MemberCategory.find(params[:member_category_id])\n @membership_type.member_category = @member_category\n if @membership_type.save\n redirect_to '/preferences/members_management?tab=membership_types', :notice => \"Membership Type created\"\n else\n redirect_to '/preferences/members_management?tab=membership_types', :notice => @membership_type.errors\n end\n end", "def add_creator_as_member\n Membership.add_membership(created_by_id, id)\n end", "def update\n @membership_type.update(membership_type_params)\n @membership_type = MembershipType.new\n @membership_types = MembershipType.all\n \n end", "def create(params, membership)\n # Send payload to blip\n data = {\n initials: (params[4].nil? ? params[5][0] : params[4].tr('^a-zA-Z', '')),\n firstname: (params[5].nil? ? params[4][0] : params[5]),\n lastname: [params[6], params[7]].reject{|e| e.nil? or e.empty?}.join(' '),\n email: (params[3].nil? ? 'unknown@nieuwedelft.nl.invalid' : params[3]),\n gender: params[9] == 'Vrouw' ? 'F' : 'M',\n phone: params[14],\n mobile: params[2],\n phone_parents: params[24],\n address: [params[10], params[11], params[12]].join(' '),\n membership: membership,\n }\n begin\n unless params[15].nil?\n data[:dateofbirth] = Date.strptime(params[15], '%d-%m-%Y').strftime('%Y-%m-%d')\n end\n rescue\n $problems.write \"#{$index}, #{data[:firstname]} #{data[:lastname]}, Birthdate ignored\\n\"\n end\n blip = post('https://people.i.bolkhuis.nl/persons', data)\n\n # Grab uid\n unless blip == nil\n uid = blip['uid']\n\n # Send payload to operculum\n put(\"https://operculum.i.bolkhuis.nl/person/#{uid}\", {\n nickname: params[8],\n study: params[16],\n alive: params[17].nil?,\n inauguration: params[25],\n resignation_letter: params[26],\n resignation: params[27],\n })\n end\nend", "def create\n @member = Member.new(params[:member])\n @member.new = false\n\n respond_to do |format|\n if @member.save\n flash[:notice] = 'Member was successfully created.'\n format.html { redirect_to members_url(@member) }\n format.xml { head :created, :location => member_url(@member) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @member.errors.to_xml }\n end\n end\n end" ]
[ "0.70105594", "0.6947248", "0.6915482", "0.6773699", "0.6734321", "0.6689697", "0.6682483", "0.66363513", "0.6631679", "0.6577498", "0.6518194", "0.6373315", "0.6362637", "0.63517153", "0.63334924", "0.6313198", "0.62955207", "0.6275529", "0.62693894", "0.6269347", "0.6260356", "0.62515736", "0.6245131", "0.6243735", "0.6210916", "0.6207537", "0.61928356", "0.61774427", "0.6176527", "0.617437", "0.6166191", "0.6165778", "0.6136668", "0.61346436", "0.6129415", "0.61268824", "0.6118965", "0.60853463", "0.608517", "0.6083663", "0.6080992", "0.60793394", "0.60759735", "0.6071073", "0.60608155", "0.6051922", "0.6051314", "0.6049544", "0.60415375", "0.6035322", "0.60130084", "0.60060954", "0.5952413", "0.59462315", "0.5943082", "0.59265274", "0.59250784", "0.5905955", "0.5901299", "0.5896773", "0.58955956", "0.5890783", "0.58902997", "0.5889701", "0.5887437", "0.5887437", "0.5887437", "0.5887437", "0.5887437", "0.5887437", "0.5887437", "0.5887437", "0.5887437", "0.58643854", "0.58522177", "0.58482283", "0.5838426", "0.58375305", "0.5836122", "0.5821731", "0.5820828", "0.58168554", "0.5814454", "0.58093417", "0.57990664", "0.5794103", "0.57932425", "0.57873416", "0.57819855", "0.5781109", "0.57732785", "0.57660776", "0.5761976", "0.57597816", "0.5753407", "0.5723708", "0.5715801", "0.5694009", "0.5693495", "0.5690113" ]
0.61714005
30
Initializes a new object
def initialize(attrs = {}) @attrs = attrs.deep_find(self.class.to_s.demodulize) if attrs.is_a?(Hash) @attrs ||= attrs @attrs.each do |k, v| instance_variable_set("@#{k.to_s.underscore}", v) unless v.nil? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize() end", "def initialize\n \n end", "def initialize\n end", "def initialize()\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) 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 init\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 constructor; end", "def initialize(obj); end", "def initialize\r\n\r\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 initialize\n end", "def initialize\n\t\t\n\tend", "def initialize\n end", "def initialize\n\n\tend", "def initialize\n\n\tend", "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 initialize()\n\t\tend", "def initialize\n \n end", "def initialize\n \n end", "def init\n end", "def init\n end", "def init\n end", "def initialize()\r\n\r\n end", "def initialize object\n\t\tself.object = object\n\tend", "def init; end", "def init; end", "def init; end", "def init; end", "def initialize\n\n\n\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\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 initialize\n end", "def initialize\n end", "def initialize\nend", "def initialize\n \n end", "def initialize()\n # override parent\n end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def initialize()\n\tend", "def initialize()\n\tend", "def init\n raise NotImplementedError\n end", "def initialize\n\n end", "def initialize\n\n end", "def initialize\n\n\nend", "def initialize\n # nothing here for now\n end", "def initialize\n\t\nend", "def initialize()\n end", "def initialize()\n end", "def initialize(*_)\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end" ]
[ "0.84613174", "0.8216564", "0.8215841", "0.8211569", "0.82106155", "0.82106155", "0.81460595", "0.81460595", "0.81460595", "0.81460595", "0.81460595", "0.8131518", "0.8131518", "0.8131518", "0.8131518", "0.8131518", "0.8131518", "0.8123764", "0.8107522", "0.8107522", "0.8107522", "0.8107522", "0.8107522", "0.8107522", "0.8107522", "0.8107522", "0.8107522", "0.8107522", "0.8107522", "0.809858", "0.808811", "0.80631936", "0.80560046", "0.80560046", "0.80560046", "0.80560046", "0.80560046", "0.80560046", "0.80560046", "0.80560046", "0.80560046", "0.80182195", "0.7982159", "0.7938349", "0.7938349", "0.78684443", "0.78684443", "0.78684443", "0.78684443", "0.78684443", "0.78684443", "0.78684443", "0.78684443", "0.78654003", "0.7772852", "0.7772852", "0.7725717", "0.7725717", "0.7725717", "0.77084506", "0.76972103", "0.76712877", "0.76712877", "0.76712877", "0.76712877", "0.7627597", "0.7623286", "0.7623286", "0.7623286", "0.7623286", "0.7623286", "0.7623286", "0.7623286", "0.75584453", "0.75584453", "0.75584453", "0.75584453", "0.75584453", "0.75584453", "0.75584453", "0.75584453", "0.75584453", "0.75584453", "0.7528625", "0.7524562", "0.75195813", "0.75158787", "0.75061977", "0.75061977", "0.7503177", "0.7497848", "0.7497848", "0.7492839", "0.7486552", "0.7458451", "0.74418974", "0.74418974", "0.7414332", "0.73999906", "0.73999906", "0.73999906" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def prescription_params params.require(:prescription).permit(:quantity, :unit, :observation, :hospitalization_id, :medicaments) 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
Create query using field parser. Equivalent to Lucene's field:"value" query. Inspired from ActiveFedora::SolrQueryBuilder.field_query.
def field_query(field, value) "_query_:\"{!field f=#{field}}#{value}\"" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_field_query query, response, scope\n if Array === query\n case query.first\n when :method # a method call\n query.shift\n return eval(query.join('.'))\n when :literal # a literal value\n return query.last\n end\n end\n response.scalar_query(query, scope)\n end", "def query(field, opts = {})\n field = field.to_sym\n\n # For some reason, #filter(verify:) is supposed to return the values to\n # use. I cannot honestly figure out why this is the case, so we provide\n # #query(valid:) instead. #query(valid:) lambdas receive a value+context\n # and return a boolean. If all values in a field are valid, the whole\n # is assumed valid.\n #\n # If you must, you can still use #filter(verify:) to handle the entire\n # array all at once, or to modify values.\n filter field, verify: opts[:verify] || ->(values, context) do\n if opts[:valid]\n values if values.all? { |v| opts[:valid].call(v, context) }\n else\n values\n end\n end\n\n @_query_fields ||= {}\n @_query_fields[field] = opts\n end", "def field_search(field_queries, query)\n return query unless field_check? field_queries\n\n field_queries.each do |exps|\n sub_queries = build_sub_queries_with exps\n query = query.try(:and, sub_queries) || sub_queries\n end\n query\n end", "def field_search(field, q, options={})\n # Search for a match based on prefix or a string match as a backup\n query = {\n 'bool' => {\n 'minimum_should_match' => 1,\n 'should' => [\n {'prefix' => {field => q}},\n {'match' => {field => q}}\n ]\n }\n }\n\n run_query query, options\n end", "def get_solr_response_for_field_values(field, values, extra_solr_params = {})\n values ||= []\n values = [values] unless values.respond_to? :each\n value_str = \"(\\\"\" + values.to_a.join(\"\\\" OR \\\"\") + \"\\\")\"\n solr_params = {\n :defType => \"lucene\", # need boolean for OR\n :q => \"#{field}:#{value_str}\",\n # not sure why fl * is neccesary, why isn't default solr_search_params\n # sufficient, like it is for any other search results solr request? \n # But tests fail without this. I think because some functionality requires\n # this to actually get solr_doc_params, not solr_search_params. Confused\n # semantics again. \n :fl => \"*\", \n :facet => 'false',\n :spellcheck => 'false'\n }.merge(extra_solr_params)\n \n solr_response = find( self.solr_search_params().merge(solr_params) )\n document_list = solr_response.docs.collect{|doc| SolrDocument.new(doc, solr_response) }\n [solr_response,document_list]\n end", "def query_string\n _f = @params.fields.include?(:full_text) ? [:full_text] : fields\n # byebug\n a = query.gsub('/', '').scan( /\"[^\"]+\"|[^ ]+/ ).map do |word|\n if word[0] === '\"'\n m = word.match( /^\"(.*)\"$/ );\n word = m ? m[1] : word;\n end\n Unicode.downcase(word.gsub('\"', ''))\n end\n _q = '(' + a.join('* AND ') + '*)'\n # _q = '/(?=.*?'+a.join( ')(?=.*?' )+').*/';\n #byebug\n index.filter{ ~q(query_string: {fields: _f, query: \"#{_q}\", default_operator: 'or'}) } if _q.present? && _f.present?\n\n #index.query(multi_match: {query: \"#{_q}*\", fields: _f}) if _q.present? && _f.present\n end", "def proc_query(field); end", "def parse_custom(definition, field, value)\n validate_definition_instance(definition)\n validate_symbol(field)\n fail Clearly::Query::QueryArgumentError.new('field name must contain a dot (.)') unless field.to_s.include?('.')\n\n validate_not_blank(value)\n validate_hash(value)\n\n # extract table and field\n dot_index = field.to_s.index('.')\n\n other_table = field[0, dot_index].to_sym\n other_model = other_table.to_s.classify.constantize\n other_field = field[(dot_index + 1)..field.length].to_sym\n\n table_names = definition.associations_flat.map { |a| a[:join].table_name.to_sym }\n validate_name(other_table, table_names)\n\n models = definition.associations_flat.map { |a| a[:join] }\n validate_association(other_model, models)\n\n other_definition = select_definition_from_model(other_model)\n\n conditions = parse_standard_field(other_definition, other_field, value)\n subquery(definition, other_definition, conditions)\n end", "def parse_params(field, oper, value)\n case oper\n when \"eq\"\n condiciones = [field +\" = ?\", value]\n when \"lt\"\n condiciones = [field +\" < ?\", value]\n when \"le\"\n condiciones = [field +\" <= ?\", value]\n when \"gt\"\n condiciones = [field +\" > ?\", value]\n when \"ge\"\n condiciones = [field +\" >= ?\", value]\n when \"ne\"\n condiciones = [field +\" <> ?\", value]\n when \"bn\"\n condiciones = [\"not \" + field +\" like ?\", \"#{value}%\"]\n when \"bw\"\n condiciones = [field +\" like ?\", \"#{value}%\"]\n when \"ew\"\n condiciones = [field +\" like ?\", \"%#{value}\"]\n when \"cn\"\n condiciones = [field +\" like ?\", \"%#{value}%\"]\n else\n condiciones = []\n end\n return condiciones\n end", "def query_field; end", "def terms_query(field, val, options = {})\n if val.is_a?(Array)\n {terms: {field => val}.merge!(options)}\n else\n {term: {field => val}}\n end\n end", "def sql_for_field(field, operator, value, db_table, db_field, is_custom_filter=false)\n sql = ''\n case operator\n when \"=\"\n if value.any?\n case type_for(field)\n when :date, :date_past\n sql = date_clause(db_table, db_field, (Date.parse(value.first) rescue nil), (Date.parse(value.first) rescue nil))\n when :integer\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(#{db_table}.#{db_field} AS decimal(60,3)) = #{value.first.to_i})\"\n else\n sql = \"#{db_table}.#{db_field} = #{value.first.to_i}\"\n end\n when :float\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(#{db_table}.#{db_field} AS decimal(60,3)) BETWEEN #{value.first.to_f - 1e-5} AND #{value.first.to_f + 1e-5})\"\n else\n sql = \"#{db_table}.#{db_field} BETWEEN #{value.first.to_f - 1e-5} AND #{value.first.to_f + 1e-5}\"\n end\n else\n sql = \"#{db_table}.#{db_field} IN (\" + value.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \")\"\n end\n else\n # IN an empty set\n sql = \"1=0\"\n end\n when \"!\"\n if value.any?\n sql = \"(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (\" + value.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \"))\"\n else\n # NOT IN an empty set\n sql = \"1=1\"\n end\n when \"!*\"\n sql = \"#{db_table}.#{db_field} IS NULL\"\n sql << \" OR #{db_table}.#{db_field} = ''\" if is_custom_filter\n when \"*\"\n sql = \"#{db_table}.#{db_field} IS NOT NULL\"\n sql << \" AND #{db_table}.#{db_field} <> ''\" if is_custom_filter\n when \">=\"\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, (Date.parse(value.first) rescue nil), nil)\n else\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(#{db_table}.#{db_field} AS decimal(60,3)) >= #{value.first.to_f})\"\n else\n sql = \"#{db_table}.#{db_field} >= #{value.first.to_f}\"\n end\n end\n when \"<=\"\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, nil, (Date.parse(value.first) rescue nil))\n else\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(#{db_table}.#{db_field} AS decimal(60,3)) <= #{value.first.to_f})\"\n else\n sql = \"#{db_table}.#{db_field} <= #{value.first.to_f}\"\n end\n end\n when \"><\"\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, (Date.parse(value[0]) rescue nil), (Date.parse(value[1]) rescue nil))\n else\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(#{db_table}.#{db_field} AS decimal(60,3)) BETWEEN #{value[0].to_f} AND #{value[1].to_f})\"\n else\n sql = \"#{db_table}.#{db_field} BETWEEN #{value[0].to_f} AND #{value[1].to_f}\"\n end\n end\n when \"o\"\n sql = \"#{Issue.table_name}.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{connection.quoted_false})\" if field == \"status_id\"\n when \"c\"\n sql = \"#{Issue.table_name}.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{connection.quoted_true})\" if field == \"status_id\"\n when \">t-\"\n sql = relative_date_clause(db_table, db_field, - value.first.to_i, 0)\n when \"<t-\"\n sql = relative_date_clause(db_table, db_field, nil, - value.first.to_i)\n when \"t-\"\n sql = relative_date_clause(db_table, db_field, - value.first.to_i, - value.first.to_i)\n when \">t+\"\n sql = relative_date_clause(db_table, db_field, value.first.to_i, nil)\n when \"<t+\"\n sql = relative_date_clause(db_table, db_field, 0, value.first.to_i)\n when \"t+\"\n sql = relative_date_clause(db_table, db_field, value.first.to_i, value.first.to_i)\n when \"t\"\n sql = relative_date_clause(db_table, db_field, 0, 0)\n when \"ld\"\n # = yesterday\n sql = relative_date_clause(db_table, db_field, -1, -1)\n when \"w\"\n # = this week\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = Date.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago, - days_ago + 6)\n when \"lw\"\n # = last week\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = Date.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago - 7, - days_ago - 1)\n when \"l2w\"\n # = last 2 weeks\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = Date.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago - 14, - days_ago - 1)\n when \"m\"\n # = this month\n date = Date.today\n sql = date_clause(db_table, db_field, date.beginning_of_month, date.end_of_month)\n when \"lm\"\n # = last month\n date = Date.today.prev_month\n sql = date_clause(db_table, db_field, date.beginning_of_month, date.end_of_month)\n when \"y\"\n # = this year\n date = Date.today\n sql = date_clause(db_table, db_field, date.beginning_of_year, date.end_of_year)\n when \"~\"\n sql = \"LOWER(#{db_table}.#{db_field}) LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'\"\n when \"!~\"\n sql = \"LOWER(#{db_table}.#{db_field}) NOT LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'\"\n else\n raise \"Unknown query operator #{operator}\"\n end\n\n return sql\n end", "def field_concatinator(field, values)\n if values.size > 0\n list = [([\"#{field} ~* ?\"]*values.size).join(\" AND \")] + values\n list[0] = \"(#{list[0]})\"\n list\n else\n []\n end\n end", "def sql_query\n case @operator\n when :equals\n arel_field.eq(transmogrified_value)\n when :does_not_equal\n arel_field.not_eq(transmogrified_value)\n when :contains\n arel_field.matches(\"%#{transmogrified_value}%\")\n when :does_not_contain\n arel_field.does_not_match(\"%#{transmogrified_value}%\")\n when :starts_with\n arel_field.matches(\"#{transmogrified_value}%\")\n when :ends_with\n arel_field.matches(\"%#{transmogrified_value}\")\n when :greater_than\n arel_field.gt(transmogrified_value)\n when :greater_than_or_equal_to\n arel_field.gteq(transmogrified_value)\n when :less_than\n arel_field.lt(transmogrified_value)\n when :less_than_or_equal_to\n arel_field.lteq(transmogrified_value)\n when :in\n arel_field.in(transmogrified_value.split(/\\,\\s*/))\n when :not_in\n arel_field.not_in(transmogrified_value.split(/\\,\\s*/))\n when :blank\n arel_field.eq(nil)\n when :not_blank\n arel_field.not_eq(nil)\n end\n end", "def sql_for_field(field, operator, value, db_table, db_field, is_custom_filter=false)\n sql = ''\n case operator\n when \"=\"\n if value.any?\n case type_for(field)\n when :date, :date_past\n sql = date_clause(db_table, db_field, (Date.parse(value.first) rescue nil), (Date.parse(value.first) rescue nil))\n when :integer\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) = #{value.first.to_i})\"\n else\n sql = \"#{db_table}.#{db_field} = #{value.first.to_i}\"\n end\n when :float\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) BETWEEN #{value.first.to_f - 1e-5} AND #{value.first.to_f + 1e-5})\"\n else\n sql = \"#{db_table}.#{db_field} BETWEEN #{value.first.to_f - 1e-5} AND #{value.first.to_f + 1e-5}\"\n end\n else\n sql = \"#{db_table}.#{db_field} IN (\" + value.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \")\"\n end\n else\n # IN an empty set\n sql = \"1=0\"\n end\n when \"!\"\n if value.any?\n sql = \"(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (\" + value.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \"))\"\n else\n # NOT IN an empty set\n sql = \"1=1\"\n end\n when \"!*\"\n sql = \"#{db_table}.#{db_field} IS NULL\"\n sql << \" OR #{db_table}.#{db_field} = ''\" if is_custom_filter\n when \"*\"\n sql = \"#{db_table}.#{db_field} IS NOT NULL\"\n sql << \" AND #{db_table}.#{db_field} <> ''\" if is_custom_filter\n when \">=\"\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, (Date.parse(value.first) rescue nil), nil)\n else\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) >= #{value.first.to_f})\"\n else\n sql = \"#{db_table}.#{db_field} >= #{value.first.to_f}\"\n end\n end\n when \"<=\"\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, nil, (Date.parse(value.first) rescue nil))\n else\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) <= #{value.first.to_f})\"\n else\n sql = \"#{db_table}.#{db_field} <= #{value.first.to_f}\"\n end\n end\n when \"><\"\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, (Date.parse(value[0]) rescue nil), (Date.parse(value[1]) rescue nil))\n else\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) BETWEEN #{value[0].to_f} AND #{value[1].to_f})\"\n else\n sql = \"#{db_table}.#{db_field} BETWEEN #{value[0].to_f} AND #{value[1].to_f}\"\n end\n end\n when \"o\"\n sql = \"#{queried_table_name}.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{connection.quoted_false})\" if field == \"status_id\"\n when \"c\"\n sql = \"#{queried_table_name}.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{connection.quoted_true})\" if field == \"status_id\"\n when \"><t-\"\n # between today - n days and today\n sql = relative_date_clause(db_table, db_field, - value.first.to_i, 0)\n when \">t-\"\n # >= today - n days\n sql = relative_date_clause(db_table, db_field, - value.first.to_i, nil)\n when \"<t-\"\n # <= today - n days\n sql = relative_date_clause(db_table, db_field, nil, - value.first.to_i)\n when \"t-\"\n # = n days in past\n sql = relative_date_clause(db_table, db_field, - value.first.to_i, - value.first.to_i)\n when \"><t+\"\n # between today and today + n days\n sql = relative_date_clause(db_table, db_field, 0, value.first.to_i)\n when \">t+\"\n # >= today + n days\n sql = relative_date_clause(db_table, db_field, value.first.to_i, nil)\n when \"<t+\"\n # <= today + n days\n sql = relative_date_clause(db_table, db_field, nil, value.first.to_i)\n when \"t+\"\n # = today + n days\n sql = relative_date_clause(db_table, db_field, value.first.to_i, value.first.to_i)\n when \"t\"\n # = today\n sql = relative_date_clause(db_table, db_field, 0, 0)\n when \"ld\"\n # = yesterday\n sql = relative_date_clause(db_table, db_field, -1, -1)\n when \"w\"\n # = this week\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = Date.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago, - days_ago + 6)\n when \"lw\"\n # = last week\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = Date.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago - 7, - days_ago - 1)\n when \"l2w\"\n # = last 2 weeks\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = Date.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago - 14, - days_ago - 1)\n when \"m\"\n # = this month\n date = Date.today\n sql = date_clause(db_table, db_field, date.beginning_of_month, date.end_of_month)\n when \"lm\"\n # = last month\n date = Date.today.prev_month\n sql = date_clause(db_table, db_field, date.beginning_of_month, date.end_of_month)\n when \"y\"\n # = this year\n date = Date.today\n sql = date_clause(db_table, db_field, date.beginning_of_year, date.end_of_year)\n when \"~\"\n sql = \"LOWER(#{db_table}.#{db_field}) LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'\"\n when \"!~\"\n sql = \"LOWER(#{db_table}.#{db_field}) NOT LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'\"\n else\n raise \"Unknown query operator #{operator}\"\n end\n\n return sql\n end", "def solr_documents_by_field_values_params(field, values)\n q = if Array(values).empty?\n \"{!lucene}NOT *:*\"\n else\n \"{!lucene}#{field}:(#{ Array(values).map { |x| solr_param_quote(x) }.join(\" OR \")})\"\n end\n\n { q: q, spellcheck: 'false', fl: \"*\" }\n end", "def query\n case query_type_str\n when 'empty'\n return\n when 'iso'\n return iso_query_builder\n when 'multi'\n return multi_query_builder\n end\n end", "def sql_for_field(field, operator, value, db_table, db_field, is_custom_filter=false)\n sql = ''\n\n #---------------\n # Smile specific : manage case where db_table param is not provided\n db_table_and_field = (db_table.present? ? \"#{db_table}.\" : '') + \"#{db_field}\"\n\n case operator\n when \"=\"\n if value.any?\n case type_for(field)\n when :date, :date_past\n sql = date_clause(db_table, db_field, parse_date(value.first), parse_date(value.first), is_custom_filter)\n when :integer\n int_values = value.first.to_s.scan(/[+-]?\\d+/).map(&:to_i).join(\",\")\n #---------------\n # Smile specific : manage case where db_table param is not provided\n if int_values.present?\n if is_custom_filter\n sql = \"(#{db_table_and_field} <> '' AND CAST(CASE #{db_table_and_field} WHEN '' THEN '0' ELSE #{db_table_and_field} END AS decimal(30,3)) = #{int_values})\"\n else\n sql = \"#{db_table_and_field} IN (#{int_values})\"\n end\n else\n sql = \"1=0\"\n end\n when :float\n #---------------\n # Smile specific : manage case where db_table param is not provided\n if is_custom_filter\n sql = \"(#{db_table_and_field} <> '' AND CAST(CASE #{db_table_and_field} WHEN '' THEN '0' ELSE #{db_table_and_field} END AS decimal(30,3)) BETWEEN #{value.first.to_f - 1e-5} AND #{value.first.to_f + 1e-5})\"\n else\n sql = \"#{db_table_and_field} BETWEEN #{value.first.to_f - 1e-5} AND #{value.first.to_f + 1e-5}\"\n end\n else\n sql = queried_class.send(:sanitize_sql_for_conditions, [\"#{db_table_and_field} IN (?)\", value])\n end\n else\n # IN an empty set\n sql = \"1=0\"\n end\n when \"!\"\n if value.any?\n # Smile specific : manage case where db_table param is not provided\n sql = queried_class.send(:sanitize_sql_for_conditions, [\"(#{db_table_and_field} IS NULL OR #{db_table_and_field} NOT IN (?))\", value])\n else\n # NOT IN an empty set\n sql = \"1=1\"\n end\n when \"!*\"\n #---------------\n # Smile specific : manage case where db_table param is not provided\n sql = \"#{db_table_and_field} IS NULL\"\n sql << \" OR #{db_table_and_field} = ''\" if (is_custom_filter || [:text, :string].include?(type_for(field)))\n when \"*\"\n #---------------\n # Smile specific : manage case where db_table param is not provided\n sql = \"#{db_table_and_field} IS NOT NULL\"\n sql << \" AND #{db_table_and_field} <> ''\" if is_custom_filter\n when \">=\"\n #---------------\n # Smile specific #147568 Filter on parent task\n # Smile specific : manage case where db_table param is not provided\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, parse_date(value.first), nil, is_custom_filter)\n else\n #---------------\n # Smile specific : manage case where db_table param is not provided\n if is_custom_filter\n sql = \"(#{db_table_and_field} <> '' AND CAST(CASE #{db_table_and_field} WHEN '' THEN '0' ELSE #{db_table_and_field} END AS decimal(30,3)) >= #{value.first.to_f})\"\n else\n sql = \"#{db_table_and_field} >= #{value.first.to_f}\"\n end\n end\n when \"<=\"\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, nil, parse_date(value.first), is_custom_filter)\n else\n #---------------\n # Smile specific #147568 Filter on parent task\n # Smile specific, manage case where db_table param is not provided\n if is_custom_filter\n sql = \"(#{db_table_and_field} <> '' AND CAST(CASE #{db_table_and_field} WHEN '' THEN '0' ELSE #{db_table_and_field} END AS decimal(30,3)) <= #{value.first.to_f})\"\n else\n sql = \"#{db_table_and_field} <= #{value.first.to_f}\"\n end\n end\n when \"><\"\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, parse_date(value[0]), parse_date(value[1]), is_custom_filter)\n else\n #---------------\n # Smile specific : manage case where db_table param is not provided\n if is_custom_filter\n sql = \"(#{db_table_and_field} <> '' AND CAST(CASE #{db_table_and_field} WHEN '' THEN '0' ELSE #{db_table_and_field} END AS decimal(30,3)) BETWEEN #{value[0].to_f} AND #{value[1].to_f})\"\n else\n sql = \"#{db_table_and_field} BETWEEN #{value[0].to_f} AND #{value[1].to_f}\"\n end\n end\n when \"o\"\n sql = \"#{queried_table_name}.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{self.class.connection.quoted_false})\" if field == \"status_id\"\n when \"c\"\n sql = \"#{queried_table_name}.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{self.class.connection.quoted_true})\" if field == \"status_id\"\n when \"><t-\"\n # between today - n days and today\n sql = relative_date_clause(db_table, db_field, - value.first.to_i, 0, is_custom_filter)\n when \">t-\"\n # >= today - n days\n sql = relative_date_clause(db_table, db_field, - value.first.to_i, nil, is_custom_filter)\n when \"<t-\"\n # <= today - n days\n sql = relative_date_clause(db_table, db_field, nil, - value.first.to_i, is_custom_filter)\n when \"t-\"\n # = n days in past\n sql = relative_date_clause(db_table, db_field, - value.first.to_i, - value.first.to_i, is_custom_filter)\n when \"><t+\"\n # between today and today + n days\n sql = relative_date_clause(db_table, db_field, 0, value.first.to_i, is_custom_filter)\n when \">t+\"\n # >= today + n days\n sql = relative_date_clause(db_table, db_field, value.first.to_i, nil, is_custom_filter)\n when \"<t+\"\n # <= today + n days\n sql = relative_date_clause(db_table, db_field, nil, value.first.to_i, is_custom_filter)\n when \"t+\"\n # = today + n days\n sql = relative_date_clause(db_table, db_field, value.first.to_i, value.first.to_i, is_custom_filter)\n when \"t\"\n # = today\n sql = relative_date_clause(db_table, db_field, 0, 0, is_custom_filter)\n when \"ld\"\n # = yesterday\n sql = relative_date_clause(db_table, db_field, -1, -1, is_custom_filter)\n when \"w\"\n # = this week\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = User.current.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago, - days_ago + 6, is_custom_filter)\n when \"lw\"\n # = last week\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = User.current.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago - 7, - days_ago - 1, is_custom_filter)\n when \"l2w\"\n # = last 2 weeks\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = User.current.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago - 14, - days_ago - 1, is_custom_filter)\n when \"m\"\n # = this month\n date = User.current.today\n sql = date_clause(db_table, db_field, date.beginning_of_month, date.end_of_month, is_custom_filter)\n when \"lm\"\n # = last month\n date = User.current.today.prev_month\n sql = date_clause(db_table, db_field, date.beginning_of_month, date.end_of_month, is_custom_filter)\n when \"y\"\n # = this year\n date = User.current.today\n sql = date_clause(db_table, db_field, date.beginning_of_year, date.end_of_year, is_custom_filter)\n when \"~\"\n sql = sql_contains(\"#{db_table_and_field}\", value.first)\n when \"!~\"\n sql = sql_contains(\"#{db_table_and_field}\", value.first, false)\n else\n raise \"Unknown query operator #{operator}\"\n end\n\n return sql\n end", "def parse_field(field_name)\n element_spec = @@spec.values.\n select {|v| (v['name']) =~ /^#{field_name}$/i}.\n first\n self.send(element_spec['node'])\n end", "def gteq(field, value)\n tap { filters << \"#{field}.gteq('#{value}')\" }\n end", "def parse_query(query); end", "def parse_query(query); end", "def grouping_query(field, phrase, op = 'AND')\n raise 'op must be AND or OR' unless ['AND', 'OR'].include? op\n\n \"_query_:\\\"{!lucene q.op=#{op}}#{field}:(#{phrase})\\\"\"\n end", "def validate!\n if query.present?\n # Construct field and value from the query\n parts = query.split(':')\n unless parts.size == 2\n raise ArgumentError, 'facet query not separated by colon'\n end\n\n self.field = parts[0].to_sym\n self.value = parts[1]\n\n # Strip quotes from the value if present\n self.value = value[1..-2] if value[0] == '\"' && value[-1] == '\"'\n\n # We only know how to handle one field, year\n unless field == :year\n raise ArgumentError, \"do not know how to handle facet queries for #{field}\"\n end\n else\n raise ArgumentError, 'facet without field' if field.blank?\n raise ArgumentError, 'facet without value' if value.blank?\n\n # We only know how to handle :authors_facet and :journal_facet\n unless %i[authors_facet journal_facet].include?(field)\n raise ArgumentError, \"do not know how to handle facets on #{field}\"\n end\n\n # Strip quotes from the value if present\n self.value = value[1..-2] if value[0] == '\"' && value[-1] == '\"'\n\n # Construct the query from field and value\n self.query = \"#{field}:\\\"#{value}\\\"\"\n end\n end", "def to_single_field_sql(builder, definition, &block)\n raise ScopedSearch::QueryNotSupported, \"Field name not a leaf node\" unless lhs.kind_of?(ScopedSearch::QueryLanguage::AST::LeafNode)\n raise ScopedSearch::QueryNotSupported, \"Value not a leaf node\" unless rhs.kind_of?(ScopedSearch::QueryLanguage::AST::LeafNode)\n\n # Search only on the given field.\n field = definition.field_by_name(lhs.value)\n raise ScopedSearch::QueryNotSupported, \"Field '#{lhs.value}' not recognized for searching!\" unless field\n\n # see if the value passes user defined validation\n if operator == :in\n rhs.value.split(',').each { |v| validate_value(field, v) }\n else\n validate_value(field, rhs.value)\n end\n\n builder.sql_test(field, operator, rhs.value,lhs.value, &block)\n end", "def query(value)\n merge(geuquery: value.to_s)\n end", "def query(value)\n value.each do |field, rx|\n @query_rx[field] = rx\n end\n end", "def search(selectable, field, query)\n if query.is_a?(Hash) || query.to_s.include?('/')\n low, high = query.is_a?(Hash) ? [query[:l] || query['l'], query[:h] || query['h']] : query.to_s.split('/')\n\n if low.to_i > 0\n selectable = selectable.gte(field => low.to_i)\n end\n\n if high.to_i > 0\n selectable = selectable.lte(field => high.to_i)\n end\n\n selectable\n else\n selectable.where(field => query.to_i)\n end\n end", "def lteq(field, value)\n tap { filters << \"#{field}.lteq('#{value}')\" }\n end", "def parse_query(query=nil, options={}, models=nil)\n valid_options = [:offset, :limit, :facets, :models, :results_format, :order, :scores, :operator, :page, :per_page, :conditions, :find]\n\n if options[:page] and options[:per_page]\n options[:limit] = options[:per_page].to_i\n options[:offset] = (options[:page].to_i - 1 ) * options[:limit]\n end\n\n if options[:limit] and options[:offset].nil?\n options[:limit] = options[:per_page] = 15\n end\n\n query_options = {}\n return if query.nil?\n raise \"Invalid parameters: #{(options.keys - valid_options).join(',')}\" unless (options.keys - valid_options).empty?\n\n Deprecation.validate_query(options)\n query_options[:start] = options[:offset]\n query_options[:rows] = options[:limit]\n query_options[:operator] = options[:operator]\n\n # first steps on the facet parameter processing\n if options[:facets]\n query_options[:facets] = {}\n query_options[:facets][:limit] = -1 # TODO: make this configurable\n query_options[:facets][:sort] = :count if options[:facets][:sort]\n query_options[:facets][:mincount] = 0\n query_options[:facets][:mincount] = 1 if options[:facets][:zeros] == false\n query_options[:facets][:fields] = options[:facets][:fields].collect{|k| \"#{k}_facet\"} if options[:facets][:fields]\n query_options[:filter_queries] = replace_types(options[:facets][:browse].collect{|k| \"#{k.sub!(/ *: */,\"_facet:\")}\"}) if options[:facets][:browse]\n query_options[:facets][:queries] = replace_types(options[:facets][:query].collect{|k| \"#{k.sub!(/ *: */,\"_t:\")}\"}) if options[:facets][:query]\n end\n \n if models.nil?\n # TODO: use a filter query for type, allowing Solr to cache it individually\n models = \"AND #{solr_configuration[:type_field]}:#{self.name}\"\n field_list = solr_configuration[:primary_key_field]\n else\n field_list = \"id\"\n end\n \n query_options[:field_list] = [field_list, 'score']\n query = \"(#{query.gsub(/ *: */,\"_t:\")}) #{models}\"\n order = options[:order].split(/\\s*,\\s*/).collect{|e| e.gsub(/\\s+/,'_t ').gsub(/\\bscore_t\\b/, 'score') }.join(',') if options[:order]\n query_options[:query] = replace_types([query])[0] # TODO adjust replace_types to work with String or Array\n\n if options[:order]\n # TODO: set the sort parameter instead of the old ;order. style.\n query_options[:query] << ';' << replace_types([order], false)[0]\n end\n \n ActsAsSolr::Post.execute(Solr::Request::Standard.new(query_options))\n end", "def initialize(query, field = :name)\n fail UnsupportedIndex unless %w(name sncf_id).include?(field.to_s)\n @query = query\n @by = field\n end", "def get_solr_response_for_field_values(field, values, extra_controller_params = {})\n # solr_response = query_solr(params, extra_controller_params.merge(solr_documents_by_field_values_params(field, values)))\n #\n # [solr_response, solr_response.documents]\n\n # Updated Blacklight 5.10.x version of this deprecated function...\n\n query =\n search_builder.with(params).merge(extra_controller_params).merge(solr_documents_by_field_values_params(field, values))\n\n solr_response = repository.search(query)\n\n [solr_response, solr_response.documents]\n end", "def parse_standard_field(definition, field, value)\n validate_definition_instance(definition)\n validate_symbol(field)\n validate_not_blank(value)\n validate_hash(value)\n value.map do |operator, operation_value|\n condition_components(operator, definition.table, field, definition.all_fields, operation_value)\n end\n end", "def query\n unless @query\n parse_query()\n end\n @query\n end", "def query(query, phrase=false)\n if phrase\n q = %q[]\n params['q'] = query.gsub(\" \",\"+\").gsub('\"',\"'\")\n else\n params['q'] = CGI.escape(query)\n end\n params.merge!({'fq' => query_filters.uniq.join(\"+AND+\")}) unless query_filters.empty?\n self\n end", "def with_field(value)\n @query_hash[WITH_FIELD][value] = value\n self\n end", "def parse_query(query=nil, options={}, models=nil)\n valid_options = [:offset, :limit, :facets, :models, :results_format, :order, :scores, :operator]\n query_options = {}\n return if query.nil?\n raise \"Invalid parameters: #{(options.keys - valid_options).join(',')}\" unless (options.keys - valid_options).empty?\n begin\n Deprecation.validate_query(options)\n query_options[:start] = options[:offset]\n query_options[:rows] = options[:limit]\n query_options[:operator] = options[:operator]\n \n # first steps on the facet parameter processing\n if options[:facets]\n query_options[:facets] = {}\n query_options[:facets][:limit] = -1 # TODO: make this configurable\n query_options[:facets][:sort] = :count if options[:facets][:sort]\n query_options[:facets][:mincount] = 0\n query_options[:facets][:mincount] = 1 if options[:facets][:zeros] == false\n query_options[:facets][:fields] = options[:facets][:fields].collect{|k| \"#{k}_facet\"} if options[:facets][:fields]\n query_options[:filter_queries] = replace_types(options[:facets][:browse].collect{|k| \"#{k.sub!(/ *: */,\"_facet:\")}\"}) if options[:facets][:browse]\n query_options[:facets][:queries] = replace_types(options[:facets][:query].collect{|k| \"#{k.sub!(/ *: */,\"_t:\")}\"}) if options[:facets][:query]\n end\n \n if models.nil?\n # TODO: use a filter query for type, allowing Solr to cache it individually\n models = \"AND #{solr_configuration[:type_field]}:#{self.name}\"\n field_list = solr_configuration[:primary_key_field]\n else\n field_list = \"id\"\n end\n \n query_options[:field_list] = [field_list, 'score']\n query = \"(#{query.gsub(/ *: */,\"_t:\")}) #{models}\"\n order = options[:order].split(/\\s*,\\s*/).collect{|e| e.gsub(/\\s+/,'_t ').gsub(/\\bscore_t\\b/, 'score') }.join(',') if options[:order] \n query_options[:query] = replace_types([query])[0] # TODO adjust replace_types to work with String or Array \n\n if options[:order]\n # TODO: set the sort parameter instead of the old ;order. style.\n query_options[:query] << ';' << replace_types([order], false)[0]\n end\n \n ActsAsSolr::Post.execute(Solr::Request::Standard.new(query_options))\n rescue\n raise \"There was a problem executing your search: #{$!}\"\n end \n end", "def initialize field, operator, value\n @field = field\n @operator = operator\n if @operator == :eq && value.class == String\n value = /^#{value}$/\n else\n value = value\n end\n @value = value\n\n method_string = 'def compare(inval);'\n if value.class == Regexp\n if operator == :eq\n method_string += \" inval.match(@value);\"\n else\n raise ArgumentError, \"operation #{operator} does not work with a regexp\"\n end\n else\n if operator == :eq\n method_string += \" inval == @value;\"\n elsif operator == :lt\n method_string += \" inval < @value;\"\n elsif operator == :gt\n method_string += \" inval > @value;\"\n end\n end\n method_string += 'end;'\n self.instance_eval method_string\n end", "def sql_for_field(field, operator, value, db_table, db_field, is_custom_filter=false)\n sql = ''\n case operator\n when \"=\"\n sql = \"#{db_table}.#{db_field} IN (\" + value.collect{|val| \"'#{connection.quoted_string(val)}'\"}.join(\",\") + \")\"\n when \"!\"\n sql = \"(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (\" + value.collect{|val| \"'#{connection.quoted_string(val)}'\"}.join(\",\") + \"))\"\n when \"!*\"\n sql = \"#{db_table}.#{db_field} IS NULL\"\n sql << \" OR #{db_table}.#{db_field} = ''\" if is_custom_filter\n when \"*\"\n sql = \"#{db_table}.#{db_field} IS NOT NULL\"\n sql << \" AND #{db_table}.#{db_field} <> ''\" if is_custom_filter\n when \">=\"\n sql = \"#{db_table}.#{db_field} >= #{value.first.to_f}\"\n when \"<=\"\n sql = \"#{db_table}.#{db_field} <= #{value.first.to_f}\"\n when \"o\"\n sql = \"#{IssueStatus.table_name}.is_closed=#{connection.quoted_false}\" if field == \"status_id\"\n when \"c\"\n sql = \"#{IssueStatus.table_name}.is_closed=#{connection.quoted_true}\" if field == \"status_id\"\n when \">t-\"\n sql = date_range_clause(db_table, db_field, - value.first.to_i, 0)\n when \"<t-\"\n sql = date_range_clause(db_table, db_field, nil, - value.first.to_i)\n when \"t-\"\n sql = date_range_clause(db_table, db_field, - value.first.to_i, - value.first.to_i)\n when \">t+\"\n sql = date_range_clause(db_table, db_field, value.first.to_i, nil)\n when \"<t+\"\n sql = date_range_clause(db_table, db_field, 0, value.first.to_i)\n when \"t+\"\n sql = date_range_clause(db_table, db_field, value.first.to_i, value.first.to_i)\n when \"t\"\n sql = date_range_clause(db_table, db_field, 0, 0)\n when \"w\"\n from = l(:general_first_day_of_week) == '7' ?\n # week starts on sunday\n ((Date.today.cwday == 7) ? Time.now.at_beginning_of_day : Time.now.at_beginning_of_week - 1.day) :\n # week starts on monday (Rails default)\n Time.now.at_beginning_of_week\n sql = \"#{db_table}.#{db_field} BETWEEN '%s' AND '%s'\" % [connection.quoted_date(from), connection.quoted_date(from + 7.days)]\n when \"~\"\n sql = \"LOWER(#{db_table}.#{db_field}) LIKE '%#{connection.quoted_string(value.first.to_s.downcase)}%'\"\n when \"!~\"\n sql = \"LOWER(#{db_table}.#{db_field}) NOT LIKE '%#{connection.quoted_string(value.first.to_s.downcase)}%'\"\n when \"..\"\n from = nil\n to = nil\n sql = \"\"\n from = Date.parse(value[1])\n to = Date.parse(value[2])\n sql = value_in_date_range(db_table, db_field, from, to)\n end\n return sql\n end", "def translate_value(field, value)\n translated_value = field.complete_value[value.to_sym]\n raise ScopedSearch::QueryNotSupported, \"'#{field.field}' should be one of '#{field.complete_value.keys.join(', ')}', but the query was '#{value}'\" if translated_value.nil?\n translated_value\n end", "def add_general_query\n fields = [\n \"creators.name^5\",\n \"title^7\",\n \"endnotes\",\n \"notes\",\n \"summary\",\n \"tags.name\",\n \"series.title\"\n ]\n query_string = options[:q]\n return if query_string.blank?\n body.must(\n :query_string,\n fields: fields,\n query: query_string\n )\n end", "def query\n normalize_query(phrase_query, query_filters.compact)\n end", "def query( query )\n query.downcase!\n case query\n when /^:r:/ then query_regexp query.gsub(/^:r:/, '')\n when /^:f:/ then query_fulltext_regexp query.gsub(/^:f:/, '')\n else query_simple query\n end\n end", "def search_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end", "def query_string(expr)\n new(dataset.query_string(expr))\n end", "def initialize(field_name, value)\n @field_name = field_name\n @value = value\n end", "def is_query_valid\n # skip test for null prefix operators if in the process of completing the field name.\n return if(last_token_is(NULL_PREFIX_OPERATORS, 2) && !(query =~ /(\\s|\\)|,)$/))\n QueryBuilder.build_query(definition, query)\n end", "def search_fields(val)\n raise \"search_fields requires a String.\" unless val.is_a? String\n @searchFields = val\n self\n end", "def parse_query(query)\n parse_params(parse_nested_query(query))\n end", "def query_clause(type, key, value)\n \"_query_:\\\"{!#{type} f=#{key}}#{value.gsub('\"', '\\\"')}\\\"\"\n end", "def to_query(col, value, op = '=')\n return op == '=' ? \"(#{col} IS NULL)\" : \"(#{col} IS NOT NULL)\" if value.nil?\n\n case op.downcase\n when '=', '!='\n if value.is_a?(Array)\n rhs = 'IN (' + Array.new(value.length, '?').join(', ') + ')'\n rhs = 'NOT ' + rhs if op == '!='\n else\n rhs = op + ' ?'\n end\n when 'between'\n rhs = 'BETWEEN ? AND ?'\n when 'not between'\n rhs = 'NOT BETWEEN ? AND ?'\n when 'like'\n rhs = 'LIKE ?'\n when 'not like'\n rhs = 'NOT LIKE ?'\n else\n rhs = op + ' ?'\n end\n\n lhs = col.to_s\n lhs = \"LOWER(#{lhs})\" if @columns[col] == :string\n\n \"(#{lhs} #{rhs})\"\n end", "def stringToQuery (val)\n\t\t\n\tend", "def query_clause(type, key, value)\n \"_query_:\\\"{!#{type} f=#{key}}#{value.gsub('\"', '\\\"')}\\\"\"\n end", "def query_param(key_name)\n\n # Turn the string into a valid Ruby accessor name: replace \"-\" with \"_\"\n accessor_name = QueryString.get_accessor_name(key_name)\n\n # Create a new class that represents query string parameters\n field accessor_name, QueryString, :key_name => key_name\n\n end", "def query_clause(type, key, value)\n \"_query_:\\\"{!#{type} f=#{key}}#{value.gsub('\"', '\\\"')}\\\"\"\n end", "def query=(value)\n @query = value\n end", "def query=(value)\n @query = value\n end", "def query=(value)\n @query = value\n end", "def query(query, args = {})\n args[:q] = query\n args[:qt] = 'standard'\n conn = ActiveFedora::SolrService.instance.conn\n result = conn.post('select', data: args)\n result.fetch('response').fetch('docs')\n end", "def test_facet_search_with_query\n records = Electronic.find_with_facet \"memory\", :facets => {:query => [\"price:[* TO 200.00]\",\n \"price:[200.00 TO 500.00]\",\n \"price:[500.00 TO *]\"]},\n :field_types => {:price => :range_float}\n assert_equal 4, records[:docs].size\n assert_equal({\"facet_queries\" => {\"price_rf:[* TO 200.00]\"=>2,\n \"price_rf:[500.00 TO *]\"=>1,\n \"price_rf:[200.00 TO 500.00]\"=>1}, \n \"facet_fields\" => {}}, records[:facets])\n end", "def query(query, args = {})\n args.merge!(q: query, qt: 'standard')\n conn = ActiveFedora::SolrService.instance.conn\n result = conn.post('select', data: args)\n result.fetch('response').fetch('docs')\n end", "def filter(field, operator, value, value2=nil)\n operator = operator.to_s.upcase\n raise ArgumentError, \"invalid operator\" unless Operators.include?(operator)\n \n chain { |x|\n filter = { 'field' => field, 'operator' => operator, 'value1' => value.to_s }\n filter['value2'] = value2.to_s if operator == 'BETWEEN'\n x.filters << filter\n }\n end", "def initialize(field, expression = nil)\n @field, @expression = field, expression\n end", "def solr_query(query, options = {})\n query_options = generate_query_options(query, options)\n activerecord_options = extract_activerecord_options(options)\n SolrSearchable::Handler::Select.new(query_options, self, {:format => :raw}).execute\n end", "def to_query\n hash = {:fields => [], :operators => {}, :values => {}}\n active_filters.each do |f|\n hash[:fields] << f.name\n hash[:operators][f.name] = f.operator\n hash[:values][f.name] = f.value\n end\n hash.to_query\n end", "def parse_query\n @attributes = nil\n @scope = nil\n @filter = nil\n @extensions = nil\n\n if @query\n attrs, scope, filter, extensions = @query.split('?')\n\n @attributes = attrs if attrs && attrs.size > 0\n @scope = scope if scope && scope.size > 0\n @filter = filter if filter && filter.size > 0\n @extensions = extensions if extensions && extensions.size > 0\n end\n end", "def indexed_value_for(field, value)\n if @config.numeric?(field)\n Java::OrgNeo4jIndexLucene::ValueContext.new(value).indexNumeric\n else\n Java::OrgNeo4jIndexLucene::ValueContext.new(value)\n end\n end", "def parse_query(qs, d = T.unsafe(nil), &unescaper); end", "def parse_query(qs, d = T.unsafe(nil), &unescaper); end", "def build_query\n Jbuilder.encode do |j|\n j.track_total_hits true\n j.query do\n j.bool do\n # Query\n if @multi_queries.any?\n j.must do\n @multi_queries.each do |query|\n j.child! do\n if query[:term].kind_of?(String)\n # https://www.elastic.co/guide/en/elasticsearch/reference/7.17/query-dsl-match-query.html\n j.simple_query_string do\n j.query sanitize(query[:term])\n j.default_operator \"OR\"\n j.flags \"PHRASE\"\n j.lenient true\n j.quote_field_suffix RegisteredElement::EXACT_FIELD_SUFFIX\n j.fields [query[:field]]\n end\n else\n j.range do\n j.set! query[:field] do\n term = query[:term]\n if term[:from_year].present? || term[:to_year].present? # date range\n if term[:from_year].present?\n from_date = Time.new(term[:from_year].to_i,\n term[:from_month].present? ? term[:from_month].to_i : nil,\n term[:from_day].present? ? term[:from_day].to_i : nil)\n j.gte from_date.strftime(\"%Y-%m-%d\")\n end\n if term[:to_year].present?\n to_date = Time.new(term[:to_year].to_i,\n term[:to_month].present? ? term[:to_month].to_i : nil,\n term[:to_day].present? ? term[:to_day].to_i : nil)\n j.lte to_date.strftime(\"%Y-%m-%d\")\n end\n else # exact date (maybe excluding month or day)\n from_date = Time.new(term[:year].present? ? term[:year].to_i : nil,\n term[:month].present? ? term[:month].to_i : nil,\n term[:day].present? ? term[:day].to_i : nil)\n to_date = from_date.dup\n if term[:day].present?\n to_date = to_date + 1.day\n elsif term[:month].present?\n to_date = to_date + 1.month\n else\n to_date = to_date + 1.year\n end\n j.gte from_date.strftime(\"%Y-%m-%d\")\n j.lt to_date.strftime(\"%Y-%m-%d\")\n end\n end\n end\n end\n end\n end\n end\n elsif @query\n j.must do\n if @query[:term].kind_of?(String)\n # https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html\n j.simple_query_string do\n j.query sanitize(@query[:term])\n j.default_operator \"AND\"\n j.flags \"PHRASE\"\n j.lenient true\n j.quote_field_suffix RegisteredElement::EXACT_FIELD_SUFFIX\n j.fields @query[:fields]\n end\n elsif @query[:term].respond_to?(:keys) && (@query[:term][:year] || @query[:term][:from_year])\n date_range_from_query(j, @query)\n end\n end\n end\n\n j.filter do\n j.bool do\n j.must do\n j.child! do\n j.term do\n j.set! OpenSearchIndex::StandardFields::CLASS, get_class.to_s\n end\n end\n if @exists_field\n j.child! do\n j.exists do\n j.field @exists_field\n end\n end\n end\n @filters.each do |key_value|\n if key_value[1].respond_to?(:each)\n j.child! do\n j.bool do\n j.should do\n key_value[1].each do |term|\n j.child! do\n j.term do\n j.set! key_value[0], term\n end\n end\n end\n end\n end\n end\n elsif !key_value[1].nil?\n j.child! do\n j.term do\n j.set! key_value[0], key_value[1]\n end\n end\n end\n end\n @filter_ranges.each do |range|\n j.child! do\n j.range do\n j.set! range[:field] do\n j.set! range[:op], range[:value]\n end\n end\n end\n end\n end\n if @must_nots.any? || @must_not_ranges.any?\n j.must_not do\n @must_nots.each do |key_value|\n unless key_value[1].nil?\n j.child! do\n if key_value[0].respond_to?(:each)\n j.terms do\n j.set! key_value[0], key_value[1]\n end\n else\n j.term do\n j.set! key_value[0], key_value[1]\n end\n end\n end\n end\n end\n @must_not_ranges.each do |range|\n j.child! do\n j.range do\n j.set! range[:field] do\n j.set! range[:op], range[:value]\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\n\n # Aggregations\n j.aggregations do\n if @aggregations\n facet_elements.each do |element|\n j.set! element[:keyword_field] do\n j.terms do\n j.field element[:keyword_field]\n j.size @bucket_limit\n end\n end\n end\n end\n end\n\n # Ordering\n # Order by explicit orders, if provided; otherwise sort by the metadata\n # profile's default order, if @orders is set to true; otherwise don't\n # sort.\n if @orders.respond_to?(:any?) && @orders.any?\n j.sort do\n @orders.each do |order|\n j.child! do\n j.set! order[:field] do\n j.order order[:direction]\n j.unmapped_type \"keyword\" unless order[:field] == OpenSearchIndex::StandardFields::SCORE\n end\n end\n end\n end\n elsif @orders\n end\n\n # search_after\n if @search_after\n j.search_after @search_after\n end\n\n # Start\n if @start.present?\n j.from @start\n end\n\n # Limit\n if @limit.present?\n j.size @limit\n end\n end\n end", "def wc_query_field(field_id)\n @columns.each do |c|\n if c[:id] == field_id then \n return c[:query]\n end\n end\n field_id\n end", "def where(field, value)\n field = field.to_sym\n value = value.to_s\n\n if field == :_id\n [ find(value) ].compact\n elsif @indexed_fields.include?(field)\n (@indexes.dig(field, value) || []).map { |id| find(id) }\n else\n find_in_collection(field, value)\n end\n end", "def initialize(document, field, value, options = {})\n @document, @field, @value =\n document, document.database_field_name(field.to_s), value\n @options = options\n end", "def field\n @field ||= quoted_field(field_name)\n end", "def initialize(name, boost = nil, operation = nil)\n parsed = QueryField.parse_key(name)\n @name = parsed[:name]\n @boost = boost && boost.to_f > 0 && boost.to_f || parsed[:boost]\n @operation = operation && operation == :all && operation || parsed[:operation]\n @values = []\n end", "def facet_value_to_fq_string(facet_field, value, use_local_params: true)\n facet_config = blacklight_config.facet_fields[facet_field]\n\n solr_field = facet_config.field if facet_config && !facet_config.query\n solr_field ||= facet_field\n\n local_params = []\n local_params << \"tag=#{facet_config.tag}\" if use_local_params && facet_config && facet_config.tag\n\n if facet_config && facet_config.query\n if facet_config.query[value]\n facet_config.query[value][:fq]\n else\n # exclude all documents if the custom facet key specified was not found\n '-*:*'\n end\n elsif value.is_a?(Range)\n prefix = \"{!#{local_params.join(' ')}}\" unless local_params.empty?\n \"#{prefix}#{solr_field}:[#{value.first} TO #{value.last}]\"\n elsif value == Blacklight::SearchState::FilterField::MISSING\n \"-#{solr_field}:[* TO *]\"\n else\n \"{!term f=#{solr_field}#{\" #{local_params.join(' ')}\" unless local_params.empty?}}#{convert_to_term_value(value)}\"\n end\n end", "def query\n ([query_for_one_keyword] * split_query_string.size).join(' AND ')\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end", "def query(value)\n Query.new(self, @query_by, value).to_relation\n end", "def parse_query(query)\n query = query.dup.strip\n\n first_expression = query.slice(expression_pattern)\n\n if first_expression.nil?\n if query.starts_with?('\"') && query.ends_with?('\"')\n query = query.dup.slice(1..-1)\n query = query.dup.slice(0..-2)\n end\n else\n check_query(query)\n end\n\n array = query.scan(expression_pattern)\n return [['name', ':', query]] if array.empty?\n wrong_keys = []\n result = array.map do |item|\n query_key, operator, query_value = item.flatten\n query_key.downcase!\n\n wrong_keys << query_key if query_value.to_s.empty?\n\n column = SEARCH_TOKENS_DEF.select { |k| k.include? query_key }.values.first\n wrong_keys << query_key if column.nil?\n\n [\n column,\n operator,\n query_value.tr(\"\\\"\", '')\n ]\n end\n\n raise InvalidQueryError,\n \"Wrong search definition(s) specified: #{wrong_keys.join(', ')}\" unless wrong_keys.empty?\n\n result\n end", "def query(value = nil, &block)\n __define__(:query, value, block)\n end", "def define_query\n name = @name\n klass.send :define_method, \"#{name}?\" do\n send(\"#{name}_value\").present? &&\n send(\"#{name}_unit\").present?\n end\n end", "def parse_query\n return nil if @query.nil?\n\n key, value = @query.split('=')\n return { key: key, value: value }\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end", "def set_Query(value)\n set_input(\"Query\", value)\n end" ]
[ "0.6597149", "0.6155972", "0.60944504", "0.5897008", "0.58508974", "0.58476716", "0.58424956", "0.5756688", "0.57141507", "0.56492513", "0.56170285", "0.5539387", "0.55223775", "0.551104", "0.55059355", "0.54593694", "0.5440864", "0.54265296", "0.5389577", "0.5385445", "0.53830445", "0.53830445", "0.53805923", "0.5349045", "0.53179", "0.5316088", "0.5314609", "0.5297494", "0.52944165", "0.5289867", "0.52878493", "0.5272842", "0.5259728", "0.52575797", "0.52523226", "0.52365667", "0.52065265", "0.52025324", "0.51987225", "0.51786464", "0.5152175", "0.5151912", "0.5140642", "0.5126317", "0.5121595", "0.51114935", "0.5106382", "0.5103905", "0.51031923", "0.51031506", "0.5092724", "0.5086136", "0.507593", "0.5075452", "0.50730795", "0.50645256", "0.50645256", "0.50645256", "0.50539833", "0.5051926", "0.5048439", "0.5046176", "0.50458544", "0.5044051", "0.503896", "0.50359404", "0.5013216", "0.5009464", "0.5009464", "0.500345", "0.49933493", "0.49920788", "0.49884227", "0.49875283", "0.49873647", "0.49852213", "0.49832207", "0.49803102", "0.49803102", "0.49803102", "0.49803102", "0.49803102", "0.49799904", "0.497309", "0.4967873", "0.49564573", "0.49534813", "0.49463633", "0.49463633", "0.49463633", "0.49463633", "0.49463633", "0.49463633", "0.49463633", "0.49463633", "0.49463633", "0.49463633", "0.49463633", "0.49463633", "0.49463633" ]
0.75168353
0
Creates queries using the lucene parser. This allows users to search with wildcard() and fuzzy (~) special characters. Words in phrases are ANDed or ORed depending on the value of operation given.
def grouping_query(field, phrase, op = 'AND') raise 'op must be AND or OR' unless ['AND', 'OR'].include? op "_query_:\"{!lucene q.op=#{op}}#{field}:(#{phrase})\"" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_process\n @search_text =params[:q].to_s\n all =params[:all].to_s\n exact =params[:exact].to_s\n any =params[:any].to_s\n none =params[:none].to_s\n advanced_query=\"\"\n\n if all != \"\"\n all =all.split(' ')\n all_like =all.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n all_like =all_like.join(' and ')\n advanced_query=all_like\n end\n\n if exact != \"\" && all != \"\"\n exact =\"'%\"+exact+\"%'\"\n advanced_query = advanced_query + \" and keyword like \" + exact\n end\n\n if exact != \"\" && all == \"\"\n exact =\"'%\"+exact+\"%'\"\n advanced_query = \"keyword like \" + exact\n end\n\n if any != \"\" and (all != \"\" or exact != \"\")\n any =any.split(' ')\n any_like =any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n any_like =any_like.join(' or ')\n advanced_query = advanced_query + \" and (\" + any_like + \")\"\n end\n\n if any != \"\" and all == \"\" and exact == \"\"\n any =any.split(' ')\n any_like =any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n any_like =any_like.join(' or ')\n advanced_query = \"(\" + any_like + \")\"\n end\n\n if none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\n none =none.split(' ')\n none_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\n\n none_not_like=none_not_like.join(' and ')\n\n advanced_query=advanced_query + \" and \" + none_not_like\n\n end\n\n if none != \"\" and all == \"\" and exact == \"\" and any == \"\"\n none =none.split(' ')\n none_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\n\n none_not_like=none_not_like.join(' and ')\n\n advanced_query= none_not_like\n end\n\n\n advanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\n\n parameter_search_text=@search_text.split.join(\" \")\n keyword_array =parameter_search_text.split(' ')\n keyword_count =keyword_array.size\n\n connection = ActiveRecord::Base.connection\n\n if all != \"\" or exact != \"\" or any != \"\" or none != \"\"\n @resultset = connection.execute(\"#{advanced_query}\");\n else\n @resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\n end\n\n ActiveRecord::Base.clear_active_connections!\n\n @resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '') }\n\n @model_ids =Array.new\n @model_names =Array.new\n @model_types =Array.new\n\n @resultset_strings.each do |result|\n\n substring=result[0..4]\n\n if substring == \"NMLCL\"\n cell=Cell.find_by_Cell_ID(result.to_s)\n name=cell.Cell_Name\n type=\"Cell\"\n end\n\n if substring == \"NMLCH\"\n channel=Channel.find_by_Channel_ID(result.to_s)\n name =channel.Channel_Name\n type =\"Channel\"\n end\n\n\n if substring == \"NMLNT\"\n network=Network.find_by_Network_ID(result.to_s)\n name =network.Network_Name\n type =\"Network\"\n end\n\n if substring == \"NMLSY\"\n synapse=Synapse.find_by_Synapse_ID(result.to_s)\n name =synapse.Synapse_Name\n type =\"Synapse\"\n end\n\n @model_ids.push(result)\n @model_names.push(name)\n @model_types.push(type)\n\n end\n\n if @model_ids.count != 0\n\n render :partial => 'keyword_results_list',\n :locals => {\n :model_ids => @model_ids,\n :model_names => @model_names,\n :model_types => @model_types\n }\n\n else\n\n render :partial => 'no_results'\n\n end\n\n end", "def search_process\r\nsearch_text=params[:q].to_s\r\nall=params[:all].to_s\r\nexact=params[:exact].to_s\r\nany=params[:any].to_s\r\nnone=params[:none].to_s\r\nadvanced_query=\"\"\r\n\r\nif all != \"\"\r\nall=all.split(' ')\r\nall_like=all.map {|x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nall_like=all_like.join(' and ')\r\nadvanced_query=all_like\r\nend\r\n\r\nif exact != \"\" && all != \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = advanced_query + \" and keyword like \" + exact\r\nend\r\n\r\nif exact != \"\" && all == \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = \"keyword like \" + exact\r\nend\r\n\r\nif any != \"\" and ( all != \"\" or exact != \"\" )\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = advanced_query + \" and (\" + any_like + \")\"\r\nend\r\n\r\nif any != \"\" and all == \"\" and exact == \"\"\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = \"(\" + any_like + \")\"\r\nend\r\n\r\nif none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query=advanced_query + \" and \" + none_not_like\r\n\r\nend\r\n\r\nif none != \"\" and all == \"\" and exact == \"\" and any == \"\"\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query= none_not_like\r\nend\r\n\r\n\r\n\r\n\r\n\r\nadvanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\r\nputs \"\\n\\n***********************************\\n\\n\"+advanced_query+\"\\n\\n**********************\\n\\n\"\r\n\r\nparameter_search_text=search_text.split.join(\" \")\r\n keyword_array=parameter_search_text.split(' ')\r\n keyword_count=keyword_array.size\r\n\r\nconnection = ActiveRecord::Base.connection();\r\nif all != \"\" or exact != \"\" or any != \"\" or none != \"\"\r\n@resultset = connection.execute(\"#{advanced_query}\");\r\nelse\r\n@resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\r\nend\r\nActiveRecord::Base.clear_active_connections!()\r\n\r\n@resultset.each do |res|\r\nputs res\r\nend\r\n@resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '')}\r\n@model_ids=Array.new\r\n@model_names=Array.new\r\n@model_types=Array.new\r\n@resultset_strings.each do |result|\r\nsubstring=result[0..4]\r\nputs\"\\n\\n************\"+substring\r\nif substring == \"NMLCL\"\r\ncell=Cell.find_by_Cell_ID(result.to_s)\r\nname=cell.Cell_Name\r\ntype=\"Cell\"\r\nend\r\n\r\nif substring == \"NMLCH\"\r\nchannel=Channel.find_by_Channel_ID(result.to_s)\r\nname=channel.Channel_Name\r\ntype=\"Channel\"\r\nend\r\n\r\n\r\nif substring == \"NMLNT\"\r\nnetwork=Network.find_by_Network_ID(result.to_s)\r\nname=network.Network_Name\r\ntype=\"Network\"\r\nend\r\n\r\n#if substring == \"NMLSY\"\r\n#name=Synapse.find_by_Synapse_ID(result.to_s)\r\n#type=\"Syanpse\"\r\n#end\r\n\r\n@model_ids.push(result)\r\n@model_names.push(name)\r\n@model_types.push(type)\r\nputs \"result-\"+result+\"name-\"+name.to_s\r\nend\r\n\r\nif @model_ids.count != 0\r\nrender :partial => 'keyword_results_list',:locals => {:model_ids => @model_ids,:model_names => @model_names,:model_types => @model_types}\r\nelse\r\nrender :partial => 'no_results'\r\nend\r\n\r\n\r\n end", "def search_process\r\nsearch_text=params[:q].to_s\r\nall=params[:all].to_s\r\nexact=params[:exact].to_s\r\nany=params[:any].to_s\r\nnone=params[:none].to_s\r\nadvanced_query=\"\"\r\n\r\nif all != \"\"\r\nall=all.split(' ')\r\nall_like=all.map {|x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nall_like=all_like.join(' and ')\r\nadvanced_query=all_like\r\nend\r\n\r\nif exact != \"\" && all != \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = advanced_query + \" and keyword like \" + exact\r\nend\r\n\r\nif exact != \"\" && all == \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = \"keyword like \" + exact\r\nend\r\n\r\nif any != \"\" and ( all != \"\" or exact != \"\" )\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = advanced_query + \" and (\" + any_like + \")\"\r\nend\r\n\r\nif any != \"\" and all == \"\" and exact == \"\"\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = \"(\" + any_like + \")\"\r\nend\r\n\r\nif none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query=advanced_query + \" and \" + none_not_like\r\n\r\nend\r\n\r\nif none != \"\" and all == \"\" and exact == \"\" and any == \"\"\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query= none_not_like\r\nend\r\n\r\n\r\n\r\n\r\n\r\nadvanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\r\nputs \"\\n\\n***********************************\\n\\n\"+advanced_query+\"\\n\\n**********************\\n\\n\"\r\n\r\nparameter_search_text=search_text.split.join(\" \")\r\n keyword_array=parameter_search_text.split(' ')\r\n keyword_count=keyword_array.size\r\n\r\nconnection = ActiveRecord::Base.connection();\r\nif all != \"\" or exact != \"\" or any != \"\" or none != \"\"\r\n@resultset = connection.execute(\"#{advanced_query}\");\r\nelse\r\n@resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\r\nend\r\nActiveRecord::Base.clear_active_connections!()\r\n\r\n@resultset.each do |res|\r\nputs res\r\nend\r\n@resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '')}\r\n@model_ids=Array.new\r\n@model_names=Array.new\r\n@model_types=Array.new\r\n@resultset_strings.each do |result|\r\nsubstring=result[0..4]\r\nputs\"\\n\\n************\"+substring\r\nif substring == \"NMLCL\"\r\ncell=Cell.find_by_Cell_ID(result.to_s)\r\nname=cell.Cell_Name\r\ntype=\"Cell\"\r\nend\r\n\r\nif substring == \"NMLCH\"\r\nchannel=Channel.find_by_Channel_ID(result.to_s)\r\nname=channel.Channel_Name\r\ntype=\"Channel\"\r\nend\r\n\r\n\r\nif substring == \"NMLNT\"\r\nnetwork=Network.find_by_Network_ID(result.to_s)\r\nname=network.Network_Name\r\ntype=\"Network\"\r\nend\r\n\r\n#if substring == \"NMLSY\"\r\n#name=Synapse.find_by_Synapse_ID(result.to_s)\r\n#type=\"Syanpse\"\r\n#end\r\n\r\n@model_ids.push(result)\r\n@model_names.push(name)\r\n@model_types.push(type)\r\nputs \"result-\"+result+\"name-\"+name.to_s\r\nend\r\n\r\nif @model_ids.count != 0\r\nrender :partial => 'keyword_results_list',:locals => {:model_ids => @model_ids,:model_names => @model_names,:model_types => @model_types}\r\nelse\r\nrender :partial => 'no_results'\r\nend\r\n\r\n\r\n end", "def query( query )\n query.downcase!\n case query\n when /^:r:/ then query_regexp query.gsub(/^:r:/, '')\n when /^:f:/ then query_fulltext_regexp query.gsub(/^:f:/, '')\n else query_simple query\n end\n end", "def query_string\n _f = @params.fields.include?(:full_text) ? [:full_text] : fields\n # byebug\n a = query.gsub('/', '').scan( /\"[^\"]+\"|[^ ]+/ ).map do |word|\n if word[0] === '\"'\n m = word.match( /^\"(.*)\"$/ );\n word = m ? m[1] : word;\n end\n Unicode.downcase(word.gsub('\"', ''))\n end\n _q = '(' + a.join('* AND ') + '*)'\n # _q = '/(?=.*?'+a.join( ')(?=.*?' )+').*/';\n #byebug\n index.filter{ ~q(query_string: {fields: _f, query: \"#{_q}\", default_operator: 'or'}) } if _q.present? && _f.present?\n\n #index.query(multi_match: {query: \"#{_q}*\", fields: _f}) if _q.present? && _f.present\n end", "def build_queries(text, build_opts, norm_opts)\n\t\ttrier = TEXT_TO_TRIE.new( build_opts[:min_tokens],\n\t\t\t\t\t\t\t\t build_opts[:max_tokens],\n\t\t\t\t\t\t\t\t )\n\t\t\n\t\t# Queries are normalized.\n\t\tqueries = trier.to_trie( text, \n\t\t \t\t\t\t norm_opts[:lowercased], \n\t\t \t norm_opts[:hyphen_replaced], \n\t\t \t norm_opts[:stemmed], \n\t\t \t)\n\t\t# queries - A hash of key (the normalized query string) and value (the array of \n\t\t# offsets (range values)) pairs.\n\t\tqueries\n\tend", "def initialize(query=\"\")\n @symbols = {\n :begin => %r/\\(\\s*(?=[^\\s\\)&,\\|])/,\n :end => %r/\\s*\\)(?=[^\\w]|\\Z)/,\n :and => %r/(?:\\s+|\\s*&{1,2}\\s*)(?=[\\w\\(\"])/,\n :or => %r/\\s*(?:,|\\|{1,2})\\s*(?=[\\w\\(\"])/,\n :label => %r/(\\w+(?:-\\w+)?):\\s*(?=[\\w\\(\"])/,\n # :not => %r/!\\s*(?=[\\w\\(\"])/, # NOT is VERY HARD\n :word => %r/([\\w\\-]+(?:'[\\w\\-]+)?)(?=[^:\\w\\-\\(]|\\Z)/,\n :quoted => %r/\"([^\"]+)\"/\n }\n @query = query\n end", "def query_to_terms(query)\n query.scan(/(\\+|or \\-?|and \\-?|\\-)?(\"[^\"]*\"?|[\\w\\-]+)/).collect do |prefix, term|\n term = \"(#{term.scan(/[\\w']+/).join('&')})\" if term[0,1] == '\"'\n term = \"!#{term}\" if prefix =~ /\\-/\n [(prefix =~ /or/) ? '|' : '&', term] \n end\n end", "def query\n ([query_for_one_keyword] * split_query_string.size).join(' AND ')\n end", "def create_queries(keyword)\n sql = \"\"\n self.column_names .each do |col|\n\n sql += col + \" LIKE \" + \"\\'\" + keyword + \"\\'\"\n sql += \" OR \"\n end\n sql[0..-5] #removes the last AND. A temporary dirty fix.\n end", "def query_for_one_keyword\n return @query_for_one_keyword if @query_for_one_keyword\n\n query = fields.map { |field| \"lower(#{field}) LIKE ?\" }\n .join(' OR ')\n @query_for_one_keyword = \"(#{query})\"\n end", "def add_queries\n add_general_query\n add_title_query\n add_creators_query\n add_series_query\n add_collected_query\n add_tag_name_query\n end", "def initialize(string_or_hash)\n if string_or_hash.class == String\n self.search_string = string_or_hash.strip\n self.operator = \"OR\"\n elsif string_or_hash.class == Hash\n self.terms = string_or_hash.keys.inject({}) {|hash,key| hash[key] = string_or_hash[key].strip; hash }\n self.operator = \"AND\"\n end\n end", "def build_query(query, options={})\n queries = []\n QUERY_KEYWORDS.each do |kw|\n next unless options[kw]\n if options[kw].is_a? Array\n kw_query = options[kw].map {|s| \"#{kw}:#{s}\".strip }.join(\" OR \")\n queries << \" (#{kw_query})\"\n else\n queries << \" #{kw}:#{options[kw]}\"\n end\n end\n \"#{query} #{queries.join(' ')}\".strip\n end", "def build_query(params)\n query = UserInteraction.includes(:user, :interaction, :answer)\n fields = get_fields()\n params.each do |filter|\n field_id = filter['field'].to_sym\n operator = filter['operand']\n operand = filter['value']\n if operator == FILTER_OPERATOR_CONTAINS\n query = query.where( get_active_record_expression(fields[field_id]['column_name'], operator, fields[field_id]['model']), \"%\"+operand.to_s+\"%\" )\n else\n query = query.where( get_active_record_expression(fields[field_id]['column_name'], operator, fields[field_id]['model']), operand )\n end\n end\n return query \n end", "def search_search_text\n query\n .where(\"decidim_opinions_opinions.title ILIKE ?\", \"%#{search_text}%\")\n .or(query.where(\"decidim_opinions_opinions.body ILIKE ?\", \"%#{search_text}%\"))\n end", "def search query\n @content = @reader.read if @content.nil?\n @content.select do |doc|\n rs = []\n query.terms.each do |term|\n if term.compare(doc.send(term.field))\n rs << true\n end\n end\n if query.relation == :and\n rs.count == query.terms.count\n else\n !rs.empty?\n end\n end\n end", "def complex_expression_sql_append(sql, op, args)\n case op\n when :^\n j = ' # '\n c = false\n args.each do |a|\n sql << j if c\n literal_append(sql, a)\n c ||= true\n end\n when :ILIKE, :'NOT ILIKE'\n sql << '('\n literal_append(sql, args[0])\n sql << ' ' << op.to_s << ' '\n literal_append(sql, args[1])\n sql << ')'\n else\n super\n end\n end", "def add_general_query\n fields = [\n \"creators.name^5\",\n \"title^7\",\n \"endnotes\",\n \"notes\",\n \"summary\",\n \"tags.name\",\n \"series.title\"\n ]\n query_string = options[:q]\n return if query_string.blank?\n body.must(\n :query_string,\n fields: fields,\n query: query_string\n )\n end", "def search_conditions(query, fields=nil)\n return nil if query.blank?\n fields ||= @search_columns\n\n # split the query by commas as well as spaces, just in case\n words = query.split(\",\").map(&:split).flatten\n\n binds = {} # bind symbols\n or_frags = [] # OR fragments\n count = 1 # to keep count on the symbols and OR fragments\n\n words.each do |word|\n like_frags = [fields].flatten.map { |f| \"LOWER(#{f}) LIKE :word#{count}\" }\n or_frags << \"(#{like_frags.join(\" OR \")})\"\n binds[\"word#{count}\".to_sym] = \"%#{word.to_s.downcase}%\"\n count += 1\n end\n [or_frags.join(\" AND \"), binds]\n end", "def ar_transform_query_terms terms\n if terms && !terms.empty? && terms !~ /^\\s*[*? ]*\\s*$/\n terms.split(\" \").inject([]) do |query, token| \n query << \"*#{token}*\" \n end.join(\" or \")\n else\n \"\"\n end\n end", "def sql_query\n case @operator\n when :equals\n arel_field.eq(transmogrified_value)\n when :does_not_equal\n arel_field.not_eq(transmogrified_value)\n when :contains\n arel_field.matches(\"%#{transmogrified_value}%\")\n when :does_not_contain\n arel_field.does_not_match(\"%#{transmogrified_value}%\")\n when :starts_with\n arel_field.matches(\"#{transmogrified_value}%\")\n when :ends_with\n arel_field.matches(\"%#{transmogrified_value}\")\n when :greater_than\n arel_field.gt(transmogrified_value)\n when :greater_than_or_equal_to\n arel_field.gteq(transmogrified_value)\n when :less_than\n arel_field.lt(transmogrified_value)\n when :less_than_or_equal_to\n arel_field.lteq(transmogrified_value)\n when :in\n arel_field.in(transmogrified_value.split(/\\,\\s*/))\n when :not_in\n arel_field.not_in(transmogrified_value.split(/\\,\\s*/))\n when :blank\n arel_field.eq(nil)\n when :not_blank\n arel_field.not_eq(nil)\n end\n end", "def search(search, distance: nil, negate: false, case_type: nil)\n prefs = Doing.setting('search', {})\n matching = prefs.fetch('matching', 'pattern').normalize_matching\n distance ||= prefs.fetch('distance', 3).to_i\n case_type ||= prefs.fetch('case', 'smart').normalize_case\n\n if search.rx? || matching == :fuzzy\n matches = @title + @note.to_s =~ search.to_rx(distance: distance, case_type: case_type)\n else\n query = search.strip.to_phrase_query\n\n if query[:must].nil? && query[:must_not].nil?\n query[:must] = query[:should]\n query[:should] = []\n end\n matches = no_searches?(query[:must_not], case_type: case_type)\n matches &&= all_searches?(query[:must], case_type: case_type)\n matches &&= any_searches?(query[:should], case_type: case_type)\n end\n # if search =~ /(?<=\\A| )[+-]\\S/\n # else\n # text = @title + @note.to_s\n # matches = text =~ search.to_rx(distance: distance, case_type: case_type)\n # end\n\n # if search.rx? || !fuzzy\n # matches = text =~ search.to_rx(distance: distance, case_type: case_type)\n # else\n # distance = 0.25 if distance > 1\n # score = if (case_type == :smart && search !~ /[A-Z]/) || case_type == :ignore\n # text.downcase.pair_distance_similar(search.downcase)\n # else\n # score = text.pair_distance_similar(search)\n # end\n\n # if score >= distance\n # matches = true\n # Doing.logger.debug('Fuzzy Match:', %(#{@title}, \"#{search}\" #{score}))\n # end\n # end\n\n negate ? !matches : matches\n end", "def search(query); end", "def initialize(args={})\n if args[:term_re]\n @term_re = args[:term_re]\n term_re_str = @term_re.to_s # in case passed as actual Regexp\n\n # must define :term rule at run-time so that it can include\n # the term_re_str\n self.class.rule :term do\n match[term_re_str].repeat(1).as(:term) >> (fuzzy | boost).maybe\n end\n else\n self.class.rule :term do\n ( (escape_special_words | match[\"\\\\w\\\\'\\\\.\\\\*\\\\?\\\\-\"]).repeat(1) ).as(:term) >> (fuzzy | boost).maybe\n end\n end\n end", "def construct_filter_query(queries)\n query_string = '?'\n query_list = Array[]\n\n # Format the include_* queries similarly to other queries for easier\n # processing\n if queries.key?('include_deleted')\n queries['include_deleted'] = if queries['include_deleted']\n ['true']\n else\n ['false']\n end\n end\n\n if queries.key?('include_revisions')\n queries['include_revisions'] = if queries['include_revisions']\n ['true']\n else\n ['false']\n end\n end\n\n # If uuid is included, the only other accepted queries are the\n # include_*s\n if queries.key?('uuid')\n query_string = format('/%s?', queries['uuid'])\n if queries.key?('include_deleted')\n query_string += format('include_deleted=%s&',\n queries['include_deleted'][0])\n end\n\n if queries.key?('include_revisions')\n query_string += format('include_revisions=%s&',\n queries['include_revisions'][0])\n end\n\n # Everthing is a list now, so iterate through and push\n else\n # Sort them into an alphabetized list for easier testing\n # sorted_qs = sorted(queries.to_a, key = operator.itemgetter(0))\n sorted_qs = queries.to_a.sort\n sorted_qs.each do |query, param|\n param.each do |slug|\n # Format each query in the list\n # query_list.push('%s=%s' % Array[query, slug])\n query_list.push(format('%s=%s', query, slug))\n end\n end\n\n # Construct the query_string using the list.\n # Last character will be an & so we can push the token\n query_list.each do |string|\n query_string += format('%s&', string)\n end\n end\n query_string\n end", "def query(query, phrase=false)\n if phrase\n q = %q[]\n params['q'] = query.gsub(\" \",\"+\").gsub('\"',\"'\")\n else\n params['q'] = CGI.escape(query)\n end\n params.merge!({'fq' => query_filters.uniq.join(\"+AND+\")}) unless query_filters.empty?\n self\n end", "def test_like_two_search_condition\n search_conditions = [[\"Wes\", :like],[\"Hays\", :like]]\n query_fields = {'some_table.first_name' => :string,'some_table.last_name' => :string} \n conditions = build_query(search_conditions, query_fields) \n \n fields = ['first_name','last_name']\n regExs = [build_regex_for_like(fields,'keyword_0'), \n build_regex_for_like(fields,'keyword_1')].join('[ ]AND[ ]')\n \n assert_match /^#{regExs}$/, conditions.first\n assert_equal '%Wes%', conditions.last[:keyword_0]\n assert_equal '%Hays%', conditions.last[:keyword_1]\n end", "def match_query(query); end", "def delegate_to_search_pattern\n /(?:_equals|_contains|_gte|_lte)\\z/\n end", "def query_words\n @query_words ||= Query.query_words @text\n end", "def rocchio query\n alpha = 0\n beta = 0.75\n gamma = -0.25\n \n query = query.downcase.split(\" \")\n init = query\n\n # We append each positive feedback document's terms to our new query vector. \n self.feedback.each { |document, feedback, terms| query |= terms if feedback }\n\n query.map do |term| \n # If the term was in the original query, we set its vector wight to 1, \n # otherwise its set to 0.\n weight = (init.include? term) ? 1 : 0\n weight += alpha\n\n document_frequency = self.terms[term][:frequency]\n if document_frequency > 0 \n self.feedback.each do |document, feedback, terms|\n frequency = self.terms[term][:documents][document]\n adjust = frequency/document_frequency\n weight += (feedback ? beta : gamma) * adjust\n end\n end\n\n weight = 0 if weight < 0\n\n [term, weight]\n end\n end", "def query\n\t\t\t[@search_term,@filter].compact.join(\" \")\n\t\tend", "def AddQuery(query, index = '*', comment = '')\n # build request\n \n # mode and limits\n request = Request.new\n request.put_int @offset, @limit, @mode, @ranker\n # process the 'expr' ranker\n if @ranker == SPH_RANK_EXPR\n request.put_string @rankexpr\n end\n\n request.put_int @sort\n\n request.put_string @sortby\n # query itself\n request.put_string query\n # weights\n request.put_int_array @weights\n # indexes\n request.put_string index\n # id64 range marker\n request.put_int 1\n # id64 range\n request.put_int64 @min_id.to_i, @max_id.to_i \n \n # filters\n request.put_int @filters.length\n @filters.each do |filter|\n request.put_string filter['attr']\n request.put_int filter['type']\n\n case filter['type']\n when SPH_FILTER_VALUES\n request.put_int64_array filter['values']\n when SPH_FILTER_RANGE\n request.put_int64 filter['min'], filter['max']\n when SPH_FILTER_FLOATRANGE\n request.put_float filter['min'], filter['max']\n else\n raise SphinxInternalError, 'Internal error: unhandled filter type'\n end\n request.put_int filter['exclude'] ? 1 : 0\n end\n \n # group-by clause, max-matches count, group-sort clause, cutoff count\n request.put_int @groupfunc\n request.put_string @groupby\n request.put_int @maxmatches\n request.put_string @groupsort\n request.put_int @cutoff, @retrycount, @retrydelay\n request.put_string @groupdistinct\n \n # anchor point\n if @anchor.empty?\n request.put_int 0\n else\n request.put_int 1\n request.put_string @anchor['attrlat'], @anchor['attrlong']\n request.put_float @anchor['lat'], @anchor['long']\n end\n \n # per-index weights\n request.put_int @indexweights.length\n @indexweights.each do |idx, weight|\n request.put_string idx\n request.put_int weight\n end\n \n # max query time\n request.put_int @maxquerytime\n \n # per-field weights\n request.put_int @fieldweights.length\n @fieldweights.each do |field, weight|\n request.put_string field\n request.put_int weight\n end\n \n # comment\n request.put_string comment\n \n # attribute overrides\n request.put_int @overrides.length\n for entry in @overrides do\n request.put_string entry['attr']\n request.put_int entry['type'], entry['values'].size\n entry['values'].each do |id, val|\n assert { id.instance_of?(Fixnum) || id.instance_of?(Bignum) }\n assert { val.instance_of?(Fixnum) || val.instance_of?(Bignum) || val.instance_of?(Float) }\n \n request.put_int64 id\n case entry['type']\n when SPH_ATTR_FLOAT\n request.put_float val\n when SPH_ATTR_BIGINT\n request.put_int64 val\n else\n request.put_int val\n end\n end\n end\n \n # select-list\n request.put_string @select\n \n # store request to requests array\n @reqs << request.to_s;\n return @reqs.length - 1\n end", "def keyword_op\n @params[\"op\"] || \"AND\"\n end", "def keyword_op\n @params[\"op\"] || \"AND\"\n end", "def sql_operator(operator, field)\n raise ScopedSearch::QueryNotSupported, \"the operator '#{operator}' is not supported for field type '#{field.type}'\" if !field.virtual? and [:like, :unlike].include?(operator) and !field.textual?\n return '@@' if [:like, :unlike].include?(operator) && field.full_text_search\n case operator\n when :like then 'ILIKE'\n when :unlike then 'NOT ILIKE'\n else super(operator, field)\n end\n end", "def query\n normalize_query(phrase_query, query_filters.compact)\n end", "def parse_term\r\n parse_factor\r\n while(@cur_token.kind == :AND)\r\n accept_it\r\n if(@cur_token.kind == :NOT)\r\n accept_it\r\n end\r\n parse_factor\r\n end\r\n end", "def modify_search_query\n query_data = params['q'] && params['q'][Garage::SearchPredicate]\n if query_data.present?\n params['q'][Garage::SearchPredicate] = query_data.split(' ')\n end\n end", "def search!(collection, query_str)\n res = collection\n if query_str.present?\n\n query_str.split(Regex::FIELD).each do |term|\n next if term.blank?\n\n parts = []\n terms = []\n fields.each do |f|\n field = get_field(f, collection)\n part = [\"#{field} #{Regex::LIKE} \",\n \"#{query_base} ESCAPE '#{Regex::ESCAPECHAR}'\"].join('')\n terms << get_term(term)\n parts << part\n end\n\n if parts.any?\n query = parts.join(\" #{Regex::OR} \")\n res = res.where(query, *terms)\n end\n end\n end\n res\n end", "def conditions_for(fields=[])\n predicate = []\n values = []\n fields.each do |field|\n predicate << \"lower(#{field.to_s}) like ?\"\n values << \"'%' + @search_key.downcase + '%'\"\n end\n eval(\"[\\\"#{predicate.join(' OR ')}\\\", #{values.join(',')}]\")\n end", "def query\n Riddle::Query.escape params[:search_txt]\n end", "def sanitize(q)\n # Escape special characters\n # http://lucene.apache.org/core/4_8_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description#Escaping_Special_Characters\n escaped_characters = Regexp.escape('\\\\+-&|!(){}[]^~*?:\\/')\n q = q.gsub(/([#{escaped_characters}])/, '\\\\\\\\\\1')\n\n # AND, OR and NOT are used by lucene as logical operators. We need\n # to escape them\n ['AND', 'OR', 'NOT'].each do |word|\n escaped_word = word.split('').map {|char| \"\\\\#{char}\" }.join('')\n q = q.gsub(/\\s*\\b(#{word.upcase})\\b\\s*/, \" #{escaped_word} \")\n end\n\n # Escape odd quotes\n if q.count('\"') % 2 == 1\n q = q.gsub(/(.*)\"(.*)/, '\\1\\\"\\2')\n end\n\n q\n end", "def term_to_query(term)\n \"%#{term}%\"\nend", "def valid_find_operator\n\t\toperator = ' OR '\n\t\tif params[:operator] and !params[:operator].blank? and \n\t\t\t\t['AND','OR'].include?(params[:operator])\n\t\t\toperator = \" #{params[:operator]} \"\n\t\tend\n\t\toperator\n\tend", "def index\n if params[:query].present?\n sql_query = \"name ILIKE :query OR description ILIKE :query\"\n @toys = Toy.where(sql_query, query: \"%#{params[:query]}%\")\n else\n @toys = Toy.all\n end\n end", "def query_builder table, search\n \n # Throw on some wildcards to make search more forgiving\n search_string = \"%#{search}%\"\n\n # Check to see if the search_string is a number, if it is, also search on numerical columns\n search_number = (is_number? search) ? Float(search) : nil\n\n search_date = parse_date(search)\n\n query = nil\n case table \n when :track\n query = infrastructure_query_builder(search_string, nil)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_track_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :guideway\n query = infrastructure_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :power_signal\n query = infrastructure_query_builder(search_string, nil)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_track_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :capital_equipment\n query = transit_asset_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_equipment_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(fta_asset_class_query search_string)\n when :service_vehicle\n query = service_vehicle_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_vehicle_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(fta_asset_class_query search_string)\n .or(chassis_query search_string)\n .or(fuel_type_query search_string)\n when :bus, :rail_car, :ferry, :other_passenger_vehicle\n query = service_vehicle_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_vehicle_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(esl_category_query search_string)\n .or(fta_asset_class_query search_string)\n .or(chassis_query search_string)\n .or(fuel_type_query search_string)\n .or(fta_funding_type_query search_string)\n .or(fta_ownership_type_query search_string)\n when :passenger_facility, :maintenance_facility, :admin_facility, :parking_facility\n query = transit_asset_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(fta_equipment_type_query search_string)\n .or(asset_subtype_query search_string)\n end\n query = query.or(TransamAsset.arel_table[:in_service_date].eq(search_date)) if search_date\n query.or(ServiceStatusType.arel_table[:name].matches(search_string))\n .or(life_cycle_action_query search_string, search_date)\n .or(term_condition_rating_query search_string, search_number)\n end", "def index\n words = params[:q] && Shellwords.split(params[:q]).map(&:squish)\n if words.present?\n @with = words.reject{|word| word.first == '-'}\n @without = words.select{|word| word.first == '-'}.map do |word|\n word[1..-1]\n end\n @programming_languages =\n ProgrammingLanguage.with(@with).without(@without)\n else\n @programming_languages = ProgrammingLanguage.ordered\n end\n end", "def parse_params(field, oper, value)\n case oper\n when \"eq\"\n condiciones = [field +\" = ?\", value]\n when \"lt\"\n condiciones = [field +\" < ?\", value]\n when \"le\"\n condiciones = [field +\" <= ?\", value]\n when \"gt\"\n condiciones = [field +\" > ?\", value]\n when \"ge\"\n condiciones = [field +\" >= ?\", value]\n when \"ne\"\n condiciones = [field +\" <> ?\", value]\n when \"bn\"\n condiciones = [\"not \" + field +\" like ?\", \"#{value}%\"]\n when \"bw\"\n condiciones = [field +\" like ?\", \"#{value}%\"]\n when \"ew\"\n condiciones = [field +\" like ?\", \"%#{value}\"]\n when \"cn\"\n condiciones = [field +\" like ?\", \"%#{value}%\"]\n else\n condiciones = []\n end\n return condiciones\n end", "def search(query, options = {}); end", "def conditions_for_keywords\n sql = []\n params = []\n\n keywords.each do |kw|\n str = \"lower(tasks.name) like ?\"\n str += \" or lower(tasks.description) like ?\"\n sql << str\n 2.times { params << \"%#{ kw.word.downcase }%\" }\n end\n\n sql = sql.join(\" or \")\n res = TaskFilter.send(:sanitize_sql_array, [ sql ] + params)\n return \"(#{ res })\" if !res.blank?\n end", "def parse_query(query); end", "def parse_query(query); end", "def search_text(query, text)\n text = pattern(text)\n query.where { title.ilike(text) | description.ilike(text) }\n end", "def query_wo_exact_phrases(txt)\n self.query_without_exact_phrases ||= txt.gsub(Awesome::Definitions::Stopwords::QUOTED_REGEX, '')\n end", "def search\n terms = params[:query].split\n query = terms.map { |term| \"title like '%#{term}%' OR body like '%#{term}%' OR tags like '%#{term}%'\" }.join(\" OR \")\n \n @posts = Post.where(query).order(\"created_at DESC\").first(10)\n end", "def list\r\nif request.post?\r\n condition = nil\r\n\r\n if !params[:First_Name].blank?\r\n statement = \"First_Name like '#{params[:First_Name]}' \"\r\n condition = [\"First_Name like '#{params[:First_Name]}' \"]\r\n end\r\n \r\n if !params[:Last_Name].blank?\r\n if condition == nil \r\n condition = [\"Last_Name like '#{params[:Last_Name]}' \"]\r\n statement = \"Last_Name like '#{params[:Last_Name]}' \"\r\n else\r\n add_statement = statement + \"AND \" + \"Last_Name like '#{params[:Last_Name]}'\"\r\n condition = [statement]\r\n end\r\n end\r\n \r\n\r\n \r\n if !params[:City].blank?\r\n if condition == nil \r\n condition = [\"City like '#{params[:City]}' \"]\r\n statement = \"City like '#{params[:City]}' \"\r\n else \r\n add_statement = statement +\"AND \" + \"City like '#{params[:City]}'\"\r\n condition = [statement]\r\n end\r\n end\r\n \r\n if !params[:state].blank?\r\n if condition == nil \r\n condition = [\"State like '#{params[:state]}' \"]\r\n statement = \"State like '#{params[:state]}' \"\r\n else\r\n statement = statement + \"AND \" + \"State like '#{params[:state]}'\"\r\n condition = [statement] \r\n end\r\n end\r\n \r\n\r\n if !params[:key_words].blank?\r\n if condition == nil \r\n condition = [\"places_lived LIKE ? OR places_traveled LIKE ? OR personal_interests LIKE ? OR work_life LIKE ? OR future_plans LIKE ?\",\"%#{params[:key_words]}%\",\"#{params[:key_words]}\",\"#{params[:key_words]}\",\"#{params[:key_words]}\",\"#{params[:key_words]}\"]\r\n statement = \"places_lived LIKE '#{params[:key_words]}'OR places_traveled LIKE '#{params[:key_words]}' OR personal_interests LIKE '#{params[:key_words]}' OR work_life LIKE '#{params[:key_words]}' OR future_plans LIKE '#{params[:key_words]}'\"\r\n else\r\n statement=statement+ \"AND \" + \"City LIKE '#{params[:key_words]}'\"\r\n condition = [statement]\r\n end\r\n end\r\n \r\n if !params[:user][:industry].blank?\r\n if condition == nil \r\n condition = [\"industry like '#{params[:user][:industry]}' \"]\r\n statement = \"industry like '#{params[:user][:industry]}' \"\r\n else\r\n statement = statement +\"AND \" + \"industry like '#{params[:user][:industry]}'\"\r\n condition = [statement] \r\n end\r\n end\r\n \r\n\r\n \r\n if params[:user][:status] == '0'\r\n if condition == nil \r\n condition = [\"logged_in ='1' \"]\r\n statement = \"logged_in ='1' \"\r\n else\r\n statement = statement+ \"AND \" + \"logged_in ='1'\"\r\n condition = [statement]\r\n end\r\n end\r\n \r\n if params[:Gender]=='male'\r\n if condition == nil \r\n condition = [\"Gender like 'male' \"]\r\n statement = \"Gender like 'male' \"\r\n else\r\n statement = statement + \"AND \" + \"Gender like 'male'\"\r\n condition = [statement]\r\n end\r\n end\r\n \r\n if params[:Gender]=='female'\r\n if condition == nil \r\n condition = [\"Gender like 'female' \"]\r\n statement = \"Gender like 'female' \"\r\n else\r\n statement = statement+ \"AND \" + \"Gender like 'female'\"\r\n condition = [statement] \r\n end\r\n end\r\n if params[:Gender]=='both'\r\n if condition == nil \r\n condition = [\"Gender like 'female' OR Gender like 'male'\"]\r\n statement = \"Gender like 'female' OR Gender like 'male'\"\r\n else\r\n if !params[:key_words].blank? \r\n condition = condition\r\n else\r\n statement = statement+\"AND \" + \"(Gender like 'female' OR Gender like 'male')\"\r\n condition = [statement] \r\n end\r\n end\r\n end\r\n\r\n if params[:user][:network] == '0'\r\n\t @list = Array[]\r\n useradd = UserNetwork.find(:all, :conditions=>[\"user_id = '#{session[:user].id}' AND STATUS = '1'\"])\r\n\t if !useradd.blank?\r\n\t\tfor user in useradd\r\n\t\t @list.push(\"'\"+user.friend_id+\"'\")\r\n\t\t end\r\n\t end\r\n \t userfrd = UserNetwork.find(:all, :conditions=>[\"friend_id = '#{session[:user].id}' AND STATUS = '1'\"])\t\t\r\n\t if !userfrd.blank?\r\n\t for user in userfrd\r\n\t @list.push(\"'\"+user.user_id+\"'\")\r\n\t end\r\n\t end \r\n\t if !@list.blank?\r\n if condition == nil \t\r\n \r\n condition = [\"id in (#{@list.join(\",\")}) \" ]\r\n statement = \"id in (#{@list.join(\",\")}) \" \r\n else\r\n statement = statement+ \"AND \" + \"id in (#{@list.join(\",\")})\"\r\n condition = [statement] \r\n end\r\n\tend\r\n end\r\n \r\n \r\n if !params[:user][:Country].blank?\r\n if condition == nil \r\n \r\n condition = [\"Country like '#{params[:user][:Country]}' \"]\r\n statement= \"Country like '#{params[:user][:Country]}' \"\r\n else\r\n statement=statement+ \"AND \" + \"Country like '#{params[:user][:Country]}'\"\r\n condition = [statement] \r\n end\r\n end\r\n\r\n if condition != nil\r\n @list = User.find(:all,:conditions => condition)\r\n end\r\n\t\r\n\tif @list.blank?\r\n\trespond_to do |f|\t\r\n f.html {render :template=>\"members/list\", :locals=>{:list=>@list}}\r\n\t end\r\n\t\r\n\telse\r\n\t\t respond_to do |f|\t\r\n f.html {render :template=>\"members/search\", :locals=>{:list=>@list}}\r\n\t end\r\n\tend\r\nend\r\nend", "def solr_documents_by_field_values_params(field, values)\n q = if Array(values).empty?\n \"{!lucene}NOT *:*\"\n else\n \"{!lucene}#{field}:(#{ Array(values).map { |x| solr_param_quote(x) }.join(\" OR \")})\"\n end\n\n { q: q, spellcheck: 'false', fl: \"*\" }\n end", "def search(query)\n return [] if query.nil?\n\n @atoms = @storage.fetch(cleanup_atoms(query), query[/\\^/])\n queries = parse_query(query.dup)\n positive = run_queries(queries[:positive])\n positive_quoted = run_quoted_queries(queries[:positive_quoted])\n negative = run_queries(queries[:negative])\n negative_quoted = run_quoted_queries(queries[:negative_quoted])\n starts_with = run_queries(queries[:starts_with], true)\n start_quoted = run_quoted_queries(queries[:start_quoted], true)\n\n results = ActiveSupport::OrderedHash.new\n\n if queries[:start_quoted].any?\n results = merge_query_results(results, start_quoted)\n end\n\n if queries[:starts_with].any?\n results = merge_query_results(results, starts_with)\n end\n\n if queries[:positive_quoted].any?\n results = merge_query_results(results, positive_quoted)\n end\n\n if queries[:positive].any?\n results = merge_query_results(results, positive)\n end\n\n negative_results = (negative.keys + negative_quoted.keys)\n results.delete_if { |r_id, w| negative_results.include?(r_id) }\n results\n end", "def query_terms_xml\n bool_operator = boolean_operator\n lambda do |xml|\n xml.QueryTerms {\n xml.BoolOpeator bool_operator\n query_terms.each do |query_term|\n xml << query_term.to_xml\n end\n }\n end\n end", "def parse_query(string)\n query = parse_words(string)\n query[-1] += \"*\" unless string.match?(/[#{WORD_DELIMITERS}]\\z/)\n query\n end", "def build_titan_lucene_query(term, property)\n if property.is_a? Array\n queries = []\n property.each do |prop|\n prop = \"\\\"#{prop}\\\"\" if prop.to_s.include?(\"_\") # need to surround in double quotes if indexed property has an underscore\n queries.concat [ \"v.#{prop}:#{term}\" ] \n end\n queries.join \" OR \"\n else\n property = \"\\\"#{property}\\\"\" if property.to_s.include?(\"_\") \n \"v.#{property}:#{term}\"\n end\n end", "def search_query(search_terms)\n resource_handler.searchable_attributes.map do |attribute|\n if relation = attribute[:relation]\n \"LOWER(#{relation[:model_association].klass.table_name}.#{relation[:attr_method]}) LIKE #{search_terms}\"\n else\n \"LOWER(#{resource_handler.model.table_name}.#{attribute[:name]}) LIKE #{search_terms}\"\n end\n end.join(\" OR \")\n end", "def initialize\n @query_fields = nil \n @query_params = {}\n \n @sql_like = 'LIKE'\n \n if ActiveRecord::Base.connected? and ActiveRecord::Base.connection.adapter_name.downcase == 'postgresql'\n @sql_like = 'ILIKE'\n end\n end", "def RunQueries\n if @reqs.empty?\n @error = 'No queries defined, issue AddQuery() first'\n return false\n end\n\n req = @reqs.join('')\n nreqs = @reqs.length\n @reqs = []\n response = PerformRequest(:search, req, nreqs)\n \n # parse response\n begin\n results = []\n ires = 0\n while ires < nreqs\n ires += 1\n result = {}\n \n result['error'] = ''\n result['warning'] = ''\n \n # extract status\n status = result['status'] = response.get_int\n if status != SEARCHD_OK\n message = response.get_string\n if status == SEARCHD_WARNING\n result['warning'] = message\n else\n result['error'] = message\n results << result\n next\n end\n end\n \n # read schema\n fields = []\n attrs = {}\n attrs_names_in_order = []\n \n nfields = response.get_int\n while nfields > 0\n nfields -= 1\n fields << response.get_string\n end\n result['fields'] = fields\n \n nattrs = response.get_int\n while nattrs > 0\n nattrs -= 1\n attr = response.get_string\n type = response.get_int\n attrs[attr] = type\n attrs_names_in_order << attr\n end\n result['attrs'] = attrs\n \n # read match count\n count = response.get_int\n id64 = response.get_int\n \n # read matches\n result['matches'] = []\n while count > 0\n count -= 1\n \n if id64 != 0\n doc = response.get_int64\n weight = response.get_int\n else\n doc, weight = response.get_ints(2)\n end\n \n r = {} # This is a single result put in the result['matches'] array\n r['id'] = doc\n r['weight'] = weight\n attrs_names_in_order.each do |a|\n r['attrs'] ||= {}\n \n case attrs[a]\n when SPH_ATTR_BIGINT\n # handle 64-bit ints\n r['attrs'][a] = response.get_int64\n when SPH_ATTR_FLOAT\n # handle floats\n r['attrs'][a] = response.get_float\n\t\t\t\twhen SPH_ATTR_STRING\n\t\t\t\t # handle string\n\t\t\t\t r['attrs'][a] = response.get_string\n else\n # handle everything else as unsigned ints\n val = response.get_int\n if attrs[a]==SPH_ATTR_MULTI\n r['attrs'][a] = []\n 1.upto(val) do\n r['attrs'][a] << response.get_int\n end\n elsif attrs[a]==SPH_ATTR_MULTI64\n r['attrs'][a] = []\n\t\t\t\t\tval = val/2\n 1.upto(val) do\n r['attrs'][a] << response.get_int64\n end\n else\n r['attrs'][a] = val\n end\n end\n end\n result['matches'] << r\n end\n result['total'], result['total_found'], msecs, words = response.get_ints(4)\n result['time'] = '%.3f' % (msecs / 1000.0)\n \n result['words'] = {}\n while words > 0\n words -= 1\n word = response.get_string\n docs, hits = response.get_ints(2)\n result['words'][word] = { 'docs' => docs, 'hits' => hits }\n end\n \n results << result\n end\n #rescue EOFError\n # @error = 'incomplete reply'\n # raise SphinxResponseError, @error\n end\n \n return results\n end", "def search(query)\n return [] if query.nil?\n\n @atoms = @storage.fetch(cleanup_query_tokens(query), query[/\\^/])\n queries = parse_query(query.dup)\n positive = run_queries(queries[:positive])\n positive_quoted = run_quoted_queries(queries[:positive_quoted])\n negative = run_queries(queries[:negative])\n negative_quoted = run_quoted_queries(queries[:negative_quoted])\n starts_with = run_queries(queries[:starts_with], true)\n start_quoted = run_quoted_queries(queries[:start_quoted], true)\n\n results = {}\n\n if queries[:start_quoted].any?\n results = merge_query_results(results, start_quoted)\n end\n\n if queries[:starts_with].any?\n results = merge_query_results(results, starts_with)\n end\n\n if queries[:positive_quoted].any?\n results = merge_query_results(results, positive_quoted)\n end\n\n if queries[:positive].any?\n results = merge_query_results(results, positive)\n end\n\n negative_results = (negative.keys + negative_quoted.keys)\n results.delete_if { |r_id, w| negative_results.include?(r_id) }\n results\n end", "def index\n @users = if params[:term]\n puts 'hello'\n User.where('first_name ILIKE ? OR last_name ILIKE ?', \"%#{params[:term]}%\", \"%#{params[:term]}%\")\n else\n User.all\n end\n end", "def complex_expression_sql_append(sql, op, args)\n case op\n when :&, :|, :^, :<<, :>>, :'B~'\n complex_expression_emulate_append(sql, op, args)\n # REGEXP_OPERATORS = [:~, :'!~', :'~*', :'!~*']\n when :'~'\n function_sql_append(sql, SQL::Function.new(:REGEX, args.at(0), args.at(1)))\n when :'!~'\n sql << Sequel::Dataset::NOT_SPACE\n function_sql_append(sql, SQL::Function.new(:REGEX, args.at(0), args.at(1)))\n when :'~*'\n function_sql_append(sql, SQL::Function.new(:IREGEX, args.at(0), args.at(1)))\n when :'!~*'\n sql << Sequel::Dataset::NOT_SPACE\n function_sql_append(sql, SQL::Function.new(:IREGEX, args.at(0), args.at(1)))\n else\n super\n end\n end", "def search(query)\n\t\t query = \"%#{query}%\"\n\t\t name = arel_table[:name].matches(query)\n\t\t aliases = arel_table[:aliases].matches(query)\n\t\t where(name.or(aliases))\n\t\tend", "def query\n @query = Riddle::Query.escape params[:search]\n end", "def query\n @query = Riddle::Query.escape params[:search]\n end", "def query_words\n @query_array ||= @query.split(' ')\n end", "def build_meta_search_query(meta_keys)\n keys = meta_keys.join(\"_or_\")\n keys << \"_contains\"\n return keys\n end", "def search_conditions_as_options\n [\n [I18n.t(\"advanced_searches.text_search_field.all_words\"), \"all_words\"],\n [I18n.t(\"advanced_searches.text_search_field.one_word\"), \"one_word\"],\n [I18n.t(\"advanced_searches.text_search_field.exact\"), \"exact\"]\n ]\n end", "def query\n case query_type_str\n when 'empty'\n return\n when 'iso'\n return iso_query_builder\n when 'multi'\n return multi_query_builder\n end\n end", "def query_terms_string\n raise 'You must supply at least one query term' if query_terms.empty?\n\n \"q=#{query_terms.map(&:to_s).join(\",#{boolean_operator};\")}\"\n end", "def build_search_query(terms)\n # givenName, sn, or sAMAccountName start with each term\n query = '(&'\n query << QUERY_BASE\n \n terms.gsub(/[()]/, '').split.each do |term|\n query << '(|'\n query << \"(sAMAccountName=#{term}*)\"\n query << \"(givenName=#{term}*)\"\n query << \"(sn=#{term}*)\"\n query << \"(mail=#{term}*)\"\n query << \"(proxyaddresses=smtp:#{term}*)\"\n query << ')'\n end\n\n query << ')'\n @logger.debug(\"LDAP query = #{query}\")\n\n query\n end", "def build_query(*args)\n opts = {}\n opts = args.pop if args.last.kind_of? Hash\n\n # Add the default query, if there is one\n if not @default_query.nil? then\n # make sure there is an AND if working with a cmdline supplied part\n args.push('AND') unless args.empty?\n case @default_query\n when Array\n args.push @default_query.join(' AND ')\n when Proc\n args.push @default_query.call()\n else\n args.push @default_query.to_s\n end\n end\n\n # Get prefix as a String.\n case @prefix_query\n when Array\n prefix = @prefix_query.join(' AND ') + ' AND'\n when Proc\n prefix = @prefix_query.call()\n else\n prefix = @prefix_query.to_s\n end\n args.unshift(prefix) unless opts.has_key? :noprefix\n\n # Get suffix as a String.\n case @suffix_query\n when Array\n suffix = 'AND ' + @suffix_query.join(' AND ')\n when Proc\n suffix = @suffix_query.call()\n else\n suffix = @suffix_query.to_s\n end\n args.push(suffix) unless opts.has_key? :nosuffix\n\n args.flatten.compact.join(' ')\n end", "def search(*rules); end", "def search(*rules); end", "def search_search_text\n query\n .where(localized_search_text_in(:title), text: \"%#{search_text}%\")\n .or(query.where(localized_search_text_in(:description), text: \"%#{search_text}%\"))\n end", "def generate_search (options)\n conditions_stmt = ''\n\n if options[:id].to_s.strip != '' then\n options[:id] = CGI::unescape(options[:id])\n conditions_stmt += ' AND ' unless conditions_stmt == ''\n conditions_stmt += 'code = \"' + options[:id].to_s.strip + '\"'\n end\n\n if options[:visited].to_s.strip != '' then\n options[:visited] = CGI::unescape(options[:visited])\n conditions_stmt += ' AND ' unless conditions_stmt == ''\n conditions_stmt += 'visited = \"' + (options[:visited] == 'true' ? 't' : 'f') + '\"'\n end\n \n if options[:name].to_s.strip != '' then\n options[:name] = CGI::unescape(options[:name])\n conditions_stmt += ' AND ' unless conditions_stmt == ''\n if options[:name] =~ /\\*|\\%/\n options[:name] = options[:name].gsub('*', '%')\n conditions_stmt += 'name LIKE \"' + options[:name].to_s.strip + '\"'\n else\n if options[:name] =~ /!/\n conditions_stmt += 'name != \"' + options[:name].gsub('!', '').to_s.strip + '\"'\n else\n conditions_stmt += 'name = \"' + options[:name].to_s.strip + '\"'\n end\n end\n end\n \n Rails.logger.debug {\"Search conditions: #{conditions_stmt}\"}\n conditions_stmt\n end", "def search phrase, callback = nil\n \n and_phrases, or_phrases, not_phrases, two_word_phrases = get_and_or_not_exact_of phrase\n \n res = nil\n \n two_word_phrases.each do |phrase|\n res = List::chain res, @handlers['two_word'].search(phrase)\n end\n \n if not and_phrases.empty?\n res = List::chain res, @handlers['simple'].search_and(and_phrases)\n end\n \n or_phrases.each do |or_p|\n res = List::chain res, @handlers['simple'].search_or(or_p)\n end\n \n except = @handlers['simple'].search_and not_phrases\n \n final_result = []\n # finally filter pages not to show and return\n # real document names\n prefinal_ = List::NOT(res, except)\n if prefinal_\n prefinal_.each { |x| final_result |= [@manager.get_by_id(x)] }\n else\n puts 'warning: empty prefinal result'\n end\n \n # callback may be used for postfiltration etc.\n if callback\n final_result = callback final_result\n end\n \n return final_result\n end", "def apply_narrowing_filters\n @filters[:narrowing].each do |filter|\n @query = @query.where(filter => @options[filter])\n end\n @query\n end", "def search(params)\n filter_name, keywords, field_queries = extract params\n scope = filtered_by filter_name\n query = text_search keywords\n query = field_search field_queries, query\n scope.where query\n end", "def search_query_for(group)\n { q: \"uid:(#{group.map { |e| \"\\\"#{e.uid}\\\"\" }.join(' OR ')})\",\n def_type: 'lucene',\n facet: false,\n fl: @options[:fl] ? @options[:fl] :\n (@options[:fulltext] ?\n RLetters::Solr::Connection::DEFAULT_FIELDS_FULLTEXT :\n RLetters::Solr::Connection::DEFAULT_FIELDS),\n tv: @options[:term_vectors] || false,\n rows: group.size }\n end", "def build_filter filter, fields\n where = [fields.map { |f| \"#{f} like ?\" }.join(\" || \")]\n fields.count.times { |n| where << \"%#{filter}%\" }\n where\n end", "def search_with_index query\n docs = []\n return docs if query.terms.empty?\n load if @content.nil?\n return docs if @content.nil?\n index = {}\n query.terms.each do |term|\n if term.operator == :eq && term.value.class != Regexp\n set = @attribute_storage[term.field][term.value]\n else\n set = @content.select do |doc|\n term.compare(doc.send(term.field))\n end\n end\n\n if !set.nil? && !set.empty?\n if docs.empty?\n docs = set\n if query.relation == :and\n docs.each do |value|\n index[value] = nil\n end\n end\n else\n if query.relation == :or\n docs += set\n else\n set.each do |value|\n if !index.has_key? value\n docs << value\n index[value] = nil\n end\n end\n end\n end\n end\n end\n docs\n end", "def complex_case_search\n user_input =params[:searchterm]\n terms = user_input.split(/(.+?)((?: and | or ))/i).reject(&:empty?)\n \n if terms.present? && (terms[0].include? \"~\")\n @cases = nor_case_list(terms[0].delete \"~\")\n else\n @cases = case_list(terms[0])\n end\n\n if !terms[1].nil? && terms[1].strip == \"OR\" && terms[2].present?\n @cases = @cases | case_list(terms[2])\n elsif !terms[1].nil? && terms[1].strip == \"AND\" && terms[2].present? && (terms[2].include? \"~\")\n @cases = @cases & nor_case_list(terms[2].delete \"~\")\n else\n @cases = @cases & case_list(terms[2])\n end\n \n if @cases.present?\n render json: { success: true,response: @cases.as_json('search') },:status=>200\n else\n render :json=> { success: false, message: \"Case is not present.\" },:status=> 203\n end\n\n end", "def search(user, query, collection, wiki)\n end", "def make_query\n run_callbacks :make_query do\n self.scope.search(get_query_params)\n end\n end", "def create_parser(grammar_paths)\n @search_parser ||= grammar_paths.inject(nil) do |parser,lucene_grammar|\n begin\n break parser unless parser.nil?\n # don't instantiate custom nodes\n Treetop.load_from_string(\n IO.read(lucene_grammar).gsub(/<[^>]+>/, ''))\n LuceneParser.new\n rescue\n # silently swallow and try the next grammar\n end\n end\n end", "def do_search\n @search_text = params[:q]\n\n # Doctoring for the view to find matches:\n @q = @search_text\n @q.chop! if params[:q] =~ /\\*$/\n @q = @q[1..-1] if params[:q] =~ /^\\*/\n\n # TODO: we'll want some whitelist filtering here later:\n # params[:q] = \"#{@q}*\" unless params[:q] =~ /\\*$/ or params[:q] =~ /^[-+]/ or params[:q] =~ /\\s/\n params[:q] = I18n.transliterate(params[:q]).downcase\n\n # TODO: This search suggestions block is large; extract.\n\n # First step (and, yes, this will be slow—we will optimize later), look for\n # search suggestions that match the query:\n words = params[:q].split # TODO: we might want to remove words with ^-\n # TODO: we might also want to remove stopwords e.g.: https://github.com/brenes/stopwords-filter\n suggestions = []\n # YUCK! This is the best way to do this in Searchkick at the moment, though.\n # :S\n words.each do |word|\n word_search = SearchSuggestion.search(word, fields: [{ match: :exact }])\n suggestions += word_search.results if word_search.respond_to?(:results)\n end\n\n # If we only found one thing and they only asked for one thing:\n if suggestions.size == 1 && params[:q] !~ /\\s/\n Rails.logger.warn(\"One suggestion.\")\n # TODO: move this to a helper? It can't go on the model...\n suggestion = suggestions.first\n suggestion = suggestion.synonym_of if suggestion.synonym_of\n where = case suggestion.type\n when :page\n suggestion.page\n when :object_term\n term_records_path(uri: suggestion.object_term, object: true)\n when :path\n suggestion.path\n when :wkt_string\n flash[:notice] = \"Unimplemented, sorry.\"\n \"/\"\n end\n return redirect_to(where)\n elsif suggestions.size >= 2 && params[:q] =~ /\\s/\n Rails.logger.warn(\"Multiple suggestions.\")\n groups = suggestions.group_by(&:type)\n # Easier to handle:\n groups[:page] ||= []\n groups[:object_term] ||= []\n groups[:path] ||= []\n groups[:wkt_string] ||= []\n if groups[:page].size > 1\n Rails.logger.warn(\"Multiple PAGE suggestions.\")\n # We can't use suggestions if there's more than one species. Sorry.\n flash[:notice] = t(\"search.flash.more_than_one_species\",\n species: groups[:page].map(&:match).to_sentence)\n else\n Rails.logger.warn(\"0 or 1 Page suggestions.\")\n clade = groups[:page].try(:first).try(:page_id)\n Rails.logger.warn(\"Page suggestion: #{clade}\") if clade\n if groups[:object_term].size > 2\n Rails.logger.warn(\"Over two TERM suggestions.\")\n flash[:notice] = t(\"search.flash.more_than_two_terms\",\n terms: groups[:object_term].map(&:match).to_sentence)\n elsif groups[:path].size > 0\n Rails.logger.warn(\"...had PATH suggestions.\")\n flash[:notice] = t(\"search.flash.cannot_combine_paths\",\n path: groups[:path].map(&:match).to_sentence)\n else # NOTE: this assumes we only have OBJECT term suggestions, not predicates.\n Rails.logger.warn(\"Usable suggestions...\")\n (first, second) = groups[:object_term] # Arbitrary which is first...\n Rails.logger.warn(\"First term: #{first.object_term}\")\n Rails.logger.warn(\"Second term: #{second.object_term}\") if second\n return redirect_to(term_records_path(uri: first.object_term, object: true,\n and_object: second.try(:object_term), clade: clade))\n end\n end\n end\n\n @clade = if params[:clade]\n puts \"*\" * 100\n puts \"** Filtering by clade #{params[:clade]}\"\n # It doesn't make sense to filter some things by clade:\n params[:only] = if params[:only]\n Array(params[:only]) - [:collections, :users, :predicates, :object_terms]\n else\n [:pages, :media]\n end\n puts \"Only param should now be: #{params[:only]}\"\n Page.find(params[:clade])\n else\n nil\n end\n\n default = params.has_key?(:only)? false : true\n @types = {}\n [ :pages, :collections, :articles, :images, :videos, :videos, :sounds, :links, :users, :predicates, :object_terms ].\n each do |sym|\n @types[sym] = default\n end\n\n @types[params[:only].to_sym] = true if params.has_key?(:only)\n\n # if params.has_key?(:only)\n # Array(params[:only]).each { |type| @types[type.to_sym] = true }\n # elsif params.has_key?(:except)\n # Array(params[:except]).each { |type| @types[type.to_sym] = false }\n # end\n\n # NOTE: no search is performed unless the @types hash indicates a search for\n # that class is required:\n\n @pages = if @types[:pages]\n fields = %w[preferred_vernacular_strings^20 vernacular_strings^20 preferred_scientific_names^10 scientific_name^10 synonyms^10 providers resource_pks]\n match = words.size == 1 ? :text_start : :phrase\n basic_search(Page, boost_by: [:page_richness, :specificity, :depth], match: match, fields: fields,\n where: @clade ? { ancestry_ids: @clade.id } : nil,\n includes: [:preferred_vernaculars, :medium, { native_node: { node_ancestors: :ancestor } }])\n else\n nil\n end\n\n\n @collections = if @types[:collections]\n basic_search(Collection, fields: [\"name^5\", \"description\"])\n else\n nil\n end\n\n @articles = if @types[:articles]\n basic_search(Searchkick,\n fields: [\"name^5\", \"resource_pk^10\", \"owner\", \"description^2\"],\n where: @clade ? { ancestry_ids: @clade.id } : nil,\n index_name: [Article])\n else\n nil\n end\n\n @images = if @types[:images]\n media_search(\"image\")\n else\n nil\n end\n\n @videos = if @types[:videos]\n media_search(\"video\")\n else\n nil\n end\n\n @sounds = if @types[:sounds]\n media_search(\"sound\")\n else\n nil\n end\n\n # @links = if @types[:links]\n # basic_search(Searchkick,\n # fields: [\"name^5\", \"resource_pk^10\", \"owner\", \"description^2\"],\n # where: @clade ? { ancestry_ids: @clade.id } : nil,\n # index_name: [Link])\n # else\n # nil\n # end\n\n @users = if @types[:users]\n basic_search(User, fields: [\"username^6\", \"name^4\", \"tag_line\", \"bio^2\"])\n else\n nil\n end\n\n Searchkick.multi_search([@pages, @articles, @images, @videos, @sounds, @collections, @users].compact)\n\n @pages = PageSearchDecorator.decorate_collection(@pages) if @pages\n @articles = ArticleSearchDecorator.decorate_collection(@articles) if @articles\n @images = ImageSearchDecorator.decorate_collection(@images) if @images\n @videos = VideoSearchDecorator.decorate_collection(@videos) if @videos\n @sounds = SoundSearchDecorator.decorate_collection(@sounds) if @sounds\n @collections = CollectionSearchDecorator.decorate_collection(@collections) if @collections\n @users = UserSearchDecorator.decorate_collection(@users) if @users\n\n # if @types[:predicates]\n # @predicates_count = TraitBank.count_predicate_terms(@q)\n # # NOTE we use @q here because it has no wildcard.\n # @predicates = Kaminari.paginate_array(\n # TraitBank.search_predicate_terms(@q, params[:page], params[:per_page]),\n # total_count: @predicates_count\n # ).page(params[:page]).per(params[:per_page] || 50)\n # end\n #\n # if @types[:object_terms]\n # @object_terms_count = TraitBank.count_object_terms(@q)\n # # NOTE we use @q here because it has no wildcard.\n # @object_terms = Kaminari.paginate_array(\n # TraitBank.search_object_terms(@q, params[:page], params[:per_page]),\n # total_count: @object_terms_count\n # ).page(params[:page]).per(params[:per_page] || 50)\n # end\n\n respond_to do |fmt|\n fmt.html do\n @page_title = t(:page_title_search, query: @q)\n end\n\n fmt.js { }\n\n # TODO: JSON results for other types! TODO: move; this is view logic...\n fmt.json do\n render json: JSON.pretty_generate(@pages.results.as_json(\n except: :native_node_id,\n methods: :scientific_name,\n include: {\n preferred_vernaculars: { only: [:string],\n include: { language: { only: :code } } },\n # NOTE I'm excluding a lot more for search than you would want for\n # the basic page json:\n top_media: { only: [ :id, :guid, :owner, :name ],\n methods: [:small_icon_url, :medium_icon_url],\n include: { provider: { only: [:id, :name] },\n license: { only: [:id, :name, :icon_url] } } }\n }\n ))\n end\n end\n end", "def search_expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n return_value = SearchExpressionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal2 = nil\n string_literal3 = nil\n string_literal4 = nil\n not_expression1 = nil\n not_expression5 = nil\n\n tree_for_string_literal2 = nil\n tree_for_string_literal3 = nil\n tree_for_string_literal4 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 14:7: not_expression ( ( 'and' | 'or' | 'xor' ) not_expression )*\n @state.following.push( TOKENS_FOLLOWING_not_expression_IN_search_expression_48 )\n not_expression1 = not_expression\n @state.following.pop\n @adaptor.add_child( root_0, not_expression1.tree )\n # at line 14:22: ( ( 'and' | 'or' | 'xor' ) not_expression )*\n while true # decision 2\n alt_2 = 2\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0.between?( T__9, T__11 ) )\n alt_2 = 1\n\n end\n case alt_2\n when 1\n # at line 14:24: ( 'and' | 'or' | 'xor' ) not_expression\n # at line 14:24: ( 'and' | 'or' | 'xor' )\n alt_1 = 3\n case look_1 = @input.peek( 1 )\n when T__9 then alt_1 = 1\n when T__10 then alt_1 = 2\n when T__11 then alt_1 = 3\n else\n raise NoViableAlternative( \"\", 1, 0 )\n end\n case alt_1\n when 1\n # at line 14:25: 'and'\n string_literal2 = match( T__9, TOKENS_FOLLOWING_T__9_IN_search_expression_53 )\n\n tree_for_string_literal2 = @adaptor.create_with_payload( string_literal2 )\n root_0 = @adaptor.become_root( tree_for_string_literal2, root_0 )\n\n\n when 2\n # at line 14:34: 'or'\n string_literal3 = match( T__10, TOKENS_FOLLOWING_T__10_IN_search_expression_58 )\n\n tree_for_string_literal3 = @adaptor.create_with_payload( string_literal3 )\n root_0 = @adaptor.become_root( tree_for_string_literal3, root_0 )\n\n\n when 3\n # at line 14:42: 'xor'\n string_literal4 = match( T__11, TOKENS_FOLLOWING_T__11_IN_search_expression_63 )\n\n tree_for_string_literal4 = @adaptor.create_with_payload( string_literal4 )\n root_0 = @adaptor.become_root( tree_for_string_literal4, root_0 )\n\n\n end\n @state.following.push( TOKENS_FOLLOWING_not_expression_IN_search_expression_67 )\n not_expression5 = not_expression\n @state.following.pop\n @adaptor.add_child( root_0, not_expression5.tree )\n\n else\n break # out of loop for decision 2\n end\n end # loop for decision 2\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n end\n \n return return_value\n end", "def create_parser(grammar_paths)\n @search_parser ||=\n grammar_paths.inject(nil) do |parser, lucene_grammar|\n begin\n break parser unless parser.nil?\n # Don't instantiate custom nodes\n Treetop.load_from_string(\n IO.read(lucene_grammar).gsub(/<[^>]+>/, ''))\n LuceneParser.new\n rescue\n # Silently swallow and try the next grammar\n end\n end\n end", "def appctrl_build_search_conditions( model )\n\n # All search-related keys start with \"s_\". The next character is a number\n # or letter which causes \"sort\" to organise keys in the order specified in\n # the view. An associated key \"sr_\" carries \"and\" or \"or\" for the radio\n # button selection for that entry, or neither of these if there is no radio\n # button (the first search term).\n\n conditions = []\n query = ''\n first = true\n columns = model::SEARCH_COLUMNS\n translate = model.respond_to?( :columns_for_translation )\n\n columns.each do | column |\n\n # Fields with a \"#\" inside have a method name to call to generate the\n # form data.\n\n array = column.split( '#' )\n\n if ( array.size > 1 )\n column = array.first\n generator_method = array.last\n else\n generator_method = nil\n end\n\n column = model.translated_column( column ) if ( translate )\n value = params[ \"s_#{ column }\".to_sym ]\n next if ( value.blank? )\n\n radio = params[ \"sr_#{ column }\".to_sym ]\n\n # If this is the first search term with a non-empty value then the radio\n # button and/or state is irrelevant and must be suppressed to avoid\n # invalid SQL generation later.\n\n if ( first )\n radio = ''\n first = false\n end\n\n # Make sure the value is an appropriate type.\n\n klass = model.columns_hash[ column ].klass # Ruby type representing column\n\n if ( klass == Fixnum )\n value = value.to_i\n elsif ( klass == Float )\n value = value.to_f\n else\n value = \"%#{ value }%\"\n end\n\n # If a block is given then call it, passing the column name. It should\n # evaluate to \"nil\" or a string.\n\n caller_sql = yield( column ) if ( block_given? )\n\n if ( caller_sql.nil? )\n klass = model.columns_hash[ column ].klass # Ruby type representing column\n\n if ( klass == Fixnum || klass == Float )\n sql_fragment = \"#{ column } = ?\"\n else\n sql_fragment = \"LOWER(#{ column }) LIKE LOWER(?)\"\n end\n\n conditions.push( value )\n else\n sql_fragment = caller_sql\n conditions = conditions + ( [ value ] * caller_sql.count( '?' ) )\n end\n\n # Map radios manually, rather than with \"radio.uppercase\" or whatever -\n # the values come from the form submission so cannot be trusted. Someone\n # might try inserting bits of SQL in there to hack the site.\n\n case radio\n when \"and\": sql_fragment = \" AND (#{ sql_fragment })\"\n when \"or\": sql_fragment = \" OR (#{ sql_fragment })\"\n else sql_fragment = \"(#{ sql_fragment })\"\n end\n\n query << sql_fragment\n end\n\n # Push the conditions string onto the front of the array as this is what\n # the \":conditions\" parameter in \"find()\" et al will expect.\n\n return conditions.unshift( query )\n end", "def where(search, operator)\n\t\twhere_clause=[]\n\t\tfor i in 0..search.count-1\n\t\t\tif search.values[i].is_a? String\n\t\t\t\twhere_clause.push(\"#{search.keys[i]}#{operator}'#{search.values[i]}'\")\n\t\t\telse\n\t\t\t\twhere_clause.push(\"#{search.keys[i]}#{operator}#{search.values[i]}\")\n\t\t\tend\n\t\tend\n\t\twhere_clause = where_clause.join(\" AND \")\n\t\tresults = DATA.execute(\"SELECT * FROM #{@table} WHERE #{where_clause}\")\n\t\treturn results\n\tend", "def interpret(expression)\n \t\tresult = [\"Query Result: \"]\n\t\tmainQuery = ' '\n\t\tsubQuery = ' '\n\t\tforUsed = false\n\t\tsearchString = nil\n\t\tsearchStarted = false\n\t\tsearchEnded = false\n\n\t\ttokens = expression.split(' ')\n\t\tfor currentToken in tokens\n \t\t\tif currentToken == \"show\"\n \t\t\t\tnext\n\t\t\tend\n\n\t\t\t#//show in all queries, not really used\n\t\t\tif currentToken == \"title\"\n \t\t\t\tif mainQuery == ' '\n \t\t\t\t\tmainQuery = 'T'\n\t\t\t\telsif forUsed and subQuery == ' '\n \t\t\t\t\t\tsubQuery = 'T'\n\t\t\t\tend\n\t\t\telsif currentToken == \"actor\"\n \t\t\t\tif mainQuery == ' '\n \t\t\t\t\tmainQuery = 'A'\n\t\t\t\telsif forUsed and subQuery == ' '\n \t\t\t\t\t\tsubQuery = 'A'\n\t\t\t\tend\n\n\t\t\telsif currentToken == 'for'\n \t\t\t\tforUsed = true\n\n\t\t\telsif searchString == nil and subQuery != ' ' and currentToken.start_with?(\"<\")\n \t\t\t\tsearchString = currentToken\n\t\t\t\tsearchStarted = true\n\t\t\t\tif currentToken.end_with?(\">\")\n \t\t\t\t\tsearchEnded = true \n\t\t\t\tend\n\n\t\t\telsif searchStarted and not searchEnded\n \t\t\t\tsearchString += \" \" + currentToken\n\t\t\t\tif currentToken.end_with?(\">\")\n\t\t\t\t\tsearchEnded = true \n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\n\t\t#//remove <>\n\t\tif searchString != nil\n\t\t\tsearchString = searchString.slice(1..-2)\n\t\t\t#searchString = searchString.substring(1,(searchString.length() - 1)) \n\t\tend\n\n\t\texpr = nil\n\t\tif mainQuery == 'A'\n \t\t\tif subQuery == 'T'\n \t\t\t\texpr = DvdActorTitleExpression.new(searchString) \n\t\t\telse\n \t\t\t\texpr = DvdActorExpression.new()\n\t\t\tend\n\t\telsif mainQuery == 'T'\n \t\t\tif subQuery == 'A'\n \t\t\t\texpr = DvdTitleActorExpression.new(searchString) \n\t\t\telse\n \t\t\t\texpr = DvdTitleExpression.new()\n\t\t\tend\n\t\telse\n \t\t\treturn str(result)\n\t\tend\n\n\t\tresult.push(expr.interpret(@ctx))\n\t\tresult.join('')\n\tend", "def test_word_operator\n tokenizer = Tokenizer.new\n tokenizer.text = \"and or\"\n tokenizer.tokenize\n tokens = tokenizer.tokens\n\n #test type of token\n assert_equal(\"OperatorToken\", tokens.first.class.name)\n\n #test values\n assert_equal(\"AND\", tokens.first.val)\n assert_equal(\"OR\", tokens.last.val)\n\n #test position\n assert_equal(4, tokens.last.start_index)\n assert_equal(6, tokens.last.end_index)\n end" ]
[ "0.6859464", "0.6680074", "0.6680074", "0.6474183", "0.64040613", "0.6363093", "0.6296369", "0.61689484", "0.60850304", "0.6061759", "0.5979322", "0.5901407", "0.5892853", "0.58882225", "0.5825663", "0.5780755", "0.57691365", "0.57658976", "0.57221997", "0.5711245", "0.56620693", "0.5655007", "0.5637597", "0.5635635", "0.56021374", "0.55996615", "0.55815333", "0.55692554", "0.555306", "0.5524582", "0.5516037", "0.5508484", "0.5499968", "0.5494813", "0.5472515", "0.5472515", "0.54492545", "0.5448399", "0.5444667", "0.5429181", "0.54220444", "0.54161966", "0.5388163", "0.5378478", "0.53679526", "0.5362554", "0.53607", "0.5358066", "0.53460497", "0.5345266", "0.53376377", "0.533173", "0.53268266", "0.53268266", "0.5323337", "0.53156", "0.52961284", "0.52890784", "0.52799034", "0.52777994", "0.52607214", "0.5259682", "0.5257299", "0.52434963", "0.524", "0.5239541", "0.52304244", "0.522674", "0.52254426", "0.5222009", "0.521964", "0.52178043", "0.5208786", "0.52075845", "0.52020127", "0.52019614", "0.52011883", "0.520034", "0.5197494", "0.5187955", "0.5187955", "0.5182974", "0.5178522", "0.5175546", "0.51536167", "0.5152566", "0.5152526", "0.5147885", "0.51427245", "0.5139265", "0.5128337", "0.5121058", "0.5117294", "0.5109246", "0.5107716", "0.5106339", "0.50963205", "0.50961167", "0.5086411", "0.5083662" ]
0.63389915
6
Create query using join parser, similar to sql join.
def join_query(from, to, field, value) "_query_:\"{!join from=#{from} to=#{to}}#{field}:\\\"#{value}\\\"\"" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join(table, field1, field2, join_type = 'INNER JOIN')\n @join = \" #{join_type} #{table} ON #{@from}.#{field1}=#{table}.#{field2}\"\n\n self\n end", "def join(*args)\n\t\tif args.count > 1\n\t\t\tjoins = args.map { |arg| \"INNER JOIN #{arg} ON #{arg}.#{table}_id = #{table}.id\"}.join(\" \")\n\t\t\trows = connection.execute <<-SQL \n\t\t\t\tSELECT * FROM #{table} #{joins};\n\t\t\tSQL\n\t\telse\n\t\t\tcase args.first\n\t\t\twhen String\n\t\t\t\trows = connection.execute <<-SQL\n\t\t\t\t\tSELECT * FROM #{table} #{BlocRecord::Utility.sql_strings(args.first)};\n\t\t\t\tSQL\n\t\t\twhen Symbol\n\t\t\t\trows = connection.execute <<-SQL \n\t\t\t\t\tSELECT * FROM #{table}\n\t\t\t\t\tINNER JOIN #{args.first} ON #{arg.first}.#{table}_id = #{table}.id;\n\t\t\t\tSQL\n\t\t\twhen Hash \n\t\t\t\t#extract the options from the hash\n\t\t\t\tsecond_table = args[0].keys.first \n\t\t\t\tthird_table = args[0].keys.first\n\t\t\t\trows = connection.execute <<-SQL \n\t\t\t\t\tSELECT * FROM #{table}\n\t\t\t\t\tINNER JOIN #{second_table} ON #{second_table}.#{table}_id = #{table}.id\n\t\t\t\t\tINNER JOIN #{third_table} ON #{third_table}.#{second_table}_id = #{second_table}.id;\n\t\t\t\tSQL\n\n\t\t\tend \n\t\tend\n\t\trows_to_array(rows)\n\tend", "def join_from_sql(type, sql)\n if(from = @opts[:from][1..-1]).empty?\n raise(Error, 'Need multiple FROM tables if updating/deleting a dataset with JOINs') if @opts[:join]\n else\n sql << SPACE << type.to_s << SPACE\n source_list_append(sql, from)\n select_join_sql(sql)\n end\n end", "def join_from_sql(type, sql)\n if(from = @opts[:from][1..-1]).empty?\n raise(Error, 'Need multiple FROM tables if updating/deleting a dataset with JOINs') if @opts[:join]\n else\n sql << ' ' << type.to_s << ' '\n source_list_append(sql, from)\n select_join_sql(sql)\n end\n end", "def join_query(*queries, *tables, join_type=nil, *conditions)\n\tquery = \"select \"\n\tqueries.each do |statement|\n\t\tquery += \" #{statement}\"\n\tend\n\n\tquery += \" from\"\n\n\ttables.each do |table|\n\t\tquery += \"#{table}\"\n\tend\n\n\tquery += \"#{join_type}\" if join_type != nil\n\n\tif join_type == \"INNER\"\n\t\tquery += \"INNER JOIN\"\n\t\tconditions.each do |condition|\n\t\t\tquery += \"ON\"\n\t\t\tquery += \" #{condition}\"\n\t\tend\n\tend\n\n\tif join_type == \"CROSS\"\n\t\tquery += \"CROSS JOIN\"\n\t\tquery += conditions[0]\n\tend\n\n\treturn query\n\nend", "def append_join(join)\n @clause[:join] << join.string \n @clause[:join] << join.implicit_joins\n end", "def multi_query_builder\n\n query = \"\n SELECT\n #{select_arr.join(\",\\n\\t\")}\n FROM \\t#{groups.first.parent_table}\n #{pk_join_arr.join(\"\\n\")}\n #{fk_join_arr.join(\"\\n\")};\"\n\n return query\n end", "def test_join1\n\t\tr = prep(\"program foo;\\nfoo(A,B) :- bar(A,B);\\n\")\n\t\t\n\t\t# set up schema table's predicate\n\t\t## require 'ruby-debug'; debugger\n\t\tterm_schema = @terms.schema_of\n\t\tterm_pred = Predicate.new(false,@terms.name,@terms,term_schema.variables)\n\t\tterm_pred.set(r, \"global\", \"r3\", 1)\n\t\t\n\t\tsj = ScanJoin.new(r, term_pred, @preds.schema_of)\t\n\t\tts = TupleSet.new(\"pred\", *@preds.tuples)\n\t\tres = sj.evaluate(ts)\n\n\t\tassert_equal(2, res.tups.length)\n\tend", "def join_query\n prefixes = Survey.all.map &:prefix\n query = [\"select * from export_journal_infos ji, \"] << prefixes.map {|prefix| \"export_variables_#{prefix}_answers\" }\n prefixes.each do |prefix|\n query << \"where export_variables_#{prefix}_answers. #{prefix} on #{prefix}.journal_id = ji.journal_id \"\n # query << \"inner join export_variables_#{prefix}_answers #{prefix} on #{prefix}.journal_id = ji.journal_id \"\n end\n query\n end", "def construct_simple_join_sql(num)\n connection = klass.connection\n key_value_table = klass.table_name\n\n main_table = definition.klass.table_name\n main_table_pk, value_table_fk_main = reflection_keys(definition.reflection_by_name(definition.klass, relation))\n\n join_sql = \"\\n INNER JOIN #{connection.quote_table_name(key_value_table)} #{key_value_table}_#{num} ON (#{connection.quote_table_name(main_table)}.#{connection.quote_column_name(main_table_pk)} = #{key_value_table}_#{num}.#{connection.quote_column_name(value_table_fk_main)})\"\n return join_sql\n end", "def using(key, &block)\n if @type == :natural then cmd = 'JOIN '\n elsif @type == :left then cmd = 'LEFT JOIN '\n elsif @type == :right then cmd = 'RIGHT JOIN '\n end\n key = key.to_s\n using_string = \"#{@base_klass.table_name}.#{key} = \"\n using_string << \"#{@join_klass.table_name}.#{key}\"\n @string = \"\\n\" << cmd << @join_klass.table_name << ' ON (' << using_string << ') '\n @clause_parser.append_join(self)\n yield @clause_parser # use extended clause parser for inner block argument\n end", "def build_join_expression(exps, other, type)\n return ['true', []] if type == :cross\n\n a_heads = headers\n b_heads = other.headers\n common_heads = a_heads & b_heads\n b_common_heads = []\n if exps.empty?\n if common_heads.empty?\n msg = \"#{type}-join with no common column names needs join expression\"\n raise UserError, msg\n else\n # A Natural join on all common heads\n common_heads.each do |h|\n ensure_common_types!(self_h: h, other_h: h, other: other)\n end\n nat_exp = common_heads.map { |h| \"(#{h}_a == #{h}_b)\" }.join(' && ')\n [nat_exp, common_heads]\n end\n else\n # We have join expressions to evaluate\n and_conds = []\n partial_result = nil\n last_sym = nil\n exps.each do |exp|\n case exp\n when Symbol\n case exp.to_s.clean\n when /\\A(?<sy>.*)_a\\z/\n a_head = Regexp.last_match[:sy].to_sym\n unless a_heads.include?(a_head)\n raise UserError, \"no column '#{a_head}' in table\"\n end\n\n if partial_result\n # Second of a pair\n ensure_common_types!(self_h: a_head,\n other_h: last_sym,\n other: other)\n partial_result << \"#{a_head}_a)\"\n and_conds << partial_result\n partial_result = nil\n else\n # First of a pair of _a or _b\n partial_result = +\"(#{a_head}_a == \"\n end\n last_sym = a_head\n when /\\A(?<sy>.*)_b\\z/\n b_head = Regexp.last_match[:sy].to_sym\n unless b_heads.include?(b_head)\n raise UserError, \"no column '#{b_head}' in second table\"\n end\n\n if partial_result\n # Second of a pair\n ensure_common_types!(self_h: last_sym,\n other_h: b_head,\n other: other)\n partial_result << \"#{b_head}_b)\"\n and_conds << partial_result\n partial_result = nil\n else\n # First of a pair of _a or _b\n partial_result = +\"(#{b_head}_b == \"\n end\n b_common_heads << b_head\n last_sym = b_head\n else\n # No modifier, so must be one of the common columns\n unless partial_result.nil?\n # We were expecting the second of a modified pair, but got an\n # unmodified symbol instead.\n msg =\n \"follow '#{last_sym}' by qualified exp from the other table\"\n raise UserError, msg\n end\n # We have an unqualified symbol that must appear in both tables\n unless common_heads.include?(exp)\n msg = \"unqualified column '#{exp}' must occur in both tables\"\n raise UserError, msg\n end\n ensure_common_types!(self_h: exp, other_h: exp, other: other)\n and_conds << \"(#{exp}_a == #{exp}_b)\"\n b_common_heads << exp\n end\n when String\n # We have a string expression in which all column references must be\n # qualified.\n and_conds << \"(#{exp})\"\n else\n msg = \"invalid join expression '#{exp}' of class #{exp.class}\"\n raise UserError, msg\n end\n end\n [and_conds.join(' && '), b_common_heads]\n end\n end", "def relation_method\n :join\n end", "def join(args, joiner=nil)\n raise Error, 'argument to Sequel.join must be an array' unless args.is_a?(Array)\n if joiner\n args = args.zip([joiner]*args.length).flatten\n args.pop\n end\n\n return SQL::StringExpression.new(:NOOP, '') if args.empty?\n\n args = args.map do |a|\n case a\n when Symbol, ::Sequel::SQL::Expression, ::Sequel::LiteralString, TrueClass, FalseClass, NilClass\n a\n else\n a.to_s\n end\n end\n SQL::StringExpression.new(:'||', *args)\n end", "def apply_join(query, join)\n validate_query(query)\n query.joins(join)\n end", "def construct_join_sql(key_relation, num)\n join_sql = \"\"\n connection = klass.connection\n key = key_relation.to_s.singularize.to_sym\n\n key_table = definition.reflection_by_name(klass, key).table_name\n value_table = klass.table_name.to_s\n\n value_table_fk_key, key_table_pk = reflection_keys(definition.reflection_by_name(klass, key))\n\n main_reflection = definition.reflection_by_name(definition.klass, relation)\n if main_reflection\n main_table = definition.klass.table_name\n main_table_pk, value_table_fk_main = reflection_keys(definition.reflection_by_name(definition.klass, relation))\n\n join_sql = \"\\n INNER JOIN #{connection.quote_table_name(value_table)} #{value_table}_#{num} ON (#{main_table}.#{main_table_pk} = #{value_table}_#{num}.#{value_table_fk_main})\"\n value_table = \" #{value_table}_#{num}\"\n end\n join_sql += \"\\n INNER JOIN #{connection.quote_table_name(key_table)} #{key_table}_#{num} ON (#{key_table}_#{num}.#{key_table_pk} = #{value_table}.#{value_table_fk_key}) \"\n\n return join_sql\n end", "def to_sql\n @sql ||= case @kind\n when :target, :comp_op, :bin_bool_op, :term\n child(0).to_sql\n when :target_set\n # array of fragments, one per target\n [child(0).to_sql] + (child(1) ? child(2).to_sql : [])\n when :qual_term\n # child(2) will be an array (target_set)\n \"(\" + child(2).to_sql.collect{|sql| comparison(child(0), child(1).child(0), sql)}.join(\" OR \") + \")\"\n when :unqual_term\n \"(\" + default_quals.collect{|q| comparison(q, EQUAL_TOKEN, child(0).to_sql)}.join(\" OR \") + \")\"\n when :query\n # first form\n if child(0).is?(:lparen)\n @children.collect{|c| c.to_sql}.join\n # second form\n elsif child(1) && child(1).is?(:bin_bool_op)\n @children.collect{|c| c.to_sql}.join(\" \")\n # third form\n elsif child(1) && child(1).is?(:query)\n child(0).to_sql + \" AND \" + child(1).to_sql\n # fourth form\n else\n child(0).to_sql\n end\n end\n end", "def add_joins!(sql, options, scope = :auto)\r\n scope = scope(:find) if :auto == scope\r\n join = (scope && scope[:joins]) || options[:joins]\r\n return if join.blank?\r\n extend_sql_avoiding_table_naming_clashes!(sql, scope && scope[:joins])\r\n extend_sql_avoiding_table_naming_clashes!(sql, options[:joins])\r\n end", "def joins\n\t\tprivate_methods(false).grep(/_joins$/).sort.map { |m| send(m) }.compact\n\tend", "def prepend_join(join)\n @clause[:join] = join.string << @clause[:join]\n @clause[:join] << join.implicit_joins\n end", "def table_aliases_from_join_fragment(sql)\r\n return [] if sql.blank?\r\n return sql.scan(/JOIN\\s+(`[^`]+`|\"[^\"]+\"|\\[[^\\]]+\\]|\\S+)(?:\\s+(?:AS\\s+)?(`[^`]+`|\"[^\"]+\"|\\[[^\\]]+\\]|\\S+))?/i).collect do |name|\r\n ((name[1] =~ /^ON$/i) ? name[0] : (name[1] || name[0])).gsub(/^[`\"\\[]?(.*)[`\"\\]]?$/, '\\1')\r\n end\r\n end", "def to_clause( join_string, compact_nils = DONT_COMPACT_NILS )\n # The clause items and the values have to be in the same order.\n keys_ = keys\n if block_given?\n mapping = keys_.map { |field| yield field }\n else\n mapping = keys_.map { |field| \"#{field} = ?\" }\n end\n clause = mapping.join( join_string )\n values_ = keys_.map { |key|\n self[ key ]\n }\n if compact_nils\n values_.compact!\n end\n [ clause, values_ ]\n end", "def joins(tables,options={})\n # now check for dot notiation\n dot_notation = tables.split \".\"\n parent_table = nil\n options = {}\n dot_notation.each do |j_table|\n options[:from] = parent_table unless parent_table.nil?\n options[:alias] = j_table unless parent_table.nil?\n join(j_table,options)\n parent_table = j_table\n end\n\n self\n end", "def to_find_conditions(join_association = {})\n return nil if operator.nil?\n \n op, arg_format, values = operator, \"?\", [operand]\n op, arg_format, values = case operator\n when :<=> then [ \"BETWEEN\", \"? AND ?\", [ operand.first, operand.last ] ]\n when :=~ then\n case operand\n when String then [ \"LIKE\", arg_format, values ]\n when Regexp then [ \"REGEXP\", arg_format, values.map(&:source) ]\n end\n when :==, :=== then\n case operand\n when Array then [ \"IN\", \"(?)\", values ]\n when Range then [ \"IN\", \"(?)\", values ]\n when Condition then [ \"=\", operand.full_name, [] ]\n when nil then [ \"IS\", \"NULL\", [] ]\n else [ \"=\", arg_format, values ]\n end\n when :contains then [ \"LIKE\", arg_format, values.map{|v| \"%#{v}%\" } ]\n else\n case operand\n when Condition then [ op, oprand.full_name, [] ]\n else [ op, arg_format, values ]\n end\n end\n sql = \"#{full_name} #{op} #{arg_format}\"\n sql = \"NOT (#{sql})\" if @negative\n [ sql, *values ]\n end", "def joins_for_match_all_tags(tags)\n joins = []\n \n tags.each_with_index do |tag, index|\n taggings_alias = \"#{Tagging.table_name}_#{index}\"\n tags_alias = \"#{Tag.table_name}_#{index}\"\n\n join = <<-END\n INNER JOIN #{Tagging.table_name} AS #{taggings_alias} ON\n #{taggings_alias}.taggable_id = #{table_name}.#{primary_key} AND\n #{taggings_alias}.taggable_type = #{quote_value(base_class.name)} AND\n #{taggings_alias}.tag_id = ?\n END\n\n joins << sanitize_sql([join, tag.id])\n end\n \n joins.join(\" \")\n end", "def joins\n []\n end", "def handle_joins fields, select = nil\n ret = select || scoped\n fields.each do |qualified_field|\n assoc, foreign_table, field = parse_field(qualified_field)\n ret = ret.joins(join_string(assoc, foreign_table)) if assoc\n end\n ret\n end", "def extract_query_conditions(join_string = \"AND\")\n Rails.logger.debug { \"extract_query_conditions ...\" }\n \n return @extracted_query_conditions if @extracted_query_conditions\n conditions_string = \"\"\n condition_values = []\n query_conditions.each do |condition|\n Rails.logger.debug { \"condition = #{condition.inspect}\" }\n \n unless condition.nil? || condition.empty?\n Rails.logger.debug { \"loading from condition: #{condition.inspect}\" }\n conditions_string += \" #{join_string} \" unless conditions_string.blank?\n if condition.is_a?(Hash)\n condition = condition[:conditions]\n end\n conditions_string += (\"(\" + condition.shift + \")\")\n condition_values += condition\n end\n end\n @extracted_query_conditions = ([conditions_string] + condition_values)\n end", "def build_query(*args)\n opts = {}\n opts = args.pop if args.last.kind_of? Hash\n\n # Add the default query, if there is one\n if not @default_query.nil? then\n # make sure there is an AND if working with a cmdline supplied part\n args.push('AND') unless args.empty?\n case @default_query\n when Array\n args.push @default_query.join(' AND ')\n when Proc\n args.push @default_query.call()\n else\n args.push @default_query.to_s\n end\n end\n\n # Get prefix as a String.\n case @prefix_query\n when Array\n prefix = @prefix_query.join(' AND ') + ' AND'\n when Proc\n prefix = @prefix_query.call()\n else\n prefix = @prefix_query.to_s\n end\n args.unshift(prefix) unless opts.has_key? :noprefix\n\n # Get suffix as a String.\n case @suffix_query\n when Array\n suffix = 'AND ' + @suffix_query.join(' AND ')\n when Proc\n suffix = @suffix_query.call()\n else\n suffix = @suffix_query.to_s\n end\n args.push(suffix) unless opts.has_key? :nosuffix\n\n args.flatten.compact.join(' ')\n end", "def sql_parse_query(default_nick, args, context=CTX_LOG)\n oargs = args.dup\n args, extra = extra_field_clause(args, context)\n args, sort_fields = extract_sort_fields(args, extra)\n args, group_filters = extract_group_filters(args, extra)\n\n split_args = split_query_parts(args)\n primary_args = split_args[0]\n\n if split_args.size > 1 && sort_fields.empty?\n sort_fields = extract_sort_fields([\"o=%\"], extra)[1]\n end\n\n nick = resolve_nick(extract_nick(primary_args), default_nick)\n primary_query = sql_build_query(nick, cloneargs(primary_args),\n context, extra, false)\n\n # Not all split queries will have an aggregate column. For instance:\n # !lg * / win has no aggregate column, but the user presumably wants to use\n # counts. In such cases, add x=n for the user.\n if split_args.size > 1 && !primary_query.summarise? && extra.empty?\n _, extra = extra_field_clause(['x=n'], context)\n primary_query = sql_build_query(nick, cloneargs(primary_args),\n context, extra, false)\n end\n\n # If the query has no sorts, but has an x=foo form => o=foo form.\n # If the query has no sorts and no x=foo, but has s=[+-]foo => o=[+-]n\n if primary_query.summarise && sort_fields.empty?\n if !extra.empty?\n sort_fields = extra.default_sorts\n else\n summary_field_list = primary_query.summarise\n sort_field = summary_field_list.fields[0]\n sort_fields = extract_sort_fields([\"o=#{sort_field.order}n\"], extra)[1]\n end\n end\n\n query_list = QueryList.new\n query_list.sorts = sort_fields\n query_list.filters = group_filters\n query_list << primary_query\n\n for fragment_args in split_args[1..-1] do\n combined_args = listgame_combine_argument_lists(cloneargs(primary_args),\n fragment_args)\n query_list << sql_build_query(nick, combined_args,\n context, extra, false)\n end\n\n # If we have multiple queries, all must be summary queries:\n if query_list.size > 1 and !query_list.all? { |q| q.summarise? }\n raise (\"Bad input: #{oargs.join(' ')}; when using /, \" +\n \"all query pieces must be summary queries\")\n end\n\n query_list\nend", "def join_table(type, table, expr=nil, options=OPTS, &block)\n if expr.is_a?(SQL::AliasedExpression) && expr.expression.is_a?(Array) && !expr.expression.empty? && expr.expression.all?\n options = options.merge(:join_using=>true)\n end\n super\n end", "def query(*args, &block)\n if args.empty?\n @query\n else\n if args[0].is_a?(String)\n @query = args[0].strip\n else\n @query = build_arel(\n args.inject({}) do |acc, param|\n acc.merge(\n param.is_a?(Hash) ? param : Hash[ [[param, nil]] ]\n )\n end,\n block).to_sql\n end\n end\n end", "def query(args = {})\n initialize_query unless initialized?\n\n our_select = args[:select] || \"DISTINCT #{model.table_name}.id\"\n our_join = join.dup\n our_join += args[:join] if args[:join].is_a?(Array)\n our_join << args[:join] if args[:join].is_a?(Hash)\n our_join << args[:join] if args[:join].is_a?(Symbol)\n our_tables = tables.dup\n our_tables += args[:tables] if args[:tables].is_a?(Array)\n our_tables << args[:tables] if args[:tables].is_a?(Symbol)\n our_from = calc_from_clause(our_join, our_tables)\n our_where = where.dup\n our_where += args[:where] if args[:where].is_a?(Array)\n our_where << args[:where] if args[:where].is_a?(String)\n our_where = calc_where_clause(our_where)\n our_group = args[:group] || group\n our_order = args[:order] || order\n our_order = reverse_order(order) if our_order == :reverse\n our_limit = args[:limit]\n\n # Tack id at end of order to disambiguate the order.\n # (I despise programs that render random results!)\n if our_order.present? &&\n !our_order.match(/.id( |$)/)\n our_order += \", #{model.table_name}.id DESC\"\n end\n\n sql = %(\n SELECT #{our_select}\n FROM #{our_from}\n )\n sql += \" WHERE #{our_where}\\n\" if our_where.present?\n sql += \" GROUP BY #{our_group}\\n\" if our_group.present?\n sql += \" ORDER BY #{our_order}\\n\" if our_order.present?\n sql += \" LIMIT #{our_limit}\\n\" if our_limit.present?\n\n @last_query = sql\n sql\n end", "def joins\n @joins ||= [@options[:joins]].flatten.compact\n end", "def add_joins(*joins)\n joins.each do |join|\n case join.class.to_s\n when \"String\"\n add_join_clause(join)\n when \"Symbol\",\"Hash\"\n add_include(join)\n else\n raise ArgumentError.new(\"#{join.class} is not a String or Symbol\")\n end\n end\n end", "def get_has_many_relation_query_sql(relation, query)\n fields = build_select_fields(relation[:table_fields].split(','),'a')\n\n qry = \"SELECT #{fields},`b`.`#{relation[:this_key]}` AS `_table_key` FROM `#{relation[:table]}` AS `a`, `#{@table_name}` AS `b` WHERE (`a`.`#{relation[:table_key]}` = `b`.`#{relation[:this_key]}`)\"\n where = build_where_ns(query,'b')\n qry += \" AND #{where}\" unless where.length == 0\n qry\n end", "def merge_joins_with_searchlogic(*args)\n joins = merge_joins_without_searchlogic(*args)\n joins.collect { |j| j.is_a?(String) ? j.split(\" \") : j }.flatten.uniq\n end", "def custom_sql\n # \"SELECT employees.first_name, stores.name FROM employees, stores WHERE employees.store_id = stores.id;\"\n\n \"SELECT employees,first_name, stores.name FROM employees JOIN stores ON stores.id = employees.store_id;\"\nend", "def build_query_parts\n # Always include the following columns:\n select_clause = ['DISTINCT(Person.' + _(:id, :person) + ') as person_id'] # person id\n select_clause += ['Person.' + _(:first_name, :person) + ' as First_Name'] # first name\n select_clause += ['Person.' + _(:last_name, :person) + ' as Last_Name'] # last name\n \n # Always include the person table\n tables = ['Person']\n tables_clause = Person.table_name + ' as Person'\n # Always include the campus involvements table\n tables << 'CampusInvolvement'\n tables_clause += \" LEFT JOIN #{CampusInvolvement.table_name} as CampusInvolvement on Person.#{_(:id, :person)} = CampusInvolvement.#{_(:person_id, :campus_involvement)} AND CampusInvolvement.end_date IS NULL\"\n # Always include the ministry involvements table\n tables << 'MinistryInvolvement'\n tables_clause += \" LEFT JOIN #{MinistryInvolvement.table_name} as MinistryInvolvement on Person.#{_(:id, :person)} = MinistryInvolvement.#{_(:person_id, :ministry_involvement)} AND MinistryInvolvement.end_date IS NULL\"\n # Always include the current address\n tables << 'CurrentAddress'\n tables_clause += \" LEFT JOIN #{CurrentAddress.table_name} as CurrentAddress on Person.#{_(:id, :person)} = CurrentAddress.#{_(:person_id, :address)} AND #{_(:address_type, :address)} = 'current'\"\n # Hooks to support different schemas\n tables += build_query_parts_custom_tables if self.respond_to?(:build_query_parts_custom_tables)\n tables_clause += build_query_parts_custom_tables_clause if self.respond_to?(:build_query_parts_custom_tables_clause)\n\n columns.each do |column|\n raise inspect if column.nil? # If something goes wrong, we want good information\n # Add table to table clause\n table_name = column.from_clause.constantize.table_name if column.from_clause.present?\n unless !column.from_clause.present? || tables.include?(column.from_clause)\n tables << column.from_clause\n source_model = (column.source_model.to_s.empty? ? 'Person' : column.source_model).constantize\n source_column = column.source_column.to_s.empty? ? 'id' : column.source_column\n foreign_key = column.foreign_key.to_s.empty? ? 'person_id' : column.foreign_key\n source_table_name = source_model.table_name\n join_on_left = \"#{source_model}.#{_(source_column.to_sym, source_model.name.downcase.to_sym)}\"\n join_on_right = \"#{column.from_clause}.#{_(foreign_key.to_sym, column.from_clause.underscore.to_sym)}\"\n tables_clause += \" LEFT JOIN #{table_name} as #{column.from_clause} on #{join_on_left} = #{join_on_right}\"\n tables_clause += \" AND \" + column.join_clause unless column.join_clause.blank?\n end\n \n # Don't add id, first name or last name here because we added them earlier\n unless ['id','first_name','last_name'].include?(column.select_clause)\n # Add column to select clause\n unless column.select_clause.first == '('\n select_clause << \"#{column.from_clause}.#{_(column.select_clause, column.from_clause.underscore)} as #{column.safe_name}\"\n else\n select_clause << \"#{column.select_clause} as #{column.safe_name}\"\n end\n end\n end\n self.select_clause = select_clause.join(', ')\n self.tables_clause = tables_clause\n return tables\n end", "def join_using_clause_using_sql_append(sql, using_columns)\n if using_columns.is_a?(SQL::AliasedExpression)\n super(sql, using_columns.expression)\n sql << ' AS '\n identifier_append(sql, using_columns.alias)\n else\n super\n end\n end", "def get_has_many_through_relation_query_sql(relation,query)\n fields = build_select_fields(relation[:table_fields].split(','),'a')\n\n qry = \"SELECT #{fields},`c`.`#{relation[:this_key]}` AS `_table_key` FROM `#{relation[:table]}` AS `a`, `#{relation[:link_table]}` AS `b`, `#{@table_name}` AS `c` WHERE (`a`.`#{relation[:table_key]}` = `b`.`#{relation[:link_field]}` AND `b`.`#{relation[:link_key]}` = `c`.`#{relation[:this_key]}`)\"\n where = build_where_ns(query,'c')\n qry += \" AND #{where}\" unless where.length == 0\n qry\n end", "def sql_clauses(hash, join: :and, connector: join)\n result = hash.map { |k, v| sql_clause(k, v) }.compact_blank!\n connector &&= connector.to_s.strip.upcase\n connector ? result.join(\" #{connector} \") : result\n end", "def add_join(join)\n @clause[:final_join] = join.implicit_joins\n end", "def sql_match(*terms, join: :and, connector: join, **opt)\n json = (opt[:type] == :json)\n connector &&= connector.to_s.strip.upcase\n opt[:columns] &&= Array.wrap(opt[:columns]).compact.map(&:to_sym).presence\n opt[:columns] ||= field_names\n merge_match_terms(*terms, **opt).flat_map { |field, matches|\n matches.map do |value|\n json ? sql_match_json(field, value) : sql_match_pattern(field, value)\n end\n }.then { |result|\n connector ? result.join(\" #{connector} \") : result\n }\n end", "def joins\n []\n end", "def query\n ([query_for_one_keyword] * split_query_string.size).join(' AND ')\n end", "def build_query(base)\n # Expose columns and get the list of the ones for select\n columns = expose_columns(base, @query.try(:arel_table))\n sub_columns = columns.dup\n type = @union_all.present? ? 'all' : ''\n\n # Build any extra columns that are dynamic and from the recursion\n extra_columns(base, columns, sub_columns)\n\n # Prepare the query depending on its type\n if @query.is_a?(String) && @sub_query.is_a?(String)\n args = @args.each_with_object({}) { |h, (k, v)| h[k] = base.connection.quote(v) }\n ::Arel.sql(\"(#{@query} UNION #{type.upcase} #{@sub_query})\" % args)\n elsif relation_query?(@query)\n @query = @query.where(@where) if @where.present?\n @bound_attributes.concat(@query.send(:bound_attributes))\n\n if relation_query?(@sub_query)\n @bound_attributes.concat(@sub_query.send(:bound_attributes))\n\n sub_query = @sub_query.select(*sub_columns).arel\n sub_query.from([@sub_query.arel_table, table])\n else\n sub_query = ::Arel.sql(@sub_query)\n end\n\n @query.select(*columns).arel.union(type, sub_query)\n else\n raise ArgumentError, <<-MSG.squish\n Only String and ActiveRecord::Base objects are accepted as query and sub query\n objects, #{@query.class.name} given for #{self.class.name}.\n MSG\n end\n end", "def sqlhelper(list_args, args_def)\n args = args_def\n db = args[:db] || @args[:db]\n table_def = \"`#{db.escape_table(args[:table])}`.\" || \"\"\n\n sql_joins = \"\"\n sql_where = \"\"\n sql_order = \"\"\n sql_limit = \"\"\n sql_groupby = \"\"\n\n do_joins = {}\n\n limit_from = nil\n limit_to = nil\n\n if list_args.key?(\"orderby\")\n orders = []\n orderstr = list_args[\"orderby\"]\n list_args[\"orderby\"] = [list_args[\"orderby\"]] if list_args[\"orderby\"].is_a?(Hash)\n\n if list_args[\"orderby\"].is_a?(String)\n found = false\n found = true if args[:cols].key?(orderstr)\n\n if found\n sql_order << \" ORDER BY \"\n ordermode = \" ASC\"\n if list_args.key?(\"ordermode\")\n if list_args[\"ordermode\"] == \"desc\"\n ordermode = \" DESC\"\n elsif list_args[\"ordermode\"] == \"asc\"\n ordermode = \" ASC\"\n raise \"Unknown ordermode: #{list_args[\"ordermode\"]}\"\n end\n\n list_args.delete(\"ordermode\")\n end\n\n sql_order << \"#{table_def}`#{db.escape_column(list_args[\"orderby\"])}`#{ordermode}\"\n list_args.delete(\"orderby\")\n end\n elsif list_args[\"orderby\"].is_a?(Array)\n sql_order << \" ORDER BY \"\n\n list_args[\"orderby\"].each do |val|\n ordermode = nil\n orderstr = nil\n found = false\n\n if val.is_a?(Array)\n if val[1] == \"asc\"\n ordermode = \" ASC\"\n elsif val[1] == \"desc\"\n ordermode = \" DESC\"\n end\n\n if val[0].is_a?(Array)\n if args[:joined_tables]\n args[:joined_tables].each do |table_name, table_data|\n next if table_name.to_s != val[0][0].to_s\n do_joins[table_name] = true\n orders << \"`#{db.escape_table(table_name)}`.`#{db.escape_column(val[0][1])}`#{ordermode}\"\n found = true\n break\n end\n end\n\n raise \"Could not find joined table for ordering: '#{val[0][0]}'.\" if !found\n else\n orderstr = val[0]\n end\n elsif val.is_a?(String)\n orderstr = val\n ordermode = \" ASC\"\n elsif val.is_a?(Hash) and val[:type] == :sql\n orders << val[:sql]\n found = true\n elsif val.is_a?(Hash) and val[:type] == :case\n caseorder = \" CASE\"\n\n val[:case].each do |key, caseval|\n col = key.first\n isval = key.last\n col_str = nil\n\n if col.is_a?(Array)\n raise \"No joined tables for '#{args[:table]}'.\" if !args[:joined_tables]\n\n found = false\n args[:joined_tables].each do |table_name, table_data|\n if table_name == col.first\n do_joins[table_name] = true\n col_str = \"`#{db.escape_table(table_name)}`.`#{db.escape_column(col.last)}`\"\n found = true\n break\n end\n end\n\n raise \"No such joined table on '#{args[:table]}': '#{col.first}' (#{col.first.class.name}) with the following joined table:\\n#{Php4r.print_r(args[:joined_tables], true)}\" if !found\n elsif col.is_a?(String) or col.is_a?(Symbol)\n col_str = \"#{table_def}`#{col}`\"\n found = true\n else\n raise \"Unknown type for case-ordering: '#{col.class.name}'.\"\n end\n\n raise \"'colstr' was not set.\" if !col_str\n caseorder << \" WHEN #{col_str} = '#{db.esc(isval)}' THEN '#{db.esc(caseval)}'\"\n end\n\n if val[:else]\n caseorder << \" ELSE '#{db.esc(val[:else])}'\"\n end\n\n caseorder << \" END\"\n orders << caseorder\n elsif val.is_a?(Hash)\n raise \"No joined tables.\" if !args.key?(:joined_tables)\n\n if val[:mode] == \"asc\"\n ordermode = \" ASC\"\n elsif val[:mode] == \"desc\"\n ordermode = \" DESC\"\n end\n\n if args[:joined_tables]\n args[:joined_tables].each do |table_name, table_data|\n if table_data[:parent_table]\n table_name_real = table_name\n elsif table_data[:datarow]\n table_name_real = self.datarow_from_datarow_argument(table_data[:datarow]).classname\n else\n table_name_real = @args[:module].const_get(table_name).classname\n end\n\n if table_name.to_s == val[:table].to_s\n do_joins[table_name] = true\n\n if val[:sql]\n orders << val[:sql]\n elsif val[:col]\n orders << \"`#{db.escape_table(table_name_real)}`.`#{db.escape_column(val[:col])}`#{ordermode}\"\n else\n raise \"Couldnt figure out how to order based on keys: '#{val.keys.sort}'.\"\n end\n\n found = true\n break\n end\n end\n end\n else\n raise \"Unknown object: #{val.class.name}\"\n end\n\n found = true if args[:cols].key?(orderstr)\n\n if !found\n raise \"Column not found for ordering: #{orderstr}.\"\n end\n\n orders << \"#{table_def}`#{db.escape_column(orderstr)}`#{ordermode}\" if orderstr\n end\n\n sql_order << orders.join(\", \")\n list_args.delete(\"orderby\")\n else\n raise \"Unknown orderby object: #{list_args[\"orderby\"].class.name}.\"\n end\n end\n\n list_args.each do |realkey, val|\n found = false\n\n if realkey.is_a?(Array)\n if !args[:joins_skip]\n datarow_obj = self.datarow_obj_from_args(args_def, list_args, realkey[0])\n args = datarow_obj.columns_sqlhelper_args\n raise \"Couldnt get arguments from SQLHelper.\" if !args\n else\n datarow_obj = @args[:module].const_get(realkey[0])\n args = args_def\n end\n\n table_sym = realkey[0].to_sym\n do_joins[table_sym] = true\n list_table_name_real = table_sym\n table = \"`#{db.escape_table(list_table_name_real)}`.\"\n key = realkey[1]\n else\n table = table_def\n args = args_def\n key = realkey\n end\n\n if args.key?(:cols_bools) and args[:cols_bools].index(key) != nil\n val_s = val.to_s\n\n if val_s == \"1\" or val_s == \"true\"\n realval = \"1\"\n elsif val_s == \"0\" or val_s == \"false\"\n realval = \"0\"\n else\n raise \"Could not make real value out of class: #{val.class.name} => #{val}.\"\n end\n\n sql_where << \" AND #{table}`#{db.escape_column(key)}` = '#{db.esc(realval)}'\"\n found = true\n elsif args[:cols].key?(key)\n if val.is_a?(Array)\n if val.empty? and db.opts[:type].to_s == \"mysql\"\n sql_where << \" AND false\"\n else\n escape_sql = Knj::ArrayExt.join(\n :arr => val,\n :callback => proc{|value|\n db.escape(value)\n },\n :sep => \",\",\n :surr => \"'\"\n )\n sql_where << \" AND #{table}`#{db.escape_column(key)}` IN (#{escape_sql})\"\n end\n elsif val.is_a?(Hash) and val[:type].to_sym == :col\n raise \"No table was given for join: '#{val}', key: '#{key}' on table #{table}.\" if !val.key?(:table)\n do_joins[val[:table].to_sym] = true\n sql_where << \" AND #{table}`#{db.escape_column(key)}` = `#{db.escape_table(val[:table])}`.`#{db.escape_column(val[:name])}`\"\n elsif val.is_a?(Hash) and val[:type] == :sqlval and val[:val] == :null\n sql_where << \" AND #{table}`#{db.escape_column(key)}` IS NULL\"\n elsif val.is_a?(Proc)\n call_args = Knj::Hash_methods.new(:ob => self, :db => db)\n sql_where << \" AND #{table}`#{db.escape_column(key)}` = '#{db.esc(val.call(call_args))}'\"\n else\n sql_where << \" AND #{table}`#{db.escape_column(key)}` = '#{db.esc(val)}'\"\n end\n\n found = true\n elsif key.to_s == \"limit_from\"\n limit_from = val.to_i\n found = true\n elsif key.to_s == \"limit_to\"\n limit_to = val.to_i\n found = true\n elsif key.to_s == \"limit\"\n limit_from = 0\n limit_to = val.to_i\n found = true\n elsif args.key?(:cols_dbrows) and args[:cols_dbrows].index(\"#{key.to_s}_id\") != nil\n if val == false\n sql_where << \" AND #{table}`#{db.escape_column(key.to_s + \"_id\")}` = '0'\"\n elsif val.is_a?(Array)\n if val.empty?\n sql_where << \" AND false\"\n else\n sql_where << \" AND #{table}`#{db.escape_column(\"#{key}_id\")}` IN (#{Knj::ArrayExt.join(:arr => val, :sep => \",\", :surr => \"'\", :callback => proc{|obj| obj.id.sql})})\"\n end\n else\n sql_where << \" AND #{table}`#{db.escape_column(key.to_s + \"_id\")}` = '#{db.esc(val.id)}'\"\n end\n\n found = true\n elsif match = key.match(/^([A-z_\\d]+)_(search|has)$/) and args[:cols].key?(match[1]) != nil\n if match[2] == \"search\"\n Knj::Strings.searchstring(val).each do |str|\n sql_where << \" AND #{table}`#{db.escape_column(match[1])}` LIKE '%#{db.esc(str)}%'\"\n end\n elsif match[2] == \"has\"\n if val\n sql_where << \" AND #{table}`#{db.escape_column(match[1])}` != ''\"\n else\n sql_where << \" AND #{table}`#{db.escape_column(match[1])}` = ''\"\n end\n end\n\n found = true\n elsif match = key.match(/^([A-z_\\d]+)_(not|lower)$/) and args[:cols].key?(match[1])\n if match[2] == \"not\"\n if val.is_a?(Array)\n if val.empty?\n #ignore.\n else\n escape_sql = Knj::ArrayExt.join(\n :arr => val,\n :callback => proc{|value|\n db.escape(value)\n },\n :sep => \",\",\n :surr => \"'\"\n )\n sql_where << \" AND #{table}`#{db.escape_column(match[1])}` NOT IN (#{escape_sql})\"\n end\n else\n sql_where << \" AND #{table}`#{db.escape_column(match[1])}` != '#{db.esc(val)}'\"\n end\n elsif match[2] == \"lower\"\n sql_where << \" AND LOWER(#{table}`#{db.escape_column(match[1])}`) = LOWER('#{db.esc(val)}')\"\n else\n raise \"Unknown mode: '#{match[2]}'.\"\n end\n\n found = true\n elsif args.key?(:cols_date) and match = key.match(/^(.+)_(day|week|month|year|from|to|below|above)(|_(not))$/) and args[:cols_date].index(match[1]) != nil\n not_v = match[4]\n val = Datet.in(val) if val.is_a?(Time)\n\n if match[2] == \"day\"\n if val.is_a?(Array)\n sql_where << \" AND (\"\n first = true\n\n val.each do |realval|\n if first\n first = false\n else\n sql_where << \" OR \"\n end\n\n sql_where << \"#{db.sqlspecs.strftime(\"%d %m %Y\", \"#{table}`#{db.escape_column(match[1])}`\")} #{self.not(not_v, \"!\")}= #{db.sqlspecs.strftime(\"%d %m %Y\", \"'#{db.esc(realval.dbstr)}'\")}\"\n end\n\n sql_where << \")\"\n else\n sql_where << \" AND #{db.sqlspecs.strftime(\"%d %m %Y\", \"#{table}`#{db.escape_column(match[1])}`\")} #{self.not(not_v, \"!\")}= #{db.sqlspecs.strftime(\"%d %m %Y\", \"'#{db.esc(val.dbstr)}'\")}\"\n end\n elsif match[2] == \"week\"\n sql_where << \" AND #{db.sqlspecs.strftime(\"%W %Y\", \"#{table}`#{db.escape_column(match[1])}`\")} #{self.not(not_v, \"!\")}= #{db.sqlspecs.strftime(\"%W %Y\", \"'#{db.esc(val.dbstr)}'\")}\"\n elsif match[2] == \"month\"\n sql_where << \" AND #{db.sqlspecs.strftime(\"%m %Y\", \"#{table}`#{db.escape_column(match[1])}`\")} #{self.not(not_v, \"!\")}= #{db.sqlspecs.strftime(\"%m %Y\", \"'#{db.esc(val.dbstr)}'\")}\"\n elsif match[2] == \"year\"\n sql_where << \" AND #{db.sqlspecs.strftime(\"%Y\", \"#{table}`#{db.escape_column(match[1])}`\")} #{self.not(not_v, \"!\")}= #{db.sqlspecs.strftime(\"%Y\", \"'#{db.esc(val.dbstr)}'\")}\"\n elsif match[2] == \"from\" or match[2] == \"above\"\n sql_where << \" AND #{table}`#{db.escape_column(match[1])}` >= '#{db.esc(val.dbstr)}'\"\n elsif match[2] == \"to\" or match[2] == \"below\"\n sql_where << \" AND #{table}`#{db.escape_column(match[1])}` <= '#{db.esc(val.dbstr)}'\"\n else\n raise \"Unknown date-key: #{match[2]}.\"\n end\n\n found = true\n elsif args.key?(:cols_num) and match = key.match(/^(.+)_(from|to|above|below|numeric)$/) and args[:cols_num].index(match[1]) != nil\n if match[2] == \"from\"\n sql_where << \" AND #{table}`#{db.escape_column(match[1])}` >= '#{db.esc(val)}'\"\n elsif match[2] == \"to\"\n sql_where << \" AND #{table}`#{db.escape_column(match[1])}` <= '#{db.esc(val)}'\"\n elsif match[2] == \"above\"\n sql_where << \" AND #{table}`#{db.escape_column(match[1])}` > '#{db.esc(val)}'\"\n elsif match[2] == \"below\"\n sql_where << \" AND #{table}`#{db.escape_column(match[1])}` < '#{db.esc(val)}'\"\n else\n raise \"Unknown method of treating cols-num-argument: #{match[2]}.\"\n end\n\n found = true\n elsif match = key.match(/^(.+)_lookup$/) and args[:cols].key?(\"#{match[1]}_id\") and args[:cols].key?(\"#{match[1]}_class\")\n sql_where << \" AND #{table}`#{db.escape_column(\"#{match[1]}_class\")}` = '#{db.esc(val.table)}'\"\n sql_where << \" AND #{table}`#{db.escape_column(\"#{match[1]}_id\")}` = '#{db.esc(val.id)}'\"\n found = true\n elsif realkey == \"groupby\"\n found = true\n\n if val.is_a?(Array)\n val.each do |col_name|\n raise \"Column '#{val}' not found on table '#{table}'.\" if !args[:cols].key?(col_name)\n sql_groupby << \", \" if sql_groupby.length > 0\n sql_groupby << \"#{table}`#{db.escape_column(col_name)}`\"\n end\n elsif val.is_a?(String)\n sql_groupby << \", \" if sql_groupby.length > 0\n sql_groupby << \"#{table}`#{db.escape_column(val)}`\"\n else\n raise \"Unknown class given for 'groupby': '#{val.class.name}'.\"\n end\n end\n\n list_args.delete(realkey) if found\n end\n\n args = args_def\n\n if !args[:joins_skip]\n raise \"No joins defined on '#{args[:table]}' for: '#{args[:table]}'.\" if !do_joins.empty? and !args[:joined_tables]\n\n do_joins.each do |table_name, temp_val|\n raise \"No join defined on table '#{args[:table]}' for table '#{table_name}'.\" if !args[:joined_tables].key?(table_name)\n table_data = args[:joined_tables][table_name]\n\n if table_data.key?(:parent_table)\n join_table_name_real = table_name\n sql_joins << \" LEFT JOIN `#{table_data[:parent_table]}` AS `#{table_name}` ON 1=1\"\n else\n const = @args[:module].const_get(table_name)\n join_table_name_real = const.classname\n sql_joins << \" LEFT JOIN `#{const.table}` AS `#{const.classname}` ON 1=1\"\n end\n\n ob = table_data[:ob] || self\n class_name = args[:table].to_sym\n\n if table_data[:datarow]\n datarow = self.datarow_from_datarow_argument(table_data[:datarow])\n else\n self.requireclass(class_name) if @objects.key?(class_name)\n datarow = @args[:module].const_get(class_name)\n end\n\n if !datarow.columns_sqlhelper_args\n ob.requireclass(datarow.table.to_sym)\n raise \"No SQL-helper-args on class '#{datarow.table}' ???\" if !datarow.columns_sqlhelper_args\n end\n\n newargs = datarow.columns_sqlhelper_args.clone\n newargs[:table] = join_table_name_real\n newargs[:joins_skip] = true\n\n #Clone the where-arguments and run them against another sqlhelper to sub-join.\n join_args = table_data[:where].clone\n ret = self.sqlhelper(join_args, newargs)\n sql_joins << ret[:sql_where]\n\n #If any of the join-arguments are left, then we should throw an error.\n join_args.each do |key, val|\n raise \"Invalid key '#{key}' when trying to join table '#{table_name}' on table '#{args_def[:table]}'.\"\n end\n end\n end\n\n #If limit arguments has been given then add them.\n if limit_from and limit_to\n sql_limit = \" LIMIT #{limit_from}, #{limit_to}\"\n end\n\n sql_groupby = nil if sql_groupby.length <= 0\n\n return {\n :sql_joins => sql_joins,\n :sql_where => sql_where,\n :sql_limit => sql_limit,\n :sql_order => sql_order,\n :sql_groupby => sql_groupby\n }\n end", "def _arel\n if _on\n [_join.new(_table, _on)]\n else\n @associations.each.with_index.inject([]) do |joins, (assoc, i)|\n construct @associations[0..i], joins, assoc._join\n end\n end\n end", "def build_arel(*)\n arel = super\n subqueries = build_auxiliary_statements(arel)\n subqueries.nil? ? arel : arel.with(subqueries)\n end", "def clean_join_table\n # these 2 lines run pretty much the same sql, self.parses adds a where in clause\n self.parsers = []\n # OR\n # ActiveRecord::Base.connection.execute(\"DELETE FROM parsers_transformations WHERE transformation_id = #{id}\")\n end", "def get_joins\n join_sources = @model.arel_table.\n join(@associated.source).\n on(@associated.filters).\n join_sources\n return @model.joins(@members + join_sources)\n end", "def multiple_query sql\n splited_sql = sql.split(';')\n splited_sql.each do |each_sql|\n query(each_sql)\n end\n end", "def print_join\r\n if get_tables.size < 2\r\n puts \"you do not have enough tables to join\"\r\n return nil\r\n end\r\n to_join = []\r\n puts \"choose 2 of these tables to join\"\r\n print_table_names\r\n until to_join.length == 2\r\n puts \"what is your first table you would like to join?\" if to_join.length == 0\r\n puts \"what is your second table you would like to join?\" if to_join.length == 1\r\n answer = gets.chomp\r\n to_join << answer if table_exists?(answer)\r\n end\r\n if references(to_join[1]).include?(to_join[0])\r\n execute = @db.execute(\"SELECT * FROM #{to_join[0]} JOIN #{to_join[1]}\r\n ON #{to_join[0]}.#{to_join[1]}_id = #{to_join[1]}.id ;\")\r\n print_execute_titles(execute)\r\n print_execute(execute)\r\n elsif references(to_join[0]).include?(to_join[1])\r\n execute = @db.execute(\"SELECT * FROM #{to_join[1]} JOIN #{to_join[0]}\r\n ON #{to_join[1]}.#{to_join[0]}_id = #{to_join[0]}.id ;\")\r\n print_execute_titles(execute)\r\n print_execute(execute)\r\n else\r\n puts \"Those two tables are incompatible and cannot be joined\"\r\n end\r\n end", "def to_sql\n @join.association_join.gsub(/::ts_join_alias::/,\n \"#{@reflection.klass.connection.quote_table_name(@join.parent.aliased_table_name)}\"\n )\n end", "def joins\n @joins\n end", "def parse_query(query); end", "def parse_query(query); end", "def join(join_clause)\n @joins.push join_clause\n self\n end", "def build_query(query, options={})\n queries = []\n QUERY_KEYWORDS.each do |kw|\n next unless options[kw]\n if options[kw].is_a? Array\n kw_query = options[kw].map {|s| \"#{kw}:#{s}\".strip }.join(\" OR \")\n queries << \" (#{kw_query})\"\n else\n queries << \" #{kw}:#{options[kw]}\"\n end\n end\n \"#{query} #{queries.join(' ')}\".strip\n end", "def join(from:, to:, field:, value:)\n [ JOIN % { from: from, to: to, field: field, value: value } ]\n end", "def inner_polymorphic_join(target, options = {})\n options[:on] ||= table_name\n options[:on_table_name] ||= connection.quote_table_name(options[:on])\n options[:target_table] ||= connection.quote_table_name(target.to_s.pluralize)\n options[:as] ||= \"owner\"\n postgres = ::ActiveRecord::Base.connection.adapter_name == \"PostgreSQL\"\n \"INNER JOIN #{options[:target_table]} ON #{options[:target_table]}.id = #{options[:on_table_name]}.#{options[:as]}_id AND \" +\n \"#{options[:on_table_name]}.#{options[:as]}_type = #{postgres ? \"E\" : \"\"}'#{target.to_s.camelize}'\"\n end", "def join( c, how = 'AND' )\n\t\t@conditions = self.class.join( conditions, c, how )\n\t\tself\n\tend", "def test_parse_join\n msg = Message.parse(@join_message)\n assert_equal @join_message, msg.raw_message\n assert_equal CMD_JOIN, msg.message_type\n assert_equal ['#chan'], msg.params\n end", "def join(other, *exps, join_type: :inner)\n unless other.is_a?(Table)\n raise UserError, 'need other table as first argument to join'\n end\n unless JOIN_TYPES.include?(join_type)\n raise UserError, \"join_type may only be: #{JOIN_TYPES.join(', ')}\"\n end\n\n # These may be needed for outer joins.\n self_row_nils = headers.map { |h| [h, nil] }.to_h\n other_row_nils = other.headers.map { |h| [h, nil] }.to_h\n join_exp, other_common_heads =\n build_join_expression(exps, other, join_type)\n ev = Evaluator.new\n result = empty_dup\n other_rows = other.rows\n other_row_matches = Array.new(other_rows.size, false)\n rows.each do |self_row|\n self_row_matched = false\n other_rows.each_with_index do |other_row, k|\n # Same as other_row, but with keys that are common with self and equal\n # in value, removed, so the output table need not repeat them.\n locals = build_locals_hash(row_a: self_row, row_b: other_row)\n matches = ev.evaluate(join_exp, locals: locals)\n next unless matches\n\n self_row_matched = other_row_matches[k] = true\n out_row = build_out_row(row_a: self_row, row_b: other_row,\n common_heads: other_common_heads,\n type: join_type)\n result << out_row\n end\n next unless [:left, :full].include?(join_type)\n next if self_row_matched\n\n result << build_out_row(row_a: self_row,\n row_b: other_row_nils,\n type: join_type)\n end\n if [:right, :full].include?(join_type)\n other_rows.each_with_index do |other_row, k|\n next if other_row_matches[k]\n\n result << build_out_row(row_a: self_row_nils,\n row_b: other_row,\n type: join_type)\n end\n end\n result.normalize_boundaries\n result\n end", "def get_relation(params = {})\n @arel = @model_class.arel_table\n\n relation = @model_class.scoped\n\n relation = apply_column_filters(relation, params[:filter]) if params[:filter]\n\n query = params[:query] && ActiveSupport::JSON.decode(params[:query])\n\n if query.present?\n # array of arrays of conditions that should be joined by OR\n and_predicates = query.map do |conditions|\n predicates_for_and_conditions(conditions)\n end\n\n # join them by OR\n predicates = and_predicates[1..-1].inject(and_predicates.first){ |r,c| r.or(c) }\n end\n\n relation = relation.where(predicates)\n\n relation = relation.extend_with(params[:scope]) if params[:scope]\n\n relation\n end", "def apply_joins(query, joins)\n joins.each do |join|\n query = apply_join(query, join)\n end\n query\n end", "def parse_expr_tree(expr_tree, opts = {})\n instruction = {\n selects: {},\n joins: [],\n where: \"\"\n }\n\n # If expr_tree is blank\n if expr_tree.blank?\n instruction[:where] = TRUE_WHERE_QUERY\n return instruction\n end\n\n # If expr_tree is not blank\n tree_operator = nil\n where_stack = []\n\n expr_tree.each_with_index do |expr, idx|\n if (idx == 0) && (%w(AND OR).include? expr)\n tree_operator = expr\n else\n if expr.is_a? Array\n result = parse_expr_tree(expr, opts)\n instruction[:joins] |= result[:joins].flatten\n instruction[:selects].merge! result[:selects]\n where = \"(#{result[:where]})\"\n else\n\n # =====================================================================================\n # TODO: @giosakti simplify this algorithm\n # =====================================================================================\n\n expr_stack = expr.scan(/(?:\"(?:\\\\.|[^\"])*\"|[^\" ])+/)\n if (expr_stack.size != 3) && (!%w(= IN).include? expr_stack[1])\n raise \"Syntax error #{expr}\"\n else\n operator = expr_stack[1]\n\n #\n # Evaluate lhs\n #\n lhs_expr = expr_stack.first\n if lhs_expr.start_with?(\"object\")\n result = parse_lhs(lhs_expr, opts[:object], operator)\n lhs_join = result[:join]\n lhs_select = result[:select]\n lhs_where = result[:where]\n else\n raise \"Syntax error: #{lhs_expr} at left-hand side\"\n end\n\n #\n # Evaluate rhs\n #\n rhs_expr = expr_stack.last\n if rhs_expr.start_with?(\"subject\")\n rhs_where = parse_rhs(rhs_expr, opts[:subject], operator)\n else\n rhs_where = rhs_expr\n end\n\n #\n # Formulaize instructions\n #\n instruction[:joins] |= [lhs_join] if lhs_join.present?\n instruction[:selects].merge! lhs_select if lhs_select.present?\n if rhs_where.present?\n where = \"#{lhs_where} #{operator} #{rhs_where}\"\n else\n where = FALSE_WHERE_QUERY\n end\n end\n\n # =====================================================================================\n # END TODO: @giosakti simplify this algorithm\n # =====================================================================================\n\n end\n\n where_stack.push where\n end\n end\n\n if tree_operator\n instruction[:where] = where_stack.join(\" #{tree_operator} \")\n else\n instruction[:where] = where_stack.shift\n end\n\n return instruction\n end", "def from_query()\n if @from_query.nil?\n if has_where_predicate?()\n @from_query = /\\sfrom\\s([\\w\\s\\.\\=\\>\\<\\_\\-]+)\\swhere\\s/i.match(query)[1]\n else\n @from_query = query[query.downcase.index(' from ')+6..query.length].gsub(';','').strip()\n # @from_query = /\\sfrom\\s([\\w\\s\\.\\=\\>\\<\\_\\-]+)\\s(where\\s)?/i.match(query)[1]\n end\n end\n return @from_query\n end", "def joins\n joins_hash = {}\n @rules.each do |rule|\n associations_hash = rule.custom_where_conditions ? rule.conditions : rule.associations_hash\n merge_joins(joins_hash, associations_hash)\n end\n if joins_hash.empty?\n [joins_hash, []]\n else\n clean_joins(joins_hash)\n end\n end", "def build_where_ns(query,ns)\n where = \"\"\n query.each_pair do |k, v| \n if (k!='include' and k!='exclude')\n where += \"(`#{ns}`.`#{escape_str_field(k)}` #{build_equal_condition(v)}) AND \"\n end\n end\n where.chomp(' AND ')\n end", "def create_queries(keyword)\n sql = \"\"\n self.column_names .each do |col|\n\n sql += col + \" LIKE \" + \"\\'\" + keyword + \"\\'\"\n sql += \" OR \"\n end\n sql[0..-5] #removes the last AND. A temporary dirty fix.\n end", "def build_query(table_name, where_expression)\n query = %Q{SELECT *\\n FROM \"#{table_name}\"}\n unless where_expression.nil?\n query << \"\\n WHERE #{where_expression}\"\n end\n unless (pk = find_primary_key(table_name)).empty?\n query << \"\\n ORDER BY \" << pk.join(', ')\n end\n return query\nend", "def parse_select(cmd)\n # First let's break the statement into its various sub-lists. Start\n # with FROM\n from_list = cmd.index('FROM')\n raise \"Statement missing FROM clause.\" unless from_list\n select_list = cmd[1...from_list].reject { |x| x == ',' }\n select_list = select_list.collect { |x| x.downcase }\n \n # Now do INTO (skipping WHERE for now)\n into_list = cmd.index('INTO')\n raise \"Statement missing INTO clause.\" unless into_list\n from_list = cmd[from_list+1...into_list]\n into_list = cmd[into_list+1..-1]\n unless into_list.length.between?(1,2)\n raise \"Bad number of terms in INTO clause\"\n end\n\n # Now do WHERE (which is conditional and will be part of FROM)\n where_list = nil\n if from_list.include? 'WHERE'\n where_pos = from_list.index 'WHERE'\n where_list = from_list[where_pos+1..-1]\n unless where_list.length == 1\n raise \"Bad number of terms in WHERE clause (#{where_list.length})\"\n end\n from_list = from_list[0...where_pos]\n where_list = where_list.first\n end\n if from_list.length != 1\n raise \"Bad number of terms in FROM clause (#{from_list.length})\"\n end\n from_list = from_list.first.downcase\n\n # Return the hash with the attributes we've just parsed out\n { :select => select_list, :from => from_list, :where => where_list,\n :into => into_list }\n end", "def build_query(params)\n query = UserInteraction.includes(:user, :interaction, :answer)\n fields = get_fields()\n params.each do |filter|\n field_id = filter['field'].to_sym\n operator = filter['operand']\n operand = filter['value']\n if operator == FILTER_OPERATOR_CONTAINS\n query = query.where( get_active_record_expression(fields[field_id]['column_name'], operator, fields[field_id]['model']), \"%\"+operand.to_s+\"%\" )\n else\n query = query.where( get_active_record_expression(fields[field_id]['column_name'], operator, fields[field_id]['model']), operand )\n end\n end\n return query \n end", "def calc_from_clause(our_join = join, our_tables = tables)\n implicits = [model.table_name] + our_tables\n result = implicits.uniq.map { |x| \"`#{x}`\" }.join(\", \")\n if our_join\n result += \" \"\n result += calc_join_conditions(model.table_name, our_join).join(\" \")\n end\n result\n end", "def inner_join(sym, **props)\n join(sym, **props.merge(type: :inner))\n end", "def needs_join_table(table_name1, type, table_name2, clause, join_name = nil)\n join_name ||= \"#{table_name1}=#{type}=#{table_name2}\"\n @needed_join_tables[join_name] ||= {}\n @needed_join_tables[join_name][table] ||= begin\n # define join for this part ('table' = unique for each part)\n\n # don't add to list of tables, just get unique alias name\n second_table = get_alias(table_name2)\n\n # create join\n first_table = table(table_name1)\n\n @join_tables[first_table] ||= []\n @join_tables[first_table] << \"#{type} JOIN #{second_table} ON #{clause.gsub('TABLE1',first_table).gsub('TABLE2',second_table)}\"\n second_table\n end\n end", "def get_has_one_relation_query_sql(relation, query)\n fields = build_select_fields(relation[:table_fields].split(','),'a')\n\n qry = \"SELECT #{fields},`b`.`#{relation[:this_key]}` AS `_table_key` FROM `#{relation[:table]}` AS `a`, `#{@table_name}` AS `b` WHERE (`a`.`#{relation[:table_key]}` = `b`.`#{relation[:this_key]}`)\"\n where = build_where_ns(query,'b')\n qry += \" AND #{where}\" unless where.length == 0\n qry\n end", "def get_relation(params = {})\n @arel = data_class.arel_table\n\n relation = data_class.scoped\n\n relation = apply_column_filters(relation, params[:filter]) if params[:filter]\n\n if params[:extra_conditions]\n extra_conditions = normalize_extra_conditions(ActiveSupport::JSON.decode(params[:extra_conditions]))\n relation = relation.extend_with_netzke_conditions(extra_conditions) if params[:extra_conditions]\n end\n\n query = params[:query] && ActiveSupport::JSON.decode(params[:query])\n\n if query.present?\n # array of arrays of conditions that should be joined by OR\n and_predicates = query.map do |conditions|\n predicates_for_and_conditions(conditions)\n end\n\n # join them by OR\n predicates = and_predicates[1..-1].inject(and_predicates.first){ |r,c| r.or(c) }\n end\n\n relation = relation.where(predicates)\n\n relation = relation.extend_with(config[:scope]) if config[:scope]\n\n relation\n end", "def joins_on\n # join(relations).on(conditions)\n condition = deals.join(clients)\n .on(deals[:advertiser_id].eq(clients[:id]))\n workflow_criterions.each do |wc|\n case wc.field\n when 'currencies'\n condition = condition\n .join(currencies)\n .on(deals[:curr_cd].eq(currencies[:curr_cd]))\n when 'deal_type'\n condition = condition\n .join(values)\n .on(deals[:id].eq(values[:subject_id]))\n .join(options)\n .on(values[:option_id].eq(options[:id]))\n when 'deal_initiative'\n condition = condition\n .join(initiatives)\n .on(deals[:initiative_id].eq(initiatives[:id]))\n when 'teams'\n condition = condition\n .join(deal_members)\n .on(deal_members[:deal_id].eq(deals[:id]))\n .join(users)\n .on(users[:id].eq(deal_members[:user_id]))\n .join(teams)\n .on(teams[:id].eq(users[:team_id]).or(teams[:leader_id].eq(users[:id])))\n when 'client_segments'\n condition = condition\n .join(client_segments)\n .on(clients[:client_segment_id].eq(client_segments[:id]))\n when 'client_regions'\n condition = condition\n .join(client_regions)\n .on(clients[:client_region_id].eq(client_regions[:id]))\n when 'client_categories'\n condition = condition\n .join(client_categories)\n .on(clients[:client_category_id].eq(client_categories[:id]))\n when 'client_subcategories'\n condition = condition\n .join(client_subcategories)\n .on(clients[:client_subcategory_id].eq(client_subcategories[:id]))\n when 'share'\n condition = condition\n .join(deal_members)\n .on(deal_members[:deal_id].eq(deals[:id]))\n end\n case wc.base_object\n when 'Account Custom Fields'\n unless condition.to_sql.include?(\"INNER JOIN \\\"account_cfs\\\"\")\n condition = condition\n .join(account_cfs)\n .on(clients[:id].eq(account_cfs[:client_id]))\n end\n when 'Deal Custom Fields'\n unless condition.to_sql.include?(\"INNER JOIN \\\"deal_custom_fields\\\"\")\n condition = condition\n .join(deal_custom_fields)\n .on(deals[:id].eq(deal_custom_fields[:deal_id]))\n end\n when 'Deal Members'\n condition = condition\n .join(deal_members)\n .on(deal_members[:deal_id].eq(deals[:id]))\n .join(values)\n .on(values[:subject_id].eq(deal_members[:id]))\n .join(fields)\n .on(values[:field_id].eq(fields[:id]))\n .join(member_roles)\n .on(fields[:id].eq(member_roles[:field_id])) if wc.field.eql?('role')\n end\n end\n condition\n end", "def joins_for_order_statement(order_options)\n joins = []\n\n if order_options\n if order_options.include?('authors')\n joins << \"LEFT OUTER JOIN #{User.table_name} authors ON authors.id = #{Meeting.table_name}.author_id\"\n end\n end\n\n joins.any? ? joins.join(' ') : nil\n end", "def join(table,options={})\n # defaults\n options[:type] ||= \"inner\"\n options[:alias] ||= table\n options[:from] ||= @from_table\n\n case options[:type]\n when \"left\"\n @roots[table] = @alias[options[:from]].join(table, Java::javax.persistence.criteria.JoinType::LEFT)\n else\n # default to inner join\n @roots[table] = @alias[options[:from]].join(table)\n end\n\n # set alias\n # @alias[options[:from]] = @roots[table]\n @alias[options[:alias]] = @roots[table]\n @alias[table] = @roots[table]\n\n self\n end", "def and_relation(relation)\n q = all\n q = q.where(relation.where_clause.ast) if relation.where_clause.present?\n q = q.joins(relation.joins_values + q.joins_values) if relation.joins_values.present?\n q = q.order(relation.order_values) if relation.order_values.present?\n q\n end", "def evaluate_joins(scope, &block)\n dependency = evaluate!(scope, &block)._arel\n join_arel = Nodes.unwrap(dependency._arel)\n [join_arel, dependency.bind_values]\n end", "def add_joins_to_relation(rel, joins)\n return rel.joins(Report::Join.list_to_sql(joins))\n end", "def and_relation(relation)\n q = all\n raise \"incompatible FROM clauses: #{q.to_sql}; #{relation.to_sql}\" if !q.from_clause.empty? && q.from_clause != relation.from_clause\n raise \"incompatible GROUP BY clauses: #{q.to_sql}; #{relation.to_sql}\" if !q.group_values.empty? && q.group_values != relation.group_values\n\n q = q.select(q.select_values + relation.select_values) if !relation.select_values.empty?\n q = q.from(relation.from_clause.value) if !relation.from_clause.empty?\n q = q.joins(relation.joins_values + q.joins_values) if relation.joins_values.present?\n q = q.where(relation.where_clause.ast) if relation.where_clause.present?\n q = q.group(relation.group_values) if relation.group_values.present?\n q = q.order(relation.order_values) if relation.order_values.present? && !relation.reordering_value\n q = q.reorder(relation.order_values) if relation.order_values.present? && relation.reordering_value\n q\n end", "def fat_record_joins\n joins = \" LEFT JOIN active_sources AS obj_sources ON semantic_relations.object_id = obj_sources.id AND semantic_relations.object_type = 'TaliaCore::ActiveSource'\"\n joins << \" LEFT JOIN semantic_properties AS obj_props ON semantic_relations.object_id = obj_props.id AND semantic_relations.object_type = 'TaliaCore::SemanticProperty'\"\n joins << \" LEFT JOIN active_sources AS subject_sources ON semantic_relations.subject_id = subject_sources.id\"\n joins\n end", "def fk_join_arr\n result = []\n groups.each_with_index do |group, idx|\n group_alias = \"#{group.parent_table}_#{idx}\"\n group_query = group_query_builder(group)\n result.push \"JOIN (\\n#{group_query}\\n\\t) AS #{group_alias}_fk\"\n result.push \"ON #{group_alias}_fk.#{FKEYS[group.parent_table]}=#{group.parent_table}.#{group.parent_table_pk}\"\n if idx > 0\n groups.each_with_index do |x_group, x_idx|\n #next if x_idx < idx\n x_group_alias = \"#{x_group.parent_table}_#{x_idx}\"\n result.push \"\\tAND #{x_group_alias}_fk.year = #{group_alias}_fk.year\"\n break\n end\n end\n end\n return result\n end", "def translation_join_str(language, options = {})\n main_tname = options[:table_alias] || self.table_name\n tname = options[:translation_table_alias] || self.translation_table_name\n \"JOIN #{tname} ON #{main_tname}.#{self.primary_key}=#{tname}.#{self.translation_foreign_key} and #{tname}.#{self.language_column}='#{language.to_s}'\"\n end", "def sql\n return @incoming_sql if parameter.blank?\n\n @incoming_sql = @incoming_sql.joins(:instances)\n .joins(instances: :reference)\n .where([text_search_version,\n text_search_param(parameter)])\n @incoming_sql = @incoming_sql.where(PROTOLOGUE_CLAUSE) if @parser.protologue?\n @incoming_sql\n end", "def create_join_excluded_tbl(preserve_null_pk = true)\n if @excluded_join_tbl.nil?\n join_list =join_list()\n cross_join_from = ''\n full_join_from = ''\n satisfied_tbl = create_satisfied_tbl()\n 0.upto(join_list.count-1) do |i|\n join = join_list.find{|j| j['id'] ==i }\n l_rel_list = join['l_rel_list']\n quals = join['quals']\n q = ReverseParseTree.whereClauseConst(quals)\n has_quals = (not join['quals'].nil?)\n join_type = ReverseParseTree.joinTypeConvert(join['jointype'].to_s, has_quals)\n\n r_rel = join['r_rel_list'][0]\n l_arg = (i==0 ? \"#{l_rel_list[0].relname} #{l_rel_list[0].relalias}\" : \"\")\n # for efficiency only change the last join to cross join\n if i == join_list.count-1\n cross_join_from = cross_join_from + \"#{l_arg} CROSS JOIN #{r_rel.relname} #{r_rel.relalias} \"\n else\n cross_join_from = cross_join_from + \"#{l_arg} #{join_type} #{r_rel.relname} #{r_rel.relalias} on #{q} \"\n end\n # full_join_from = full_join_from + \"#{l_arg} CROSS JOIN #{r_rel.relname} #{r_rel.relalias} on #{q}\"\n end\n @excluded_join_tbl = \"#{@table}_join_excluded\"\n # renamed_pk_col = @pk_full_list.map { |pk| \"#{pk['col']} as #{pk['alias']}_pk\" }.join(', ')\n \n if preserve_null_pk\n renamed_pk_col = @pk_full_list.map { |pk| \"#{pk['col']} as #{pk['alias']}_pk\" }.join(', ')\n else\n renamed_pk_col = @pk_full_list.map do |pk|\n pkcol = @all_cols.find{|col| col.colname == pk['colname'] and col.relname==pk['relname']}\n \"COALESCE(#{pkcol.select_name},#{pkcol.null_replacement}) as #{pkcol.colalias}_pk\"\n end.join(',')\n end\n targetListReplacement = \"#{renamed_pk_col},#{@all_cols_select}\"\n query = ReverseParseTree.reverseAndreplace(@parseTree, targetListReplacement, '')\n old_from = from_query()\n # cross join\n all_cols_renamed()\n cross_join_query = query.gsub(/#{old_from}/i,cross_join_from)\n # pk_join_satisfied_tbl = @pk_full_list.map { |pk| \"t.#{pk['alias']}_pk = s.#{pk['alias']}_pk\" }.join(' AND ')\n # pk_not_in_satisfied_tbl = @pk_full_list.map { |pk| \"s.#{pk['alias']}_pk is null\" }.join(' OR ')\n\n create_tbl_query = \"select * from #{satisfied_tbl} where 1=2\"\n create_tbl_query = QueryBuilder.create_tbl(@excluded_join_tbl, '', create_tbl_query)\n DBConn.exec(create_tbl_query)\n # limit to 1000 rows due to resource limitation\n cross_join_query = \"with cross_join as (#{cross_join_query} limit 1000) INSERT INTO #{@excluded_join_tbl} select * from (select t.* from cross_join as t except select * from #{satisfied_tbl}) as tmp\"\n puts cross_join_query\n DBConn.exec(cross_join_query)\n\n # unless preserve_null_pk\n # pk = @pk_full_list.map { |pk| \"#{pk['alias']}_pk\" }.join(',')\n # DBConn.update_null_columns(@excluded_join_tbl,pk)\n # end\n # # full join\n # full_join_query = query.gsub(old_from,full_join_from)\n # full_join_query = \"(#{full_join_query} except select #{@all_cols_renamed} from #{satisfied_tbl})\"\n # full_join_query = \"INSERT INTO #{@excluded_tbl} #{full_join_query}\"\n # DBConn.exec(query)\n end\n return @excluded_join_tbl\n end", "def complex_expression_sql_append(sql, op, args)\n r = args[1]\n if (((op == :'=' || op == :'!=') and r.is_a?(Sequel::Model)) ||\n (multiple = ((op == :IN || op == :'NOT IN') and ((is_ds = r.is_a?(Sequel::Dataset)) or r.all?{|x| x.is_a?(Sequel::Model)}))))\n l = args[0]\n if ar = model.association_reflections[l]\n if multiple\n klass = ar.associated_class\n if is_ds\n if r.respond_to?(:model)\n unless r.model <= klass\n # A dataset for a different model class, could be a valid regular query\n return super\n end\n else\n # Not a model dataset, could be a valid regular query\n return super\n end\n else\n unless r.all?{|x| x.is_a?(klass)}\n raise Sequel::Error, \"invalid association class for one object for association #{l.inspect} used in dataset filter for model #{model.inspect}, expected class #{klass.inspect}\"\n end\n end\n elsif !r.is_a?(ar.associated_class)\n raise Sequel::Error, \"invalid association class #{r.class.inspect} for association #{l.inspect} used in dataset filter for model #{model.inspect}, expected class #{ar.associated_class.inspect}\"\n end\n\n if exp = association_filter_expression(op, ar, r)\n literal_append(sql, exp)\n else\n raise Sequel::Error, \"invalid association type #{ar[:type].inspect} for association #{l.inspect} used in dataset filter for model #{model.inspect}\"\n end\n elsif multiple && (is_ds || r.empty?)\n # Not a query designed for this support, could be a valid regular query\n super\n else\n raise Sequel::Error, \"invalid association #{l.inspect} used in dataset filter for model #{model.inspect}\"\n end\n else\n super\n end\n end", "def join_tables(db)\n db.execute(\"SELECT users.user_name, platform.platform_name, music.artist, music.song, music.explicit_lyrics FROM music JOIN users ON music.user_id = users.id JOIN platform ON music.platform_id = platform.id\")\nend", "def construct_query(ids)\n # Some descendants of ActiveFedora::Base are anonymous classes. They don't have names. Filter them out.\n candidate_classes = klass.descendants.select(&:name)\n candidate_classes += [klass] unless klass == ActiveFedora::Base\n model_pairs = candidate_classes.each_with_object([]) { |klass, arr| arr << [:has_model, klass.to_class_uri] }\n '(' + ActiveFedora::SolrQueryBuilder.construct_query_for_ids(ids) + ') AND (' +\n ActiveFedora::SolrQueryBuilder.construct_query_for_rel(model_pairs, 'OR') + ')'\n end", "def construct_filter_query(queries)\n query_string = '?'\n query_list = Array[]\n\n # Format the include_* queries similarly to other queries for easier\n # processing\n if queries.key?('include_deleted')\n queries['include_deleted'] = if queries['include_deleted']\n ['true']\n else\n ['false']\n end\n end\n\n if queries.key?('include_revisions')\n queries['include_revisions'] = if queries['include_revisions']\n ['true']\n else\n ['false']\n end\n end\n\n # If uuid is included, the only other accepted queries are the\n # include_*s\n if queries.key?('uuid')\n query_string = format('/%s?', queries['uuid'])\n if queries.key?('include_deleted')\n query_string += format('include_deleted=%s&',\n queries['include_deleted'][0])\n end\n\n if queries.key?('include_revisions')\n query_string += format('include_revisions=%s&',\n queries['include_revisions'][0])\n end\n\n # Everthing is a list now, so iterate through and push\n else\n # Sort them into an alphabetized list for easier testing\n # sorted_qs = sorted(queries.to_a, key = operator.itemgetter(0))\n sorted_qs = queries.to_a.sort\n sorted_qs.each do |query, param|\n param.each do |slug|\n # Format each query in the list\n # query_list.push('%s=%s' % Array[query, slug])\n query_list.push(format('%s=%s', query, slug))\n end\n end\n\n # Construct the query_string using the list.\n # Last character will be an & so we can push the token\n query_list.each do |string|\n query_string += format('%s&', string)\n end\n end\n query_string\n end", "def join(other, join_definition, relation_aliases = {})\n joined = index.join(other.index, join_definition, relation_aliases)\n new(joined, other.index.aliases(joined))\n end", "def join_with_or ar, **options\n\n\t\t::Xqsr3::Quality::ParameterChecking.check_parameter ar, 'ar', type: ::Array, allow_nil: true\n\t\t::Xqsr3::Quality::ParameterChecking.check_parameter options, 'options', type: ::Hash, allow_nil: false\n\n\t\t::Xqsr3::Quality::ParameterChecking.check_parameter options[:or], ':or', type: ::String, option: true, allow_nil: true\n\t\t::Xqsr3::Quality::ParameterChecking.check_parameter options[:oxford_comma], ':oxford_comma', types: [ ::FalseClass, ::TrueClass ], option: true, allow_nil: true\n\t\t::Xqsr3::Quality::ParameterChecking.check_parameter options[:quote_char], ':quote_char', type: ::String, option: true, allow_nil: true\n\t\t::Xqsr3::Quality::ParameterChecking.check_parameter options[:separator], ':separator', type: ::String, option: true, allow_nil: true\n\n\t\treturn '' if ar.nil?\n\t\treturn '' if ar.empty?\n\n\t\tseparator\t=\toptions[:separator] || ','\n\t\tor_word\t\t=\toptions[:or] || 'or'\n\t\tox_comma\t=\t(options.has_key?(:oxford_comma) && !options[:oxford_comma]) ? '' : separator\n\t\tquote_char\t=\toptions[:quote_char]\n\n\t\tar\t\t\t=\tar.map { |v| \"#{quote_char}#{v}#{quote_char}\" } if quote_char\n\n\t\tcase ar.size\n\t\twhen 1\n\t\t\tar[0]\n\t\twhen 2\n\t\t\t\"#{ar[0]} #{or_word} #{ar[1]}\"\n\t\telse\n\t\t\t\"#{ar[0...-1].join(separator + ' ')}#{ox_comma} #{or_word} #{ar[-1]}\"\n\t\tend\n\tend", "def build_query(key, queries, localparams = \"\")\n query_string = ''\n case queries\n when String\n query_string = queries\n when Array\n query_string = queries.join(' ')\n when Hash\n query_string_array = []\n queries.each do |k,v|\n query_string_array << key_value_pair_string(k, v)\n end\n query_string = query_string_array.join(' ')\n end\n\n query_string = localparams + query_string\n\n {key => query_string}\n end", "def create_query( relation )\n Query.new(relation)\n end" ]
[ "0.6523445", "0.65155745", "0.6388709", "0.63140893", "0.62682563", "0.6233941", "0.6188287", "0.6070854", "0.6059934", "0.59720993", "0.597065", "0.59581333", "0.58965135", "0.58571875", "0.5846518", "0.5829649", "0.5822159", "0.5791104", "0.57683694", "0.5752367", "0.57296103", "0.57178307", "0.5690842", "0.5680992", "0.5658261", "0.5656618", "0.5635812", "0.56337106", "0.56284326", "0.5590844", "0.55906516", "0.5568505", "0.5562365", "0.5552641", "0.5540843", "0.55091286", "0.55014664", "0.54877776", "0.54871", "0.5468611", "0.5463202", "0.54555255", "0.5432938", "0.5399867", "0.5375446", "0.5342841", "0.53301066", "0.531905", "0.5315141", "0.5314266", "0.5302155", "0.52919406", "0.52884954", "0.528435", "0.52821785", "0.52816814", "0.52816224", "0.52816224", "0.52798676", "0.5271706", "0.5268179", "0.52236587", "0.52188635", "0.52187943", "0.5212537", "0.5205274", "0.5193648", "0.517261", "0.51719445", "0.51710576", "0.515108", "0.51496047", "0.5144947", "0.5144355", "0.5131609", "0.51276636", "0.51251936", "0.5110785", "0.51107633", "0.51087976", "0.509265", "0.50865537", "0.50801086", "0.5072331", "0.50720036", "0.507173", "0.5070048", "0.50668865", "0.5060056", "0.5057035", "0.5056655", "0.5052824", "0.50494725", "0.5048949", "0.50472206", "0.50472176", "0.5043115", "0.5027968", "0.50208545", "0.5019412" ]
0.67276204
0
GET /jobs GET /jobs.json
def index @jobs = Job.all @paginated_jobs = @jobs.paginate(:page => params[:page], :per_page => Settings.Pagination.NoOfEntriesPerPage) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @jobs = Job.all\n\n render json: @jobs\n end", "def index\n @jobs = Job.all\n render json: @jobs\n end", "def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end", "def index\n @jobs = current_user.jobs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end", "def index\n @job_items = @job.job_items.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @job_items }\n end\n end", "def find_jobs(params:)\n response = HTTParty.get(\"#{@host}/api/jobs\", query: params)\n\n return response[\"jobs\"] \n end", "def jobs(opts = {})\n api(\n @client.list_jobs(\n @project_id,\n deep_symbolize_keys(opts)\n )\n )\n end", "def index \n @jobs = Job.all.find_all{ |job| job.user_id == current_user.user_id }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end", "def list_jobs\n jobs = if unsafe_params[:editable]\n Job.editable_by(@context).accessible_by_private\n else\n Job.accessible_by(@context)\n end\n\n if unsafe_params[:scopes].present?\n check_scope!\n jobs = jobs.where(scope: unsafe_params[:scopes])\n end\n\n if unsafe_params[:space_uid].present?\n jobs = jobs.terminal\n end\n\n result = jobs.eager_load(user: :org).order(id: :desc).map do |job|\n describe_for_api(job, unsafe_params[:describe])\n end\n\n render json: result\n end", "def index\n @jobs = Job.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end", "def fetch_job\n JSON.parse(RestClient.get(url).body)\n end", "def listjobs(project=self.project)\n get('listjobs.json', project: project).reject{|k,v| k=='status'}\n end", "def job(id, options = {})\n objectify get(\"/job/#{id}\", options)['joblist']['job']\n end", "def get_jobs(url)\n result = JSON.parse(get_data(url))\n job_list = []\n result[\"jobs\"].each do |job|\n job = JenkinsJob.new job[\"name\"], job[\"color\"], job[\"url\"]\n job_list << job\n end\n job_list\nend", "def show\n render json: @job\n end", "def show\n render json: @job\n end", "def show\n @job = @user.jobs.find_by_id!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def index\n @jobs = Job.all\n end", "def index\n @jobs = Job.all\n end", "def index\n @jobs = Job.all\n end", "def index\n @jobs = Job.all\n end", "def index\n @jobs = Job.all\n end", "def index\n @jobs = Job.all\n end", "def index\n @jobs = Job.all\n end", "def get_jobs_sample(client)\n response = client['jobs'].get\n\n p ''\n p 'Get jobs'\n p response\nend", "def jobs(opts = {})\n api(api_method: @bq.jobs.list,\n parameters: opts)\n end", "def index\n self.limit\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end", "def index\n \n @meeting_threads = @current_user.available_jobs\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meeting_threads }\n end\n end", "def index\n render json: {:jobs => Job.where('branch_id = ?', current_user.branch_id).order(id: :desc),\n :branch_id => current_user.branch_id }\n end", "def jobs\n\t\t# ...\n\tend", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def jobs\n\t\t@jobs = Job.where(user_id: @company.user_id)\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend", "def job\n fetch('games.final_fantasy_xiv.jobs')\n end", "def list_jobs(username, password, uuid = nil)\n jobs = get_json('jobs.json', username, password)\n puts \"\"\n jobs[\"jobs\"].each do |job|\n next if uuid && job['uuid'] != uuid\n if job['jobURL']\n job.merge!(get_json(job['jobURL'], username, password, ''))\n end\n puts summarise_job(job, 2)\n puts \"\"\n end\n del = jobs['delivered']\n puts \"#{del['jobCount']} jobs, #{del['activityCount']} activities delivered since #{del['since']}\"\nend", "def getCurrentJobs\n getJobs('0/')\n end", "def show\n @job = @user.jobs.find_by_id!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render_for_api :checkins_with_job, json: @job, root: :job }\n end\n end", "def index\n #@jobs = Job.all\n @jobs = Job.all(:order => 'updated_at DESC')\n #@jobs = @user.jobs.all(:order => 'updated_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end", "def index\n @jobs = Job.all\n # @jobs = ScriptedClient::Job.all\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @launched_job }\n end\n end", "def index\n jobs = Job.all.map do |job|\n { title: job.title, timerange: job.timerange }\n end\n \n render json: { results: jobs }.to_json, status: :ok\n end", "def get_job(id)\n conn = @client.get do |req|\n req.url \"/api/v2/job/#{id}\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end", "def get_single_job_sample(client)\n response = client[\"jobs/#{$job_id}\"].get\n\n p ''\n p 'Get single job'\n p response\nend", "def index\n @training_active_jobs = Training::ActiveJob.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @training_active_jobs }\n end\n end", "def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def get(jid)\n results = @client.call('get', jid)\n Job.new(@client, JSON.parse(results)) unless results.nil?\n end", "def get_job_status id\n response = get \"http://#{@host}/loadbalancers/tenant/#{@tenant}/jobs/#{id}\"\n raise LBModelException.new \"Expected HTTP 200 but got #{response.code} instead\" unless response.code == 200\n\n JSON.parse(response)\n end", "def index\n @job_requests = JobRequest.all\n end", "def index\n @jobs = Job.page(params[:page])\n end", "def find_job(job_id)\n response = HTTParty.get(\"#{@host}/api/jobs/#{job_id}\")\n\n return response['job']\n end", "def show\n @job_item = @job.job_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_item }\n end\n end", "def index\n @jobs = Job.all\n render :index\n end", "def index\n @jobs = Job.paginate :page => params[:page], :order => 'created_at DESC', :per_page =>10\n @job = Job.find(:last)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n format.json { render :json => @jobs }\n end\n end", "def index\n @jobs = Job.with_hires(nil).all\n end", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json {\n render :json => @job,\n :methods => [:status_name, :percentage, :total, :completed, :error, :ended?]\n }\n end\n end", "def jobs\n @jobs || {}\n end", "def index\n @jobtimes = current_company.jobtimes.find_all_by_job_id(params[:job_id])\n respond_to do |format|\n format.xml {render :xml => @jobtimes }\n format.json { render :json => @jobtimes }\n end\n end", "def possible_jobs\n \n\n job = params[:job].titleize\n location = params[:location].titleize\n\n results = Cb.job.search({ location: location,\n keywords: job })\n jobs = results.model.jobs\n @job_data = {\n job: job,\n location: location,\n job_results: jobs\n }\n end", "def index\n @job_folios = JobFolio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @job_folios }\n end\n end", "def get_job_info(page)\n job_api = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs?page=#{page}&per_page=#{PER_PAGE}\"\n begin\n response = RestClient::Request.new(\n :method => :get,\n :url => job_api,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n response.headers\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"jobs info error: #{err.response}\"\n return nil\n end\nend", "def show\n @user = User.find(params[:id])\n @jobs = @user.jobs\n end", "def public_api_get_jobs(modified, api_key, opts = {})\n data, _status_code, _headers = public_api_get_jobs_with_http_info(modified, api_key, opts)\n return data\n end", "def index\n @joborders = Joborder.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @joborders }\n end\n end", "def jobs\n doc = Nokogiri::XML open(@url)\n\n doc.search('//job').map { |node|\n Job.new(attributes_from(node))\n }\n end", "def get_jobs_list(status = :all, page = 1, reload = false)\n Bitmovin::Job.list(status, page, reload)\n end", "def search\n data = Job.search(params)\n\n # Respond with :json, :txt (tab delimited Blast results), or GFF3.\n respond_with data.flatten!(1) do |format|\n format.json {\n render :json => Quorum::JobSerializer.as_json(data)\n }\n format.gff {\n render :text => Quorum::JobSerializer.as_gff(data)\n }\n format.txt {\n render :text => Quorum::JobSerializer.as_txt(data)\n }\n end\n end", "def index\n @jobs = Job.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end", "def job_get(organization, jobid)\n uri = server_uri(\"/organizations/#{organization}/jobs/#{jobid}\")\n res_data = api_get(uri)\n @logger.debug res_data\n\n return res_data\n end", "def index\n # Fetches space jobs.\n if params[:space_id]\n jobs = []\n if find_user_space\n jobs = @space.jobs.\n eager_load(:app, user: :org, analysis: :workflow).\n includes(:taggings).\n search_by_tags(params.dig(:filters, :tags)).\n order(order_from_params).page(page_from_params).per(PAGE_SIZE)\n jobs.each { |job| job.current_user = @context.user }\n\n jobs = JobService::JobsFilter.call(jobs, params[:filters])\n\n sync_jobs(jobs)\n end\n\n page_dict = pagination_dict(jobs)\n\n render json: jobs, root: \"jobs\", meta: count(page_dict[:total_count]).\n merge({ pagination: page_dict }), adapter: :json\n else\n # Fetches all user 'private' jobs.\n jobs = Job.\n editable_by(@context).\n accessible_by_private.\n eager_load(:app, user: :org, analysis: :workflow).\n includes(:taggings).\n search_by_tags(params.dig(:filters, :tags)).\n order(ORDER_GROUP_FIELDS)\n jobs = JobService::JobsFilter.call(jobs, params[:filters])\n\n render_jobs_list(jobs)\n end\n end", "def get_jobs(from, to)\n\n job_info = get_job_info(from)\n total_page = job_info[:x_total_pages].to_i\n new_to = (to == nil || to < total_page) ? to : total_page\n puts \">> total page : \" + total_page.to_s\n\n jobs = []\n (from..new_to).each do |page|\n job_api = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs?page=#{page}&per_page=#{PER_PAGE}\"\n puts \">>start:page:\" + page.to_s\n\n begin\n response = RestClient::Request.new(\n :method => :get,\n :url => job_api,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n if response != nil && response.code == 200\n res = JSON.parse(response.to_str)\n jobs += res\n end\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"jobs error: #{err.response}\"\n end\n end\n\n jobs\nend", "def index\n @jobs = PeriodicJob.list params[:page], current_user.row_limit\n end", "def index\n \t@jobs = Job.all\n \t# if i wanted to find all of my jobs\n \t# @jobs = current_user.jobs.all\n end", "def index\n @jobs = Job.find(:all, :conditions => params_to_conditions(params), :order => \"id\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end", "def jobs\r\n end", "def index\n @job_details = JobDetail.all\n end", "def get_job(job_id)\n client = IotHubApiClient.new(@options)\n res = client.get(jobs_path(job_id), @api_version_param)\n JobResponse.new(response_json(res))\n end", "def show\n @employing_unit = EmployingUnit.find(params[:id])\n @job=Job.new\n @jobs=@employing_unit.jobs\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employing_unit }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def index\n @jobsearches = Jobsearch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobsearches }\n end\n end", "def new\n\t\t@job = Job.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @job }\n\t\tend\n\tend", "def index\n @job = Job.find(params[:jid]) if params[:jid] and Job.exists?(params[:jid])\n redirect_to jobs_path unless @job\n @job = Job.find(params[:jid]) if params[:jid] and Job.exists?(params[:jid])\n redirect_to jobs_path unless @job\n @job_scope_additions = JobScopeAddition.find_all_by_jobs_id(@job.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @job_scope_additions }\n end\n end", "def index\n jobs_index(Job.all)\n end", "def index\n respond_to do |format|\n format.html \n format.js { render :partial => 'list', :locals => { :jobs => Job.get_jobs(current_user, params) } }\n format.xml { render :xml => Job.get_jobs(current_user, params.merge({:show => 'all'})) }\n end\n end", "def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def get_job(uuid, username, password)\n jobs = get_json('jobs.json', username, password)\n job = jobs['jobs'].find { |j| j['uuid'] == uuid }\n\n if job['jobURL']\n job.merge!(get_json(job['jobURL'], username, password, ''))\n end\n\n fail \"Could not find job with UUID=#{uuid}\" unless job\n job\nend", "def index\n\t\t@page = 'browse'\n if params[:search].blank?\n\t\t case params[:type]\n\t\t\t\twhen \"featured\"\n\t\t\t\t\t@jobs = Job.featured\n when \"latest\"\n @jobs = Job.recently_submited(9)\n\t\t\t\twhen \"closed\"\n\t\t\t\t\t@jobs = Job.closed\n\t\t\t\telse\n\t\t\t\t\t@jobs = Job.open\n end\n else\n\t\t\t@page = 'search'\n @jobs = Job.active.find(:all, :conditions => ['role LIKE ? OR company LIKE ?', \"%#{params[:search]}%\", \"%#{params[:search]}%\"])\n\t\t\tif @jobs.empty?\n @page_header_line = \"Your search by <strong>#{h(params[:search])}</strong> did not return any job. Try a different search or <a href='#{jobs_url}'>go browse</a>.\"\n else\n @page_header_line = \"Your search by <strong>#{h(params[:search])}</strong> returned the following results: \"\n end\n end\n\n @jobs = @jobs.paginate :per_page => 10, :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end", "def jobs(params={})\n @radius = params[:radius] if params[:radius]\n @zipcode = params[:zipcode] if params[:zipcode]\n return @jobs if (@jobs && !params[:force])\n page = params[:page] || 1\n per_page = params[:per_page] || 100\n @jobs = get_jobs(page,per_page)\n end", "def show\n\t\t@project = Project.accessible(current_user).find_by_name(params[:project_id])\n\t\traise \"There is no such project.\" unless @project.present?\n\n\t\t@job = Job.find(params[:id])\n\t\t@messages_grid = initialize_grid(@job.messages,\n\t\t\torder: :created_at,\n\t\t\tper_page: 10\n\t\t)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @job }\n\t\tend\n\tend", "def index\n @jobs = Job.all\n\n # change layout for index\n #render layout: \"application\"\n end", "def show\n @saved_jobs = SavedJob.where(:user_id => current_user.id).order(\"created_at DESC\")\n\n @saved_job = SavedJob.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @saved_job }\n end\n end", "def all_jobs\n\n find_jobs()\n end", "def index\n @volunteer_jobs = VolunteerJob.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @volunteer_jobs }\n end\n end", "def index\n @pending_jobs = PendingJob.all\n end" ]
[ "0.78487986", "0.78391117", "0.7709953", "0.7699296", "0.74898845", "0.7433689", "0.7387766", "0.73397416", "0.73253435", "0.72978896", "0.72852373", "0.7262688", "0.7212051", "0.72030485", "0.71915585", "0.71915585", "0.71735525", "0.7161574", "0.7146019", "0.7146019", "0.7146019", "0.7146019", "0.7146019", "0.7146019", "0.71374166", "0.7110979", "0.71033067", "0.7084538", "0.708442", "0.7081443", "0.70546216", "0.70546216", "0.70546216", "0.70546216", "0.70546216", "0.7043654", "0.70404917", "0.7024569", "0.70204306", "0.70020276", "0.69962513", "0.6987001", "0.6984571", "0.69816613", "0.6978064", "0.6923412", "0.6912754", "0.6851684", "0.6851684", "0.68406266", "0.68397737", "0.68359077", "0.6835666", "0.6826369", "0.68250775", "0.68166214", "0.6811104", "0.68076795", "0.6782449", "0.6761304", "0.6757455", "0.672691", "0.6703917", "0.6699922", "0.6692218", "0.6682872", "0.6671499", "0.6659162", "0.6645825", "0.66439766", "0.6639349", "0.6636272", "0.6608544", "0.66001517", "0.65981805", "0.6589027", "0.6566939", "0.65351313", "0.65193075", "0.6513305", "0.65111524", "0.6503713", "0.649713", "0.6487792", "0.6481146", "0.64804345", "0.64754134", "0.64746165", "0.64746165", "0.64746165", "0.64746165", "0.6472091", "0.64716864", "0.6471483", "0.6460298", "0.64557004", "0.6455072", "0.64457816", "0.64410967", "0.64351296" ]
0.67068017
62
GET /jobs/1 GET /jobs/1.json
def show @tasks = Task.where(:job => @job) @paginated_tasks = @tasks.paginate(:page => params[:page], :per_page => Settings.Pagination.NoOfEntriesPerPage) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_single_job_sample(client)\n response = client[\"jobs/#{$job_id}\"].get\n\n p ''\n p 'Get single job'\n p response\nend", "def job(id, options = {})\n objectify get(\"/job/#{id}\", options)['joblist']['job']\n end", "def index\n @jobs = Job.all\n\n render json: @jobs\n end", "def index\n @jobs = Job.all\n render json: @jobs\n end", "def show\n @job = @user.jobs.find_by_id!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def index\n @jobs = current_user.jobs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end", "def get_job(id)\n conn = @client.get do |req|\n req.url \"/api/v2/job/#{id}\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end", "def find_job(job_id)\n response = HTTParty.get(\"#{@host}/api/jobs/#{job_id}\")\n\n return response['job']\n end", "def fetch_job\n JSON.parse(RestClient.get(url).body)\n end", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end", "def index\n @job_items = @job.job_items.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @job_items }\n end\n end", "def show\n @job = @user.jobs.find_by_id!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render_for_api :checkins_with_job, json: @job, root: :job }\n end\n end", "def show\n render json: @job\n end", "def show\n render json: @job\n end", "def get_job_status id\n response = get \"http://#{@host}/loadbalancers/tenant/#{@tenant}/jobs/#{id}\"\n raise LBModelException.new \"Expected HTTP 200 but got #{response.code} instead\" unless response.code == 200\n\n JSON.parse(response)\n end", "def show\n @job_item = @job.job_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_item }\n end\n end", "def get(jid)\n results = @client.call('get', jid)\n Job.new(@client, JSON.parse(results)) unless results.nil?\n end", "def get_jobs_sample(client)\n response = client['jobs'].get\n\n p ''\n p 'Get jobs'\n p response\nend", "def index\n @jobs = Job.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end", "def index \n @jobs = Job.all.find_all{ |job| job.user_id == current_user.user_id }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end", "def find_jobs(params:)\n response = HTTParty.get(\"#{@host}/api/jobs\", query: params)\n\n return response[\"jobs\"] \n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @launched_job }\n end\n end", "def index\n self.limit\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end", "def job\n fetch('games.final_fantasy_xiv.jobs')\n end", "def index\n @jobs = Job.all\n end", "def index\n @jobs = Job.all\n end", "def index\n @jobs = Job.all\n end", "def index\n @jobs = Job.all\n end", "def index\n @jobs = Job.all\n end", "def index\n @jobs = Job.all\n end", "def listjobs(project=self.project)\n get('listjobs.json', project: project).reject{|k,v| k=='status'}\n end", "def get_jobs(url)\n result = JSON.parse(get_data(url))\n job_list = []\n result[\"jobs\"].each do |job|\n job = JenkinsJob.new job[\"name\"], job[\"color\"], job[\"url\"]\n job_list << job\n end\n job_list\nend", "def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def getCurrentJobs\n getJobs('0/')\n end", "def index\n @jobs = Job.all\n end", "def show\n @job = Job.find(params[:id])\n end", "def show\n @job = Job.find(params[:id])\n end", "def fetch_job\n @job = Job.find(params.require(:id))\n end", "def job_get(organization, jobid)\n uri = server_uri(\"/organizations/#{organization}/jobs/#{jobid}\")\n res_data = api_get(uri)\n @logger.debug res_data\n\n return res_data\n end", "def get_job_info(page)\n job_api = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs?page=#{page}&per_page=#{PER_PAGE}\"\n begin\n response = RestClient::Request.new(\n :method => :get,\n :url => job_api,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n response.headers\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"jobs info error: #{err.response}\"\n return nil\n end\nend", "def get_job(uuid, username, password)\n jobs = get_json('jobs.json', username, password)\n job = jobs['jobs'].find { |j| j['uuid'] == uuid }\n\n if job['jobURL']\n job.merge!(get_json(job['jobURL'], username, password, ''))\n end\n\n fail \"Could not find job with UUID=#{uuid}\" unless job\n job\nend", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json {\n render :json => @job,\n :methods => [:status_name, :percentage, :total, :completed, :error, :ended?]\n }\n end\n end", "def jobs\n\t\t# ...\n\tend", "def jobs(opts = {})\n api(\n @client.list_jobs(\n @project_id,\n deep_symbolize_keys(opts)\n )\n )\n end", "def index\n @jobs = Job.all\n # @jobs = ScriptedClient::Job.all\n end", "def get_job(job_id)\n client = IotHubApiClient.new(@options)\n res = client.get(jobs_path(job_id), @api_version_param)\n JobResponse.new(response_json(res))\n end", "def show\n @job_title = JobTitle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_title }\n end\n end", "def index\n render json: {:jobs => Job.where('branch_id = ?', current_user.branch_id).order(id: :desc),\n :branch_id => current_user.branch_id }\n end", "def index\n #@jobs = Job.all\n @jobs = Job.all(:order => 'updated_at DESC')\n #@jobs = @user.jobs.all(:order => 'updated_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end", "def index\n \n @meeting_threads = @current_user.available_jobs\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meeting_threads }\n end\n end", "def index\n @job_requests = JobRequest.all\n end", "def show\n respond_with Job.find(params[:id])\n end", "def index\n @jobs = Job.page(params[:page])\n end", "def index\n @jobs = Job.all\n render :index\n end", "def index\n jobs = Job.all.map do |job|\n { title: job.title, timerange: job.timerange }\n end\n \n render json: { results: jobs }.to_json, status: :ok\n end", "def index\n @jobs = Job.paginate :page => params[:page], :order => 'created_at DESC', :per_page =>10\n @job = Job.find(:last)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n format.json { render :json => @jobs }\n end\n end", "def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n format.json { render :json => @job }\n end\n end", "def show\n @user = User.find(params[:id])\n @jobs = @user.jobs\n end", "def list_jobs(username, password, uuid = nil)\n jobs = get_json('jobs.json', username, password)\n puts \"\"\n jobs[\"jobs\"].each do |job|\n next if uuid && job['uuid'] != uuid\n if job['jobURL']\n job.merge!(get_json(job['jobURL'], username, password, ''))\n end\n puts summarise_job(job, 2)\n puts \"\"\n end\n del = jobs['delivered']\n puts \"#{del['jobCount']} jobs, #{del['activityCount']} activities delivered since #{del['since']}\"\nend", "def show\n @device = Device.find(params[:device_id])\n @job = @device.jobs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def list_jobs\n jobs = if unsafe_params[:editable]\n Job.editable_by(@context).accessible_by_private\n else\n Job.accessible_by(@context)\n end\n\n if unsafe_params[:scopes].present?\n check_scope!\n jobs = jobs.where(scope: unsafe_params[:scopes])\n end\n\n if unsafe_params[:space_uid].present?\n jobs = jobs.terminal\n end\n\n result = jobs.eager_load(user: :org).order(id: :desc).map do |job|\n describe_for_api(job, unsafe_params[:describe])\n end\n\n render json: result\n end", "def index\n @training_active_jobs = Training::ActiveJob.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @training_active_jobs }\n end\n end", "def index\n @jobs = Job.with_hires(nil).all\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def show\n @employing_unit = EmployingUnit.find(params[:id])\n @job=Job.new\n @jobs=@employing_unit.jobs\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employing_unit }\n end\n end", "def job(job_name)\n jobs job_name\n end", "def show\n @job = Job.find(params[:id])\n render :show\n end", "def print_job_sample(client)\n response = client[\"jobs/#{$job_id}/print\"].put nil\n\n p ''\n p 'Print a job'\n p response\nend", "def new\n\t\t@job = Job.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @job }\n\t\tend\n\tend", "def index\n @job_details = JobDetail.all\n end", "def show\n @job_folio = JobFolio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_folio }\n end\n end", "def find_job\n @job = Job.find(params[:job_id])\n end", "def index\n @job = Job.find(params[:jid]) if params[:jid] and Job.exists?(params[:jid])\n redirect_to jobs_path unless @job\n @job = Job.find(params[:jid]) if params[:jid] and Job.exists?(params[:jid])\n redirect_to jobs_path unless @job\n @job_scope_additions = JobScopeAddition.find_all_by_jobs_id(@job.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @job_scope_additions }\n end\n end", "def show\n @job = Job.find(params[:job_id])\n @part = @job.parts.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json {render json: @part}\n end\n end", "def show\n @training_active_job = Training::ActiveJob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @training_active_job }\n end\n end", "def create\n job = Job.create(job_params)\n render json: job\n end", "def jobs(opts = {})\n api(api_method: @bq.jobs.list,\n parameters: opts)\n end", "def show\n\t\t@project = Project.accessible(current_user).find_by_name(params[:project_id])\n\t\traise \"There is no such project.\" unless @project.present?\n\n\t\t@job = Job.find(params[:id])\n\t\t@messages_grid = initialize_grid(@job.messages,\n\t\t\torder: :created_at,\n\t\t\tper_page: 10\n\t\t)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @job }\n\t\tend\n\tend", "def show\n @saved_jobs = SavedJob.where(:user_id => current_user.id).order(\"created_at DESC\")\n\n @saved_job = SavedJob.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @saved_job }\n end\n end", "def index\n @job_folios = JobFolio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @job_folios }\n end\n end", "def index\n @jobtimes = current_company.jobtimes.find_all_by_job_id(params[:job_id])\n respond_to do |format|\n format.xml {render :xml => @jobtimes }\n format.json { render :json => @jobtimes }\n end\n end", "def index\n @jobs = Job.all\n @paginated_jobs = @jobs.paginate(:page => params[:page], :per_page => Settings.Pagination.NoOfEntriesPerPage)\n end", "def show\n @location = Location.find(params[:id])\n @jobs = @location.jobs\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def index\n @joborders = Joborder.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @joborders }\n end\n end", "def index\n @jobs = Job.find(:all, :conditions => params_to_conditions(params), :order => \"id\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end", "def index\n @jobs = Job.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end", "def show\n @job_compact = JobCompact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_compact }\n end\n end", "def job # this is a getter\n @job\n end", "def show\n @jobber = Jobber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jobber }\n end\n end", "def show\n @emp_job = EmpJob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @emp_job }\n end\n end", "def new\n @device = Device.find(params[:device_id]) \n @job = @device.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end" ]
[ "0.7502627", "0.7452839", "0.74433225", "0.7431692", "0.73964095", "0.7318132", "0.73017573", "0.7274776", "0.72400314", "0.72262365", "0.72262365", "0.72262365", "0.72262365", "0.72262365", "0.7224223", "0.7210173", "0.7158107", "0.7103444", "0.7103444", "0.70951277", "0.70601654", "0.7044532", "0.7035684", "0.6970953", "0.696714", "0.696486", "0.6939762", "0.6911511", "0.6907541", "0.6893121", "0.6893121", "0.6893121", "0.6893121", "0.6893121", "0.6893121", "0.68911624", "0.6850468", "0.685026", "0.685026", "0.6843068", "0.6826189", "0.6806024", "0.6806024", "0.6786205", "0.6784602", "0.67684627", "0.6761976", "0.6761152", "0.6760262", "0.6732827", "0.6716682", "0.6699513", "0.6694644", "0.6684754", "0.6665444", "0.6642488", "0.6630999", "0.662039", "0.6617179", "0.661179", "0.6603265", "0.65967405", "0.65964955", "0.6595446", "0.65911883", "0.6577531", "0.6571862", "0.6571862", "0.6571862", "0.6571862", "0.6571524", "0.65633017", "0.655555", "0.6549316", "0.65379936", "0.6531391", "0.652758", "0.64775044", "0.64739305", "0.6454324", "0.64510185", "0.6428531", "0.6428451", "0.64259934", "0.642127", "0.6413919", "0.64037675", "0.6394354", "0.63912344", "0.63878506", "0.63867205", "0.63783586", "0.6364667", "0.6362414", "0.63522846", "0.63519084", "0.63494635", "0.6338983", "0.63383627", "0.6319861", "0.63129044" ]
0.0
-1
POST /jobs POST /jobs.json
def create @task = Task.new(task_state: TaskState.where(name: "Pending")[0] ) if params[:all] # get task IDs from system, map to strings @task.concrete_package_versions << System.find(params[:system_id]).concrete_package_versions.where(concrete_package_state: ConcretePackageState.first ) #TODO: centralised state manager else # get task IDs from submitted array if params[:updates] params[:updates].each do |updateID| @task.concrete_package_versions << ConcretePackageVersion.find( updateID ) end end end if ( ConcretePackageState.exists?(name: "Queued for Installation") ) stateQueued = ConcretePackageState.where(name: "Queued for Installation")[0] @task.concrete_package_versions.each do |update| update.concrete_package_state = stateQueued update.save() end end @task.tries = 0 @task.save if current_user @job = Job.new(user: current_user, started_at: Time.new) @job.tasks << @task @job.save BackgroundSender.perform_async( @task ) redirect_to @job else #TODO: log! end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @job = current_user.posted_jobs.build(job_params)\n if @job.save\n render json: @job\n else\n render json: @job.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n job = Job.create(job_params)\n render json: job\n end", "def new_job(job, username, password)\n puts \"Requesting quote for job:\"\n puts JSON.pretty_generate(job)\n puts \"\"\n res = post_json('jobs.json', job, username, password)\n if res['error'] || res['status'] == 'error'\n puts \"Job rejected (error #{res['status']}): #{res['error'] || res['reason']}\"\n return\n end\n\n puts \"Gnip's job desc:\"\n puts summarise_job(res)\nend", "def create_job(job:, params: {})\n response = HTTParty.post(\"#{@host}/api/jobs\", body: {job: job, api_key: @api_key}.merge(params))\n \n return response\n end", "def create\n\t\tjob = Job.new\n\t\tjob.user_id = current_user.id\n\t\tjob.http_method \t= params[:http_method]\n\t\tjob.http_uri \t\t= params[:http_uri]\n\t\tjob.http_host \t\t= params[:http_host]\n\t\tjob.http_headers\t= params[:http_headers]\n\t\tjob.http_data\t\t= params[:http_data]\n\n\t\t# Set job type to bruteforce by default. This will change, but\n\t\t# for now we don't care about responses.\n\t\tjob.attack_type\t\t\t= \"repeat\"\n\n\t\t# Set status to pending by default -- this may change in future\n\t\tjob.status \t\t\t= \"pending\"\n\n\t\tjob.save\n\n\t\trender :json => job.to_json\n\tend", "def create\n @job = @user.jobs.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to :dashboard, notice: 'Job was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job = Job.new(params[:job])\n @job.status = 'listed'\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n JobsWorker.perform_async(@job.id, @job.server.id)\n flash[:success] = 'Job was successfully created.'\n format.html { redirect_to jobs_path }\n format.json { render :show, status: :created, location: @job }\n else\n flash[:error] = 'Please fill all fields correctly !!'\n format.html { redirect_to root_url }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@job = Job.new(params[:job])\n\n\t\trespond_to do |format|\n\t\t\tif @job.save\n\t\t\t\tformat.html { redirect_to @job, notice: 'Job was successfully created.' }\n\t\t\t\tformat.json { render json: @job, status: :created, location: @job }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @job.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @job = @user.jobs.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to :dashboard, notice: \"Job was successfully created.\" }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(id, job)\n connection.post do |req|\n req.url \"job/#{id}\"\n req.body = job\n end\n end", "def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job = current_company.jobs.build(params[:job])\n respond_to do |format|\n if @job.save\n format.html { redirect_to root_path, notice: 'Vaga criada com sucesso' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n arg = params[:email]\n counter = Job.enqueue(arg)\n render :status => :accepted, :json => { jobId: counter }\n end", "def create\n @myjob = Myjob.new(myjob_params)\n\n respond_to do |format|\n if @myjob.save\n format.html { redirect_to @myjob, notice: 'Myjob was successfully created.' }\n format.json { render :show, status: :created, location: @myjob }\n else\n format.html { render :new }\n format.json { render json: @myjob.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to root_path, notice: 'Job was successfully created.' }\n format.json { render action: 'show', status: :created, location: @job }\n else\n format.html { render action: 'new' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job = Job.new(job_params)\n @job.user = current_user\n if @job.save\n render json: { redirect_url: job_url(@job), notice: \"Thanks for posting! Your job is now pending review.\" }\n else\n render json: @job.errors\n end\n end", "def create_batch_job(job_id)\n request = Net::HTTP::Put.new(\"/jobs/#{job_id}\")\n response = http.request(request)\n handle_response({ request_method: request.method, request_path: request.path }, response)\n end", "def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render action: 'show', status: :created, location: @job }\n else\n format.html { render action: 'new' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_job(json_payload)\n conn = @client.post do |req|\n req.url '/api/v2/job/create'\n req.headers[\"Authorization\"] = @token\n req.body = json_payload\n end\n conn.body\n end", "def create\n\n printer_ids = JSON.parse(job_params[:printer])\n\n printers = Printer.where(id: printer_ids)\n\n job_params_fixed = job_params\n\n job_params_fixed[:printer] = nil\n\n\n printers.each do |printer|\n\n @job = Job.new(job_params_fixed)\n\n @job.printer = printer\n\n @job.status = \"Unassigned\"\n @job.save\n end\n\n redirect_to root_path\n\n # respond_to do |format|\n # if @job.save\n # format.html { redirect_to @job, notice: 'Job was successfully created.' }\n # format.json { render :show, status: :created, location: @job }\n # else\n # format.html { render :new }\n # format.json { render json: @job.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @job_post = JobPost.new(job_post_params)\n\n if @job_post.save\n render :show, status: :created, location: @job_post\n else\n render json: @job_post.errors, status: :unprocessable_entity\n end\n end", "def create\n @job = current_user.jobs.new(job_params)\n respond_to do |format|\n if @job.save\n \ttrack_activity @job\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @postjob = Postjob.new(postjob_params)\n\n respond_to do |format|\n if @postjob.save\n format.html { redirect_to @postjob, notice: 'Postjob was successfully created.' }\n format.json { render :show, status: :created, location: @postjob }\n else\n format.html { render :new }\n format.json { render json: @postjob.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end", "def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def create\n @job = current_member.jobs.new(job_params)\n @job.published_at = DateTime.now\n\n\n respond_to do |format|\n if @job.save\n\n format.html { redirect_to @job, notice: 'The stuff you want done was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @create_job = CreateJob.new(create_job_params)\n\n respond_to do |format|\n if @create_job.save\n format.html { redirect_to @create_job, notice: 'Create job was successfully created.' }\n format.json { render :show, status: :created, location: @create_job }\n else\n format.html { render :new }\n format.json { render json: @create_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def jobs\n\t\t# ...\n\tend", "def create_batch\n begin\n # create the new batch\n batch = BatchJob.new\n batch.name = params[:name]\n batch.job_type = params[:type_id]\n batch.ocr_engine_id = params[:engine_id]\n batch.font_id = params[:font_id]\n batch.parameters = params[:params]\n batch.notes = params[:notes]\n batch.save!\n \n # populate it with pages from the selected works\n json_payload = ActiveSupport::JSON.decode(params[:json])\n json_payload['works'].each do | work_id |\n pages = Page.where(\"pg_work_id = ?\", work_id)\n pages.each do | page |\n job = JobQueue.new\n job.batch_id = batch.id\n job.page_id = page.pg_page_id\n job.job_status = 1\n job.work_id=work_id\n job.save!\n end\n end\n\n # get a new summary for the job queue\n status = get_job_queue_status()\n render :json => ActiveSupport::JSON.encode(status), :status => :ok \n \n rescue => e\n render :text => e.message, :status => :error\n end \n end", "def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to mentor_job_path(@job), notice: 'Job was successfully created.' }\n format.json { render action: 'show', status: :created, location: @job }\n else\n format.html { render action: 'new' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@job = Job.new(params[:job])\n @job = current_user.jobs.new(params[:job])\n \n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if current_user.saved_jobs.where(job_id: params[:saved_job][:job_id]).count > 0\n respond_to do |format|\n format.html { redirect_to worker_all_jobs_path, notice: t('saved_jobs_controller.saved_jobs_create_error') }\n end\n else\n @saved_job = current_user.saved_jobs.new(saved_job_params)\n\n respond_to do |format|\n if @saved_job.save\n format.html { redirect_to worker_all_jobs_path, notice: t('saved_jobs_controller.saved_jobs_create_success') }\n format.json { render :show, status: :created, location: @saved_job }\n\n else\n format.html { render :new }\n format.json { render json: @saved_job.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @job = Job.new(params[:job])\n @job.company_id = current_company.id\n\n if @job.save\n response_message = {:message => \"Job created successfully.\", :job => @job}\n else\n response_message = {:message => \"Job creation failed. Please try again!\"}\n end\n\n respond_to do |format|\n format.xml { render :xml => response_message}\n format.json { render :json => response_message }\n end\n end", "def record_job(job_json)\n job = JSON.parse(job_json)\n processing_jobs.create!(\n :account_id => account_id,\n :cloud_crowd_id => job['id'],\n :title => title,\n :remote_job => job\n )\n end", "def index\n @jobs = Job.all\n render json: @jobs\n end", "def create\n ensure_authenticated!\n\n job = Grid5000::Job.new(job_params)\n Rails.logger.info \"Received job = #{job.inspect}\"\n raise BadRequest, \"The job you are trying to submit is not valid: #{job.errors.join('; ')}\" unless job.valid?\n\n job_to_send = job.to_hash(destination: 'oar-2.4-submission')\n Rails.logger.info \"Submitting #{job_to_send.inspect}\"\n\n result = @oarapi.create_job(job_to_send)\n\n job_uid = JSON.parse(result)['id']\n location_uri = uri_to(\n resource_path(job_uid),\n :in, :absolute\n )\n\n job = OAR::Job.expanded.includes(:job_types, :job_events, :gantt).find(job_uid)\n job.links = links_for_item(job)\n\n render_opts = {\n methods: %i[resources_by_type assigned_nodes],\n location: location_uri,\n status: 201\n }\n render_result(job, render_opts)\n end", "def index\n @jobs = Job.all\n\n render json: @jobs\n end", "def create\n @job = Job.new(job_params)\n \n respond_to do |format|\n if @job.save\n format.html { redirect_to '/admin/'+@job.company.id.to_s , notice: \"Job was successfully created.\" }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pending_job = PendingJob.new(pending_job_params)\n current_stage = 'E'\n @pending_job.time_queued = Time.now\n @pending_job.current_stage = current_stage\n @pending_job.current_stage_started = Time.now\n\n respond_to do |format|\n if @pending_job.save\n EFinishJob.perform_in(1.minutes, @pending_job.id, @pending_job.course, @pending_job.assignment, @pending_job.username)\n format.html { redirect_to @pending_job, notice: 'Pending job was successfully created.' }\n format.json { render :show, status: :created, location: @pending_job }\n else\n format.html { render :new }\n format.json { render json: @pending_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job = Job.new(job_params)\n @job.creator = current_user\n @job.tasks.each do |task|\n if @job.job_type.present?\n task.type = \"#{@job.job_type.to_s.singularize.capitalize}Task\"\n end\n task.creator = current_user\n task.worker ||= current_user\n task.payoff_amount_cents ||= 0\n end\n respond_to do |format|\n if @job.save\n @job.tasks.each{ |task| task.set_price }\n format.html {\n if params[:commit].to_s.match(/save.*new/i)\n redirect_to new_job_path(client_id: @job.client_id, job_type: @job.job_type), notice: 'Job was successfully created. Create another one below...' \n else\n redirect_to @job, notice: 'Job was successfully created.'\n end\n }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_to_queue\n @list = current_user.list\n if @list.add_job(params[:id])\n respond_to do |format|\n format.json { render :json => @list.jobs }\n end\n else\n flash[:errors] = \"Sorry, something went wrong\"\n redirect_to :back\n end\n end", "def create\n @job.user_id = current_user.id\n respond_to do |format|\n if @job.save\n format.html { redirect_to(@job, :notice => 'Job was successfully created.') }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n format.json { render :json => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n format.json { render :json => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @jobs = Job.new(params[:accepted_jobs])\n\n @jobs.user_id = current_user.id\n\n pp @jobs\n\n # respond_to do |format|\n # if @jobs.save\n # format.html { redirect_to home_path, notice: 'Request was successfully created.' }\n # format.json { render json: @jobs, status: :created, location: home_path }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @jobs.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @job = Job.new(job_params)\n @job.user_id = current_user.id\n @job.organization_id = current_user.organization_id\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @launched_job = LaunchedJob.new(launched_job_params)\n\n respond_to do |format|\n if @launched_job.save\n format.html { redirect_to @launched_job, notice: 'Launched job was successfully created.' }\n format.json { render json: @launched_job, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @launched_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job = Job.new(job_params.merge({\n owner_id: current_user_id,\n owner_name: current_user_name,\n user_id: current_user_db_record.id,\n remote: job_params[:remote]\n }))\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @act_job = ActJob.new(act_job_params)\n\n respond_to do |format|\n if @act_job.save\n format.html { redirect_to @act_job, notice: 'Act job was successfully created.' }\n format.json { render :show, status: :created, location: @act_job }\n else\n format.html { render :new }\n format.json { render json: @act_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_job_content_sample(client)\n job_multipart = {\n :file => File.new($full_path),\n 'num copies' => 10\n }\n\n response = client['jobs'].post job_multipart\n\n p ''\n p 'Submit a new job'\n p response\nend", "def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to job_url(@job) }\n format.xml { head :created, :location => job_url(@job) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors.to_xml }\n end\n end\n end", "def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to(@job, :notice => 'Job was successfully created.') }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def create\n @job_item = @job.job_items.build(params[:job_item])\n\n respond_to do |format|\n if @job_item.save\n format.html { redirect_to [@job, @job_item], notice: 'Job item was successfully created.' }\n format.json { render json: @job_item, status: :created, location: @job_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job = current_user.jobs.build(params[:job])\n if @job.save\n flash[:success] = \"Job Added!\"\n redirect_to root_url\n else\n render 'new'\n end\n\n end", "def create\n @job = Vger::Resources::Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to company_job(:company_id => params[:company_id], :id => @job.id), notice: 'Job was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def job_params\n params.require(:job).permit(:name, :client_id, :description, :quantity, :datein, :duedate, :completeper, :expectedin, :completed, :status, :comment)\n end", "def create\n @job = current_user.jobs.new( job_params )\n\n if @job.save\n redirect_to @job, notice: 'Job created.'\n else\n render :new\n end\n end", "def jobs_post(body, opts = {})\n data, status_code, headers = jobs_post_with_http_info(body, opts)\n return data\n end", "def create\n ensure_authenticated!\n\n job = Grid5000::Job.new(payload)\n Rails.logger.info \"Received job = #{job.inspect}\"\n raise BadRequest, \"The job you are trying to submit is not valid: #{job.errors.join(\"; \")}\" unless job.valid?\n job_to_send = job.to_hash(:destination => \"oar-2.4-submission\")\n Rails.logger.info \"Submitting #{job_to_send.inspect}\"\n\n url = uri_to(\n site_path(params[:site_id])+\"/internal/oarapi/jobs.json\", :out\n )\n http = EM::HttpRequest.new(url).post(\n :timeout => 20,\n :body => job_to_send.to_json,\n :head => {\n 'X-Remote-Ident' => @credentials[:cn],\n 'Content-Type' => media_type(:json),\n 'Accept' => media_type(:json)\n }\n )\n continue_if!(http, :is => [201,202])\n\n job_uid = JSON.parse(http.response)['id']\n location_uri = uri_to(\n resource_path(job_uid),\n :in, :absolute\n )\n\n job = OAR::Job.expanded.find(\n job_uid,\n :include => [:job_types, :job_events, :gantt]\n )\n job.links = links_for_item(job)\n \n render_opts = {\n :methods => [:resources_by_type, :assigned_nodes],\n :location => location_uri,\n :status => 201\n }\n respond_to do |format|\n format.g5kitemjson { render render_opts.merge(:json => job) }\n format.json { render render_opts.merge(:json => job) }\n end\n end", "def create\n @job = Job.new(job_params)\n\n if params[:job][:staff].present?\n params[:job][:staff].each do |s|\n @job.staff << Staff.where(id: s)\n end\n end\n if params[:job][:contractor].present?\n @job.contractor = Contractor.find(params[:job][:contractor])\n end\n if params[:job][:date_completed].present? and params[:job][:date_payment_recv].present? and params[:job][:date_completed] <= Time.now and params[:job][:date_payment_recv] <= Time.now\n @job.status = 0\n end\n puts @job.inspect\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job = @employer.jobs.build(job_params)\n respond_to do |format|\n if @job.save\n format.html { redirect_to edit_employer_path(@employer,anchor: \"jobs_tab\"), notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n flash[:notice] = 'Job Created' if @job_category.jobs.create params[:job]\n respond_with @job.job_category, @job\n end", "def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def get_jobs(url)\n result = JSON.parse(get_data(url))\n job_list = []\n result[\"jobs\"].each do |job|\n job = JenkinsJob.new job[\"name\"], job[\"color\"], job[\"url\"]\n job_list << job\n end\n job_list\nend", "def new\n @device = Device.find(params[:device_id]) \n @job = @device.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def job_params\n params.require(:job).permit(:name, :target, :current, :status)\n end", "def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to verify_job_url(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @job = Job.new(job_params)\n\n param_ids = params[:job][:param_ids]\n if param_ids\n param_ids.each do |param_id|\n @job.params << Param.find(param_id) unless param_id.blank? || param_id.to_i == 0\n end\n end\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render action: 'show', status: :created, location: @job }\n else\n format.html { render action: 'new' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job = Job.new(job_params)\n puts (@job.description)\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render action: 'show', status: :created, location: @job }\n else\n format.html { render action: 'new' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @worker_job = WorkerJob.new(worker_job_params)\n\n respond_to do |format|\n if @worker_job.save\n format.html { redirect_to @worker_job, notice: 'Worker job was successfully created.' }\n format.json { render action: 'show', status: :created, location: @worker_job }\n else\n format.html { render action: 'new' }\n format.json { render json: @worker_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job_folio = JobFolio.new(params[:job_folio])\n\n respond_to do |format|\n if @job_folio.save\n format.html { redirect_to @job_folio, notice: 'Job folio was successfully created.' }\n format.json { render json: @job_folio, status: :created, location: @job_folio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job_folio.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def create\n job = Job.find(params[:job_id])\n @saved_job = SavedJob.create(:job_id => params[:job_id], :user_id => current_user().id)\n\n respond_to do |format|\n if @saved_job.save\n format.html { redirect_to @saved_job, :notice => 'Saved job was successfully created.' }\n format.js\n format.json { render :json => @saved_job, :status => :created, :location => @saved_job }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @saved_job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @job = Job.new(job_params)\n if @job.save\n flash[:success] = 'Job was successfully created.'\n redirect_to @job \n else\n render :new\n end\n end", "def create\n @findjob = Findjob.new(findjob_params)\n\n respond_to do |format|\n if @findjob.save\n format.html { redirect_to @findjob, notice: 'Findjob was successfully created.' }\n format.json { render :show, status: :created, location: @findjob }\n else\n format.html { render :new }\n format.json { render json: @findjob.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n job = Job.new\n job.job_name = params[:job_name]\n job.description = params[:description]\n job.quote = params[:quote].to_f\n job.running_total = 0\n \n if job.save\n jobConnect = JobToUser.new\n jobConnect.job_id = job.id\n jobConnect.user_id = current_user.id\n jobConnect.save\n redirect_to(\"/services/show\", :notice => 'Job was successfully created.')\n else\n redirect_to(\"/services/show\", :notice => 'Job Failed to Save. Try Again Later.')\n end\n end", "def create\n # @nanny_job = NannyJob.new(nanny_job_params)\n @nanny_job = current_user.nanny_jobs.build(nanny_job_params)\n\n respond_to do |format|\n if @nanny_job.save\n format.html { redirect_to @nanny_job, notice: 'Nanny job was successfully created.' }\n format.json { render :show, status: :created, location: @nanny_job }\n else\n format.html { render :new }\n format.json { render json: @nanny_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def submit_batch_job(job_id)\n request_path = \"/jobs/#{job_id}/queue\"\n request_body = \"submit\"\n response = http.request_post(request_path, request_body)\n handle_response({ request_method: 'POST', request_path: request_path, request_body: request_body }, response)\n end", "def create\n job_id = ProductScraperJob.perform_async current_user.id, params[:url]\n respond_to do |format|\n format.html { redirect_to root_path, notice: \"Successfully queued..\" }\n format.json { render json: { id: job_id }.to_json }\n end\n end", "def create\n @printjob = Printjob.new(printjob_params)\n\n\n respond_to do |format|\n if @printjob.save\n format.html { redirect_to @printjob, notice: 'Printjob was successfully created.' }\n format.json { render :show, status: :created, location: @printjob }\n else\n format.html { render :new }\n format.json { render json: @printjob.errors, status: :unprocessable_entity }\n end\n end\n end", "def job_params\n params.require(:job).permit(:title, :description, :name, :email, :category, :deadline)\n end", "def create\n @emp_job = EmpJob.new(params[:emp_job])\n\n respond_to do |format|\n if @emp_job.save\n format.html { redirect_to @emp_job, notice: 'Emp job was successfully created.' }\n format.json { render json: @emp_job, status: :created, location: @emp_job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @emp_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_job(job)\n begin\n response = RestClient::Request.execute(\n method: :post,\n url: build_jobs_url,\n payload: job.to_codem_json,\n timeout: EBU::NETWORK_TIMEOUT,\n open_timeout: EBU::NETWORK_TIMEOUT\n )\n if response.code == 202\n if (obj = JSON.parse(response.to_str))\n obj[\"job_id\"]\n else\n raise \"Job #{job.id} was created on transcoder #{self.id}, but no job ID was returned.\"\n end\n else\n nil\n end\n rescue Timeout::Error => e\n nil\n rescue => e\n nil\n end\n end", "def create\n\n @customer_job = CustomerJob.new( customer_job_params )\n\n respond_to do |format|\n if @customer_job.save\n format.html { redirect_to customer_jobs_url, notice: 'Customer job was successfully created.' }\n format.json { render :show, status: :created, location: @customer_job }\n else\n format.html { render :new }\n format.json { render json: @customer_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @print_job = PrintJob.new(print_job_params)\n\n respond_to do |format|\n if @print_job.save\n format.html { redirect_to @print_job, notice: 'Print job was successfully created.' }\n format.json { render :show, status: :created, location: @print_job }\n else\n format.html { render :new }\n format.json { render json: @print_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @db_job = DbJob.new(db_job_params)\n\n respond_to do |format|\n if @db_job.save\n format.html { redirect_to @db_job, notice: 'Db job was successfully created.' }\n format.json { render :show, status: :created, location: @db_job }\n else\n format.html { render :new }\n format.json { render json: @db_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n @job = Job.new(job_params)\n\n if @job.save \n render 'jobs/create'\n end \n end", "def create\n @jobtype = Jobtype.new(params[:jobtype])\n \n if @jobtype.save\n render_json \"success\"\n else\n render_error \"failure\"\n end\n end", "def create\n @job_progress = JobProgress.new(job_progress_params)\n\n respond_to do |format|\n if @job_progress.save\n format.html { redirect_to @job_progress, notice: 'Job progress was successfully created.' }\n format.json { render :show, status: :created, location: @job_progress }\n else\n format.html { render :new }\n format.json { render json: @job_progress.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job = Job.new(job_params)\n respond_to do |format|\n if @job.save_series\n record_activity :create, @job\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n @job_type = JobType.find_by(id: @job.job_type_id)\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job = Job.new(job_params)\n @job.poster_id = current_user.id\n respond_to do |format|\n if @job.save\n\tformat.html { \n\t if session[:batch_job] == true\n\t redirect_to batch_job_path\n\t else\n\t redirect_to job_build_path(job_id: @job.id, id: :job_scope)\n\t end }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.74641937", "0.73064774", "0.70868206", "0.70318276", "0.7020725", "0.70076245", "0.69820875", "0.6932717", "0.6932393", "0.6921801", "0.690776", "0.6904804", "0.68841195", "0.68841195", "0.68841195", "0.6880201", "0.6878812", "0.68659544", "0.6856052", "0.6820773", "0.6802524", "0.6800804", "0.67782366", "0.6699477", "0.6675743", "0.66638595", "0.6657965", "0.66499007", "0.664411", "0.664411", "0.6639388", "0.6585875", "0.6580278", "0.6563387", "0.65632266", "0.65519947", "0.65470797", "0.65227", "0.6520522", "0.649927", "0.6492484", "0.64791805", "0.64784694", "0.64744866", "0.6463607", "0.6461046", "0.645945", "0.6449949", "0.6441076", "0.6440606", "0.64192486", "0.639435", "0.6389524", "0.63838416", "0.6378053", "0.6362768", "0.6361608", "0.63593835", "0.6354577", "0.6350836", "0.63418674", "0.6341601", "0.63388187", "0.6335929", "0.6334812", "0.6309098", "0.6296334", "0.6296334", "0.6296334", "0.6296334", "0.62901354", "0.6289007", "0.6286024", "0.6285204", "0.627709", "0.6275034", "0.6272077", "0.6267853", "0.62621814", "0.62621814", "0.62621814", "0.62621814", "0.6244258", "0.6242678", "0.62420696", "0.62357044", "0.6235201", "0.6229365", "0.6205252", "0.6205074", "0.620479", "0.61994207", "0.619894", "0.61986345", "0.61953866", "0.61947423", "0.6193481", "0.6191382", "0.617558", "0.61706126", "0.61699426" ]
0.0
-1
PATCH/PUT /jobs/1 PATCH/PUT /jobs/1.json
def update respond_to do |format| if @job.update(job_params) format.html { redirect_to @job, success: 'Job was successfully updated.' } format.json { render :show, status: :ok, location: @job } else format.html { render :edit } format.json { render json: @job.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n job = Job.find(params[:id])\n job.update_attributes(job_params)\n render json: job\n end", "def update\n @job = @user.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n begin\n @job_request = job_requests.find( params[ :id ] )\n rescue ActiveRecord::RecordNotFound\n @job_request = nil\n end\n\n respond_to do |format|\n if @job_request && @job_request.update_attributes( params[ :job_request ] )\n format.html { redirect_to root_path, notice: \"Job Requests Updated Successfully\"}\n format.json { head :no_content }\n else\n format.html { redirect_to root_path, notice: \"Update Failed\" }\n format.json { render json: @job_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @job = current_member.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(job_params)\n format.html { redirect_to @job, notice: 'The stuff you want done was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend", "def update\n @job = @user.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: \"Job was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to root_path, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_job(job:)\n response = HTTParty.put(\"#{@host}/api/jobs/#{job[:id]}\", body: {job: job, api_key: @api_key})\n \n return response.success?\n end", "def update\n @job = current_user.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = t('jobs_controller.update.success')\n format.html { redirect_to @job}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to app_jobs_path, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n byebug\n respond_to do |format|\n if @job.update(send(\"#{@job.type.underscore.to_sym}_params\"))\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to jobs_path, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job = @user.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to(@job, :notice => 'Job was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize!(@job)\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to mentor_job_path(@job), notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: \"Job was successfully updated.\" }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pending_job.update(pending_job_params)\n format.html { redirect_to @pending_job, notice: 'Pending job was successfully updated.' }\n format.json { render :show, status: :ok, location: @pending_job }\n else\n format.html { render :edit }\n format.json { render json: @pending_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, job)\n connection.put do |req|\n req.url \"job/#{id}\"\n req.body = job\n end\n end", "def update\n respond_to do |format|\n if @myjob.update(myjob_params)\n format.html { redirect_to @myjob, notice: 'Myjob was successfully updated.' }\n format.json { render :show, status: :ok, location: @myjob }\n else\n format.html { render :edit }\n format.json { render json: @myjob.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if UbiquoJobs.manager.update(params[:id], params[:job])\n flash[:notice] = t(\"ubiquo.jobs.job_edited\")\n format.html { redirect_to(ubiquo.jobs_path) }\n format.xml { head :ok }\n format.js\n else\n flash[:error] = t(\"ubiquo.jobs.cant_edit\")\n format.html { render :action => \"edit\" }\n format.xml { render :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n if @job.update_attributes(params[:job])\n response_message = {:message => \"Job updated successfully.\", :job => @job}\n else\n response_message = {:message => \"Job updation failed. Please try again!\"}\n end\n\n respond_to do |format|\n format.xml { render :xml => response_message }\n format.json { render :json => response_message }\n end\n end", "def update\n respond_to do |format|\n if @launched_job.update(launched_job_params)\n format.html { redirect_to @launched_job, notice: 'Launched job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @launched_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @job.update(job_params)\n @job.update(category: @category)\n @job.update(keywords: @keywords)\n render json: @job, status: :accepted\n else\n render json: @job.errors, status: :unprocessable_entity\n end\n end", "def update\n @job = Job.find(params[:id])\n @job.update({\n name: params[:job][:name],\n description: params[:job][:description],\n origin: params[:job][:origin],\n destination: params[:job][:destination],\n cost: params[:job][:cost],\n containers_needed: params[:job][:containers_needed]\n })\n\n if (@job)\n redirect_to url_for(:controller => :jobs, :action => :index)\n else\n redirect_to url_for(:controller => :jobs, :action => :edit)\n end\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n record_activity :update, @job\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to(@job, :notice => 'Job was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to(@job, :notice => 'Job was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully accepted.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @saved_job = SavedJob.find(params[:id])\n\n respond_to do |format|\n if @saved_job.update_attributes(params[:saved_job])\n format.html { redirect_to @saved_job, :notice => 'Saved job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @saved_job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n format.json { render :json => @job.errors, :status => :unprocessable_entity } \n end\n end\n end", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to(edit_admin_job_path(@job), :notice => 'Job was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @create_job.update(create_job_params)\n format.html { redirect_to @create_job, notice: 'job was successfully updated.' }\n format.json { render :show, status: :ok, location: @create_job }\n else\n format.html { render :edit }\n format.json { render json: @create_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job_item = @job.job_items.find(params[:id])\n\n respond_to do |format|\n if @job_item.update_attributes(params[:job_item])\n format.html { redirect_to [@job, @job_item], notice: 'Job item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to job_url(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors.to_xml }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n \n # todo:\n # add permission checking here\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize @job\n respond_to do |format|\n if @job.update(job_params)\n flash[:success] = t('flashes.update', model: Job.model_name.human)\n format.html { redirect_to @job}\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job_folio = JobFolio.find(params[:id])\n\n respond_to do |format|\n if @job_folio.update_attributes(params[:job_folio])\n format.html { redirect_to @job_folio, notice: 'Job folio was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_folio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n\n if @job.update_attributes(params[:job])\n flash[:success] = \"The job has been updated!\"\n redirect_to root_url\n end\n\n end", "def update\n respond_to do |format|\n if @act_job.update(act_job_params)\n format.html { redirect_to @act_job, notice: 'Act job was successfully updated.' }\n format.json { render :show, status: :ok, location: @act_job }\n else\n format.html { render :edit }\n format.json { render json: @act_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @saved_job.update(saved_job_params)\n format.html { redirect_to @saved_job, notice: t('saved_jobs_controller.saved_jobs_update_success') }\n format.json { render :show, status: :ok, location: @saved_job }\n else\n format.html { render :edit }\n format.json { render json: @saved_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def action_update\n if job_exists\n post_job(job_url)\n else\n post_job(new_job_url)\n end\nend", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update #:nodoc:\n job = Job.find(params[:id])\n job.enter(params[:status], params, request.headers)\n respond_with job, location: api_job_url(job)\n end", "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to edit_employer_path(@employer,anchor: \"jobs_tab\"), notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @device = Device.find(params[:device_id])\n @job = @device.jobs.find(params[:id])\n\n respond_to do |format|\n if !owner?(@job)\n flash[:error] = \"Dazu hast du keine Berechtigung!\"\n elsif @job.update_attributes(params[:job])\n ConflictHelper.delete_management(@device, @job.id-1)\n flash[:success] = \"Auftrag wurde erfolgreich geaendert\"\n format.html { redirect_to root_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @job = args[:job] if args.key?(:job)\n @status = args[:status] if args.key?(:status)\n end", "def update\n respond_to do |format|\n if @job_form.update(job_form_params)\n format.html { redirect_to @job_form, notice: 'Job form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @worker_job.update(worker_job_params)\n format.html { redirect_to @worker_job, notice: 'Worker job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @worker_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sfjob = Sfjob.find(params[:id])\n\n respond_to do |format|\n if @sfjob.update_attributes(params[:sfjob])\n format.html { redirect_to @sfjob, notice: 'Sfjob was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sfjob.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job_compact = JobCompact.find(params[:id])\n\n respond_to do |format|\n if @job_compact.update_attributes(params[:job_compact])\n format.html { redirect_to @job_compact, notice: 'Job compact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_compact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find(params[:id])\n case params[:status]\n when \"requested\"\n @job.status :requested\n when \"printed\"\n @job.status :printed\n when \"paid\"\n @job.status :paid\n end\n \n @job.save\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n job = Job.find(params[:id])\n\n Job.storage_fields.each do |field|\n job[field.to_sym] = params[field.to_sym]\n end\n\n respond_with job.save\n end", "def update\n #@jobapp = Jobapp.find(params[:id])\n\n respond_to do |format|\n if @jobapp.update_attributes(params[:jobapp])\n format.html { redirect_to @jobapp, notice: 'Jobapp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jobapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @db_job.update(db_job_params)\n format.html { redirect_to @db_job, notice: 'Db job was successfully updated.' }\n format.json { render :show, status: :ok, location: @db_job }\n else\n format.html { render :edit }\n format.json { render json: @db_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @failed_jobs = args[:failed_jobs] if args.key?(:failed_jobs)\n @job = args[:job] if args.key?(:job)\n end", "def update\n if @job.update( job_params )\n redirect_to @job, notice:'Job updated.'\n else\n render :edit\n end\n end", "def update\n @photo_job = PhotoJob.find(params[:id])\n\n respond_to do |format|\n if @photo_job.update_attributes(params[:photo_job])\n format.html { redirect_to @photo_job, :notice => 'Photo job was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @photo_job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @userjob.update(userjob_params)\n format.html { redirect_to @userjob, notice: 'Userjob was successfully updated.' }\n format.json { render :show, status: :ok, location: @userjob }\n else\n format.html { render :edit }\n format.json { render json: @userjob.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @job = args[:job] if args.key?(:job)\n end", "def update!(**args)\n @job = args[:job] if args.key?(:job)\n end", "def update\n @emp_job = EmpJob.find(params[:id])\n\n respond_to do |format|\n if @emp_job.update_attributes(params[:emp_job])\n format.html { redirect_to @emp_job, notice: 'Emp job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @emp_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @postjob.update(postjob_params)\n format.html { redirect_to @postjob, notice: 'Postjob was successfully updated.' }\n format.json { render :show, status: :ok, location: @postjob }\n else\n format.html { render :edit }\n format.json { render json: @postjob.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:job][:staff].present?\n @job.staff.clear\n params[:job][:staff].each do |s|\n @job.staff << Staff.where(id: s)\n end\n end\n if params[:job][:contractor].present?\n @job.contractor = Contractor.find(params[:job][:contractor])\n end\n if params[:job][:date_completed].present? and params[:job][:date_payment_recv].present? and params[:job][:date_completed] <= Time.now and params[:job][:date_payment_recv] <= Time.now\n @job.status = 0\n end\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_progress.update(job_progress_params)\n format.html { redirect_to @job_progress, notice: 'Job progress was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_progress }\n else\n format.html { render :edit }\n format.json { render json: @job_progress.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job_list = JobList.find(params[:id])\n\n respond_to do |format|\n if @job_list.update_attributes(params[:job_list])\n format.html { redirect_to @job_list, notice: 'Job list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @findjob.update(findjob_params)\n format.html { redirect_to @findjob, notice: 'Findjob was successfully updated.' }\n format.json { render :show, status: :ok, location: @findjob }\n else\n format.html { render :edit }\n format.json { render json: @findjob.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job.modifier = current_user\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job = Mugen::Job.update(params[:id])\n \n redirect_to mygengo_jobs_path\n end", "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job]) and !@job.hidden\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @job = Job.find_by_permalink!(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @scrapper_job.update(scrapper_job_params)\n\tformat.html { redirect_to @scrapper_job, notice: 'Scrapper job was successfully updated.' }\n\tformat.json { render :show, status: :ok, location: @scrapper_job }\n else\n\tformat.html { render :edit }\n\tformat.json { render json: @scrapper_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @training_active_job = Training::ActiveJob.find(params[:id])\n\n respond_to do |format|\n if @training_active_job.update_attributes(params[:training_active_job])\n format.html { redirect_to @training_active_job, notice: 'Active job was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @training_active_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @patch_jobs = args[:patch_jobs] if args.key?(:patch_jobs)\n end", "def update\n respond_to do |format|\n if @applicant_job.update(applicant_job_params)\n format.html { redirect_to @applicant_job, notice: 'Applicant job was successfully updated.' }\n format.json { render :show, status: :ok, location: @applicant_job }\n else\n format.html { render :edit }\n format.json { render json: @applicant_job.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.74817234", "0.7169015", "0.7167652", "0.7095741", "0.70942", "0.7070403", "0.70637274", "0.70637274", "0.70637274", "0.70577025", "0.7052269", "0.7050123", "0.70051134", "0.69992834", "0.6992486", "0.69848675", "0.6957225", "0.695623", "0.69412476", "0.6881211", "0.6875447", "0.6875447", "0.6875447", "0.6875447", "0.6875447", "0.6875447", "0.6875447", "0.6875447", "0.6875447", "0.6875447", "0.6875447", "0.6875447", "0.6875447", "0.6875447", "0.6851171", "0.6814396", "0.6810699", "0.67948735", "0.6780935", "0.67749554", "0.67534596", "0.6743507", "0.6742249", "0.67286336", "0.67063385", "0.67004853", "0.66928244", "0.66788876", "0.66788876", "0.6668043", "0.6644724", "0.6642202", "0.6637648", "0.6636466", "0.6633828", "0.66098607", "0.66094744", "0.66055816", "0.6590327", "0.6590327", "0.6590327", "0.65703845", "0.6563089", "0.65362436", "0.65168715", "0.65117073", "0.6510017", "0.65037245", "0.6486759", "0.64718884", "0.64454156", "0.64174354", "0.6415834", "0.64136904", "0.63859147", "0.6382526", "0.6379508", "0.63640344", "0.635488", "0.6339515", "0.63355535", "0.63310117", "0.63287604", "0.6326657", "0.63261306", "0.63261306", "0.6323815", "0.6319222", "0.6308361", "0.6299931", "0.628535", "0.6279507", "0.62709117", "0.62682486", "0.6233628", "0.6228757", "0.62186044", "0.62057424", "0.6205387", "0.62018365" ]
0.68443346
35
DELETE /jobs/1 DELETE /jobs/1.json
def destroy @job.destroy respond_to do |format| format.html { redirect_to jobs_url, success: 'Job was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(id)\n connection.delete do |req|\n req.url \"job/#{id}\"\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job = current_member.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def delete\n job_resource.delete\n end", "def destroy \n @job = Mugen::Job.delete(params[:id])\n \n respond_to do |format|\n format.html { redirect_to(mygengo_jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n Job.destroy(params[:id])\n end", "def destroy\n @job = @user.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @job = @user.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to :dashboard, notice: \"Job was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @job = @user.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to :dashboard, notice: 'Job was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @launched_job.destroy\n respond_to do |format|\n format.html { redirect_to launched_jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_with Job.find(params[:id]).delete\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to mentor_jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job = current_user.posted_jobs.find(params[:id])\n @job.try(:destroy)\n render json: {}\n end", "def destroy\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to app_jobs_path, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @saved_job = SavedJob.find(params[:id])\n @saved_job.destroy\n\n respond_to do |format|\n format.html { redirect_to saved_jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n authorize!(@job)\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.xml { head :ok }\n end\n end", "def destroy\n if UbiquoJobs.manager.delete(params[:id])\n flash[:notice] = t(\"ubiquo.jobs.job_removed\")\n else\n flash[:error] = t(\"ubiquo.jobs.cant_remove\")\n end\n\n respond_to do |format|\n format.html { redirect_to(ubiquo.jobs_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job_item = @job.job_items.find(params[:id])\n @job_item.destroy\n\n respond_to do |format|\n format.html { redirect_to [@job] }\n format.json { head :ok }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to client_path(@job.client), notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job = Job.destroy(params[:id])\n redirect_to jobs_path\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n redirect_to root_url\n end", "def destroy\n @myjob.destroy\n respond_to do |format|\n format.html { redirect_to myjobs_url, notice: 'Myjob was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to @job, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @saved_job.destroy\n respond_to do |format|\n format.html { redirect_to saved_jobs_url, notice: t('saved_jobs_controller.saved_jobs_delete_success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @db_job.destroy\n respond_to do |format|\n format.html { redirect_to db_jobs_url, notice: 'Db job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_jobs(job_ids)\n\n job_ids.each do |id|\n api_url = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs/#{id}/erase\"\n\n begin\n response = RestClient::Request.new(\n :method => :post,\n :url => api_url,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n if response != nil && response.code == 204\n puts \"delete job #{id} => success\"\n else\n puts \"delete job #{id} => failed\"\n end\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"delete job artifacts #{id} => error\"\n end\n\n end\n\nend", "def destroy\n @job.destroy\n respond_to do |format|\n flash[:success] = \"Job successfully destroyed\"\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n redirect_to jobs_path\n end", "def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: \"Job was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete_job(sid)\n\t\t\tresponse = connection.delete(\"search/jobs/#{sid}\")\n\t\t\treturn_error_or_body(response, response.body)\n\t\tend", "def destroy\n @sfjob = Sfjob.find(params[:id])\n @sfjob.destroy\n\n respond_to do |format|\n format.html { redirect_to sfjobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pending_job.destroy\n respond_to do |format|\n format.html { redirect_to pending_jobs_url, notice: 'Pending job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @worker_job.destroy\n respond_to do |format|\n format.html { redirect_to worker_jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_status = JobStatus.find(params[:id])\n @job_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_job_statuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @act_job.destroy\n respond_to do |format|\n format.html { redirect_to act_jobs_url, notice: 'Act job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job.destroy\n redirect_to jobs_path, notice:'Job deleted.'\n end", "def destroy\n @job_title = JobTitle.find(params[:id])\n @job_title.destroy\n\n respond_to do |format|\n format.html { redirect_to job_titles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @import_job.destroy\n respond_to do |format|\n format.html { redirect_to import_jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @create_job.destroy\n respond_to do |format|\n format.html { redirect_to create_jobs_url, notice: 'Create job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_folio = JobFolio.find(params[:id])\n @job_folio.destroy\n\n respond_to do |format|\n format.html { redirect_to job_folios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @job_detail.destroy\n respond_to do |format|\n format.html { redirect_to job_job_details_url, notice: 'Job detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_job name\n\t\t\tputs \"==> Deleting job: '#{name}'\"\n\t\t\tRestClient.post(\"#{@jenkins_host}:#{@jenkins_port}/job/#{name}/doDelete\", {}){ |response, request, result, &block|\n\t\t\t\tif [301, 302, 307].include? response.code\n \t\t\t\t\tresponse.follow_redirection(request, result, &block)\n \t\t\t\telse\n \t\t\t\tresponse.return!(request, result, &block)\n \t\t\t\tend\n \t\t\t}\n \t\t\treturn true\n\t\tend", "def destroy\n ensure_authenticated!\n job = OAR::Job.find(params[:id])\n authorize!(job.user)\n\n url = uri_to(\n site_path(\n params[:site_id]\n )+\"/internal/oarapi/jobs/#{params[:id]}.json\",\n :out\n )\n http = EM::HttpRequest.new(url).delete(\n :timeout => 5,\n :head => {\n 'X-Remote-Ident' => @credentials[:cn],\n 'Accept' => media_type(:json)\n }\n )\n\n continue_if!(http, :is => [200,202,204,404])\n\n if http.response_header.status == 404\n raise NotFound, \"Cannot find job##{params[:id]} on the OAR server\"\n else\n response.headers['X-Oar-Info'] = (\n JSON.parse(http.response)['oardel_output'] || \"\"\n ).split(\"\\n\").join(\" \") rescue \"-\"\n\n location_uri = uri_to(\n resource_path(params[:id]),\n :in, :absolute\n )\n\n render :text => \"\",\n :head => :ok,\n :location => location_uri,\n :status => 202\n end\n end", "def destroy\n @job_progress.destroy\n respond_to do |format|\n format.html { redirect_to job_progresses_url, notice: 'Job progress was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n job = Job.find(params[:id])\n job.destroy\n respond_with job do |format|\n format.html { redirect_to jobs_path }\n end\n end", "def destroy\n #@jobapp = Jobapp.find(params[:id])\n @jobapp.destroy\n\n respond_to do |format|\n format.html { redirect_to jobapps_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 destroy\n @job_list = JobList.find(params[:id])\n @job_list.destroy\n\n respond_to do |format|\n format.html { redirect_to job_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @emp_job = EmpJob.find(params[:id])\n @emp_job.destroy\n\n respond_to do |format|\n format.html { redirect_to emp_jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @postjob.destroy\n respond_to do |format|\n format.html { redirect_to postjobs_url, notice: 'Postjob was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_runner.destroy\n\n respond_to do |format|\n format.html { redirect_to(job_runners_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @job = Job.find_by_job_number(params[:id])\n if admin?\n @job.destroy\n end\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end", "def destroy\n @job_compact = JobCompact.find(params[:id])\n @job_compact.destroy\n\n respond_to do |format|\n format.html { redirect_to job_compacts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @training_active_job = Training::ActiveJob.find(params[:id])\n @training_active_job.destroy\n\n respond_to do |format|\n format.html { redirect_to training_active_jobs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @jobshistory.destroy\n respond_to do |format|\n format.html { redirect_to jobshistories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @job\n @job.destroy\n respond_to do |format|\n flash[:success] = t('flashes.destroy', model: Job.model_name.human)\n format.html { redirect_to jobs_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @job_posting.destroy\n respond_to do |format|\n format.html { redirect_to job_postings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @userjob.destroy\n respond_to do |format|\n format.html { redirect_to userjobs_url, notice: 'Userjob was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @findjob.destroy\n respond_to do |format|\n format.html { redirect_to findjobs_url, notice: 'Findjob was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @job = Job.find(params[:id])\n if @job.destroy\n response_message = {:message => \"Job deleted successfully.\", :job => @job}\n else\n response_message = {:message => \"Job deletion failed. Please try again!\"}\n end\n\n respond_to do |format|\n format.xml { render :xml => response_message }\n format.json { render :json => response_message }\n end\n end", "def destroy\n @job_notification = JobNotification.find(params[:id])\n @job_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to job_notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_request.destroy\n respond_to do |format|\n format.html { redirect_to @deal, notice: 'Job request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @joborder = Joborder.find(params[:id])\n @joborder.destroy\n\n respond_to do |format|\n format.html { redirect_to joborders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nanny_job.destroy\n respond_to do |format|\n format.html { redirect_to nanny_jobs_url, notice: 'Nanny job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @jobtype = Jobtype.find(params[:id])\n if @jobtype.destroy\n render_json \"success\"\n else\n render_error \"failure\"\n end\n end", "def destroy\n @job_assignment = @group.jobs.find(params[:id])\n @job_assignment.destroy\n\n respond_to do |format|\n format.html { redirect_to group_jobs_path(@group) }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, @db_job_status\n @db_job_status.destroy\n respond_to do |format|\n format.html { redirect_to db_job_statuses_url, notice: 'Db job status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @jobsite.destroy\n respond_to do |format|\n format.html { redirect_to jobsites_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.77455926", "0.7700092", "0.76760954", "0.76760954", "0.76760954", "0.76760954", "0.7675618", "0.7674465", "0.7658132", "0.7643448", "0.76179034", "0.7559175", "0.75548303", "0.75477374", "0.7545383", "0.7539608", "0.753705", "0.75200063", "0.7508049", "0.7505697", "0.74647886", "0.7459004", "0.7456986", "0.74404657", "0.7422022", "0.740733", "0.740733", "0.740733", "0.740733", "0.740733", "0.740733", "0.740733", "0.740733", "0.74072737", "0.73871607", "0.7385222", "0.73797566", "0.7364831", "0.73601925", "0.7351342", "0.7351342", "0.7351342", "0.7351342", "0.7351342", "0.7351342", "0.7351342", "0.7351342", "0.7351342", "0.7351342", "0.7351342", "0.7351342", "0.7351342", "0.7323667", "0.73065096", "0.72900105", "0.7287286", "0.72479767", "0.72449243", "0.7241558", "0.72205496", "0.722007", "0.7205479", "0.7195967", "0.7179834", "0.7178375", "0.7173325", "0.7171673", "0.7125182", "0.7123106", "0.7116549", "0.71135086", "0.70828915", "0.707219", "0.70720154", "0.70682186", "0.7064315", "0.7047263", "0.70348203", "0.70312977", "0.7026718", "0.7020905", "0.7015685", "0.7011992", "0.7011949", "0.70102936", "0.70058125", "0.699981", "0.69891316", "0.6986108", "0.6979218", "0.69605273", "0.6959628", "0.6939072", "0.6934046", "0.6908006", "0.6897568", "0.687522", "0.687013", "0.68481004", "0.6836521" ]
0.7275973
56
Use callbacks to share common setup or constraints between actions.
def set_job @job = Job.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 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 setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\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 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 startcompany(action)\n @done = true\n action.setup\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 setup\n #implement in subclass;\n end", "def after_set_callback; 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 setup(easy)\n super\n easy.customrequest = @verb\n end", "def around_hooks; 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 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 shared_action(name, &block)\n @controller.shared_actions[name] = 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", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.53314966", "0.53114754", "0.52984965", "0.52977055", "0.5296272", "0.5260649", "0.5245076", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.5235081", "0.52321917", "0.5228592", "0.5220735", "0.52198535", "0.52139324", "0.5208539", "0.5206585", "0.5178542", "0.5175199", "0.5173538", "0.5167041", "0.51614195", "0.51577675", "0.5153909", "0.51528823", "0.5152225", "0.51429904", "0.5141399", "0.51345575", "0.51145", "0.5114052", "0.5114052", "0.5110216", "0.5108656", "0.50935394", "0.5089196", "0.5081936", "0.5079627", "0.50675833", "0.5056105", "0.5053687", "0.5050475", "0.5050475", "0.503471", "0.5028311", "0.501982", "0.50157547", "0.5013552", "0.50014806", "0.50011593", "0.49976763", "0.4990292", "0.4990292", "0.49882022", "0.4981269", "0.49792367", "0.49766538", "0.4967978", "0.49667212", "0.4958987", "0.49572337", "0.49550423", "0.4954479", "0.4952353", "0.494726", "0.4944055", "0.4935437", "0.4931248", "0.49283475", "0.49281213", "0.49268973", "0.4921738", "0.49204507", "0.4918924", "0.49182287", "0.4916538", "0.49158585", "0.49156788" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def job_params params.require(:job).permit(:started_at, :user_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
Use callbacks to share common setup or constraints between actions.
def set_activity # @user = User.find(params[:user_id]) @activity = Activity.find(params[:id]) rescue ActiveRecord::RecordNotFound render json: { message: 'no activity matches that ID' }, status: 404 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
Only allow a trusted parameter "white list" through.
def activity_params params.require(:activity).permit(:name, :category, :hours_spent, :date) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "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 filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n 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 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 [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\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 filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "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 additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; 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 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 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 paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\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 filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\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 argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\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 sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\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 special_device_list_params\n params.require(:special_device_list).permit(:name)\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" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
Completely cover if user updates any fields and handle Oauth all in one
def update_or_create(attributes) if user.nil? create_user(attributes) else user.update_attributes(attributes) end user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_using_auth o\n\t\tself.user_id = o.info.user_id\n\t\tself.login_name = o.info.profile.login_name\n\t\tself.email = o.info.email\n\t\tself.join_tsz = o.info.profile.join_tsz\n\t\tself.transaction_buy_count = o.info.profile.transaction_buy_count\n\t\tself.transaction_sold_count = o.info.profile.transaction_sold_count\n\t\tself.is_seller = o.info.profile.is_seller\n\t\tself.location = o.info.profile.lon ? [o.info.profile.lon, o.info.profile.lat] : nil\n\t\tself.image_url = o.info.profile.image_url_75x75\n\t\tself.country_id = o.info.profile.country_id\n\t\tself.gender = o.info.profile.gender\n\t\tself.oauth_token = o.extra.access_token.token\n\t\tself.oauth_token_secret = o.extra.access_token.secret\n\t\tsave\n\t\tself\n\tend", "def update\n @user = User.find(params[:id])\n if @user.openid_url.nil? || @user.openid_url.blank?\n handle_traditional_update\n else\n handle_openid_update\n end\n \n end", "def update\n user = User.find(params[:id])\n if @current_user._id == user._id\n if params[:user][:current_password]\n if @current_user.authenticate(params[:user][:current_password])\n if params[:user][:password] == params[:user][:password_confirmation]\n @current_user.update!(params.require(:user).permit(:password))\n auditLog(@current_user, nil, :UPDATE_COMPANY_USER, \"User: #{@current_user.name}/#{@current_user.email} password updated\")\n render json: { user: @current_user, token: @current_user.auth_token }, methods: [:type, :firstName, :lastName]\n else\n render :json => {error: I18n.t(:passwords_dont_match)}, :status => :bad_request\n end\n else\n render :json => {error: I18n.t(:invalid_pw)}, :status => :bad_request\n end\n else\n\n if @current_user.name != params[:user][:name].to_s || @current_user.email != params[:user][:email].to_s.downcase\n oldName = @current_user.name\n oldEmail = @current_user.email\n @current_user.assign_attributes(params.require(:user).permit(:name, :email))\n if @current_user.valid?\n @current_user.save\n render json: { user: @current_user, token: @current_user.auth_token }, methods: [:type, :firstName, :lastName]\n else\n render :json => {error: \"A user with that email already exists on our system. Please choose another email address.\"}, :status => :bad_request\n end\n else\n render json: { user: @current_user, token: @current_user.auth_token }, methods: [:type, :firstName, :lastName]\n end\n end\n else\n render :json => {error: I18n.t(:invalid_user)}, :status => :unauthorized\n end\n end", "def update\n @user = User.find(current_user.id)\n # email_changed = @user.email != params[:user][:email]\n is_facebook_account = !@user.provider.blank?\n\n successfully_updated = if !is_facebook_account\n @user.update_with_password(allowed_params)\n else\n @user.update_without_password(allowed_params)\n end\n\n if successfully_updated\n # Sign in the user bypassing validation in case his password changed\n # sign_in @user, :bypass => true\n redirect_to registration_path\n else\n redirect_to registration_path \n end\n end", "def update_user\n end", "def update\n return redirect_to :h_1 unless params[:user]\n\n if params[:user][:username]\n allow = User.username_allowed(params[:user][:username], :current_user => current_user)\n params[:user][:username] = allow[:allowed] ? allow[:regular] : \"\"\n end\n \n condition = params[:user][:username] || params[:user][:email] || params[:user][:password]\n \n updated = current_user.update_attributes params[:user] if !condition\n updated = current_user.update_with_password params[:user] if condition\n \n unless updated\n @errors = current_user.errors\n #cookies[:flavour] = current_user.flavour#why?\n end\n if updated\n set_current_locale current_user.locale\n set_current_time_zone current_user.time_zone\n end\n redirect_to request.referrer\n end", "def edit\n change = false\n user = User.find(params[:id])\n if not params[\"first_name\"].nil? and !params[\"first_name\"].blank?\n change = true\n user.login.update(first_name: params[\"first_name\"])\n end\n if not params[\"last_name\"].nil? and !params[\"last_name\"].blank?\n change = true\n user.login.update(last_name: params[\"last_name\"])\n end\n if not params[\"password\"].nil? and !params[\"password\"].blank?\n change = true\n user.login.update(password: params[\"password\"])\n end\n if not params[\"middle_initial\"].nil? and !params[\"middle_initial\"].blank?\n change = true\n user.login.update(middle_initial: params[\"middle_initial\"])\n end\n if not params[\"login_type\"].nil? and !params[\"login_type\"].blank?\n change = true\n user.login.update(login_type: params[\"login_type\"].to_i)\n end\n if not params[\"username\"].nil? and !params[\"username\"].blank?\n change = true\n user.login.update(username: params[\"username\"])\n end\n if not params[\"email\"].nil? and !params[\"email\"].blank?\n change = true\n user.login.update(email: params[\"email\"])\n end\n if not params[\"login_type\"].nil? and !params[\"login_type\"].blank?\n change = true\n user.login.update(login_type: params[\"login_type\"])\n end\n #@user.login.update(updated_at: DateTime.now)\n\n if not params[\"program\"].nil? and !params[\"program\"].blank?\n change = true\n user.update(program: params[\"program\"])\n end\n if not params[\"status\"].nil? and !params[\"status\"].blank?\n change = true\n user.update(status: params[\"status\"])\n end\n if change\n respond_to do |format|\n format.html { redirect_to user, notice: 'User was updated successfully.' }\n end\n end\n end", "def update\n \n oldUser = User.find(current_user.id)\n @user = User.find(current_user.id)\n\n successfully_updated = if needs_password?(@user, account_update_params)\n @user.update_with_password(account_update_params)\n else\n # remove the virtual current_password attribute update_without_password\n # doesn't know how to ignore it\n params[:user].delete(:current_password)\n @user.update_without_password(account_update_params)\n end\n\n if successfully_updated\n \n ## Move the user profile photo from tmp to user directory\n if @user.profile_photo!=\"\"\n move_tmp_user_photo(@user)\n end\n \n #update latitude longitude here ...\n if @user.user_type == \"fan\" || @user.user_type == \"artist\"\n #//check if the address has been changed\n addressChanged = !((oldUser.country_id == @user.country_id) && (oldUser.state_id == @user.state_id) && (oldUser.zip ==@user.zip) && (oldUser.city == @user.city))\n if addressChanged\n fullAddress = \"\"\n countryName = \"\"\n stateName = \"\"\n if @user.country_id.to_i > 0\n countryRow = Country.where(\"id = ? \",@user.country_id.to_i).take\n if countryRow != nil\n countryName = countryRow.country_name\n end\n end\n \n if @user.state_id.to_i > 0\n stateRow = State.where(\"id = ? \",@user.state_id.to_i).take\n if stateRow != nil\n stateName = stateRow.state_name\n end\n end\n \n if @user.zip.to_s != \"\"\n fullAddress = URI.encode(@user.zip)\n end\n \n if @user.city.to_s !=\"\"\n if fullAddress.blank?\n fullAddress = URI.encode(@user.city)\n else\n fullAddress += \",\"+URI.encode(@user.city)\n end \n end\n \n if stateName !=\"\"\n if fullAddress.blank?\n fullAddress = URI.encode(stateName)\n else\n fullAddress += \",\"+URI.encode(stateName)\n end \n end\n \n if countryName !=\"\"\n if fullAddress.blank?\n fullAddress = URI.encode(countryName)\n else\n fullAddress += \",\"+URI.encode(countryName)\n end \n end\n \n #render text: fullAddress and return\n if !fullAddress.blank?\n lat_long = Geocoder.coordinates(fullAddress)\n cUser = User.find(@user.id);\n if lat_long!=nil\n cUser.update_attributes(:latitude => lat_long[0],:longitude => lat_long[1])\n end \n end \n end \n end\n \n set_flash_message :notice, :updated\n # Sign in the user bypassing validation in case his password changed\n sign_in @user, :bypass => true\n redirect_to after_update_path_for(@user)\n else\n render \"edit\"\n end\n end", "def update\n params[:user].reject! { |k,v|\n !['name','email','facebook_uid'].include?k || (k=='password' && v != '' && v == params[:password_verify])\n }\n @user = User.find(current_user.id)\n\n respond_to do |format|\n if params[:user]['facebook_uid'] and params[:user]['facebook_uid'] != \"\"\n params[:user].delete 'facebook_uid' if current_facebook_user.nil? or current_facebook_client.nil? or current_facebook_user.id != params[:user]['facebook_uid']\n end\n if @user.update_attributes(params[:user])\n if @user.facebook_uid and current_facebook_user and current_facebook_client\n if current_facebook_user.id == @user.facebook_uid\n @user.facebook_session_key = current_facebook_client.access_token\n end\n end\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def change_info\n if params.include?(:token) and params.include?(:name) and params.include?(:address) and params.include?(:email) and params.include?(:description)\n if User.exists?(:token => params[:token])\n user_temp = {:name => params[:name], :address => params[:address], :email => params[:email], :description => params[:description]}\n user = User.find_by(:token => params[:token])\n if user.update user_temp\n success = true\n message = 'Updated successfully'\n else\n success = false\n message = 'Something wrong happened with database'\n end\n else\n success = false\n message = 'Token does not exist'\n end\n else\n success = false\n message = 'Please check your parameters again'\n end\n result = {:success => success, :message => message}\n render json: result\n end", "def update\n # @user = User.find(params[:id])\n @user = current_user # makes our views \"cleaner\" and more consistent\n params[:user][:existing_identity_attrs] ||= {}\n unless configatron.user_can_change_login\n params[:user].delete(:login)\n @user_login_is_readonly = true\n end\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Account updated!\"\n format.html { redirect_to account_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_user\n\n ## Update other fields\n %w(billing_cycle billing_cycle_start_date is_profile_complete is_verified_email approval_status).each do |f|\n params[:user].delete(f)\n end\n\n @user.is_profile_complete = 'yes'\n if @user.update_attributes(params[:user])\n sign_in @user, :bypass => true\n respond_to do |format|\n format.json { render :json => {\"user\" => @user.as_json}, :status => :created }\n end\n else ## error when save\n respond_to do |format|\n format.json { render json: @user.errors.full_messages, :status => :bad_request }\n end\n end\n end", "def update\n if params[:commit] == \"Update\"\n super\n elsif params[:commit] == \"Cancel my account\"\n if current_user.valid_password?(params[:user][:current_password])\n kill_user(current_user)\n destroy\n else\n # I don't know how rails is doing that nice effect, so I basically have this dirty hack here...\n clean_up_passwords current_user\n params[:commit] = \"Update\"\n update\n end\n end\n end", "def update\n #\n # Update Record / Change Password\n #\n if token_present? && @current_account\n if @current_account.email != params[:id]\n return render_error(422, :WRONG_PARAM, \"email\")\n end\n # Do any privileged operations here, we're authenticated\n # IE update name, update email?, update password\n update_account_authenticated\n #\n # ResetPassword/Confirm Account\n #\n else\n # Not authenticated...couple things we could be trying to do\n @account = Account.first_by_email(params[:id])\n if @account.nil?\n # No account found\n render_error_modelname(404, :MISSING_RECORD, User)\n #resend confirmation token (and regenerate token if expired)\n elsif params['resend'].present?\n update_resend_account\n #if the confirmation token has expired, error out\n elsif !@account.confirmed? && @account.send(:confirmation_period_expired?)\n render_error(401, \"Confirmation Token Expired\")\n elsif !@account.confirmed? && (params[:confirmation_token].present? || params[:old_password].present?)\n # Unconfirmed accounts\n # Confirming and setting name and password details\n update_and_confirm_account\n elsif @account.confirmed? && params[:reset_password_token]\n update_and_reset_password\n else\n name = \"User=#{params[:id]}\"\n log_security_unauthorized_alert_message(\"User\", name, \"not authenticated\")\n render_error(401, :UNAUTHORIZED)\n end\n end\n end", "def update\n\t\tget_current_user\n\t\t@user = User.find(params[:id])\n\n\t\treturn (render json: {errors: [\"Je bent niet geauthoriseerd om dit te doen\"]}, status: :unprocessable_entity) unless (@current_user.isAdmin || @current_user.id == @user.id)\n\n\t respond_to do |format|\n\t if @user.update_attributes(params[:user])\n\t \tnew_remember_token(@user) if @current_user.isStudent\n\t format.json { head :no_content }\n\t else\n\t format.json { render json: {errors: @user.errors.full_messages}, status: :unprocessable_entity }\n\t end\n\t end\n\tend", "def update\n if user_params[:password].blank?\n user_params.delete(:password)\n user_params.delete(:password_confirmation)\n end\n\n if needs_password?(current_user, user_params)\n save = current_user.update(user_params)\n else\n save = current_user.update_without_password(user_params)\n end\n\n respond_to do |format|\n if save\n format.html { redirect_to current_user.url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_user\n current_user.update_last_access if current_user && signed_in?\n end", "def update_with_password(params, *options)\n if authentications.present?\n update_attributes(params, *options)\n else\n super\n end\n end", "def update\n puts \"current user\"\n puts @user.id\n puts current_user.id\n if current_user.admin || @user.id == current_user.id\n if user_params['is_disabled']\n @user.tokens = nil\n end\n if @user.update(user_params)\n render json: @user\n else\n puts @user.errors.full_messages\n render json: @user.errors, status: :unprocessable_entity\n end\n else\n render json: @user.errors, status: :bad_request\n end\n end", "def user_update_me(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: UserApi#user_update_me ... opts: #{opts}\"\n end\n\n # resource path\n path = \"/user\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\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', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n form_params[\"firstname\"] = opts[:'firstname'] if opts[:'firstname']\n form_params[\"lastname\"] = opts[:'lastname'] if opts[:'lastname']\n form_params[\"oldPassword\"] = opts[:'old_password'] if opts[:'old_password']\n form_params[\"newPassword\"] = opts[:'new_password'] if opts[:'new_password']\n form_params[\"newPasswordConfirm\"] = opts[:'new_password_confirm'] if opts[:'new_password_confirm']\n form_params[\"country\"] = opts[:'country'] if opts[:'country']\n form_params[\"pgpPubKey\"] = opts[:'pgp_pub_key'] if opts[:'pgp_pub_key']\n\n # http body (model)\n post_body = nil\n\n\n auth_names = []\n result = @api_client.call_api(:PUT, 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 => 'User')\n if Configuration.debugging\n Configuration.logger.debug \"API called: UserApi#user_update_me. Result: #{result.inspect}\"\n end\n return result\n end", "def update\n @user = User.find(params[:id])\n #update_status = @user.update_attributes(params[:user])\n #update_message = \"User was successfully updated.\"\n\n if params[:origin] == \"password-set\"\n #update_status = @user.update_with_password(params[:user])\n update_status = @user.update_attributes(:password => params[:user][\"password\"], :password_confirmation => params[:user][\"password_confirmation\"])\n update_message = \"Password successfully updated.\"\n @password_update = true\n else\n update_status = @user.update_attributes(params[:user])\n update_message = \"User was successfully updated.\"\n end\n respond_to do |format|\n if update_status\n format.html { redirect_to (can? :read, User) ? users_path : user_path(@user), notice: update_message }\n format.js\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.js\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n puts 'ENTROU NO UPDATE USER'\n return vinculate_user unless params[:vincular].nil?\n\n update_password\n end", "def update\n respond_to do |format|\n\n @user.email = user_params[:email]\n @user.publicvisible = user_params[:publicvisible]\n @user.realname = user_params[:realname]\n if user_params[:password] != '*'\n @user.password = user_params[:password]\n else\n @user.password = nil\n end\n\n\n begin\n status = @user.save\n rescue ActiveResource::UnauthorizedAccess\n status = false\n end\n\n if status\n format.html { redirect_to edit_profile_path, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to @user, alert: \"Could not update\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @title = \"Edit basic info\"\n @user=User.find(session[:user_id])\n if param_posted?(:user)\n attribute = params[:attribute]\n case attribute\n when \"email\"\n try_to_update @user, attribute\n when \"password\"\n if @user.correct_password?(params)\n try_to_update @user, attribute\n else\n @user.password_errors(params)\n end\n when \"team_id\"\n try_to_update @user, attribute\n end\n end \n #For security purpose, never fill in password fields automatically.\n @user.clear_password!\n end", "def update\n#\t\t@newform = false \n\n=begin\t\tif params[:user] && params[:user][:newform] && params[:user][:newform] == true\n\t\t\t@newform = true\n\t\tend\n=end\n\n unless ( (id = params[:id]) && ( (id == session[:user_id]) || (User.find(session[:user_id]).site_admin) ) )\n id = session[:user_id]\n end\n @user = User.find(id)\n\t\t@request_uri = edit_user_url(id)\n @user.email_confirmation = params[:user][:email_confirmation]\n\t\tbegin\n\t\t\tunless @user.twitter_user\n\t\t\t\t@user_twitter_authorized = false\t\t\t\t\n\t\t\telse\n\t\t\t\tuser_client = client(false, false, nil)\n\t\t\t\t@twit_user = user_client.verify_credentials\n\t\t\t\t@user_twitter_authorized = true\t\t\t\t\n\t\t\tend\t\t\n\t\trescue\n\t\t\t\t@user_twitter_authorized = false\n\t\tend \n \n \n # if they have flipped whether they want messages or not\n\t\tif @user.twitter_user && params[:twitter_user] && params[:twitter_user][:twitter_replies] && ((params[:twitter_user][:twitter_replies] == \"0\" && @user.twitter_user.opt_out_of_messages == false) ||(params[:twitter_user][:twitter_replies] == \"1\" && @user.twitter_user.opt_out_of_messages == true))\n\t\t @user.twitter_user.opt_out_of_messages = !@user.twitter_user.opt_out_of_messages\n\t\t @user.twitter_user.save\n\t end\n\t\t\n \n \n\t\t# Hash the password before putting it into DB\n\t\t\n\t\tif params[:user] && params[:user][:password] && params[:user][:password] != '' && params[:user][:password] != nil\n\t\t \n\t\t #see if a salt exists\n random = ActiveSupport::SecureRandom.hex(10)\n salt = Digest::SHA2.hexdigest(\"#{Time.now.utc}#{random}\")\n salted_password = Digest::SHA2.hexdigest(\"#{salt}#{params[:user][:password]}\")\n params[:user][:password_salt] = salt\n\t\t\tparams[:user][:password] = salted_password\n\t\telse\n\t\t\tif @user.status == 'pending'\n\t\t\t\t#set password to nil if user is activating so that they are required to put a password\n\t\t\t\tparams[:user][:password] = nil\n\t\t\telse\n\t\t\t\tparams[:user][:password] = @user.password\n\t\t\tend\n\t\tend\n\n\n\t\t# We must also hash the confirmation entry so the model can check them together\n#\t\tparams[:user][:password_confirmation] = salted_password\n \n #for the regular \"post\"ers make sure the country matches the state in case they changed it\n unless ( params[:user][:country_id].nil? || (params[:user][:country_id].to_i == @user.country_id) || (params[:user][:state_id] == '1') )\n unless Country.find(params[:user][:country_id]).states.collect{|s| s.id}.include?(params[:user][:state_id].to_i)\n #if the state isn't in the country then reset the state_id update and redirect\n params[:user][:state_id] = 1\n\n @user.update_attributes(params[:user])\n if @user.twitter_user\n @user.reward_tweet_bandstock_retroactively\n end\n redirect_to :action => \"state_select\"\n return true\n end\n end\n \n if params[:user][:phone]\n params[:user][:phone].gsub!(/[^0-9]/, '')#clean phone\n end\n @user.update_attributes(params[:user])\n \n success = @user.save\n if @user.twitter_user\n @user.reward_tweet_bandstock_retroactively\n end\n if success\n\t\t\tif @user.status == 'pending'\n\t\t\t\t@user.status = 'active'\n\t\t\tend\n\t\t\t\n\t\t\tsuccess = @user.save\n\t\tend \n \n respond_to do |format|\n format.html { \n unless success #&& photo_success\n render :action => 'edit'\n return false\n else\n flash[:notice] = \"Profile updated.\"\n redirect_to root_url\n end\n }\n format.js\n format.xml { head :ok }\n end\n\n end", "def update\n @search = Item.search(params[:search])\n @user = User.find(current_user.id)\n email_changed = @user.email != params[:user][:email]\n password_changed = !params[:user][:password].empty?\n\n successfully_updated = if email_changed or password_changed #\n @user.update_with_password(params[:user])\n else\n @userparams = params[:user]\n @userparams.delete(:current_password)\n @userparams.delete(:password)\n @user.update_without_password(@userparams)\n end\n\n if successfully_updated\n # Sign in the user bypassing validation in case his password changed\n sign_in @user, :bypass => true\n redirect_to root_path\n else\n render \"edit\"\n end\n end", "def update\n @houses = House.all\n\n if user_params[:password].blank?\n result = @user.update_without_password(user_params)\n else\n if current_user.id == @user.id\n result = @user.update_with_password(user_params)\n else\n result = @user.update_attributes(user_params)\n end\n end\n\n\n respond_to do |format|\n if result\n format.html { redirect_to @user, notice: 'User (' + @user.name + ') was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def update\n # require password to change account information\n if @currentUser && @currentUser.authenticate(user_params[:password])\n\n updatedParams = user_params\n\n updatedParams[:password] = updatedParams[:new_password]\n updatedParams.delete(:new_password)\n\n if @currentUser.update_attributes(updatedParams)\n head :no_content\n else\n render json: { errors: @currentUser.errors.messages }, status: 422\n end\n else\n render json: { errors: @currentUser.errors.messages }, status: 401\n end\n end", "def update_resource(resource, params)\n if [\"facebook\", \"github\", \"google_oauth2\"].include? current_user.provider\n params.delete(\"email\")\n params.delete(\"avatar\")\n resource.update_without_password(params)\n else\n resource.update_with_password(params)\n end\n end", "def update\n # prevent spoofs\n #TODO this is bullshit code; add filters, :before_update\n if !(request.post? || request.put?) || !user_signed_in? ||\n !(self.current_user.user_id == params[:id].to_i || self.current_user.admin_flag == 1)\n flash[:notice] = 'EPIC FAIL. You\\'re not logged in or you\\'re trying to update someone else\\'s account.'\n redirect_to(:controller => '/members', :action => 'index', :id=>params[:id])\n return\n end\n\n serviceable = MemberServiceable.new(params, session)\n @user = serviceable.update\n\n flash[:message]='Account Updated.'\n redirect_to(:controller => '/members', :action => 'profile', :id=>params[:id])\n\n end", "def update\n updated_user = user_params\n\n if params[:user][:do_not_email] == '1'\n updated_user[:marketing] = '0'\n updated_user[:articles] = '0'\n updated_user[:digest] = '0'\n end\n\n user = Token.consume(params[:user][:nonce])\n\n if user == nil or user.id.to_s != params[:id] or params[:user][:url_email] != user.email\n flash[:alert] = 'Access denied!'\n redirect_to action: 'edit'\n return\n elsif user.email != params[:user][:email]\n email_already_exists = email_already_exists?(params[:user][:email])\n if email_already_exists\n redirect_to action: 'edit'\n return\n end\n else\n respond_to do |format|\n if @user.update(updated_user)\n format.html { redirect_to action: 'index' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n # TODO: wrap into Facebook class?\n fb_response = Facebook.new(params[:facebook_access_token]).get(\"/me\")\n \n # TODO: handle errors, security\n\n if fb_response.code != 200\n render :nothing => true, :status => 401\n else\n @user = User.find_by_facebook_id(fb_response['id'])\n\n if @user\n # existing user logging-in\n @user.update_attribute(:facebook_token, params[:facebook_access_token])\n render :nothing => true, :status => 200\n else\n # shinny new user logging-in\n @user = User.create_from_facebook_response(params[:facebook_access_token], fb_response)\n if @user.save\n render :nothing => true, :status => 201\n else\n render :nothing => true, :status => 500\n raise \"could not save new user\"\n end\n end\n end\n end", "def update\n @user = LinkedData::Client::Models::User.find(params[:id])\n @user = LinkedData::Client::Models::User.find_by_username(params[:id]).first if @user.nil?\n @errors = validate_update(user_params)\n if @errors.size < 1\n\n if params[:user][:password]\n error_response = @user.update(values: { password: params[:user][:password] })\n else\n user_roles = @user.role\n\n if @user.admin? != (params[:user][:admin].to_i == 1)\n user_roles = update_role(@user)\n end\n\n @user.update_from_params(user_params.merge!(role: user_roles))\n error_response = @user.update\n end\n\n if response_error?(error_response)\n @errors = response_errors(error_response)\n # @errors = {acronym: \"Username already exists, please use another\"} if error_response.status == 409\n render action: \"edit\"\n else\n flash[:notice] = 'Account was successfully updated'\n\n if session[:user].username == @user.username\n session[:user].update_from_params(user_params)\n end\n redirect_to user_path(@user.username)\n end\n else\n render action: \"edit\"\n end\n end", "def update\n # @user is already set by correct_user\n # @user = User.find(params[:id])\n if @user.update_attributes(params[:user])\n # Handle a successful update.\n flash[:success] = \"Profile updated\"\n # log_in here makes sure token in cookie gets updated\n # If someone is using hijacked cookie, token gets updated and results in stole token not working\n log_in @user\n redirect_to @user\n else\n render 'edit'\n end\n end", "def update\n update_method = user_update_params[:current_password] ? 'update_with_password' : 'update_without_password'\n\n if @user.method(update_method).call(user_update_params)\n sign_out_current_user\n render json: @user, status: :ok\n else\n render json: format_errors(@user.errors), status: :unprocessable_entity\n end\n end", "def handle_update_details_for_third_party(user, need_email=true)\n @data.user = user\n @session.push(Login, :back_from_update_third_party)\n @data.previous_email = user.contact.con_email\n collect_user_info(false, false, true, need_email)\n end", "def update\n @user = User.find(params[:id])\n \n \n if @user.update_attributes(params[:user]) \n\n if @user.practiceobjects.count == 1 #this should fix the problem from below- we're only dealing with situations in which the user has 1 PO\n @user.practiceobjects.each do |p| # this makes any changes to user notes/name as announced default changes for any blank parallel fields in the users PO's. \n # mainly to update the practiceobject when the user first fills out that info\n \n # this SHOULD only update the PO when the user has only one PO, because won't have access to the form that hits this action if he has more than one PO\n #NEED TO MAKE SURE OF THIS - MAKE SURE THIS ACTION NOT HIT FROM ANYWHERE ELSE, not hit any other time the PO is updated - IS IT HIT WHEN ADMIN NOTES UPDATED THROUGH BEST IN PLACE?\n # after looking at the terminal output, it doesn't look like best_in_place hits this update action, so it's cool\n #THIS WON\"T WORK - ANY update to the user, e.g. when updating password, will change all PO values back to the default - see fix above\n p.update_attributes(:notes => @user.notes)\n \n \n p.update_attributes(:phonetic => @user.phonetic)\n end \n end \n\n if params[:user][:password] #I think this only occurs when user sets pw for the first time, when signing up.\n \n if is_haltom_user\n flash[:info] = \"Welcome to your VoiceGems Dashboard! You may need to wait a minute and refresh the page to hear your name recording below. Please ensure that your recording plays back, and then signout to allow the next student to record! Thank you!\"\n redirect_to @user\n else \n flash[:info] = \"Welcome to your VoiceGems Dashboard! You may need to wait a minute and refresh the page to hear your recording below.\"\n redirect_to @user\n end\n else\n if params[:user][:email]\n redirect_to @user, notice: 'User update was successful.'\n else \n redirect_to @user, notice: 'Update was successful. If you uploaded a recording, please wait a minute and refresh the page to see the changes take effect.' \n end \n end \n \n \n else\n if params[:user][:password]\n if mobile_device?\n render action: 'mobile_setpassword', :layout => nil\n else \n render action: 'setpassword'\n end \n else\n if params[:user][:email]\n render action: \"edit\"\n else\n flash[:error] = \"Something went wrong, please try again.\"\n redirect_to current_user\n end \n end\n #format.html { render action: \"edit\" } redirect_to(session[:return_to] || edit_user_path)\n # format.html { redirect_to (session[:return_to] || edit_user_path(@user))} \n #format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n \n end", "def update\n verify_post_request\n access_denied unless has_role?(:admin)\n require_parameters :login\n\n user = User.find_active_by_login(params[:login])\n\n if user.nil?\n render_bad_request(\"Could not find user with login #{params[:login]}\")\n elsif user.update_attributes!(params)\n hash = user.to_hash\n respond_to do |format|\n format.json { render :json => jsonp(hash) }\n format.xml { render :xml => hash.to_xml(:skip_types => true, :root => 'users') }\n end\n end\n end", "def update!(**args)\n @auth_provider = args[:auth_provider] if args.key?(:auth_provider)\n end", "def update\n if params[:id] != current_user.id && current_user.is_admin == false\n \traise \"You are not authorized to access this function\"\n end \n @user = current_user\n @user.update_attributes(params[:user])\n respond_with(@user)\n end", "def update\n super do |resource|\n # TODO (rspeicher): In Devise master (> 3.4.1), we can set\n # `Devise.sign_in_after_reset_password = false` and avoid this mess.\n if resource.errors.empty? && resource.try(:otp_required_for_login?)\n resource.unlock_access! if unlockable?(resource)\n\n # Since we are not signing this user in, we use the :updated_not_active\n # message which only contains \"Your password was changed successfully.\"\n set_flash_message(:notice, :updated_not_active) if is_flashing_format?\n\n # Redirect to sign in so they can enter 2FA code\n respond_with(resource, location: new_session_path(resource)) and return\n end\n end\n end", "def update\n @user = User.find(params[:id])\n @user.password = params[:user][:password] unless params[:user][:password] == nil\n @user.password_confirmation = params[:user][:password_confirmation] unless params[:user][:password_confirmation] == nil\n @user.city = params[:user][:city] unless params[:user][:city] == nil\n @user.dob = params[:user][:dob] unless params[:user][:dob] == nil\n @user.first_name = params[:user][:first_name] unless params[:user][:first_name] == nil\n @user.gender = params[:user][:gender] unless params[:user][:gender] == nil\n @user.last_name = params[:user][:last_name] unless params[:user][:last_name] == nil\n @user.state = params[:user][:state] unless params[:user][:state] == nil\n \n respond_to do |format|\n if @user.save\n format.html { redirect_to '/', :notice => \"#{ @user.first_name } #{ @user.last_name } was successfully updated.\" }\n format.json { head :no_content }\n else\n @button_text = 'Update info'\n @show_tos = false\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @oeuser.id.to_i == params[:id].to_i\n @user = User.find(params[:id])\n if params[:oldpassword] and params[:newpassword] and params[:confirmpassword]\n @user.errors.add(:password, \"Current password doesn't match\") if not @user.checkpass(params[:oldpassword])\n @user.errors.add(:password, \"New and confirmation password doesn't match\") if not params[:newpassword] == params[:confirmpassword]\n if @user.errors.empty? \n @user.password = params[:newpassword]\n end\n end\n respond_to do |format|\n if @user.errors.empty? and @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n else\n flash[:error] = \"Restricted Access, You need to be Admin\"\n redirect_to root_url\n end\n end", "def update\n authorize! :update, @user\n respond_to do |format|\n if @user.update(user_params)\n sign_in(@user == current_user ? @user : current_user, :bypass => true)\n format.html { redirect_to @user, notice: 'Your profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update? ; user.account.active? ; end", "def fill_up_user_update\n # return true if !self.class.column_names.include? 'updated_by_id'\n return true if !UserInfo.current_user_id\n\n # self.updated_by_id = UserInfo.current_user_id\n true\n end", "def update\n params[\"user\"].each do |key, value| \n value.strip!\n if value == \"\"\n params[\"user\"].delete(key)\n end\n end\n \n params[\"user\"][\"email\"].downcase!\n \n @prev_user_info = User.find_by_id(params[\"user\"][\"id\"])\n existing_user = User.find_by_id(params[\"user\"][\"id\"])\n \n if !params[\"user\"][\"password_hash\"].blank?\n existing_user.password = params[\"user\"][\"password_hash\"]\n end\n\n if existing_user.update_attributes(params[\"user\"])\n @object = existing_user\n \n render \"user_success\"\n\n else\n @error_messages = existing_user.errors.to_a\n @user = User.new\n @new_item = User.find_by_id(params[\"id\"])\n\n render \"edit\"\n end\n end", "def update #Modificado para que solo pueda cambiar nombre y apellido (y admin cuando el que hace el cambio sea un admin)\n\tif(!session[:user_id])\n\t\tlash[:error] = \"Acceso denegado\"\n\t\tredirect_to home_path\n\t\treturn\n\tend\n \n\tif(!params[:user_id] or !params[:hashed_id] or !params[:name] or !params[:lastname])\n\t\tflash[:error] = \"Error\"\n\t\tredirect_to home_path\n\t\treturn\n\tend\n\t\n\tif(params[:admin] and !User.find(session[:user_id]).admin)\n\t\tflash[:error] = \"Error\"\n\t\tredirect_to home_path\n\t\treturn\n\tend\n\t\n\tif(Digest::SHA1.hexdigest(params[:user_id].to_s) != params[:hashed_id])\n\t\tflash[:error] = \"Error\"\n\t\tredirect_to home_path\n\t\treturn\n\tend\n\t\n @user = User.find(params[:user_id])\n\t@user.name = params[:name]\n\t@user.lastname = params[:lastname]\n\t\n\tif(User.find(session[:user_id]).admin and session[:user_id] != params[:user_id])\n\t\tif(params[:admin])\n\t\t\t@user.admin = true\n\t\telse\n\t\t\t@user.admin = false\n\t\tend\n\tend\n\t\n\t\n\t@user.save\n\t\n\tflash[:succes] = \"Datos actualizados satisfactoriamente\"\n\t\n\tif(User.find(session[:user_id]).admin)\n\t\tredirect_to users_path\n\t\treturn\n\tend\n\t\n\tredirect_to \"/profile/#{@user.id}\"\n end", "def update\n\n if(params[:token].nil?)\n response.status = 400\n render json: {msg: \"Token is not defined\"}\n return\n end\n\n session = validate_session(params[:token])\n\n if session.nil?\n response.status = 401\n render json: {}\n return\n end\n\n if params[:payload].nil?\n response.status = 400\n render json: {msg: \"Payload is not defined in request\"}\n return\n end\n\n begin\n obj = User.find(params[:id])\n\n unless session.user.id == obj.id\n response.status = 403\n render json: {}\n return\n end\n\n unless(params[:payload][:full_name].nil?)\n obj.full_name = params[:payload][:full_name]\n end\n\n unless(params[:payload][:email].nil?)\n obj.email = params[:payload][:email]\n end\n\n # Sending plain password\n # TODO: encrypt on client side\n unless(params[:payload][:password].nil?)\n obj.password = Digest::SHA256.hexdigest(params[:payload][:password])\n end\n\n if(obj.invalid?)\n response.status = 400\n r = {}\n obj.errors.map {|k, v| r[k] = v}\n render json: r\n return\n end\n\n obj.save\n\n response.status = 204\n render json: obj\n rescue ActiveRecord::RecordNotFound => e\n response.status = 404\n render json: {}\n rescue Exception => e\n response.status = 500\n render json: {msg: e}\n end\n\n end", "def update\n respond_to do |format|\n if @user.password_changed?\n sign_in(@user, :bypass => true)\n else\n if @user.update(user_params)\n format.html { redirect_to \"/\", notice: t('success_update') }\n format.json { render :show, status: :ok, location: \"/\" }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end\nend", "def update\n\n @user = User.find(current_user.id)\n\n params[:user].delete(:password) # these aren't on the form, but let's remove them anyway to prevent hacking attempt\n params[:user].delete(:password_confirmation) # these aren't on the form, but let's remove them anyway to prevent hacking attempt\n params[:user].delete(:current_password) # these aren't on the form, but let's remove them anyway to prevent hacking attempt\n params[:user].delete(:email)\n\n # check to be sure they aren't changing their username to something that includes @stanford.edu\n\n if params[:user][:username].include?('@stanford.edu') && @user.sunet_user? && params[:user][:username] != \"#{@user.sunet}@stanford.edu\"\n @user.errors.add(:base,t('revs.authentication.stanford_email_warning1'))\n successfully_updated = false\n elsif params[:user][:username].include?('@stanford.edu') && !@user.sunet_user?\n @user.errors.add(:base,t('revs.authentication.stanford_email_warning2'))\n successfully_updated = false\n else\n successfully_updated = @user.update_without_password(user_params)\n end\n\n if successfully_updated\n set_flash_message :notice, :updated\n # Sign in the user bypassing validation in case his password changed\n bypass_sign_in @user\n redirect_to user_path(@user.username)\n else\n render \"edit\"\n end\n\n end", "def update\n authorize! :edit, User\n @user = User.find(params[:id])\n return_url = users_url(:use_session => true)\n respond_to do |format|\n if @user.update_attributes(params[:user])\n do_extra_actions\n format.html { redirect_to return_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors.to_xml }\n end\n end\n end", "def before_save_user\n self.encrypted_password.encode! 'utf-8'\n\n # If demo is enabled, demo user cannot change email or password nor be locked\n if Feedbunch::Application.config.demo_enabled\n demo_email = Feedbunch::Application.config.demo_email\n if email_changed? && self.email_was == demo_email\n Rails.logger.info 'Somebody attempted to change the demo user email. Blocking the attempt.'\n self.errors.add :email, 'Cannot change demo user email'\n self.email = demo_email\n end\n\n demo_password = Feedbunch::Application.config.demo_password\n if encrypted_password_changed? && self.email == demo_email\n Rails.logger.info 'Somebody attempted to change the demo user password. Blocking the attempt.'\n self.errors.add :password, 'Cannot change demo user password'\n self.password = demo_password\n end\n\n if locked_at_changed? && self.email == demo_email\n Rails.logger.info 'Keeping demo user from being locked because of too many authentication failures'\n self.locked_at = nil\n end\n\n if unlock_token_changed? && self.email == demo_email\n Rails.logger.info 'Removing unlock token for demo user, demo user cannot be locked out'\n self.unlock_token = nil\n end\n end\n end", "def update\n\n if @user.username == user_params[:username] && @user.email == user_params[:email]\n if user_params[:password].blank?\n sql_parts = [\"UPDATE users SET phone = ?, firstname = ?, lastname = ?, age = ?, updated_at = ?\",\n user_params[:phone], user_params[:firstname], user_params[:lastname], user_params[:age], Time.now]\n else\n sql_parts = [\"UPDATE users SET username = ?, email = ?, phone = ?, firstname = ?, lastname = ?, age = ?, updated_at = ?, password_digest = ?\",\n user_params[:username], user_params[:email], user_params[:phone], user_params[:firstname], user_params[:lastname], user_params[:age], Time.now, User.digest(user_params[:password])]\n end\n end\n\n sql = ApplicationRecord.send(:sanitize_sql_array, sql_parts)\n ApplicationRecord.connection.execute(sql)\n\n #respond_to do |format|\n # if @user.update(user_params)\n # format.html { redirect_to @user, notice: 'User was successfully updated.' }\n # format.json { render :show, status: :ok, location: @user }\n # else\n # format.html { render :edit }\n # format.json { render json: @user.errors, status: :unprocessable_entity }\n # end\n #end\n end", "def update\n if check_user_write_access\n respond_to do |format|\n if user.update_attributes(params[:user])\n format.html { redirect_to user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def custom_update\n user = User.find(params[:id])\n user.update_attributes(params[:user])\n render :text => true\n end", "def update\n\n @user = self.current_user\n @user.update_attributes(params)\n \n rescue => ex\n @user.reload\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json \n end\n end", "def edit_user\n if (@user = find_user(params[:id]))\n @all_roles = Role.find_all.select { |r| r.name != UserEngine.config(:guest_role_name) }\n case request.method\n when :get\n when :post\n @user.attributes = params[:user].delete_if { |k,v| not LoginEngine.config(:changeable_fields).include?(k) }\n if @user.save\n flash.now[:notice] = \"Details for user '#{@user.login}' have been updated\"\n else\n flash.now[:warning] = \"Details could not be updated!\"\n end\n end\n else\n redirect_back_or_default :action => 'list'\n end\n end", "def update\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n #return render :text => params\n @user = User.find(params[:user][:id])\n if @user.update_attributes(params[:user])\n redirect_to :action => 'index'\n else\n render 'edit'\n end\n else \n redirect_to '/'\n end\n end", "def update\n self.resource = resource_class.to_adapter.get!(send(:\"current_#{resource_name}\").to_key)\n prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email)\n resource.reset_authentication_token\n \n updated = if needs_password?(resource, params)\n if params[:user][:date_of_birth].present?\n params[:user][:date_of_birth] = frame_date_of_birth_to_date_format(params[:user][:date_of_birth].to_s)\n if params[:user][:date_of_birth] != nil\n resource.update_with_password(account_update_params)\n else\n render json: {errors: [\"Date format not correct.\"]}, status: :unprocessable_entity and return\n end\n else\n resource.update_with_password(account_update_params)\n end\n else\n params[:user].delete(:current_password)\n if params[:user][:date_of_birth].present?\n params[:user][:date_of_birth] = frame_date_of_birth_to_date_format(params[:user][:date_of_birth].to_s)\n if params[:user][:date_of_birth] != nil\n resource.update_without_password(account_update_params)\n else\n render json: {errors: [\"Date format not correct.\"]}, status: :unprocessable_entity and return\n end\n else\n resource.update_without_password(account_update_params)\n end\n end\n\n if updated\n sign_in resource_name, resource, :bypass => true\n render json: {\n auth_token: resource.authentication_token,\n user_role: resource.role,\n registration_complete: resource.registration_complete?\n }, status: :ok\n else\n clean_up_passwords resource\n render json: {errors: resource.errors.full_messages}, status: :unprocessable_entity\n end\n\n end", "def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end", "def twofa\n @user = current_user\n \n if params[:user]\n if @user.update_attributes params.require(:user).permit(:gauth_enabled,:password,:password_confirmation)\n if (params[:user][:gauth_enabled] == '1')\n flash[:info] = \"Two-factor authentication has been enabled\"\n else\n flash[:warn] = \"Two-factor authentication was not enabled\"\n end\n redirect_to admin_twofa_path\n return \n else\n flash[:error] = \"Something went wrong while trying to update your settings\"\n end\n end\n \n if !@user.twofa_enabled?\n @user.regenerate_secret!\n end\n end", "def update\n # @user = User.find(params[:id]) - Now defined in authenticate function\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n @title = \"Edit Profile\"\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n unless (current_user || current_affiliate).stripe_account\n redirect_to new_user_stripe_account_path and return\n end\n\n begin\n # Retrieve the Stripe account\n @stripe_account = Stripe::Account.retrieve((current_user || current_affiliate).stripe_account.acct_id)\n\n @stripe_account = StripeAccount.new(stripe_account_params)\n\n\n # Reject empty values\n stripe_account_params.each do |key, value|\n if value.empty?\n flash.now[:alert] = \"Please complete all fields.\"\n render 'edit' and return\n end\n end\n\n # Iterate through each field needed\n @stripe_account.verification.fields_needed.each do |field|\n\n # Update each needed attribute\n case field\n when 'legal_entity.address.city'\n @stripe_account.legal_entity.address.city = account_params[:address_city]\n when 'legal_entity.address.line1'\n @stripe_account.legal_entity.address.line1 = account_params[:address_line1]\n when 'legal_entity.address.postal_code'\n @stripe_account.legal_entity.address.postal_code = account_params[:address_postal]\n when 'legal_entity.address.state'\n @stripe_account.legal_entity.address.state = account_params[:address_state]\n when 'legal_entity.dob.day'\n @stripe_account.legal_entity.dob.day = account_params[:dob_day]\n when 'legal_entity.dob.month'\n @stripe_account.legal_entity.dob.month = account_params[:dob_month]\n when 'legal_entity.dob.year'\n @stripe_account.legal_entity.dob.year = account_params[:dob_year]\n when 'legal_entity.first_name'\n @stripe_account.legal_entity.first_name = account_params[:first_name]\n when 'legal_entity.last_name'\n @stripe_account.legal_entity.last_name = account_params[:last_name]\n when 'legal_entity.ssn_last_4'\n @stripe_account.legal_entity.ssn_last_4 = account_params[:ssn_last_4]\n when 'legal_entity.type'\n @stripe_account.legal_entity.type = account_params[:type]\n when 'legal_entity.personal_id_number'\n @stripe_account.legal_entity.personal_id_number = account_params[:personal_id_number]\n when 'legal_entity.verification.document'\n @stripe_account.legal_entity.verification.document = account_params[:verification_document]\n when 'legal_entity.business_name'\n @stripe_account.legal_entity.business_name = account_params[:business_name]\n when 'legal_entity.business_tax_id'\n @stripe_account.legal_entity.business_tax_id = account_params[:business_tax_id]\n end\n end\n\n\n respond_to do |format|\n if @stripe_account.update(stripe_account_params)\n format.html { redirect_to @stripe_account, notice: 'Stripe account was successfully updated.' }\n format.json { render :show, status: :ok, location: @stripe_account }\n else\n format.html { render :edit }\n format.json { render json: @stripe_account.errors, status: :unprocessable_entity }\n end\n end\n end\nend", "def update\n @user = User.find(params[:id])\n ####\n @user.status = params[:user][:status] if is_admin?\n params[:user].delete(:status )\n #pp = params[:user].merge(:password => '1' )\n \n logger.info(params[:user])\n #####\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if params[:user][:password].present? ? @user.update_attributes(params[:user]) : @user.update_without_password(params[:user])\n flash[:notice] = 'User was successfully updated.'\n @changed << @user.id\n \n sign_in @user, bypass: true if current_user.id == @user.id\n\n format.html { redirect_to :back }\n format.js { render 'shared/index'; flash.discard }\n format.json { head :no_content }\n else\n @edited << @user.id\n @expanded << @user.id\n\n format.html { render action: 'edit', template: 'shared/edit' }\n format.js { render 'user' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if (params[:user][:password].blank?)\n params[:user].delete(:password)\n params[:user].delete(:password_confirmation)\n\n end\n\n if !current_user.super_admin?\n params[:user].delete(:username)\n end\n\n if unauthorized_access(!current_user.nil? && (current_user.id == @user.id || can?(:edit, \"User\".constantize)))\n return\n end\n\n if (@user.super_admin? && !current_user.super_admin?)\n return unauthorized_access(false)\n end\n\n user_redirect = admin_users_path\n redirect_options = { notice: 'Usuário foi atualizado com sucesso.' }\n\n respond_to do |format|\n @user.password_string = @user.password\n if verify_super_admin(@user) && @user.update(params[:user])\n if !params[:user][:password].blank?\n Devise::LDAP::Adapter.update_password(@user.username, params[:user][:password])\n end\n\n if current_user.id == @user.id\n flash[:notice] = 'Usuário foi atualizado com sucesso. Para ter acesso ao sistema, é preciso se logar novamente com seus dados de acesso atualizados.'\n sign_out_and_redirect(@user)\n return\n end\n format.html { redirect_to user_redirect, redirect_options }\n format.json { head :no_content }\n else\n if current_user.local_access?\n @uos = {current_user.uo.nome => current_user.uo.id}\n else\n @uos = Uo.order(\"nome ASC\").all.collect {|uo| [uo.nome, uo.id]}\n end\n @roles = Role.order(\"nome ASC\").all.collect { |role| [role.nome, role.id] }\n if !verify_super_admin(@user)\n flash.now[:error] = \"Apenas um usuário com papel de SuperAdmin pode criar outro usuário SuperAdmin\"\n end\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n authorize! :manage, @user\n \n respond_to do |format|\n\n if (current_user.id == @user.id) \n # Don't let a non-administrator assign themselves admin/download/viewing priviledges.\n # (Also) Don't let the current user disable their own admin account!\n params[:user].delete \"is_administrator\"\n if ! current_user.is_administrator\n params[:user].delete \"is_data_downloader\"\n params[:user].delete \"is_data_viewer\"\n end\n end \n \n\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n # format.json { render :show, status: :ok, location: @user }\n format.json { respond_with_bip(@user) }\n else\n format.html { render :edit }\n # format.json { render json: @user.errors, status: :unprocessable_entity }\n format.json { respond_with_bip(@user) }\n end\n end\n end", "def update\n respond_with ApidUser.update(params[:id], params[:apid_user])\n rescue ActiveRecord::RecordNotFound\n respond_with ApidUser::StateChangeError\n end", "def update\n @user = User.find(params[:id])\n\n redirect_url = params.has_key?(\"admin_fxn\") ? ('/users/' + @user.id.to_s + '/edit') : '/profile'\n\n if params[\"commit\"]\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to redirect_url, notice: 'User successfully updated.' }\n format.json { head :no_content }\n else\n format.html {\n if params.has_key?(\"admin_fxn\")\n @admin_function = true\n @current_user = current_user\n render action: 'edit'\n else\n @admin_function = false\n @current_user = current_user\n render action: 'profile'\n end\n }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to redirect_url\n end\n end", "def update\n # User.find(current_user) vs plain current_user avoids failed name change to appear immediately in layout\n @user = User.find(current_user.id)\n \n # this needs to be passed to the object instance so that it validates the current password\n # any more elegant way to do it?\n @user.validate_current_password = true if account_section == 'password'\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Changes saved.\"\n format.html { redirect_to account_edit_url(account_section) }\n format.xml { head :ok }\n else\n format.html { render :action => :edit }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n # this action is triggered when the user sends data to edit their data\n # you can add your custom code here\n\n new_params = params.require(:user).permit(:email, :username, :current_password, :password, :password_confirmation)\n\n change_password = true\n\n if params[:user][:password].blank?\n params[:user].delete(\"password\")\n params[:user].delete(\"password_confirmation\")\n new_params = params.require(:user).permit(:email, :username)\n change_password = false\n end\n\n @user = User.find(current_user.id)\n\n is_valid = false\n\n if change_password\n is_valid = @user.update_with_password(new_params)\n else\n @user.update_without_password(new_params)\n end\n\n if is_valid\n set_flash_message :notice, :updated\n sign_in @user, :bypass => true\n redirect_to after_update_path_for(@user)\n else\n render \"edit\"\n end\n\n end", "def update \n user = User.where(:id => current_user.user)\n if user.update(user_params)\n render :json => {:user => user }\n else\n render :json => {:error => user.errors.full_messages.first}\n end\nend", "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "def update\n self_edit_only\n @user = User.find(params[:id])\n if @user.update(update_params)\n redirect_to user_url, :notice => \"Update successful!\"\n else\n render \"edit\"\n end\n end", "def amend_user\n # we should have a current user.\n user = current_user\n if (user)\n auth = request.env[\"omniauth.auth\"]\n # We should have at most one of these.\n oauths = Authentication.where(:provider => auth[\"provider\"],\n :uid => auth[\"uid\"],\n :user_id.ne => nil,\n :master_id => @master.id).order(\"create_at desc\").all\n oauth = nil\n oauths.each do |oa|\n if oa.user == user\n if oauth.nil?\n oauth = oa\n else # masters should all be the same\n # Be proactive resilience here and get rid of this one. We should not have multiples\n logger.error(\"sessions#ammend_customer: getting rid of multiple administrator authentications.\")\n oa.destroy()\n end\n else\n redirect_to edit_master_user_registration_path(user.master, user),\n :alert => \"This authentication belongs to different user.\"\n return\n end\n end\n if oauth\n if @master != oauth.user.master\n # This is really bad. Attempt a fix.\n logger.error \"sessions#amend_user: Authentication has mismatched master for user. Removing.\"\n oauth.destroy()\n end\n redirect_to edit_master_user_registration_path(user.master, user),\n :notice => \"This authentication has already been added.\"\n else\n oauth = Authentication.create_with_omniauth(auth)\n oauth.master = @master\n user.authentications << oauth\n user.save\n redirect_to edit_master_user_registration_path(user.master, user),\n :notice => \"Authentication added.\"\n end\n else\n redirect_to master_user_sign_in_path(@master),\n :alert => \"Need to sign in first.\"\n end\n end", "def update_resource(resource, params)\n # if params['email'] != current_user.email || params['password'].present?\n # resource.update_with_password(params)\n # else\n resource.update_without_password(params.except('password', 'password_confirmation', 'current_password'))\n # end\n end", "def update_devise_user\n inject_into_file 'app/models/user.rb', after: \":validatable\" do <<-'RUBY'\n, :omniauthable\n validates_presence_of :email\n has_many :authorizations\n\n def self.new_with_session(params,session)\n if session[\"devise.user_attributes\"]\n new(session[\"devise.user_attributes\"],without_protection: true) do |user|\n user.attributes = params\n user.valid?\n end\n else\n super\n end\n end\n\n def self.from_omniauth(auth, current_user)\n authorization = Authorization.where(:provider => auth.provider, :uid => auth.uid.to_s, :token => auth.credentials.token, :secret => auth.credentials.secret).first_or_initialize\n if authorization.user.blank?\n user = current_user.nil? ? User.where('email = ?', auth[\"info\"][\"email\"]).first : current_user\n if user.blank?\n user = User.new\n user.password = Devise.friendly_token[0,10]\n user.name = auth.info.name\n user.email = auth.info.email\n auth.provider == \"twitter\" ? user.save(:validate => false) : user.save\n end\n authorization.username = auth.info.nickname\n authorization.user_id = user.id\n authorization.save\n end\n authorization.user\n end\n RUBY\n end\n end", "def update_with_password(params = {})\n if has_facebook_profile?\n params.delete(:current_password)\n update_without_password(params)\n else\n super\n end\n end", "def update\n if current__user.isAdmin || current__user == @user\n if @user.update(user_update_params)\n # setToken\n # UserNotifierMailer.send_signup_email(@user).deliver\n render :show, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n else\n render json: 'Sorry you are not allowed to perform this operation.', status: :unprocessable_entity\n end\n end", "def update\n head :unauthorized\n end", "def update\n if request.format.html? && params[\"user\"][\"password\"].present? &&\n params[\"user\"][\"password\"] == params[\"user\"][\"password_confirmation\"] &&\n params[\"user\"][\"password\"] == params[\"user\"][\"current_password\"]\n flash[:alert] = ERROR_MESSAGE_FOR_PASSWORD\n redirect_to edit_user_registration_path and return\n elsif request.format.html?\n super\n else\n @user = User.find_by_authentication_token(params[:token])\n if !params[:user].nil? && !@user.blank?\n if params[\"user\"][\"password\"].present? &&\n params[\"user\"][\"password\"] == params[\"user\"][\"password_confirmation\"] &&\n params[\"user\"][\"password\"] == params[\"user\"][\"current_password\"]\n render :json=> { :status => 404, :message => ERROR_MESSAGE_FOR_PASSWORD} and return\n end\n if @user.valid_password?(params[:user][:current_password])\n @user.update_attributes(allow_registration_parameters) ? (render :json=> {:status => 200, :user => @user, :message => \"User details updated.\"}) :\n (render :json=> {:status => 404,:message => @user.errors.full_messages.join(\"<br/>\").html_safe})\n return\n else\n render :json=> {:status => 404, :message => \"Current password entered is wrong.\"}\n end\n else\n render :json=> {:status => 404, :message => \"Invalid authentication token used.\"}\n end\n\n end\n\n end", "def update\n if @user.update_without_password(update_params)\n render_update_success @user\n else\n render_failure @user\n end\n end", "def update\n # required for settings form to submit when password is left blank\n if params[:user][:password].blank?\n params[:user].delete(\"password\")\n params[:user].delete(\"password_confirmation\")\n end\n\n @user_id = current_user.id\n @user = User.find(@user_id)\n if @user.is_new_user == true\n if @user.update_attributes(user_params)\n @user.not_new_user\n flash[:success] = '謝謝您,資料已經更新'\n\n old_user = User.find(@user_id)\n sign_in(old_user, :bypass => true)\n\n redirect_to user_path(@user)\n else\n render :edit\n end\n else\n @user.update_with_password(user_params)\n sign_in(@user, :bypass => true)\n end\n\n # email_changed = @user.email != params[:user][:email]\n # first_time = @user.sign_in_count == 1\n\n # successfully_updated = if !first_time\n # @user.update_with_password(user_params)\n # else\n # @user.update_attributes(user_params)\n # end\n\n # if successfully_updated\n # # Sign in the user bypassing validation in case his password changed\n # # sign_in @user, :bypass => true\n # # redirect_to root_path\n # else\n # # render \"edit\"\n # end\n end", "def update\n\n if param_user[:email_work] != user.login\n param_user[:login] = param_user[:email_work]\n end\n @selected_profiles = param_user[:profile_ids]\n\n respond_to do |format|\n if user.update_attributes(param_user)\n @message = \"#{@user.full_name} has been modified.\"\n\t Resque.enqueue(Finforenet::Jobs::CheckPublicProfiles, @user.id) if @user.is_public\n if !request.xhr?\n format.html { redirect_to users_path({:page=>params[:page]}), :notice => @message }\n else\n format.html { render :action => \"edit\", :layout=> !request.xhr?}\n end\n else\n format.html { render :action => \"edit\", :layout=> !request.xhr? }\n end\n end\n end", "def update!(**args)\n @all_authenticated_users = args[:all_authenticated_users] if args.key?(:all_authenticated_users)\n @cap_token_holder = args[:cap_token_holder] if args.key?(:cap_token_holder)\n @chat = args[:chat] if args.key?(:chat)\n @circle = args[:circle] if args.key?(:circle)\n @cloud_principal = args[:cloud_principal] if args.key?(:cloud_principal)\n @contact_group = args[:contact_group] if args.key?(:contact_group)\n @email_owner = args[:email_owner] if args.key?(:email_owner)\n @event = args[:event] if args.key?(:event)\n @gaia_group = args[:gaia_group] if args.key?(:gaia_group)\n @gaia_user = args[:gaia_user] if args.key?(:gaia_user)\n @host = args[:host] if args.key?(:host)\n @ldap_group = args[:ldap_group] if args.key?(:ldap_group)\n @ldap_user = args[:ldap_user] if args.key?(:ldap_user)\n @mdb_group = args[:mdb_group] if args.key?(:mdb_group)\n @mdb_user = args[:mdb_user] if args.key?(:mdb_user)\n @oauth_consumer = args[:oauth_consumer] if args.key?(:oauth_consumer)\n @postini_user = args[:postini_user] if args.key?(:postini_user)\n @rbac_role = args[:rbac_role] if args.key?(:rbac_role)\n @rbac_subject = args[:rbac_subject] if args.key?(:rbac_subject)\n @resource_role = args[:resource_role] if args.key?(:resource_role)\n @scope = args[:scope] if args.key?(:scope)\n @signing_key_possessor = args[:signing_key_possessor] if args.key?(:signing_key_possessor)\n @simple_secret_holder = args[:simple_secret_holder] if args.key?(:simple_secret_holder)\n @social_graph_node = args[:social_graph_node] if args.key?(:social_graph_node)\n @square = args[:square] if args.key?(:square)\n @youtube_user = args[:youtube_user] if args.key?(:youtube_user)\n @zwieback_session = args[:zwieback_session] if args.key?(:zwieback_session)\n end", "def update!(**args)\n @all_authenticated_users = args[:all_authenticated_users] if args.key?(:all_authenticated_users)\n @cap_token_holder = args[:cap_token_holder] if args.key?(:cap_token_holder)\n @chat = args[:chat] if args.key?(:chat)\n @circle = args[:circle] if args.key?(:circle)\n @cloud_principal = args[:cloud_principal] if args.key?(:cloud_principal)\n @contact_group = args[:contact_group] if args.key?(:contact_group)\n @email_owner = args[:email_owner] if args.key?(:email_owner)\n @event = args[:event] if args.key?(:event)\n @gaia_group = args[:gaia_group] if args.key?(:gaia_group)\n @gaia_user = args[:gaia_user] if args.key?(:gaia_user)\n @host = args[:host] if args.key?(:host)\n @ldap_group = args[:ldap_group] if args.key?(:ldap_group)\n @ldap_user = args[:ldap_user] if args.key?(:ldap_user)\n @mdb_group = args[:mdb_group] if args.key?(:mdb_group)\n @mdb_user = args[:mdb_user] if args.key?(:mdb_user)\n @oauth_consumer = args[:oauth_consumer] if args.key?(:oauth_consumer)\n @postini_user = args[:postini_user] if args.key?(:postini_user)\n @rbac_role = args[:rbac_role] if args.key?(:rbac_role)\n @rbac_subject = args[:rbac_subject] if args.key?(:rbac_subject)\n @resource_role = args[:resource_role] if args.key?(:resource_role)\n @scope = args[:scope] if args.key?(:scope)\n @signing_key_possessor = args[:signing_key_possessor] if args.key?(:signing_key_possessor)\n @simple_secret_holder = args[:simple_secret_holder] if args.key?(:simple_secret_holder)\n @social_graph_node = args[:social_graph_node] if args.key?(:social_graph_node)\n @square = args[:square] if args.key?(:square)\n @youtube_user = args[:youtube_user] if args.key?(:youtube_user)\n @zwieback_session = args[:zwieback_session] if args.key?(:zwieback_session)\n end", "def update\n @user = current_user\n @user_locations = @user.user_locations\n \n old_password = @user.sync_password\n \n new_password = request_password\n \n # @user_locations.each do |ul|\n request = request_github(@user.user_locations.where({ :location_id => 1 }).first.login_name, old_password, new_password)\n # end\n \n unless request.nil?\n # TXT user\n txt_user(@user.cell_phone, request)\n \n # Save new password to user\n @user.update_attributes({ :sync_password => request })\n \n redirect_to root_url, :notice => \"New password TXT'd to your cell phone.\"\n else\n redirect_to root_url, :notice => 'Authentication Failed. Try again.'\n end\n end", "def update_with_password(params, *options); end", "def authorize\n render json: { status: 200, msg: 'You are not allowed to do this update' } unless current_user && current_user.can_modify_user?(params[:id])\n end", "def update\n if session[:id] && session[:token]\n\n if params[:user][:avatar]\n url_image = User::upload(params[:user][:avatar])\n if url_image != false\n string_encode = Base64.encode64(File.open(Rails.root.to_s + \"/public\" + url_image.to_s,\"rb\").read)\n original_image = params[:user][:avatar].original_filename\n params[:user][:avatar] = string_encode\n params[:user][:name_original_avatar] = original_image\n # File.delete(Rails.root.to_s + \"/public\" + url_image.to_s)\n end\n end\n\n if params[:user][\"birthday(1i)\"] !=\"\" && params[:user][\"birthday(2i)\"] != \"\" && params[:user][\"birthday(3i)\"] != \"\"\n params[:user][:birthday] = Date.civil(params[:user][\"birthday(1i)\"].to_i,params[:user][\"birthday(2i)\"].to_i,params[:user][\"birthday(3i)\"].to_i)\n end\n\n params[:user][:session_id] = session[:id]\n params[:user][:session_token] = session[:token]\n data_input = params[:user]\n data_output = ::Utility.send_request_to_host_api(\"put\",DOMAIN_HOST+VERSION_API+\"/\"+USERS_TABLE+\"/\"+session[:id].to_s,data_input)\n\n if data_output[\"meta\"][\"code\"].to_i == 1001\n flash[:errors] = data_output[\"meta\"][\"messages\"]\n else\n if data_output[\"meta\"][\"code\"].to_i == 200\n flash[:notice] = data_output[\"meta\"][\"description\"]\n else\n flash[:error] = data_output[\"meta\"][\"description\"]\n end\n end\n \n redirect_to({action:'edit'})\n else\n redirect_to({action:'signin'})\n end\n end", "def update\n\t\tparams.permit!\n\t\t@user = User.find(params[:id])\n\t\t@first_name = params[:user][:first_name].to_s\n\t\t@second_name = params[:user][:second_name].to_s\n\t\t@last_name = params[:user][:last_name].to_s\n\n\t\tif @first_name != \"-\" and @second_name != \"-\" and @last_name != \"-\"\n\t\t\t\t@user.update_attribute(:active,1)\n\t\tend\t\n\n\t\tif User.find_by_id(session[:user_id]).access != \"admin\" and @user_id == session[:user_id]\n\t\t\tif\tUser.authenticate(@user.name, params[:old_password]) == @user\n\t\t\t\t@user.update_attribute(:password, \"#{params[:user][:password]}\")\n\t\t\telse\n\t\t\t\tparams[:user][:password] = \"\"\n\t\t\tend\n\t\tend\n\t\t\t\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(users_url,\n :notice => \"User #{@user.name} was successfully updated.\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update_resource(resource, params)\n if params[\"password\"]&.present? or params[\"email\"]&.present?\n return super\n else\n resource.update_without_password(params.except(\"current_password\"))\n end\n end", "def update\n if @user == @current_user\n redirect_path = user_path(@user)\n else\n lastname_letter = @user.last_name[0]\n redirect_path = users_path(letter: lastname_letter)\n end\n authorize_user\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to redirect_path, notice: I18n.t('updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update?\n user_is_owner? || user_is_admin?\n end", "def update_without_password(params, *options); end", "def update\n @user = User.find(params[:id])\n\n # If you can manage users: Always provide your own password to verify changes \n # Else: Provide the user's password\n valid_password = false\n if (can?(:manage, User))\n valid_current_password = current_user.valid_password?(params[:user][:current_password])\n else\n valid_current_password = @user.valid_password?(params[:user][:current_password])\n end\n\n @user.errors[:base] << \"The password you entered is incorrect\" unless valid_current_password\n if params[:user][:password].blank?\n [:password,:password_confirmation,:current_password].collect {|p| params[:user].delete(p)} \n end\n\n respond_to do |format|\n if can?(:update, User) and @user.errors[:base].empty? && @user.update_attributes(params[:user])\n flash[:notice] = \"Your account has been updated\"\n format.json { render :json => @user.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to(@user) }\n else\n format.json { render :text => \"Could not update user\", :status => :unprocessable_entity } #placeholder\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n format.html { render :action => :edit, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordNotFound\n respond_to_not_found(:json, :xml, :html)\n end", "def update\n respond_to do |format|\n if user_params[:password].present?\n update_user_with_password(format)\n else\n update_user_without_password(format)\n end\n end\n end", "def update\n @user = User.find(params[:id])\n #raise @user.inspect\n if @user.update_attributes(params[:user])\n #set_flash_message :notice, :updated\n # Sign in the user bypassing validation in case his password changed\n @user_c= User.find(current_user.id)\n sign_in @user_c, :bypass => true \n respond_to do |format| \n format.html { redirect_to edit_admin_user_path , notice: \"User (#{@user.email}) password was successfully updated.\" }\n format.json\n end \n else\nrespond_to do |format|\nformat.html { render action: \"edit\" , notice: \"User was successfully deleted.\"}\nformat.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n\nend", "def update_email_and_password_from_account\n\n\t\t# remember i could put here @petowner = Petowner.find( params[:id] ) but because require_correct_petowner has to run before any action, we already have this line of code in that method @petowner = Petowner.find( params[:id])\n\n\t\tif params[:commit] == \"Save email changes\"\n\n\n\t\t\tif params[:personal_email].blank? || params[:confirm_personal_email].blank?\n\n\t\t\t\tflash[:alert] = \"!! Please make sure all email addresses are present before saving changes !!\" \n\n\n\t\t\telse\n\n\t\t\t\tif params[:personal_email] == params[:confirm_personal_email]\n\n\t\t\t\t\t# change in db to update the new email\n\t\t\t\t\t@petowner.personal_email = params[:personal_email]\n\t\t\t\t\t@petowner.save\n\n\t\t\t\t\tflash[:notice] = \"!! You have successfully updated your email address !!\"\n\t\n\t\t\t\telse\n\n\t\t\t\t\tflash[:alert] = \"!! Email and email confirmation do not match. Try again !!\"\n\n\n\t\t\t\tend\n\n\n\t\t\tend\n\n\t\t\t\n\t\t\t\n\t\telsif params[:commit] == \"Save password changes\"\n\n\t\t\tif params[:password].blank? || params[:confirm_password].blank?\n\n\t\t\t\tflash[:alert] = \"!! Please make sure both password and password confirmation are present before saving changes !!\" \n\n\n\t\t\telse\n\n\t\t\t\tif params[:password] == params[:confirm_password]\n\n\t\t\t\t\t# change in db to update the new email\n\t\t\t\t\t@petowner.password = params[:password]\n\t\t\t\t\t@petowner.save\n\n\t\t\t\t\tflash[:notice] = \"!! You have successfully updated your password !!\"\n\t\n\t\t\t\telse\n\n\t\t\t\t\tflash[:alert] = \"!! Password and Password confirmation do not match. Try again !!\"\n\n\n\t\t\t\tend\n\n\t\t\tend\n\n\n\n\t\tend\n\n\n\n\n\t\tredirect_to pet_owner_dashboard_account_details_path(@petowner.id)\n\n\tend", "def update?\n user == identity.user\n end" ]
[ "0.67362064", "0.6712289", "0.6692839", "0.66788125", "0.66229546", "0.6571586", "0.6489177", "0.64311165", "0.64148104", "0.64068735", "0.6312864", "0.630796", "0.62939876", "0.6271059", "0.6265699", "0.62381893", "0.62368757", "0.6231109", "0.62289834", "0.62174016", "0.6213419", "0.6205745", "0.6193487", "0.61906165", "0.6184514", "0.6175307", "0.61575466", "0.6154367", "0.6152489", "0.61462045", "0.6145375", "0.6142981", "0.6111639", "0.6111575", "0.6103676", "0.61002296", "0.60915715", "0.6088359", "0.60732067", "0.60673916", "0.60623056", "0.60570073", "0.60564196", "0.6055736", "0.60549307", "0.60488224", "0.6046501", "0.6044088", "0.60431343", "0.60394514", "0.6039448", "0.6038916", "0.60379845", "0.6035454", "0.60337627", "0.60213447", "0.6008165", "0.60071063", "0.60055417", "0.6004461", "0.6004047", "0.6002364", "0.59931546", "0.59735745", "0.5966464", "0.5962115", "0.5958752", "0.59545124", "0.5951456", "0.5948995", "0.5944703", "0.5936302", "0.59213805", "0.59141606", "0.5909017", "0.5903045", "0.5899827", "0.58967596", "0.58949286", "0.58949226", "0.58917814", "0.5888349", "0.5884859", "0.5884592", "0.58843935", "0.5884094", "0.5884094", "0.58782154", "0.5873848", "0.5872271", "0.58687305", "0.58685356", "0.5863841", "0.5863579", "0.58596104", "0.58589786", "0.5856127", "0.58545125", "0.5853385", "0.5852355", "0.58489484" ]
0.0
-1
original `create_format_method` overrides `format` method with metaprogramming
def create_format_method end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format(format, *arguments); end", "def create_format_method\n case @style\n when :json; Parseable.create_json_format_method(self)\n when :yaml; Parseable.create_yaml_format_method(self)\n else raise ArgumentError, \"unknown format style '#@style'\" end\n end", "def format\n raise NotImplementedError\n end", "def happy_format(type, meth, *args)\n Formatter.new(send(meth.to_sym), type, args[0], args[1]).format\n end", "def format(fmt, *rest) end", "def _process_format(format); end", "def _process_format(format); end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def __format(params)\n # Define singleton method.\n instance_eval(_format_method, __FILE__, __LINE__)\n # Delegate to singleton method.\n __format(params)\n end", "def format\n @_format\n end", "def format\n raise '#format must be implemented in child class'\n end", "def formatter\n raise NotImplementedError\n end", "def format(value = nil, &block)\n __define__(:format, value, block)\n end", "def formats; end", "def formats; end", "def format!; end", "def formats\n format\n end", "def format(text); end", "def format *formats\n format! *formats << true\n end", "def st_format(f)\n if self.class.st_config[:formats].respond_to?(:call)\n self.class.st_config[:formats].call(f.to_sym)\n else\n if self.class.st_config[:formats][f].is_a?(Symbol)\n self.send(self.class.st_config[:formats][f])\n else\n self.class.st_config[:formats][f]\n end\n end\n end", "def format\n @format ||= properties.format.new self\n end", "def formatter; end", "def formatter; end", "def formatter; end", "def format=(_arg0); end", "def format=(_arg0); end", "def format=(_arg0); end", "def format=(_arg0); end", "def _process_format(format) # :nodoc:\n end", "def format(meth=nil, &block)\n @value_format ||= (meth ? meth : block)\n end", "def format\n @format\n end", "def format(name=nil)\n @format = name.to_s if name\n @format || DEFAULT_FORMAT\n end", "def formatters; end", "def format(formatter = self.class.formatter, **options)\n formatter.format(self, options)\n end", "def formatter=(_arg0); end", "def formatter=(_arg0); end", "def formatter=(_arg0); end", "def format(&block)\n @format = block if block\n @format\n end", "def date_formats\n now = Time.now\n [:to_date, :to_datetime, :to_time].each do |conv_meth|\n obj = now.send(conv_meth)\n puts obj.class.name\n puts \"=\" * obj.class.name.length\n name_and_fmts = obj.class::DATE_FORMATS.map { |k, v| [k, %Q('#{String === v ? v : '&proc'}')] }\n max_name_size = name_and_fmts.map { |k, _| k.to_s.length }.max + 2\n max_fmt_size = name_and_fmts.map { |_, v| v.length }.max + 1\n name_and_fmts.each do |format_name, format_str|\n puts sprintf(\"%#{max_name_size}s:%-#{max_fmt_size}s %s\", format_name, format_str, obj.to_s(format_name))\n end\n puts\n end\nend", "def _format_method\n return @_format_method if @_format_method\n\n arguments_type = ::Hash\n @_has_parameters = false\n\n # RANT RANT RANT:\n # THIS CODE DOES NOT WORK.\n # there is a bug in the Ruby parser in some cases.\n # In this object:\n # instance_eval(\"t :foo\")\n # cannot parse :foo\n # However it works fine in irb and ruby -e.\n #\n # kurt@cashnetusa.com 2009/01/08\n=begin\n # Handle early subsititions.\n @_template = @template.gsub(/\\<\\{\\{(.*?)\\}\\}\\>/) do | m |\n expr = $1\n # expr = \"(#{expr}).to_s\"\n expr = \"\\n#{expr}\\n\"\n expr = \"begin#{expr}end\"\n #expr = \";nil; (#{expr});\"\n # expr = \"lambda { || #{expr}; }.call\"\n $stderr.puts \"expr = #{expr}\"\n #Contenter::Api::Selector.with(@_selector) do\n result = instance_eval(expr).to_s\n #end\n # $stderr.puts \"result = #{result.inspect}\"\n result\n end\n=end\n @_template ||= @template\n @_template = @template if @_template == @template\n @_template.freeze\n\n parameter_offset = -1\n p = @_template\n t = \"'\"\n until p.empty?\n case\n # Escape string delimiters.\n when m = /\\A([\\\\'])/.match(p)\n t << '\\\\' + m[1]\n\n # Parameter subsititutions.\n when m = /\\A(\\{\\{\\{(.*?)\\}\\}\\})/.match(p)\n t << '\\' << (' << m[2] << ').to_s << \\''\n @_has_parameters = true\n\n # \"early\" subsititutions.\n # SEE RANT ABOVE.\n when m = /\\A(\\<\\{\\{(.*?)\\}\\}\\>)/.match(p)\n t << '\\' << (' << m[2] << ').to_s << \\''\n @_has_parameters = true\n\n else\n t << p[0 .. 0]\n p = p[1 .. -1]\n \n end\n \n p = m.post_match if m\n end\n t << \"'\"\n\n # STDERR.puts \"template #{template.inspect} => #{t.inspect}\"\n\n # Decide on arguments defaults depending on the template substitutions.\n @arguments_default = \n case arguments_type\n when ::Array\n EMPTY_ARRAY\n when ::Hash\n EMPTY_HASH\n else\n EMPTY_HASH\n end\n @arguments = @arguments_default\n\n # $stderr.puts \"arguments = #{@arguments.inspect}\"\n # $stderr.puts \"arguments_default = #{@arguments_default.inspect}\"\n \n # Define a __format singleton method.\n # TODO: Not thread-safe.\n if @_has_parameters\n t = <<-\"END\"\n def self.__format(args)\n arguments_save = @arguments\n @arguments = args || @arguments_default\n #{t}\n ensure\n @arguments = arguments_save\n end\nEND\n else\n t = <<-\"END\"\n def self.__format(args)\n @_template\n end\nEND\n end\n\n # $stderr.puts \"@_format =\\n#{t}\"\n\n @_format_method = t.freeze\n\n rescue Exception => err\n new_err = err.class.new(\"#{err} in #{self.inspect}:\\n #{err.backtrace * \"\\n \"}\")\n raise new_err\n end", "def format(format_name)\n valid_for 'string'\n assert_string format_name\n set format: format_name\n end", "def format=(procedure); end", "def formats(*args, &block)\n unless respond_to?(:model_formatting_attributes)\n # use all these attributes instead of a single ModelFormatting::Config because\n # it's easier to support subclassing.\n class_attribute :model_formatting_attributes, \n :model_formatting_white_list, :model_formatting_context, \n :model_formatting_before_callback, :model_formatting_after_callback\n send :include, ModelFormatting::InstanceMethods\n self.model_formatting_context = []\n self.model_formatting_attributes = {} \n self.model_formatting_white_list = HTML::WhiteListSanitizer.new\n before_save :format_content_with_model_formatting\n end\n\n model_formatting_attributes.update args.extract_options!\n args.each do |field|\n model_formatting_attributes[field] = \"formatted_#{field}\"\n end\n\n if block\n config = ModelFormatting::Config.new(model_formatting_white_list, model_formatting_attributes, model_formatting_context)\n config.instance_eval &block\n self.model_formatting_before_callback = config.before_callback if config.before_callback\n self.model_formatting_after_callback = config.after_callback if config.after_callback\n end\n end", "def format(args = {})\n to_s\n end", "def format\n @format ||= self._format_default\n end", "def format\n lookup_val = Integer(@rf['format'])\n @_format ||= format_proxy.lookup_format_name(lookup_val)\n rescue\n @rf['format']\n end", "def format(format, &block)\n scope :format => format, &block\n end", "def format\n return @format\n end", "def format\n return @format\n end", "def format\n return @format\n end", "def method_missing(method, *args)\n \"#{method.to_s} not a valid formatter!\"\n end", "def format\n @format ||= Manipulator.new\n end", "def format\n @format ||= {}\n end", "def format(*args)\n to_s % [*args]\n end", "def format_arguments; end", "def format _label, _value\n raise NotImplementedError, self\n end", "def to_format\n @format ||= lookup.last \n end", "def format(format, *arguments)\n @format = format\n @format_arguments = *arguments unless arguments.empty?\n end", "def with_format(format)\n old_formats = formats\n self.formats = [format]\n yield\n self.formats = old_formats\n nil\n end", "def format_symbol\n\t\t:format\n\tend", "def with_format(format, &block)\n old_formats = formats\n self.formats = [format]\n yield\n self.formats = old_formats\n nil\n end", "def format\n collect { |a| a.format }\n end", "def formatter fmt\n @formatter = fmt\n end", "def format(*rules)\n return self.class.zero if zero? && self.class.zero\n\n # This section included for compatiblity since format in this fork\n # uses a splatted array instead of a hash to accept parameters\n # Hashes are needed to pass multi-dimensional parameters such as :precison => 5\n # BEGIN compatibility block\n rules_hash = {}\n rules.each do |rule|\n if rule.is_a?(Hash)\n rule.each_key do |key|\n rules.push(key)\n rules_hash[key] = rule[key]\n end\n end\n end\n # END of compatibility block\n\n # flattening array to allow explicit passing of arrays\n rules = rules.flatten\n\n formatted =\n if rules.include?(:no_cents)\n \"$#{to_s(0)}\"\n elsif rules.include?(:precision)\n \"$#{to_s(rules_hash[:precision])}\"\n else\n \"$#{to_s(2)}\"\n end\n\n # BJM: Apply thousands_separator\n thousands_separator_value = ','\n decimal_separator = '.'\n regexp_decimal = Regexp.escape(decimal_separator)\n\n formatted_parts = formatted.split(decimal_separator)\n integer_part = formatted_parts.first\n decimal_part = formatted_parts.last unless rules.include?(:no_cents)\n\n integer_part.gsub!(/(\\d)(?=(?:\\d{3})+(?:[^\\d]{1}|$))/, \"\\\\1#{thousands_separator_value}\")\n\n formatted = \"#{integer_part}\"\n\n formatted += \"#{decimal_separator}#{decimal_part}\" unless rules.include?(:no_cents)\n\n # BJM: move negative outside ($-2.00 => -$2.00)\n formatted.gsub!('$-', '-$')\n\n # BJM: use parenthesis if requested and required\n if rules.include?(:parenthesize_negative) && formatted.gsub!('-$', '$')\n formatted = \"(#{formatted})\"\n end\n\n if rules.include?(:with_currency)\n formatted << \" \"\n formatted << '<span class=\"currency\">' if rules.include?(:html)\n formatted << currency\n formatted << '</span>' if rules.include?(:html)\n end\n \n formatted\n end", "def format_string(format, params = {})\n format % params\n end", "def formatter()\n @formatter\n end", "def formatter(formatter = T.unsafe(nil)); end", "def to_s ; format ; end", "def stub_formatted(object, format)\n return unless format\n object.stub!(\"to_#{format}\").and_return(\"#{object.class} formatted as #{format}\")\n end", "def method_missing(format, *args, &block)\n raise ArgumentError, \":#{format} format already set\" if formats.any? { |name, proc| name.eql?(format) }\n raise ArgumentError, 'Must not supply both argument and block' if !args.empty? && block_given?\n if !args.empty? && (!args.first.nil? || args.size > 1)\n raise ArgumentError, 'The only argument accepted is nil for disabling formats'\n end\n formats << [format, block || (args.empty? ? proc {} : nil)]\n end", "def format(format_value)\n @template.format = format_value\n end", "def format(fmt)\n scoped_formats.push(fmt)\n yield\n ensure\n scoped_formats.pop\n end", "def format_args(args)\n method = \"format_#{self.argtype}\"\n self.__send__(method, args)\n end", "def to_formatted_s(format = :default)\n RANGE_FORMATS[format] ? RANGE_FORMATS[format].call(first, last) : to_default_s\n end", "def with_format(format, &block)\n old_formats = formats\n begin\n self.formats = [format]\n return block.call\n ensure\n self.formats = old_formats\n end\n end", "def define_format_helpers global_formats, strict_formats\n (all_formats = (global_formats + strict_formats.map {|s| s.last}.flatten).uniq)\n (all_formats = Hash[all_formats.zip(all_formats)]).each_key do |f|\n method_name = '%s?' % f.sub('.', '')\n define_method method_name do\n # Hash searching is a lot faster than String comparison\n all_formats[format]\n end\n private method_name\n end\n end", "def format=(name)\n @format = name.to_s\n end", "def set_format *args\n global, format = args.fetch_opts [nil], :type => :console, :time => [\"%H:%M:%S\", \"%03d\"] \n format = if format[:type] == :html; {\n :caller => \"<a class='l'>%f:%l</a> <a class='m'>:%m</a>\", \n :format => \"<div class='line'><a class='t'>%time</a> <a class='%mode'>%mode</m> [%caller]: <p>%text</p>%att</div>\",\n :att =>\"<div class='att'><div class='hide'>+</div><pre>%s</pre></div>\",\n :serializer => RMTools::RMLogger::HTML\n }; else {\n :caller => \"#{@c.gray('%f:%l')} #{@c.red_bold(':%m')}\", \n :format => \"%time %mode [%caller]: %text\"\n } end.merge format\n if global\n _set_format @default_format, format\n else\n _set_format(file_format={}, format)\n @file_formats[File.expand_path(caller[0].till ':')] = file_format\n end\n end", "def format\n \"#{amount} #{currency}\"\n end", "def format(value = nil)\n if value.nil?\n @format ||= nil\n else\n @format = value\n end\n end", "def format\n @spec[:format]\n end", "def with_format(format, &block)\n\t old_formats = formats\n\t self.formats = [format]\n\t block.call\n\t self.formats = old_formats\n\t nil\n\tend", "def format(value)\n _format(value) or fail ArgumentError, \"Unknown value for format: #{value}\"\n end", "def format(value)\n _format(value) or fail ArgumentError, \"Unknown value for format: #{value}\"\n end", "def format_message(*args)\n old_format_message(*args)\n end", "def formatted format\n {:status => status, :error => exception.message}.send to_format(format)\n end", "def initialize\n @formatter = method(:default_formatter)\n end", "def formatted(options={})\n options = {:order => nil,\n :separator => '/',\n :international => :jp,\n :months => nil}.merge(options)\n order = options[:order] ? options[:order] : SYMBOLS_ORDER[options[:international]]\n codes = order.map {|o| SYMBOLS_TO_CODE[o]}.compact.uniq\n text = codes.serialize(options[:separator])\n text = self.strftime(text)\n if options[:months]\n array = text.deserialize(options[:separator])\n index = order.index(:month)\n month = array[index].to_i - 1\n array[index] = case options[:months]\n when :short then MONTHS_SHORT[:en][month]\n when :long then MONTHS_LONG[:en][month]\n else array[index]\n end\n array.serialize(options[:separator])\n else\n text\n end\n end", "def format(options = {})\n options = options.dup\n o = {}\n o[k = :color] = (v = options.delete(k)).nil?? true : v\n raise ArgumentError, \"Unknown option(s): #{options.inspect}\" if not options.empty?\n\n require_valid\n\n Colorize.colorize *[\n (own?? [[:list_method, :own_marker], OWN_MARKER[0]] : [[:list_method, :not_own_marker], OWN_MARKER[1]]),\n [[:list_method, :obj_module_name], obj_module_name],\n ([[:list_method, :owner_name], \"(#{owner_name})\"] if not own?),\n [[:list_method, :access], access],\n [[:list_method, :name], method_name],\n ([[:list_method, :visibility], \" [#{visibility}]\"] if not public?),\n [[:reset]],\n ].compact.flatten(1).reject {|v| v.is_a? Array and not o[:color]}\n end", "def format(format, description, &block)\n @formats[format] = {\n :desc => description,\n :proc => block\n }\n end", "def method_missing(meth, *args, &block)\n if meth.to_s =~ /^happy_inter_(.+)$/\n happy_format(:international, $1, *args)\n elsif meth.to_s =~ /^happy_mask_(.+)$/\n happy_format(:mask, $1, *args)\n elsif meth.to_s =~ /^happy_(.+)$/\n happy_format(:national, $1, *args)\n else\n super\n end\n end", "def formatted_value\n formatter = @format.downcase.split(' ').map do |part|\n if (parsed_format = parse_date_or_time_format(part))\n parsed_format\n else\n warn 'Unable to parse custom format. Using \"YYYY-mm-dd HH:MM:SS\" format.'\n return @value.strftime('%F %T')\n end\n end.join(' ')\n\n @value.strftime(formatter)\n end", "def to_format(formatter_klass, options={})\n formatter_klass.new(self, options).output\n end" ]
[ "0.7575126", "0.7554109", "0.7434239", "0.7395717", "0.7335282", "0.730108", "0.730108", "0.73003274", "0.73003274", "0.73003274", "0.73003274", "0.73003274", "0.73003274", "0.73003274", "0.73003274", "0.7283679", "0.7168306", "0.7146824", "0.71324587", "0.70680845", "0.7042689", "0.7042689", "0.70037925", "0.6916598", "0.68935263", "0.6880388", "0.6862573", "0.68502873", "0.68372226", "0.68372226", "0.68372226", "0.67845", "0.67845", "0.67845", "0.67845", "0.67201793", "0.671364", "0.66906774", "0.6664745", "0.66036266", "0.66001093", "0.6588602", "0.6588602", "0.6588602", "0.6566406", "0.6558578", "0.65414965", "0.64949185", "0.64879787", "0.6486882", "0.6483701", "0.64685196", "0.6438826", "0.6425274", "0.641505", "0.641505", "0.641505", "0.640502", "0.64009035", "0.639479", "0.6383553", "0.6357485", "0.6347703", "0.6338299", "0.632337", "0.6321411", "0.6299563", "0.6260153", "0.62593526", "0.62517065", "0.62504363", "0.6236434", "0.623541", "0.6231733", "0.6230853", "0.62183875", "0.6213552", "0.6203302", "0.6199155", "0.618339", "0.6177868", "0.61742413", "0.61664784", "0.61297905", "0.6110546", "0.6109327", "0.61018133", "0.6082808", "0.60760015", "0.606845", "0.60669744", "0.60385287", "0.6035998", "0.6029904", "0.60260093", "0.60052437", "0.6004232", "0.59956735", "0.5993801", "0.5983821" ]
0.8282342
0
Helper method to define a method on this class from Ruby.
def def(name, &block) @runtime_methods[name.to_s] = block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 method=(_); end", "def h_instance_method(name, args, &body)\n\t\t\t@instance_methods[name] = RubyHMethod.new(name, args, &body)\n\t\tend", "def method=(_arg0); end", "def method=(_arg0); end", "def method=(_arg0); end", "def methods=(_arg0); end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def( name, &blk )\r\n class_eval { define_method name, &blk }\r\n end", "def method_builder; end", "def method_missing(method_name, *args) self end", "def method_missing(method_name, *args) self end", "def method_name=(_arg0); end", "def method_name=(_arg0); end", "def class_def name, &blk\r\n class_eval { define_method name, &blk }\r\n end", "def methods() end", "def class_def( name, &blk )\n class_eval { define_method name, &blk }\n end", "def class_def(name, &blk)\n class_eval { define_method name, &blk }\n end", "def create_method( name, &block )\n self.class.send( :define_method, name, &block )\n end", "def custom; end", "def custom; end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def method_missing(code, *args, &blk); end", "def method_missing(code, *args, &blk); end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class() end", "def define_class_method(name, &code)\n singleton_class.instance_eval { define_method(name, &code) }\n end", "def create_method(name, &block)\n eigen = class << self; self; end\n eigen.send(:define_method, name, &block)\n end", "def def_class(superklass=Object, methodname='result')\n cls = Class.new(superklass)\n def_method(cls, methodname, @filename || '(ERB)')\n cls\n end", "def method\r\nend", "def mk_method(proc)\n @klass.send(:define_method, @method_name, proc)\n end", "def intersys_method(name)\n Method.new(database, class_name, name.to_s, self)\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def create_abstract_instance_method(name); end", "def instance_method(p0) end", "def a_method\n self\n end", "def add_method_to(cls)\n cls.class_eval do\n def m; 'hello'; end\n end\nend", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def method_missing(method, *args, &blk); end", "def class=(_arg0); end", "def my_method_param(name) #Define method \"my_method_param\"\n print \"Hello #{name}!\"\nend", "def method_symbol; end", "def public_method; end", "def public_class_method(*rest) end", "def create_method(name, &block)\n\t\t\tself.class.send(:define_method, name, &block)\n\t\tend", "def meta_def( name, &blk )\r\n meta_eval { define_method name, &blk }\r\n end", "def meta_def name, &blk\n meta_eval { define_method name, &blk }\n end", "def meta_def name, &blk\n meta_eval { define_method name, &blk }\n end", "def initialize method, *args, &block # :nodoc:\n raise TypeError, \"#{self.class} need to the symbol of the method.\" unless method.respond_to? :to_sym\n @current = natural method, *args, &block\n @callings = [@current]\n end", "def define_class_method(name, &block)\n (class << self; self; end).instance_eval do\n define_method name, &block\n end\n end", "def implementation; end", "def implementation; end", "def class_def(name, &blk)\n class_eval { define_method(name, &blk) }\n end", "def method\n\t\t# code code\n\tend", "def _define_method(method)\n #Getters\n self.class.send(:define_method, method) do\n _get method.to_sym\n end\n\n #Setters\n self.class.send(:define_method, \"#{method.to_s}=\") do |value|\n _set method, value\n end\n\n #Incrementer\n self.class.send(:define_method, \"inc_#{method.to_s}\") do |*args|\n value = args.first || 1\n _inc method, value\n end\n\n #Decrementer\n self.class.send(:define_method, \"dec_#{method.to_s}\") do |*args|\n value = args.first || 1\n _dec method, value\n end\n end", "def method_missing(method, *args, &block)\n if Parser::PROPERTIES.include?(method)\n self.class.define_property_method(method)\n send(method, *args, &block)\n elsif Parser::METHODS.include?(method)\n self.class.define_method_method(method)\n send(method, *args, &block)\n elsif method.to_s =~ /([a-z_]+)\\?/ and (Parser::PROPERTIES + Parser::METHODS).include?($1.to_sym)\n self.class.define_question_method($1)\n send(method)\n else\n super\n end\n end", "def meta_def name, &blk\n meta_eval { define_method name, &blk }\n end", "def meta_def name, &blk\n meta_eval { define_method name, &blk }\n end", "def ruby_code(obj); end", "def add_method(method)\n object = self.class.find_class_named 'Object'\n object = add_class RDoc::NormalClass, 'Object' unless object\n\n object.add_method method\n end", "def method(*args)\n define_expressions(Method, args)\n end", "def x(y)\n raise NotImplementedError, \"Define #{__method__}() in the inherited class.\"\n end", "def define(name, code=nil, &blk)\r\n\t\t\tif code and not blk then blk = proc{instance_eval(code)} end\r\n\t\t\tmetaclass.__send__(:define_method, name, &blk)\r\n\t\t\t@commands << name.to_s unless @commands.include?(name.to_s)\r\n\t\tend", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def meta_def(name, &blk)\n meta_eval { define_method name, &blk }\n end", "def meta_def name, &blk\n meta_eval { define_method name, &blk }\n end", "def my_method\n end", "def meta_def name, &blk\n meta_eval { define_method name, &blk }\n end", "def method_missing(method, *args, &block); end", "def meta_def name, &blk\r\n meta_eval { define_method name, &blk }\r\n end", "def meta_def( name, &blk )\n meta_eval { define_method name, &blk }\n end", "def method c\r\nend", "def run(*)\n raise NotImplementedError, \"Expected #{self.class} to implement ##{__method__}\"\n end", "def creating_instance_method_using_define_methods *methods\n methods.each do |method_name|\n self.class.send :define_method, method_name do |arg|\n \"The arg called #{arg}\"\n end\n end\n end", "def write\n @ruby_name = Inflector.underscore(code.name)\n\n self.prefix ||= \"#{self.parent.rice_variable}.\"\n self.suffix ||= \"\"\n\n if self.code.arguments.size == 1 && (fp = self.code.arguments[0].cpp_type.base_type).is_a?(RbGCCXML::FunctionType)\n wrap_with_function_pointer(fp)\n else\n wrap_normal_method\n end\n end" ]
[ "0.6782219", "0.6782219", "0.6782219", "0.6782219", "0.6782219", "0.6782219", "0.6782219", "0.6782219", "0.6782219", "0.6782219", "0.6782219", "0.6782219", "0.65273666", "0.6387667", "0.63664657", "0.63664657", "0.63664657", "0.63308334", "0.62953603", "0.62953603", "0.6292123", "0.6292123", "0.62427384", "0.62198323", "0.6205886", "0.6205886", "0.618374", "0.618374", "0.61698234", "0.61644953", "0.61642003", "0.6154559", "0.6150123", "0.61442274", "0.61442274", "0.61436045", "0.6143143", "0.6143143", "0.6140917", "0.60928494", "0.6081317", "0.6076995", "0.605659", "0.60519296", "0.60497403", "0.6047805", "0.60469323", "0.60469323", "0.60469323", "0.60469323", "0.60469323", "0.60469323", "0.6046284", "0.6034043", "0.6033329", "0.6019067", "0.597353", "0.59722567", "0.59722567", "0.59722567", "0.59722567", "0.5971937", "0.597182", "0.5951967", "0.59488904", "0.5943563", "0.5933521", "0.5931108", "0.5924112", "0.5918283", "0.5918283", "0.5917425", "0.5913693", "0.59106994", "0.59106994", "0.5906681", "0.5898428", "0.58895737", "0.58669406", "0.5866364", "0.5866364", "0.5864731", "0.5859948", "0.58533174", "0.58427835", "0.58373016", "0.58221364", "0.58221364", "0.58221364", "0.58221364", "0.5821565", "0.5819147", "0.58176106", "0.58157593", "0.5809376", "0.58078265", "0.58058524", "0.57944673", "0.57891315", "0.5764545", "0.57583153" ]
0.0
-1
Create a new instance of this class
def new AwesomeObject.new(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new()\n #This is a stub, used for indexing\n end", "def new(*args)\n self.class.new(*args)\n end", "def new\n self\n end", "def new(*args)\n self.class.new(*args)\n end", "def new #:nodoc:\n end", "def constructor; end", "def new\n \n end", "def new(opts = {})\n klass.new(opts)\n end", "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end", "def self_new\n raise \"Not implemented.\"\n end", "def new\n new_with_value(nil)\n end", "def initialize\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def newInstance( params={} )\n model.new( params ).extend( InstanceMethods )\n end", "def new(*args)\n raise NoMethodError.new(\"You can not instaniate this class!\")\n end", "def new\n BaseObject.new(self)\n end", "def create\n name_to_const.new\n end", "def new(*args) dup.initialize(*args) end", "def new(*)\n load\n super\n end", "def construct\n end", "def initialize() 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 build\n klass = create_class(@class_name, @options)\n klass.new\n end", "def new\n BikeObject.new(self, 'Object', @type, @name)\n end", "def new \n end", "def new(opts = {})\n super(opts).tap do |obj|\n add(obj)\n end\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 initialize\n end", "def initialize()\n end", "def initialize\n create_new_rep\n end", "def new\n\t\t\n\tend", "def new\n\t\t\n\tend", "def new(components)\n self.class.new(self, components)\n end", "def initialize\r\n\r\n end", "def build_new(*args)\n self.class.new(*args)\n end", "def new\n @record = Record.new()\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 end", "def new(*args, &block)\n object = mapper.new_object(*args, &block)\n track(object)\n object\n end", "def new\n super\n end", "def new(*args,&block)\n Base.new(*args,&block)\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def new\n @element = @@model.new()\n end", "def create(name)\n self.new(name)\n end", "def initialize\n end", "def instantiate\n resource.new(data)\n end", "def new\n @theory = Theory.new\n end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def create(attribs={})\n obj = new\n obj.send :create, attribs\n obj\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end" ]
[ "0.8204378", "0.8204378", "0.8204378", "0.8204378", "0.8204378", "0.80909187", "0.8064249", "0.8064249", "0.8064249", "0.8064249", "0.8064249", "0.8064249", "0.8064249", "0.8064249", "0.8064249", "0.79288685", "0.7722875", "0.76763016", "0.76298636", "0.75340426", "0.7497188", "0.7337153", "0.72663796", "0.7241888", "0.7229337", "0.72099125", "0.72026867", "0.7176314", "0.7176314", "0.7176314", "0.7176314", "0.7176314", "0.7128014", "0.71241236", "0.7078534", "0.7067132", "0.7031718", "0.7031311", "0.7012277", "0.7011264", "0.6954483", "0.6954483", "0.6954483", "0.6954483", "0.6954483", "0.6954483", "0.6921427", "0.6906577", "0.6890332", "0.6865692", "0.6857717", "0.6857717", "0.6857717", "0.6857717", "0.6857717", "0.6857717", "0.6857717", "0.6857717", "0.6857717", "0.6843417", "0.68400574", "0.6837476", "0.6837476", "0.68290055", "0.68287885", "0.6820245", "0.6813002", "0.68099034", "0.68099034", "0.68099034", "0.68099034", "0.68099034", "0.68099034", "0.68099034", "0.68099034", "0.68099034", "0.68099034", "0.68099034", "0.6785097", "0.6780238", "0.6758044", "0.67494565", "0.67417717", "0.67417717", "0.67417717", "0.67417717", "0.67417717", "0.67401034", "0.67270553", "0.6724048", "0.67225784", "0.67199165", "0.67191994", "0.6711657", "0.67045367", "0.67045367", "0.67045367", "0.67045367", "0.67045367" ]
0.68861055
50
Create an instance of this Awesome class that holds a Ruby value. Like a String, number, or true
def new_with_value(value) AwesomeObject.new(self, value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_value(value)\n AwesomeObject.new(self, value)\n end", "def initialize(awesome_class, ruby_value=self)\n @awesome_class = awesome_class\n @ruby_value = ruby_value\n end", "def initialize(value)\n @value = value\n @type = self.class.type\n end", "def new_with_value(value, type = nil)\n BikeObject.new(self, value, type || @type)\n end", "def value_object\n @value_class ||= create_value_class\n end", "def initialize(value = self.class.default)\n self.value = value\n end", "def value_object\n @value_class ||= create_value_class\n end", "def end_value(value)\n case value\n when TrueClass, FalseClass\n Boolean.new(value)\n when Numeric\n Number.new(value)\n when ::String\n JsonProjection::String.new(value)\n when NilClass\n Null.empty\n end\n end", "def initialize(type, value)\n @type = type\n @value = value\n end", "def initialize(value)\n self.value = value\n end", "def initialize(value)\n self.value = value\n end", "def new_with_value(value)\n RObject.new self, value\n end", "def initialize(value)\n @value = value\n end", "def initialize(value)\n @value = value\n end", "def initialize(value)\n @value = value\n end", "def initialize(value)\n @value = value\n end", "def initialize(value)\n @value = value\n end", "def initialize(value = nil)\n value.freeze unless value.nil? || value == true || value == false\n @value = value\n @options = nil\n end", "def initialize( value )\n\t\tself.value = value\n\tend", "def initialize(value)\n @value = value\n end", "def initialize(value)\n @value = value\n end", "def initialize(value)\n @value = value\n end", "def initialize(value)\n @value = value\n end", "def initialize(value)\n @value = value\n end", "def initialize(value)\n @value = value\n end", "def initialize(value)\n @value = value\n end", "def as(value)\n @value = value\n end", "def initialize(type,value)\n @type, @value = type, value\n\n end", "def from_native(value, ctx)\n new(value)\n end", "def new_with_value(value)\n RuntimeObject.new(self, value)\n end", "def initialize(value)\n\t\t@value = value\n\tend", "def initialize val\n @val=\n case val\n when Numeric, String\n val.to_f\n when Length\n val.send(\"to_#{self.class.name.downcase}\").to_f\n else\n raise TypeError, \"cannot initialize #{self.class} from #{val.class}\"\n end\n end", "def initialize(type:, value:)\n @type = type\n @value = value\n end", "def initialize(value)\r\n @value = value\r\n end", "def initialize(name, value, is_double=false, funky=nil)\n @name = Cliche.symbolize_name(name)\n @value = value\n @is_double = is_double\n @funky = funky.nil? ? :d6 : funky\n end", "def initialize(value = nil)\n @value = value\n end", "def initialize(code)\n @value = case code\n when \"nil\", \"F\"\n nil\n when \"T\"\n true\n else\n ret = Alpha.evaluate code\n if ret == false\n Number.evaluate code\n else\n ret\n end\n end\n end", "def initialize(value)\n @value = value\n freeze\n end", "def initialize(value)\n @value = value\n freeze\n end", "def initialize(value = :none)\n @value = value || :none\n end", "def initialize(value=\"\")\n @value = value\n end", "def get(value)\n return nil if value.nil?\n value.is_a?(self) ? value : self.new(value)\n end", "def initialize(value, options = {})\n @datatype = RDF::URI(options[:datatype] || DATATYPE)\n @string = options[:lexical] if options.has_key?(:lexical)\n @string = value if !defined?(@string) && value.is_a?(String)\n @object = case\n when value.is_a?(::String) then Float(value) rescue nil\n when value.is_a?(::Float) then value\n when value.respond_to?(:to_f) then value.to_f\n else Float(value.to_s) rescue nil\n end\n end", "def initialize value, type_num, is_mandatory, is_array = false\n @type_num = type_num\n @value = value\n @is_mandatory = is_mandatory\n @is_array = is_array\n end", "def __value(v); end", "def initialize(type, value)\n @value = Hash[type: type, value: value]\n end", "def value(klass = 'number_value')\n v = @attributes[klass] \n if self.new_record? && \n (!v || (v.respond_to?(:empty?) && v.empty?))\n eval default_code\n else\n v\n end\n end", "def value\n Native(val)\n end", "def initialize(name, type, value)\n\t\t@name, @type= name, type\n\t\tassign(value)\n\tend", "def literal(value)\n end", "def value\n if self[:value_type].present?\n case self[:value_type].to_sym\n when :string, :text\n self[:value].to_s\n when :password\n self[:value].to_s\n when :decimal\n BigDecimal.new(self[:value].to_s).round(2, BigDecimal::ROUND_HALF_UP)\n when :integer\n self[:value].to_i\n when :boolean\n (self[:value].to_s =~ /^[t|1]/i) != nil\n else\n self[:value].is_a?(String) ? YAML.load(self[:value]) : self[:value]\n end\n else\n self[:value]\n end\n end", "def initialize(raw_value)\n @raw_value = raw_value\n raise ArgumentError, \"Invalid value: #{raw_value}\" unless self.class.valid?(raw_value)\n freeze\n end", "def getRubyValue\n @ruby_value\n end", "def initialize(name, value)\n self.value = value\n self.name = name\n end", "def convert_value(val)\n case basic_type\n when nil\n val\n when /^str/i\n (val.nil? or val.empty?) ? nil : val\n when /^bool/i\n if val.is_a?(TrueClass) or val.is_a?(FalseClass)\n val\n elsif val.is_a?(String)\n !!(['1', 't', 'T'].include?(val))\n elsif val.is_a?(Numeric)\n !!val.nonzero?\n else\n val\n end\n when /^int/i\n val.to_i\n else\n val\n end\n end", "def initialize(value)\n raise 'Invalid operand!' unless self.class.valid? value\n\n @value = value\n end", "def value\n to_type(@value)\n end", "def define_type_and_value\n if boolean?\n @type = :boolean\n @value = @arg[:boolValue]\n elsif string?\n @type = :string\n @value = @arg[:textValue]\n elsif datetime?\n @type = :datetime\n @value = @arg[:datetimeValue]\n elsif extension?\n @type = :extension\n @value = @arg[:extension]\n else\n @type = :unknown\n end\n end", "def new_value(value)\n CanadianObject.new(self, value)\n end", "def value_coercion(value); end", "def initialize(value)\n @value = value\n super()\n end", "def initialize(value)\n @value = value\n super()\n end", "def initialize(val)\n\t\t\t@val = val\n\t\tend", "def initialize(type, value = nil)\n\t\t@type = type\n\t\t\n\t\tif (value != nil)\n\t\t\tif (type & TLV_META_TYPE_STRING == TLV_META_TYPE_STRING)\n\t\t\t\tif (value.kind_of?(Fixnum))\n\t\t\t\t\t@value = value.to_s\n\t\t\t\telse\n\t\t\t\t\t@value = value.dup\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t@value = value\n\t\t\tend\n\t\tend\n\tend", "def initialize(data)\n @value = data\n end", "def assign_value\n if assigned_attr = AttrName.find_by_id(self.attr_name_id)\n case assigned_attr.value_type\n when \"STRING\"\n self.string_val = self.raw_value\n when \"FLOAT\" #has a special case to remove the dollar symbol in front of it\n #remove_dollar_sign\n self.float_val = self.raw_value.to_f\n when \"DATETIME\"\n self.datetime_val = self.raw_value.to_datetime\n when \"BOOLEAN\"\n if self.raw_value == 'true'\n self.bool_val = true\n else\n self.bool_val = false\n end\n when \"INTEGER\"\n if assigned_attr.treat_as_price\n logger.debug \"Treating this as a price\"\n self.price_val_cents = Money.parse(self.raw_value).cents\n else\n self.int_val = self.raw_value.to_i\n end\n else\n self.string_val = self.raw_value\n end\n end\n end", "def initialize(value)\n self.value = value\n fail ArgumentError, \"Invalid value given: #{value.inspect}\" unless valid?\n end", "def val(name)\n Converter.new(name)\n end", "def value=(val); end", "def deserialize_value\n if @value.nil?\n @value = read_attribute :value\n end\n\n case value_type\n when SUPPORTED_TYPES[:Object] # or Hash, Array, etc.\n @value = YAML::load @value\n when SUPPORTED_TYPES[:Symbol]\n @value = @value.to_sym\n when SUPPORTED_TYPES[:Integer] # or Fixnum, Bignum\n @value = @value.to_i\n when SUPPORTED_TYPES[:Float]\n @value = @value.to_f\n when SUPPORTED_TYPES[:Complex]\n @value = Complex @value\n when SUPPORTED_TYPES[:Rational]\n @value = Rational @value\n when SUPPORTED_TYPES[:Boolean]\n @value = (@value == \"true\")\n else\n @value\n end\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def initialize(runtime_class, value = self)\n @runtime_class = runtime_class\n @value = value\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def format_value v\n case v\n when String\n v.inspect\n when TrueClass\n 'true'\n when FalseClass\n 'false'\n else\n v.to_s\n end\n end", "def value=(v)\n @value = from_type(v)\n end", "def initialize(name, value)\n @name = name\n @value = value\n end", "def literalize\n value = self\n case value\n when /^-?\\d+$/ then value.to_i\n when /^-?\\d+\\.\\d+$/ then value.to_f\n when 'false', 'FALSE' then false\n when 'true', 'TRUE', 'yes', 'on', 'y' then true\n when 'nil' then nil\n else\n if (value.index(':') == 0) && (value.size > 1)\n value[1..-1].to_sym\n else\n value\n end\n end\n end", "def initialize(name,value)\n @name = name\n @value = value\n end", "def parse_value(value, type = :string)\n case type\n when :integer then value.to_i\n when :decimal then value.to_f\n when :boolean\n case value\n when 'Yes' then true\n when 'No' then false\n else\n nil\n end\n else\n value\n end\n end", "def value\n value = number\n end", "def value=(_); end", "def be_true\n BeTrue.new\nend", "def initialize(value)\r\n @value = value\r\n @changeable = true\r\n default_value?\r\nend", "def make_valuestring\n\t\treturn self.value\n\tend", "def coerce(value)\n @base_class.new(value)\n end", "def initialize(val)\n return @val = val if Numeric === val\n raise TypeError, \"Expected Numeric\" \n end", "def initialize(value, name, options={})\r\n @value = value\r\n @name = name \r\n end", "def is_value?\n true\n end", "def initialize(name, value)\n @name = name\n @value = value\n end", "def initialize(value, string = nil)\n @value = value\n # discuss 'expression tree' as the \"orthodox\" solution instead of strings\n @string = string || value.to_s\n end", "def initialize(value, check=true)\n raise ArgumentError unless value.scan(/\\D/).empty?\n @value = value\n @check = check\n end", "def value!\n if ok?\n @value\n else\n raise @error\n end\n end", "def initialize(name, value)\n @name = name\n @value = value\n end", "def learn_value_type(value_type, canonical_value_type)\n # We know the exact type from a struct/class decl\n # Only need to learn a new type once\n memoized = CTypes[value_type]\n return memoized if memoized\n\n type_as_id = MRuby::Bindings::Names.type_name_to_id(canonical_value_type)\n ruby_type_name = MRuby::Bindings::Hooks.translate_type_name_to_ruby(canonical_value_type)\n\n new_ctype = CTypes.define(value_type) do\n boxing_fn.name = MRuby::Bindings::Hooks.boxing_fn_name(canonical_value_type)\n boxing_fn.invocation_template = <<EOF\n#{value_type}* new_%{as} = TODO_move_#{type_as_id}_to_heap(%{box});\nmrb_value %{as} = #{boxing_fn.name}(mrb, &%{box});\nEOF\n unboxing_fn.name = MRuby::Bindings::Hooks.unboxing_fn_name(canonical_value_type)\n unboxing_fn.invocation_template = \"#{value_type} %{as} = *(#{unboxing_fn.name}(%{unbox}));\"\n\n self.type_check_template = <<EOF\nif (!mruby_#{ MRuby::Bindings::Hooks.module_name }_typecheck_#{ ruby_type_name }(mrb, %{value})) {\nif (!mrb_obj_is_kind_of(mrb, %{value}, #{MRuby::Bindings::Hooks.module_name}_#{ruby_type_name}_class(mrb))) {\n mrb_raise(mrb, E_TYPE_ERROR, \"#{ruby_type_name} expected\");\n return mrb_nil_value();\n}\nEOF\n end\n new_ctype\n end", "def initialize(value) # setting instance variable (@value) for square\r\n @value = value \r\n end", "def cast_value(val)\n raise ArgumentError.new(\"Your value is not a String! (it's a #{val.class})\") if val.class != String && val.class != TrueClass && val.class != FalseClass\n \n if (Float val rescue false)\n Float val\n elsif (Integer val rescue false)\n Integer val\n elsif val =~ /^true$/i || val == true\n true\n elsif val =~ /^false$/i || val == false\n false\n else\n val\n end\n end", "def raw_value=(v)\n @value = v\n end", "def value\n @value ||= 1\n end", "def value(value)\n with_attribute(:value => value)\n end" ]
[ "0.69721514", "0.67558557", "0.67395514", "0.6506494", "0.6501158", "0.6481547", "0.64633673", "0.63486207", "0.63295555", "0.6319684", "0.6319684", "0.6260485", "0.62325317", "0.62325317", "0.62325317", "0.62325317", "0.62325317", "0.6215993", "0.6214941", "0.6203157", "0.6203157", "0.6203157", "0.6164842", "0.6164842", "0.6164842", "0.6164842", "0.6160999", "0.61304235", "0.6114841", "0.60707515", "0.6054121", "0.6028347", "0.6027248", "0.6012517", "0.5971923", "0.5964168", "0.59298384", "0.59281194", "0.59281194", "0.5925614", "0.59183466", "0.5902591", "0.5902514", "0.5885108", "0.5871389", "0.5864484", "0.583812", "0.5834667", "0.5823721", "0.5823494", "0.5822915", "0.5821782", "0.5820053", "0.5818848", "0.5810658", "0.5800199", "0.5797757", "0.5780552", "0.5776535", "0.5772176", "0.57721055", "0.57721055", "0.5771354", "0.57707775", "0.5754637", "0.5743287", "0.5737918", "0.5716065", "0.57117087", "0.57012045", "0.5698067", "0.5698067", "0.5689616", "0.56802833", "0.56758523", "0.56708103", "0.56670374", "0.5642174", "0.5639755", "0.56350285", "0.56286836", "0.5625562", "0.5620168", "0.56163555", "0.5615798", "0.5610602", "0.5606876", "0.5603117", "0.55929637", "0.5581448", "0.55716175", "0.5567355", "0.5556415", "0.5551089", "0.55478716", "0.55445194", "0.55424696", "0.55414987", "0.5541151", "0.5537326" ]
0.6865174
1
And since this is just a Ruby file, we can write functions that our web app needs right here too:
def currently_snowing? omaha_coordinates = "41.2524,-95.9980" api_url = "https://api.darksky.net/forecast/#{ENV["DARK_SKY_API_KEY"]}/#{omaha_coordinates}" response = HTTParty.get(api_url) response_hash = response.to_h current_weather = response_hash["currently"] if current_weather["icon"].downcase == "snow" return true else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def functions\n\n end", "def weber; end", "def how_it_works\r\n end", "def helpers; end", "def helpers; end", "def helpers; end", "def external; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def main\n\n end", "def main\n end", "def file_utils; end", "def custom; end", "def custom; end", "def apis; end", "def script; end", "def script; end", "def main; end", "def define_helpers; end", "def common\n \n end", "def library; end", "def library; end", "def api; end", "def api; end", "def hello_world\n\t\n puts \"Hello, world!\" \n \nend", "def who_we_are\r\n end", "def do_something_used_in_sinatra_app(var) end", "def rossini; end", "def implementation; end", "def implementation; end", "def hello\r\n\treturn \"Hello World\"\r\nend", "def hello_world\n puts \"Hello World\"\nend", "def wrapper; end", "def hello_world\n puts \"Hello world!\"\n end", "def greeting(name)\n \"Hello, \" + name + \". How are you doing?\"\nend", "def greeting(name)\n \"Hello there, \" + name + \"!\"\nend", "def greeter\n 'Hello World!'\nend", "def hello(name)\n # YOUR CODE HERE\n \"Hello, #{name}\"\nend", "def hello(name)\n # YOUR CODE HERE\n \"Hello, #{name}\"\nend", "def hello_world\n puts \"hello world\"\nend", "def hello_world\n puts \"hello world\"\nend", "def ninety_nine_bottles_of_beer\nend", "def ninety_nine_bottles_of_beer\nend", "def ninety_nine_bottles_of_beer\nend", "def hello(name)\r\n return \"Hello, #{name}\" \r\nend", "def main\n\nend", "def function_name\n working code\nend", "def suivre; end", "def ext; end", "def ext; end", "def hello(name)\n # YOUR CODE HERE\n \"Hello, \" + name\nend", "def private; end", "def standalone; end", "def greeting(name)\n \"Hello #{name}!\"\nend", "def greeting(name)\n \"Hello #{name}!\"\nend", "def hello\r\n return \"hello world\"\r\nend", "def greeting(name)\n \"Hello, \" + name\nend", "def hello(name)\n # YOUR CODE HERE\n \"Hello, #{name}\"\n \nend", "def herald; end", "def cobasysprog\n end", "def hello()\n \"Hello\"\nend", "def jack_handey; end", "def hello\r\n return \"Hello there\"\r\nend", "def methods() end", "def greeting(name)\n \"Hello,\" + name + \". How are you doing?\"\nend", "def greeting(name)\n \"Hello, #{name}!\"\nend", "def hello(name)\n \"Hello, \"\nend", "def appraisals; end", "def appraisals; end", "def hello\n\n \"Hello!\"\n\nend", "def greet\n 'hello world!'\nend", "def hello\n return \"hello world\"\nend", "def code_point; end", "def bellini; 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 hello(name)\n \"Hello, \" + name\nend", "def hello(name)\n \"Hello, \" + name\nend", "def hello(name)\n \"Hello, \" + name\nend", "def hello(name)\n \"Hello, \" + name\nend", "def helloWorld\n puts \"Hello World!\"\nend", "def operations; end", "def operations; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end" ]
[ "0.65519035", "0.64858204", "0.6455307", "0.6417576", "0.6417576", "0.6417576", "0.63154", "0.6292208", "0.6292208", "0.6292208", "0.6292208", "0.6292208", "0.6292208", "0.6292208", "0.6191948", "0.6137953", "0.6116462", "0.6085741", "0.6085741", "0.60842675", "0.60487276", "0.60487276", "0.6022551", "0.60101914", "0.59582245", "0.595653", "0.595653", "0.5890224", "0.5890224", "0.5888331", "0.5880963", "0.5872806", "0.58679354", "0.58645827", "0.58645827", "0.5837029", "0.5812015", "0.5794666", "0.57919425", "0.5788311", "0.57790905", "0.57656556", "0.57596165", "0.57596165", "0.5758303", "0.5758303", "0.5751361", "0.5751361", "0.5751361", "0.5751328", "0.5750277", "0.5747025", "0.5743003", "0.57366145", "0.57366145", "0.5731969", "0.572764", "0.57268894", "0.57254875", "0.57254875", "0.5718209", "0.57167983", "0.57130605", "0.5711427", "0.57050335", "0.56958115", "0.5694735", "0.56908774", "0.56826866", "0.56666994", "0.56632364", "0.5662587", "0.5658767", "0.5658767", "0.5653307", "0.5642807", "0.56380165", "0.5629689", "0.56277126", "0.5616829", "0.5616829", "0.5616829", "0.5616829", "0.5616829", "0.5616829", "0.5616829", "0.5616829", "0.5616829", "0.5616829", "0.5616829", "0.5612065", "0.5612065", "0.5612065", "0.5612065", "0.560872", "0.56059027", "0.56059027", "0.5603179", "0.5603179", "0.5603179", "0.5603179" ]
0.0
-1
Borrowed from MockStorage, load to a common module?
def random_bucket_hash name=random_bucket_name {"kind"=>"storage#bucket", "id"=>name, "selfLink"=>"https://www.googleapis.com/storage/v1/b/#{name}", "projectNumber"=>"1234567890", "name"=>name, "timeCreated"=>::Time.now, "metageneration"=>"1", "owner"=>{"entity"=>"project-owners-1234567890"}, "location"=>"US", "storageClass"=>"STANDARD", "etag"=>"CAE=" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_storage_module(config)\n return StorageMongo.new(config)\nend", "def storages\n reflective_auto_load_adapter_extension\n storages # call the overrided method\n end", "def storage() @storage; end", "def load!; end", "def load; end", "def load; end", "def load; end", "def determine_storage(opts)\n\n if ARGV.include?('--help')\n puts %{\n\nARGUMENTS for functional tests :\n\n --fs : uses Ruote::FsStorage\n\nelse uses the in-memory Ruote::Engine (fastest, but no persistence at all)\n\n }\n exit 0\n end\n\n ps = ARGV.select { |a| a.match(/^--[a-z]/) }\n ps.delete('--split')\n\n persistent = opts.delete(:persistent)\n\n if ps.include?('--fs')\n\n require 'ruote/storage/fs_storage'\n\n require_json\n Rufus::Json.detect_backend\n\n Ruote::FsStorage.new('work', opts)\n\n elsif not ps.empty?\n\n pers = nil\n ps.find { |a| pers = locate_storage_impl(a) }\n\n raise \"no persistence found (#{ps.inspect})\" unless pers\n\n lib, path = pers\n $:.unshift(File.join(path, 'lib'))\n\n begin\n load 'test/functional_connection.rb'\n rescue LoadError => le\n begin\n load File.join(path, %w[ test functional_connection.rb ])\n rescue LoadError => lee\n begin\n load File.join(path, %w[ test integration_connection.rb ])\n rescue LoadError => leee\n p le\n p lee\n p leee\n raise leee\n end\n end\n end\n\n new_storage(opts)\n\n elsif persistent\n\n require_json\n Rufus::Json.detect_backend\n\n require 'ruote/storage/fs_storage'\n\n Ruote::FsStorage.new('work', opts)\n\n else\n\n Ruote::HashStorage.new(opts)\n end\nend", "def storage; end", "def storage_instance; end", "def get_from_storage(id)\n\t\traise \"[FATAL] Storage directory not set\" if Repository.data_dir.nil?\n\n\t\t# Aquire raw JSON\n\t\traw = aquire_raw(id)\n\n\t\t# Escape if object not found\n\t\treturn nil if raw.nil?\n\n\t\t# Create object\n\t\tobj = JSON::parse(raw)\n\n\t\t# Grab needed objects, args => self\n\t\tobj.cache_collect\n\n\t\t# return\n\t\treturn obj\n\tend", "def ensure_store\n @store ||= LocalStorage.new\n end", "def load\n end", "def load\n end", "def load\n end", "def neofiles_mock(attrs, klass)\n Mongoid::Factory.from_db(klass, attrs).tap do |obj|\n neofiles_lazy_loadable obj\n end\n end", "def storage_dir\n File.join(thirdpartydir,\"storage\")\n end", "def load\r\n \r\n end", "def test_it_loads_user_modules\n sm = StateMachine.new\n sm.include_module('TestModule')\n assert_equal(sm.test_method, 'Test String')\n end", "def storage\n @_storage ||= in_memory\n end", "def before_load(test_files); end", "def get_storage_adapter\n @storage_adapter.new(storage_adapter_config)\n end", "def test_respond_to\r\n\r\n assert_respond_to @storage, :add\r\n assert_respond_to @storage, :contains?\r\n assert_respond_to @storage, :find\r\n\r\n end", "def initialize(storage = {})\n @storage = storage\n end", "def require( library_name )\n\tbegin\n\t\tMockFS.mock = false\n\t\tsuper\n\t\tMockFS.mock = true\n\trescue LoadError => err\n\t\tMockFS.mock = true\n\t\tfile = library_name\n\t\tfile += '.rb' unless library_name =~ /\\.rb$/\n\t\tif File.exist? file\n\t\t\tcontents = File.open( file ) do |f| f.gets( nil ); end\n\t\t\teval contents\n\t\telse\n\t\t\traise\n\t\tend\n\tend\nend", "def storage \n Trole::Storage::BaseOne\n end", "def storage\n @storage ||= in_memory\n end", "def storage\n @storage ||= in_memory\n end", "def name()\n \"TestStorageHandler\"\n end", "def loader; end", "def storage_class\n @storage_class || storage_loader.storage_class\n end", "def initialize(storage_key)\n @storage = self.class.find_storage(storage_key)\n @storage_key = storage_key.to_sym\n end", "def load\n end", "def load\n end", "def load\n end", "def import\n end", "def import\n end", "def import\n end", "def import\n end", "def load_path; end", "def storage\n require 'yaml/store'\n Storage[object_id] ||= YAML::Store.new(STORAGE_FILE)\n end", "def storage_class\n raise NotImplementedError\n end", "def load\n raise NotImplementedError, 'You must be implement \"load\" method.'\n end", "def load_source_and_set_module; end", "def test_memory_persistence\n @scrubber.load_extension(Scrubber.extensions[:memory_persistence])\n key = \"My Key\"\n data = \"This is my data\"\n @scrubber.store_record(key, data)\n assert_equal(@scrubber.retrieve_record(key), data, \"Persisted data should match retrieved data\")\n end", "def load(name)\n Kernel.load name\nend", "def setup\n super\n @default_provider_id = register_default_provider\n @default_consumer_id = register_default_consumer\n\n # Define some dummy items\n @default_items = [\n { name: \"Item1\", price: 39.99, provider: @default_provider_id },\n { name: \"Item2\", price: 10, provider: @default_provider_id }\n ]\n\n # Check everything is empty\n assert_equal(0, get_registered_number(\"api/items\"),\n \"There are registered items at test setup\")\n\n assert_equal 0, count_orders, \"There are registered orders at test setup\"\n\n # TODO: Rename the files\n Item.db_filename = \"tests/test_files/test_items.json\"\n Order.db_filename = \"tests/test_files/test_orders.json\"\n end", "def dynamic_loadable_module\n super\n end", "def initialize(storage:, include_prefix: false, **options)\n @client = ::Imgix::Client.new(options)\n @api_key = options.fetch(:api_key)\n @storage = storage\n @include_prefix = include_prefix\n\n instance_eval do\n # Purges the file from the source storage after moving it.\n def move(io, id, **options)\n @storage.move(io, id, **options)\n io.storage.purge(io.id) if io.storage.is_a?(Storage::Imgix)\n end if @storage.respond_to?(:move)\n\n def movable?(io, id)\n @storage.movable?(io, id)\n end if @storage.respond_to?(:movable?)\n\n def download(id)\n @storage.download(id)\n end if @storage.respond_to?(:download)\n\n def presign(*args)\n @storage.presign(*args)\n end if @storage.respond_to?(:presign)\n\n def clear!(*args)\n @storage.clear!(*args)\n end if @storage.respond_to?(:clear!)\n end\n end", "def load_storage\n path = Pathname.new(\"#{ENV['HOME']}/.hush/storage.yml\")\n path.file? ? YAML.load_file(path) : {}\n\n if path.file? && y = YAML.load_file(path)\n y\n else\n {}\n end\n end", "def storage\n @storage ||= Fog::Storage.new(storage_config)\n end", "def load_from_server\n load_settings\n load_branding\n end", "def load_storage\n YAML.load_file(file_path) || {}\n end", "def config_loader\n @config_loader ||= TestConfigLoader.new\n end", "def set_storage\n @storage = Storage.find(params[:id])\n end", "def storage\n @storage ||= in_memory\n end", "def storage\n @storage ||= in_memory\n end", "def storage\n @storage ||= in_memory\n end", "def storage_instance=(_arg0); end", "def load\n self.class.load self # pass the loading off to the class\n end", "def load_all; end", "def load_all; end", "def load_all; end", "def register_ensure_loaded(object); end", "def test_2\n f = Foo.new\n z = f.bulk_load(LOAD, \"device_worker\")\n assert_equal LOAD, z\n end", "def pre_hard_load(mod); end", "def internal\n @internal ||= load_from_file\n end", "def initialize( storage={} )\n\t\t@storage = storage\n\tend", "def post_soft_load(mod); end", "def store_with(storage, storage_id = nil, &block)\n @storages << Backup::Storage.const_get(\n last_constant(storage)\n ).new(storage_id, &block)\n end", "def load\n initialize(File.info(uuid).entity)\n end", "def post_hard_load(mod); end", "def set_item_storage\n @item_storage = ItemStorage.find(params[:id])\n end", "def test_read_file\r\n hash_calc = Minitest::Mock.new('test_hash_calculator')\r\n block_checker = Minitest::Mock.new('test_block_checker')\r\n account_tracker = Minitest::Mock.new('account_tracker')\r\n def block_checker.read_next_line; nil; end\r\n def account_tracker.print_accounts; nil; end\r\n assert_nil @g.read_file(hash_calc, block_checker, account_tracker)\r\n end", "def set_storage\n @storage = Storage.find(params[:id])\n end", "def set_storage\n @storage = Storage.find(params[:id])\n end", "def set_storage\n @storage = Storage.find(params[:id])\n end", "def set_storage\n @storage = Storage.find(params[:id])\n end", "def test_get_list_files()\n\n path = 'folder1'\n storage = 'First Storage'\n request = GetListFilesRequest.new(path, storage)\n\n result = @storage_api.get_list_files(request)\n assert result.code == 200, 'Error while getting list files'\n assert result.files != nil\n\n end", "def load_storage_system(item)\n warn_msg = \"Both StorageSystem name '#{storage_system_name}' and IP '#{storage_system_ip}' were provided. Name is being ignored!\"\n Chef::Log.warn(warn_msg) if storage_system_name && storage_system_ip\n if storage_system_ip\n item.set_storage_system(OneviewSDK::StorageSystem.new(item.client, credentials: { ip_hostname: storage_system_ip }))\n elsif storage_system_name\n item.set_storage_system(OneviewSDK::StorageSystem.new(item.client, name: storage_system_name))\n end\n end", "def load_storage_system(item)\n raise \"Unspecified property: 'storage_system'. Please set it before attempting this action.\" unless storage_system\n storage_system_resource = OneviewSDK::StorageSystem.new(item.client, credentials: { ip_hostname: storage_system })\n unless storage_system_resource.exists?\n storage_system_resource = OneviewSDK::StorageSystem.new(item.client, name: storage_system)\n end\n item.set_storage_system(storage_system_resource)\n end", "def setup\n if @request.present?\n @request.env['HTTP_ACCEPT'] = 'application/json'\n @request.headers['x-api-key'] = 'some_api_key'\n end\n ActiveSupport::Cache::FileStore.any_instance.stubs(:read).returns(\"anandsai_auth\")\n end", "def try_load_object(name, cache_path); end", "def import()\n # TODO\n end", "def setup\n Carnivore.configure!(:verify)\n @connection = Miasma.api(\n connection_arguments.deep_merge(\n Smash.new(\n :type => :storage\n )\n )\n )\n @bucket = @connection.buckets.get(bucket_name)\n unless(@bucket)\n @bucket = @connection.buckets.build(:name => bucket_name).save\n end\n end", "def init\n # Guard against doing this more than once.\n unless @config.nil?\n return\n end\n\n if Config.config_files.nil?\n raise \"No configuration file provided, set LapisLazuli::WorldModule::Config.config_files\"\n end\n\n load_config(Config.config_files)\n # In case there was no config file found an empty @config needs to be set to prevent infinite looping.\n if @config.nil?\n warn 'Unable to find a configuration file, defaulting to empty config.yml.'\n @config = {}\n end\n\n @metadata = Runtime.instance.set_if(self, :metadata) do\n log.debug \"Creating metadata storage\"\n Storage.new(\"metadata\")\n end\n end", "def lookup_storage(key)\n { memory: Storage::Memory, redis: Storage::Redis }[key]\n end", "def initialize(path = \"\")\n\t\tpath = \"\" if path.nil?\n\t\tdata = File.open(path,\"r\"){|f| f.read} if File.exists?(path)\n\t\t@data = data.nil? ? mock_data : data\n\tend", "def storage\n @plugins.detect { |p| p.is_a? BaseStorage }\n end", "def load(name); end", "def derivative_storage(path)\n storage = self.class.derivatives_storage\n storage = instance_exec(path, &storage) if storage.respond_to?(:call)\n storage\n end", "def get_storage_class\n return @m_storage_class\n end", "def ensure_storage_file\n new_storage if !storage_exists?\n end", "def get_config(storage, path)\n file = (storage and path) ? storage + path : @defaults[:storage] + @defaults[:config]\n file = File.expand_path file\n return load file\n end", "def setup\n yield self\n require \"power_api\"\n end", "def pre_soft_load(mod); end", "def create_model_storage(repository, model)\n raise NotImplementedError\n end", "def initialize(storage = [])\n @storage = storage\n end", "def load\r\n return unless File.exist?(STORAGE)\r\n\r\n props = YAML.load(File.read(STORAGE))\r\n props.each{|k, v| instance_variable_set(\"@#{k}\", v) }\r\n end", "def storage\n uploader.storage\n end", "def test_check_and_maybe_load_taskstore\r\n=begin\r\n # if logging in, .path should equal /userdata/foo\r\n session[:id] = 1 # should simulate logging in\r\n logged_in_store = check_and_maybe_load_taskstore(@store)\r\n assert_match(/\\/userdata\\//, logged_in_store.path) # a /tmp/ path has been called\r\n # if logging out, .path should equal /tmp/foo\r\n session.clear # should simulate logging out\r\n logged_out_store = check_and_maybe_load_taskstore(@my_own_store)\r\n assert_match(/\\/tmp\\//, logged_in_store.path) # a /tmp/ path has been called\r\n=end\r\n end" ]
[ "0.6567207", "0.60182106", "0.5989204", "0.5969939", "0.594189", "0.594189", "0.594189", "0.5927389", "0.59193575", "0.58834875", "0.58478874", "0.57741225", "0.57520896", "0.57520896", "0.5736447", "0.56745607", "0.56318426", "0.55931765", "0.55606323", "0.5544921", "0.55150455", "0.5513412", "0.550194", "0.5501883", "0.54991126", "0.54903907", "0.5484707", "0.5484707", "0.54763013", "0.5459649", "0.54592353", "0.54487175", "0.5440323", "0.5440323", "0.5440323", "0.5429988", "0.5429988", "0.5429988", "0.5429988", "0.5427996", "0.54271054", "0.54126334", "0.5411422", "0.5410253", "0.5405375", "0.54050356", "0.5374101", "0.53680164", "0.5366284", "0.53581834", "0.5300745", "0.5298054", "0.52946806", "0.52918833", "0.52845013", "0.52782243", "0.52782243", "0.52782243", "0.5274791", "0.52692276", "0.5255317", "0.5255317", "0.5255317", "0.52506226", "0.5245975", "0.52455586", "0.52414495", "0.521703", "0.5210235", "0.520361", "0.51986074", "0.5197823", "0.51975304", "0.51961887", "0.51832944", "0.51832944", "0.51832944", "0.51832944", "0.5179948", "0.5170559", "0.5165898", "0.51649284", "0.5154104", "0.5149566", "0.51363057", "0.5133173", "0.5126537", "0.5118399", "0.5110775", "0.51031435", "0.50973374", "0.50951624", "0.5089836", "0.50865316", "0.5084728", "0.50843877", "0.5070888", "0.5069599", "0.5062606", "0.5059918", "0.5049246" ]
0.0
-1
do def on_week(week) self.select do |point_total| point_total.week == week end.sort_by(&:updated_at).last end end
def cached_points @cached_points ||= Scout.cache.fetch(['points', cache_key]) { points.to_a.select do |point| !cached_bye_weeks.include?(point.week) end } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weekly_updates_by_project(since)\n since = Date.new(2000,01,01) if since == :all\n self.weekly_updates.where([\"weekstart > ?\",since]).order(\"project_id, weekstart desc\").group_by {|w| w.project}\n end", "def by_week\n @device = params[:device]\n @pf_by_week = Measure.where('created_at BETWEEN ? AND ? AND device_id = ?', DateTime.now.beginning_of_week, DateTime.now.end_of_week, @device).group_by_day_of_week(:created_at, format: \"%a\", week_start: :monday).minimum(:pf)\n render json: @pf_by_week\n end", "def bf_sort_point\n point = 0\n\n # recent review worth more points\n self.member_reviews.each do |r|\n point += 10 if r.created_at > 2.weeks.ago\n point += 3 if r.created_at > 6.weeks.ago and r.created_at <= 2.weeks.ago\n point += 1 if r.created_at <= 6.weeks.ago \n end\n\n point\n end", "def all_weeks\n @all_weeks ||=\n data_points.each_with_object(Hash.new(0)) { |feed, all_weeks|\n all_weeks[feed.occurred_on.beginning_of_week(week_start_day)] += feed.send(field)\n }\n end", "def current_week\n\t\t#TODO\n\tend", "def load_local_sensors_by_name_last_week(name)\n s_date = (Date.today-6).to_time.utc\n e_date = (Date.today+1).to_time.utc \n @resultset = {}\n @resultset[name] = Sensor.find(:all, \n :conditions=>[\"created_at between ? and ? AND name=?\", s_date, e_date, name], \n :order=>\"created_at\");\n end", "def weekly_points\n weekly_crime_points + weekly_suspension_points\n end", "def each_week(&block)\n self.each(Week.length,&block)\n end", "def each_week(&block)\n self.each(Week.length,&block)\n end", "def current_week\n self.week.to_i\n end", "def this_week?\n\t\trange = (Time.now .. Time.now.sunday)\n\t\trange = (Time.now .. Time.now.next_week) if(Time.now.sunday?)\n\t\tself.showtimes.detect{ |st| range.cover? st.timestamp }\n\tend", "def this_week?\n\t\trange = (Time.now .. Time.now.sunday)\n\t\trange = (Time.now .. Time.now.next_week) if(Time.now.sunday?)\n\t\tself.showtimes.detect{ |st| range.cover? st.timestamp }\n\tend", "def week\n self.range('week')\n end", "def current_week\n standings = Standing.all.order(:wins).reverse\n\n user_standing_index = nil\n standings.each_with_index do |st, index|\n user_standing_index = index if st.user_id == current_user.id\n end\n\n ahead_user_standings = standings[user_standing_index - 1]\n behind_user_standings = standings[user_standing_index + 1]\n\n ahead_user = User.find(ahead_user_standings.user_id)\n behind_user = User.find(behind_user_standings.user_id)\n\n @user_standing = {\n place: user_standing_index + 1,\n wins: standings[user_standing_index].wins\n }\n\n @current_week = Week.last\n games = Game.where(week_id: @current_week.id)\n @games = games.order(:game_finished, :date, :start_time)\n\n if games.order(updated_at: :desc).first\n @last_upd = games.order(updated_at: :desc).first.updated_at\n else\n @last_upd = @current_week.updated_at\n end\n\n @correct = 0\n ahead_correct = 0\n behind_correct = 0\n\n @picks = {}\n @games.each do |g|\n user_pick = g.picks.where(user_id: current_user.id)\n ahead_pick = g.picks.where(user_id: ahead_user.id)\n behind_pick = g.picks.where(user_id: behind_user.id)\n\n pick_count = g.picks.count.to_f\n away_count = g.picks.where(away_home: 'away').count.to_f\n home_count = g.picks.where(away_home: 'home').count.to_f\n\n if away_count > home_count\n field = \"#{g.away} (#{(away_count / pick_count) * 100}%)\"\n elsif home_count > away_count\n field = \"#{g.home} (#{(home_count / pick_count) * 100}%)\"\n else\n field = 'split 50/50'\n end\n\n if user_pick[0] != nil\n if user_pick[0].pick\n @picks[user_pick[0].game_id] = { \n :pick => user_pick[0].pick, \n :away_home => user_pick[0].away_home,\n :field => field\n }\n end\n\n if user_pick[0].tbreak_pts != nil\n @tbreak_pts = user_pick[0].tbreak_pts\n end\n\n if g[:game_finished] == true\n @correct += 1 if user_pick[0].away_home == g.winner\n ahead_correct += 1 if ahead_pick[0].away_home == g.winner\n behind_correct += 1 if behind_pick[0].away_home == g.winner\n end\n end\n end\n\n @ahead = {\n user: ahead_user.username,\n wins: ahead_user_standings.wins,\n correct_this_week: ahead_correct\n }\n\n @behind = {\n user: behind_user.username,\n wins: behind_user_standings.wins,\n correct_this_week: behind_correct\n }\n end", "def week\n\t\t@@week\n\tend", "def index\n current_user.picks.unevaluated.each(&:evaluate)\n @current_week = current_week\n if params[:week]\n @week = params[:week]\n @favorite_team_game = current_user.favorite_team.find_game_by_week(@week) if current_user.favorite_team\n @games_groups = Game.where(week: params[:week]).group_by(&:kickoff).sort_by{|group| group[0]}\n else\n @week = @current_week\n @favorite_team_game = current_user.favorite_team.find_game_by_week(@week) if current_user.favorite_team\n @games_groups = Game.where(week: @week).group_by(&:kickoff).sort_by{|group| group[0]}\n end\n end", "def current_week\n return get_current_week_from_weeks(Week.where(year: Date.today.year)\n .order(:number))\n end", "def fetch_next_week_events_and_analyze\n events = fetch_next_week_events\n analyze_events(events)\n end", "def methods_and_specs_added_by_week events\n events.select {|e| e.status == :added }\n .group_by {|e| week_from_date(e.date) }\n .map {|week,es| [week, method_count(es), spec_count(es)] }\nend", "def index\n # @dailybanks = Dailybank.where.not(status: \"Locked\")\n @dailybanks = Dailybank.where(\"effective_date >= ?\", Date.today.beginning_of_week.-(7.days))\n @dailybanks = @dailybanks.sort_by { |hsh| hsh[:effective_date] } \n end", "def discover_week( nextweek )\n year = self.year\n owner = self.user_id\n\n if ( nextweek )\n inc = 1\n week = self.week_number + 1\n limit = Timesheet.get_last_week_number( year ) + 1\n\n return if ( week >= limit )\n else\n inc = -1\n week = self.week_number - 1\n limit = 0\n\n return if ( week <= limit )\n end\n\n while ( week != limit )\n timesheet = Timesheet.find_by_user_id_and_year_and_week_number(\n owner, year, week\n )\n\n if ( yield( timesheet ) )\n return { :week_number => week, :timesheet => timesheet }\n end\n\n week += inc\n end\n\n return nil\n end", "def week; end", "def get_matches_by_week(week_number)\n self.matches.where(:week_number => week_number)\n end", "def week\n stamp = params[:stamp].to_i\n interval = (params[:interval] || 10).to_i\n plus_weeks = (params[:plus_weeks] || 0).to_i\n context = (params[:context] || 0).to_i == 1 ? true : false\n time = Time.at(stamp).utc\n\n # Calculate monday from given date\n wday = time.wday\n # Adjust for sunday when we want to start on a monday\n wday = 7 if wday == 0\n\n date = time - (wday.days - 1.days)\n\n date = date + plus_weeks.weeks\n\n # Number of days in week range if we add context, we add the surrounding weeks as well\n days = context ? (7 * 3) - 1 : 6\n\n # If context we'll start at the monday before\n if context\n date -= 7.days\n end\n\n\n\n week_data = []\n week_dates = []\n\n buckets = 0.step((60 * 24) - 1, interval).to_a\n\n (0..days).each do |day|\n interval_data = Hash.new { |h, k| h[k] = [] }\n\n data = GlucoseSensorData.by_day(date.to_date, :field => :timestamp)\n\n data.each do |datum|\n minutes = datum.timestamp.min + (datum.timestamp.hour * 60)\n # At first seems like a no op but this actually buckets minutes into intervals\n bucket = (minutes / interval) * interval\n\n interval_data[bucket] << datum\n end\n\n week_context = nil\n\n if context\n week_number = day / 7\n if week_number == 0\n week_context = \"before\"\n elsif week_number == 1\n week_context = \"current\"\n else\n week_context = \"after\"\n end\n else\n week_context = \"current\"\n end\n\n buckets.each do |bucket|\n datum = {}\n\n datums = interval_data[bucket]\n # Averages glucose values if there are more than one datum for that bucket\n if datums.length > 0\n datum[:glucose] = datums.inject(0.0) { |sum, d| sum + d.glucose } / datums.size\n #datum[:timestamp] = datums[0].timestamp.to_i\n end\n datum[:timestamp] = (date + bucket.minutes).to_i\n datum[:week_context] = week_context\n\n\n datum[:time] = bucket\n datum[:day] = date.strftime(\"%A\").downcase\n datum[:date] = date.to_i\n week_data << datum\n end\n\n week_dates.push({ :week_context => week_context, :day => date.strftime(\"%A\").downcase, :date => date.to_i })\n date += 1.days\n end\n\n render :json => { :data => week_data, :interval => interval, :week_dates => week_dates }\n end", "def index\n @posts = Post.where(:ts_date => 1.week.ago...Time.now).order(sort_column + ' ' + sort_direction)\n end", "def select_trend_by_week\n self.trend_period = 'week'\n records = []\n records = get_select_trend_by_week( week_from_date, end_date, accounts)\n records = fill_missing_rows(records, week_from_date, end_date) \n records.flatten\n end", "def check_week(target_week)\n $log.info(\"Looking for week #{ target_week } scores, using week #{ @current_week } scores.\")\n raise \"No new scores - nothing to do. Aborting.\" unless target_week == @current_week \n end", "def pays_players_week\n self.players.inject(0) {|sum, player| sum += player.pay_week}\n end", "def methods_and_specs_changed_by_week events\n events.select {|e| e.status == :changed }\n .group_by {|e| week_from_date(e.date) }\n .map {|week,es| [week, method_count(es), spec_count(es)] }\nend", "def shows_at_venue_per_day(week_day)\n festival_start = find_days_start_time(week_day)\n shows_at_venue = Event.where(\"venue_id\" => @venue.id)\n @shows_at_venue_per_day = []\n shows_at_venue.each do |show|\n if show.weekday == week_day\n @shows_at_venue_per_day << show\n end\n end\n if @shows_at_venue_per_day != []\n @shows_at_venue_per_day.sort_by! { |obj| obj.start_date_time}\n shows_with_blanks(festival_start)\n fill_out_final_blanks(festival_start)\n end\n return @shows_with_blanks\n end", "def this_week(limit: 5, markdown: false, rank: :top) \r\n \r\n coins = sort_coins('7d', limit: limit, rank: rank)\r\n build_table coins, markdown: markdown\r\n\r\n end", "def select_current_week\n select_week_of Date.today\n end", "def last_7_day_kwh_usage_by_day\n usage_data = []\n Time.now.utc.to_date.downto(6.days.ago.utc.to_date).each do |date|\n usage_data << total_day_kwh_usage_on(date).round(2)\n end\n usage_data\n end", "def current_week\n week_split.select { |c| c.include?(day) }.flatten\n end", "def this_week_advertisers_first_seen\n ads = Ad.where(lang: @lang)\n render json: ads.unscope(:order).where(\"advertiser is not null\").group(\"advertiser\").having(\"min(created_at) > NOW() - interval '1 week'\").order(\"count_all desc\").count.map{|k, v| {advertiser: k, count: v} }\n end", "def this_week(project, api_key)\n\treturn _iterations('current', project, api_key)\nend", "def methods_and_specs_deleted_by_week events\n events.select {|e| e.status == :deleted }\n .group_by {|e| week_from_date(e.date) }\n .map {|week,es| [week, method_count(es), spec_count(es)] }\nend", "def weeks_on_list\n @data['weeks_on_list']\n end", "def weekly\n render json: Question.active.weekly.not_seen(@api_current_user.id).first\n end", "def showable_week( nextweek )\n discover_week( nextweek ) do | timesheet |\n ( not timesheet.nil? )\n end\n end", "def get_week\n\t week = Time.now.strftime(\"%W\").to_i\n\t wday = Time.now.wday\n\t week = wday <= 3 ? week - 1 : week\n\t \t\n\t # registro = ActivityReport.find(:all, :conditions => {:volunteer_id => self.volunteer_id, :semana => week})\n\t registro = ActivityReport.where(volunteer_id: self.volunteer_id, semana: week)\n\t unless registro.empty?\n\t # DEPRECATION WARNING: ActiveModel::Errors#[]= is deprecated and will be removed in Rails 5.1. Use model.errors.add(:semana, \": Ya existe un registro de esta Semana\") instead. (called from get_week at /vagrant_data/hadronapp/app/models/activity_report.rb:35)\n\t errors[:semana] = \": Ya existe un registro de esta Semana\"\n\t return false\n \tend\n\tend", "def week\n @obj.date.strftime(\"%V\")\n end", "def week_eliminated(chefstats)\n chefstats.each { |chefstat|\n if chefstat.stat.abbreviation == Stat::ELIMINATED_ABBR\n return chefstat.week\n end\n }\n return nil\n end", "def photos\n \treturn Photo.where(\"week_int = ?\", self.week_number)\n end", "def week\n @todoas = Todoa.where(user_id: current_user.id,done: false).where('due BETWEEN ? AND ?', Date.today, Date.today + 7.day)\n end", "def mds_needing_scoring\n Matchday.where(locked: true, scored: false).pluck(:week)\n end", "def calories_week(db, member_id)\n total_calories= []\n t = DateTime.now\n past_week = ((t-6)..t).map{ |date| date.strftime(\"%m-%d\") }\n past_week.each do |x|\n calories_date= db.execute(\"SELECT * FROM calories WHERE member_id='#{member_id}' AND day='#{x}' \")\n calories_date.each do |cals|\n total_calories << cals['amt_burned']\n end \n end \n total_calories.inject(:+)\nend", "def week_index\n @week_index ||= date.wday\n end", "def week_score(user_id)\n @current_user=User.find(user_id)\n @week_questions=Question.show_for_current_week\n @week_score=Array.new\n @week_leaderboard=Array.new\n User.all.each do |u|\n @questions=Array.new\n @week_questions.all.each do |q|\n @questions<<(Response.find_all_by_question_id(q.id) & Response.find_all_by_user_id(u.id))\n end\n @questions=@questions.uniq.flatten!\n @week_score<<@questions.map { |i| (i.points) }.delete_if { |x| x == nil }.sum\n @week_leaderboard<<{:user_id=>u.id,:score=>@questions.map { |i| (i.points) }.delete_if { |x| x == nil }.sum}\n if (u==@current_user)\n @week_points=@questions.map { |i| (i.points) }.delete_if { |x| x == nil }.sum\n @user_score=@questions.map { |i| (i.points) }.delete_if { |x| x == nil }\n end\n end\n @week_rank= @week_score.sort().reverse.index(@week_points)+1 rescue ''\n end", "def calculate_week_time\n week_begin = DateTime.now.utc.beginning_of_week\n deadline = DateTime.now.utc.end_of_week\n self.commits.where(\"begin_time > ? and end_time < ?\", week_begin, deadline).sum(:spent_time)\n end", "def weekly(options = {})\n branch options.merge(every: :week)\n end", "def weekly(options = {})\n branch options.merge(every: :week)\n end", "def quality_driven_software_export\n @from = Time.zone.now - 1.week\n @to = Time.zone.now\n end", "def beginning_of_week; end", "def beginning_of_week; end", "def smoked_this_week\n Smoke.by_user(id).this_week(Date.today).sum(:counted) || 0\n end", "def show\n\n @week = @inclass.week\n end", "def completed_weekly_tasks\n self.weekly_tasks.where(\n :is_weekly_attendance_marking_done => true ,\n :is_weekly_payment_collection_finalized => true, \n :is_weekly_payment_approved_by_cashier => true \n )\n end", "def each_week(&block)\n each_day.each_slice 7, &block\n end", "def trend_points_for_creation_date(obj)\n if obj.created_at > 1.day.ago then 50\n elsif obj.created_at > 1.week.ago then 25\n elsif obj.created_at > 2.weeks.ago then 10\n elsif obj.created_at > 3.weeks.ago then 3\n else 0\n end\nend", "def sunday_weekly_batch\n JdeFetch.checking_buffer\n JdeFetch.checking_item_cost\n end", "def rank_last_week\n @data['rank_last_week']\n end", "def index\n @publish_checkers = PublishChecker.all.order(year: :desc, week: :desc)\n end", "def index\n # Should be Current_Week\n @week_num = params[:week_num] ? params[:week_num] : 1\n @matchups = Matchup.find_all_by_week(@week_num).sort_by { |matchup| [ matchup.time, matchup.away ] }\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @matchups }\n end\n end", "def update_week(week)\n blocks = week['blocks']\n week.delete 'blocks'\n week['course_id'] = @course.id if !week.key?(:course_id) || week['course_id'].nil?\n @week = update_util Week, week\n @week.course.reorder_weeks\n\n return if blocks.blank?\n blocks.each { |block| update_block(block) }\n end", "def current_week_kwh_usage\n total_week_kwh_usage_until(Time.now.utc.to_date).round(2)\n end", "def load_weekly_chart\n if params[:date]\n @e_date_str = params[:date]\n e_date = Date.parse(@e_date_str)\n @week_number = e_date.cweek-0\n else\n @week_number = params[:week].to_i\n# if params[:week] then\n# @week_number = params[:week].to_i\n# else\n# @week_number = (Date.today.cweek - 0)\n# end\n end\n\n if @week_number < 0 then\n @week_number = 1\n end\n if @week_number >52 then\n @week_number = @week_number - 52\n end\n\n logger.debug \"load weekly chart called\"\n @date_range_start = Date.commercial(Date.today.cwyear, @week_number, 1).strftime \"%m/%d/%y\" # 1/19/09 (Monday)\n @date_range_end = Date.commercial(Date.today.cwyear, @week_number, 7).strftime \"%m/%d/%y\" # 1/25/09 (Sunday)\n\n reports = EffortLog.find_by_sql([\"SELECT task_types.name, users.human_name, effort_log_line_items.sum FROM effort_log_line_items inner join effort_logs on effort_log_line_items.effort_log_id = effort_logs.id inner join users on users.id = person_id inner join task_types on task_type_id = task_types.id where course_id = ? and effort_logs.week_number = ? order by name, human_name\", params[:id], @week_number])\n\n @labels_array = []\n labels_index_hash = {}\n\n reports.each do |line|\n l_human_name = line.human_name\n if !labels_index_hash.has_key?(l_human_name)\n @labels_array << l_human_name\n labels_index_hash[l_human_name] = @labels_array.size\n end\n end\n\n #unless the user is a student, move them to be the first column of data\n unless current_user && (!current_user.is_staff? && !current_user.is_admin?) then\n @labels_array.each_index do |i|\n if @labels_array[i] == current_user.human_name then\n labels_index_hash[@labels_array[0]] = i+1\n labels_index_hash[current_user.human_name] = 1\n @labels_array[i] = @labels_array[0]\n @labels_array[0] = current_user.human_name\n end\n end\n @labels_array.each_index do |i|\n if @labels_array[i] != current_user.login then\n @labels_array[i] = 'anonymous'\n end\n end\n end\n\n if request.env[\"Anonymous\"] then\n @labels_array.each_index do |i|\n @labels_array[i] = 'anonymous'\n end\n end\n\n row_width = @labels_array.size + 1 #Plus one is the for an additional first column, the \"type\" label.\n current_task = \"\"\n current_task_chart_data_row = Array.new(row_width) { |i| \"0.0\" }\n @chart_data = []\n reports.each do |line|\n if line.name == current_task\n current_task_chart_data_row[labels_index_hash[line.human_name]] = line.sum\n else\n if current_task != \"\" then\n @chart_data << current_task_chart_data_row\n current_task_chart_data_row = Array.new(row_width) { |i| \"0.0\" }\n end\n current_task = line.name\n current_task_chart_data_row[0] = line.name\n current_task_chart_data_row[labels_index_hash[line.human_name]] = line.sum\n end\n end\n @chart_data << current_task_chart_data_row\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :layout => false }\n end\n end", "def week\n created_at.beginning_of_week\n end", "def convertDailyToWeeklyData()\n aggregateData(ChartDirector::ArrayMath.new(@timeStamps).selectStartOfWeek())\n end", "def current_week_statuses\n bools = []\n current_week_reports.each do |report|\n statuses = report.statuses\n statuses.each do |status|\n if status.goal_id == self.id\n bools << status.status\n end\n end\n end\n bools\n end", "def cweek\n end", "def betweenDates(index,week)\n if (index <= week[4].to_i)\n return week\n end\n return []\nend", "def game_week\n now = DateTime.now\n all_games = NflSchedule.where(year: Date.today.year)\n .order(:start_time)\n week_started = 0\n all_games.each { |game|\n if (week_started < game.week) && (now > game.start_time)\n week_started = game.week\n end\n }\n return week_started\n end", "def weeks; self * WEEK; end", "def weeks; self * WEEK; end", "def weekly_availability\n return [] if course.nil?\n\n availability = [\n { day: 'monday', count: 0, start_times: [] },\n { day: 'tuesday', count: 0, start_times: [] },\n { day: 'wednesday', count: 0, start_times: [] },\n { day: 'thursday', count: 0, start_times: [] },\n { day: 'friday', count: 0, start_times: [] },\n { day: 'saturday', count: 0, start_times: [] },\n { day: 'sunday', count: 0, start_times: [] }\n ]\n\n course.plannings.order('start_time ASC, end_time ASC').each do |planning|\n next if planning.week_day.nil? or Date::DAYNAMES[planning.week_day].nil?\n course_day = Date::DAYNAMES[planning.week_day].downcase\n day_availability = availability.detect { |d| d[:day] == course_day }\n\n day_availability[:count] += 1\n day_availability[:start_times] << I18n.l(planning.start_time, format: :short) if planning.start_time\n end\n\n availability\n end", "def detect_closest_weeks_for_date(all_weeks, date)\n date_range = ((date - 16)..(date + 16)).to_a\n all_weeks.select{|d| date_range.include?(Date.parse(d))}\n end", "def week\n first_day_of_week = @date.monday\n \n days_of_week = []\n 7.times do |time|\n days_of_week << day_and_types(first_day_of_week + time.days)\n end \n \n days_of_week\n end", "def get_folder_commits_by_week_and_level(folder_level)\n output = []\n diff_staff_by_week = @mapped_diffs\n for array_of_diff_staff in diff_staff_by_week\n plot_hash = folder_hash_for_level(folder_level).clone\n for diff in array_of_diff_staff\n key = find_key(folder_level, diff)\n plot_hash[key] = plot_hash[key] += (diff.additions - diff.deletions) unless plot_hash[key].nil?\n end\n output << plot_hash\n end\n output\n end", "def weekStats()\r\n # Get the first day\r\n curCal = JCalendar::getInstance()\r\n curCal.add(JCalendar::DATE, -7)\r\n weekStatsCount = @daohelper.getVisitAuditDate(curCal)\r\n \r\n # Extract visit stats for the last 7 days\r\n i = -6\r\n statMap = {}\r\n statMapDates = {}\r\n while i <= 0\r\n curCal = JCalendar::getInstance()\r\n curCal.add(JCalendar::DATE, i)\r\n curStat = @daohelper.getVisitAuditOnDate(curCal) \r\n strId = \"stats#{i + 6}\"\r\n statMap[strId] = curStat\r\n statMapDates[strId] = curCal\r\n i += 1\r\n end\r\n\r\n stats = BotListVisitLogStatsForm.new\r\n stats.weekVisits = weekStatsCount\r\n stats.weekStats = statMap\r\n stats.weekStatsDates = statMapDates\r\n return stats\r\n end", "def week\n @week ||= (((date-start_of_month)+1)/7.0).ceil\n end", "def parse_week\n @week = @@doc.xpath(\"//fixVersion\")[0].content\n end", "def next\n week = Week.where('number > ? AND setup_id = ?', self.number, self.setup_id).order(number: :asc).first\n week && week.is_visible? ? week : nil\n end", "def match_week\n @week ? { 'fiscal_week_id' => @week.to_i } : {}\n end", "def last\n Koyomi::Week.new(self.koyomi_month.last, self.week_start).last\n end", "def methods_profile events\n events.group_by {|e| week_from_date(e.date) }\n .map {|week,es| [week, method_count(es, :added), method_count(es, :changed), method_count(es, :deleted)] }\nend", "def select_weekly_meeting_for_weekly_payment\n setup_for_select_weekly_meeting\n \n # select_weekly_meeting_for_weekly_payment_url(group_loan)\n \n add_breadcrumb \"#{t 'process.select_group_loan'}\", 'select_group_loan_for_weekly_payment_path'\n set_breadcrumb_for @group_loan, 'select_weekly_meeting_for_weekly_payment_url' + \"(#{@group_loan.id})\", \n \"#{t 'process.select_week'}\"\n end", "def trips_by_weekday()\n TripCollection.new( @trips.select {|k, t| t.start_time.wday.between?(1,5) } )\n end", "def primary_pool_picks\n picks.where(:week_id => Week.closed_week_ids).where(:is_second_chance => nil).order(:week_id)\n end", "def set_week\n self.week = time_out.nil? ? time_in.beginning_of_week : time_out.beginning_of_week\n end", "def weekly_sell\n @weekly_sell ||= settle_items.last_week.sum('quantity')\n end", "def call\n if second_week_selected == false\n handle_first_week\n elsif second_week_selected\n handle_second_week\n elsif second_week_selected.nil?\n clear_back_button_dates\n end\n end", "def seller_weekly_report_orders(seller)\n start_week=(Time.zone.now - 1.week).beginning_of_week\n end_week=(Time.zone.now - 1.week).end_of_week\n seller_hash = {}\n final_arr = []\n orders = seller.orders.where(:order_date=>start_week..end_week).where(:is_cancel=>false)\n total_order_value = orders.sum(&:total).to_f\n total_unit_sold = 0\n total_orders = orders.count\n orders.each do |order|\n line_items = order.line_items\n if line_items.present?\n total_unit_sold = total_unit_sold + line_items.sum(&:quantity).to_i\n expected_price = 0.0\n line_items.each do |li|\n expected_price = expected_price + (li.variant.selling_price*li.quantity)\n end\n arr = []\n arr << seller.name\n arr << order.market_place_order_no\n arr << order.cart_no\n arr << order.order_date.strftime(\"%d-%m-%Y %T\")\n arr << (line_items.first.is_pick_at_store ? \"Y\" : \" \") rescue ''\n if order.market_place.code == \"qoo10\"\n arr << (order.total.to_f - order.market_place_details[\"ShippingRate\"].to_f)\n arr << order.market_place_details[\"ShippingRate\"]\n else\n arr << order.total\n arr << \"NA\"\n end\n arr << order.total\n arr << line_items.count\n arr << line_items.sum(&:quantity)\n final_arr << arr\n end\n end\n seller_hash.merge!(\"orders\"=>final_arr, \"total_order_value\"=>total_order_value, \"total_units_sold\"=>total_unit_sold, \"total_orders\"=>total_orders)\n return seller_hash\n end", "def weekly_tasks_pending_cashier_approval\n self.weekly_tasks.where(\n :is_weekly_attendance_marking_done => true ,\n :is_weekly_payment_collection_finalized => true,\n :is_weekly_payment_approved_by_cashier => false\n )\n end", "def generate_top_tracks(year)\n weeklycharts = lastfm.user.get_weekly_chart_list(\"pulleasy\")\n weeklycharts.each do |weekly_chart|\n charts = []\n if weekly_chart[\"from\"] > year.to_time.to_i && weekly_chart[\"to\"] < year.next_year.to_time.to_i\n charts << weekly_chart\n end\n end\nend", "def load_month_week_goals(master_goal, year, month) \n week_array = create_weeks_array(year,month)\n if week_array.first[:week_num]<week_array.last[:week_num]\n month_week_goals = master_goal.weeks.where(week_num:week_array.first[:week_num]..week_array.last[:week_num], year:year)\n else\n # Resolving also potential Dec issue where last week is #1\n month_week_goals = master_goal.weeks.where( '(week_num >= ? AND year = ?) OR (week_num = 1 AND year = ? )', week_array.first[:week_num], year, year+1 )\n end\n return month_week_goals\n end", "def group_checkins_by_week\n previous = nil\n by_week = {}\n \n @checkins.each do |checkin|\n week_number = Time.at(checkin['createdAt']).strftime '%U'\n categories = checkin['venue']['categories']\n previous = checkin\n \n next if not categories.length\n \n venue_categories = []\n \n # Only gather up category names.\n categories.each do |cat|\n venue_categories << cat['shortName']\n end\n \n # Create a new array for week numbers that don't exist.\n if not by_week.has_key? week_number\n by_week[week_number] = []\n end\n \n by_week[week_number].push(venue_categories).flatten!\n end\n \n # Sort by week number.\n by_week.sort_by { |week| week }\n \n @by_week = by_week\n end", "def next_week_in weeks\n Week.find_by(initial_day: initial_day+( weeks * 7.days))\n end", "def prune_weekly(snapshot)\n catch :found do\n (0..rotation.weekly - 1).each do |count|\n week_beg = beginning_of_week(in_weeks(count))\n week_end = end_of_week(in_weeks(count))\n if snapshot.created_at >= week_beg && snapshot.created_at <= week_end\n save_oldest_snapshot(snapshot, week_beg)\n throw :found, true\n end\n end\n false\n end\n end", "def get_current_week_from_weeks(weeks)\n now = DateTime.now\n weeks.each { |week|\n if now < week.start_time\n return (week.number - 1)\n end\n }\n return weeks.last.number\n end", "def aging_weeks__c\n if %w(1 true).include?(is_closed.to_s.downcase)\n (last_modified_date.to_i-created_date.to_i)/(60*60*24*7)\n else\n (Time.now.to_i - created_date.to_i)/(60*60*24*7)\n end\n end" ]
[ "0.6799802", "0.67953163", "0.6377486", "0.62406886", "0.6053723", "0.60249394", "0.59177655", "0.59103334", "0.59103334", "0.5898046", "0.58547884", "0.58547884", "0.58360773", "0.579886", "0.57984227", "0.57743114", "0.5767644", "0.574897", "0.5710354", "0.5698378", "0.5688825", "0.56639767", "0.56621", "0.5655301", "0.5652558", "0.5650506", "0.5631194", "0.56240785", "0.5613512", "0.56090313", "0.5605157", "0.5575603", "0.55536383", "0.5552188", "0.5550132", "0.55497247", "0.5538416", "0.55343765", "0.55196697", "0.5519581", "0.5490315", "0.54899347", "0.54898244", "0.54843265", "0.5481092", "0.5453835", "0.54495907", "0.5445338", "0.5426922", "0.54101604", "0.54020953", "0.54020953", "0.5397533", "0.5397144", "0.5397144", "0.5392906", "0.53905517", "0.5380632", "0.53734684", "0.53643286", "0.53608644", "0.53491914", "0.5349025", "0.5347221", "0.53468037", "0.5346631", "0.53427935", "0.5337076", "0.53326035", "0.5319195", "0.53175163", "0.5316214", "0.5313055", "0.53123224", "0.53123224", "0.5303112", "0.5301174", "0.5298448", "0.5296339", "0.52926123", "0.5291606", "0.5288936", "0.5287656", "0.52787596", "0.5272499", "0.52637005", "0.52628314", "0.52628094", "0.5248078", "0.52447355", "0.5243972", "0.52414376", "0.5235172", "0.52327645", "0.5230165", "0.5225701", "0.5222515", "0.521643", "0.5216276", "0.5214973", "0.5214606" ]
0.0
-1
Figure out if there is a better way to get this
def bye_weeks Set.new(((1..17).to_a - (cached_home_games.map(&:week) + cached_away_games.map(&:week)))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def offences_by; end", "def first_offset; end", "def first_offset; end", "def origin_aggressive\n return (@attributes & 0x80 == 0x00)\n end", "def anchored; end", "def caar; first.first end", "def first?; end", "def culprit\n @culprit\n end", "def probers; end", "def first; end", "def first; end", "def first_used\n [ index_of_first(self), index_of_first(@formats) ].compact.min\n end", "def internship_passed; end", "def get_original_result\n non_pr_results.first\n end", "def original_result; end", "def same; end", "def offences_by=(_arg0); end", "def caveats; nil end", "def caveats; nil end", "def getc()\n #This is a stub, used for indexing\n end", "def offset; end", "def offset; end", "def offset; end", "def current_entry; end", "def floor()\n #This is a stub, used for indexing\n end", "def current_offset; end", "def first() end", "def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end", "def how_long thing\n $lengthCache[thing] ||= $things[thing] && (1 + $things[thing].map{|t|how_long(t)}.inject(&:+)) || 0\nend", "def last_rut; end", "def loc; end", "def loc; end", "def loc; end", "def test_row_first(r)\n flag = false\n $pages[r-1].select{|p| (p.p >> PAGE_SHIFT).even? }.each {|p|\n $pages[r+1].select {|q| (q.p >> PAGE_SHIFT).even? and conflict?(p.v, q.v)\n }.each {|q|\n flag |= hammer_row(r, p, q, $ntime_max)\n } \n }\n return flag\nend", "def get_first\r\n @head&.data\r\n end", "def starting_position; end", "def possibly_include_hidden?; end", "def used?; end", "def known\n @n[0] - @tn[0]\n end", "def representative_member\n # memoize with a value that could be nil....\n return @representative_member if defined?(@representative_member)\n\n @representative_member = all_members.find { |m| m.id == work.representative_id }\n end", "def rest_positionals; end", "def most_specific_subdivision; end", "def required_positionals; end", "def one_singleton_ancestors_cache; end", "def hit_value()\n #This is a stub, used for indexing\n end", "def getc() end", "def getc() end", "def getc() end", "def topleft; return self[0,2].to_a; end", "def get_composite()\n return nil\n end", "def get_entry(entry); end", "def x; return self[0]; end", "def next_result()\n #This is a stub, used for indexing\n end", "def get_next_entry; end", "def attr_get_sb1(attr_type, strict = true)\n #This is a stub, used for indexing\n end", "def inspect()\n #This is a stub, used for indexing\n end", "def value_if_false\n return @value_if_false\n end", "def one_instance_ancestors_cache; end", "def usable?; end", "def rassoc(p0) end", "def bar?\n\t\t# with new cache structure, data is written to cache every frame, so after a couple of frames of not firing, the two values in the cache will be the same.\n\t\t# Nothing wrong with that though. It's not like you're allocating any more data than before or anything.\n\t\t\n\t\t# if boolean, return that value instead, ignoring the cache\n\t\treturn @this if !!@this == @this\n\t\t\n\t\t\n\t\t# there is stored data but it's old, or no data has yet been stored\n\t\t@prev && @prev != @this or @prev.nil?\n\tend", "def key_for_min_value(name_hash)\n low_key = nil\nlow_value = nil\nname_hash.each do |key, value|\n # binding.pry\n if low_value == nil or low_value > value\n low_value = value\n low_key = key\n end \nend\nlow_key\nend", "def real_mined_reader\n @real_mined\n end", "def get_bests_to_be_ignored\n @bests_to_be_ignored\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end", "def s0\n return self[:s0]\n end" ]
[ "0.544927", "0.5401816", "0.5142231", "0.5142231", "0.50187904", "0.4974338", "0.49353495", "0.4906963", "0.4893704", "0.48514667", "0.48020172", "0.48020172", "0.48010805", "0.48006916", "0.47972178", "0.47851503", "0.47756904", "0.47701055", "0.47678757", "0.47678757", "0.47589716", "0.47565448", "0.47565448", "0.47565448", "0.47413197", "0.47300765", "0.47163108", "0.47075215", "0.47064525", "0.47042152", "0.47037283", "0.4701043", "0.4701043", "0.4701043", "0.4694904", "0.46936122", "0.46748525", "0.46628544", "0.46612614", "0.46525544", "0.46506575", "0.4650266", "0.4649992", "0.46396467", "0.46378195", "0.4633452", "0.46242324", "0.46242324", "0.46242324", "0.46233037", "0.45999143", "0.45990497", "0.4596005", "0.4595739", "0.4580355", "0.45725664", "0.45664924", "0.4559794", "0.4556906", "0.45560876", "0.4554297", "0.45489553", "0.45481318", "0.45441237", "0.45438066", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548", "0.45426548" ]
0.0
-1
TODO Fix this. It only returns weeks that had an interception, since it doesn't join weeks with none.
def interceptions_per_game interceptions.joins(:game).group("armchair_analysis_games.wk").count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weeks\n @weeks ||= days.slice_when do |day|\n Date::DAYNAMES[day.wday] == LAST_DAY_OF_THE_WEEK\n end.to_a\n end", "def weeks\n\t\tk = offset( first_day.cwday )\n\n [ first_week( k ) ] + middle_weeks( DPW - k )\n end", "def unused_weeks()\n timesheets = Timesheet.where( :user_id => self.user_id, :year => self.year )\n used_weeks = timesheets.select( :week_number ).map( &:week_number )\n\n range = 1..Timesheet.get_last_week_number( self.year )\n unused_weeks = ( range.to_a - used_weeks )\n unused_weeks.push( self.week_number ) unless ( self.week_number.nil? )\n\n return unused_weeks.sort()\n end", "def all_weeks\n @all_weeks ||=\n data_points.each_with_object(Hash.new(0)) { |feed, all_weeks|\n all_weeks[feed.occurred_on.beginning_of_week(week_start_day)] += feed.send(field)\n }\n end", "def weeks_on_list\n @data['weeks_on_list']\n end", "def reportable_weeks(options = {})\n week = options[:from] ? from_time(options[:from]) : earliest_week\n last_in_sequence = current\n [week].tap do |weeks|\n while week != last_in_sequence\n week = week.next\n weeks << week\n end\n end\n end", "def weeks\n result = end_week - start_week + 1\n weeks = Date.new(start_date.year, 12, 31).strftime('%W').to_i\n result < 0 ? result + weeks : result\n end", "def weeks\n @month.weeks.map { |w|\n w.map { |d| \n {\n\t\t\t\t date: d,\n\t\t\t\t\titems: !d.nil? ? items.where( trx_date: d ) : []\n\t\t\t\t}\n }\n }\n end", "def week_eliminated(chefstats)\n chefstats.each { |chefstat|\n if chefstat.stat.abbreviation == Stat::ELIMINATED_ABBR\n return chefstat.week\n end\n }\n return nil\n end", "def bye_weeks\n Set.new(((1..17).to_a - (cached_home_games.map(&:week) + cached_away_games.map(&:week))))\n end", "def weeks() 7 * days end", "def registration_weeks\n result = 0\n weeks = 0\n if registration_start_date && registration_end_date\n weeks = Date.new(registration_start_date.year, 12, 31).\n strftime('%W').to_i\n\n result = get_registration_end_week - get_registration_start_week + 1\n end\n result < 0 ? result + weeks : result\n end", "def weeks\n\t\treturn self * 7.days\n\tend", "def weeks\n\t\treturn self * 7.days\n\tend", "def mds_needing_scoring\n Matchday.where(locked: true, scored: false).pluck(:week)\n end", "def weeks\n days_in_month = Time.days_in_month(month, year)\n starting_day = date.beginning_of_week() -1.day + beginning_of_week.days\n ending_day = (date + days_in_month).end_of_week() -1.day + beginning_of_week.days\n (starting_day..ending_day).to_a.in_groups_of(7).collect { |week| Week.new(week, events) }\n end", "def weeks\n lines[2..-1]\n end", "def cfp_weeks\n result = 0\n if call_for_papers\n result = call_for_papers.weeks\n end\n result\n end", "def current_week\n week_split.select { |c| c.include?(day) }.flatten\n end", "def setup_weeks(week_start)\n a_date = self.first\n the_last = self.last\n @weeks = []\n\n while (a_date < the_last)\n @weeks << Koyomi::Week.new(a_date, week_start)\n a_date += WEEK_DAYS\n end\n @weeks\n end", "def weeks_since(weeks)\n advance(weeks: weeks)\n end", "def next_week_in weeks\n Week.find_by(initial_day: initial_day+( weeks * 7.days))\n end", "def calculate_open_weeks\n @timeline_week_count - blackout_weeks_count - @course.weeks.count\n end", "def showable_week( nextweek )\n discover_week( nextweek ) do | timesheet |\n ( not timesheet.nil? )\n end\n end", "def availabilities_in_week(start_date)\n start = DateTime.strptime(start_date, '%d%m%Y')\n lessons = self.lessons\n lessons_booked = lessons.select{ |l| ((start)..(start + 7.days)).cover?(DateTime.strptime(l.date, '%d/%m/%Y')) }\n availabilities_booked = lessons_booked.map{ |l| l.availability }\n\n return self.availabilities.each_with_index.map do |a, i|\n a.attributes.merge({booked: availabilities_booked.include?(a), date: start + i.days})\n end\n end", "def week\n first_day_of_week = @date.monday\n \n days_of_week = []\n 7.times do |time|\n days_of_week << day_and_types(first_day_of_week + time.days)\n end \n \n days_of_week\n end", "def discover_week( nextweek )\n year = self.year\n owner = self.user_id\n\n if ( nextweek )\n inc = 1\n week = self.week_number + 1\n limit = Timesheet.get_last_week_number( year ) + 1\n\n return if ( week >= limit )\n else\n inc = -1\n week = self.week_number - 1\n limit = 0\n\n return if ( week <= limit )\n end\n\n while ( week != limit )\n timesheet = Timesheet.find_by_user_id_and_year_and_week_number(\n owner, year, week\n )\n\n if ( yield( timesheet ) )\n return { :week_number => week, :timesheet => timesheet }\n end\n\n week += inc\n end\n\n return nil\n end", "def week( date = Date.today )\n (0...weeks.size).find { |i| weeks[i].include? date } + 1\n end", "def max_weeks\n return SurvivorEntry::MAX_WEEKS_MAP[self.get_game_type]\n end", "def game_week\n now = DateTime.now\n all_games = NflSchedule.where(year: Date.today.year)\n .order(:start_time)\n week_started = 0\n all_games.each { |game|\n if (week_started < game.week) && (now > game.start_time)\n week_started = game.week\n end\n }\n return week_started\n end", "def get_current_week_from_weeks(weeks)\n now = DateTime.now\n weeks.each { |week|\n if now < week.start_time\n return (week.number - 1)\n end\n }\n return weeks.last.number\n end", "def get_biweek()\n a = []\n week_days = DAYS.map { |day| day[:day] }\n @schedule.each_with_index do |row, i|\n row = row.compact.map { |a| a.upcase }\n if row.all? { |word| week_days.include?(word) } && row != []\n a.push(i + 1)\n end\n end\n return a\nend", "def weeks ; self * 7.days ; end", "def inspect\n \"it is the \" + ordinal_list(@weeks) + \" week of the month\"\n end", "def last_week(x = 1)\n\t\tself - (604800 * x)\n\tend", "def weeks\n self.to_i * 604_800\n end", "def fortnights\n\t\treturn self * 2.weeks\n\tend", "def fortnights\n\t\treturn self * 2.weeks\n\tend", "def matches?(weeks_since_injury)\n\t\t\t\tweeks_since_injury >= (start_week - 1).to_f && # it's after the prior week, i.e. when injured, you are immediately in the first \n\t\t\t\t # week of injury\n\t\t\t\t(\n\t\t\t\t\tend_week.nil? ||\n\t\t\t\t\tweeks_since_injury < end_week.to_f # it's before the end_week number - i.e. exactly 1 week after an injury,\n\t\t\t\t \t\t\t # you are now into the second week of injury\n\t\t\t\t)\t\t\t\t \n\t\t\tend", "def weeks ; Duration[self * 604800] ; end", "def prune_weekly(snapshot)\n catch :found do\n (0..rotation.weekly - 1).each do |count|\n week_beg = beginning_of_week(in_weeks(count))\n week_end = end_of_week(in_weeks(count))\n if snapshot.created_at >= week_beg && snapshot.created_at <= week_end\n save_oldest_snapshot(snapshot, week_beg)\n throw :found, true\n end\n end\n false\n end\n end", "def one_week_wonders(songs)\n wonders = []\n (1...(songs.length - 1).each do |i|\n # two conditions must be satisfied\n # for it NOT to be a one week wonder\n # song this week is the song from previous week\n # or song this week is the song next week\n if songs[i - 1] == songs[i] or songs[i] == songs[i + 1]\n # if it's already in the not wonders, lets not repear ourselves\n if !not_wonders.include?(songs[i])\n not_wonders << songs[i]\n end\n end\n end\n\n wonders = []\n songs.each do |song|\n # if it is not in the not_wonders list then it is a wonder\n # we should add a song that is already in the wonders list\n if !not_wonders.include?(song) and !wonders.include?(song)\n wonders << song\n end\n end\n\n wonders\nend", "def current_week_statuses\n bools = []\n current_week_reports.each do |report|\n statuses = report.statuses\n statuses.each do |status|\n if status.goal_id == self.id\n bools << status.status\n end\n end\n end\n bools\n end", "def this_week(project, api_key)\n\treturn _iterations('current', project, api_key)\nend", "def week\n stamp = params[:stamp].to_i\n interval = (params[:interval] || 10).to_i\n plus_weeks = (params[:plus_weeks] || 0).to_i\n context = (params[:context] || 0).to_i == 1 ? true : false\n time = Time.at(stamp).utc\n\n # Calculate monday from given date\n wday = time.wday\n # Adjust for sunday when we want to start on a monday\n wday = 7 if wday == 0\n\n date = time - (wday.days - 1.days)\n\n date = date + plus_weeks.weeks\n\n # Number of days in week range if we add context, we add the surrounding weeks as well\n days = context ? (7 * 3) - 1 : 6\n\n # If context we'll start at the monday before\n if context\n date -= 7.days\n end\n\n\n\n week_data = []\n week_dates = []\n\n buckets = 0.step((60 * 24) - 1, interval).to_a\n\n (0..days).each do |day|\n interval_data = Hash.new { |h, k| h[k] = [] }\n\n data = GlucoseSensorData.by_day(date.to_date, :field => :timestamp)\n\n data.each do |datum|\n minutes = datum.timestamp.min + (datum.timestamp.hour * 60)\n # At first seems like a no op but this actually buckets minutes into intervals\n bucket = (minutes / interval) * interval\n\n interval_data[bucket] << datum\n end\n\n week_context = nil\n\n if context\n week_number = day / 7\n if week_number == 0\n week_context = \"before\"\n elsif week_number == 1\n week_context = \"current\"\n else\n week_context = \"after\"\n end\n else\n week_context = \"current\"\n end\n\n buckets.each do |bucket|\n datum = {}\n\n datums = interval_data[bucket]\n # Averages glucose values if there are more than one datum for that bucket\n if datums.length > 0\n datum[:glucose] = datums.inject(0.0) { |sum, d| sum + d.glucose } / datums.size\n #datum[:timestamp] = datums[0].timestamp.to_i\n end\n datum[:timestamp] = (date + bucket.minutes).to_i\n datum[:week_context] = week_context\n\n\n datum[:time] = bucket\n datum[:day] = date.strftime(\"%A\").downcase\n datum[:date] = date.to_i\n week_data << datum\n end\n\n week_dates.push({ :week_context => week_context, :day => date.strftime(\"%A\").downcase, :date => date.to_i })\n date += 1.days\n end\n\n render :json => { :data => week_data, :interval => interval, :week_dates => week_dates }\n end", "def smoked_this_week\n Smoke.by_user(id).this_week(Date.today).sum(:counted) || 0\n end", "def weekly_plan_workouts(todays_date) \n # lookup week day value of today's workout (name/description) by plan_day.\n # (for example, plan_day:103 is held on week_day:0 (Sunday))\n plan_week_day = current_user.training_cycles.last.plan.workouts.find_by(plan_day:plan_day(todays_date)).week_day\n\n # returns plan_day numbers for beginning and end of week surrounding the plan_day to create a weekly range from which to pull workouts\n # (if plan_day = 10, then week_start (1) & week_end (7) are plan_day:6 & 12 respectively)\n plan_week_start = (plan_day(todays_date) + 1) - plan_week_day\n\t\tplan_week_end = plan_day(todays_date) + (7 - plan_week_day)\n\n\t\t@workouts = current_user.training_cycles.last.plan.workouts.includes(:workout_type).where(plan_day:plan_week_start..plan_week_end).order(\"plan_day\")\n\tend", "def one_week_wonders(songs)\n one_week_wonders = songs.select {|el| no_repeats?(el, songs)}\n one_week_wonders.uniq\nend", "def weekly_availability\n return [] if course.nil?\n\n availability = [\n { day: 'monday', count: 0, start_times: [] },\n { day: 'tuesday', count: 0, start_times: [] },\n { day: 'wednesday', count: 0, start_times: [] },\n { day: 'thursday', count: 0, start_times: [] },\n { day: 'friday', count: 0, start_times: [] },\n { day: 'saturday', count: 0, start_times: [] },\n { day: 'sunday', count: 0, start_times: [] }\n ]\n\n course.plannings.order('start_time ASC, end_time ASC').each do |planning|\n next if planning.week_day.nil? or Date::DAYNAMES[planning.week_day].nil?\n course_day = Date::DAYNAMES[planning.week_day].downcase\n day_availability = availability.detect { |d| d[:day] == course_day }\n\n day_availability[:count] += 1\n day_availability[:start_times] << I18n.l(planning.start_time, format: :short) if planning.start_time\n end\n\n availability\n end", "def get_registrations_per_week\n result = []\n\n if registrations &&\n registration_start_date &&\n registration_end_date\n\n reg = registrations.group(\"strftime('%W', created_at)\").count\n start_week = get_registration_start_week\n weeks = registration_weeks\n result = calculate_items_per_week(start_week, weeks, reg)\n end\n result\n end", "def weeks; self * WEEK; end", "def weeks; self * WEEK; end", "def week_index\n @week_index ||= date.wday\n end", "def current_week\n return get_current_week_from_weeks(Week.where(year: Date.today.year)\n .order(:number))\n end", "def week\n @week ||= (((date-start_of_month)+1)/7.0).ceil\n end", "def non_working_week_days\n @non_working_week_days ||= begin\n days = [] # Setting.non_working_week_days\n if days.is_a?(Array) && days.size < 7\n days.map(&:to_i)\n else\n []\n end\n end\n end", "def calc_weeks_till\n (calc_days_till / 7.0).round(2)\n end", "def one_week_wonders(songs)\n songs.select {|song| no_repeats?(song, songs)}.uniq\nend", "def current_game_week\n url = \"/service/weather/json/#{api_key}/\"\n response = conn.get(url)\n result = JSON.parse(response.body, symbolize_names: true)\n weather_data = result[:Games].map do |home_team, weather_data|\n GameWeather.new(weather_data)\n end\n return result[:Week], weather_data\n end", "def beginning_of_week; end", "def beginning_of_week; end", "def week\n working_date = DateTime.new(self.year, 1, 1)\n working_date.week_day_start = self.week_day_start\n working_date = (working_date-working_date.send(\"wday_offset\"))\n week_num = 0\n working_date.step(self) { |a_day| \n if a_day.wday == _week_day_numbers.first\n week_num += 1\n end\n }\n week_num\n end", "def match_week\n @week ? { 'fiscal_week_id' => @week.to_i } : {}\n end", "def week\n self.range('week')\n end", "def this_week?\n\t\trange = (Time.now .. Time.now.sunday)\n\t\trange = (Time.now .. Time.now.next_week) if(Time.now.sunday?)\n\t\tself.showtimes.detect{ |st| range.cover? st.timestamp }\n\tend", "def this_week?\n\t\trange = (Time.now .. Time.now.sunday)\n\t\trange = (Time.now .. Time.now.next_week) if(Time.now.sunday?)\n\t\tself.showtimes.detect{ |st| range.cover? st.timestamp }\n\tend", "def week\n cweek = self.cweek\n year = self.year\n month = self.month\n\n next_year = year + 1\n previous_year = year - 1\n\n days = Date.new(year)\n .step(Date.new(year, -1, -1))\n .select{ |d| d.cweek == cweek }\n\n if cweek == 1 && month == 12 ||\n cweek == 1 && month == 1 ||\n cweek >= 52 && month == 12 ||\n cweek >= 52 && month == 1\n\n days.keep_if{ |d| d.year == year && d.month == month }\n end\n\n if days.count < 7\n rest = 7 - days.count\n\n rest_days = nil\n if month == 1\n rest_days = Date.new(previous_year, 12, 31 - rest + 1).step(Date.new(previous_year, 12, 31))\n elsif month == 12\n rest_days = Date.new(next_year).step(Date.new(next_year, 1, rest))\n end\n\n if !rest_days.nil?\n days += rest_days.to_a\n end\n end\n\n days.sort[0, 7]\n end", "def weeks_in_year\n return (self-(self.yday-1)).wday == 6 && self.leap? ? 54 : 53\n end", "def starting_of_week\n self.class.new(year, month, current_week.detect { |i| !i.nil? })\n end", "def skip_week\n for item in action_items\n item.skip! unless item.complete?\n end\n\n end", "def total_weeks\n week_split.size\n end", "def days_left_in_week\n 7 - days_past_in_week\n end", "def betweenDates(index,week)\n if (index <= week[4].to_i)\n return week\n end\n return []\nend", "def pays_players_week\n self.players.inject(0) {|sum, player| sum += player.pay_week}\n end", "def week; end", "def weeks\n rows = []\n rows << name_of_month.center(20) + \" \"\n rows << \"Su Mo Tu We Th Fr Sa\" + \" \"\n days = format_dates\n (0..7).each {|num|\n fields = days[num * 7, 7]\n rows << fields.join(\" \") + \" \" if fields\n }\n if rows.last.length < 22\n rows.last << \" \" * (22 - rows.last.length)\n end\n until rows.length == 8\n rows << \" \" * 22\n end\n rows\n end", "def weekoff_present(i,employee)\n flag = 0\n flag = EmployeeAttendance.exists?(day: i,employee_id: employee,present: \"WO\")\n flag\n end", "def start_of_week; self - wday.days end", "def not_scheduled_applications\n accepted_applications.select do |a|\n been_in_stage_for(a, 7.days.ago)\n end\n end", "def group_checkins_by_week\n previous = nil\n by_week = {}\n \n @checkins.each do |checkin|\n week_number = Time.at(checkin['createdAt']).strftime '%U'\n categories = checkin['venue']['categories']\n previous = checkin\n \n next if not categories.length\n \n venue_categories = []\n \n # Only gather up category names.\n categories.each do |cat|\n venue_categories << cat['shortName']\n end\n \n # Create a new array for week numbers that don't exist.\n if not by_week.has_key? week_number\n by_week[week_number] = []\n end\n \n by_week[week_number].push(venue_categories).flatten!\n end\n \n # Sort by week number.\n by_week.sort_by { |week| week }\n \n @by_week = by_week\n end", "def fortnights ; self * 2.weeks ; end", "def one_week_wonders(songs)\n songs.select { |song| no_repeats?(song, songs) }.uniq\nend", "def one_week_wonders(songs)\n songs.select { |song| no_repeats?(song, songs) }.uniq\nend", "def aging_weeks__c\n if %w(1 true).include?(is_closed.to_s.downcase)\n (last_modified_date.to_i-created_date.to_i)/(60*60*24*7)\n else\n (Time.now.to_i - created_date.to_i)/(60*60*24*7)\n end\n end", "def get_submissions_per_week\n result = []\n\n if call_for_papers && events\n submissions = events.group(\"strftime('%W', created_at)\").count\n start_week = call_for_papers.start_week\n weeks = call_for_papers.weeks\n result = calculate_items_per_week(start_week, weeks, submissions)\n end\n result\n end", "def calculate_week_meeting_dates\n meetings = []\n @timeline_week_count.times do |wk|\n week_start = @beginning_of_first_week + wk.weeks\n # This excludes Sunday, putting the end of the week at Saturday.\n week_end = week_start.end_of_week(:sunday)\n week_mtgs = []\n @meeting_dates.each do |meeting|\n next if (meeting < @course.timeline_start) || (@course.timeline_end < meeting)\n week_mtgs << meeting if date_is_between(meeting, week_start, week_end)\n end\n meetings.push week_mtgs\n end\n meetings\n end", "def general\n @week == 0 ? true : false\n end", "def iso_weeks_in_year(wkst)\n iso_year, week_one_start = *iso_year_and_week_one_start(wkst)\n probe_date = week_one_start + (7*52)\n if probe_date.iso_year(wkst) == iso_year\n 53\n else\n 52\n end\n end", "def weekly_updates_by_project(since)\n since = Date.new(2000,01,01) if since == :all\n self.weekly_updates.where([\"weekstart > ?\",since]).order(\"project_id, weekstart desc\").group_by {|w| w.project}\n end", "def current_week\n\t\t#TODO\n\tend", "def one_week_wonders(songs)\n songs.uniq.select { |song| no_repeats?(song, songs) }\nend", "def one_week_wonders(songs)\n songs.uniq.select { |song| no_repeats?(song, songs) }\nend", "def test_start_of_week(p_date)\n if p_date.wday == 0 #sundays count as end of week for vehicle app\n return p_date - 6\n else\n (p_date - p_date.wday.days) + 1 #start on monday\n end\n end", "def one_week_wonders(songs)\n songs.select{ |song| no_repeats?(song, songs)}.uniq\nend", "def current_week\n self.week.to_i\n end", "def find_weekpattern(date)\n # find the pattern that fits the date\n #\n if date < @from\n result = Week.new(Time.at(0), @from - MINUTE, WORK_TYPE)\n elsif date > to\n result = Week.new(@to + MINUTE, Time.new(9999), WORK_TYPE)\n else\n\n date = Time.gm(date.year, date.month, date.day)\n\n result = @weeks.find { |week| week.start <= date && week.finish >= date }\n end\n result\n end", "def x_weeks_from_day(weeks_away, day2index)\n day1index = dayindex\n if day1index > day2index\n days_away = (7 * weeks_away) - (day1index - day2index) #sm - removed the +1 from the weeks_away\n elsif day1index < day2index\n days_away = (7 * weeks_away) + (day2index - day1index)\n elsif day1index == day2index\n days_away = 7 * weeks_away\n end\n add_days(days_away) # returns a new date object\n end", "def number_of_weeks\n @number_of_weeks ||= cell_row(last_of_month) + 1\n end", "def week_pattern\n year_weeks == 53 ? [5,4,5]+[4,4,5]*3 : [4,4,5]*4\n end", "def cutoff_date\n case date.wday\n when 0\n date + (weeks.to_i * 7)\n when 1\n date + (weeks.to_i * 7) - 1\n when 2\n date + (weeks.to_i * 7) - 2\n when 3\n date + (weeks.to_i * 7) - 3\n when 4\n date + (weeks.to_i * 7) - 4\n when 5\n date + (weeks.to_i * 7) - 5\n when 6\n date + (weeks.to_i * 7) + 1\n end\n end", "def each_days_of_week(*wdays)\n if wdays.empty?\n each_days\n else\n each_days.except {|dt| !wdays.include?(dt.wday) }\n end\n end" ]
[ "0.69804275", "0.6597045", "0.6578972", "0.6551563", "0.63786703", "0.6333989", "0.6226884", "0.62110597", "0.6191249", "0.61191154", "0.6114361", "0.60792184", "0.6079087", "0.6079087", "0.60779744", "0.6050565", "0.6045271", "0.5944059", "0.5907793", "0.59022224", "0.58867776", "0.5873625", "0.58415437", "0.5825122", "0.58204424", "0.581895", "0.5793883", "0.57922983", "0.57805306", "0.5775046", "0.57745427", "0.5767976", "0.5737894", "0.57302624", "0.5717457", "0.570471", "0.56860334", "0.56860334", "0.5667378", "0.56604105", "0.5651204", "0.5642949", "0.56242007", "0.56204", "0.5606476", "0.5574118", "0.5565462", "0.55548984", "0.55435073", "0.55306673", "0.5530168", "0.5530168", "0.55254185", "0.5520407", "0.55040807", "0.54907155", "0.54902977", "0.5477115", "0.54718184", "0.54612994", "0.54612994", "0.54571325", "0.54532754", "0.54530996", "0.5449945", "0.5449945", "0.5442358", "0.54408026", "0.5430054", "0.5417648", "0.5415781", "0.54034823", "0.5400399", "0.5398874", "0.5396311", "0.539454", "0.5390857", "0.53823954", "0.53774077", "0.53725445", "0.5371522", "0.53715056", "0.53715056", "0.5371082", "0.5369682", "0.53578633", "0.53462297", "0.53435576", "0.5340236", "0.53401095", "0.5330465", "0.5330465", "0.5330411", "0.5329796", "0.53280205", "0.5305915", "0.52957296", "0.528178", "0.5278807", "0.5277993", "0.52775425" ]
0.0
-1
Policy: Update old one
def import(week = GameWeek.current.week) importing(week) do client = Scout::Client.new updated_players = client.players(:start => 0) import_log "updated_players: #{updated_players.size}" lookup = all.inject({}) do |id_to_player, player| id_to_player[player.yahoo_key] = player id_to_player end import_log "existing players: #{lookup.keys.size}" players_to_save = updated_players.map do |updated_player| if existing_player = lookup[updated_player.player_key] existing_player.attributes = Player.attributes_from_payload(updated_player) if existing_player.changed? existing_player else nil end else Player.from_payload(updated_player) end end.compact import_log "players_to_save: #{players_to_save.size}" players_to_save.each(&:save) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @policy = args[:policy] unless args[:policy].nil?\n end", "def update!(**args)\n @policy_delta = args[:policy_delta] if args.key?(:policy_delta)\n end", "def update!(**args)\n @policy_delta = args[:policy_delta] if args.key?(:policy_delta)\n end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update ; end", "def update() end", "def update\n\t\t# Left empty intentionally.\n\tend", "def update\n \n end", "def update!(**args)\n @disabled_policy = args[:disabled_policy] if args.key?(:disabled_policy)\n @has_unpublished_changes = args[:has_unpublished_changes] if args.key?(:has_unpublished_changes)\n @state = args[:state] if args.key?(:state)\n end", "def update_policy(resource, name, config)\n puts Colors.blue(\"\\tupdating policy #{name}...\")\n policy = resource.policy(name)\n if config.empty?\n policy.delete()\n else\n policy.put({\n :policy_document => config.as_pretty_json\n })\n end\n end", "def update\n # Not generally used\n end", "def update\n # Not generally used\n end", "def update\n \n end", "def replace_update_me\n end", "def update_policy(arn, doc)\n begin\n MU::Cloud::AWS.iam(credentials: @config['credentials']).create_policy_version(\n policy_arn: arn,\n set_as_default: true,\n policy_document: JSON.generate(doc)\n )\n rescue Aws::IAM::Errors::LimitExceeded => e\n delete_version = MU::Cloud::AWS.iam(credentials: @config['credentials']).list_policy_versions(\n policy_arn: arn,\n ).versions.last.version_id\n MU.log \"Purging oldest version (#{delete_version}) of IAM policy #{arn}\", MU::NOTICE\n MU::Cloud::AWS.iam(credentials: @config['credentials']).delete_policy_version(\n policy_arn: arn,\n version_id: delete_version\n )\n retry\n end\n end", "def update!(**args)\n @boolean_policy = args[:boolean_policy] if args.key?(:boolean_policy)\n @constraint = args[:constraint] if args.key?(:constraint)\n @etag = args[:etag] if args.key?(:etag)\n @list_policy = args[:list_policy] if args.key?(:list_policy)\n @restore_default = args[:restore_default] if args.key?(:restore_default)\n @update_time = args[:update_time] if args.key?(:update_time)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @metadata = args[:metadata] if args.key?(:metadata)\n @policy = args[:policy] if args.key?(:policy)\n end", "def update!(**args)\n @metadata = args[:metadata] if args.key?(:metadata)\n @policy = args[:policy] if args.key?(:policy)\n end", "def update_policy new_policy_hash\n new_policy_hash = new_policy_hash.try(:to_hash) || {}\n\n new_policy = new_policy_hash.underscorify_keys\n policy = to_hash.underscorify_keys.deep_reset(false)\n\n policy.deep_merge! new_policy\n update_attribute(:the_policy, _jsonable(policy))\n end", "def update\r\n end", "def update;end", "def update; end", "def update!(**args)\n @policy_action = args[:policy_action] if args.key?(:policy_action)\n @policy_name = args[:policy_name] if args.key?(:policy_name)\n end", "def update\n\t\t\n\t\tend", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @project_owner = args[:project_owner] if args.key?(:project_owner)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n end", "def update \n end", "def update(policy,exceptions)\n @options[:connection].put(\"/policies/#{@options[:path]}\", :payload => {:exceptions => exceptions, :policy => policy}) && true\n end", "def update \n end", "def update!\n return if locked? || originator.nil?\n originator.update_adjustment(self, source)\n end", "def update\n # TODO: implement update\n end", "def update\n #Nothing necessary\n end", "def update\n \t\n end", "def update\n \t\n end", "def update\n # don't need to update; hash is shared\n end", "def update\r\n end", "def update\r\n end", "def update\r\n end", "def update\r\n end", "def update\n\n end", "def update\r\n\r\n end", "def update #saves and redirects, saves changes\n end", "def update\n # do nothing\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @policy_name = args[:policy_name] if args.key?(:policy_name)\n @redact_query_span = args[:redact_query_span] if args.key?(:redact_query_span)\n @replacement = args[:replacement] if args.key?(:replacement)\n @scrub_argument_value = args[:scrub_argument_value] if args.key?(:scrub_argument_value)\n end", "def update_local\n # TODO\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @policy_tags = args[:policy_tags] if args.key?(:policy_tags)\n end", "def update!(**args)\n @access = args[:access] if args.key?(:access)\n @explained_policies = args[:explained_policies] if args.key?(:explained_policies)\n end", "def update!(**args)\n @access = args[:access] if args.key?(:access)\n @explained_policies = args[:explained_policies] if args.key?(:explained_policies)\n end", "def update!\n @source.headers.delete(:update)\n set_updated_time(Time.now)\n save\n end", "def update!(**args)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @policy = args[:policy] if args.key?(:policy)\n end" ]
[ "0.68869656", "0.68869656", "0.68869656", "0.68869656", "0.68869656", "0.68869656", "0.68869656", "0.68869656", "0.68869656", "0.68869656", "0.68869656", "0.68869656", "0.6849323", "0.6849323", "0.6849323", "0.6849323", "0.6849323", "0.6849323", "0.6849323", "0.6849323", "0.6806512", "0.67403454", "0.67403454", "0.6628104", "0.6628104", "0.6628104", "0.6628104", "0.6628104", "0.6628104", "0.6628104", "0.6628104", "0.65775365", "0.6561116", "0.6558344", "0.64675164", "0.64608246", "0.64473635", "0.64399344", "0.64399344", "0.63693345", "0.6352547", "0.6342427", "0.633933", "0.6324422", "0.6324422", "0.6302265", "0.6250284", "0.6249038", "0.62472665", "0.62461925", "0.6243501", "0.62266564", "0.62238276", "0.62125325", "0.6208457", "0.6183601", "0.6174833", "0.6174012", "0.61709875", "0.61709875", "0.6162951", "0.6157961", "0.6157961", "0.6157961", "0.6157961", "0.61528075", "0.61392236", "0.61358976", "0.6134796", "0.6131894", "0.6130773", "0.6130773", "0.6130773", "0.6130773", "0.6130773", "0.6130773", "0.6130773", "0.6130773", "0.6130773", "0.6130773", "0.6130773", "0.6130773", "0.6130773", "0.6128587", "0.6112394", "0.6103212", "0.6103212", "0.6103212", "0.6103212", "0.6103212", "0.6103212", "0.6103212", "0.6103212", "0.6103212", "0.6103212", "0.6103212", "0.60887563", "0.6084515", "0.6084515", "0.60771525", "0.60706604" ]
0.0
-1
we cache prime factors...
def prime_factors position = -1 if cached = $prime_factors[self] # cached? return cached # yes end if self == 1 # we have 1 we are done return $prime_factors[self]=[] # return no factors elsif position<0 # we havn't reached factor 5 yet if self&1 == 0 # test factor 2 return $prime_factors[self]=[2,*(self>>1).prime_factors] elsif self%3 == 0 # and factor 3 return $prime_factors[self]=[3,*(self/3).prime_factors] end end loop do position+=6 # increment position by 6 if position*position > self # we have a prime number return it return $prime_factors[self]=[self] elsif (quo,rem = divmod(position)) and rem.zero? # test 6n-1 return $prime_factors[self]=[position,*quo.prime_factors(position-6)] elsif (quo,rem = divmod(position+2)) and rem.zero? # and 6n+1 return $prime_factors[self]=[position+2,*quo.prime_factors(position-6)] end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prime_factors( n )\nend", "def prime_factorization(num)\nend", "def prime_factorization(num)\n \nend", "def prime_factorization(num)\n \nend", "def prime_factorization(num)\n \nend", "def prime_factors_mult( n )\nend", "def prime_factors\n n = self\n factors = Hash.new(0)\n\n # Pull out twos manually\n while n % 2 == 0 do\n factors[2] += 1\n n /= 2\n end\n\n # Then use Fermat's method\n a = Math.sqrt(n).ceil\n b2 = a**2 - n\n until (b2**0.5).round**2 == b2 do\n a += 1\n b2 = a**2 - n\n end\n\n candidates = [(a - Math.sqrt(b2)).round, (a + Math.sqrt(b2)).round]\n candidates.each do |candidate|\n next if candidate == 1\n if candidate == n\n factors[n] += 1\n else\n candidate_factors = candidate.prime_factors\n if candidate_factors.length == 1\n factors[candidate_factors.first] += 1\n else\n candidates.concat candidate_factors\n end\n end\n end\n \n expanded = []\n factors.each do |prime, count|\n count.times { expanded << prime }\n end\n expanded.sort\n end", "def prime_factor\n max = 600851475143**0.5\n\n for i in (1..max).step(2)\n if 600851475143 % i == 0\n if is_prime(i)\n ans = i\n end\n end\n end\n ans\nend", "def factors\n exponents = ::NArray.int(PRIMES.size, 2)\n self.each_with_index do |y, i|\n exponents[true,i] = ::NArray.to_na(PRIMES.to_a.map do |x|\n exp_count = 0\n while y % x == 0\n exp_count += 1\n y /= x\n end\n exp_count\n end)\n end\n # Will be an NArray of exponents (negative numbers are denominators)\n exponents[true,0] - exponents[true,1]\n end", "def prime_factorization(min_div)\r\n\tlist = []\r\n\tmin_div.prime_division.each{|arr| arr[1].times {list << arr[0]}}\r\n\tpowers = list.reverse.map{|i| i - 1}\r\n\tlist = Prime.take(list.size)\r\n\tlist.map.with_index{|_, idx| list[idx] ** powers[idx]}.inject(:*)\r\nend", "def prime_divisors(factor_me)\n squareroot = Math.sqrt(factor_me).ceil\n # print \"\\tDEBUG: limit is \\\"\" + squareroot.to_s + \"\\\"\\n\"\n\n factors= Set.new\n\n number_to_factor = factor_me\n\n for factor_candidate in 2..squareroot\n # if factor_candidate % number_to_factor == 0\n if number_to_factor.divmod(factor_candidate)[1] == 0\n #print \"\\tDEBUG: \\\"\" + factor_candidate.to_s + \n # \"\\\" is a factor of \\\"\" + number_to_factor.to_s + \"\\\"\\n\"\n\n factors.add(factor_candidate)\n number_to_factor = number_to_factor / factor_candidate\n end\n end\n\n if factors.size == 0\n print \"\\t\\t\" + factor_me.to_s + \" is prime!\\n\"\n end\n\n return factors\n\nend", "def prime_factors(n)\r\n num=Math.sqrt(n).round\r\n while num>0\r\n if n%num==0\r\n return num if prime?(num)\r\n end\r\n num-=1\r\n end\r\nend", "def prime_factorization num\n acc = 1\n ans = Array.new\n for i in 2..num\n if num % i == 0\n if isPrime?(i)\n temp = num\n count = 0\n ans.push(i)\n while (temp % i == 0)\n count = count + 1\n temp = temp / i\n acc = acc * i\n end\n ans.push(count)\n if acc == num\n return ans\n end\n end\n end\n end\nend", "def prime_factors(n)\n\tfps = []\n\t# check for even\n\tif n % 2 == 0\n\t\tfps.push(2)\n\t\tn = div_factor(n, 2)\n\tend\n\t# check odd factors\n\tfact = 3\n\tmaxFact = Math.sqrt(n)\n\twhile n > 1 && fact < maxFact\n\t\tif n % fact == 0\n\t\t\tfps.push(fact)\n\t\t\tn = div_factor(n, fact)\n\t\t\tmaxFact = Math.sqrt(n)\n\t\tend\n\t\tfact = fact + 2\n\tend\n\tif n > fps.last\n\t\tfps.push(n)\n\tend\n\tfps.sort!\nend", "def prime_factorization(num)\n primes = [] \n i = 2 \n while num != 1\n while num % i == 0\n if is_prime?(i) \n num = num / i \n primes << i \n else\n i += 1 \n end \n end\n i += 1 \n end\n primes\nend", "def prime_factorization(n)\n return [n] if is_prime?(n)\n\n # factors(n).each do |factor|\n # return [prime_factorization(factor), prime_factorization(n/factor)].flatten\n # end\n factor = factors(n)[0]\n prime_factorization(factor) + prime_factorization(n/factor)\n \n \nend", "def prime_factors (n)\n return factors(n) & primes(n)\nend", "def prime_factorization(num)\n if is_prime?(num)\n return [num]\n end\n factors = []\n (2..num).each do |factor|\n if num % factor == 0\n factors << factor\n factors << prime_factorization(num/factor)\n \n break\n end\n end\n factors.flatten\n\nend", "def factors() (1..self).select { |n| (self % n).zero? } end", "def prime_factors(n)\n return factors(n) & primes(n)\nend", "def prime_factors(n)\n factors = []\n old_n = n\n @primes.each { |prime|\n if @factors_hash[n]\n factors += @factors_hash[n]\n factors.uniq!\n break\n end\n if n % prime == 0\n factors.push(prime)\n n /= prime\n end\n break if prime >= n\n # If the remainder is a prime, add and break\n if @prime_hash[n]\n factors.push(n)\n break\n end\n }\n @factors_hash[old_n] = factors\n return factors\nend", "def prime_factorization(num)\n return [num] if is_prime?(num)\n\n (2..num).each do |fact|\n if num % fact == 0\n prime_factorization(fact)\n other_fact = num / fact\n prime_factorization(other_fact)\n end\n end\n\nend", "def prime_factor(n)\n factors = []\n p = 2\n\n\n while (p < n)\n\n return factors if ( factors.inject(:*).to_i >= n )\n\n if ( n % p == 0 )\n factors.push(p)\n end\n\n p += 1\n\n end\n\n\n return factors\nend", "def prime_factor(num)\n i = 2\n factors = []\n while i <= num\n if num % i == 0\n factors << i\n num = num / i\n else\n i += 1\n end\n end\n factors\nend", "def prime_factors\n return self.prime_factorization.uniq\n end", "def product_of_factorization(prime_factors)\n answer = 1\n prime_factors.each do |prime, exponent|\n answer *= prime**exponent\n end\n answer\nend", "def prime_factorization(num)\n\n (2...num).each do |factor|\n if num % factor == 0\n divisor = num / factor\n return prime_factorization(factor) + prime_factorization(divisor)\n end\n end\n [num]\nend", "def primeFactors(n)\n i = 2\n npf = 0 #number of prime factors\n while i < n-1\n if n % i == 0 && Prime.prime?(i)\n npf += 1\n end\n i+=1\n end\n npf\nend", "def prime_factors(number)\n factors = []\n i = 0\n if prime?(number)\n return [number]\n else\n new_prime = @primes[-1] + 2\n while @primes[-1] * 2 <= number\n if prime?(new_prime)\n @primes << new_prime\n end\n new_prime += 2\n end\n while @primes[i] <= Math.sqrt(number)\n if number % @primes[i] == 0\n factors << @primes[i]\n number /= @primes[i]\n i = 0\n else\n i += 1\n end\n end\n factors << number\n end\n return factors\nend", "def prime_factors(num)\n facs = factors(num)\n p_facs = []\n facs.each{|n| p_facs.push(n) if prime?(n)}\n p_facs\nend", "def prime_factorization(num)\n return [num] if prime?(num)\n\n #otherwise break up into two factors, \n #and call prime_factorization on them both\n (2..num/2).each do |n| \n if num % n == 0\n return prime_factorization(n) + prime_factorization(num/n) \n end\n end\nend", "def prime_factors(n)\n return [] if n == 1\n factor = (2..n).find {|x| n % x == 0}\n [factor] + prime_factors(n / factor)\nend", "def factor_primes n\n a=1;b=1\n while a < n do\n a=a+1\n next if not n.modulo(a).zero? or a == b\n b=b*a\n puts \"a=#{a};b=#{b}\"\n break if b == n\n end\nend", "def prime_factors(num)\n require \"prime\"\n primes = []\n Prime.each{|prime| primes << prime if num % prime ==0 ; break if prime > num }\n primes\nend", "def prime_factors\n if prime?\n [self]\n else\n pair = factorize\n (pair[0].prime_factors + pair[1].prime_factors).sort.uniq\n end\n end", "def prime_factors(num)\n factors(num).select {|n| prime?(n)}\nend", "def prime_factorization(num)\n (2...num).each do |fact|\n if num % fact == 0 \n fact_2 = num / fact\n return [ *prime_factorization(fact), *prime_factorization(fact_2) ]\n end\n end\n\n [ num ]\nend", "def prime_factors(num)\r\n # your code goes here\r\n prime_factors = []\r\n for i in 1 .. num\r\n if num % i == 0 && prime?(i)\r\n prime_factors << i\r\n end\r\n end\r\n prime_factors\r\nend", "def factors(num)\n factors = Prime.prime_division(num)\n result = []\n factors.each { |factor, power| result += [factor] * power }\n result\nend", "def factors( n )\n p = Primer.ld( n )\n return n if p == n\n factors n.div( p )\nend", "def prime2(nprime)\n\n primes = [2]\n factors = {}\n\n num = 3\n while primes.size < nprime do\n\n root = Math.sqrt(num).floor\n isprime = true\n\n primes.each{ |prime|\n break if prime > root\n if num % prime == 0\n isprime = false\n break\n end\n }\n\n primes << num if isprime\n num += 1\n\n printf(\"\\r%d\", primes.size) if primes.size % 1000.0 == 0\n\n end\n\n return primes\n\nend", "def factors(num)\n pn = num.prime_division\n ans = []\n pn.each_index do |i|\n ans << pn[i][0]\n end\n return ans\nend", "def prime_factors(n)\n factors = []\n d = 2\n while n > 1\n while n % d == 0\n factors << d\n n /= d\n end\n d = d + 1\n if d*d > n\n if n > 1\n factors << n\n break\n end\n end\n end\n return factors\nend", "def prime_factors(num)\n factors = factors(num)\n result = []\n factors.each do |fac|\n if prime?(fac)\n result << fac\n end\n end\n result\nend", "def prime_factors(number)\n primes = []\n return primes unless number >= 1\n return primes << number if is_prime?(number)\n # until is_prime?(number) do\n (2..(number / 2)).to_a.each do |num|\n if number % num == 0 # Divisor\n if is_prime?(num)\n primes << num\n number /= num\n return (primes << prime_factors(number)).flatten\n # break\n end\n end\n end\n # end\n # primes << number\nend", "def prime_factorization(num)\n (2...num).each do |fact|\n if (num % fact == 0)\n otherFact = num / fact\n return [ *prime_factorization(fact), *prime_factorization(otherFact) ]\n end\n end\n\n [num]\nend", "def factors(num)\n prime?(num) ? [1, num].uniq : [*1..num].select { |i| num % i == 0}\nend", "def prime_factorization(num)\n # return [num] if prime?(num)\n # first_prime = find_prime_factor(num)\n # return [first_prime] + prime_factorization(num/first_prime)\n (2...(num/2)).each do |n|\n if num % n == 0\n multiplier = num / n\n return prime_factorization(n) + prime_factorization(multiplier)\n end\n end\n [num]\nend", "def prime_factors(num)\n\n if prime?(num)\n return [num]\n end\n\n primes = (2...num).to_a.select { |factor| prime?(factor) }\n\n \n \n factors = []\n\n while num > 1\n candidate = primes.shift\n\n if num % candidate == 0\n factors << candidate\n while num % candidate == 0\n num /= candidate\n end\n end\n end\n\n return factors\n \nend", "def prime_factorization(num)\n (2...num).each do |fact|\n if num % fact == 0\n other_fact = num/fact\n return [*prime_factorization(fact),*prime_factorization(other_fact)]\n end\n end\n\n return [num]\nend", "def factors(num)\r\n factors = []\r\n sqrt = Math.sqrt(num)\r\n until num == 1\r\n\r\n factor_founded = false\r\n (2..sqrt).each do |i|\r\n if (num % i).zero?\r\n num /= i\r\n factors << i\r\n factor_founded = true\r\n break\r\n end\r\n end\r\n unless factor_founded\r\n factors << num\r\n num /= num\r\n end\r\n end\r\n return factors\r\nend", "def prime_factorization(num)\n (2...num).each do |fact|\n if num % fact == 0\n other_fact = num / fact\n return [ *prime_factorization(fact), *prime_factorization(other_fact) ]\n end\n end\n [ num ]\nend", "def prime_factors(num)\n factors(num).select { |factor| prime?(factor) }\nend", "def prime_factorization(num)\n\n (2...num).each do |i|\n if num % i == 0\n i2 = num / i\n return [*prime_factorization(i), *prime_factorization(i2)]\n end \n end\n [num]\nend", "def prime_factorization_of number\n counter = 2\n result = {}\n\n while number > 1\n # Check if the counter divides number, reducing the number each time until\n # counter no longer divides into it.\n #\n # A prime check isn't necessary as a prime will always precede its\n # composite values. Thus, a prime's multiples should never divide the\n # reduced number. This is less CPU work than checking if the counter is\n # prime.\n if number % counter == 0\n result[counter] = 0\n until number % counter != 0\n number = number / counter\n result[counter] += 1\n end\n end\n counter += 1\n end\n\n result\nend", "def prime_factors(num)\n facs = (1..num).select {|x| num % x == 0 }\n facs.select {|x| prime?(x)}\nend", "def prime_factors(num)\n (2..num).select {|n| num%n ==0 && prime?(n)} \nend", "def prime_factorization(num)\n (2...num).each do |fact|\n if num % fact == 0\n other_fact = num / fact\n return [*prime_factorization(fact), *prime_factorization(other_fact)]\n end\n end\n [num]\nend", "def prime_factorisation(n)\n Prime.prime_division(n).flat_map { |factor, power| [factor] * power }\n end", "def generate_smooth_prime(factors, bitsize)\n factors -= [2] # Just to be sure\n min_prime = 2 ** (bitsize-1)\n # tries = 0\n while true\n p1 = 2\n seen_factors = Set[]\n\n while p1 < min_prime\n u = factors.sample\n next if seen_factors.include?(u)\n p1 *= u\n end\n # tries += 1\n if (p1+1).fast_prime?\n # puts \"Found in #{tries} tries\"\n return (p1+1)\n end\n # if tries % 10000 == 0\n # puts \"#{tries} tries\"\n # end\n end\n end", "def compute\n n = 600851475143\n\n while true\n p = smallest_prime_factor(n)\n\n if p < n\n n /= p\n else\n return n\n end\n end\nend", "def prime_factorization(n)\n (2...n).each do |num|\n if n % num == 0\n othernum = n / num\n return [*prime_factorization(num),*prime_factorization(othernum)]\n end\n end\n [n]\nend", "def prime_factors num\n\tfactors = []\n\ttest_value = 2\n\twhile num > 1 do\n\t\twhile num % test_value == 0 do\n\t\t\tfactors.push num\n\t\t\tnum = num / test_value\n\t\tend\n\t\ttest_value += 1\n\tend\n\treturn factors\nend", "def prime_factorization(num)\n return [num] if is_prime?(num)\n\n prime_factors = []\n prime_factors << first_factor(num)\n next_num = num / first_factor(num)\n prime_factors << prime_factorization(next_num)\n prime_factors.flatten\nend", "def prime_factors (n)\r\n return factors(n).select { |x| factors(x).length == 2 }\r\nend", "def primeFactors(x)\n\tlargestFactor = 1\n\tcurrentFactor = 1\n\twhile currentFactor <= x # limit of the problem\n\t\tif x % currentFactor == 0 \n\t\t\tx = x / currentFactor\n\t\t\tif currentFactor > largestFactor\n\t\t\t\tlargestFactor = currentFactor\n\t\t\t\tcurrentFactor = 0\n\t\t\tend\n\t\tend\n\t\tcurrentFactor += 1\n\tend\n\treturn largestFactor\nend", "def factors(number)\n # TODO: can optimise by only going up to the square of the number\n (1..number).select { |x| number % x == 0 }.count\nend", "def prime_factors(num)\n prime_facts = []\n\n (1..num).each do |i|\n if num % i == 0 && prime?(i)\n prime_facts << i\n end\n end\n\n return prime_facts\nend", "def primo_factor(number)\t\n\n\tresult =[]\n\n\twhile number != 1\n\t\tfor i in 2..10000\n\t\t\tif number % i == 0 && number > 1\n\t\t\t\tresult << i\n\t\t\t\tnumber = number/i\t\t\t\n\t\n\t \t\tend\n\t\tend\n\tend\n\tputs \"The largest prime factor of #{number} is #{result.inspect}. Congrats!\"\n\nend", "def prime_factors(num)\n arr = factors(num)\n new_arr = []\n arr.each do |n|\n new_arr << n if prime?(n)\n end\n new_arr\nend", "def factorize(orig)\n factors = {}\n factors.default = 0 # return 0 instead nil if key not found in hash\n n = orig\n i = 2\n sqi = 4 # square of i\n while sqi <= n do\n while n.modulo(i) == 0 do\n n /= i\n factors[i] += 1\n \t# puts \"Found factor #{i}\"\n end\n # we take advantage of the fact that (i +1)**2 = i**2 + 2*i +1\n sqi += 2 * i + 1\n i += 1\n end\n \n if (n != 1) and (n != orig)\n factors[n] += 1\n end\n factors\nend", "def prime_factorization(num)\n\n return [num] if prime?(num)\n\n (2...num).each do |divisor|\n if num % divisor == 0\n next_factor = num / divisor\n return [divisor, *prime_factorization(next_factor)]\n end\n end\n\nend", "def prime_factorization(num)\n if is_prime(num)\n return [num]\n else\n n = 2\n while (num % n) != 0\n n += 1\n end\n return [n] + prime_factorization(num / n)\n end\nend", "def prime_factorization(num)\n return [num] if prime?(num)\n [2,3,5].each do |factor|\n if num % factor == 0\n return [factor] + prime_factorization(num / factor)\n end\n end\nend", "def prime_factorization(num)\n (2...num).each do |factor|\n if num % factor == 0\n other = num / factor\n return prime_factorization(factor).concat(prime_factorization(other))\n end\n end\n\n [num]\nend", "def factor(n)\n i=2 # start at 2 since all is divisible by one\n prime = true\n #print \"Factors of #{n}: \"\n while( i < Math.sqrt(n)+1 ) # only test up to the square root of the number\n if(n%i == 0)\n # print \"#{i},\"\n prime = false\n end\n i += 1\n end\n if (prime == true) \n puts \"#{n} is a prime number. Found in: #{Time.now - $start} seconds\" # since last prime number found\n $start = Time.now \n end\n \nend", "def prime_factors (n)\n return (1..n).select { |x| n%x==0 and x.prime? }\nend", "def prime_factors(number)\n divisors = []\n divisor = 2\n\n while number > 1\n if number % divisor == 0\n number /= divisor\n divisors << divisor\n else\n divisor += 1\n end\n end\n\n divisors.uniq\nend", "def compute_primes\n nums = (@max_checked..@max_checked * 2).map { |x| x.odd? ? x : nil }.to_a\n 1.upto(@primes.index { |p| p * p > @max_checked * 2 }) do |i|\n start_idx = -@max_checked % @primes[i] # prime[i]'s 1st multiple's index\n\n (start_idx..nums.size).step(@primes[i]) { |x| nums[x] = nil }\n end\n @max_checked *= 2\n @primes += nums.compact\n end", "def factors\n k = 1\n max = Math.sqrt(self).ceil\n lofacs = []\n hifacs = []\n while k <= max.ceil\n if (self.to_f/k) == (self.to_i/k)\n lofacs << k\n hifacs << self/k unless self/k == k\n end\n k += 1\n end\n lofacs + hifacs.reverse\n end", "def prime_factors(num)\n\tfactors(num).select { |n| prime?(n) }\nend", "def all_factorizations(num)\n Prime.prime_division(num)\nend", "def euler003\n 600851475143.prime_factors.last\nend", "def prime_factors(number)\n return [] if number < 2\n return [number] if number < 4\n factors = []\n\n factor = 2\n while factor < number\n break if number % factor == 0\n factor += 1\n end\n factors << factor\n factors.concat(prime_factors(number / factor))\n factors.sort\nend", "def prime_factors(number)\n return [] if number < 2\n return [number] if number < 4\n factors = []\n\n factor = 2\n while factor < number\n break if number % factor == 0\n factor += 1\n end\n factors << factor\n factors.concat(prime_factors(number / factor))\n factors.sort\nend", "def prime_factors(num)\n arr = (2..Math.sqrt(num).round).to_a\n primes = arr.each do |i|\n arr.select! {|j| j%i != 0 or j==i}\n end\n pfacts = primes.select {|i| num%i == 0}\n\n return [num] if pfacts.empty?\n return pfacts\nend", "def prime_factors(num)\n primes = (2..num).select { | n | isprime?(n) }\n primes.select { |prime| num % prime == 0 }\nend", "def arrPrimeFactors (n)\n result = Array.new\n while n != 1\n (2 .. n).each do |i|\n if n % i == 0\n result.push i\n n /= i\n break\n end\n end\n end\n result\nend", "def prime_factors(number, array=[])\n 2.upto(number) do |factor|\n if number % factor == 0\n array << factor\n number /= factor\n prime_factors(number, array)\n break\n end\n end\n array\nend", "def num_factors(n)\n pf = prime_factors(n)\n freq = Hash.new(0)\n pf.each{ |i| freq[i] += 1 }\n freq.inject(1){ |t,(k,v)| t * (v+1) }\nend", "def solution(n)\n factors = 0\n (1..Math.sqrt(n)).each do |i|\n if n % i == 0\n factors += i == Math.sqrt(n) ? 1 : 2\n end\n end\n factors\nend", "def prime_factor(num)\n\t\n\t(1..num).select {|n| (num % n).zero?}\n\t#zero? will return true when num has zero\nend", "def solution(a)\n factors = factors_sieve(a)\n n = a.size\n a.map {|num| n - factors[num]}\nend", "def primes_from_2( x )\n # primes have no factors except for 1 and self\n primes = [ 2 ]\n i = 2\n while primes.size < x\n i += 1\n is_prime = true\n primes.each do |p|\n #( 2..( i ** 0.5 ).floor ).each do |p|\n #break if p > ( i / 2 )\n break if p > ( i ** 0.5 )\n if 0 == ( i % p )\n is_prime = false\n break\n end\n end # p\n primes << i if is_prime\n i += 1 # skip the next integer (it's even)\n end # while\n return primes[ -1 ]\nend", "def find_factors!\n (1..number).each do |n|\n break if @factors.include?(n)\n if number % n == 0\n @factors << n << (number / n)\n end\n end\n # handle any perfect squares\n\n @factors.uniq!\n end", "def prime_factorization(num)\n return [num] if prime?(num)\n (2...num).each do |i|\n if prime?(i) && num % i == 0\n return [i].concat(prime_factorization(num / i))\n end\n end\nend", "def factors(number)\n dividend = number\n divisors = []\n while dividend > 0 do\n divisors << number / dividend if number % dividend == 0\n dividend -= 1\n end\n puts \"Prime!!\" if divisors.length < 3\n divisors\nend", "def factors(num)\n\nend", "def factors(num)\n\nend", "def factors(num)\n\nend" ]
[ "0.7829766", "0.77158517", "0.7673474", "0.7673474", "0.7673474", "0.76552266", "0.7640543", "0.76309425", "0.7583187", "0.7530958", "0.75230366", "0.7519169", "0.7515079", "0.75122666", "0.7487473", "0.7480736", "0.74699724", "0.7453267", "0.74499947", "0.74438536", "0.7428626", "0.7419749", "0.7409938", "0.7347565", "0.7326705", "0.73169774", "0.72997665", "0.72919077", "0.7290724", "0.72736263", "0.72644854", "0.72485626", "0.7244199", "0.72410655", "0.7226251", "0.72006255", "0.71990305", "0.7197911", "0.7190491", "0.71859187", "0.71858954", "0.71833086", "0.71817505", "0.7179477", "0.71727204", "0.7171743", "0.71536416", "0.7142787", "0.71330035", "0.7130468", "0.71303815", "0.71235335", "0.7118107", "0.7112579", "0.71096313", "0.7092699", "0.7080882", "0.7076538", "0.7073981", "0.7073154", "0.70647943", "0.7060147", "0.70593274", "0.70351136", "0.70268637", "0.7025646", "0.70250076", "0.70249236", "0.7024683", "0.7024044", "0.7019652", "0.701454", "0.7010954", "0.70102394", "0.7005821", "0.69881934", "0.69877285", "0.6978988", "0.6977122", "0.69760984", "0.69737303", "0.6970827", "0.69555664", "0.6951222", "0.6951222", "0.6940092", "0.69380766", "0.69305694", "0.692835", "0.6927717", "0.6924562", "0.69227874", "0.69122016", "0.6910169", "0.69097865", "0.6906975", "0.69037616", "0.69013596", "0.69013596", "0.69013596" ]
0.7299499
27
Note that `ongoing` in this context means currently ongoing or upcoming as per Linked Events documentation. This parameter needs a specified text search, so it is not a boolean flag. For example to search ongoing or upcoming that match the text "nuoret", use `ongoing: "nuoret"`.
def events(publisher: nil, keywords: nil, start: nil, ongoing: nil, sort: "start_time") keywords = keywords.join(",") if keywords.is_a?(Array) result = fetch( "event", # Undocumented `event_type` parameter used at tapahtumat.hel.fi event_type: "general", # Types used at tapahtumat.hel.fi, removes the recurring super events # which have their own occurrences for each event day. Otherwise the # list might show duplicates during the first occurrence of the event. super_event_type: "umbrella,none", publisher: publisher.presence, keyword: keywords.presence, start: start.presence, all_ongoing_AND: ongoing.presence, sort: sort.presence ) return [] unless result result["data"] || [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_text_main(clipped = false)\n text = ''\n if self.event_type == 'sent' \n text = text + self.outgoing_message.get_text_for_indexing + \"\\n\\n\"\n elsif self.event_type == 'followup_sent'\n text = text + self.outgoing_message.get_text_for_indexing + \"\\n\\n\"\n elsif self.event_type == 'response'\n if clipped\n text = text + self.incoming_message.get_text_for_indexing_clipped + \"\\n\\n\"\n else\n text = text + self.incoming_message.get_text_for_indexing_full + \"\\n\\n\"\n end\n elsif self.event_type == 'comment'\n text = text + self.comment.body + \"\\n\\n\"\n else\n # nothing\n end\n return text\n end", "def match_event(query); end", "def legacy_search(args)\n warn \"WARNING: Calling Technorati#search this way is deprecated.\"\n warn \"WARNING: Please update your code.\"\n\n { 'start' => args } \n end", "def search_for_future_calendar_events\n uri = URI.parse(\"https://www.googleapis.com/calendar/v3/calendars/ufbobbo%40gmail.com/events?orderBy=startTime&singleEvents=true&timeMin=#{Time.now.strftime(\"%FT%T%:z\")}&fields=items(id%2Cstart)&key=#{ENV['GOOGLE_API_KEY']}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request).body\n end", "def searchEvents(word)\n @w = word.downcase()\n @ufEvents = Event.all\n @es = []\n @ufEvents.each do |e|\n if e.name.to_s.downcase().include?(@w) ||\n e.description.to_s.downcase().include?(@w) ||\n e.street.to_s.downcase().include?(@w) ||\n e.city.to_s.downcase().include?(@w) ||\n e.state.to_s.downcase().include?(@w) ||\n e.country.to_s.downcase().include?(@w) ||\n User.find_by(id: e.user_id).username.downcase().include?(@w)\n @es.push(e)\n end\n end\n return @es\n end", "def upcoming_event?(event)\n #FIXME_AB: no need to fire a query.\n Event.upcoming.include?(event)\n end", "def search_non_note(string)\n logger.info \"Searching for '#{string}'\"\n search string\n end", "def search(event)\n self.class.runtime += event.duration\n return unless logger.debug?\n\n payload = event.payload\n name = \"#{payload[:klass]} #{payload[:name]} (#{event.duration.round(1)}ms)\"\n search = payload[:search].inspect.gsub(/:(\\w+)=>/, '\\1: ')\n\n debug %Q| #{color(name, GREEN, true)} #{colorize_logging ? \"\\e[2m#{search}\\e[0m\" : search}|\n end", "def upcoming_events\n attended_events.where('date >= :current_date AND accepted',\n current_date: DateTime.now)\n end", "def search\n if params[:query]\n respond_with Event\n .fulltext_search(params[:query])\n .includes(:categories, :organization, :location)\n else\n Event\n .order(\"updated_at DESC\")\n .includes(:categories, :organization, :location)\n end\n end", "def search_search_text\n query\n .where(\"decidim_opinions_opinions.title ILIKE ?\", \"%#{search_text}%\")\n .or(query.where(\"decidim_opinions_opinions.body ILIKE ?\", \"%#{search_text}%\"))\n end", "def full_text_search(options, ar_options ={})\n klass = use_invitation(options) ? Invitation : Meeting\n ar_options[:include] ||= DEFAULT_INCLUDES\n\t\t build_query_string(options)\n\n\t\t options[:sort] = @sort_options unless @sort_options.nil?\n\t\t options[:page] ||= 1\n logger.debug \"SEARCH STRING: #{@query_string} OPTIONS: #{options.to_yaml}\"\n\n\t\t begin\n\t\t results = klass.paginate_search(@query_string, options, ar_options) \n\t\t rescue\n\t\t logger.error(\"Error while searching with search string: #{@query_string}\")\n\t\t logger.error(\"Error was: #{$!}.\")\n\t\t logger.error($!.backtrace.join(\"\\n\"))\n\t\t return WillPaginate::Collection.new(0, 20, 0) # This is wrong actually. We need to return an empty paginator... Might be somethign like this WillPaginate::Collection.new(page, per_page, total_hits) ?? \n\t\t end\n results.each do |result|\n result.extend(TTB::CoerceInvitation)\n result.filtered_date = self.start_date\n end\n \n \n #~ real_results = results.sort_by{|inv| inv.start_time_local }\n #~ real_results.extend(TTB::CoerceResults)\n #~ real_results.real_results = results\n\t\t return results\n\t\tend", "def index\n if params[:search].present? || params[:date_filter].present?\n # @ingoing = Document.search(\n # params[:search], \n # where: {\n # outgoing: false,\n # date: {\n # gte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').beginning_of_day, \n # lte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').end_of_day\n # } \n # }, \n # order: {created_at: :desc} )\n # @outgoing = Document.search(\n # params[:search], \n # where: {\n # outgoing: true,\n # date: {\n # gte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').beginning_of_day, \n # lte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').end_of_day\n # } \n # }, \n # order: {created_at: :desc} )\n\n search = params[:search].present? ? params[:search] : \"*\"\n where = {}\n\n # if params[:date_filter].present?\n # where[:date] = {\n # gte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').beginning_of_day,\n # lte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').end_of_day\n # }\n # end\n\n # @ingoing = Document.search(search, where.merge(outgoing: false))\n # @outgoing = Document.search(search, where.merge(outgoing: true))\n\n # search = params[:search].present? ? params[:search] : \"*\"\n # where = {misspellings: false}\n\n if params[:date_filter].present?\n where[:date] = {\n gte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').beginning_of_day,\n lte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').end_of_day\n }\n end\n\n @ingoing = Document.search( search, where: where.merge(:outgoing => false), order: {created_at: :desc}, misspellings: false )\n @outgoing = Document.search( search, where: where.merge(:outgoing => true), order: {created_at: :desc}, misspellings: false )\n\n else\n @documents = Document.where(archival: false)\n @ingoing = @documents.where(outgoing: false).order('created_at desc')\n @outgoing = @documents.where(outgoing: true).order('created_at desc')\n end\n\n respond_to do |format|\n format.html\n format.xlsx {\n render xlsx: \"index\", filename: \"documents_spreadsheet.xlsx\"\n }\n end\n end", "def scan_expression(text, options)\n starting = ending = nil\n\n start_every_regex = /^(start(?:s|ing)?)\\s(.*)(\\s(?:every|each|\\bon\\b|repeat)(?:s|ing)?)(.*)/i\n every_start_regex = /^(every|each|\\bon\\b|repeat(?:the)?)\\s(.*)(\\s(?:start)(?:s|ing)?)(.*)/i\n start_ending_regex = /^(start(?:s|ing)?)\\s(.*)(\\s(?:\\bend|until)(?:s|ing)?)(.*)/i\n if text =~ start_every_regex\n starting = text.match(start_every_regex)[2].strip\n text = text.match(start_every_regex)[4].strip\n event, ending = process_for_ending(text)\n elsif text =~ every_start_regex\n event = text.match(every_start_regex)[2].strip\n text = text.match(every_start_regex)[4].strip\n starting, ending = process_for_ending(text)\n elsif text =~ start_ending_regex\n starting = text.match(start_ending_regex)[2].strip\n ending = text.match(start_ending_regex)[4].strip\n event = 'day'\n else\n event, ending = process_for_ending(text)\n end\n\n # they gave a phrase so if we can't interpret then we need to raise an error\n if starting\n Tickle.dwrite(\"starting: #{starting}\")\n @start = chronic_parse(pre_filter(starting))\n if @start\n @start.to_time\n else\n raise(InvalidDateExpression,\"the starting date expression \\\"#{starting}\\\" could not be interpretted\")\n end\n else\n @start = options[:start].to_time rescue nil\n end\n\n if ending\n @until = chronic_parse(pre_filter(ending))\n if @until\n @until.to_time\n else\n raise(InvalidDateExpression,\"the ending date expression \\\"#{ending}\\\" could not be interpretted\")\n end\n else\n @until = options[:until].to_time rescue nil\n end\n\n @next = nil\n\n return event\n end", "def search_search_text\n query\n .where(localized_search_text_in(:title), text: \"%#{search_text}%\")\n .or(query.where(localized_search_text_in(:description), text: \"%#{search_text}%\"))\n end", "def search_time_sheet_events(options={})\n days = {}\n method = 'search.messages'\n max_cnt = 15\n cnt = 0\n cur_date = options[:start]\n total_hours = 0.0\n\n loop do\n entries = []\n fdate = cur_date.strftime('%Y-%m-%d')\n printf \"\\n>>> processing #{fdate}\"\n \n query = \"in:engineering from:me on:#{fdate} biab\"\n matches = self.class.get(\"/#{method}\", query: { token: @token, query: query }).tap do |response|\n printf \"v\"\n raise \"error searching for #{query} from #{method}: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end.fetch(\"messages\").fetch(\"matches\")\n\n entries.concat matches.map{|x| \n printf \".\"\n x['ts'] = DateTime.strptime(x['ts'],'%s').to_time\n {state: :off, ts: x['ts'], permalink: x['permalink'], text: x['text']}\n }\n\n query = \"in:engineering from:me on:#{fdate} brb\"\n matches = self.class.get(\"/#{method}\", query: { token: @token, query: query }).tap do |response|\n printf \"v\"\n raise \"error searching for #{query} from #{method}: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end.fetch(\"messages\").fetch(\"matches\")\n\n entries.concat matches.map{|x| \n printf \".\"\n x['ts'] = DateTime.strptime(x['ts'],'%s').to_time\n {state: :off, ts: x['ts'], permalink: x['permalink'], text: x['text']}\n }\n \n query = \"in:engineering from:me on:#{fdate} back\"\n matches = self.class.get(\"/#{method}\", query: { token: @token, query: query }).tap do |response|\n printf \"v\"\n raise \"error searching for #{query} from #{method}: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end.fetch(\"messages\").fetch(\"matches\")\n\n entries.concat matches.map{|x| \n printf \".\"\n x['ts'] = DateTime.strptime(x['ts'],'%s').to_time\n {state: :on, ts: x['ts'], permalink: x['permalink'], text: x['text']}\n }\n \n query = \"in:engineering from:me on:#{fdate} good\"\n matches = self.class.get(\"/#{method}\", query: { token: @token, query: query }).tap do |response|\n printf \"v\"\n raise \"error searching for #{query} from #{method}: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end.fetch(\"messages\").fetch(\"matches\")\n\n entries.concat matches.map{|x| \n printf \".\"\n x['ts'] = DateTime.strptime(x['ts'],'%s').to_time\n state = (x['text'] =~ /evening|night/) ? :off : :on\n {state: state, ts: x['ts'], permalink: x['permalink'], text: x['text']}\n }\n\n entries = entries.sort_by { |h| h[:ts] }\n days[fdate] = {entries: entries}\n\n start_entry = nil\n last_entry = nil\n seconds = 60*15\n total_time_for_day = 0.0\n start = nil\n entries.each do |entry|\n begin\n printf \".\"\n entry[:diff] = 0\n\n if(entry[:state] == :off)\n stop = Time.at((entry[:ts].to_f / seconds).round * seconds)\n start = nil\n entry[:ts] = stop\n next unless start_entry\n\n diff = entry[:ts] - start_entry[:ts]\n start_entry[:diff] = (diff/(60*60))\n\n total_time_for_day += start_entry[:diff]\n start_entry = nil\n else\n time = Time.at((entry[:ts].to_f / seconds).round * seconds)\n entry[:ts] = time\n\n start_entry = entry if start_entry.nil?\n end\n rescue Exception => e\n puts \"Problem with entry: #{entry.inspect}\nstart_entry: #{start_entry.inspect}\n\"\n raise e\n end\n last_entry = entry\n end\n\n if(start_entry)\n today = Time.now.strftime(\"%Y%m%d\")\n process_day = start_entry[:ts].strftime(\"%Y%m%d\")\n\n if(today == process_day)\n time = Time.at((Time.now.to_f / seconds).round * seconds)\n\n diff_work = time - start_entry[:ts]\n start_entry[:diff] = diff_work/(60*60)\n total_time_for_day += start_entry[:diff]\n \n entries << {state: :pending, ts: time, text: \"still working\"}\n\n else\n entries << {state: :off, ts: last_entry[:ts], text: \"good day/evening (you never checked out?)\"}\n end\n end\n\n if entries.length > 0\n entries[entries.length-1][:diff] = 0.0 \n days[fdate][:hours] = total_time_for_day\n total_hours += days[fdate][:hours]\n printf \"=> #{days[fdate][:hours]} for day; #{total_hours} for range\"\n end\n\n break unless(cnt > max_cnt or cur_date < options[:stop])\n\n # go to next day\n cur_date += (60*60*24)\n cnt += 1\n end\n\n days[:hours] = total_hours\n report = {report: days}\n puts \"\\n>>> DONE!\"\n report\n end", "def activity_watching_following()\n\t Activity.where('$or' => [{ :project_id => { \"$in\" => self[:watching] } }, { :project_id => { \"$in\" => repo_ids } }, {:author_id => { \"$in\" => self[:following] }}] ).all\n end", "def find_someday\n self.all(\n :completed_at => nil, \n :someday => true,\n :order => [:title])\n end", "def is_completed\n params[:search].present? ? params[:search][:status].eql?('Completed') : false\n end", "def match_eod\n @_match_eod ||= matcher('End Of Day', 'event')\n end", "def imported_events\n# ImportedEvent.new.search(summary)\n ImportedEvent.find_by_term_and_date(summary,date)\n end", "def search_status(...)\n SearchService.active_status\n end", "def upcoming_event\n @upcoming_event ||= events.where(\"start_time > ?\", Time.now).order(\"start_time ASC\").first\n end", "def index\n @events = Event.all\n\t if params[:search]\n\t\t @events = Event.where('lower(name) LIKE ? OR lower(description) LIKE ? OR lower(\"ort\") LIKE ?',\n\t\t\t \"%#{params[:search].downcase}%\", \"%#{params[:search].downcase}%\", \"%#{params[:search].downcase}%\")\n\t end\n end", "def search\n if Config[\"ISEARCH\"]\n incremental_search\n else\n str = getstr('/')\n do_search NEXT, str\n end\n end", "def search_activity\n case activity\n when \"voted\"\n query\n .includes(:votes)\n .where(decidim_opinions_opinion_votes: { decidim_author_id: @current_user })\n when \"my_opinions\"\n query\n .where.not(coauthorships_count: 0)\n .joins(:coauthorships)\n .where(decidim_coauthorships: { decidim_author_type: \"Decidim::UserBaseEntity\" })\n .where(decidim_coauthorships: { decidim_author_id: @current_user })\n else # Assume 'all'\n query\n end\n end", "def index\n @events = Event.all\n# if params[:term].present?\n# @events = Eventbrite::Event.search({q: params[:term]}).events\n# else\n# @events = Eventbrite::Event.search({q: 'Miami'}).events\n# end\n # @event = Eventbrite::Event.search({q: 'Community Service'})\n # @events = Eventbrite::Event.search({q: params[:term]}).events\n # @events = Event.all\n # @events = if params[:term]\n # Event.where('name LIKE ?', \"%#{params[:term]}%\")\n # else\n # Event.all\n # end\n\n\n # @events = if params[:term]\n # Event.where('name LIKE ?', \"%#{params[:term]}%\")\n\n\n\n\n end", "def search\n if params[:query]\n query = \"%#{params[:query].downcase}%\"\n @events = Event.where(\"lower(title) LIKE :query or lower(description) LIKE :query\", :query => query)\n end\n\n respond_to do |format|\n format.html\n format.json { render 'events/index' }\n end\n end", "def localized_search_text_in(field)\n options[:organization].available_locales.map do |l|\n \"#{field} ->> '#{l}' ILIKE :text\"\n end.join(\" OR \")\n end", "def search_events(query, version = DEFAULT_API_VERSION)\n options = {:params => {:q => query},\n :api_version => version}\n api_call(:get, 'events', options)\n end", "def upcoming_events\n events.where(\"date > ?\", Time.now)\n end", "def ongoing?\n Time.now > start_at && Time.now < end_at\n end", "def find_events(query)\n event_lookup(\"?q=#{query}\")\n end", "def find_events(query)\n event_lookup(\"?q=#{query}\")\n end", "def ongoing?\n status == 1\n end", "def search_heartbeats(text, options)\n limit = options[:limit].blank? ? nil : options[:limit].to_i\n skip = options[:skip].blank? ? nil : options[:skip].to_i\n order = options[:order].blank? ? :created_at.desc : options[:order]\n\n Record.with(collection: \"#{self.class.name.demodulize.downcase}_heartbeat\") do |m|\n criteria = m.full_text_search(text)\n criteria = criteria.order_by(order) if order\n criteria = criteria.limit(limit).skip(skip)\n\n docs = criteria.to_a\n docs\n end\n end", "def coming_due_events\n candidate_events.select(&:coming_due?)\n end", "def search_status\n if uri_term?\n :single_result\n else\n perform_search\n end\n end", "def parse_search(q)\n # TODO continue\n end", "def has_event_with_options?(name, options = {})\n event = Event.new(name, options)\n event.type = :search\n events.dup.keep_if { |e| e.match? Star.new, event }.to_a.first\n end", "def search word\n # No need to enclose the following in a EM.run block b/c TweetStream does this when \n # it initializes the client.\n puts \"entering\"\n q = last_search_query(word) \n current_search = next_search(word, q)\n #jump first one beacause of max_id including last one\n q = q.merge(current_search.next_results)\n current_search = next_search(word, q)\n puts \"#{current_search.attrs[:search_metadata]}\"\n while current_search.next_results? do\n current_search.results.each do |tweet|\n unless same_tweet(tweet)\n raw_tweet_to_tweet(tweet, word).save\n end\n end\n q = q.merge(current_search.next_results)\n current_search = next_search(word, q)\n end\n end", "def find_future_events(options={})\n formatted_start_min = encode_time(Time.now)\n query = \"?timeMin=#{formatted_start_min}#{parse_options(options)}\"\n event_lookup(query)\n end", "def upcoming_events\n [] || Event.where('event_start_date > :date AND event_end_date > :date AND status = :status', {date: Time.now.strftime('%Y-%m-%d'), status: Event.statuses.ready}).limit(3)\n end", "def search(params = {})\n @client.call(method: :get, path: 'message-events', query_values: params)\n end", "def search_note(string)\n logger.info 'Searching for a string within a note'\n search string\n end", "def list_events\n result = ''\n $events.find.each do |doc|\n result << doc['location'] + ' at ' + doc['time'] + \"\\n\"\n end\n if result.empty?\n 'The database is currently empty.'\n else\n result\n end\nend", "def found_events\n @mood.events\n end", "def upcoming_events\n events = []\n if participant?\n participant.upcoming_events.each { |e| events << e }\n else\n events << \"Pregnancy Screener\"\n end\n events\n end", "def closed_status\n closed_status_wording || 'Awarded'\n end", "def search(query, options = {}); end", "def ongoing_game\n games(game_state: \"ongoing\", role: \"player\").any? ? games(game_state: \"ongoing\", role: \"player\")[0] : false\n end", "def search(word)\n \n end", "def set_SearchOn(value)\n set_input(\"SearchOn\", value)\n end", "def set_SearchOn(value)\n set_input(\"SearchOn\", value)\n end", "def set_SearchOn(value)\n set_input(\"SearchOn\", value)\n end", "def set_SearchOn(value)\n set_input(\"SearchOn\", value)\n end", "def set_SearchOn(value)\n set_input(\"SearchOn\", value)\n end", "def user_wants_to_join?\n @data['event']['text'].downcase != 'no'\n end", "def _events_match(e1, e2)\n e1.source && e2.source && e1.source.title == e2.source.title && e1.start.date_time.to_s == e2.start.date_time.to_s\n end", "def ongoing_project_tasks\n query = user_channel_filter(ProjectTask.where(status: 'ongoing').order(started_at: :asc))\n @count = query.count\n query = query.limit(params[:limit]) if params[:limit].present?\n @project_tasks = query\n end", "def notify_new_findings\n # TODO: make the method avoid the creation of a Notification record\n end", "def index\n @events = if params[:past]\n Event.is_past\n else\n Event.is_not_past\n end\n @past = params[:past]\n end", "def search_pending\n rpc(:search_pending_all).key?(:success)\n end", "def events\n # FIXME this logic belongs in the Event model. stop leaking AR outside of the model\n @events ||= Event.includes(:upcoming_observances).where(\"observances.start_on >= ?\", Date.current).references(:observances)\n end", "def full_search\n Room.full_search(params[:search])\n .where(state: \"published\")\n .order(\"promoted ASC\")\n .page(params[:page]).per(10)\n end", "def search(*args)\n return \"No XML\" if !@ndoc\n @ndoc.search(*args)\n end", "def find_events_by_name\n\n print \"Enter name of Event you want to search for: \".blue\n user_input = gets.chomp\n\n events = EventScraperCli::Event.all.find_all {|e| e.name.downcase.match(/#{user_input.downcase}/)}\n\n question = \"Select a Event: \"\n\n chosen_event = list_events(events, question)\n\n chosen_event ? get_details(chosen_event) : return\n\n chosen_event\n end", "def unfollowed_events\n events.where(visited: false).select do |event|\n !(event.next_event? || event.choices?)\n end\n end", "def search_terms\n \"#vote #{poll_tag}\"\n end", "def is_upcoming_event?(event_id)\n current_time = Time.now\n event = Event.find(:first,:conditions => ['ends_on >? and id=?',current_time,event_id])\n if event.blank?\n return false\n else\n return true\n end\n end", "def search_callback\n # SyncEngine.dosync\n status = @params['status']\n if ( @params['project_id'] && !@params['project_id'].empty?)\n WebView.navigate( url_for :controller=>\"Story\",:action => :index,\n :query => {:count_search=>get_count_search,:iteration=>@params['iteration'],:story_id=>@params['story_id'],:project_id => @params['project_id'].gsub(/[^0-9]/, '')} )\n end\n end", "def has_event_with_options?(name, options = {})\n event = Event.new(name, options)\n event.type = :search\n events.dup.keep_if { |e| e.match? self, event }.to_a.first\n end", "def set_work_search_blog\n @event = Event.find(params[:id]) \n @event.date_range = @event.start.to_date.to_s + \" To \"+ (@event.end.to_date - 1.day).to_s \n end", "def current\n # [Steve, 20161001] We need to whitelist all parameters for the search query:\n params.permit!()\n @start_date = \"#{Date.today.prev_day(8)}\"\n @end_date = \"#{Date.today.next_month(10)}\"\n @title = if params[:text].to_s.size > 0\n I18n.t('meeting.current_title') + \" ('#{ params[:text] }', #{ Format.a_date(@start_date) } ... #{ Format.a_date(@end_date) })\"\n else\n I18n.t('meeting.current_title') + \" (#{ Format.a_date(@start_date) } ... #{ Format.a_date(@end_date) })\"\n end\n @preselected_swimmer_id = params[:swimmer_id].to_i if params[:swimmer_id]\n @preselected_team_id = params[:team_id].to_i if params[:team_id]\n\n # Calendar DAO using a costructor which selects meeting using dates\n @calendarMeetingPicker = CalendarMeetingPicker.new( @start_date, @end_date )\n @calendarDAO = @calendarMeetingPicker.pick_meetings( 'ASC', false, current_user )\n @meetings = @calendarDAO.get_paginated_meetings( params[:page] || 1 )\n\n end", "def search(project: nil, text: nil, kind: 'subject', tags: { }, page: 1, results: [])\n raise 'no project specified' unless project\n tag_query = tags.each_pair.collect{ |k, v| \"tags[#{ k }]=#{ v }\" }.join '&'\n uri = URI.parse \"https://api.zooniverse.org/projects/#{ project }/talk/search?text=#{ text }&kind=#{ kind }&#{ tag_query }&per_page=20&page=#{ page }\"\n req = Net::HTTP::Get.new uri.to_s\n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n res = http.request req\n json = JSON.parse res.body\n \n pages = (json['total'] / json['per_page'].to_f).ceil\n \n # More than 1,000 results\n if page == 1 && pages > 50\n puts \"\\n\\nThis query has #{ json['total'] } results.\"\n puts \"It could take a long time and degrade server performance.\"\n puts \"Are you really sure you want to run this query? (y/n)\"\n return unless gets.chomp =~ /y/i\n end\n \n if json['page'] < pages\n puts \"#{ json['page'] } / #{ pages }\"\n search project: project, text: text, kind: kind, tags: tags, page: page + 1, results: results + json['results']\n else\n results + json['results']\n end\nend", "def search_time_sheet_activities(options={})\n cur_date = options[:start]\n method = 'search.messages'\n entries = []\n cnt = 0\n max_cnt = 15\n\n loop do\n fdate = cur_date.strftime('%Y-%m-%d')\n printf \"\\n>>> gathering activities for #{fdate}\"\n \n query = \"in:engineering from:me on:#{fdate}\"\n matches = self.class.get(\"/#{method}\", query: { token: @token, query: query }).tap do |response|\n printf \"v\"\n raise \"error searching for #{query} from #{method}: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end.fetch(\"messages\").fetch(\"matches\")\n\n entries.concat matches.map{|x| \n printf \".\"\n x['ts'] = DateTime.strptime(x['ts'],'%s').to_time\n {ts: x['ts'], permalink: x['permalink'], text: x['text']}\n }\n\n break unless(cnt > max_cnt or cur_date < options[:stop])\n \n cur_date += (60*60*24)\n cnt += 1\n end\n\n entries = entries.sort_by { |h| h[:ts] }\n end", "def index\n if params[:field].present? && params[:keyword].present?\n @events = Event.all.where([\"#{params[:field]} like ?\", \"%#{params[:keyword]}%\"]).per_page_kaminari(params[:page]).per(params[:per])\n else\n @events = Event.all.per_page_kaminari(params[:page]).per(params[:per])\n end\n end", "def get_email_text(search_array, timeout=600, delete=true, since_sec=3600)\n # Only look for emails that have come in since the last hour\n since = Time.now - since_sec\n imap_search_terms = search_array.dup.push(\"SINCE\", since.strftime('%d-%b-%Y'))\n @log.debug(\"Searching for email with query: #{imap_search_terms}\")\n\n super imap_search_terms, timeout, delete, since_sec\n end", "def speak(holidays)\n\t\t\tp \"ho, ho, ho! Haaapy #{holidays}!\"\n\tend", "def pending_keywords\n spec_keywords('pending')\n end", "def searching?\n @searching\n end", "def live_search\n# @banco_pages, @bancos = paginate :bancos, :per_page => 10\n @ejidos = Ejido.find(:all, :order => 'ejido')\n @ejidos = Ejido.find(:all, :conditions => [\"ejido like ?\", \"%#{params[:searchtext]}%\"])\n return render(:partial => 'filtroejido', :layout => false) if request.xhr?\n end", "def index\n if params[:search]\n @events = Event.where(name: params[:search])\n else\n @events = Event.all\n end\n end", "def events_with_presence(bool)\n current_user.participations.includes(:event).where(presence: bool).map { |p| p.event }\n end", "def no_articles\n message = \"Sorry, there are no results!\"\n options = [\"Go to Search\", \"Go Back\"]\n choice = PROMPT.select(message, options)\n case options.index(choice)\n when 0\n Search.new_search\n when 1\n CLI.user_options\n end\n end", "def find_events_in_range(start_min, start_max,options = {})\n options[:max_results] ||= 25\n options[:order_by] ||= 'lastmodified' # other option is 'starttime'\n formatted_start_min = start_min.strftime(\"%Y-%m-%dT%H:%M:%S\")\n formatted_start_max = start_max.strftime(\"%Y-%m-%dT%H:%M:%S\")\n query = \"?start-min=#{formatted_start_min}&start-max=#{formatted_start_max}&recurrence-expansion-start=#{formatted_start_min}&recurrence-expansion-end=#{formatted_start_max}\"\n query = \"#{query}&orderby=#{options[:order_by]}&max-results=#{options[:max_results]}\"\n event_lookup(query)\n end", "def search_conditions_as_options\n [\n [I18n.t(\"advanced_searches.text_search_field.all_words\"), \"all_words\"],\n [I18n.t(\"advanced_searches.text_search_field.one_word\"), \"one_word\"],\n [I18n.t(\"advanced_searches.text_search_field.exact\"), \"exact\"]\n ]\n end", "def searching?\n @searching\n end", "def search(user, query, collection, wiki)\n end", "def index\n if params[:teachers]\n @events = Event.find(:all, :order => 'updated_at DESC', :conditions => {:open => true}).paginate(:page => params[:page], :per_page => 15)\n else\n @events = Event.find(:all, :order => 'scheduled_time ASC', :conditions => ['scheduled_time >= ? AND open = false', DateTime.now]).paginate(:page => params[:page], :per_page => 15)\n end\n end", "def start_stream \n @client.track(@search_terms.each {|term| print \"'#{term} ',\"}) do |status|\n count = REDIS.incr(\"#{status.created_at}\")\n # puts \"#{status.created_at}: #{status.text} #{count}\"\n end\n end", "def reservation_search_pending(limit, offset, today)\n extra_condition = \"WHERE b.status = 1 and b.date_from >= ?\"\n repository.adapter.select(query_strategy.query_reservation_search(limit, offset, extra_condition), today)\n end", "def search_params\n params.require(:event).permit(:search, :start_date, :end_date, search_by_tags: [])\n end", "def index\n @events = Event.all\n\n file_names = Dir.glob('config/*.yml')\n exist = false\n file_names.each do |file_name|\n exist = true if(file_name == 'config/settings.local.yml')\n end\n holiday(params[:start], params[:end]) if !params[:start].nil? && !params[:end].nil? && exist\n end", "def meeting_live(*args)\n options = Utils.extract_options!(args)\n meeting_list(options.merge(type: 'live'))\n end", "def awaiting_admin_events\n candidate_events.select(&:awaiting_admin?)\n end", "def search_engine_class\n EventSearch\n end", "def search(*args)\n search_internal([\"SEARCH\"], *args)\n end", "def search_time_sheet_activities(options={})\n cur_date = options[:start]\n method = 'search.messages'\n entries = []\n cnt = 0\n max_cnt = 15\n channels = (ENV['SLACK_CHANNELS'] and ENV['SLACK_CHANNELS'].split(/,/)) or ['engineering']\n\n loop do\n channels.each do |channel|\n\n fdate = cur_date.strftime('%Y-%m-%d')\n printf \"\\n>>> gathering activities for #{fdate}\"\n \n query = \"in:#{channel} from:me on:#{fdate}\"\n matches = self.class.get(\"/#{method}\", query: { token: @token, query: query }).tap do |response|\n printf \"v\"\n raise \"error searching for #{query} from #{method}: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end.fetch(\"messages\").fetch(\"matches\")\n\n entries.concat matches.map{|x| \n printf \".\"\n x['ts'] = DateTime.strptime(x['ts'],'%s').to_time\n {ts: x['ts'], permalink: x['permalink'], text: x['text']}\n }\n\n break if(cnt > max_cnt)\n cnt += 1\n end\n cur_date += (60*60*24)\n break if(cur_date > options[:stop])\n end\n\n entries = entries.sort_by { |h| h[:ts] }\n end", "def sentiment(text)\r\n return iod_request('analyzesentiment',\r\n {:text => text, :language => $sentiment_language, :apikey => $api_key})\r\nend", "def events_commissioned_at\n find_related_frbr_objects( :is_commissioned_for, :which_events?) \n end" ]
[ "0.53137773", "0.50614303", "0.49276343", "0.4882983", "0.47293347", "0.4692215", "0.46871063", "0.46795344", "0.46720463", "0.46627545", "0.4653141", "0.464491", "0.46213344", "0.4610847", "0.46057022", "0.4594052", "0.4577571", "0.45727205", "0.45484862", "0.45236498", "0.45145786", "0.45036644", "0.44048122", "0.44010955", "0.4393152", "0.43897527", "0.43893424", "0.43856043", "0.43823865", "0.43786973", "0.43743765", "0.4369339", "0.43648562", "0.43648562", "0.43485805", "0.43451545", "0.434288", "0.4335491", "0.43287954", "0.43220463", "0.43185434", "0.4305558", "0.4297131", "0.42896596", "0.42835966", "0.42832285", "0.42699808", "0.42657572", "0.42530742", "0.42456764", "0.42443216", "0.4243377", "0.42424962", "0.42424962", "0.42424962", "0.42424962", "0.42424962", "0.42378387", "0.4236859", "0.42352977", "0.42349178", "0.42235896", "0.4223467", "0.42210343", "0.42169848", "0.4216753", "0.4215174", "0.42104295", "0.42088228", "0.4199318", "0.41892195", "0.41810492", "0.4177656", "0.41748616", "0.41745153", "0.4168589", "0.41683194", "0.41676524", "0.41650987", "0.4158044", "0.41555664", "0.41539407", "0.41482285", "0.41372314", "0.4126397", "0.41234487", "0.4120715", "0.41194806", "0.41193953", "0.4106963", "0.41066614", "0.41060224", "0.41058677", "0.41044936", "0.41039553", "0.40960717", "0.40950096", "0.40930793", "0.4092884", "0.40908802", "0.40898502" ]
0.0
-1
GET /activities GET /activities.json
def index @activities = Activity.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activities\n get_call(\"1/activities.json\")\n end", "def activities(params = {})\n scope 'default'\n get('activities/', params)\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activities(options={})\n response = connection.get do |req|\n req.url \"activities\", options\n end\n return_error_or_body(response)\n end", "def recent_activities\n get(\"/user/#{@user_id}/activities/recent.json\")\n end", "def activities(options = {})\n get('/user/activities', query: options)\n end", "def recent_activities()\n get(\"/user/#{@user_id}/activities/recent.json\")\n end", "def activities(id)\n get(\"/accounts/#{id}/activities\")['activities']\n end", "def index\n @activities = Activity.all\n render json: @activities\n end", "def index(user)\n activities = []\n json = eval(RestClient.get(ENDPOINT + \"/activities?user_id=#{user}\").to_s)\n json.each do |attributes|\n activities << Activity.new(attributes)\n end\n activities\n end", "def activity(params={})\n Endpoints::Activity.new(self).get(params)\n end", "def show\n begin\n @activity = PublicActivity::Activity.all.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n return render_errors(['No activity found.'])\n end\n\n return render :json => {:status => 1, :activities => @activities}\n end", "def favorite_activities\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end", "def show\n @activity = current_user.activities.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def favorite_activities()\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end", "def show\n @activity = current_user.user_activities.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def activities_get(opts = {})\n activities_get_with_http_info(opts)\n end", "def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end", "def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end", "def frequent_activities\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end", "def frequent_activities()\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end", "def get_activities(opts = {})\n data, _status_code, _headers = get_activities_with_http_info(opts)\n return data\n end", "def index\n @activities = current_user.activities\n end", "def get_activities\n\t\tviewer = nil\n\t\tviewer = User.find_by_id(params[:user_id]) if (params.has_key?(:user_id))\n\t\t\n @activities = Activity.getActivitiesBy2(params[:category_id], params[:user_id])\n\t\t(0...@activities.length).each {|ndx| @activities[ndx].viewer = viewer}\n render :json => @activities\n end", "def show\n @activities = Activity.where('schedule_id': params[:id])\n render json: @activities.as_json\n end", "def all_activities(**args)\n params = parameters(args) do\n optional_params :user_id, :filter_id, :type, :start, :limit, :start_date, :end_date, :done\n end\n request(:get, 'activities', params)\n end", "def show\n render json: @activity\n end", "def index\n @activities = current_user.activities\n @profile = current_user.profile # Comeback too\n @categories = Category.all\n respond_to do |format|\n format.html\n format.json { render json: @activities }\n end\n end", "def activities_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.activities_get ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?\n query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?\n query_params[:'done'] = opts[:'done'] if !opts[:'done'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#activities_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end", "def get_activities_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.get_activities ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_template'] = opts[:'filter_template'] if !opts[:'filter_template'].nil?\n query_params[:'filter_name'] = opts[:'filter_name'] if !opts[:'filter_name'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'PageResourceBareActivityResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#get_activities\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @selected_user = User.find_by_id(params[:id])\n @activities = @selected_user.activities.order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activities }\n end\n end", "def index\n \t@activities = Activity.all(limit: ActivitiesController::MAX_SEARCH_RESULTS)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @activities }\n end\n end", "def activities\n @activities = if @project\n @project.activities\n else\n User.current.projects.all(:include => :time_entry_activities).map(&:time_entry_activities).flatten + TimeEntryActivity.shared.active\n end\n\n respond_to do |format|\n format.xml\n end\n end", "def activities\n add_to_query restrict_kind: 'activity'\n end", "def show\n @activity = Activity.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @activity}\n end\n end", "def user_activities(id:, **args)\n params = parameters(args) do\n optional_params :due_date, :type, :start, :limit, :done\n end\n request(:get, \"users/#{id}/activities\", params)\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def index\n if logged_in? && current_user.identity.eql?(1)\n @activities = Activity.all\n else\n not_found\n end\n end", "def index\n @activities = current_user.attending_activities\n render :index\n end", "def activity_detail(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"activities/#{id}\", params)\n end", "def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end", "def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end", "def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def fetch(activity_id)\n RubyRedtail::Query.run(\"calendar/activities/#{activity_id}\", @api_hash, \"GET\")\n end", "def activities(options)\n activities_request build_url_parameters(options).merge(detailed: true)\n end", "def get_activities(user_id, params = {})\n user_id = user_id.to_s\n validate_identifier(:user_id, user_id)\n call_myspace_api(:activities, params.dup.update(:user_id => user_id))\n end", "def index\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects'))\n @activities = @response\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}\n end\n end", "def fetch_activities(token, params)\n params.to_options!\n\n # Setup params.\n setup_params_logic = lambda do |last_request, params|\n if !last_request.blank?\n params[:occurred_since_date] = last_request\n end\n end\n\n # Parse the response.\n response_parse_logic = lambda do |response|\n content_keys = {}\n doc = Nokogiri::XML(response.body)\n\n doc.xpath(\"/activities//activity\").each do |act|\n id = act.search('id').first.inner_html\n content_keys[id] = act.to_s\n end\n content_keys\n end\n\n url = format_project_url(get_api_url('activities'), params[:project_id])\n fetch(::PivotalTracker::Activity, token, url,\n response_parse_logic, setup_params_logic, true)\n end", "def tracker_activities\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities = JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n while next_ind.positive? do\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&offset=#{next_ind}&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities += JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n end\n end", "def activity(user = nil, opts = {})\n client.get_activity(user, opts)\n end", "def activities\n\t activity_feed.activities\n\tend", "def get_activities\n @params=task_params\n @project=current_user.projects.find(@params[:project_id])\n counter=0\n @res=[]\n @project.activities.each do |p|\n if p.users.include? current_user\n @res[counter]={\n activity_id: p.id, \n name: p.name\n }\n counter+=1\n end\n end\n respond_to do |format|\n format.json {render json: @res.uniq}\n end\n end", "def show\n @activity_type = ActivityType.find(params[:id]) \n @activitypage = @activity_type.activities.page(params[:page]).per(20)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_type }\n end\n end", "def get_activity\n\t\tviewer = nil\n\t\tviewer = User.find_by_id(params[:user_id]) if (params.has_key?(:user_id))\n\t\t\n @activity = Activity.find(params[:activity_id])\n\t\t@activity.viewer = viewer if (!@activity.nil?)\n\t\t\n render :json => @activity\n end", "def get_all_activties_for_user\n\n\t@activities = Activity.all(:user_id => params[:user_id]) \n\n\t#get json format\n\tarr = Array(@activities) \n @json_format ={ 'Activities' => arr}.to_json\n\t@title = \"All Activities for ##{params[:user_id]}\"\n\t#redirect to home page\n\terb :home\nend", "def show\n render json: @day, include: [:activities]\n end", "def get_activities(user_id, params = {})\r\n user_id = user_id.to_s\r\n @context.validate_identifier(:user_id, user_id)\r\n @context.call_myspace_api(:activities, params.dup.update(:user_id => user_id))\r\n end", "def index\n @activities = @team.activities\n @activity = Activity.new(team_id: @team.id)\n end", "def show\n @my_activity = MyActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_activity }\n end\n end", "def index\n @user_activities = UserActivity.all\n end", "def index\n @user_activities = UserActivity.all\n end", "def index\n @user_activities = UserActivity.all\n end", "def list_activities\n GooglePlus::Activity.for_person(id)\n end", "def index\n render json: TeachingActivity.all\n end", "def activities\n return @activities\n end", "def show\n @recent_activity = RecentActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recent_activity }\n end\n end", "def get_project_activities(project_id_or_key, params = {})\n get(\"projects/#{project_id_or_key}/activities\", params)\n end", "def activities(params = {})\n rv = []\n try_again = true\n fetched = 0\n p = params.dup\n p[:offset] = 0\n\n while try_again do\n result = api_call(ROOT_ACTIVITIES, p)\n return nil if result.nil?\n rv += result[:results]\n\n meta = result[:meta]\n fetched += meta[:count]\n if fetched >= meta[:total]\n try_again = false\n else\n p[:offset] += meta[:count]\n end\n end\n\n rv\n end", "def activities(per_page: nil, page: nil)\n if page || per_page\n get_activities(per_page: per_page, page: page)\n else\n get_activities if @activities.empty?\n @activities.values\n end\n end", "def get_activities_by_object_type_and_id(object_type, id)\n return @client.raw(\"get\", \"/helpers/activities/#{object_type}/#{id}\")\n end", "def show\n @activity = Activity.find(params[:id])\n\n if current_user\n \t@user = current_user\n \t@user_activity = UserActivity.find_by_user_id_and_activity_id @user.id, @activity.id\n \t\n \tRails.logger.info \"#{@user_activity.inspect}\"\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def new\n @my_activity = MyActivity.new\n @all_activites = MyActivity.where(\"user_id =?\", current_user.id).order('created_at DESC').limit(10)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_activity }\n end\n end", "def activities=(value)\n @activities = value\n end", "def get_activities_by_object_type_and_id(object_type, id)\n @client.raw('get', \"/helpers/activities/#{object_type}/#{id}\")\n end", "def index\n @activities = PublicActivity::Activity.published\n\n if params[:recipient_type] and recipient_klass = params[:recipient_type].safe_constantize and r_id = params[:recipient_id] and @recipient = recipient_klass.find(r_id)\n @activities = @activities.on(@recipient)\n elsif current_user\n # This is user current feed !\n query_params = ['User', current_user.id]\n query = \"(activities.recipient_type = ? AND activities.recipient_id = ?)\"\n\n # Followed Pages\n if pages = current_user.followed_pages and pages.present?\n query += \" OR (activities.recipient_type = ? AND activities.recipient_id IN (?))\"\n query_params += [\"Page\"] + [pages.collect(&:id)]\n end\n\n @activities = @activities.where(query, *query_params)\n\n else\n head :bad_request # should not happen\n end\n\n @activities = @activities.order('updated_at DESC, created_at DESC').page(params[:page]).per(5)\n \n authorize @activities\n end", "def activities\n @persona = Persona.where(:screen_name => params[:persona_id]).first\n @activity = @persona.get_activity( params ) \n\n\t\t#setup default parameters\n\t\t#params[:targetDiv] = params.has_key? :targetDiv ? params[:targetDiv] : '#recent-activity-body'\n\t\tif !params.has_key? :targetDiv then\n\t\t\tparams[:targetDiv] = '#recent-activity-body'\n\t\tend\n\n\t\tjs :params => { :screen_name => @persona.screen_name }\n\t\trespond_to do |format| \n\t\t\tformat.html\n\t\t\tformat.js\n\t\tend\n end", "def index\n@activity = Activity.all\nend", "def index\n @current_activities = CurrentActivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @current_activities }\n end\n end", "def index\n @status_activities = StatusActivity.all\n end", "def index\n \n @activities = Activity.search(params[:search], params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @activities }\n end\n end", "def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity }\n format.json { render :json => @activity.to_json }\n end\n end", "def show\n @project = Project.find(params[:id])\n @activities = PublicActivity::Activity.order('created_at desc').where(:project_id=>@project.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def index\n @activities = @user.activities.where(\"date = ?\", requested_date(params[:date]))\n end", "def show\n @user = User.find(params[:id])\n @activities = PublicActivity::Activity.where(owner_type: \"User\", owner_id: @user.id).limit(5).order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def activities\n children('activities')\n end", "def show\n @activity = Activity.find(params[:id])\n end", "def show\n @activity_item = ActivityItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_item }\n end\n end" ]
[ "0.87229973", "0.8237991", "0.8174613", "0.8174613", "0.81609166", "0.8031665", "0.7980325", "0.79700005", "0.795089", "0.7611846", "0.7541555", "0.752615", "0.7450007", "0.74256104", "0.74131006", "0.7386156", "0.73540217", "0.7342527", "0.7318892", "0.7318892", "0.72758335", "0.7264239", "0.72252625", "0.71868676", "0.7140161", "0.7105114", "0.70855975", "0.7061582", "0.70457876", "0.70274246", "0.70241237", "0.699996", "0.69928265", "0.69911855", "0.69787055", "0.69322515", "0.6897415", "0.68827504", "0.6863454", "0.68626535", "0.68567526", "0.6855282", "0.6834092", "0.6829797", "0.6829797", "0.6827856", "0.6827856", "0.6806195", "0.6792906", "0.6785631", "0.6741421", "0.6733523", "0.6723781", "0.67163146", "0.667705", "0.6675488", "0.6672348", "0.6665041", "0.6656609", "0.6641119", "0.66347796", "0.66328305", "0.6629187", "0.6628469", "0.6628469", "0.6628469", "0.66130275", "0.6612095", "0.66060597", "0.6594897", "0.6593136", "0.65755486", "0.65620446", "0.6558849", "0.6557003", "0.6551075", "0.6549228", "0.65185976", "0.65051675", "0.6486497", "0.64606917", "0.6451818", "0.644346", "0.6439643", "0.6437731", "0.64259535", "0.64009535", "0.6394424", "0.63679665", "0.63594365", "0.63158023" ]
0.7012036
40
GET /activities/1 GET /activities/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activities\n get_call(\"1/activities.json\")\n end", "def show\n begin\n @activity = PublicActivity::Activity.all.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n return render_errors(['No activity found.'])\n end\n\n return render :json => {:status => 1, :activities => @activities}\n end", "def activities(params = {})\n scope 'default'\n get('activities/', params)\n end", "def recent_activities\n get(\"/user/#{@user_id}/activities/recent.json\")\n end", "def show\n @activity = current_user.activities.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def recent_activities()\n get(\"/user/#{@user_id}/activities/recent.json\")\n end", "def show\n @activity = current_user.user_activities.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def index\n @activities = Activity.all\n render json: @activities\n end", "def activity(params={})\n Endpoints::Activity.new(self).get(params)\n end", "def activities(id)\n get(\"/accounts/#{id}/activities\")['activities']\n end", "def show\n @activity = Activity.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @activity}\n end\n end", "def activities(options={})\n response = connection.get do |req|\n req.url \"activities\", options\n end\n return_error_or_body(response)\n end", "def show\n @activities = Activity.where('schedule_id': params[:id])\n render json: @activities.as_json\n end", "def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def index(user)\n activities = []\n json = eval(RestClient.get(ENDPOINT + \"/activities?user_id=#{user}\").to_s)\n json.each do |attributes|\n activities << Activity.new(attributes)\n end\n activities\n end", "def show\n render json: @activity\n end", "def activity_detail(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"activities/#{id}\", params)\n end", "def show\n @my_activity = MyActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_activity }\n end\n end", "def favorite_activities\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end", "def favorite_activities()\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end", "def activities(options = {})\n get('/user/activities', query: options)\n end", "def frequent_activities\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end", "def show\n @recent_activity = RecentActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recent_activity }\n end\n end", "def frequent_activities()\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end", "def show\n @selected_user = User.find_by_id(params[:id])\n @activities = @selected_user.activities.order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activities }\n end\n end", "def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end", "def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end", "def get_activity\n\t\tviewer = nil\n\t\tviewer = User.find_by_id(params[:user_id]) if (params.has_key?(:user_id))\n\t\t\n @activity = Activity.find(params[:activity_id])\n\t\t@activity.viewer = viewer if (!@activity.nil?)\n\t\t\n render :json => @activity\n end", "def show\n @activity_type = ActivityType.find(params[:id]) \n @activitypage = @activity_type.activities.page(params[:page]).per(20)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_type }\n end\n end", "def fetch(activity_id)\n RubyRedtail::Query.run(\"calendar/activities/#{activity_id}\", @api_hash, \"GET\")\n end", "def show\n @activity = Activity.find(params[:id])\n end", "def index\n @activities = current_user.activities\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def show\n @activity = Activity.find(params[:id])\n\n if current_user\n \t@user = current_user\n \t@user_activity = UserActivity.find_by_user_id_and_activity_id @user.id, @activity.id\n \t\n \tRails.logger.info \"#{@user_activity.inspect}\"\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def show\n @activity_item = ActivityItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_item }\n end\n end", "def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity }\n format.json { render :json => @activity.to_json }\n end\n end", "def show\n @project = Project.find(params[:id])\n @activities = PublicActivity::Activity.order('created_at desc').where(:project_id=>@project.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def index\n \t@activities = Activity.all(limit: ActivitiesController::MAX_SEARCH_RESULTS)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @activities }\n end\n end", "def get_activities\n\t\tviewer = nil\n\t\tviewer = User.find_by_id(params[:user_id]) if (params.has_key?(:user_id))\n\t\t\n @activities = Activity.getActivitiesBy2(params[:category_id], params[:user_id])\n\t\t(0...@activities.length).each {|ndx| @activities[ndx].viewer = viewer}\n render :json => @activities\n end", "def activity(user = nil, opts = {})\n client.get_activity(user, opts)\n end", "def index\n @activities = current_user.activities\n @profile = current_user.profile # Comeback too\n @categories = Category.all\n respond_to do |format|\n format.html\n format.json { render json: @activities }\n end\n end", "def new\n @my_activity = MyActivity.new\n @all_activites = MyActivity.where(\"user_id =?\", current_user.id).order('created_at DESC').limit(10)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_activity }\n end\n end", "def index\n if logged_in? && current_user.identity.eql?(1)\n @activities = Activity.all\n else\n not_found\n end\n end", "def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end", "def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end", "def get_activities_by_object_type_and_id(object_type, id)\n return @client.raw(\"get\", \"/helpers/activities/#{object_type}/#{id}\")\n end", "def get_activities_by_object_type_and_id(object_type, id)\n @client.raw('get', \"/helpers/activities/#{object_type}/#{id}\")\n end", "def show\n @user = User.find(params[:id])\n @activities = PublicActivity::Activity.where(owner_type: \"User\", owner_id: @user.id).limit(5).order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n render json: @day, include: [:activities]\n end", "def activities_get(opts = {})\n activities_get_with_http_info(opts)\n end", "def activities_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.activities_get ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?\n query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?\n query_params[:'done'] = opts[:'done'] if !opts[:'done'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#activities_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end", "def index\n @activities = @team.activities\n @activity = Activity.new(team_id: @team.id)\n end", "def show\n @activity=Activity.find(params[:id])\n end", "def index\n @activities = current_user.attending_activities\n render :index\n end", "def index\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects'))\n @activities = @response\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}\n end\n end", "def get_activities\n @params=task_params\n @project=current_user.projects.find(@params[:project_id])\n counter=0\n @res=[]\n @project.activities.each do |p|\n if p.users.include? current_user\n @res[counter]={\n activity_id: p.id, \n name: p.name\n }\n counter+=1\n end\n end\n respond_to do |format|\n format.json {render json: @res.uniq}\n end\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def get_activities(user_id, params = {})\n user_id = user_id.to_s\n validate_identifier(:user_id, user_id)\n call_myspace_api(:activities, params.dup.update(:user_id => user_id))\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def get_activities_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.get_activities ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_template'] = opts[:'filter_template'] if !opts[:'filter_template'].nil?\n query_params[:'filter_name'] = opts[:'filter_name'] if !opts[:'filter_name'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'PageResourceBareActivityResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#get_activities\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n@activity = Activity.all\nend", "def index\n render json: TeachingActivity.all\n end", "def activities\n @activities = if @project\n @project.activities\n else\n User.current.projects.all(:include => :time_entry_activities).map(&:time_entry_activities).flatten + TimeEntryActivity.shared.active\n end\n\n respond_to do |format|\n format.xml\n end\n end", "def show\n @work_activity = WorkActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_activity }\n end\n end", "def show\n @step_activity = StepActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step_activity }\n end\n end", "def index\n @status_activities = StatusActivity.all\n end", "def index\n @user_activities = UserActivity.all\n end", "def index\n @user_activities = UserActivity.all\n end", "def index\n @user_activities = UserActivity.all\n end", "def new\n @activity = Activity.new\n @series = get_series('activities')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end", "def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html { redirect_to activity_comments_url(@activity) }\n format.xml { render :xml => @activity.to_xml(:include => :user, :except => NB_CONFIG['api_exclude_fields']) }\n format.json { render :json => @activity.to_json(:include => :user, :except => NB_CONFIG['api_exclude_fields']) } \n end \n end", "def get_all_activties_for_user\n\n\t@activities = Activity.all(:user_id => params[:user_id]) \n\n\t#get json format\n\tarr = Array(@activities) \n @json_format ={ 'Activities' => arr}.to_json\n\t@title = \"All Activities for ##{params[:user_id]}\"\n\t#redirect to home page\n\terb :home\nend", "def all_activities(**args)\n params = parameters(args) do\n optional_params :user_id, :filter_id, :type, :start, :limit, :start_date, :end_date, :done\n end\n request(:get, 'activities', params)\n end", "def user_activities(id:, **args)\n params = parameters(args) do\n optional_params :due_date, :type, :start, :limit, :done\n end\n request(:get, \"users/#{id}/activities\", params)\n end", "def get_project_activities(project_id_or_key, params = {})\n get(\"projects/#{project_id_or_key}/activities\", params)\n end", "def show\n @qa_client = QaClient.find(params[:id])\n @qa_activities = @qa_client.qa_activities\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qa_client }\n end\n end", "def index\n @current_activities = CurrentActivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @current_activities }\n end\n end", "def get_activities(user_id, params = {})\r\n user_id = user_id.to_s\r\n @context.validate_identifier(:user_id, user_id)\r\n @context.call_myspace_api(:activities, params.dup.update(:user_id => user_id))\r\n end", "def show\n @activity_tag = ActivityTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_tag }\n end\n end", "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end", "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end", "def show\n @activite = Activite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activite }\n end\n end", "def show\n @activity_event = ActivityEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_event }\n end\n end", "def index\n @activities = @user.activities.where(\"date = ?\", requested_date(params[:date]))\n end", "def activities\n @persona = Persona.where(:screen_name => params[:persona_id]).first\n @activity = @persona.get_activity( params ) \n\n\t\t#setup default parameters\n\t\t#params[:targetDiv] = params.has_key? :targetDiv ? params[:targetDiv] : '#recent-activity-body'\n\t\tif !params.has_key? :targetDiv then\n\t\t\tparams[:targetDiv] = '#recent-activity-body'\n\t\tend\n\n\t\tjs :params => { :screen_name => @persona.screen_name }\n\t\trespond_to do |format| \n\t\t\tformat.html\n\t\t\tformat.js\n\t\tend\n end", "def index\n @user = current_user\n @activities = Activity.where({processed: 1, user_id: current_user.id}).order('activity_date')\n #@new_activities = Activity.where({processed: 0, user_id: current_user.id}).order('activity_date')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @activities }\n end\n end", "def activity\n if params[:project_token]\n @project = Project.find_by_api_access_token(params[:project_token])\n if @project\n render '/projects/api/v1/activity'\n else\n render file: \"#{Rails.root}/public/404.html\", layout: false, status: :not_found\n end\n end\n end", "def fetch_activities(token, params)\n params.to_options!\n\n # Setup params.\n setup_params_logic = lambda do |last_request, params|\n if !last_request.blank?\n params[:occurred_since_date] = last_request\n end\n end\n\n # Parse the response.\n response_parse_logic = lambda do |response|\n content_keys = {}\n doc = Nokogiri::XML(response.body)\n\n doc.xpath(\"/activities//activity\").each do |act|\n id = act.search('id').first.inner_html\n content_keys[id] = act.to_s\n end\n content_keys\n end\n\n url = format_project_url(get_api_url('activities'), params[:project_id])\n fetch(::PivotalTracker::Activity, token, url,\n response_parse_logic, setup_params_logic, true)\n end" ]
[ "0.83788407", "0.83788407", "0.8096585", "0.7685623", "0.7667807", "0.76401794", "0.7609177", "0.75712854", "0.75329125", "0.74525696", "0.74308854", "0.7332175", "0.73110914", "0.72872484", "0.7285642", "0.7231286", "0.7206347", "0.7206347", "0.7189005", "0.7184855", "0.70567536", "0.70504594", "0.70471585", "0.6988338", "0.6986585", "0.6978882", "0.69616455", "0.6958397", "0.6953562", "0.69255227", "0.69255227", "0.6894177", "0.6878504", "0.6875385", "0.6857223", "0.68414325", "0.68293345", "0.68293345", "0.68293345", "0.68293345", "0.68293345", "0.68293345", "0.68293345", "0.68293345", "0.68293345", "0.68293345", "0.6816858", "0.680654", "0.6800987", "0.6798651", "0.67474514", "0.6725457", "0.67163175", "0.6711541", "0.6682631", "0.6630054", "0.6605643", "0.6605643", "0.659743", "0.6593531", "0.65813345", "0.65674776", "0.65497714", "0.6546729", "0.65377074", "0.6527479", "0.6508206", "0.6501104", "0.64950675", "0.6471984", "0.6470937", "0.647051", "0.644454", "0.64229137", "0.64218044", "0.64170927", "0.6408803", "0.6405781", "0.6394965", "0.63781375", "0.63781375", "0.63781375", "0.6372521", "0.63720435", "0.6365697", "0.63631016", "0.6354655", "0.63520426", "0.634384", "0.6338895", "0.6334911", "0.6326654", "0.6321508", "0.6321508", "0.63113666", "0.6310981", "0.6299206", "0.62961197", "0.6295181", "0.6292663", "0.6288323" ]
0.0
-1
POST /activities POST /activities.json
def create #@activity = Activity.new(activity_params) @activity = current_user.activities.build(activity_params) if @activity.save if params[:if_completed] == 'yes' flash[:success] = "发布成功!" redirect_to "/activities" else #redirect_to "/upload_activity_pic?id=#{@activity.id}" @headers = env.select {|k,v| k.start_with? 'HTTP_'} .collect {|pair| [pair[0].sub(/^HTTP_/, ''), pair[1]]} .collect {|pair| pair.join(": ") << "<br>"} .sort if @headers.to_s.downcase.include?('micromessenger') redirect_to "/upload_activity_pic_weixin?id=#{@activity.id}" else redirect_to "/upload_activity_pic?id=#{@activity.id}" end end else redirect_to '/activities/new' end # respond_to do |format| # if @activity.save # format.html { redirect_to @activity, notice: 'Activity was successfully created.' } # format.json { render :show, status: :created, location: @activity } # else # format.html { render :new } # format.json { render json: @activity.errors, status: :unprocessable_entity } # end # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @activity = @user.activities.create(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Exercise event was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n flash[:success] = 'Activity was successfully created.'\n format.html { redirect_to activities_path }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n @activity[:user_id] = current_user.id\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activities_path, notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n activity_params = params.require(:activity).permit(:title, :body,\n tags_attributes:\n [:category_id])\n @activity = Activity.create(activity_params)\n current_user.activities << @activity\n respond_to do |format|\n format.html\n format.json { render json: @activity }\n end\n end", "def create\n # byebug\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to root_path, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.create activity_params\n status = @activity.new_record? ? 400 : 201\n if @activity.recurrence\n render json: @activity.activity_factory.activities.as_json, status:status\n else\n respond_with @activity, status:status\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n @activity.user = current_user\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activities_path, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n Activity.for_user(current_user).active.each do |a|\n a.end = Time.now\n a.save\n end\n\n @activity = Activity.new(params.permit(:description))\n @activity.user = current_user\n @activity.start = Time.now\n @activity.save!\n\n render json: @activity\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = current_user.activities.new(activity_params)\n @activity.name = params[:name]\n @activity.date = Date.civil(params[:date][:year].to_i, params[:date][:month].to_i, params[:date][:day].to_i)\n @activity.duration = params[:activity][:hour] + ':' + params[:activity][:minute] + ':' + params[:activity][:second]\n \n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if current_user\n if params[:format] == \"json\"\n @activity = current_user.activities.new_from_json(params)\n if params[:activity][:auto_title] == true\n @activity.auto_title!\n end\n else\n @activity = current_user.activities.new(params[:activity])\n end\n else\n @activity = Activity.new(params[:activity])\n end\n respond_to do |format|\n if @activity.save\n format.html { redirect_to(@activity, :notice => 'Activity was successfully created.') }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n format.json { render :json => @activity.to_json, :status => :created, :location => @activity }\n else\n logger.info @activity.errors.inspect\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n format.json { render :json => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n data = reload(get_series('activities'), str(Date.strptime(params[:activity].values.join(\"-\"))))\n saved = false\n get_series('activities').each do |s|\n puts \"Updating series=#{s}\"\n data[s].each do |day|\n @activity = for_date(day['dateTime'])\n @activity.send(s.partition('/')[2] + '=', day['value'])\n saved = @activity.save\n if not saved\n flash[:error] = @activity.errors\n end\n end\n end\n\n respond_to do |format|\n flash[:success] = 'Activity was successfully created.'\n format.html { redirect_to @activity }\n format.json { render json: @activity, status: :created, location: @activity }\n end\n end", "def create_activity(**args)\n params = parameters(args) do\n required_params :subject, :type\n optional_params :subject, :type, :done, :due_date, :due_time, :duration, :user_id, :deal_id, :person_id, :participants, :org_id, :note\n end\n request(:post, 'activities', params)\n end", "def create\n @activity = PublicActivity::Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:events].nil?\n else\n params[:events].each do |e|\n if Activity.exists?(uuid: params[:events][e][:id])\n @activity = Activity.find_by uuid: params[:events][e][:id]\n @activity.update({\n start_time: params[:events][e][:start].in_time_zone,\n end_time: params[:events][e][:end].in_time_zone,\n })\n next\n else\n @activity = Activity.new({\n start_time: params[:events][e][:start].in_time_zone,\n end_time: params[:events][e][:end].in_time_zone,\n uuid: params[:events][e][:id],\n name: params[:events][e][:name],\n place: params[:events][e][:google_id],\n schedule_id: params[:schedule_id]\n })\n\n @activity.save\n end\n end\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n @activity.user = current_user\n @activity.organization = current_user.organization\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activity_path(@activity), notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.js { render partial: 'activity', locals: {activities: [@activity], is_filted: false} }\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.js { render partial: 'activity', notice: @activity.errors }\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize Activity\n @activity = Activity.new(params[:activity])\n @activity.user = current_visitor\n\n if params[:update_material_properties]\n # set the material_properties tags\n @activity.material_property_list = (params[:material_properties] || [])\n end\n\n if params[:update_cohorts]\n # set the cohorts\n @activity.set_cohorts_by_id(params[:cohort_ids] || [])\n end\n\n if params[:update_grade_levels]\n # set the grade_level tags\n @activity.grade_level_list = (params[:grade_levels] || [])\n end\n\n if params[:update_subject_areas]\n # set the subject_area tags\n @activity.subject_area_list = (params[:subject_areas] || [])\n end\n\n respond_to do |format|\n if @activity.save\n format.js # render the js file\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to(@activity) }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to [@course, @learning_unit, @activity], notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \tRails.logger.info params\n @activity = Activity.new(params[:activity])\n @activity.user = current_user\n\n if params.has_key?('hidden-activity') and params['hidden-activity'].has_key?('tag_list')\n \t@activity.tag_list = params['hidden-activity'][:tag_list]\n end\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n # Delete images post invalidation\n @activity.activity_images.map(&:destroy)\n @activity.activity_images = []\n ActivitiesController::MAX_IMAGES.times { @activity.activity_images.build }\n\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dev_activity = current_user.dev_activities.create(dev_activity_params)\n\n respond_to do |format|\n if @dev_activity.save\n format.html { redirect_to user_dev_activities_path(current_user), notice: 'The Development Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dev_activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @dev_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n activity_contents = params[:activity][:activity_contents]\n params = activity_params\n @activity = Activity.new(starter_id: current_user_id,\n activity_date: params[:activity_date],\n activity_end_time: params[:activity_end_time],\n place: params[:place],\n content: params[:content],\n activity_type_id: params[:activity_type_id],\n status: params[:status])\n\n\n respond_to do |format|\n if @activity.validate\n @activity.save\n ActivityParticipant.create(user_id: current_user_id,\n activity_id: @activity.id,\n identity: 1)\n activity_contents = JSON.parse(activity_contents)\n activity_contents.each do |content|\n ActivityContent.create(activity_id: @activity.id,\n sport_option: content[\"sport_option\"],\n quantity: content[\"quantity\"])\n\n end\n format.html {redirect_to @activity, notice: 'Activity was successfully created.'}\n format.json {render :show, status: :created, location: @activity}\n starter = @activity.starter\n starter.follower.each do |user|\n MessageChannel.broadcast_to(user, {type: 1, count: 1, msg: {\n title: \"<i class='fas fa-plus-circle'></i> New Poster from #{starter.user_name}\",\n text: 'A new poster has been posted', type: 'info'}})\n end\n format.js {render 'users/create_activity'}\n\n else\n #format.js {render json: {status: 2}}\n # unless @activity.activity_date.nil?\n # @activity.activity_date = @activity.activity_date.strftime('%m/%d/%Y %H:%M')\n # end\n format.html {render :new}\n format.json {render json: @activity.errors, status: :unprocessable_entity}\n format.js {render layout: false, content_type: 'text/javascript'}\n end\n end\n end", "def activities\n get_call(\"1/activities.json\")\n end", "def create\n save_status = false\n\n if (nil == params[:id])\n ruby_date = Activity.new(params.require(:activity).permit(:date)).date\n @activity = @user.activities.find_by(params.require(:activity).permit(:item_id).merge({:date => ruby_date}))\n\n if (nil != @activity)\n save_status = @activity.update(params.require(:activity).permit(:amount))\n else\n @activity = Activity.new(params.require(:activity).permit(:amount, :item_id, :date))\n @activity.user = @user\n save_status = @activity.save\n end\n else\n @activity = @user.activities.find_by({:id => params[:id]})\n save_status = @activity.update(params.require(:activity).permit(:amount))\n end\n\n respond_to do |format|\n if (nil == @activity)\n format.json { render json: {}, status: :unauthorized }\n elsif (true == save_status)\n format.json { render :show, status: :created }\n else\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if current_user\n @activity = Activity.new(activity_params)\n @activity.user_id = current_user.id\n\n respond_to do |format|\n if @activity.save\n\n # add owner to going to activity\n Goingtoactivity.create(user_id: @activity.user_id, activity_id: @activity.id)\n\n format.json { render :show, status: :created, location: @activity }\n else\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.json { render :json => {:success=>false, :message=>\"Something's wrong with the token. current_user is nil.\"} }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n respond_to do |format|\n if @activity.save\n #Guardamos todos los objectivos\n params[:objectives].split(\",\").each do |objective|\n puts objective\n obj = Objective.create(description: objective, is_done: false)\n @activity.objectives << obj\n end\n #Guardamos al usuario correspondiente\n params[:users].each do |user_id|\n ActivitiesUser.create(activity_id: @activity.id, user_id: user_id)\n \n end\n @plan = Plan.find(params[:plan_id])\n @plan.activities << @activity\n format.html { redirect_to planslink_path(@activity.plan.family_group.id), notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @title = Title.find(activity_params[:title_id])\n @event = Event.find(@title[:event_id])\n @activity = Activity.new(activity_params)\n @title.activities << @activity\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to \"/events/#{@event.id}\", notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def create\n @user_activity = UserActivity.new(user_activity_params)\n\n respond_to do |format|\n if @user_activity.save\n format.html { redirect_to @user_activity, notice: 'User activity was successfully created.' }\n format.json { render :show, status: :created, location: @user_activity }\n else\n format.html { render :new }\n format.json { render json: @user_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @status_activity = StatusActivity.new(status_activity_params)\n\n respond_to do |format|\n if @status_activity.save\n format.html { redirect_to @status_activity, notice: 'Status activity was successfully created.' }\n format.json { render :show, status: :created, location: @status_activity }\n else\n format.html { render :new }\n format.json { render json: @status_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @breadcrumb = 'create'\n @activity = Activity.new(params[:activity])\n @activity.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: crud_notice('created', @activity) }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = @activity_type.activity_class.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activities_path(@activity_type.table_name, @activity), notice: \"#{@activity_type.name.humanize} was successfully created.\" }\n format.json { render :show, status: :created, location: @activity }\n format.js { render :create }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n format.js { render :new }\n end\n end\n end", "def create\n @my_activity = MyActivity.new(params[:my_activity])\n\n respond_to do |format|\n if @my_activity.save\n @all_activites = MyActivity.where(\"user_id =?\", current_user.id).order('created_at DESC').limit(10)\n #format.html { redirect_to @my_activity, notice: 'My activity was successfully created.' }\n #format.json { render json: @my_activity, status: :created, location: @my_activity }\n format.html {redirect_to new_my_activity_path}\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @my_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n if @activity.save\n redirect_to activities_path\n else\n render 'new'\n end\n\n end", "def create\n\t\tdestId = params[:destination_id]\n\t\tdestination = Destination.find_by_id(destId)\n\t\titinerary = Itinerary.create({tags: itinerary_params[:tags].split(\" \")})\n\t\ta = activity_params.first\n\t\tactivity = itinerary.activities.create({title: a[:title], tip: a[:tip], location: a[:location], photo: a[:photo], highlight: a[:highlight]})\n\t\trespond_with itinerary\n\tend", "def create\n @activity = Activity.new(activity_params.merge(user_id: current_user.id))\n # render text: params\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activities_url, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: activities_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_activity = UserActivity.new(user_activity_params)\n @user_activity.user_id = current_user.try(:id)\n \n respond_to do |format|\n if @user_activity.save\n format.html { redirect_to @user_activity, notice: \"User activity was successfully created.\" }\n format.json { render :show, status: :created, location: @user_activity }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @user_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = current_user.activities.new(activity_params)\n @activity.supplier_id = current_user.id\n #@activity.status = Activity::SETTING if @activity.activity_type.is_show?\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to edit_activity_path(@activity), notice: 'Activity was successfully created.' }\n format.json { render action: 'edit', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @type_activity = TypeActivity.new(type_activity_params)\n\n respond_to do |format|\n if @type_activity.save\n format.html { redirect_to @type_activity, notice: 'Type activity was successfully created.' }\n format.json { render :show, status: :created, location: @type_activity }\n else\n format.html { render :new }\n format.json { render json: @type_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n @activity.user = current_user\n @activity.organization = current_user.organization\n @activity.date = change_date_format(params[:activity][:date]) if !(params[:activity][:date]).blank?\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activity_path(@activity), notice: 'Data was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.require(:activity).permit(:name, :user_id, :location, :time, :nrofpeopleinvited, :description)\n end", "def activity_params\n params.require(:activity).permit(:description, :is_done, :observations, :activity_type, :deadline)\n end", "def create\n @app = App.find(params[:app_id])\n @activity = @app.activities.build(params[:activity])\n @activity.state = Activity::STATE_DEVELOPMENT\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n format.html do\n if request.xhr?\n render :partial => 'shared/activity_row', :collection => @app.activities, :as => 'activity'\n else\n redirect_to app_activity_path(@app, @activity)\n end\n end\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html do\n @base_versions = ['1_1_0']\n \n if request.xhr?\n render :partial => 'new', :locals => {:activity => @activity, :app => @app}, :status => :unprocessable_entity\n else\n render :action => \"new\"\n end\n end\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @activities = Activity.all\n render json: @activities\n end", "def create\n @step_activity = StepActivity.new(params[:step_activity])\n\n respond_to do |format|\n if @step_activity.save\n format.html { redirect_to @step_activity, notice: 'Step activity was successfully created.' }\n format.json { render json: @step_activity, status: :created, location: @step_activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @step_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to [:phone, @activity], notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to(@activity, :notice => 'Activity was successfully created.') }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @activity_item = ActivityItem.new(params[:activity_item])\n\n respond_to do |format|\n if @activity_item.save\n format.html { redirect_to @activity_item, notice: 'Activity item was successfully created.' }\n format.json { render json: @activity_item, status: :created, location: @activity_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = I18n.t('activities.controller.Successfully_created')\n format.html { redirect_to(@activity) }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @recent_activity = RecentActivity.new(params[:recent_activity])\n\n respond_to do |format|\n if @recent_activity.save\n format.html { redirect_to @recent_activity, notice: 'Recent activity was successfully created.' }\n format.json { render json: @recent_activity, status: :created, location: @recent_activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recent_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_activity = UserActivity.new(user_activity_params)\n\n respond_to do |format|\n if @user_activity.save\n format.html { redirect_to customer_path(@user_activity.customer_id), notice: 'User activity was successfully created.' }\n format.json { render :show, status: :created, location: @user_activity }\n else\n format.html { render :new }\n format.json { render json: @user_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_activity\n device_id = request.headers['device_id']\n string = request.body.read\n activity = ActiveSupport::JSON.decode(string)\n a_ids = []\n if !activity.empty?\n begin\n activity.each do |a|\n if a['user_id'].nil?\n a['device_id'] = device_id\n end\n id = a['event_id']\n a.delete('event_id')\n logger.info\"=====#{a}\"\n UserActivity.create(a)\n a_ids << id\n end\n rescue Exception => e\n logger.info \"===Exception in creating usage #{e}\"\n # @error = \"#{e.message} for #{e.try(:record).try(:class).try(:name)}\"\n end\n respond_to do |format|\n format.json { render json: a_ids }\n end\n end\n\nend", "def create\n @activity = Activity.new(params[:activity])\n @attcategories = Attcategory.all\n \n @activity.duration = params[:activity_hours].to_i * 60\n @activity.duration += params[:activity_minutes].to_i\n \n @activity.user = current_user\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to :action => :change_actattributes, :id => @activity }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_activity_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.create_activity ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'activity_resource'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'ActivityResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#create_activity\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def activities(params = {})\n scope 'default'\n get('activities/', params)\n end", "def create_activity\n player = Player.find_or_create_by(email:req_params[:email])\n project = Project.find_by(name:req_params[:project])\n event = req_params[:event]\n count = req_params[:count]\n @activity = Activity.get_activity_type(player,event,project,count)\n\n end", "def activities=(value)\n @activities = value\n end", "def add_activity\n @activity = Activity.new({\n :user => User.find_by_id(params[:user_id]), \n :name => params[:activity][:name], \n :description => params[:activity][:description],\n :category => Category.find_by_id(params[:activity][:category]),\n\t\t\t:location => params[:activity][:location]\n #:loc_x => params[:activity][:loc_x], \n #:loc_y => params[:activity][:loc_y])\n\t\t})\n\n if @activity.save\n\t\t\t\tputs params[:activity].inspect\n\t\t\t\t@activity.add_photo(params[:user_id], params[:activity][:photo_url])\n\t\t\t\trender :json=>@activity\n else\n render :text=>'There was an error saving the activity.', :status=>:service_unavailable\n end\n end", "def add_activity(activity)\n act = activity.as_json\n write_feed.add_activity(act)\n end", "def create\n @activity_participant = Activity::Participant.new(activity_participant_params)\n @activity_participant.user = current_user\n @activity_participant.activity = Activity.find_by_id(params[:activity_id])\n\n respond_to do |format|\n if @activity_participant.save\n format.html { redirect_to activity_participants_url, notice: \"Participant was successfully created.\" }\n format.json { render :show, status: :created, location: @activity_participant }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @activity_participant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n @activity.team = @team\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to team_activities_path(@team), notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n @activities = @team.activities\n iwantmodal\n should_modal_be_open\n format.html { render action: 'index' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity_type = ActivityType.new(params[:activity_type])\n\n respond_to do |format|\n if @activity_type.save\n format.html { redirect_to @activity_type, notice: 'Activity type was successfully created.' }\n format.json { render json: @activity_type, status: :created, location: @activity_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n\t\tauthorize! :create, @activity\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to(activities_url) }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n # TODO: Need to move this logic to Model ??\n # Get max activity number\n current_activity_number = Activity.maximum(:activity_id, :conditions => [\"issue_id = ?\", activity_params[:issue_id]])\n\n # Set next activity number\n if current_activity_number\n next_activity_number = current_activity_number + 1\n else\n next_activity_number = 1\n end\n @activity.activity_id = next_activity_number\n\n # Convert blank into zero\n @activity.hours = 0 if @activity.hours.blank?\n @activity.minutes = 0 if @activity.minutes.blank?\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project_activity = ProjectActivity.new(project_activity_params)\n\n respond_to do |format|\n if @project_activity.save\n format.html { redirect_to @project_activity, notice: 'Project activity was successfully created.' }\n format.json { render :show, status: :created, location: @project_activity }\n else\n format.html { render :new }\n format.json { render json: @project_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def index(user)\n activities = []\n json = eval(RestClient.get(ENDPOINT + \"/activities?user_id=#{user}\").to_s)\n json.each do |attributes|\n activities << Activity.new(attributes)\n end\n activities\n end", "def activity_params\n params.fetch(:activity, {}).permit(\n :name,\n :start,\n :duration,\n :activity_type_id\n )\n end", "def create_activity(activity)\n create_or_update(activity, nil,\n 'activity', 'activities')\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n \n\n else\n# format.html { render :new }\n format.html { redirect_to \"/activities/qyer\", notice: @activity.errors }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.require(:activity).permit(:name, :deal_id, :team_id, :person_id, :organization_id, :type_id, :note, :date, :time, :length, :user_id, :done)\n end", "def activities(options={})\n response = connection.get do |req|\n req.url \"activities\", options\n end\n return_error_or_body(response)\n end", "def activities_params\n params.require(:activity).permit(:action, :trackable)\n end", "def republish\n json = JSON.parse(request.body.read)\n begin\n @external_activity = ActivityRuntimeAPI.republish(json)\n head :created, :location => @external_activity\n rescue StandardError => e\n json_error(e)\n end\n end", "def create\n # @activity = Activity.new(activity_params)\n @activity = @group.activities.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n # format.html { redirect_to @group, notice: 'Activity was successfully created.' }\n format.html { redirect_to [@group, @activity], notice: 'Activity was successfully updated.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end", "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end", "def new\n @activity = Activity.new\n @series = get_series('activities')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end", "def activity_params\n params.require(:activity).permit(:reference, :name, :user_id, :start_time, :end_time, :sport, :owner, :entry, :is_proxy)\n end", "def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n if @activity.is_achievement\n format.html { redirect_to :action => 'index' }\n else\n format.html { redirect_to :action => 'plan_chart' }\n end\n format.html { redirect_to :action => :plan_chart }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n ap = activity_params\n if !ap[:points].nil?\n doc = Nokogiri::XML(ap[:points].read)\n parse_gpx(doc,ap)\n end\n @activity = Activity.new(ap)\n @activity.owner_id = current_user.id\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.require(:activity).permit(:name, :description, :location, :start, :end, :deadline, :reminder_at, :subgroup_division_enabled, :no_response_action)\n end", "def create\n # Obtain user information by searching for username\n @user = User.find_by_username(params[:username])\n @activity = @user.activities.new(activity_params)\n if @activity.save\n flash[:success] = \"Activity Successfully Added!\"\n redirect_to calendar_path(@user.username)\n else\n render 'new'\n end\n end", "def create\n\n @activity = Activity.new(activity_params)\n\n\n @activity.date = convert_date_to_i(params[:date])\n @activity.time_from = get_time_from\n @activity.time_to = get_time_to\n\n respond_to do |format|\n if @activity.save\n\n format.html { redirect_to new_lambing_path }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.require(:activity).permit(:title, :started_at, :stopped_at, :applied_at, :number_limit, :pay_type, :province, :city, :district, :location, :approval, :condition)\n end", "def activity_params\n params.require(:activity).permit(:name, :date, :points, :place_id, :sport_id, :owner_id)\n end", "def create\n @goal = current_user.goals.build(goal_params)\n\n # iterate throught dates\n puts goal_params[:start_date]\n puts goal_params[:duration]\n\n if goal_params[:start_date] != \"\" && goal_params[:duration] != \"\"\n start_date = Date.parse(goal_params[:start_date])\n end_date = start_date + goal_params[:duration].to_i - 1\n\n start_date.upto(end_date) do |date|\n @goal.activities.build({done: false, due_date: date})\n end\n end\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to goals_path, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.require(:activity).permit(:exercise_type_id, :exercise_unit_id, :intensity_id, :date, :num_units)\n end", "def create\n @activities_list = ActivitiesList.new(activities_list_params)\n\n respond_to do |format|\n if @activities_list.save\n format.html { redirect_to @activities_list, notice: 'Activities list was successfully created.' }\n format.json { render :show, status: :created, location: @activities_list }\n else\n format.html { render :new }\n format.json { render json: @activities_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity_type = ActivityType.new (activity_type_params)\n \n respond_to do |format|\n if @activity_type.save\n format.html { redirect_to @activity_type, notice: 'activity_type was successfully created.' }\n format.json { render :show, status: :created, location: @activity_type }\n else\n format.html { render :new }\n format.json { render json: @activity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work_activity = WorkActivity.new(params[:work_activity])\n\n respond_to do |format|\n if @work_activity.save\n format.html { redirect_to @work_activity, notice: 'Work activity was successfully created.' }\n format.json { render json: @work_activity, status: :created, location: @work_activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @opportunity = Opportunity.new(opportunity_params)\n @opportunity.organisation = @organisation\n\n unless opportunity_params[:new_activity].blank?\n activity = Activity.find_by_title(opportunity_params[:new_activity])\n if activity.nil?\n activity = Activity.new(:title => opportunity_params[:new_activity])\n activity.save\n end\n @opportunity.activity = activity\n end\n\n unless opportunity_params[:new_sub_activity].blank?\n sub_activity = @opportunity.activity.sub_activities.find_by_title(opportunity_params[:new_sub_activity])\n if sub_activity.nil?\n sub_activity = @opportunity.activity.sub_activities.new(:title => opportunity_params[:new_sub_activity])\n sub_activity.save\n end\n @opportunity.sub_activity = sub_activity\n end\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n format.json { render :show, status: :created, location: @opportunity }\n else\n @activities = Activity.all\n @sub_activities = []\n format.html { render :new }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_activity(activity)\n self.activities << activity\n end", "def activity_params\n params.require(:activity).permit(:content, :start, :title, :title_id)\n end", "def activity(params={})\n Endpoints::Activity.new(self).get(params)\n end", "def create\n @course = Course.find(params[:course_id])\n @activity = @course.activities.build(params[:activity])\n @participants = @activity.participants.collect\n @activity.participants = []\n respond_to do |format|\n if @activity.save\n save_participants\n format.html { redirect_to( course_path(params[:course_id]), :notice => 'Lista de presença salva com sucesso') }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n @javascript_hash = @course.participants_as_javascript_hash\n 80.times { @activity.participants.build }\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.7249106", "0.70048165", "0.6964346", "0.6956599", "0.69475126", "0.6929332", "0.69046366", "0.6889496", "0.6862793", "0.68420047", "0.6838635", "0.68081975", "0.68079776", "0.68079776", "0.6798919", "0.677082", "0.6740217", "0.67014927", "0.6675203", "0.6665923", "0.6659741", "0.66497296", "0.66260356", "0.66255397", "0.6625307", "0.6618906", "0.6608279", "0.6597215", "0.6572306", "0.6548478", "0.6545597", "0.654504", "0.6531478", "0.6531478", "0.6525069", "0.65126884", "0.64865255", "0.6478666", "0.6473505", "0.64526296", "0.64259535", "0.6421336", "0.64114636", "0.6405053", "0.63795096", "0.6373347", "0.63450116", "0.6337208", "0.6336257", "0.63160855", "0.631069", "0.63106066", "0.6306154", "0.62985283", "0.6296367", "0.6275596", "0.6270746", "0.6268673", "0.62586695", "0.6258483", "0.62326264", "0.6231441", "0.62267804", "0.62261266", "0.6221256", "0.6197047", "0.61817104", "0.61811554", "0.61788964", "0.61750215", "0.6166878", "0.6164684", "0.61633086", "0.61566573", "0.6117561", "0.610921", "0.6105447", "0.6104091", "0.60982573", "0.60947186", "0.60938215", "0.60938215", "0.60757643", "0.60684997", "0.6066601", "0.60618585", "0.6033479", "0.6031145", "0.6029268", "0.60185343", "0.6017789", "0.6012027", "0.60031873", "0.59959805", "0.59913605", "0.59872144", "0.59859747", "0.59781975", "0.59690434", "0.596817", "0.59595513" ]
0.0
-1
PATCH/PUT /activities/1 PATCH/PUT /activities/1.json
def update respond_to do |format| if @activity.update(activity_params) format.html { redirect_to @activity, notice: 'Activity was successfully updated.' } format.json { render :show, status: :ok, location: @activity } else format.html { render :edit } format.json { render json: @activity.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n @activity.status = Activity::SETTED if @activity.setting?\n if @activity.update(activity_params)\n format.html { redirect_to activities_url, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # make sure that user have access to activity else raise execption\n current_user.user_activities.find(params[:id])\n \n # re query from database beacuse user_activities call have joins operation that make the record readony\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to activity_path(@activity), notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:success] = 'Activity was successfully updated.'\n format.html { redirect_to activities_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to current_user, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to activities_path, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # only the owner can edit his / her activity\n if current_user.id == @activity.user_id\n respond_to do |format|\n if @activity.update(activity_params)\n format.json { render :json => {:success=>true, :message=>\"Activity was successfully updated.\"} }\n else\n format.json { render :json => {:success=>false, :message=>\"Something went wrong. Could not update activity.\"} }\n end\n end\n else\n respond_to do |format|\n format.json { render :json => {:success=>false, :message=>\"You are not the owner of this activity.\"} }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to activities_path, notice: 'Exercise event was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to project_activity_url(@project, @activity), notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n \n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to activities_path }\n format.xml { render :nothing => true }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors.to_xml }\n end\n end\n end", "def update\n @activity = Activity.where(:user_id => current_user.id).find(params[:id])\n\n respond_to do |format|\n if params[:activity][:force_update]\n \n params[:activity][:force_update] = nil\n @activity.completed = params[:activity][:completed]\n \n if @activity.save(:validate => false)\n flash[:success] = \"Activity updated\"\n format.html { redirect_to(request.env[\"HTTP_REFERER\"]) }\n format.xml { head :ok }\n end\n \n elsif @activity.update_attributes(params[:activity])\n flash[:success] = \"Activity updated\"\n \n format.js { render :text => 'OK' }\n format.html { redirect_to( activities_path , :success => 'Activity updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.js { render :text => 'KO' }\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n format.json { render :json => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @activity.nil?\n send_error_json( @activity.id, \"Param 'activity' missing\", 400)\n return\n end\n\n fav = true\n if params['activity'].nil? || params['activity']['favourite'].nil? || params['activity']['favourite']=='false'\n fav = false\n end\n update_hash = {:favourite => fav}\n\n if params['activity'] && params['activity']['intensity']\n update_hash[:intensity] = params['activity']['intensity'].to_f\n end\n\n if params['activity'] && params['activity']['group']\n update_hash[:group] = params['activity']['group']\n end\n\n if params['activity'] && params['activity']['name']\n at = ActivityType.where(name: params['activity']['name']).first\n if !at.nil?\n update_hash[:activity_type_id] = at.id\n else\n send_error_json(@activity.id, \"Invalid activity type\", 400)\n return\n end\n end\n\n if @activity.update_attributes(update_hash)\n send_success_json(@activity.id)\n else\n send_error_json(@activity.id, @activity.errors.full_messages.to_sentence, 400)\n end\n\n end", "def update\n @breadcrumb = 'update'\n @activity = Activity.find(params[:id])\n @activity.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity,\n notice: (crud_notice('updated', @activity) + \"#{undo_link(@activity)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n #remove all existed contents first\n @activity.activity_contents.destroy_all\n activity_contents = JSON.parse(params[:activity][:activity_contents])\n activity_contents.each do |content|\n ActivityContent.create(activity_id: @activity.id,\n sport_option: content[\"sport_option\"],\n quantity: content[\"quantity\"])\n end\n format.html {redirect_to @activity, notice: 'Activity was successfully updated.'}\n format.json {render :show, status: :ok, location: @activity}\n format.js {render 'users/create_activity'}\n else\n format.html {render :edit}\n format.json {render json: @activity.errors, status: :unprocessable_entity}\n format.js {render 'activities/create', layout: false, content_type: 'text/javascript'}\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to [:phone, @activity], notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_activity(id:, **args)\n params = parameters(args) do\n optional_params :subject, :type, :done, :due_date, :due_time, :duration, :user_id, :deal_id, :person_id, :participants, :org_id, :note\n end\n request(:put, \"activities/#{id}\", params)\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to [@group, @activity], notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to [@course, @learning_unit, @activity], notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # make sure that user have access to activity else raise execption\n # current_user.user_activities.find(params[:id])\n \n # re query from database beacuse user_activities call have joins operation that make the record readony\n @activity = Activity.find(params[:id])\n params[:activity][:date] = change_date_format(params[:activity][:date]) if !(params[:activity][:date]).blank?\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to activity_path(@activity), notice: 'Data was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n cancel = params[:commit] == \"Cancel\"\n @activity = Activity.find(params[:id])\n authorize @activity\n\n if params[:update_material_properties]\n # set the material_properties tags\n @activity.material_property_list = (params[:material_properties] || [])\n @activity.save\n end\n\n if params[:update_cohorts]\n # set the cohort tags\n @activity.set_cohorts_by_id(params[:cohort_ids] || [])\n @activity.save\n end\n\n if params[:update_grade_levels]\n # set the grade_level tags\n @activity.grade_level_list = (params[:grade_levels] || [])\n @activity.save\n end\n\n if params[:update_subject_areas]\n # set the subject_area tags\n @activity.subject_area_list = (params[:subject_areas] || [])\n @activity.save\n end\n\n if request.xhr?\n if cancel || @activity.update_attributes(params[:activity])\n render :partial => 'shared/activity_header', :locals => { :activity => @activity }\n else\n render :xml => @activity.errors, :status => :unprocessable_entity\n end\n else\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(@activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to activities_path(@activity_type.table_name, @activity.id), notice: \"#{@activity_type.name.humanize} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @activity }\n format.js { render :update }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n format.js { render :edit }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to(@activity, :notice => 'Activity was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @activity_type = ActivityType.find(params[:id])\n\n respond_to do |format|\n if @activity_type.update_attributes(params[:activity_type])\n format.html { redirect_to @activity_type, notice: 'Activity type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # render text: params\n respond_to do |format|\n if @activity.update(activity_params.merge(user_id: current_user.id))\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = I18n.t('activities.controller.Successfully_updated')\n format.html { redirect_to(activities_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @activity_item = ActivityItem.find(params[:id])\n\n respond_to do |format|\n if @activity_item.update_attributes(params[:activity_item])\n format.html { redirect_to @activity_item, notice: 'Activity item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \"\"\"\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:activity])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \"\"\"\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n# format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.html { redirect_to \"/activities/nanjingstart\", notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n if params.has_key?('hidden-activity') and params['hidden-activity'].has_key?('tag_list')\n \tparams[:activity][:tag_list] = params['hidden-activity'][:tag_list]\n end\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n \n if @activity.created_at < 1.day.ago\n \tauthorize! :edit, @activity\n end\n end", "def update\n respond_to do |format|\n if @status_activity.update(status_activity_params)\n format.html { redirect_to @status_activity, notice: 'Status activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @status_activity }\n else\n format.html { render :edit }\n format.json { render json: @status_activity.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 r = Reciever.where(\"name == ? \", activity_params[:reciever][:name].upcase)\n r.empty? ? @reciever = Reciever.new(name: activity_params[:reciever][:name].upcase) : @reciever = r.first\n\n respond_to do |format|\n if @activity.update(activity_params.except(:reciever))\n @reciever.save\n @reciever.activities << @activity\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_activity = MyActivity.find(params[:id])\n\n respond_to do |format|\n if @my_activity.update_attributes(params[:my_activity])\n #format.html { redirect_to @my_activity, notice: 'My activity 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: @my_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @step_activity = StepActivity.find(params[:id])\n\n respond_to do |format|\n if @step_activity.update_attributes(params[:step_activity])\n format.html { redirect_to @step_activity, notice: 'Step activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @step_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @workflow\n respond_to do |format|\n if @workflow.update(workflow_params)\n @workflow.create_activity(:update, owner: current_user) if @workflow.log_update_activity?\n format.html { redirect_to @workflow, notice: 'Workflow was successfully updated.' }\n format.json { render :show, status: :ok, location: @workflow }\n else\n format.html { render :edit }\n format.json { render json: @workflow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:app_id])\n @activity = @app.activities.find(params[:id])\n\n if params[:cancel_edit_activity_button]\n respond_to do |format|\n format.html do\n if request.xhr? \n render :partial => 'shared/activity', :locals => { :activity => @activity }\n else\n redirect_to apps_url\n end\n end\n \n format.xml { head :ok }\n end\n \n return\n end\n\n @vscm = Brazil::AppSchemaVersionControl.new(:vc_type => Brazil::AppSchemaVersionControl::TYPE_SUBVERSION, :vc_path => @app.vc_path, :vc_uri => ::AppConfig.vc_uri) \n @base_versions = @vscm.find_versions(params[:arg])\n @base_versions << Activity::NO_BASE_VERSION if @base_versions.count == 0\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html do\n if request.xhr?\n render :partial => \"shared/activity\", :locals => {:activity => @activity}\n else\n redirect_to app_activity_path(@app, @activity)\n end\n end\n format.xml { head :ok }\n else\n format.html do\n if request.xhr?\n render :action => \"edit\", :layout => false, :status => :unprocessable_entity\n else\n render :action => \"edit\"\n end\n end\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(@activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @dev_activity.update(dev_activity_params)\n format.html { redirect_to @dev_activity, notice: 'The Development Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dev_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\t\tauthorize! :update, @activity\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n redirect = group_activity_path(@group, @activity)\n redirect = edit_group_activity_path(@group, @activity) if params.key?('commit-continue')\n\n format.html do\n redirect_to redirect\n flash_message(:info, I18n.t('activities.updated'))\n end\n format.json { render :show, status: :ok, location: @activity }\n else\n set_edit_parameters!\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @activity = Activity.find(params[:id])\n @categories = Category.all\n respond_to do |format|\n format.json { render json: @activity }\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to team_activities_path(@team), notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n iwantmodal\n should_modal_be_open\n format.html { render action: 'index' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity_event = ActivityEvent.find(params[:id])\n\n respond_to do |format|\n if @activity_event.update_attributes(params[:activity_event])\n format.html { redirect_to @activity_event, notice: 'Activity event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@activity = Activity.find(params[:id])\n @activity = Activity.find_by_permalink(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to(@activity, :notice => 'Activity was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit_activity\n @activity = Activity.find(params[:id])\n end", "def update\n if @day.update(update_params)\n render json: @day, include: [:activities]\n else \n render json: @day.errors\n end\n end", "def update\n respond_to do |format|\n if @project_activity.update(project_activity_params)\n format.html { redirect_to @project_activity, notice: 'Project activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_activity }\n else\n format.html { render :edit }\n format.json { render json: @project_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @title = Title.find(activity_params[:title_id])\n @event = Event.find(@title[:event_id])\n @activity = Activity.new(activity_params)\n @title.activities << @activity\n \n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to \"/events/#{@event.id}\", notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_activities!\n _, _, host, = URI.split url\n PublicActivity::Activity.where(trackable: self).update_all(\n parameters: {\n namespace_id: namespace.id,\n namespace_name: namespace.clean_name,\n webhook_url: url,\n webhook_host: host\n }\n )\n end", "def update\n respond_to do |format|\n if @google_account_activity.update(google_account_activity_params)\n format.html { redirect_to google_account_activities_path }\n response = {status: 200}\n format.json { render json: response, status: response[:status] }\n else\n format.html { render action: 'edit' }\n format.json { render json: @google_account_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_activity.update(user_activity_params)\n format.html { redirect_to @user_activity, notice: 'User activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_activity }\n else\n format.html { render :edit }\n format.json { render json: @user_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recent_activity = RecentActivity.find(params[:id])\n\n respond_to do |format|\n if @recent_activity.update_attributes(params[:recent_activity])\n format.html { redirect_to @recent_activity, notice: 'Recent activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recent_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n for i in 0..@activity.objectives.length()-1\n objective = @activity.objectives[i]\n objective.is_done = params[:objective][i.to_s()]\n objective.save!\n end\n format.html { redirect_to planslink_path(@activity.plan.family_group.id), notice: '¡Actividad actualizada!.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n @attcategories = Attcategory.find(:all)\n \n duration = params[:activity_hours].to_i * 60\n duration += params[:activity_minutes].to_i\n \n args = params[:activity].merge!({\"duration\" => duration})\n \n # Work around - initialize attributes to zero every\n # time before filling them back in\n @activity.update_attributes(:actattribute_ids => [])\n\n respond_to do |format|\n if @activity.update_attributes(args)\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(@activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\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 @type_activity.update(type_activity_params)\n format.html { redirect_to @type_activity, notice: 'Type activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_activity }\n else\n format.html { render :edit }\n format.json { render json: @type_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n cancel = params[:commit] == \"Cancel\"\n @external_activity = ExternalActivity.find(params[:id])\n authorize @external_activity\n\n if params[:update_material_properties]\n # set the material_properties tags\n @external_activity.material_property_list = (params[:material_properties] || [])\n @external_activity.save\n end\n\n if params[:update_cohorts]\n # set the cohort tags\n @external_activity.set_cohorts_by_id(params[:cohort_ids] || [])\n @external_activity.save\n end\n\n if params[:update_grade_levels]\n # set the grade_level tags\n @external_activity.grade_level_list = (params[:grade_levels] || [])\n @external_activity.save\n end\n\n if params[:update_subject_areas]\n # set the subject_area tags\n @external_activity.subject_area_list = (params[:subject_areas] || [])\n @external_activity.save\n end\n\n if params[:update_sensors]\n # set the sensor tags\n @external_activity.sensor_list = (params[:sensors] || [])\n @external_activity.save\n end\n\n if params[:update_projects]\n # set the projects\n @external_activity.projects = Admin::Project.where(id: params[:project_ids] || [])\n @external_activity.save\n end\n\n if params[:update_external_reports]\n # set the external reports\n @external_activity.external_report_ids= (params[:external_reports] || [])\n @external_activity.save\n end\n\n respond_to do |format|\n # allow for params[:external_activity] to not exist while other update_* params to update\n if !params[:external_activity] || @external_activity.update(external_activity_strong_params(params[:external_activity]))\n flash['notice'] = 'ExternalActivity was successfully updated.'\n # redirect to browse path instead of show page since the show page is deprecated\n format.html { redirect_to(browse_external_activity_path(@external_activity)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @external_activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_activity.update(user_activity_params)\n format.html { redirect_to @user_activity, notice: \"User activity was successfully updated.\" }\n format.json { render :show, status: :ok, location: @user_activity }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @user_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity_item.update(activity_item_params)\n format.html { redirect_to @activity_item, notice: 'Activity item was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity_item }\n else\n format.html { render :edit }\n format.json { render json: @activity_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Attività aggiornata correttamente'\n format.html { redirect_to(@activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to( course_path(params[:course_id]), :notice => 'Lista de presença salva com sucesso') }\n format.html { redirect_to(@activity, :notice => 'activity was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n @activity.update_attribute(:enabled,params[:activity][:enabled])\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to([:manage, @activity]) }\n format.xml { head :ok }\n else\n format.html { render :activity => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n flash[:success] = 'Activity was successfully updated.'\n correct_execution format, :ok\n else\n error_execution format, :edit\n end\n end\n end", "def update\n respond_to do |format|\n @old_ID = @asset.id\n asset_params[:id] = nil\n #get all activities from the asset and update their asset id\n @asset_activities = @asset.asset_activities\n if @asset = Asset.create(asset_params) \n #keep track of old assetID id for current asset\n format.html { redirect_to @asset, notice: 'Asset was successfully updated.' }\n format.json { head :no_content } \n #turn off current revision\n @old_revision_id = Revision.find_by(asset_id: @old_ID)\n #create revision record\n @new_revision = Revision.new()\n #inset new revision into table\n @new_revision.old_revision_id = @old_revision_id\n @new_revision.asset_id = @asset.id\n @new_revision.save()\n #update the activity ID that pertains to the asset ID\n @asset_activities.update_all(:asset_id => @asset.id)\n\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\n\n params = opportunity_params\n\n unless params[:new_activity].blank?\n activity = Activity.find_by_title(params[:new_activity])\n if activity.nil?\n activity = Activity.new(:title => params[:new_activity])\n activity.save\n end\n params[:activity_id] = activity.id\n end\n\n unless params[:new_sub_activity].blank?\n sub_activity = @opportunity.activity.sub_activities.find_by_title(params[:new_sub_activity])\n if sub_activity.nil?\n sub_activity = @opportunity.activity.sub_activities.new(:title => params[:new_sub_activity])\n sub_activity.save\n end\n params[:sub_activity_id] = sub_activity.id\n end\n respond_to do |format|\n if @opportunity.update(params)\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully updated.' }\n format.json { render :show, status: :ok, location: @opportunity }\n else\n @activities = Activity.all\n @sub_activities = @opportunity.activity.sub_activities.order(:title)\n format.html { render :edit }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activities_list.update(activities_list_params)\n format.html { redirect_to @activities_list, notice: 'Activities list was successfully updated.' }\n format.json { render :show, status: :ok, location: @activities_list }\n else\n format.html { render :edit }\n format.json { render json: @activities_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @work_activity = WorkActivity.find(params[:id])\n\n respond_to do |format|\n if @work_activity.update_attributes(params[:work_activity])\n format.html { redirect_to @work_activity, notice: 'Work activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @idea.update(idea_params)\n @idea.create_activity :update, owner: (current_user)\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_activity_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.update_activity ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ActivitiesApi.update_activity\"\n end\n # resource path\n local_var_path = \"/activities/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'activity_resource'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'ActivityResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#update_activity\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\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!(**args)\n @activity = args[:activity] if args.key?(:activity)\n @activity_type = args[:activity_type] if args.key?(:activity_type)\n @full_resource_name = args[:full_resource_name] if args.key?(:full_resource_name)\n @observation_period = args[:observation_period] if args.key?(:observation_period)\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n if @activity.is_achievement\n format.html { redirect_to :action => 'index' }\n else\n format.html { redirect_to :action => 'plan_chart' }\n end\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @activity_tag = ActivityTag.find(params[:id])\n\n respond_to do |format|\n if @activity_tag.update_attributes(params[:activity_tag])\n format.html { redirect_to @activity_tag, notice: 'Activity tag was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @activity\n if @activity.delete\n head :no_content\n else\n head :gone\n end\n else\n head :unprocessable_entity\n end\n\n end", "def update\n respond_to do |format|\n if @workflow.update(workflow_params)\n format.json { render json: @workflow, :layout => false }\n else\n #format.json { render json: @workflow.errors, status: :unprocessable_entity, :layout => false }\n end\n end\n end", "def update\n respond_to do |format|\n if @judge_activity.update(judge_activity_params)\n format.html { redirect_to @judge_activity, notice: 'Judge activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @judge_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activite = Activite.find(params[:id])\n\n \n respond_to do |format|\n if @activite.update_attributes(params[:activite])\n format.html { redirect_to(@activite, :notice => 'Activite was successfully updated.') }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>@activite}}\n \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:question_id])\n respond_to do |format|\n if @question.update(question_params)\n @question.create_activity :update, owner: (current_user)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @act = Act.find(params[:id])\n\n respond_to do |format|\n if @act.update_attributes(params[:act])\n format.html { redirect_to acts_path, notice: 'act was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @act.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @active_launchable_activities = args[:active_launchable_activities] if args.key?(:active_launchable_activities)\n end", "def update\n if params[:commit] == \"Cancel\"\n session[:activity_draft] = nil # delete any saved draft\n redirect_to activities_url\n else\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n session[:activity_draft] = nil # delete any saved draft\n format.html do \n flash[:notice] = \"#{@class_name_titleized}: #{@activity.name} was successfully updated.\"\n if params[:commit] == \"Save and keep editing\"\n redirect_to edit_activity_url(@activity)\n else\n redirect_to activity_url(@activity)\n end\n end\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors.to_xml }\n end\n end\n end\n end", "def update\r\n @text_activity = TextActivity.find_by_id(params[:id]) \r\n\r\n attr = params[:text_activity]\r\n section_id = attr[:section_id]\r\n attr.delete(:section_id) \r\n\r\n respond_to do |format|\r\n if @text_activity.update_attributes(attr)\r\n format.html { redirect_to Section.find(section_id), notice: 'Text activity was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @text_activity.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @wait = Wait.find(params[:id])\n\n respond_to do |format|\n if @wait.update_attributes(params[:wait])\n format.json { head :no_content }\n else\n format.json { render json: @wait.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @acticle.update(acticle_params)\n format.html { redirect_to @acticle, notice: 'Acticle was successfully updated.' }\n format.json { render :show, status: :ok, location: @acticle }\n else\n format.html { render :edit }\n format.json { render json: @acticle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @supported_activities = args[:supported_activities] if args.key?(:supported_activities)\n end", "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 update\n @today_activity = TodayActivity.find(params[:id])\n\n respond_to do |format|\n if @today_activity.update_attributes(params[:today_activity])\n flash[:notice] = 'TodayActivity was successfully updated.'\n format.html { redirect_to(@today_activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @today_activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:presentacion][:activo]\n id = params[:id]\n Presentacion.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end" ]
[ "0.68841285", "0.68299145", "0.6815713", "0.6810834", "0.68061996", "0.67753994", "0.6754749", "0.6754749", "0.6754749", "0.6754749", "0.6754749", "0.66995573", "0.6663162", "0.6661705", "0.66614246", "0.66366166", "0.6602412", "0.65958416", "0.6586029", "0.6581988", "0.6573941", "0.65515125", "0.65481067", "0.65180796", "0.65005636", "0.64743036", "0.64700633", "0.6445311", "0.6413085", "0.6400687", "0.6391112", "0.63887256", "0.63587934", "0.6354183", "0.6350569", "0.63504255", "0.6344051", "0.63296473", "0.6328261", "0.6320486", "0.63184166", "0.6316373", "0.63113874", "0.6307706", "0.62937635", "0.62869686", "0.6284909", "0.6274309", "0.62333393", "0.6228477", "0.6186858", "0.6180576", "0.6175288", "0.6173333", "0.61638576", "0.6155937", "0.615413", "0.61536753", "0.6136723", "0.6134249", "0.6128315", "0.61281174", "0.6123064", "0.61181664", "0.61152136", "0.61002177", "0.60976714", "0.609737", "0.60853636", "0.6081954", "0.6076272", "0.6074062", "0.60582036", "0.60533893", "0.60317254", "0.6027926", "0.6027763", "0.6026148", "0.6018479", "0.6018173", "0.60180616", "0.6014832", "0.6005276", "0.5985968", "0.59814376", "0.59781235", "0.59772366", "0.597311", "0.5965579", "0.59654087", "0.5948313", "0.59355164", "0.5932115", "0.5926103", "0.59204555", "0.5916725", "0.59143996", "0.5898484" ]
0.6625412
17
DELETE /activities/1 DELETE /activities/1.json
def delete_activity_comment @comment = ActivityComment.find(params[:id]) @comment.destroy #flash[:success] = "Micropost deleted" #redirect_to request.referrer || root_url redirect_to "/activity_comments?id=#{@comment.activity.id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = current_user.activities.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy \n @activity = current_user.user_activities.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_path }\n format.json { head :no_content }\n end\n end", "def destroy \n @activity = current_user.user_activities.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_path }\n format.json { head :no_content }\n end\n end", "def destroy\n\n if @activity.nil?\n send_error_json(nil, \"Delete error\", 400)\n return\n end\n\n currid = @activity.id\n\n if @activity.destroy\n send_success_json(currid, {})\n else\n send_error_json(currid, \"Delete error\", 400)\n end\n end", "def destroy\n @my_activity = MyActivity.find(params[:id])\n @my_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to my_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dev_activity.destroy\n respond_to do |format|\n format.html { redirect_to dev_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = current_user.activities.find(params[:id])\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to api_activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to :back}\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to team_activities_path(@team) }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html {redirect_to activities_url, notice: 'Activity was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to phone_activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to project_activities_url(@project), notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n \n respond_to do |format|\n format.html { redirect_to activities_url }\n format.xml { render :nothing => true }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Exercise event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html do\n flash[:success] = 'Activity was successfully destroyed.'\n redirect_to activities_url\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @step_activity = StepActivity.find(params[:id])\n @step_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to step_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @current_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n if Activity.exists?(uuid: params[:id])\n @activity = Activity.find_by(uuid: params[:id])\n @activity.destroy\n end\n end", "def destroy\n @recent_activity = RecentActivity.find(params[:id])\n @recent_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to recent_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to([:manage, activities_url]) }\n format.xml { head :ok }\n end\n end", "def destroy\n @status_activity.destroy\n respond_to do |format|\n format.html { redirect_to status_activities_url, notice: 'Status activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_group_url(@group) }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_type = ActivityType.find(params[:id])\n @activity_type.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_item = ActivityItem.find(params[:id])\n @activity_item.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n activity = Activity.find(params[:id])\n activity.destroy\n redirect_to root_url\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to [@course, @learning_unit], notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n @title = Title.find(@activity[:title_id])\n @event = Event.find(@title[:event_id])\n respond_to do |format|\n format.html { redirect_to event_path(@event), notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_activity\n @activity = Activity.find(params[:id])\n @activity.destroy\n end", "def destroy\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.destroy\n format.html { redirect_to activities_url,\n notice: (crud_notice('destroyed', @activity) + \"#{undo_link(@activity)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to activities_url, alert: \"#{@activity.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def delete_activity(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:delete, \"activities/#{id}\", params)\n end", "def destroy\n @activity = Activity.find(params[:id])\n\n @activity.destroy\n\n redirect_to activities_path\n end", "def destroy\n @judge_activity.destroy\n respond_to do |format|\n format.html { redirect_to judge_activities_url }\n format.json { head :no_content }\n end\n end", "def delete_activities(**args)\n params = parameters(args) do\n required_params :ids\n optional_params :ids\n end\n request(:delete, 'activities', params)\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_path(@activity_type.table_name), notice: \"#{@activity_type.name.humanize} was successfully deleted.\" }\n format.json { head :no_content }\n format.js { render :destroy }\n end\n end", "def destroy\n #@activity = Activity.find(params[:id])\n @activity = Activity.find_by_permalink(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n\t\tauthorize! :destroy, @activity\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @type_activity.destroy\n respond_to do |format|\n format.html { redirect_to type_activities_url, notice: 'Type activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_activity(db, act_id)\n\tdb.execute(\"DELETE FROM activities WHERE id=?\", [act_id])\nend", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n\n if @activity.created_at < 1.day.ago\n \tauthorize! :edit, @activity\n end\n end", "def destroy\n @user_activity.destroy\n respond_to do |format|\n format.html { redirect_to user_activities_url, notice: \"User activity was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_activity.destroy\n respond_to do |format|\n format.html { redirect_to user_activities_url, notice: 'User activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_item.destroy\n respond_to do |format|\n format.html { redirect_to activity_items_url, notice: 'Activity item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n activity_type.destroy\n respond_to do |format|\n format.html { redirect_to activity_types_url, notice: 'activity_type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activite = Activite.find(params[:id])\n @activite.destroy\n\n respond_to do |format|\n format.html { redirect_to activites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_event = ActivityEvent.find(params[:id])\n @activity_event.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacination = Vacination.find(params[:id])\n @vacination.activity.destroy\n respond_to do |format|\n format.html { redirect_to vacinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.where(:user_id => current_user.id).find(params[:id])\n @activity.destroy\n flash[:success] = \"Activity deleted\"\n\n respond_to do |format|\n format.js { render :text => 'OK' }\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n if current_user.activity_ids.include?(params[:id].to_i)\n @activity = current_user.activities.find(params[:id])\n elsif current_user.admin?\n @activity = Activity.find(params[:id])\n else\n redirect_to root_path, :notice => \"Not authorized\"\n end\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @today_activity = TodayActivity.find(params[:id])\n @today_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(today_activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity_tag = ActivityTag.find(params[:id])\n @activity_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_tags_url }\n format.json { head :ok }\n end\n end", "def destroy\n @project_activity.destroy\n respond_to do |format|\n format.html { redirect_to project_activities_url, notice: 'Project activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html do\n redirect_to group_activities_url(@group)\n flash_message(:info, 'Activity was successfully destroyed.')\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @evactivity = Evactivity.find(params[:id])\n @evactivity.destroy\n\n respond_to do |format|\n format.html { redirect_to(evactivities_url) }\n format.xml { head :ok }\n end\n end", "def destroy_intent(base_path)\n delete_json(intent_url(base_path))\n rescue GdsApi::HTTPNotFound => e\n e\n end", "def destroy\n @activities_list.destroy\n respond_to do |format|\n format.html { redirect_to activities_lists_url, notice: 'Activities list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @spot_activity = SpotActivity.find(params[:id])\n @spot_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(spot_activities_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @activity_record.destroy\n respond_to do |format|\n format.html { redirect_to activity_records_url, notice: 'Activity record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_notice.destroy\n respond_to do |format|\n format.html { redirect_to activity_notices_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @gallery_activity = GalleryActivity.find(params[:id])\r\n @gallery_activity.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to gallery_activities_url }\r\n format.json { head :ok }\r\n end\r\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(course_path(params[:course_id])) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => :plan_chart }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity_log.destroy\n respond_to do |format|\n format.html { redirect_to activity_logs_url, notice: 'Activity log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n flash[:success] = \"Activity deleted\"\n\n format.html { redirect_to(people_url(current_user)) }\n end", "def delete_activities\n self.activities.delete_all\n end", "def destroy\r\n @text_activity = TextActivity.find(params[:id])\r\n @text_activity.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to :back }\r\n format.json { head :ok }\r\n end\r\n end", "def destroy\n @user_activity = current_user.user_activities.find_by(user_id: current_user.id)\n\n if @activity.owner_id == current_user.id\n @activity.destroy\n elsif !@user_activity.nil?\n @user_activity.destroy\n else\n render file: 'app/views/errors/forbidden_access.html', status: :unauthorized\n end\n\n respond_to do |format|\n format.html { redirect_to list_user_activities_path, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n access_denied unless current_user.is_admin? or @activity.user_id == current_user.id\n @activity.delete!\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.js {\n render :update do |page|\n page.remove 'activity_and_comments_' + @activity.id.to_s\n end \n }\n end\n end", "def destroy\n @activity_title.destroy\n respond_to do |format|\n format.html { redirect_to activity_titles_url, notice: 'Activity title was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_type_f.destroy\n respond_to do |format|\n format.html { redirect_to activity_type_fs_url, notice: 'Activity type f was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @work_activity = WorkActivity.find(params[:id])\n @work_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to work_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_kind.destroy\n respond_to do |format|\n format.html { redirect_to activity_kinds_url, notice: 'Activity kind was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n c_id = @user_activity.customer_id\n @user_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_url(c_id), notice: 'User activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activite = Activite.find(params[:id])\n @activite.destroy\n\n respond_to do |format|\n format.html { redirect_to(activites_url) }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>[]}}\n \n end\n end", "def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_category.destroy\n respond_to do |format|\n format.html { redirect_to activity_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @market_activity = MarketActivity.find(params[:id])\n @market_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to market_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activite.destroy\n respond_to do |format|\n format.html { redirect_to activites_url, notice: 'Activite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \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" ]
[ "0.7712568", "0.7712568", "0.7712568", "0.7712568", "0.7712568", "0.76978153", "0.7688336", "0.7663404", "0.7663404", "0.76458544", "0.76458544", "0.7643713", "0.7564872", "0.75457203", "0.745816", "0.73909366", "0.73904556", "0.73731923", "0.73731923", "0.73731923", "0.73731923", "0.73731923", "0.73731923", "0.73481995", "0.73416245", "0.7341086", "0.7332064", "0.73257965", "0.73257756", "0.72915006", "0.72915006", "0.72915006", "0.72915006", "0.7275883", "0.7268724", "0.72669137", "0.7246248", "0.7230373", "0.7227545", "0.7216078", "0.72103095", "0.7202828", "0.7199694", "0.7179847", "0.7143273", "0.71384317", "0.71219426", "0.7121868", "0.7121433", "0.7106636", "0.70878696", "0.70865566", "0.70853233", "0.7067567", "0.7030781", "0.70211947", "0.7012679", "0.7001932", "0.69987464", "0.69941527", "0.6985621", "0.69706845", "0.6967915", "0.6967435", "0.69258755", "0.69219923", "0.6913831", "0.6880847", "0.68805844", "0.6874126", "0.6850702", "0.68496335", "0.6841298", "0.68394154", "0.6837306", "0.6836624", "0.6833475", "0.6820451", "0.68156445", "0.68129987", "0.6808387", "0.68075055", "0.6793785", "0.6790162", "0.6773047", "0.6739487", "0.6723926", "0.6717819", "0.67053896", "0.67026925", "0.66904825", "0.66743493", "0.6669548", "0.6663775", "0.6654555", "0.6641795", "0.6631505", "0.6606946", "0.66062915", "0.66062915", "0.66062915" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_activity @activity = Activity.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 activity_params params.require(:activity).permit(:title, :description, :starttime, :endtime, :place, :number_of_people, :pay_type, :average_cost, :user_id, :tags, :apply_up_limit) 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
GET /minisounds GET /minisounds.json
def index @minisounds = Minisound.all.order("playtime") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_minisound\n @minisound = Minisound.find(params[:id])\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 update\n respond_to do |format|\n if @minisound.update(minisound_params)\n format.html { redirect_to @minisound, notice: 'Minisound was successfully updated.' }\n format.json { render :show, status: :ok, location: @minisound }\n else\n format.html { render :edit }\n format.json { render json: @minisound.errors, status: :unprocessable_entity }\n end\n end\n end", "def wines\n client = Square::Client.new(\n access_token: Figaro.env.square_api_key,\n environment: 'production'\n )\n\n result = client.catalog.list_catalog(\n types: \"ITEM\"\n )\n \n if result.success?\n wines = result.data[0].filter {|item| item[:item_data][:name].start_with?(\"20\")}\n wine_data = wines.map do |wine|\n price = wine[:item_data][:variations][0][:item_variation_data][:price_money][:amount]\n {\n \"name\": wine[:item_data][:name],\n \"price\": price\n }\n end\n render json: wine_data.to_json\n elsif result.error?\n warn result.errors\n end\n end", "def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round }\n end\n end", "def show\n @compound = Compound.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compound }\n end\n end", "def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @round }\n end\n end", "def foods_units\n get('/foods/units.json')\n end", "def minions\r\n @minions.list\r\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 @grant_round = GrantRound.find(params[:id])\n\n render json: @grant_round\n end", "def index\n @minerals = Mineral.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @minerals }\n end\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 rounds\n @title = \"My Rounds\"\n\n puts '====================== rounds'\n\n @user = User.find(params[:id])\n #@rounds = @user.rounds.where(complete: 'Y').paginate(page: params[:page], :per_page => 50)\n #@rounds = @user.rounds.paginate(page: params[:page], :per_page => 50)\n @rounds = @user.rounds\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :rounds=>@rounds.as_json(\n :include => { \n :holes => { },\n :scorecard => { },\n :event => { \n :include => { \n :course => {\n :include => {\n :facility => { :only => [:id, :facility_code, :facility_name, :address, :city, :state, :longitude, :latitude], \n :include => { \n :courses => { :only => [:id, :course_code, :facility_code, :course_name, :hol, :par] }\n }\n }\n } \n } \n }\n }\n }\n )\n } }\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 skins\n client.get \"skins/#{inst_id}/list\"\n end", "def show_rounds\n\t\t@rounds = @participant.rounds\n\t\trender json: @rounds\n\tend", "def show\n @mineral = Mineral.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mineral }\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 get_mmsparts()\n return @api.do_request(\"GET\", get_base_api_path() + \"/mms_parts\")\n end", "def get_mmsparts()\n return @api.do_request(\"GET\", get_base_api_path() + \"/mms_parts\")\n end", "def index\n @mint_coins = @coin.mint_coins\n\n @mint_coins_by_grouping = group_mint_coins(@mint_coins)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @mint_coins }\n end\n end", "def show\n @stock = Stock.find(params[:id])\n\n render json: @stock\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 index\n page_number = params[:page] ? params[:page][:number] : 1\n per_page = params[:per_page] ? params[:per_page] : 10\n\n @standings = Standing.paginate(page: page_number, per_page: per_page)\n\n render json: @standings\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 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 find_rate()\n uri_string = \"https://free.currconv.com/api/v7/convert?q=GBP_\"\\\n \"#{@currency}&compact=ultra&apiKey=2d46a9b5b650dca0dbb1\"\n uri = URI(uri_string)\n res = Net::HTTP.get_response(uri)\n return(JSON.parse(res.body)[\"GBP_#{@currency}\"]/100.0)\n end", "def show\n @ore = Ore.find(params[:id])\n @shares = []\n variation = @ore.variations.first\n total = variation.yields.sum(:quantity)\n \n variation.minerals.each do |mineral|\n y = variation.yields.detect { |y| y[:mineral_id] == mineral.id }\n share = { :mineral => mineral, :percentage => (y.quantity / total.to_f) * 100 }\n @shares << share\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ore }\n end\n end", "def get_standard_size\n standard_size = StandardSize.where(fit_type: params[:fit_type]).where(neck: params[:neck])\n if standard_size.empty?\n response = { msg: \"No Standard size found\"}\n render json: response.to_json, status: \"200\"\n else\n render json: standard_size.first.to_json, status: \"200\"\n end\n\n end", "def get_coins\n get(\"/getcoins\")\n end", "def show\n @slam = Slam.find(params[:id])\n @round1 = Round.create(round_number: 1, slam_id: @slam.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slam }\n end\n end", "def units\n @units = Item.select(\"DISTINCT unit\").where(\"unit like ?\", \"%#{params[:q]}%\").limit(20).map(&:unit)\n @units += Detail.select(\"DISTINCT unit\").where(\"unit like ?\", \"%#{params[:q]}%\").limit(20).map(&:unit)\n @units = @units.uniq\n respond_to do |format|\n format.json { render json: @units }\n end\n end", "def mens\n mens = Inventory.where(mens == true)\n render json: mens\n end", "def get_skus()\n\tputs \"Getting skus\"\n\tresponse = request_get(\"/api/sku\")\n\tputs response.body\nend", "def index\n @military_battle_rounds = Military::BattleRound.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @military_battle_rounds }\n end\n end", "def minisound_params\n params.require(:minisound).permit(:video_id, :name, :playtime)\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 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 @pots = Pot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pots }\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", "def show\n @mint_coin = @coin.mint_coins.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @mint_coin }\n end\n end", "def round(round_number)\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/round/#{round_number}\") )\n end", "def min_price\n @set[\"PriceSet\"][\"minPrice\"]\n end", "def scotch_single_malt\n puts \"Let's explore single malt Scotch whiskies\"\n #call method to list whiskies for this particular type\n list_whiskies('c/40/single-malt-scotch-whisky?filter=true&rfdata=~size.76#productlist-filter')\n end", "def scubooks\n sections = Section.all\n render json: sections\n end", "def show\n @military_battle_round = Military::BattleRound.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @military_battle_round }\n end\n end", "def index\n @shorties = Shorty.per_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorties }\n end\n end", "def show\n hub = Hub.find(params[:id])\n respond_to do |format|\n format.json { render :json => hub.warehouses }\n end\n end", "def show\n @magzine = Magzine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @magzine }\n end\n end", "def show\n @mostsmallresource = Mostsmallresource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallresource }\n end\n end", "def show\n @smallmap = Smallmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @smallmap }\n end\n end", "def userStocks\n render :json => StockPresenter.new.getStocks(current_user.id)\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 list_ingredients\n rid = params[:id]\n items = Aws.get_ingredients_from_db(rid)\n render :json => items\n end", "def show\n @fraction = Fraction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fraction }\n end\n end", "def index\n @packing_quantities = PackingQuantity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @packing_quantities }\n end\n end", "def list\n @sizes = Admin::Size.all\n\n render json: { sizes: @sizes }\n end", "def recipes # /v1/user/:id/recipes (GET)\n recipes = ::Recipe.all\n render json: recipes, :each_serializer => RecipeSmallSerializer, root: false, status: 200\n end", "def show\n @pot = Pot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pot }\n end\n end", "def playset_pricing_ajax\n card = Mtg::Card.joins(:set).includes(:statistics).active.where(\"mtg_cards.name LIKE ? AND mtg_sets.code LIKE ?\", \"#{params[:name]}\", \"#{params[:set]}\").first\n listing = card.listings.build(:condition => params[:condition], :playset => true)\n respond_to do |format|\n format.json do\n recommended_pricing = listing.product_recommended_pricing\n playset_price_low = recommended_pricing[:price_low].dollars\n playset_price_med = recommended_pricing[:price_med].dollars\n playset_price_high = recommended_pricing[:price_high].dollars\n label_low = generate_pricing_label \"Low\", recommended_pricing[:price_low].dollars\n label_med = generate_pricing_label \"Average\", recommended_pricing[:price_med].dollars\n label_high = generate_pricing_label \"High\", recommended_pricing[:price_high].dollars\n render :json => [[label_low, playset_price_low], [label_med, playset_price_med], [label_high, playset_price_high], [\"Other\", \"other\"]].to_json\n end\n end\n end", "def getmininginfo\n @api.request 'getmininginfo'\n end", "def pounds_to_kilo(pounds)\n kilograms = pounds * 0.45\n return kilograms\nend", "def getMsa\r\n census_geo, url = CensusApi.getGeoInfo(params[:lat], params[:lon])\r\n @Output = MsaMapping.getMsaByGeo(census_geo[:partialGeoId])\r\n render :json => @Output\r\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def show_close_songs\n # finds all songs tagged within a .5 mile radius\n radius = params[:rad].to_f / 1000.0\n lat = params[:lat].to_f #lat_lng_list[0].to_f\n lng = params[:lng].to_f #lat_lng_list[1].to_f\n location = [lat, lng]\n @songs = Song.near(location, radius, :units => :km)\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { render :json => @songs }\n format.mobile {render :json => @songs }\n end\n end", "def get_sizes\n @item = Item.find(params[:id])\n @sizes = @item.variants_for(:size, nil, params[:colour])\n respond_to do |format|\n format.json { render :json => @sizes }\n end\n end", "def sounds_list(params = {})\n get \"sounds\", params\n end", "def my_students(query={})\n self.simple_client.get(\"/api/v1/students?#{query.to_query}\")\n end", "def show\n @coin_set = CoinSet.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coin_set }\n end\n end", "def show\n @sundry_grn = SundryGrn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sundry_grn }\n end\n end", "def index\n\n respond_to do |format|\n format.html { @transactions = Transaction.all }\n format.json { @transactions = Transaction.where(mck_id: params[:mck_id].to_s.upcase) }\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 index\n @quantities = Quantity.search(params[:search])\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 params.require(%i[id])\n render json: Ingredient.find_by!(id: params[:id])\n end", "def show\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ministerio }\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 @wine = Wine.find(params[:id])\n @bottlings = Bottling.find_all_by_wine_id(params[:id]).sort_by! {|b| b.bottle_size[0..-3].to_i }\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wine }\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 index\n render json: { size: I18n.t(@order.pizza_in_progress.size || '?') , costs: con2curr( @order.pizza_in_progress.total ), items: reduced_pizza_items }.to_json, status: :ok\n end", "def mine(**params)\n path = File.join(plural_resource_path, \"mine\").to_s\n api_request(:get, path, params: params)\n end", "def get_skins\n response = get_siteinfo('skins')\n ret = {}\n response['query']['skins'].each do |s|\n ret[s['code']] = s['*']\n end\n ret\n end", "def get_lowest_offer_listings_for_asin(asins, condition = nil)\n params = build_list 'ASIN', asins\n params['ItemCondition'] = condition if condition\n url = products_url 'GetLowestOfferListingsForASIN', params\n\n res = Response.new connection.get url\n\n if res.valid?\n res\n else\n raise BadResponse, res.first('Error')['Message']\n end\n end", "def show\n @sin = Sin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sin }\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 get_min_rate(options={})\n post 'rates', options.merge(rate_filter: 'min_rate')\n end", "def index\n @compounds = Compound.order(:molar_mass).paginate(page: params[:page], per_page: 20)\n end", "def show\n @microposst = Microposst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microposst }\n end\n end", "def index\n @minumen = Minuman.all\n end", "def my_multis\n multis = get(\"/api/multi/mine\").body\n multis.map { |thing| object_from_body(thing) }\n end", "def ingredients_by_recipe\n recipe = Recipe.find(params[:id])\n render json: recipe.ingredients\n end", "def show\r\n @stats = Stat.all\r\n @statsu = Stat.where(calculation_id: params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @stat }\r\n end\r\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 @ministries = Ministries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ministries }\n end\n end", "def show\n @ingredients_name = IngredientsName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ingredients_name }\n end\n end", "def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round }\n end\n end", "def index\n @floor_plans = @product.floor_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @floor_plans }\n end\n end" ]
[ "0.59257907", "0.5874203", "0.56043935", "0.55121845", "0.5377079", "0.5333722", "0.53114355", "0.5257152", "0.5203881", "0.5174087", "0.5141796", "0.5122168", "0.51206994", "0.50945103", "0.5085286", "0.506236", "0.5057485", "0.503431", "0.5033928", "0.5033412", "0.5033412", "0.50283897", "0.5021467", "0.50124073", "0.49913907", "0.49813688", "0.49694002", "0.49532223", "0.4949765", "0.49395216", "0.49381313", "0.49233213", "0.4916989", "0.48924556", "0.48887298", "0.48874417", "0.48842964", "0.4878998", "0.48743153", "0.48721159", "0.4870745", "0.48563072", "0.48497927", "0.48438075", "0.4836953", "0.48261613", "0.48251238", "0.48224837", "0.48208854", "0.4811534", "0.48086923", "0.48084968", "0.4805494", "0.4801104", "0.4801104", "0.4801104", "0.4801104", "0.47980294", "0.47897345", "0.47838536", "0.47831994", "0.47825968", "0.47818974", "0.47742954", "0.47742254", "0.47718108", "0.47644997", "0.4757464", "0.4757159", "0.47559732", "0.47460285", "0.47429514", "0.47397476", "0.4738665", "0.4736671", "0.4729083", "0.47274762", "0.47268438", "0.47218364", "0.47210068", "0.4714201", "0.4702615", "0.47007906", "0.47004047", "0.4698726", "0.4694991", "0.46866995", "0.4679333", "0.46768957", "0.4676528", "0.467074", "0.46694833", "0.46620667", "0.46527827", "0.46467414", "0.4646331", "0.4639396", "0.46368557", "0.46353456", "0.46238148" ]
0.5620347
2
GET /minisounds/1 GET /minisounds/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_minisound\n @minisound = Minisound.find(params[:id])\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 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 @mineral = Mineral.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mineral }\n end\n end", "def show\n @compound = Compound.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compound }\n end\n end", "def index\n @minisounds = Minisound.all.order(\"playtime\")\n end", "def index\n @minerals = Mineral.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @minerals }\n end\n end", "def update\n respond_to do |format|\n if @minisound.update(minisound_params)\n format.html { redirect_to @minisound, notice: 'Minisound was successfully updated.' }\n format.json { render :show, status: :ok, location: @minisound }\n else\n format.html { render :edit }\n format.json { render json: @minisound.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round }\n end\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 @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ministerio }\n end\n end", "def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @round }\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", "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 @magzine = Magzine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @magzine }\n end\n end", "def show\n @mostsmallresource = Mostsmallresource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallresource }\n end\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 render json: @stock\n end", "def show\n @mint_coin = @coin.mint_coins.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @mint_coin }\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 @slam = Slam.find(params[:id])\n @round1 = Round.create(round_number: 1, slam_id: @slam.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slam }\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 @microposst = Microposst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microposst }\n end\n end", "def show\n @smallmap = Smallmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @smallmap }\n end\n end", "def show\n @grant_round = GrantRound.find(params[:id])\n\n render json: @grant_round\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 show\n @minimessage = Minimessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @minimessage }\n end\n end", "def mine(**params)\n path = File.join(plural_resource_path, \"mine\").to_s\n api_request(:get, path, params: params)\n end", "def show\n hub = Hub.find(params[:id])\n respond_to do |format|\n format.json { render :json => hub.warehouses }\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 @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 @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 @mib = Mib.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mib }\n end\n end", "def wines\n client = Square::Client.new(\n access_token: Figaro.env.square_api_key,\n environment: 'production'\n )\n\n result = client.catalog.list_catalog(\n types: \"ITEM\"\n )\n \n if result.success?\n wines = result.data[0].filter {|item| item[:item_data][:name].start_with?(\"20\")}\n wine_data = wines.map do |wine|\n price = wine[:item_data][:variations][0][:item_variation_data][:price_money][:amount]\n {\n \"name\": wine[:item_data][:name],\n \"price\": price\n }\n end\n render json: wine_data.to_json\n elsif result.error?\n warn result.errors\n end\n end", "def show\n @ministries = Ministries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ministries }\n end\n end", "def show\n @mostsmallitemequipinventory = Mostsmallitemequipinventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallitemequipinventory }\n end\n end", "def show\n @military_battle_round = Military::BattleRound.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @military_battle_round }\n end\n end", "def index\n @minumen = Minuman.all\n end", "def minions\r\n @minions.list\r\n end", "def show\n @coin_set = CoinSet.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coin_set }\n end\n end", "def index\n @mint_coins = @coin.mint_coins\n\n @mint_coins_by_grouping = group_mint_coins(@mint_coins)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @mint_coins }\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 show\n @material_quantity_label = MaterialQuantityLabel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @material_quantity_label }\n end\n end", "def skins\n client.get \"skins/#{inst_id}/list\"\n end", "def show\n @pot = Pot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pot }\n end\n end", "def index\n @shorties = Shorty.per_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorties }\n end\n end", "def show\n @mostsmallskill = Mostsmallskill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallskill }\n end\n end", "def foods_units\n get('/foods/units.json')\n end", "def show\n @sin = Sin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sin }\n end\n end", "def show\n @microplst = Microplst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microplst }\n end\n end", "def show\n @quantity = Quantity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quantity }\n end\n end", "def show\n @quantity = Quantity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quantity }\n end\n end", "def show\n params.require(%i[id])\n render json: Ingredient.find_by!(id: params[:id])\n end", "def show\n @fraction = Fraction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fraction }\n end\n end", "def show\n @stat_misc = StatMisc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stat_misc }\n end\n end", "def index\n page_number = params[:page] ? params[:page][:number] : 1\n per_page = params[:per_page] ? params[:per_page] : 10\n\n @standings = Standing.paginate(page: page_number, per_page: per_page)\n\n render json: @standings\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 mens\n mens = Inventory.where(mens == true)\n render json: mens\n end", "def show\n @mostsmalliteminfo = Mostsmalliteminfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmalliteminfo }\n end\n end", "def show\n @ore = Ore.find(params[:id])\n @shares = []\n variation = @ore.variations.first\n total = variation.yields.sum(:quantity)\n \n variation.minerals.each do |mineral|\n y = variation.yields.detect { |y| y[:mineral_id] == mineral.id }\n share = { :mineral => mineral, :percentage => (y.quantity / total.to_f) * 100 }\n @shares << share\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ore }\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 @manpack = Manpack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manpack }\n end\n end", "def index\n @military_battle_rounds = Military::BattleRound.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @military_battle_rounds }\n end\n end", "def show\n @weight = Weight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weight }\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 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 getMsa\r\n census_geo, url = CensusApi.getGeoInfo(params[:lat], params[:lon])\r\n @Output = MsaMapping.getMsaByGeo(census_geo[:partialGeoId])\r\n render :json => @Output\r\n end", "def index\n @minerals = Mineral.select(:id, :name).order(:name)\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\r\n @stats = Stat.all\r\n @statsu = Stat.where(calculation_id: params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @stat }\r\n end\r\n end", "def show\n @mostsmallitemcategory = Mostsmallitemcategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallitemcategory }\n end\n end", "def index\n @pots = Pot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pots }\n end\n end", "def find_single(scope) \n JSON[RestClient.get \"#{@site}/unit/#{scope}\", :accept=>'json'][0]\n end", "def my_multis\n multis = get(\"/api/multi/mine\").body\n multis.map { |thing| object_from_body(thing) }\n end", "def show\n @shorter = Shorter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @shorter }\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 scotch_single_malt\n puts \"Let's explore single malt Scotch whiskies\"\n #call method to list whiskies for this particular type\n list_whiskies('c/40/single-malt-scotch-whisky?filter=true&rfdata=~size.76#productlist-filter')\n end", "def show\n @wine = Wine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wine }\n end\n end", "def index\n @ministries = Ministry.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ministries }\n end\n end", "def show\n @smurf = Smurf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @smurf }\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 show\n if @power_supply.nil?\n head :not_found\n else\n render json: @power_supply.properties\n end\n end", "def show\n @packing_quantity = PackingQuantity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @packing_quantity }\n end\n end", "def get_mmsparts()\n return @api.do_request(\"GET\", get_base_api_path() + \"/mms_parts\")\n end", "def get_mmsparts()\n return @api.do_request(\"GET\", get_base_api_path() + \"/mms_parts\")\n end", "def show\n @monit = Monit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monit }\n end\n end", "def units\n @units = Item.select(\"DISTINCT unit\").where(\"unit like ?\", \"%#{params[:q]}%\").limit(20).map(&:unit)\n @units += Detail.select(\"DISTINCT unit\").where(\"unit like ?\", \"%#{params[:q]}%\").limit(20).map(&:unit)\n @units = @units.uniq\n respond_to do |format|\n format.json { render json: @units }\n end\n end", "def index\n @packing_quantities = PackingQuantity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @packing_quantities }\n end\n end", "def get_standard_size\n standard_size = StandardSize.where(fit_type: params[:fit_type]).where(neck: params[:neck])\n if standard_size.empty?\n response = { msg: \"No Standard size found\"}\n render json: response.to_json, status: \"200\"\n else\n render json: standard_size.first.to_json, status: \"200\"\n end\n\n end", "def show\n @ingredients_name = IngredientsName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ingredients_name }\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 @short_name = ShortName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @short_name }\n end\n end", "def show_rounds\n\t\t@rounds = @participant.rounds\n\t\trender json: @rounds\n\tend", "def show\n @item_unit = ItemUnit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_unit }\n end\n end", "def show\n @mall_type = MallType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mall_type }\n end\n end", "def show\n @ministerios = Ministerios.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ministerios }\n end\n end", "def show\n @mall = Mall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mall }\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" ]
[ "0.6116707", "0.6023588", "0.5854544", "0.57832056", "0.5729807", "0.5726323", "0.5709502", "0.5674683", "0.5626736", "0.5576918", "0.55713546", "0.5565534", "0.55636406", "0.5538162", "0.54892933", "0.54854983", "0.5480952", "0.54350907", "0.54334164", "0.5411297", "0.5404855", "0.5392381", "0.53781176", "0.53752404", "0.5362562", "0.53602594", "0.53302276", "0.53199536", "0.53156894", "0.53111404", "0.5309532", "0.5303899", "0.5303141", "0.52851015", "0.5279303", "0.52578586", "0.5249759", "0.5248519", "0.52412564", "0.5235278", "0.5226712", "0.5226399", "0.52168125", "0.52026236", "0.52010125", "0.51921505", "0.51896393", "0.51870906", "0.5184224", "0.51809776", "0.5180539", "0.5180539", "0.5176814", "0.51650727", "0.51591027", "0.51566", "0.51554763", "0.51554763", "0.51554763", "0.51554763", "0.515542", "0.51543266", "0.5150726", "0.51494944", "0.51415014", "0.51410764", "0.51325196", "0.5122329", "0.5119031", "0.511787", "0.51171196", "0.5115991", "0.5115871", "0.5115762", "0.51085395", "0.51019055", "0.5092411", "0.5088228", "0.50818956", "0.5080722", "0.5078503", "0.5072331", "0.5071711", "0.50712514", "0.50656605", "0.50627714", "0.5060593", "0.5060593", "0.50599843", "0.5058289", "0.50539523", "0.50523674", "0.50430936", "0.50421244", "0.504194", "0.5040881", "0.50379705", "0.50368613", "0.5027731", "0.50199765", "0.5017776" ]
0.0
-1
POST /minisounds POST /minisounds.json
def create @minisound = Minisound.new(minisound_params) respond_to do |format| if @minisound.save format.html { redirect_to @minisound, notice: 'Minisound was successfully created.' } format.json { render :show, status: :created, location: @minisound } else format.html { render :new } format.json { render json: @minisound.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n post_params = {\n name: params[:name].downcase,\n units: params[:units] || 0\n }\n render json: Ingredient.create!(post_params), status: :created\n end", "def update\n respond_to do |format|\n if @minisound.update(minisound_params)\n format.html { redirect_to @minisound, notice: 'Minisound was successfully updated.' }\n format.json { render :show, status: :ok, location: @minisound }\n else\n format.html { render :edit }\n format.json { render json: @minisound.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_minisound\n @minisound = Minisound.find(params[:id])\n end", "def compound_params\n params.require(:compound).permit(:food_id, :recipe_id, :grams)\n end", "def pmround_params\n params.require(:pmround).permit(:round)\n end", "def compound_params\n params.require(:compound).permit(:name, :molecular_formula, :molar_mass, :cas, :structure, :amount, :shelf, :room_number, :additional_info)\n end", "def minisound_params\n params.require(:minisound).permit(:video_id, :name, :playtime)\n end", "def round_params\n params.require(:round).permit(:number)\n end", "def create\n @aggregation_round = AggregationRound.new(aggregation_round_params)\n\n respond_to do |format|\n if @aggregation_round.save\n format.html { redirect_to @aggregation_round, notice: 'Aggregation round was successfully created.' }\n format.json { render :show, status: :created, location: @aggregation_round }\n else\n format.html { render :new }\n format.json { render json: @aggregation_round.errors, status: :unprocessable_entity }\n end\n end\n end", "def prescription_params\n params.require(:prescription).permit(:quantity, :unit, :observation, :hospitalization_id, :medicaments)\n end", "def round_params\n params.require(:round).permit(:commit, :title, :number_of_questions, questions_attributes: [:id, :question, :answer])\n end", "def mbracket_params\n params.require(:mbracket).permit(:name)\n end", "def create\n @compound = Compound.new(params[:compound])\n\n respond_to do |format|\n if @compound.save\n format.html { redirect_to @compound, notice: 'Compound was successfully created.' }\n format.json { render json: @compound, status: :created, location: @compound }\n else\n format.html { render action: \"new\" }\n format.json { render json: @compound.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n 'currency_code' => 'USD',\n 'amount' => 400\n }\n }\n ]\n }\n\n response = Unirest.post CONNECT_HOST + '/v1/' + LOCATION_ID + '/items',\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully created item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item creation failed'\n puts response.body\n return nil\n end\nend", "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 @round = Round.new(params[:round])\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to @round, notice: 'Round was successfully created.' }\n format.json { render json: @round, status: :created, location: @round }\n else\n format.html { render action: \"new\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @grant_round = GrantRound.new(grant_round_params(params[:grant_round]))\n\n if @grant_round.save\n render json: @grant_round, status: :created, location: @grant_round\n else\n render json: @grant_round.errors, status: :unprocessable_entity\n end\n end", "def stock_collection_params\n params.require(:stock_collection).permit(:addition_type, stocks_attributes: [:id, :product_name, :modal_number, :quantity, :purchase_price, :sale_price, :minimum_stock, :mrp, :pieces, :_destroy])\n end", "def compound_params\n params.require(:compound).permit(:result_no, :generate_no, :e_no, :last_result_no, :last_generate_no, :source_1_i_no, :source_1_name, :source_2_i_no, :source_2_name, :is_success, :compound_result_id)\n end", "def round_params\n params.require(:round).permit(:round_no, :name, :about, :turn_duration, :start_date, :vote_date, :calc_date)\n end", "def round_params\n params.require(:round).permit(:month,\n albums_attributes: [:id, :title, :band, :cover, :rdio_link, :found, :link, :link_text, :round_id, :review, :finder, :finder_photo,\n places_attributes: [:id, :teaser, :name, :link, :address, :city, :state, :description, :link_text, :album_id],\n hints_attributes: [:id, :name, :description, :photo, :thumbnail, :album_id],\n find_attributes: [:id, :user_id, :album_id, :photo]\n ])\n end", "def minnpaku_params\n params.require(:minnpaku).permit(:name, :body, :image, :price, :performance, :smoke,\n :style, :provide, :please, :review, :latitude, :longitude)\n end", "def round_params\n params.permit(:id, round:\n [:roundtype_id, :round_number, :matches, :match_number]\n )\n end", "def create\n @round = Round.new(round_params)\n \n respond_to do |format|\n if @round.save\n format.html { redirect_to @round }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end", "def recipe_ingredients_unit_params\n params.require(:recipe_ingredients_unit).permit(:ingredient_unit_name)\n end", "def create\n @mbracket = Mbracket.new(mbracket_params)\n\n respond_to do |format|\n if @mbracket.save\n format.html { redirect_to @mbracket, notice: 'Mbracket was successfully created.' }\n format.json { render :show, status: :created, location: @mbracket }\n else\n format.html { render :new }\n format.json { render json: @mbracket.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 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 create\n @minicurso = Minicurso.new(params[:minicurso])\n\n respond_to do |format|\n if @minicurso.save\n format.html { redirect_to @minicurso, notice: 'Minicurso was successfully created.' }\n format.json { render json: @minicurso, status: :created, location: @minicurso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @minicurso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @short_message = ShortMessage.new(short_message_params)\n\n client = GlobeLabs.new\n target = @short_message.target\n if target.present?\n resp = client.send_sms(@short_message)\n Rails.logger.info(\"=== savon client resp: #{resp.inspect}\")\n end\n\n recepients = params[:recepients]\n Rails.logger.info(\"==== params:#{params.inspect}\")\n if recepients.present?\n Rails.logger.info(\"==== params:#{params[:recepients].inspect}\")\n recepients.each do |cell_no|\n @short_message = ShortMessage.new(short_message_params)\n @short_message.target = cell_no\n if @short_message.save\n resp = client.send_sms(@short_message)\n Rails.logger.info(\"=== savon client resp: #{resp.inspect}\")\n end\n end\n end\n\n respond_to do |format|\n if @short_message.save\n format.html { redirect_to short_messages_path, notice: 'Short message was successfully created.' }\n format.json { render action: 'show', status: :created, location: @short_message }\n else\n format.html { render action: 'new' }\n format.json { render json: @short_message.errors, status: :unprocessable_entity }\n end\n end\n end", "def round_params\n params.require(:round).permit(:debate_id, :round_number, :start_time, :end_time, :status)\n end", "def add_ingredients\n rid = params['id']\n name = params['name']\n quant = params['quantity']\n meas = params['measurement']\n\n ingredients = {\n 'name' => name,\n 'quantity' => quant,\n 'measurement' => meas,\n }\n\n if Aws.save_ingredient_to_db(rid, ingredients)\n msg = {:notice => \"Ingredient created!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while creating ingredient!\"}\n render :json => msg\n end\n end", "def create\n @slam = Slam.new(params[:slam])\n\n respond_to do |format|\n if @slam.save\n @slam.update_attributes(master_id: current_user.id)\n @round1 = Round.create(round_number: 1, slam_id: @slam.id)\n \n format.html { redirect_to edit_round_path(@round1), notice: 'Get to it!' }\n format.json { render json: @slam, status: :created, location: @slam }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slam.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recipe = Recipe.find(params[:recipe_id])\n @food = Food.find(params[:food_id])\n @compound = Compound.new\n @compound.food = @food\n @compound.recipe_id = params[:recipe_id]\n @compound.grams = 100\n\n respond_to do |format|\n if @compound.save\n format.html { redirect_to subcategory_foods_path(@food.subcategory),\n notice: 'Compuesto añadido a la receta actual. acceda al menú para finalizar la creación de la receta.' }\n format.json { render :show, status: :created, location: @compound }\n else\n format.html { render :new }\n format.json { render json: @compound.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recipe_ingredients_unit = RecipeIngredientsUnit.new(recipe_ingredients_unit_params)\n\n respond_to do |format|\n if @recipe_ingredients_unit.save\n format.html { redirect_to recipe_ingredients_units_path, notice: 'Recipe ingredients unit was successfully created.' }\n format.json { render :show, status: :created, location: @recipe_ingredients_unit }\n else\n format.html { render :new }\n format.json { render json: @recipe_ingredients_unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pmround = Pmround.new(pmround_params)\n\n respond_to do |format|\n if @pmround.save\n format.html { redirect_to @pmround, notice: 'Pmround was successfully created.' }\n format.json { render :show, status: :created, location: @pmround }\n else\n format.html { render :new }\n format.json { render json: @pmround.errors, status: :unprocessable_entity }\n end\n end\n end", "def round_params\n params.require(:round).permit(:number, :start_time, :tournament_id,\n :notification_message)\n end", "def minut_params\n params.require(:minut).permit(:title, :body, authors_attributes: [:minut_id, :user_id])\n end", "def create\n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\n params.each do |key,value|\n if key.include? 'quantity'\n c = Commodity.find(key.split('_')[0].to_i)\n quan = value.to_i.abs\n if StockType.find(@document.stock_type_id).s_type == StockingType::SHIPPING\n quan = -quan\n end\n s = @document.stocks.create(commodity_id: c.id, quantity: quan, warehouse_id: @document.warehouse_id)\n CommodityWarehouseRelationship.update_stock(@document.warehouse_id, c.id, quan)\n end\n end\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def standard_unit_params\n params.require(:standard_unit).permit(:name)\n end", "def miniaturas_reserva_params\n params.require(:miniaturas_reserva).permit(:miniatura_id, :reserva_id, :quantidade)\n end", "def create\n @micropst = Micropst.new(micropst_params)\n\n respond_to do |format|\n if @micropst.save\n format.html { redirect_to @micropst, notice: \"Micropst was successfully created.\" }\n format.json { render :show, status: :created, location: @micropst }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @micropst.errors, status: :unprocessable_entity }\n end\n end\n end", "def shine_params\n params.require(:shine).permit(:title, :completed)\n end", "def create\n @miniaturas_reserva = MiniaturasReserva.new(miniaturas_reserva_params)\n\n respond_to do |format|\n if @miniaturas_reserva.save\n format.html { redirect_to home_index_url, notice: 'Miniaturas reserva was successfully created.' }\n format.json { render :show, status: :created, location: @miniaturas_reserva }\n else\n format.html { render :new }\n format.json { render json: @miniaturas_reserva.errors, status: :unprocessable_entity }\n end\n @reserva = Reserva.where(id: @miniaturas_reserva.reserva_id).take\n @miniatura = Miniatura.where(id: @miniaturas_reserva.miniatura_id).take\n if(@reserva != nil)\n if(@reserva.preco_total == nil)\n @preco_total = (@miniatura.preco * @miniaturas_reserva.quantidade)\n else\n @preco_total = @reserva.preco_total + (@miniatura.preco * @miniaturas_reserva.quantidade)\n end\n @reserva.update(preco_total: @preco_total)\n end\n end\n end", "def create\n @moresmallmobsquad = Moresmallmobsquad.new(params[:moresmallmobsquad])\n\n respond_to do |format|\n if @moresmallmobsquad.save\n format.html { redirect_to @moresmallmobsquad, notice: 'Moresmallmobsquad was successfully created.' }\n format.json { render json: @moresmallmobsquad, status: :created, location: @moresmallmobsquad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @moresmallmobsquad.errors, status: :unprocessable_entity }\n end\n end\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 round_params\n params.require(:round).permit(:judge_id, :status)\n end", "def ingredient_params\n params.require(:ingredient).permit(:name, :amount, :unit, :addTime)\n end", "def medicine_stock_params\n params.require(:medicine_stock).permit(:nome, :validade, :quantidade, :doenca)\n end", "def create\n @sm_volume = SmVolume.new(params[:sm_volume])\n\n respond_to do |format|\n if @sm_volume.save\n format.html { redirect_to @sm_volume, notice: 'Sm volume was successfully created.' }\n format.json { render json: @sm_volume, status: :created, location: @sm_volume }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sm_volume.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @smallsurvey = Smallsurvey.new(smallsurvey_params)\n\n respond_to do |format|\n if @smallsurvey.save\n format.html { redirect_to final_path, notice: 'Smallsurvey was successfully created.' }\n format.json { render :show, status: :created, location: @smallsurvey }\n else\n format.html { render :new }\n format.json { render json: @smallsurvey.errors, status: :unprocessable_entity }\n end\n end\n end", "def mineral_params\n params.require(:mineral).permit(:name)\n end", "def create\n @round = Round.new(round_params)\n @round.started = false\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to @round, notice: 'Round was successfully created.' }\n format.json { render action: 'show', status: :created, location: @round }\n else\n format.html { render action: 'new' }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end", "def mixture_params\n params.require(:mixture).permit(:percentage, :wine_id, :strain_id)\n end", "def create\n @round = Round.new(params[:round])\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to(@round, :notice => 'Round was successfully created.') }\n format.xml { render :xml => @round, :status => :created, :location => @round }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @round.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @round = Round.new(params[:round])\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to(@round, :notice => 'Round was successfully created.') }\n format.xml { render :xml => @round, :status => :created, :location => @round }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @round.errors, :status => :unprocessable_entity }\n end\n end\n end", "def re_in_params\n params.require(:re_in).permit(:recipe_id, :ingredient_name, :ingredient_id, :amount, :unit)\n end", "def stock_params\n params.require(:stock).permit(:name, :quantity)\n end", "def unit_params\n params.require(:unit).permit(:name, :weight, :package_dimensions)\n end", "def round_params\n params.require(:round).permit(:deck_id, :username, :score)\n end", "def round_params\n params.require(:round).permit(:date, :number, :tournament_id)\n end", "def pmprize_params\n params.require(:pmprize).permit(:amount, :name, :pmmatch_id, :pmplayer_id)\n end", "def create\n @ministries = Ministries.new(params[:ministries])\n\n respond_to do |format|\n if @ministries.save\n flash[:notice] = 'Ministries was successfully created.'\n format.html { redirect_to(@ministries) }\n format.xml { render :xml => @ministries, :status => :created, :location => @ministries }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ministries.errors, :status => :unprocessable_entity }\n end\n end\n end", "def recipe_params\n params.require(:recipe).permit(:name, :description, :quantity, :unit, parts: [:product_id, :quantity] )\n end", "def create\n @round = Round.new(round_params['round'])\n\n respond_to do |format|\n if @round.save\n @round.create_matches\n update_parents(@round)\n format.html { redirect_to @round, notice: 'Round was successfully created.' }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @round = Round.new(round_params)\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to @round.debate }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end", "def stock_params\n params.require(:stock).permit(:medId, :quantity, :price)\n end", "def create\n @round = Round.new(round_params)\n @round.save!\n notify_clients\n head :ok\n rescue\n render layout: false, status: :bad_request\n end", "def create\n @specialization_weight = SpecializationWeight.new(specialization_weight_params)\n\n respond_to do |format|\n if @specialization_weight.save\n format.html { redirect_to @specialization_weight, notice: 'Specialization weight was successfully created.' }\n format.json { render :show, status: :created, location: @specialization_weight }\n else\n format.html { render :new }\n format.json { render json: @specialization_weight.errors, status: :unprocessable_entity }\n end\n end\n end", "def round_params\n params.require(:round).permit(:judge_id)\n end", "def create\n @round = Round.new(round_params)\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to game_round_path(@game, @round), notice: 'Round was successfully started!' }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end", "def msale_params\n params.require(:msale).permit(:proforma, :customer, :nic, :address, :phone, :total, :debt, :tax)\n end", "def round_params\n params.require(:round).permit(:character, :points, :round_count, :city, :country, :river)\n end", "def stock_params\n params.require(:stock).permit(:altas, :bajas, :item_id)\n end", "def wine_params\n params.require(:wine).permit(:name, :input_region, :body, :sweetness, :sourness, :winetype_id, :year, {:winevariety_ids => []}, :score, :price, {:situation_ids => []}, :winery, :photo)\n end", "def fraction_params\n params.require(:fraction).permit(:fraction)\n end", "def multidestination_params\n params.require(:multidestination).permit(:quantity_days, :price, :banner, :featured, :position, :deleted_at, :status, multidestinationables_attributes: [:id, :status], multidestinationable_rooms_attributes: [:id, :price_cop, :price_usd, :night_price_cop, :night_price_usd],\n title: @language, subtitle: @language, description: @language, include: @language, exclude: @language, itinerary: @language)\n end", "def create\n @sundry_grn = SundryGrn.new(params[:sundry_grn])\n\n respond_to do |format|\n if @sundry_grn.save\n format.html { redirect_to @sundry_grn, :notice => 'Sundry grn was successfully created.' }\n format.json { render :json => @sundry_grn, :status => :created, :location => @sundry_grn }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sundry_grn.errors, :status => :unprocessable_entity }\n end\n end\n end", "def monument_params\n params.require(:monument).permit(:name, :address)\n end", "def inventory_stock_params\n params.require(:inventory_stock).permit(:quantity,:min_quantity,:max_quantity,:min_sale_quantity,:max_sale_quantity,:is_in_stock,:status)\n end", "def prescription_params\n params.require(:prescription).permit(:user_id, :prescribed_at, :drug_id, :quantity, :quantity)\n end", "def latstraps1_params\n params.require(:latstraps1).permit(:exercise, :reps, :sets)\n end", "def aggregation_round_params\n params.require(:aggregation_round).permit(:start_date, :end_date, :qty_limit, :product_id)\n end", "def create\n @saddness = Saddness.new(saddness_params)\n\n respond_to do |format|\n if @saddness.save\n format.html { redirect_to @saddness, notice: 'Saddness was successfully created.' }\n format.json { render :show, status: :created, location: @saddness }\n else\n format.html { render :new }\n format.json { render json: @saddness.errors, status: :unprocessable_entity }\n end\n end\n end", "def s_material_params\n params.require(:s_material).permit(:name_id, :pack, :amount, :unit_id, :min_amount, :storage_place, :comments, {s_material_files: []})\n end", "def create\n @quotation_unit = QuotationUnit.new(quotation_unit_params)\n\n respond_to do |format|\n if @quotation_unit.save\n format.html { redirect_to @quotation_unit, notice: 'Quotation unit was successfully created.' }\n format.json { render :show, status: :created, location: @quotation_unit }\n else\n format.html { render :new }\n format.json { render json: @quotation_unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @microposst = Microposst.new(params[:microposst])\n\n respond_to do |format|\n if @microposst.save\n format.html { redirect_to @microposst, notice: 'Microposst was successfully created.' }\n format.json { render json: @microposst, status: :created, location: @microposst }\n else\n format.html { render action: \"new\" }\n format.json { render json: @microposst.errors, status: :unprocessable_entity }\n end\n end\n end", "def snack_params\n params.require(:snack).permit(:name, :category, :beginning_inventory, :ending_inventory, :price, :profit, :vending_machine_id)\n end", "def round_params\n params.require(:round).permit(:name, :expiration_date, :tournament_id,\n games_attributes: [\n :id, :description, :team1,\n :team2, :start_time,\n :bet_points, :result, :_destroy\n ],\n multi_choices_attributes: [\n :id, :description, { options: [] },\n :bet_points, :result, :_destroy\n ] )\n \n end", "def specialization_weight_params\n params.require(:specialization_weight).permit(:weight, :skill_category_id, :specialization_id)\n end", "def add_snack\n response = RestClient.post SNACKS_URL, {name: @suggestion.name, location: @suggestion.location}.to_json, content_type: :json\n logger.debug \"web service response code => #{response.code}\"\n if response.code != 200\n flash[:notice] = \"Error: #{response.code} while communicating with services, please try again later.\"\n end\n parsed = JSON.parse(response) \n end", "def potassium_params\n params.require(:potassium).permit(:min, :max, :stage_id, :disease_id, :cf)\n end", "def create\n @small_group = SmallGroup.new(small_group_params)\n\n respond_to do |format|\n if @small_group.save\n format.html { redirect_to @small_group, notice: 'Small group was successfully created.' }\n format.json { render :show, status: :created, location: @small_group }\n else\n format.html { render :new }\n format.json { render json: @small_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def bonus_params\n params.require(:bonus).permit(:number, :round, :category_id, :subcategory_id, :quinterest_id, :tournament_id, :leadin)\n end", "def create\n @round = Round.new(round_params)\n\n respond_to do |format|\n if @round.save\n\n @formTemplate = FormTemplate.new(round_id: @round.id)\n @formTemplate.save\n delphiEstimation = DelphiEstimation.find_by_id(@round.delphiEstimation_id)\n project = Project.find_by_id(delphiEstimation.p_id)\n wbs = WorkBreakdownStructure.find_by p_id: project.id\n tasks = Task.where(wbs_id: wbs.id)\n tasks.each do |task|\n subtasks = Subtask.where(task_id: task.id)\n subtasks.each do |subtask|\n workpackages = Workpackage.where(subtask_id: subtask.id)\n workpackages.each do |workpackage|\n EstimationTemplate.new(form_template_id: @formTemplate.id, workpackage_id: workpackage.id, comment: '').save\n end\n end\n end\n\n format.html { redirect_to @formTemplate, notice: 'Runde wurde erfolgreich angelegt.' }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end", "def ingredient_params\n params.require(:ingredient).permit(:name, :amount, :min_amount, :amount_type, :min_amount_type, :user_id, :product_id)\n end", "def create\n @round = Round.new(params[:round])\n params[:round][:start_date] = Date.strptime(params[:round][:start_date], '%d/%m/%Y').strftime.to_s\n params[:round][:end_date] = Date.strptime(params[:round][:end_date], '%d/%m/%Y').strftime.to_s\n\n if params[:championship][:championship_id] == \"\"\n respond_to do |format|\n flash[:error] = \"Voce deve selecionar o campeonato\"\n format.html { render :action => \"new\" }\n end\n else\n @championship = Championship.find(params[:championship][:championship_id])\n @last_round4_championship = Round.find_by_championship_id(@championship.id)\n @round.championship = @championship\n num_round = (@last_round4_championship == nil)? 1 : Round.maximum(:num_round) +1\n @round.num_round = num_round\n\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to @round, :notice => 'Round was successfully created.' }\n format.json { render :json => @round, :status => :created, :location => @round }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @round.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def band_params\r\n params.require(:band).permit(:name, :genre, :description, :email,\r\n :url, :image, :songdemo1, :songdemo1_title,\r\n :songdemo2, :songdemo2_title,\r\n :zipcode, :radius)\r\n end", "def mannequin_photos\n params.require(:mannequin) #.permit(photos: [])#, :scope, :public_id, :version, :width, :height, :format, :resource_type, :created_at, :updated_at)\n end", "def round_params\n params.require(:round).permit(:game_id)\n end" ]
[ "0.58708096", "0.57429695", "0.56620675", "0.5588615", "0.55690855", "0.5510485", "0.54372364", "0.5353957", "0.5285262", "0.52763546", "0.52718407", "0.5238774", "0.52199244", "0.5215001", "0.51841223", "0.51752746", "0.51636684", "0.51521444", "0.5150232", "0.5122446", "0.51096743", "0.5105057", "0.50985265", "0.5089658", "0.5084306", "0.50839853", "0.5077715", "0.5065585", "0.50586796", "0.5022709", "0.50226265", "0.50216997", "0.5018214", "0.50122654", "0.49788257", "0.49718553", "0.49660274", "0.49537644", "0.49475226", "0.49341393", "0.4925053", "0.4920738", "0.4890844", "0.48857084", "0.48751205", "0.4872551", "0.48583087", "0.48515144", "0.4833408", "0.48324853", "0.4827976", "0.48273078", "0.48270035", "0.48222694", "0.48165855", "0.48165855", "0.48149765", "0.4812977", "0.4812926", "0.48073426", "0.47967818", "0.4794594", "0.47930893", "0.47798982", "0.47775128", "0.4764209", "0.47630763", "0.47611699", "0.47545072", "0.47481462", "0.47357088", "0.47344822", "0.47320896", "0.47292972", "0.47212702", "0.47034827", "0.4699302", "0.46991676", "0.46960208", "0.46892667", "0.46876752", "0.46874577", "0.46822235", "0.4674581", "0.46704945", "0.46680793", "0.46667564", "0.46649393", "0.46619713", "0.466005", "0.46590534", "0.46566334", "0.46531692", "0.4652031", "0.46500212", "0.464895", "0.46473676", "0.4643042", "0.46423414", "0.4642179" ]
0.6990563
0
PATCH/PUT /minisounds/1 PATCH/PUT /minisounds/1.json
def update respond_to do |format| if @minisound.update(minisound_params) format.html { redirect_to @minisound, notice: 'Minisound was successfully updated.' } format.json { render :show, status: :ok, location: @minisound } else format.html { render :edit } format.json { render json: @minisound.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @my_ministry = MyMinistry.find(params[:id])\n\n respond_to do |format|\n if @my_ministry.update_attributes(params[:my_ministry])\n format.html { redirect_to @my_ministry, notice: 'My ministry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_ministry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @compound = Compound.find(params[:id])\n\n respond_to do |format|\n if @compound.update_attributes(params[:compound])\n format.html { redirect_to @compound, notice: 'Compound was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compound.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @compound.update(compound_params)\n format.html { redirect_to @compound, notice: 'Compound was successfully updated.' }\n format.json { render :show, status: :ok, location: @compound }\n else\n format.html { render :edit }\n format.json { render json: @compound.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ministries = Ministries.find(params[:id])\n\n respond_to do |format|\n if @ministries.update_attributes(params[:ministries])\n flash[:notice] = 'Ministries was successfully updated.'\n format.html { redirect_to(@ministries) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ministries.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @minicurso = Minicurso.find(params[:id])\n\n respond_to do |format|\n if @minicurso.update_attributes(params[:minicurso])\n format.html { redirect_to @minicurso, notice: 'Minicurso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @minicurso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end", "def update\n @minimessage = Minimessage.find(params[:id])\n\n respond_to do |format|\n if @minimessage.update_attributes(params[:minimessage])\n format.html { redirect_to @minimessage, notice: 'Minimessage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @minimessage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @minister.update(minister_params)\n format.html { redirect_to @minister, notice: 'Minister was successfully updated.' }\n format.json { render :show, status: :ok, location: @minister }\n else\n format.html { render :edit }\n format.json { render json: @minister.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n if @ministerio.update_attributes(params[:ministerio])\n format.html { redirect_to @ministerio, notice: 'Ministerio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ministerio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sin = Sin.find(params[:id])\n\n respond_to do |format|\n if @sin.update_attributes(params[:sin])\n format.html { redirect_to @sin, notice: 'Binge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @smallmap = Smallmap.find(params[:id])\n\n respond_to do |format|\n if @smallmap.update_attributes(params[:smallmap])\n format.html { redirect_to @smallmap, notice: 'Smallmap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @smallmap.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_minisound\n @minisound = Minisound.find(params[:id])\n end", "def update\n @magzine = Magzine.find(params[:id])\n\n respond_to do |format|\n if @magzine.update_attributes(params[:magzine])\n format.html { redirect_to @magzine, notice: 'Magzine was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @magzine.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mbracket.update(mbracket_params)\n format.html { redirect_to @mbracket, notice: 'Mbracket was successfully updated.' }\n format.json { render :show, status: :ok, location: @mbracket }\n else\n format.html { render :edit }\n format.json { render json: @mbracket.errors, status: :unprocessable_entity }\n end\n end\n end", "def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end", "def update\n respond_to do |format|\n if @minuman.update(minuman_params)\n format.html { redirect_to @minuman, notice: 'Minuman was successfully updated.' }\n format.json { render :show, status: :ok, location: @minuman }\n else\n format.html { render :edit }\n format.json { render json: @minuman.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @smallsurvey.update(smallsurvey_params)\n format.html { redirect_to @smallsurvey, notice: 'Smallsurvey was successfully updated.' }\n format.json { render :show, status: :ok, location: @smallsurvey }\n else\n format.html { render :edit }\n format.json { render json: @smallsurvey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mint_coin = @coin.mint_coins.find(params[:id])\n\n respond_to do |format|\n if @mint_coin.update_attributes(params[:mint_coin])\n format.html { redirect_to coin_mint_coins_url([@coin]), :notice => 'Mint coin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @mint_coin.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n # update shops\n shops_edit = JSON.parse(params[:mall][:shops_in_mall])\n\n respond_to do |format|\n if @mall.update_with_shops(mall_params, shops_edit)\n format.html { redirect_to director_malls_path, notice: 'Mall was successfully updated.' }\n format.json { render :show, status: :ok, location: @mall }\n else\n format.html {\n @shops = Shop.to_options.to_json\n @shops_in_mall = @mall.shops.to_options.to_json\n render :edit\n }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rest\n @question_localized = QuestionLocalized.find(params[:id])\n\n respond_to do |format|\n if @question_localized.update_attributes(params[:question_localized])\n flash[:notice] = 'QuestionLocalized was successfully updated.'\n format.html { redirect_to(@question_localized) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question_localized.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @mostsmallresource = Mostsmallresource.find(params[:id])\n\n respond_to do |format|\n if @mostsmallresource.update_attributes(params[:mostsmallresource])\n format.html { redirect_to @mostsmallresource, notice: 'Mostsmallresource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmallresource.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 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 @microposst = Microposst.find(params[:id])\n\n respond_to do |format|\n if @microposst.update_attributes(params[:microposst])\n format.html { redirect_to @microposst, notice: 'Microposst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microposst.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n old_quantity = @isale.quantity # Старое значение\n\n respond_to do |format|\n if @isale.update(isale_params)\n stat = Statistic.find_by(number: @isale.pharmacy_id)\n\n stat.update_attributes(quantity: stat.quantity - old_quantity + @isale.quantity)\n \n format.html { redirect_to @isale, notice: t('helpers.success-upd') }\n format.json { render :show, status: :ok, location: @isale }\n else\n format.html { render :edit }\n format.json { render json: @isale.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @working_specific_small_item.update(working_specific_small_item_params)\n format.html { redirect_to @working_specific_small_item, notice: 'Working specific small item was successfully updated.' }\n format.json { render :show, status: :ok, location: @working_specific_small_item }\n else\n format.html { render :edit }\n format.json { render json: @working_specific_small_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @micropst.update(micropst_params)\n format.html { redirect_to @micropst, notice: \"Micropst was successfully updated.\" }\n format.json { render :show, status: :ok, location: @micropst }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @micropst.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mostsmallmission = Mostsmallmission.find(params[:id])\n\n respond_to do |format|\n if @mostsmallmission.update_attributes(params[:mostsmallmission])\n format.html { redirect_to @mostsmallmission, notice: 'Mostsmallmission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmallmission.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n respond_to do |format|\n if @magzine.update(magzine_params)\n format.html { redirect_to @magzine, notice: 'Magzine was successfully updated.' }\n format.json { render :show, status: :ok, location: @magzine }\n else\n format.html { render :edit }\n format.json { render json: @magzine.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @recipe_ingredients_unit.update(recipe_ingredients_unit_params)\n format.html { redirect_to recipe_ingredients_units_path, notice: 'Recipe ingredients unit was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_ingredients_unit }\n else\n format.html { render :edit }\n format.json { render json: @recipe_ingredients_unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @manpack = Manpack.find(params[:id])\n\n respond_to do |format|\n if @manpack.update_attributes(params[:manpack])\n format.html { redirect_to @manpack, notice: 'Manpack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manpack.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @minnpaku.update(minnpaku_params)\n format.html { redirect_to @minnpaku, notice: 'Minnpaku was successfully updated.' }\n format.json { render :show, status: :ok, location: @minnpaku }\n else\n format.html { render :edit }\n format.json { render json: @minnpaku.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mix.update(mix_params)\n format.html { redirect_to @mix, notice: 'Mix was successfully updated.' }\n format.json { render :show, status: :ok, location: @mix }\n else\n format.html { render :edit }\n format.json { render json: @mix.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instrument_patch.update(instrument_patch_params)\n format.html { redirect_to @instrument_patch, notice: 'Instrument patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instrument_patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @round.update_from_json(round_params['round'])\n update_parents(@round)\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n else\n format.html { render :edit }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @small_group.update(small_group_params)\n format.html { redirect_to @small_group, notice: 'Small group was successfully updated.' }\n format.json { render :show, status: :ok, location: @small_group }\n else\n format.html { render :edit }\n format.json { render json: @small_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @miniature.update(miniature_params)\n format.html { redirect_to @miniature, notice: 'Miniature was successfully updated.' }\n format.json { render :show, status: :ok, location: @miniature }\n else\n format.html { render :edit }\n format.json { render json: @miniature.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @specialization_weight.update(specialization_weight_params)\n format.html { redirect_to @specialization_weight, notice: 'Specialization weight was successfully updated.' }\n format.json { render :show, status: :ok, location: @specialization_weight }\n else\n format.html { render :edit }\n format.json { render json: @specialization_weight.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @request.assign_json_attributes(params) if @request.resume?\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ministry = Ministry.find(params[:id])\n\n respond_to do |format|\n if @ministry.update_attributes(params[:ministry])\n flash[:notice] = 'Ministry was successfully updated.'\n format.html { redirect_to(@ministry) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ministry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_rest\n @answer_localized = AnswerLocalized.find(params[:id])\n\n respond_to do |format|\n if @answer_localized.update_attributes(params[:answer_localized])\n flash[:notice] = 'AnswerLocalized was successfully updated.'\n format.html { redirect_to(@answer_localized) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer_localized.errors, :status => :unprocessable_entity }\n end\n end\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 patch\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.patch do |req|\n req.headers['Content-Type'] = \"application/json\"\n req.url resource_uri\n req.body = raw.to_json\n end\n if res.success?\n data = JSON.parse(res.body)\n self.class.new(data, @client)\n else\n nil\n end\n end", "def update\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n if @momsg.update_attributes(params[:momsg])\n format.html { redirect_to @momsg, notice: 'Momsg was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @momsg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sa_request.update(sa_request_params)\n format.html { redirect_to @sa_request, notice: 'Sa request was successfully updated.' }\n format.json { render :show, status: :ok, location: @sa_request }\n else\n format.html { render :edit }\n format.json { render json: @sa_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @subset.update(subset_params)\n format.html { redirect_to @subset, notice: 'Subset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @subset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @moresmallmobsquad = Moresmallmobsquad.find(params[:id])\n\n respond_to do |format|\n if @moresmallmobsquad.update_attributes(params[:moresmallmobsquad])\n format.html { redirect_to @moresmallmobsquad, notice: 'Moresmallmobsquad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moresmallmobsquad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @squire.update(squire_params)\n format.html { redirect_to @squire, notice: 'Squire was successfully updated.' }\n format.json { render :show, status: :ok, location: @squire }\n else\n format.html { render :edit }\n format.json { render json: @squire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mod_pack.update(mod_pack_params)\n format.html { redirect_to @mod_pack, notice: 'Mod pack was successfully updated.' }\n format.json { render :show, status: :ok, location: @mod_pack }\n else\n format.html { render :edit }\n format.json { render json: @mod_pack.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @latstraps1.update(latstraps1_params)\n format.html { redirect_to \"/latstraps1s\"}\n format.json { render :show, status: :ok, location: @latstraps1 }\n else\n format.html { render :edit }\n format.json { render json: @latstraps1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "def update\n respond_to do |format|\n if @singlepart.update(singlepart_params)\n format.html { redirect_to @singlepart, notice: 'Singlepart was successfully updated.' }\n format.json { render :show, status: :ok, location: @singlepart }\n else\n format.html { render :edit }\n format.json { render json: @singlepart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n if @ministerio.update_attributes(params[:ministerio])\n format.html { redirect_to(@ministerio, :notice => 'Ministerio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ministerio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @minipost.update(minipost_params)\n format.html { redirect_to @minipost, notice: 'Minipost was successfully updated.' }\n format.json { render :show, status: :ok, location: @minipost }\n else\n format.html { render :edit }\n format.json { render json: @minipost.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # build_resource\n if resource.status == 'Open'\n resource.update_attributes permitted_params[:contract]\n if !resource.valid?\n render json: resource.errors, status: :unprocessable_entity\n else\n resource.save\n respond_with json: {}, status: :ok\n end\n else\n respond_with json: [{'error':'The contract must be Open to edit.'}], status: :unprocessable_entity\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 respond_to do |format|\n if @m1.update(m1_params)\n format.html { redirect_to @m1, notice: 'M1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @m1 }\n else\n format.html { render :edit }\n format.json { render json: @m1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ministrante.update(ministrante_params)\n format.html { redirect_to @ministrante, notice: 'Ministrante was successfully updated.' }\n format.json { render :show, status: :ok, location: @ministrante }\n else\n format.html { render :edit }\n format.json { render json: @ministrante.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contract.update(update_params)\n format.html { redirect_to_leaf_notice(UPDATE_SUCCESS) }\n format.json { render :show, status: :ok, location: @contract }\n else\n unprocessable_response(format)\n end\n end\n end", "def update_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n\n respond_to do |format|\n if @entry_instrument.update_attributes(params[:entry_instrument])\n flash[:notice] = 'EntryInstrument was successfully updated.'\n format.html { redirect_to(@entry_instrument) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_instrument.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n if @moresmalltrial.update_attributes(params[:moresmalltrial])\n format.html { redirect_to @moresmalltrial, notice: 'Moresmalltrial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moresmalltrial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @compound.update(compound_params)\n @compound.update_attribute(:edited_by, current_user.id)\n File.write(\"structures/#{@compound.id}.mol\", @compound.structure )\n format.html { redirect_to @compound, notice: 'Compound was successfully updated.' }\n format.json { render :show, status: :ok, location: @compound }\n else\n format.html { render :edit }\n format.json { render json: @compound.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ministerios = Ministerios.find(params[:id])\n @title = \"Edição do Ministério: \" + @ministerios.nome\n respond_to do |format|\n if @ministerios.update_attributes(params[:ministerios])\n Ministerios.update(@ministerios.id, :respmod => self.current_usuarios.login.upcase)\n \tflash[:notice] = 'Ministerios was successfully updated.'\n format.html { redirect_to(ministerios_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ministerios.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\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 update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_mural.update(admin_mural_params)\n format.html { redirect_to @admin_mural, notice: 'Mural was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_mural }\n else\n format.html { render :edit }\n format.json { render json: @admin_mural.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @jobtype = Jobtype.find(params[:id])\n\n if @jobtype.update_attributes(params[:unit])\n render_json \"success\"\n else\n render_error \"failure\"\n end\n end", "def update\n respond_to do |format|\n if @round.update(round_params)\n format.html { redirect_to :back, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end", "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 update\n @pack = Pack.find(params[:id])\n\n respond_to do |format|\n if @pack.update_attributes(params[:pack])\n format.html { redirect_to(@pack, :notice => 'Product Mixed was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pack.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 @small_generator = SmallGenerator.find(params[:id])\n\n respond_to do |format|\n if @small_generator.update_attributes(params[:small_generator])\n format.html { redirect_to @small_generator, notice: 'Small generator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @small_generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @short_name = ShortName.find(params[:id])\n\n respond_to do |format|\n if @short_name.update_attributes(params[:short_name])\n format.html { redirect_to @short_name, notice: 'Short name was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @short_name.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @first_level_unit.update(first_level_unit_params)\n format.html { redirect_to admin_first_level_units_path, notice: 'First level unit was successfully updated.' }\n format.json { render :show, status: :ok, location: @first_level_unit }\n else\n format.html { render :edit }\n format.json { render json: @first_level_unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @small_concert.update(small_concert_params)\n format.html { redirect_to '/admin/small_concerts', notice: 'Small concert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @small_concert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lunch.update(lunch_params)\n format.html { redirect_to @lunch, notice: 'Lunch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lunch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @round = Round.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sinh_vien = SinhVien.find(params[:id])\n\n respond_to do |format|\n if @sinh_vien.update_attributes(params[:sinh_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mum = Mum.find(params[:mum_id])\n respond_to do |format|\n if @cousin.update(cousin_params)\n format.html { redirect_to mum_path(@mum), notice: 'Gen2 was successfully updated.' }\n format.json { render :show, status: :ok, location: @cousin }\n else\n format.html { render :edit }\n format.json { render json: @cousin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @syohin.update(syohin_params)\n format.html { redirect_to @syohin, notice: 'Syohin was successfully updated.' }\n format.json { render :show, status: :ok, location: @syohin }\n else\n format.html { render :edit }\n format.json { render json: @syohin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @muscle_mass.update(muscle_mass_params)\r\n format.html { redirect_to @muscle_mass, notice: 'Muscle mass 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: @muscle_mass.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @smalluser = Smalluser.find(params[:id])\n\n respond_to do |format|\n if @smalluser.update_attributes(params[:smalluser])\n format.html { redirect_to @smalluser, notice: 'Smalluser was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @smalluser.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 @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 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 @microplst = Microplst.find(params[:id])\n\n respond_to do |format|\n if @microplst.update_attributes(params[:microplst])\n format.html { redirect_to @microplst, notice: 'Microplst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microplst.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @short_message.update(short_message_params)\n format.html { redirect_to @short_message, notice: 'Short message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @short_message.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 @mostsmallskill = Mostsmallskill.find(params[:id])\n\n respond_to do |format|\n if @mostsmallskill.update_attributes(params[:mostsmallskill])\n format.html { redirect_to @mostsmallskill, notice: 'Mostsmallskill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmallskill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @sivic_ministerio.update(sivic_ministerio_params)\r\n format.html { redirect_to @sivic_ministerio, 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_ministerio.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @quantity = Quantity.find(params[:id])\n\n respond_to do |format|\n if @quantity.update_attributes(params[:quantity])\n format.html { redirect_to @quantity, notice: 'Quantity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quantity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quantity = Quantity.find(params[:id])\n\n respond_to do |format|\n if @quantity.update_attributes(params[:quantity])\n format.html { redirect_to @quantity, notice: 'Quantity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quantity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ministries_picture.update(ministries_picture_params)\n format.html { redirect_to @ministries_picture, notice: 'Ministries picture was successfully updated.' }\n format.json { render :show, status: :ok, location: @ministries_picture }\n else\n format.html { render :edit }\n format.json { render json: @ministries_picture.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @ministorage.update(ministorage_params)\n format.html { redirect_to :back, notice: '更新成功' }\n format.json { head :no_content }\n else\n format.html { render action: :back }\n format.json { render json: @ministorage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_attr\n #sanity checks \n @persona = current_persona\n @mediaset = @persona.mediasets.find(params[:id])\n \n respond_to do |format|\n @mediaset.update_attributes( params[:mediaset] )\n format.json{ respond_with_bip(@mediaset) }\n end\n end" ]
[ "0.5810324", "0.5779018", "0.5771261", "0.57280445", "0.5701555", "0.568239", "0.5679738", "0.5656366", "0.56290114", "0.56186855", "0.56155884", "0.5606402", "0.5595152", "0.55873173", "0.55774105", "0.5574383", "0.5551537", "0.5548881", "0.55415165", "0.55311704", "0.5510022", "0.5498877", "0.5488369", "0.54861504", "0.5458845", "0.5456777", "0.5454073", "0.5449247", "0.54340374", "0.5431746", "0.5419879", "0.5415811", "0.5410821", "0.5407445", "0.54053336", "0.5400455", "0.5399543", "0.5396006", "0.5395602", "0.53917116", "0.5380081", "0.5379546", "0.5379285", "0.5374374", "0.53697604", "0.5366795", "0.5364272", "0.53596467", "0.535935", "0.535925", "0.53585917", "0.53585464", "0.53460085", "0.5345649", "0.5341513", "0.5339087", "0.5335432", "0.53294593", "0.53205246", "0.5317776", "0.53099346", "0.5308946", "0.5307163", "0.5305758", "0.5302358", "0.5297514", "0.52962995", "0.52956605", "0.52952963", "0.52942055", "0.5294064", "0.5288662", "0.5287152", "0.5283337", "0.52819794", "0.52773327", "0.5276992", "0.52644765", "0.5259719", "0.52545124", "0.5254117", "0.5251148", "0.52479225", "0.5245742", "0.5245313", "0.52423984", "0.5239249", "0.5237207", "0.52349967", "0.52349967", "0.5234936", "0.5234486", "0.5234295", "0.52314776", "0.52280366", "0.5224644", "0.5224644", "0.5223664", "0.52218276", "0.52166116" ]
0.69507194
0
DELETE /minisounds/1 DELETE /minisounds/1.json
def destroy @minisound.destroy respond_to do |format| format.html { redirect_to minisounds_url, notice: 'Minisound was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @compound = Compound.find(params[:id])\n @compound.destroy\n\n respond_to do |format|\n format.html { redirect_to compounds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @minicurso = Minicurso.find(params[:id])\n @minicurso.destroy\n\n respond_to do |format|\n format.html { redirect_to minicursos_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 @minut.destroy\n respond_to do |format|\n format.html { redirect_to minuts_url, notice: 'Minut was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ministries = Ministries.find(params[:id])\n @ministries.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministries_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ministerios = Ministerios.find(params[:id])\n @ministerios.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministerios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @mostsmallmission = Mostsmallmission.find(params[:id])\n @mostsmallmission.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallmissions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @ministorage.destroy\n respond_to do |format|\n format.html { redirect_to admin_ministorages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @compound.destroy\n respond_to do |format|\n File.delete(\"structures/#{@compound.id}.mol\") if File.exist?(\"structures/#{@compound.id}.mol\")\n format.html { redirect_to compounds_url, notice: 'Compound was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mostsmallresource = Mostsmallresource.find(params[:id])\n @mostsmallresource.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallresources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @moresmalltrial = Moresmalltrial.find(params[:id])\n @moresmalltrial.destroy\n\n respond_to do |format|\n format.html { redirect_to moresmalltrials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @minuman.destroy\n respond_to do |format|\n format.html { redirect_to minumen_url, notice: 'Minuman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sivic_ministerio.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_ministerios_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @compound.destroy\n respond_to do |format|\n format.html { redirect_to compounds_url, notice: 'Compound was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stanza = Stanza.find_by_no(params[:id])\n @stanza.destroy\n\n respond_to do |format|\n format.html { redirect_to stanzas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sin = Sin.find(params[:id])\n @sin.destroy\n\n respond_to do |format|\n format.html { redirect_to sins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @small_generator = SmallGenerator.find(params[:id])\n @small_generator.destroy\n\n respond_to do |format|\n format.html { redirect_to small_generators_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @smallsurvey.destroy\n respond_to do |format|\n format.html { redirect_to smallsurveys_url, notice: 'Smallsurvey was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mineral.destroy\n respond_to do |format|\n format.html { redirect_to minerals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @momsg = Momsg.find(params[:id])\n @momsg.destroy\n\n respond_to do |format|\n format.html { redirect_to momsgs_url }\n format.json { head :ok }\n end\n end", "def destroy_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n @entry_instrument.destroy\n\n respond_to do |format|\n format.html { redirect_to(entry_instruments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @m1.destroy\n respond_to do |format|\n format.html { redirect_to m1s_url, notice: 'M1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @minimessage = Minimessage.find(params[:id])\n @minimessage.destroy\n\n respond_to do |format|\n format.html { redirect_to minimessages_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.xml { head :ok }\n end\n end", "def destroy\n @micropst.destroy\n respond_to do |format|\n format.html { redirect_to micropsts_url, notice: \"Micropst was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @microposst = Microposst.find(params[:id])\n @microposst.destroy\n\n respond_to do |format|\n format.html { redirect_to micropossts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mint_coin = @coin.mint_coins.find(params[:id])\n @mint_coin.destroy\n\n respond_to do |format|\n format.html { redirect_to coin_mint_coins_url([@coin]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @moresmallmobsquad = Moresmallmobsquad.find(params[:id])\n @moresmallmobsquad.destroy\n\n respond_to do |format|\n format.html { redirect_to moresmallmobsquads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @magzine = Magzine.find(params[:id])\n @magzine.destroy\n\n respond_to do |format|\n format.html { redirect_to magzines_url }\n format.json { head :ok }\n end\n end", "def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :ok }\n end\n end", "def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @smallmap = Smallmap.find(params[:id])\n @smallmap.destroy\n\n respond_to do |format|\n format.html { redirect_to smallmaps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bits_1.destroy\n respond_to do |format|\n format.html { redirect_to bits_1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @short_url.destroy\n render json: { status: \"Deleted\" }\n else\n render json: { head: \"no content\" }\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 delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @minister.destroy\n respond_to do |format|\n format.html { redirect_to ministers_url, notice: 'Minister was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @micropst = Micropst.find(params[:id])\n @micropst.destroy\n\n respond_to do |format|\n format.html { redirect_to(micropsts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: 'round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @basis = Base.find(params[:id])\n @basis.destroy\n\n respond_to do |format|\n format.html { redirect_to bases_url }\n format.json { head :no_content }\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 @baz55.destroy\n respond_to do |format|\n format.html { redirect_to baz55s_url, notice: \"Baz55 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @latstraps1.destroy\n respond_to do |format|\n format.html { redirect_to latstraps1s_url, notice: 'Latstraps1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @misuration_subscription.destroy\n respond_to do |format|\n format.html { redirect_to misuration_subscriptions_url, notice: 'Iscrizione al sensore eliminata correttamente' }\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 @taxirequest = Taxirequest.find(params[:id])\n @taxirequest.destroy\n\n respond_to do |format|\n format.html { redirect_to taxirequests_url }\n format.json { head :no_content }\n end\n end", "def destroy_rest\n @question_localized = QuestionLocalized.find(params[:id])\n @question_localized.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_localizeds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @stat_misc = StatMisc.find(params[:id])\n @stat_misc.destroy\n\n respond_to do |format|\n format.html { redirect_to stat_miscs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sm = Sm.find(params[:id])\n @sm.destroy\n\n respond_to do |format|\n format.html { redirect_to sms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ambush = Ambush.find(params[:id])\n @ambush.destroy\n\n respond_to do |format|\n format.html { redirect_to ambushes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @coin_set = CoinSet.find(params[:id])\n @coin_set.destroy\n\n respond_to do |format|\n format.html { redirect_to coin_sets_url }\n format.json { head :ok }\n end\n end", "def destroy\n @fraction = Fraction.find(params[:id])\n @fraction.destroy\n\n respond_to do |format|\n format.html { redirect_to regions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: 'Round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: 'Round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: 'Round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: 'Round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_rest\n @answer_localized = AnswerLocalized.find(params[:id])\n @answer_localized.destroy\n\n respond_to do |format|\n format.html { redirect_to(answer_localizeds_url) }\n format.xml { head :ok }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: \"Round was successfully destroyed.\" }\n format.json { head :no_content }\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 @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\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 @grant_round = GrantRound.find(params[:id])\n @grant_round.destroy\n\n head :no_content\n end", "def destroy\n @mostsmalliteminfo = Mostsmalliteminfo.find(params[:id])\n @mostsmalliteminfo.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmalliteminfos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shorty = Shorty.find(params[:id])\n @shorty.destroy\n\n respond_to do |format|\n format.html { redirect_to shorties_url }\n format.json { head :ok }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to(rounds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @minnpaku.destroy\n respond_to do |format|\n format.html { redirect_to minnpakus_url, notice: 'Minnpaku was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to(rounds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to(rounds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mostsmallroad = Mostsmallroad.find(params[:id])\n @mostsmallroad.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallroads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @band.destroy\n respond_to do |format|\n format.html { redirect_to bands_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @modrequest.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @short_name = ShortName.find(params[:id])\n @short_name.destroy\n\n respond_to do |format|\n format.html { redirect_to short_names_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 @singlepart.destroy\n respond_to do |format|\n format.html { redirect_to singleparts_url, notice: 'Singlepart was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @sumit.destroy\n respond_to do |format|\n format.html { redirect_to sumits_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @medusa_premis_representation_object = MedusaPremis::RepresentationObject.find(params[:id])\n @medusa_premis_representation_object.destroy\n\n respond_to do |format|\n format.html {\n query_params = session[:search] ? session[:search].dup : {}\n query_params.delete :counter\n query_params.delete :total\n link_url = url_for(query_params)\n redirect_to(link_url, notice: 'Representation object was successfully deleted.') }\n format.json { head :no_content }\n end\n end", "def destroy\n @stilage.destroy\n respond_to do |format|\n format.html { redirect_to stilages_url, notice: 'Stilage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_based.destroy\n respond_to do |format|\n format.html { redirect_to sms_baseds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @manpack = Manpack.find(params[:id])\n @manpack.destroy\n\n respond_to do |format|\n format.html { redirect_to manpacks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @base_unit.destroy\n respond_to do |format|\n format.html { redirect_to base_units_url }\n format.json { head :no_content }\n end\n end", "def destroy\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n response = HTTParty.delete(url, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n redirect_to units_url, notice: 'Unit was successfully deleted.'\n end", "def destroy\n @quest_item.destroy\n respond_to do |format|\n format.html { redirect_to admin_quest_items_url, notice: 'Всё норм' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end" ]
[ "0.6557799", "0.6532743", "0.6504515", "0.64920896", "0.6476177", "0.6430612", "0.64197105", "0.63616014", "0.6337825", "0.6337825", "0.6337825", "0.6335508", "0.6318131", "0.6309", "0.63047403", "0.63037443", "0.6301255", "0.6278031", "0.6273764", "0.6270861", "0.62663835", "0.62543505", "0.6236087", "0.6233653", "0.62290525", "0.6221419", "0.62044364", "0.61997426", "0.6194636", "0.6186808", "0.6184818", "0.617081", "0.61623174", "0.61608267", "0.6158777", "0.615863", "0.6148087", "0.6147211", "0.6147153", "0.6145516", "0.6145516", "0.61312157", "0.6129455", "0.612767", "0.61247504", "0.6122679", "0.61190367", "0.6114119", "0.6108679", "0.61046845", "0.61015284", "0.60989654", "0.6097612", "0.60956514", "0.6095433", "0.6094595", "0.6094216", "0.60906065", "0.6090507", "0.6089516", "0.60872394", "0.6085079", "0.6083328", "0.6078839", "0.6075469", "0.6075469", "0.6075469", "0.6075469", "0.60677224", "0.6067401", "0.6065187", "0.6065056", "0.6063072", "0.6062481", "0.60592884", "0.60525465", "0.605052", "0.60465074", "0.6045666", "0.6041463", "0.6036222", "0.6036222", "0.60349786", "0.6034212", "0.60341334", "0.60337347", "0.6027045", "0.60238117", "0.6023706", "0.60217965", "0.6021095", "0.60192096", "0.6017343", "0.6013854", "0.6012989", "0.6011215", "0.60106415", "0.60085416", "0.600661", "0.6004331" ]
0.73337567
0
Use callbacks to share common setup or constraints between actions.
def set_minisound @minisound = Minisound.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 minisound_params params.require(:minisound).permit(:video_id, :name, :playtime) 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 valid_params_request?; 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 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 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 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 url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def filtering_params\n params.permit(:email)\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 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 url_whitelist; 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 admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\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 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 url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "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 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.6980957", "0.6783065", "0.6747844", "0.6741468", "0.67356336", "0.6592548", "0.65036845", "0.64978707", "0.64825076", "0.64795035", "0.64560914", "0.64397955", "0.6379666", "0.6376688", "0.6366702", "0.6319728", "0.6300833", "0.6300629", "0.6294277", "0.6293905", "0.6291174", "0.62905735", "0.6283171", "0.6242344", "0.62403613", "0.6218049", "0.62143815", "0.62104696", "0.61949855", "0.6178671", "0.6176147", "0.6173327", "0.6163395", "0.6153005", "0.6151833", "0.6147288", "0.61224324", "0.6118827", "0.61075264", "0.61054534", "0.6092497", "0.6080082", "0.60710967", "0.60627776", "0.60219413", "0.60175914", "0.60153484", "0.60107356", "0.60081726", "0.60081726", "0.60013986", "0.6000165", "0.59978646", "0.59936947", "0.59925723", "0.5992084", "0.59796256", "0.5967569", "0.5960056", "0.59589803", "0.5958441", "0.5958401", "0.5952607", "0.5952406", "0.5944409", "0.59391016", "0.593842", "0.593842", "0.5933845", "0.59312123", "0.5926475", "0.59248453", "0.59179676", "0.59109294", "0.59101623", "0.5908172", "0.59058356", "0.5899052", "0.5897749", "0.5896101", "0.58942914", "0.58939576", "0.5892063", "0.5887407", "0.588292", "0.58797663", "0.587367", "0.58681566", "0.5868038", "0.5866578", "0.58665025", "0.58655846", "0.58640826", "0.5863465", "0.5862226", "0.586065", "0.58581287", "0.5854443", "0.5854172", "0.58507544", "0.5849934" ]
0.0
-1
GET /laporan_guru_agama_katolik GET /laporan_guru_agama_katolik.json
def index @laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.order("created_at DESC").page(params[:daftar_laporan_guru_agama_katolik_page]).per(6) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_laporan_guru_agama_katolik\n @laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.find(params[:id])\n end", "def laporan_guru_agama_katolik_params\n params.require(:laporan_guru_agama_katolik).permit(:judul, :tautan, :pengguna_id)\n end", "def create\n @laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.new(laporan_guru_agama_katolik_params)\n @laporan_guru_agama_katolik.pengguna_id = current_pengguna.id\n\n respond_to do |format|\n if @laporan_guru_agama_katolik.save\n format.html { redirect_to @laporan_guru_agama_katolik, notice: 'Laporan guru agama katolik was successfully created.' }\n format.json { render :show, status: :created, location: @laporan_guru_agama_katolik }\n else\n format.html { render :new }\n format.json { render json: @laporan_guru_agama_katolik.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @data_pendidikan_agama_katolik = DataPendidikanAgamaKatolik.order(\"created_at DESC\").page(params[:daftar_data_pendidikan_agama_katolik_page]).per(6)\n end", "def show\n @kansei_buhin = KanseiBuhin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kansei_buhin }\n end\n end", "def show\n @kisalli = Kisalli.find_by_key(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kisalli }\n end\n end", "def index\n @data_keagamaan_katolik = DataKeagamaanKatolik.all\n end", "def show\n render json: @lugar\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 show\n @kolegiji = Kolegiji.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegiji }\n end\n end", "def show\n @kolegij = Kolegij.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegij }\n end\n end", "def show\n @pengeluaran_bulanan = PengeluaranBulanan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pengeluaran_bulanan }\n end\n end", "def index\n @kraje = Kraj.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kraje }\n end\n end", "def show\n render json: @grupoassunto\n end", "def show\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format| \n format.json { render json: @giang_vien }\n end\n end", "def gabarra\n respond_to do |format|\n begin\n @gabarra = DescargaBauxita.descargar(params)\n format.json { render :json => @gabarra }\n rescue Exceptions::PresenciaValoresExcepcion => errores\n format.json { render :json => errores.errors, :status => 400 }\n end\n end\n end", "def index\n @kifus = Kifu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kifus }\n end\n end", "def show\n\tadd_breadcrumb \"Datos de la librería\", :librerias_path\n @libreria = Libreria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @libreria }\n end\n end", "def show\n @lich_su_binh_bau = LichSuBinhBau.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lich_su_binh_bau }\n end\n end", "def update\n respond_to do |format|\n if @laporan_guru_agama_katolik.update(laporan_guru_agama_katolik_params)\n format.html { redirect_to @laporan_guru_agama_katolik, notice: 'Laporan guru agama katolik was successfully updated.' }\n format.json { render :show, status: :ok, location: @laporan_guru_agama_katolik }\n else\n format.html { render :edit }\n format.json { render json: @laporan_guru_agama_katolik.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @kalos = Kalo.all\n end", "def new\n @kisalli = Kisalli.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kisalli }\n end\n end", "def show\n @kullanici = Kullanici.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kullanici }\n end\n end", "def show\n @bahan = Bahan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bahan }\n end\n end", "def show\n \n @tarih = Takvim.all\n\n # var olan kodlar\n @odeme_akademist = Odeme::Akademist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odeme_akademist }\n end\n end", "def show\n # @kokyaku = Kokyaku.find(params[:id])\n @kokyaku = Kokyaku.find(:first, :conditions => {:kokyakuId => params[:id], :delFlg => 0})\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kokyaku }\n end\n end", "def index\n @laporan_kinerja_pegawai_bimkat_sumteng = LaporanKinerjaPegawaiBimkatSumteng.all\n end", "def index\n @himalayas ||= Himalaya.limit(10).order('id desc')\n @descuentos ||= Descuento.limit(10).order('id desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end", "def show\n @kalplan_tltle = KalplanTltle.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kalplan_tltle }\n end\n end", "def index\n @himalayas = Himalaya.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end", "def show\n @grupo_biblico = GrupoBiblico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grupo_biblico }\n end\n end", "def index\n #@imovels = Imovel.all\n \n #Traz apenas os imoveis ativos\n # Isso vai no controller do cliente. Só os ativos aparecem\n #@imovels = Imovel.all.select { |i| i.ativo == true }\n \n @imovels = Imovel.paginate :page => params[:page], :order => 'created_at DESC', :per_page => 10\n \n # Mapa para guardar os valores das transacoes associadas a cada imovel.\n # key: imovel_id, value: lista com [0]:transacao, [1]: tipos, [2] responsavel\n @hash_informacoes_imoveis = Hash.new\n \n @imovels.each do |imovel|\n popular_imovel(imovel)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imovels }\n end\n end", "def show\n @nguoi_dung = NguoiDung.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nguoi_dung }\n end\n end", "def show\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @koti }\n end\n end", "def index\n #@imovels = Imovel.all\n \n #Traz apenas os imoveis ativos\n @imovels = Imovel.all.select { |i| i.ativo == true }\n \n # Mapa para guardar os valores das transacoes associadas a cada imovel.\n # key: imovel_id, value: lista com [0]:transacao, [1]: tipos, [2] responsavel\n @hash_informacoes_imoveis = Hash.new\n \n @imovels.each do |imovel|\n popular_imovel(imovel)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imovels }\n end\n end", "def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end", "def list_pengaduan_proses\n pengaduan = Pengaduan.all.where(status: 'proses').where(user_id: @user.id).order(created_at: :desc)\n render json: {status: true, total: pengaduan.count, data: pengaduan}\n end", "def index\n @lugars = Lugar.all\n\n render json: @lugars\n end", "def fetch_api_codewars_kata_info\n private_fetch_kata\n end", "def show\n @lugar = Lugar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lugar }\n end\n end", "def show\n @penjualan_bahan = PenjualanBahan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @penjualan_bahan }\n end\n end", "def new\n @kansei_buhin = KanseiBuhin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kansei_buhin }\n end\n end", "def show\n @nhan_xet = NhanXet.where(:chi_tiet_binh_bau_id => params[:id])\n\n respond_to do |format|\n format.json { render json: @nhan_xet.collect{|i| {:NoiDung => i.NoiDung, :created_at =>i.created_at.strftime(\"Ngày %d/%m/%Y lúc %H:%M\"), :MaUser => i.user.MaUser,:TenUser => i.user.HoTen, :TenTruong => i.truong.TenTruong}} }\n end\n end", "def index\n @kegiatans = Kegiatan.all\n end", "def show\n\tadd_breadcrumb \"Datos del libro\", :libro_path\n @libro = Libro.find(params[:id])\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @libro }\n end\n end", "def show\n @buchung = Buchung.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @buchung }\n end\n end", "def index\n @cari_uang_masuk = UangMasuk.where([\"keterangan iLIKE ?\",\"%#{params[:keterangan]}%\"]).order(id: :desc)\n @a_masuk = true\n end", "def show\n \n respond_to do |format|\n format.html\n #format.json {render json: @jiras}\n\n end\n end", "def show\n @lokasis = Rute.select(\"id_jalan\").uniq\n end", "def show\n @bruger = Bruger.find_by_id(current_user.id)\n @onske = Onske.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @onske }\n end\n end", "def index\n if session[:kunde_id] == nil\n @buchungs = Buchung.all\n else\n @buchungs = Buchung.find(:all, :conditions => ['kunde_id = ?',session[:kunde_id]], :order =>\"anfangszeit ASC\") \n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @buchungs }\n end\n end", "def index\n # Block execution if there is no current user\n if(current_user.blank?)\n return render json:{\n errors: \"true\",\n message: \"User not connected\"\n }, status: 401\n end\n\n user = User.find(current_user.id)\n logement = Logement.find_by(id:params[:logement_id])\n bain_demi = BainDemi.find_by(logement_id: params[:logement_id])\n bain_entier = BainEntier.find_by(logement_id: params[:logement_id])\n cuisine = Cuisine.find_by(logement_id: params[:logement_id])\n kit= Kitchenette.find_by(logement_id: params[:logement_id])\n\n \n render json:{\n bain_demi:bain_demi, bain_entier:bain_entier, cuisine:cuisine, kit:kit\n }\n end", "def show\n @partecipanti_gruppo = PartecipantiGruppo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partecipanti_gruppo }\n end\n end", "def show\n @zayavka = Zayavka.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zayavka }\n end\n end", "def get_non_bajaj_vehicles\n @bikes = Bike.where(non_bajaj: true).order(\"display_order\")\n \n render json: @bikes\n end", "def show\n @kraj = Kraj.includes(:miejsca=>[{:terminy=>:dzien},:grupy,:kraj]).find(params[:id])\n\t\t@miejsca = params[:dzien]? Miejsce.w_dniu_dla_kraju(params[:dzien],@kraj) : Miejsce.where(:kraj_id=>params[:id]).order(\"nazwa\").includes(:kraj ,:grupy,:terminy=>[:dzien])\n @json = @miejsca.to_gmaps4rails do |miejsce, marker|\n marker.infowindow render_to_string(:partial => \"miejsca/info_window\", :object => miejsce)\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kraj }\n end\n end", "def index\n @jalans = Jalan.all\n @lokasis = Rute.select(\"id_jalan\").uniq\n end", "def data_keagamaan_katolik_params\n params.require(:data_keagamaan_katolik).permit(:judul, :keterangan, :tautan, :user_id)\n end", "def show\n @sotrudniki = Sotrudniki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sotrudniki }\n end\n end", "def show\n @galeria = Galeria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @galeria }\n end\n end", "def show \n est = @establecimiento\n respond_to do |format|\n format.html\n format.json { \n\n if (params[:appkey].eql? appkey) #si el appkey es correcto\n render :json => {:nombre => @establecimiento.nombre, direccion: @establecimiento.direccion, :latitud => @establecimiento.latitud,\n :longitud => @establecimiento.longitud, :descripcion => @establecimiento.descripcion, :imagen => @establecimiento.foto.url(:small),\n :comentarios => @establecimiento.EstComentarios.map { |comentario| { :descripcion => comentario.descripcion, :usuario => comentario.usuario.nombre } } } \n\n else\n render json: {:error => \"No autorizado\"}\n end\n\n\n }\n end\n #No tiene restricciones, queda abierto para el API\n end", "def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end", "def show\n @himalaya = Himalaya.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @himalaya }\n end\n end", "def index\n @kisallis = Kisalli.current\n @kisallis = @kisallis.where(ohjaaja: true) if params[:ohjaaja]\n @kisallis = @kisallis.where(kisalli: true) if params[:kisalli]\n @kisallis = @kisallis.where(tira: true) if params[:tira]\n @kisallis = @kisallis.where(\"opintojen_ka >=?\", params[:ka]) if params[:ka] and not params[:ka].blank?\n\n session[:ohjaaja] = params[:ohjaaja]\n session[:kisalli] = params[:kisalli]\n session[:tira] = params[:tira]\n session[:ka] = params[:ka]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kisallis }\n end\n end", "def show\n @hasil = Hasil.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hasil }\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 @lancamentorapido = Lancamentorapido.new \n @lancamentorapidos = Lancamentorapido.all\n \n @categorias = Category.all\n @centrosdecusto = Centrodecusto.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lancamentorapidos }\n end\n end", "def index\n @knihy = Kniha.all\n end", "def index\n #@kofus = Kofu.all\n \n @search = Kofu.where(chosa_ym: session[:when_year]+session[:when_month]).where(chosain_id: session[:whoami_id]).search(params[:q])\n\n @kofus = @search.result.order(:id)\n \n @kanrikus = []\n @hashiras = []\n @kofus.each do |kofu|\n @kanrikus << kofu.keiyaku.kanriku_code\n @hashiras << kofu.keiyaku.hashira_bango\n\n \n end\n @kanrikus.uniq!\n @hashiras.uniq!\n \n \n \n end", "def index\n @hikiyamas = @omatsuri.hikiyamas\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hikiyamas }\n format.json { render :json => @hikiyamas }\n end\n end", "def matching_karyalay_list\n search_by = params[:search_by]\n if search_by.empty?\n res = fetch_all_karyalay\n else\n res = fetch_matching_karyalay(search_by)\n end\n render json: res.to_json\n end", "def show\n @jamaat = Jamaat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jamaat }\n end\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def index\n @flyer_infos = FlyerInfo.all(:select => \"id, topimg, sideimg, capacity, speed, stormresist, multiplier, price, tier, load_time, disabled\")\n @language = ApplicationHelper.preferred_language(request.headers[\"Accept-Language\"])\n\n @complete_flyers = @flyer_infos.collect { |flyer_info|\n flyer_info.as_json.merge(FlyerInfosHelper.getflyerloc(flyer_info, @language).first.as_json)\n }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @complete_flyers }\n end\n end", "def index\n seleccionarMenu(:juzgados)\n @juzgados = Juzgado.order(:ciudad_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @juzgados }\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 show\n @bili = Bili.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bili }\n end\n end", "def index\n # Retrieve kpis templates from impac api.\n # TODO: improve request params to work for strong parameters\n attrs = params.slice('metadata', 'opts')\n auth = { username: MnoEnterprise.tenant_id, password: MnoEnterprise.tenant_key }\n\n response = begin\n MnoEnterprise::ImpacClient.send_get('/api/v2/kpis', attrs, basic_auth: auth)\n rescue => e\n return render json: { message: \"Unable to retrieve kpis from Impac API | Error #{e}\" }\n end\n\n # customise available kpis\n kpis = (response['kpis'] || []).map do |kpi|\n kpi = kpi.with_indifferent_access\n kpi[:watchables].map do |watchable|\n kpi.merge(\n name: \"#{kpi[:name]} #{watchable.capitalize unless kpi[:name].downcase.index(watchable)}\".strip,\n watchables: [watchable],\n target_placeholders: {watchable => kpi[:target_placeholders][watchable]},\n )\n end\n end\n .flatten\n\n render json: { kpis: kpis }\n end", "def index\n param_page = params[:page] rescue 1\n per_page = PAGINATION\n\n param = params[:param].to_s rescue ''\n tipe = params[:tipe]\n\n #@kategori_tindakan_penunjangs = KategoriTindakanPenunjang.all.paginate :per_page => per_page, :page => param_page\n\n if params[:tipe]\n if tipe == \"kode\"\n field = \"kode LIKE ?\"\n elsif tipe == \"nama\"\n field = \"nama LIKE ?\"\n else\n end\n @kategori_tindakan_penunjangs = KategoriTindakanPenunjang.where(\"#{field} \", \"%\"+param+\"%\").paginate :per_page => per_page, :page => param_page\n else\n @kategori_tindakan_penunjangs = KategoriTindakanPenunjang.all.paginate :per_page => per_page, :page => param_page\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @kategori_tindakan_penunjangs }\n format.js\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @himalaya }\n end\n end", "def data_pendidikan_agama_katolik_params\n params.require(:data_pendidikan_agama_katolik).permit(:judul, :keterangan, :tautan, :pengguna_id)\n end", "def show\n \n @lancamentorapido = Lancamentorapido.find(params[:id])\n \n @categorias = Category.all\n @centrosdecusto = Centrodecusto.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lancamentorapido }\n end\n end", "def show\n @zakaz = Zakaz.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zakaz }\n end\n end", "def show\n @kazoku = Kazoku.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @kazoku }\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 @imp2_raman = Imp2Raman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imp2_raman }\n end\n end", "def new\n @kolegiji = Kolegiji.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kolegiji }\n end\n end", "def create\n @data_pendidikan_agama_katolik = DataPendidikanAgamaKatolik.new(data_pendidikan_agama_katolik_params)\n @data_pendidikan_agama_katolik.pengguna_id = current_pengguna.id\n \n respond_to do |format|\n if @data_pendidikan_agama_katolik.save\n format.html { redirect_to @data_pendidikan_agama_katolik, notice: 'Data pendidikan agama katolik was successfully created.' }\n format.json { render :show, status: :created, location: @data_pendidikan_agama_katolik }\n else\n format.html { render :new }\n format.json { render json: @data_pendidikan_agama_katolik.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @german_go_leagues = GermanGoLeague.all\n\t\t@title = \"Bundesliga Spiele\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @german_go_leagues }\n end\n end", "def index\n @informasi_pengumuman = InformasiPengumuman.order(\"created_at DESC\").page(params[:daftar_informasi_pengumuman_page]).per(6)\n end", "def tout\n #propriétaire\n \n # Block execution if there is no current user\n if(current_user.blank?)\n return render json:{\n errors: \"true\",\n message: \"User not connected\"\n }, status: 401\n end\n\n user = current_user\n logements = Logement.where(user_id: user)\n tarif = []\n #================ propriétaire =====================\n logements.each do |logement|\n tarif << {logement:logement,tarif:logement.calendrier,photo:\"#{logement.photos.first.photo}\",promotion:logement.promotions}\n end\n \n #================= cogestion ============\n logcngestions = Logement.all\n logcngestions.each do |logcogestion|\n if logcogestion.user != user && logcogestion.cogestion.present?\n if logcogestion.cogestion.include?(user.id)\n tarif << {logement:logcogestion,tarif:logcogestion.calendrier,photo:\"#{logcogestion.photos.first.photo}\",promotion:logcogestion.promotions}\n end\n end\n end\n \n render json:{\n tarif:tarif\n } \n end", "def show\n @kanji = Kanji.find(params[:id])\n @kanji_readings = @kanji.get_sorted_readings\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @kanji }\n end\n end", "def show\n @lbaa = Lbaa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lbaa }\n end\n end", "def show\n @litra = Litra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @litra }\n end\n end", "def show\n @imp_raman = ImpRaman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imp_raman }\n end\n end", "def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end", "def index\n render json: { \"Exercice Technique\" => \"Transporter Organizations Colisweb backend developer exercise\", \"Poste visé\" => \"Développeur Back Ruby, Alternance\", \"Candidat\" => \"Gressier Jimmy\"}\n end", "def show\n @loja = Loja.find(params[:id])\n\n\n\n @json = Loja.find(params[:id]).to_gmaps4rails\n @loja_concorrencia = LojaConcorrencium.all\n @outdoors = Outdoor.all\n @local_desportivo = LocalDesportivo.all\n\n @todos = Outdoor.all + Loja.all + Outro.all + LocalDesportivo.all + LojaConcorrencium.all\n\n @json = @todos.to_gmaps4rails\n\n @zone2 = Loja.first.latitude\n @zone1 = Loja.first.longitude\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loja }\n end\n end", "def show\n @vodka = Vodka.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vodka }\n end\n end", "def show\n @diaoboshang = Diaoboshang.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diaoboshang }\n end\n end" ]
[ "0.69260585", "0.6537066", "0.6405912", "0.63501394", "0.6334183", "0.6253596", "0.6247635", "0.6206109", "0.61929625", "0.6157312", "0.61137056", "0.60862976", "0.60839856", "0.60523677", "0.60357934", "0.59848934", "0.5962379", "0.5947529", "0.5932273", "0.59098387", "0.58942944", "0.5885813", "0.58809966", "0.58802664", "0.5875252", "0.587517", "0.58702177", "0.5858615", "0.5850999", "0.5837321", "0.5829236", "0.58218557", "0.5821117", "0.58164716", "0.5815619", "0.58138794", "0.5813106", "0.5805793", "0.5797582", "0.57956344", "0.57865393", "0.57809645", "0.5763484", "0.57584333", "0.57512456", "0.5746619", "0.57385373", "0.5728698", "0.5728379", "0.5726703", "0.57201225", "0.5716267", "0.57148564", "0.57090396", "0.5708328", "0.57076067", "0.57073444", "0.57060647", "0.57044315", "0.56911755", "0.56734353", "0.5664783", "0.5663794", "0.56615573", "0.56568694", "0.56518275", "0.5649527", "0.5645663", "0.56418806", "0.56412596", "0.5639299", "0.56361866", "0.56274074", "0.5620084", "0.56197643", "0.5613518", "0.5608598", "0.560723", "0.5606937", "0.5603447", "0.5598123", "0.55869687", "0.5584499", "0.55841786", "0.55840945", "0.5583936", "0.5581831", "0.5580375", "0.5572028", "0.5570114", "0.5565298", "0.55646867", "0.5560973", "0.5560218", "0.55586874", "0.5552682", "0.5549746", "0.55481637", "0.5548015", "0.5547916" ]
0.7205009
0
GET /laporan_guru_agama_katolik/1 GET /laporan_guru_agama_katolik/1.json
def show @pengguna = current_pengguna end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.order(\"created_at DESC\").page(params[:daftar_laporan_guru_agama_katolik_page]).per(6)\n end", "def set_laporan_guru_agama_katolik\n @laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.find(params[:id])\n end", "def show\n @kansei_buhin = KanseiBuhin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kansei_buhin }\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 show\n @kolegiji = Kolegiji.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegiji }\n end\n end", "def show\n @kolegij = Kolegij.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegij }\n end\n end", "def show\n render json: @lugar\n end", "def show\n @kisalli = Kisalli.find_by_key(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kisalli }\n end\n end", "def index\n @data_pendidikan_agama_katolik = DataPendidikanAgamaKatolik.order(\"created_at DESC\").page(params[:daftar_data_pendidikan_agama_katolik_page]).per(6)\n end", "def create\n @laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.new(laporan_guru_agama_katolik_params)\n @laporan_guru_agama_katolik.pengguna_id = current_pengguna.id\n\n respond_to do |format|\n if @laporan_guru_agama_katolik.save\n format.html { redirect_to @laporan_guru_agama_katolik, notice: 'Laporan guru agama katolik was successfully created.' }\n format.json { render :show, status: :created, location: @laporan_guru_agama_katolik }\n else\n format.html { render :new }\n format.json { render json: @laporan_guru_agama_katolik.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format| \n format.json { render json: @giang_vien }\n end\n end", "def show\n render json: @grupoassunto\n end", "def show\n @pengeluaran_bulanan = PengeluaranBulanan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pengeluaran_bulanan }\n end\n end", "def index\n @kraje = Kraj.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kraje }\n end\n end", "def show\n @lich_su_binh_bau = LichSuBinhBau.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lich_su_binh_bau }\n end\n end", "def show\n # @kokyaku = Kokyaku.find(params[:id])\n @kokyaku = Kokyaku.find(:first, :conditions => {:kokyakuId => params[:id], :delFlg => 0})\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kokyaku }\n end\n end", "def index\n @data_keagamaan_katolik = DataKeagamaanKatolik.all\n end", "def show\n @kullanici = Kullanici.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kullanici }\n end\n end", "def show\n\tadd_breadcrumb \"Datos de la librería\", :librerias_path\n @libreria = Libreria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @libreria }\n end\n end", "def show\n @nguoi_dung = NguoiDung.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nguoi_dung }\n end\n end", "def show\n @kalplan_tltle = KalplanTltle.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kalplan_tltle }\n end\n end", "def show\n @lugar = Lugar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lugar }\n end\n end", "def laporan_guru_agama_katolik_params\n params.require(:laporan_guru_agama_katolik).permit(:judul, :tautan, :pengguna_id)\n end", "def show\n \n @tarih = Takvim.all\n\n # var olan kodlar\n @odeme_akademist = Odeme::Akademist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odeme_akademist }\n end\n end", "def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end", "def show\n @bahan = Bahan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bahan }\n end\n end", "def show\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @koti }\n end\n end", "def index\n @himalayas ||= Himalaya.limit(10).order('id desc')\n @descuentos ||= Descuento.limit(10).order('id desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end", "def show\n @grupo_biblico = GrupoBiblico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grupo_biblico }\n end\n end", "def new\n @kisalli = Kisalli.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kisalli }\n end\n end", "def show\n @jamaat = Jamaat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jamaat }\n end\n end", "def index\n @kifus = Kifu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kifus }\n end\n end", "def show\n @partecipanti_gruppo = PartecipantiGruppo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partecipanti_gruppo }\n end\n end", "def gabarra\n respond_to do |format|\n begin\n @gabarra = DescargaBauxita.descargar(params)\n format.json { render :json => @gabarra }\n rescue Exceptions::PresenciaValoresExcepcion => errores\n format.json { render :json => errores.errors, :status => 400 }\n end\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 show\n @buchung = Buchung.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @buchung }\n end\n end", "def show\n\tadd_breadcrumb \"Datos del libro\", :libro_path\n @libro = Libro.find(params[:id])\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @libro }\n end\n end", "def show\n @sotrudniki = Sotrudniki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sotrudniki }\n end\n end", "def show\n @penjualan_bahan = PenjualanBahan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @penjualan_bahan }\n end\n end", "def show\n \n respond_to do |format|\n format.html\n #format.json {render json: @jiras}\n\n end\n end", "def show\n @nhan_xet = NhanXet.where(:chi_tiet_binh_bau_id => params[:id])\n\n respond_to do |format|\n format.json { render json: @nhan_xet.collect{|i| {:NoiDung => i.NoiDung, :created_at =>i.created_at.strftime(\"Ngày %d/%m/%Y lúc %H:%M\"), :MaUser => i.user.MaUser,:TenUser => i.user.HoTen, :TenTruong => i.truong.TenTruong}} }\n end\n end", "def index \n @lancamentorapido = Lancamentorapido.new \n @lancamentorapidos = Lancamentorapido.all\n \n @categorias = Category.all\n @centrosdecusto = Centrodecusto.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lancamentorapidos }\n end\n end", "def index\n @lugars = Lugar.all\n\n render json: @lugars\n end", "def show\n @galeria = Galeria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @galeria }\n end\n end", "def index\n @himalayas = Himalaya.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end", "def new\n @kansei_buhin = KanseiBuhin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kansei_buhin }\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 @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def show \n est = @establecimiento\n respond_to do |format|\n format.html\n format.json { \n\n if (params[:appkey].eql? appkey) #si el appkey es correcto\n render :json => {:nombre => @establecimiento.nombre, direccion: @establecimiento.direccion, :latitud => @establecimiento.latitud,\n :longitud => @establecimiento.longitud, :descripcion => @establecimiento.descripcion, :imagen => @establecimiento.foto.url(:small),\n :comentarios => @establecimiento.EstComentarios.map { |comentario| { :descripcion => comentario.descripcion, :usuario => comentario.usuario.nombre } } } \n\n else\n render json: {:error => \"No autorizado\"}\n end\n\n\n }\n end\n #No tiene restricciones, queda abierto para el API\n end", "def index\n seleccionarMenu(:juzgados)\n @juzgados = Juzgado.order(:ciudad_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @juzgados }\n end\n end", "def show\n @zayavka = Zayavka.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zayavka }\n end\n end", "def show\n @caballo = Caballo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caballo }\n end\n end", "def show\n \n @lancamentorapido = Lancamentorapido.find(params[:id])\n \n @categorias = Category.all\n @centrosdecusto = Centrodecusto.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lancamentorapido }\n end\n end", "def show\n @himalaya = Himalaya.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @himalaya }\n end\n end", "def show\n @zakaz = Zakaz.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zakaz }\n end\n end", "def show\n @bruger = Bruger.find_by_id(current_user.id)\n @onske = Onske.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @onske }\n end\n end", "def index\n @flyer_infos = FlyerInfo.all(:select => \"id, topimg, sideimg, capacity, speed, stormresist, multiplier, price, tier, load_time, disabled\")\n @language = ApplicationHelper.preferred_language(request.headers[\"Accept-Language\"])\n\n @complete_flyers = @flyer_infos.collect { |flyer_info|\n flyer_info.as_json.merge(FlyerInfosHelper.getflyerloc(flyer_info, @language).first.as_json)\n }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @complete_flyers }\n end\n end", "def index\n # Block execution if there is no current user\n if(current_user.blank?)\n return render json:{\n errors: \"true\",\n message: \"User not connected\"\n }, status: 401\n end\n\n user = User.find(current_user.id)\n logement = Logement.find_by(id:params[:logement_id])\n bain_demi = BainDemi.find_by(logement_id: params[:logement_id])\n bain_entier = BainEntier.find_by(logement_id: params[:logement_id])\n cuisine = Cuisine.find_by(logement_id: params[:logement_id])\n kit= Kitchenette.find_by(logement_id: params[:logement_id])\n\n \n render json:{\n bain_demi:bain_demi, bain_entier:bain_entier, cuisine:cuisine, kit:kit\n }\n end", "def show\n @hasil = Hasil.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hasil }\n end\n end", "def show\n @ultimo_grado_de_estudio = UltimoGradoDeEstudio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ultimo_grado_de_estudio }\n end\n end", "def show\n @project_tak = ProjectTak.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project_tak }\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 index\n @jalans = Jalan.all\n @lokasis = Rute.select(\"id_jalan\").uniq\n end", "def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end", "def show\n @karteikarte = Karteikarte.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @karteikarte }\n end\n end", "def show\n @imp2_raman = Imp2Raman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imp2_raman }\n end\n end", "def show\n @litra = Litra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @litra }\n end\n end", "def show\n @pichanga = Pichanga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pichanga }\n end\n end", "def show\n @sala = Sala.find(params[:id])\n\n render json: @sala, root: \"data\", include: '**', adapter: :json, status: :ok\n end", "def show\n @loja = Loja.find(params[:id])\n\n\n\n @json = Loja.find(params[:id]).to_gmaps4rails\n @loja_concorrencia = LojaConcorrencium.all\n @outdoors = Outdoor.all\n @local_desportivo = LocalDesportivo.all\n\n @todos = Outdoor.all + Loja.all + Outro.all + LocalDesportivo.all + LojaConcorrencium.all\n\n @json = @todos.to_gmaps4rails\n\n @zone2 = Loja.first.latitude\n @zone1 = Loja.first.longitude\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loja }\n end\n end", "def show\n @diaoboshang = Diaoboshang.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diaoboshang }\n end\n end", "def index\n @kalos = Kalo.all\n end", "def index\n @laporan_kinerja_pegawai_bimkat_sumteng = LaporanKinerjaPegawaiBimkatSumteng.all\n end", "def show\n @vodka = Vodka.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vodka }\n end\n end", "def index\n if session[:kunde_id] == nil\n @buchungs = Buchung.all\n else\n @buchungs = Buchung.find(:all, :conditions => ['kunde_id = ?',session[:kunde_id]], :order =>\"anfangszeit ASC\") \n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @buchungs }\n end\n end", "def index\n @ultimo_grado_de_estudios = UltimoGradoDeEstudio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ultimo_grado_de_estudios }\n end\n end", "def show\n @natulang = Natulang.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @natulang }\n end\n end", "def index\n #@imovels = Imovel.all\n \n #Traz apenas os imoveis ativos\n # Isso vai no controller do cliente. Só os ativos aparecem\n #@imovels = Imovel.all.select { |i| i.ativo == true }\n \n @imovels = Imovel.paginate :page => params[:page], :order => 'created_at DESC', :per_page => 10\n \n # Mapa para guardar os valores das transacoes associadas a cada imovel.\n # key: imovel_id, value: lista com [0]:transacao, [1]: tipos, [2] responsavel\n @hash_informacoes_imoveis = Hash.new\n \n @imovels.each do |imovel|\n popular_imovel(imovel)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imovels }\n end\n end", "def show\n @guille = Guille.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guille }\n end\n end", "def show\n @lokasis = Rute.select(\"id_jalan\").uniq\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 @indicativo = Indicativo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicativo }\n end\n end", "def show\n @anuncio= set_anuncio\n render json: @anuncio, status: :ok\n end", "def show\n @kazoku = Kazoku.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @kazoku }\n end\n end", "def new\n @kolegiji = Kolegiji.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kolegiji }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @himalaya }\n end\n end", "def index\n @formatos = Formato.where(ativo: true)\n \t\n render json: @formatos\n end", "def index\n @grupos = Grupo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @grupos }\n end\n end", "def show\n @kraj = Kraj.includes(:miejsca=>[{:terminy=>:dzien},:grupy,:kraj]).find(params[:id])\n\t\t@miejsca = params[:dzien]? Miejsce.w_dniu_dla_kraju(params[:dzien],@kraj) : Miejsce.where(:kraj_id=>params[:id]).order(\"nazwa\").includes(:kraj ,:grupy,:terminy=>[:dzien])\n @json = @miejsca.to_gmaps4rails do |miejsce, marker|\n marker.infowindow render_to_string(:partial => \"miejsca/info_window\", :object => miejsce)\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kraj }\n end\n end", "def show\n @foto_galeri = FotoGaleri.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foto_galeri }\n end\n end", "def show\n @lbaa = Lbaa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lbaa }\n end\n end", "def show\n #@stanza = Stanza.find(params[:id])\n #@stanza = Stanza.where(:stanzno=>params[:id])\n @stanza = Stanza.find_by_no(params[:id]) || not_found\n logger.info @stanza\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stanza }\n end\n end", "def show\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @juzgado }\n end\n end", "def show\n @imp_raman = ImpRaman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imp_raman }\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 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 index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end", "def show\n @sklad = Sklad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sklad }\n end\n end", "def show\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asignatura }\n end\n end", "def show\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asignatura }\n end\n end", "def index\n @categorias = Categoria.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 => @categorias }\n end\n end" ]
[ "0.7103911", "0.6802757", "0.6531669", "0.64477026", "0.63899577", "0.6389182", "0.6381669", "0.63721967", "0.63647383", "0.63262075", "0.6312964", "0.6304024", "0.62825996", "0.6256775", "0.6192643", "0.6178175", "0.61738414", "0.6159612", "0.614342", "0.6139118", "0.61326444", "0.6129778", "0.61295", "0.6124793", "0.6124288", "0.61030555", "0.6102453", "0.60873467", "0.60819185", "0.6074242", "0.60528326", "0.60518885", "0.60356605", "0.6034321", "0.6033857", "0.6033684", "0.6022883", "0.6021593", "0.6018831", "0.601611", "0.6013878", "0.6006495", "0.6006156", "0.5974959", "0.5974141", "0.5962001", "0.5956488", "0.59472334", "0.5940076", "0.5935979", "0.59196866", "0.5909236", "0.59088796", "0.58928555", "0.58915764", "0.58904564", "0.5884238", "0.5883414", "0.5874993", "0.5872827", "0.58718926", "0.5869681", "0.58684504", "0.586845", "0.5865615", "0.5864332", "0.58635026", "0.5863341", "0.585964", "0.5859361", "0.5855653", "0.5849737", "0.5847812", "0.5844732", "0.5842453", "0.58414847", "0.5836526", "0.5830305", "0.58242965", "0.58228135", "0.5822619", "0.5820871", "0.58194953", "0.5814406", "0.58109707", "0.58090603", "0.5808765", "0.58072627", "0.5804346", "0.580308", "0.5800094", "0.5795661", "0.57956463", "0.5794538", "0.5793958", "0.57927865", "0.5789062", "0.5787385", "0.5786953", "0.5786953", "0.5784561" ]
0.0
-1
POST /laporan_guru_agama_katolik POST /laporan_guru_agama_katolik.json
def create @laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.new(laporan_guru_agama_katolik_params) @laporan_guru_agama_katolik.pengguna_id = current_pengguna.id respond_to do |format| if @laporan_guru_agama_katolik.save format.html { redirect_to @laporan_guru_agama_katolik, notice: 'Laporan guru agama katolik was successfully created.' } format.json { render :show, status: :created, location: @laporan_guru_agama_katolik } else format.html { render :new } format.json { render json: @laporan_guru_agama_katolik.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def laporan_guru_agama_katolik_params\n params.require(:laporan_guru_agama_katolik).permit(:judul, :tautan, :pengguna_id)\n end", "def create\n @data_pendidikan_agama_katolik = DataPendidikanAgamaKatolik.new(data_pendidikan_agama_katolik_params)\n @data_pendidikan_agama_katolik.pengguna_id = current_pengguna.id\n \n respond_to do |format|\n if @data_pendidikan_agama_katolik.save\n format.html { redirect_to @data_pendidikan_agama_katolik, notice: 'Data pendidikan agama katolik was successfully created.' }\n format.json { render :show, status: :created, location: @data_pendidikan_agama_katolik }\n else\n format.html { render :new }\n format.json { render json: @data_pendidikan_agama_katolik.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_laporan_guru_agama_katolik\n @laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.find(params[:id])\n end", "def create\n @data_keagamaan_katolik.user_id = current_user.id\n\n respond_to do |format|\n if @data_keagamaan_katolik.save\n format.html { redirect_to @data_keagamaan_katolik, notice: 'Data keagamaan katolik was successfully created.' }\n format.json { render :show, status: :created, location: @data_keagamaan_katolik }\n else\n format.html { render :new }\n format.json { render json: @data_keagamaan_katolik.errors, status: :unprocessable_entity }\n end\n end\n end", "def data_keagamaan_katolik_params\n params.require(:data_keagamaan_katolik).permit(:judul, :keterangan, :tautan, :user_id)\n end", "def data_pendidikan_agama_katolik_params\n params.require(:data_pendidikan_agama_katolik).permit(:judul, :keterangan, :tautan, :pengguna_id)\n end", "def create\n @kakiko = Kakiko.new(kakiko_params)#属性を設定してモデルオブジェクトを生成\n @kakiko.user_id = current_user.id#user_id属性を追加\n @kakiko.tag = params[:kakiko][:tag]\n @kakiko.name = params[:kakiko][:name]\n if @kakiko.save#saveしないといくら追加したところで意味がない\n #renderでlocalhost:3000に返す \n render json: @kakiko, status: :created, location: @kakiko\n else\n render json: @kakiko.errors, status: :unprocessable_entity\n end\n end", "def create\n# return\n @kisalli = Kisalli.new(params[:kisalli])\n\n respond_to do |format|\n if @kisalli.save\n format.html { redirect_to kisalli_path(@kisalli.key), notice: 'Kiitos mielenkiinnosta. Hakemuksesi on tallennettu.' }\n format.json { render json: @kisalli, status: :created, location: @kisalli }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kisalli.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @laporan_kinerja_pegawai_bimkat_sumteng = LaporanKinerjaPegawaiBimkatSumteng.new(laporan_kinerja_pegawai_bimkat_sumteng_params)\n\n respond_to do |format|\n if @laporan_kinerja_pegawai_bimkat_sumteng.save\n format.html { redirect_to @laporan_kinerja_pegawai_bimkat_sumteng, notice: 'Laporan kinerja pegawai bimkat sumteng telah berhasil dibuat.' }\n format.json { render :show, status: :created, location: @laporan_kinerja_pegawai_bimkat_sumteng }\n else\n format.html { render :new }\n format.json { render json: @laporan_kinerja_pegawai_bimkat_sumteng.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lokasis = Rute.select(\"id_jalan\").uniq\n @jalan = Jalan.new(jalan_params)\n\n respond_to do |format|\n if @jalan.save\n format.html { redirect_to @jalan, notice: \"Jalan was successfully created.\" }\n format.json { render :show, status: :created, location: @jalan }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @jalan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kalo = Kalo.new(kalo_params)\n\n respond_to do |format|\n if @kalo.save\n format.html { redirect_to @kalo, notice: 'Kalo was successfully created.' }\n format.json { render :show, status: :created, location: @kalo }\n else\n format.html { render :new }\n format.json { render json: @kalo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @laporan_guru_agama_katolik.update(laporan_guru_agama_katolik_params)\n format.html { redirect_to @laporan_guru_agama_katolik, notice: 'Laporan guru agama katolik was successfully updated.' }\n format.json { render :show, status: :ok, location: @laporan_guru_agama_katolik }\n else\n format.html { render :edit }\n format.json { render json: @laporan_guru_agama_katolik.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kansei_buhin = KanseiBuhin.new(params[:kansei_buhin])\n\n respond_to do |format|\n if @kansei_buhin.save\n format.html { redirect_to @kansei_buhin, notice: 'Kansei buhin was successfully created.' }\n format.json { render json: @kansei_buhin, status: :created, location: @kansei_buhin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kansei_buhin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @koran = Koran.new(koran_params)\n\n respond_to do |format|\n if @koran.save\n format.html { redirect_to @koran, notice: 'Koran was successfully created.' }\n format.json { render :show, status: :created, location: @koran }\n else\n format.html { render :new }\n format.json { render json: @koran.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_digersayfa = Admin::Digersayfa.new(admin_digersayfa_params)\n @turad = { 0 => \"Bilim İnsanları\", 1 => \"Resmi Evraklar\", 2 => \"İlginç Bilgiler\", 3 => \"Motivasyon\", 4 => \"Sınav Sistemi\"}\n @tur = { 0 => \"biliminsanlari\", 1 => \"resmievraklar\", 2 => \"ilgincbilgiler\", 3 => \"motivasyon\", 4 => \"sinavsistemi\"}\n\n respond_to do |format|\n if @admin_digersayfa.save\n Admin::Duyuru.create(aciklama: @admin_digersayfa.created_at.to_s.split(\" \")[0] + \" \" + @turad[@admin_digersayfa.tur] + \" \" + @admin_digersayfa.baslik + \" yazısı eklenmiştir.<a href=/\" + @tur[@admin_digersayfa.tur] + \"> Yazıya ulaşmak için tıklayınız. </a>\", tur: 0)\n format.html { redirect_to @admin_digersayfa, notice: 'Yazı başarılı bir şekilde oluşturuldu.' }\n format.json { render :show, status: :created, location: @admin_digersayfa }\n else\n format.html { render :new }\n format.json { render json: @admin_digersayfa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @aplikasi = Aplikasi.new(aplikasi_params)\n\n respond_to do |format|\n if @aplikasi.save\n format.html { redirect_to @aplikasi, notice: \"Aplikasi was successfully created.\" }\n format.json { render :show, status: :created, location: @aplikasi }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @aplikasi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @data_kejuaraan = DataKejuaraan.new(data_kejuaraan_params)\n @kegiatan = Kegiatan.select(@data_kejuaraan.kegiatan_id)\n \n respond_to do |format|\n if @data_kejuaraan.save\n format.html { redirect_to @data_kejuaraan, notice: 'Data kejuaraan was successfully created.' }\n format.json { render :show, status: :created, location: @data_kejuaraan }\n else\n format.html { render :new }\n format.json { render json: @data_kejuaraan.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.order(\"created_at DESC\").page(params[:daftar_laporan_guru_agama_katolik_page]).per(6)\n end", "def create\n @pakettipi = Pakettipi.new(pakettipi_params)\n\n \n if Pakettipi.exists?(paket_tipi: @pakettipi.paket_tipi, urunadi_id: @pakettipi.urunadi_id)\n flash[:notice] = \"Bu paket tipi zaten KAYITLI !!\"\n redirect_to new_pakettipi_path\n else\n respond_to do |format|\n if @pakettipi.save\n format.html { redirect_to pakettipis_path, notice:'Kayıt başarıyla oluşturuldu.' }\n format.json { render :show, status: :created, location: @pakettipi }\n else\n format.html { render :new }\n format.json { render json: @pakettipi.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @kennkoukiroku = Kennkoukiroku.new(kennkoukiroku_params)\n\n respond_to do |format|\n if @kennkoukiroku.save\n format.html { redirect_to @kennkoukiroku, notice: \"健康記録を追加しました\" }\n format.json { render :show, status: :created, location: @kennkoukiroku }\n else\n format.html { render :new }\n format.json { render json: @kennkoukiroku.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ra_khoi_dang = RaKhoiDang.new(ra_khoi_dang_params)\n\n respond_to do |format|\n if @ra_khoi_dang.save\n format.html { redirect_to @ra_khoi_dang, notice: 'Ra khoi dang was successfully created.' }\n format.json { render :show, status: :created, location: @ra_khoi_dang }\n else\n format.html { render :new }\n format.json { render json: @ra_khoi_dang.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kegiatan = Kegiatan.new(kegiatan_params)\n\n respond_to do |format|\n if @kegiatan.save\n format.html { redirect_to @kegiatan, notice: 'Kegiatan was successfully created.' }\n format.json { render :show, status: :created, location: @kegiatan }\n else\n format.html { render :new }\n format.json { render json: @kegiatan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #raise penduduk_params.to_yaml\n @penduduk = Penduduk.new(penduduk_params)\n @golongan_darahs = GolonganDarah.all\n @agamas = Agama.all\n @pekerjaans= Pekerjaan.all\n @status_keluargas = StatusKeluarga.all\n @pendidikans = Pendidikan.all\n @kelurahans = Kelurahan.all\n @kecamatans = Kecamatan.all\n @kabupatens = Kabupaten.all\n @penghasilans = Penghasilan.all \n respond_to do |format|\n if @penduduk.save\n format.html { redirect_to @penduduk, notice: 'Penduduk was successfully created.' }\n format.json { render :show, status: :created, location: @penduduk }\n else\n format.html { render :new }\n format.json { render json: @penduduk.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @klienci_jaskula = KlienciJaskula.new(klienci_jaskula_params)\n\n respond_to do |format|\n if @klienci_jaskula.save\n format.html { redirect_to @klienci_jaskula, notice: 'Klienci jaskula was successfully created.' }\n format.json { render :show, status: :created, location: @klienci_jaskula }\n else\n format.html { render :new }\n format.json { render json: @klienci_jaskula.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kniha = Kniha.new(kniha_params)\n\n respond_to do |format|\n if @kniha.save\n format.html { redirect_to @kniha, notice: 'Kniha was successfully created.' }\n format.json { render :show, status: :created, location: @kniha }\n else\n format.html { render :new }\n format.json { render json: @kniha.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @informasi_pengumuman = InformasiPengumuman.new(informasi_pengumuman_params)\n @informasi_pengumuman.pengguna_id = current_pengguna.id\n \n respond_to do |format|\n if @informasi_pengumuman.save\n format.html { redirect_to @informasi_pengumuman, notice: 'Informasi pengumuman was successfully created.' }\n format.json { render :show, status: :created, location: @informasi_pengumuman }\n else\n format.html { render :new }\n format.json { render json: @informasi_pengumuman.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @aki = Aki.new(aki_params)\n\n respond_to do |format|\n if @aki.save\n format.html { redirect_to @aki, notice: 'Aki was successfully created.' }\n format.json { render :show, status: :created, location: @aki }\n else\n format.html { render :new }\n format.json { render json: @aki.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kolegiji = Kolegiji.new(params[:kolegiji])\n\n respond_to do |format|\n if @kolegiji.save\n format.html { redirect_to @kolegiji, notice: 'Kolegiji was successfully created.' }\n format.json { render json: @kolegiji, status: :created, location: @kolegiji }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kolegiji.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jabatan = Jabatan.new(jabatan_params)\n\n respond_to do |format|\n if @jabatan.save\n format.html { redirect_to @jabatan, notice: 'Jabatan berhasil tersimpan.' }\n format.json { render :show, status: :created, location: @jabatan }\n else\n format.html { render :new }\n format.json { render json: @jabatan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kolegij = Kolegij.new(params[:kolegij])\n\n respond_to do |format|\n if @kolegij.save\n format.html { redirect_to @kolegij, notice: 'Kolegij was successfully created.' }\n format.json { render json: @kolegij, status: :created, location: @kolegij }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kolegij.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @penyata_kehadiran = PenyataKehadiran.new(penyata_kehadiran_params)\n\n respond_to do |format|\n if @penyata_kehadiran.save\n format.html { redirect_to @penyata_kehadiran, notice: 'Penyata kehadiran was successfully created.' }\n format.json { render :show, status: :created, location: @penyata_kehadiran }\n else\n format.html { render :new }\n format.json { render json: @penyata_kehadiran.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bakusokukun = Bakusokukun.new(bakusokukun_params)\n\n respond_to do |format|\n if @bakusokukun.save\n format.html { redirect_to @bakusokukun, notice: 'Bakusokukun was successfully created.' }\n format.json { render :show, status: :created, location: @bakusokukun }\n else\n format.html { render :new }\n format.json { render json: @bakusokukun.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kierownik = Kierownik.new(kierownik_params)\n\n respond_to do |format|\n if @kierownik.save\n format.html { redirect_to @kierownik, notice: 'Kierownik was successfully created.' }\n format.json { render :show, status: :created, location: @kierownik }\n else\n format.html { render :new }\n format.json { render json: @kierownik.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @klasa = Klasa.new(klasa_params)\n\n respond_to do |format|\n if @klasa.save\n format.html { redirect_to @klasa, notice: 'Klasa was successfully created.' }\n format.json { render :show, status: :created, location: @klasa }\n else\n format.html { render :new }\n format.json { render json: @klasa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tagihan = Tagihan.new(tagihan_params)\n\n respond_to do |format|\n if @tagihan.save\n format.html { redirect_to @tagihan, notice: 'Tagihan was successfully created.' }\n format.json { render :show, status: :created, location: @tagihan }\n else\n format.html { render :new }\n format.json { render json: @tagihan.errors, status: :unprocessable_entity }\n end\n end\n end", "def akun_params\n params.require(:akun).permit(:kode, :nama, :tipe_akun_id, :user_id)\n end", "def aplikasi_params\n params.require(:aplikasi).permit(:id_aplikasi, :kode, :nama_aplikasi, :deskripsi, :pemilik_proses, :default_version, :divisi, :status)\n end", "def kegiatan_params\n params.require(:kegiatan).permit(:nama_kegiatan, :tempat, :tgl, :biaya)\n end", "def create\n @zayavk = Zayavk.new(zayavk_params)\n\n respond_to do |format|\n if @zayavk.save\n format.html { redirect_to @zayavk, notice: 'Заявка была успешно создана.' }\n format.json { render :show, status: :created, location: @zayavk }\n else\n format.html { render :new }\n format.json { render json: @zayavk.errors, status: :unprocessable_entity }\n end\n end\n end", "def tagihan_params\n params.require(:tagihan).permit(:jumlah, :user_id, :status)\n end", "def set_data_pendidikan_agama_katolik\n @data_pendidikan_agama_katolik = DataPendidikanAgamaKatolik.find(params[:id])\n end", "def create\n @kai2_Kai2Tuan7 = Kai2Tuan7.new(kai2_Kai2Tuan7_params)\n\n respond_to do |format|\n if @kai2_Kai2Tuan7.save\n format.html { redirect_to @kai2_Kai2Tuan7, notice: 'Kai2 Kai2Tuan7 was successfully created.' }\n format.json { render action: 'show', status: :created, location: @kai2_Kai2Tuan7 }\n else\n format.html { render action: 'new' }\n format.json { render json: @kai2_Kai2Tuan7.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cetak_blok = CetakBlok.new(cetak_blok_params)\n\n respond_to do |format|\n if @cetak_blok.save\n format.html { redirect_to cetak_bloks_url, notice: 'Cetak blok was successfully created.' }\n format.json { render :show, status: :created, location: @cetak_blok }\n else\n format.html { render :new }\n format.json { render json: @cetak_blok.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pracownik = Pracownik.new(pracownik_params)\n\n respond_to do |format|\n if @pracownik.save\n format.html { redirect_to @pracownik, notice: 'Pracownik was successfully created.' }\n format.json { render :show, status: :created, location: @pracownik }\n else\n format.html { render :new }\n format.json { render json: @pracownik.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gigapan = Gigapan.new(gigapan_params)\n\n respond_to do |format|\n if @gigapan.save\n format.html { redirect_to @gigapan, notice: 'Gigapan was successfully created.' }\n format.json { render :show, status: :created, location: @gigapan }\n else\n format.html { render :new }\n format.json { render json: @gigapan.errors, status: :unprocessable_entity }\n end\n end\n end", "def data_ukt_params\n params.require(:data_ukt).permit(:periode, :sabuk_putih, :sabuk_kuning_polos, :sabuk_kuning_strip, :sabuk_hijau_polos, :sabuk_hijau_strip, :sabuk_biru_polos, :sabuk_biru_strip, :sabuk_merah_polos, :sabuk_merah_strip_satu, :sabuk_merah_strip_dua, :jumlah)\n end", "def walikela_params\n params.require(:walikela).permit(:tahun_ajaran, :kela_id, :guru_id)\n end", "def create\n @kelurahan = Kelurahan.new(kelurahan_params)\n\n respond_to do |format|\n if @kelurahan.save\n format.html { redirect_to @kelurahan, notice: 'kelurahan berhasil tersimpan' }\n format.json { render :show, status: :created, location: @kelurahan }\n else\n format.html { render :new }\n format.json { render json: @kelurahan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pegawai = Pegawai.new(pegawai_params)\n\n respond_to do |format|\n if @pegawai.save\n format.html { redirect_to @pegawai, notice: 'Pegawai berhasil tersimpan.' }\n format.json { render :show, status: :created, location: @pegawai }\n else\n format.html { render :new }\n format.json { render json: @pegawai.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kumo = Kumo.new(kumo_params)\n\n respond_to do |format|\n if @kumo.save\n format.html { redirect_to kumos_path, notice: 'Kumo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @kumo }\n else\n format.html { render action: 'new' }\n format.json { render json: @kumo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@pasien = Pasien.find(params[:pasien_id])\n #@hasil = @pasien.hasils.create(params[:hasil])\n #redirect_to pasien_path(@post)\n @hasil = Hasil.create(params[:hasil])\n\n respond_to do |format|\n if @hasil.save\n format.html { redirect_to @hasil, notice: 'Hasil was successfully created.' }\n format.json { render json: @hasil, status: :created, location: @hasil }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hasil.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kontrahenci = Kontrahenci.new(kontrahenci_params)\n @opiekun = Opiekun.select(\"id,login\")\n \n respond_to do |format|\n if @kontrahenci.save\n format.html { redirect_to @kontrahenci, notice: 'Kontrahenci został stworzony.' }\n format.json { render :show, status: :created, location: @kontrahenci }\n else\n format.html { render :new }\n format.json { render json: @kontrahenci.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kategori_tindakan_penunjang = KategoriTindakanPenunjang.new(params[:kategori_tindakan_penunjang])\n\n respond_to do |format|\n if @kategori_tindakan_penunjang.save\n format.html { redirect_to(:action => \"new\", :notice => CREATE_MSG) }\n format.xml { render :xml => @kategori_tindakan_penunjang, :status => :created, :location => @kategori_tindakan_penunjang }\n else\n @cancel_url = request.fullpath+\"/new\"\n format.html { render :action => \"new\" }\n format.xml { render :xml => @kategori_tindakan_penunjang.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @rodzaj_pracownika = RodzajPracownika.new(rodzaj_pracownika_params)\n\n respond_to do |format|\n if @rodzaj_pracownika.save\n format.html { redirect_to @rodzaj_pracownika, notice: 'Rodzaj pracownika was successfully created.' }\n format.json { render :show, status: :created, location: @rodzaj_pracownika }\n else\n format.html { render :new }\n format.json { render json: @rodzaj_pracownika.errors, status: :unprocessable_entity }\n end\n end\n end", "def penyata_kehadiran_params\n params.require(:penyata_kehadiran).permit(:tarikh, :masamula, :masatamat)\n end", "def create\n # @katbib2 = Katbib2.new(katbib2_params)\n @katbib2 = Katbib2.find_or_create_by(name: katbib2_params[:name] )\n respond_to do |format|\n if @katbib2.save\n format.html {redirect_to :action => 'index', notice: 'Категория успешно создана.' }\n format.json { render :index, status: :created }\n else\n format.html { render :new }\n format.json { render json: @katbib2.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pengeluaran_bulanan = PengeluaranBulanan.new(params[:pengeluaran_bulanan])\n\n respond_to do |format|\n if @pengeluaran_bulanan.save\n format.html { redirect_to @pengeluaran_bulanan, notice: 'Pengeluaran bulanan was successfully created.' }\n format.json { render json: @pengeluaran_bulanan, status: :created, location: @pengeluaran_bulanan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pengeluaran_bulanan.errors, status: :unprocessable_entity }\n end\n end\n end", "def gosok_params\n params.require(:gosok).permit(:rendam_id , :hasil, :rusak, :keterangan)\n end", "def create\n @giang_vien = GiangVien.new(params[:giang_vien])\n\n respond_to do |format|\n if @giang_vien.save \n format.json { render json: @giang_vien, status: :created, location: @giang_vien }\n else \n format.json { render json: @giang_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kiban = Kiban.new(kiban_params)\n @Maker= MakerDeadline.find_by(メーカー: @kiban.メーカー)\n @approaching_deadline = (@kiban.最終注文日 + (@Maker.期限*365) - Date.today).to_i\n @kiban.経過日 = @approaching_deadline;\n respond_to do |format|\n if @kiban.save\n format.html { redirect_to @kiban, notice: 'Kiban was successfully created.' }\n format.json { render :show, status: :created, location: @kiban }\n else\n format.html { render :new}\n format.json { render json: @kiban.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @aplikace = Aplikace.new(aplikace_params)\n respond_to do |format|\n if @aplikace.save\n format.html { redirect_to @aplikace, notice: 'Aplikace was successfully created.' }\n format.json { render :show, status: :created, location: @aplikace }\n else\n format.html { render :new }\n format.json { render json: @aplikace.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kehadiran = Kehadiran.new(kehadiran_params)\n\n respond_to do |format|\n if @kehadiran.save\n format.html { redirect_to @kehadiran, notice: 'Kehadiran was successfully created.' }\n format.json { render :show, status: :created, location: @kehadiran }\n else\n format.html { render :new }\n format.json { render json: @kehadiran.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @kisalli = Kisalli.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kisalli }\n end\n end", "def create\n @kullanici = Kullanici.new(params[:kullanici])\n\n respond_to do |format|\n if @kullanici.save\n format.html { redirect_to @kullanici, notice: 'Kullanici was successfully created.' }\n format.json { render json: @kullanici, status: :created, location: @kullanici }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kullanici.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @kansei_buhin = KanseiBuhin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kansei_buhin }\n end\n end", "def create\n @imakoko = Imakoko.new(imakoko_params)\n\n respond_to do |format|\n if @imakoko.save\n format.html { redirect_to @imakoko, notice: 'Imakoko was successfully created.' }\n format.json { render :show, status: :created, location: @imakoko }\n else\n format.html { render :new }\n format.json { render json: @imakoko.errors, status: :unprocessable_entity }\n end\n end\n end", "def koran_params\n params[:koran].permit(:name, :image, :website, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday)\n # params[:koran]\n end", "def create\n @koszyk = Koszyk.new(koszyk_params)\n\n respond_to do |format|\n if @koszyk.save\n format.html { redirect_to @koszyk, notice: 'Koszyk was successfully created.' }\n format.json { render :show, status: :created, location: @koszyk }\n else\n format.html { render :new }\n format.json { render json: @koszyk.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shujukusqlguanli = Shujukusqlguanli.new(shujukusqlguanli_params)\n\n respond_to do |format|\n if @shujukusqlguanli.save\n format.html { redirect_to @shujukusqlguanli, notice: 'Shujukusqlguanli was successfully created.' }\n format.json { render :show, status: :created, location: @shujukusqlguanli }\n else\n format.html { render :new }\n format.json { render json: @shujukusqlguanli.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kai2_ji7 = Kai2Ji7.new(kai2_ji7_params)\n\n respond_to do |format|\n if @kai2_ji7.save\n format.html { redirect_to @kai2_ji7, notice: 'Kai2 ji7 was successfully created.' }\n format.json { render action: 'show', status: :created, location: @kai2_ji7 }\n else\n format.html { render action: 'new' }\n format.json { render json: @kai2_ji7.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sotrudniki = Sotrudniki.new(params[:sotrudniki])\n\n respond_to do |format|\n if @sotrudniki.save\n format.html { redirect_to @sotrudniki, notice: 'Sotrudniki was successfully created.' }\n format.json { render json: @sotrudniki, status: :created, location: @sotrudniki }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sotrudniki.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pendaftaran_kela = PendaftaranKela.new(pendaftaran_kela_params)\n\n respond_to do |format|\n if @pendaftaran_kela.save\n format.html { redirect_to @pendaftaran_kela, notice: 'Pendaftaran kela was successfully created.' }\n format.json { render :show, status: :created, location: @pendaftaran_kela }\n else\n format.html { render :new }\n format.json { render json: @pendaftaran_kela.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @uang_masuk = UangMasuk.new(uang_masuk_params)\n\n respond_to do |format|\n if @uang_masuk.save\n format.html { redirect_to uang_masuks_path, notice: 'Uang masuk was successfully created.' }\n else\n format.html { render :new }\n format.json { render json: @uang_masuk.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gakunenn = Gakunenn.new(gakunenn_params)\n\n respond_to do |format|\n if @gakunenn.save\n format.html { redirect_to @gakunenn, notice: \"学年を追加しました\" }\n format.json { render :show, status: :created, location: @gakunenn }\n else\n format.html { render :new }\n format.json { render json: @gakunenn.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kadai = Kadai.new(kadai_params)\n\n respond_to do |format|\n if @kadai.save\n format.html { redirect_to @kadai, notice: 'Kadai was successfully created.' }\n format.json { render :show, status: :created, location: @kadai }\n else\n format.html { render :new }\n format.json { render json: @kadai.errors, status: :unprocessable_entity }\n end\n end\n end", "def pegawai_params\n params.require(:pegawai).permit(:nama_pegawai, :nip, :bidang_id, :seksi_id, :jabatan_id, :golongan_id, :filter)\n end", "def create\n @leccion_kanji = LeccionKanji.new(leccion_kanji_params)\n\n respond_to do |format|\n if @leccion_kanji.save\n format.html { redirect_to @leccion_kanji, notice: 'Leccion kanji was successfully created.' }\n format.json { render :show, status: :created, location: @leccion_kanji }\n else\n format.html { render :new }\n format.json { render json: @leccion_kanji.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @leccion_hiragana = LeccionHiragana.new(leccion_hiragana_params)\n\n respond_to do |format|\n if @leccion_hiragana.save\n format.html { redirect_to @leccion_hiragana, notice: 'Leccion hiragana was successfully created.' }\n format.json { render :show, status: :created, location: @leccion_hiragana }\n else\n format.html { render :new }\n format.json { render json: @leccion_hiragana.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kontak = Kontak.new(params[:kontak])\n\n respond_to do |format|\n if @kontak.save\n flash[:peringatan] = 'Kontak was successfully created.'\n format.html { redirect_to :action => \"index\"}\n format.xml { render :xml => @kontak, :status => :created, :location => @kontak }\n else\n format.html { render :action => \"index\" }\n format.xml { render :xml => @kontak.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @kullanici = Kullanici.new(kullanici_params)\n\n respond_to do |format|\n if @kullanici.save\n format.html { redirect_to @kullanici, notice: 'Kullanici was successfully created.' }\n format.json { render :show, status: :created, location: @kullanici }\n else\n format.html { render :new }\n format.json { render json: @kullanici.errors, status: :unprocessable_entity }\n end\n end\n end", "def kniha_params\n params.require(:kniha).permit(:nazev, :autor_id, :zanr_id, :isbn, :nakladatelstvi_id, :pocet_stran, :vydani, :rozmer, :rok_vydani, :vazba, :cena, :poznamka, :popis, :koupeno, :ziskano)\n end", "def create\n @grupo_analise = GrupoAnalise.new(grupo_analise_params)\n\n respond_to do |format|\n if @grupo_analise.save\n format.html { redirect_to @grupo_analise, notice: 'Grupo analise was successfully created.' }\n format.json { render :show, status: :created, location: @grupo_analise }\n else\n format.html { render :new }\n format.json { render json: @grupo_analise.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @data_pendidikan_agama_katolik = DataPendidikanAgamaKatolik.order(\"created_at DESC\").page(params[:daftar_data_pendidikan_agama_katolik_page]).per(6)\n end", "def create\n @keiyaku = Keiyaku.new(keiyaku_params)\n\n respond_to do |format|\n if @keiyaku.save\n format.html { redirect_to @keiyaku, notice: 'Keiyaku was successfully created.' }\n format.json { render :show, status: :created, location: @keiyaku }\n else\n format.html { render :new }\n format.json { render json: @keiyaku.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bahan = Bahan.new(params[:bahan])\n\n respond_to do |format|\n if @bahan.save\n format.html { redirect_to @bahan, notice: 'Bahan was successfully created.' }\n format.json { render json: @bahan, status: :created, location: @bahan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bahan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bloknot = Bloknot.new(bloknot_params)\n\n respond_to do |format|\n if @bloknot.save\n format.html { redirect_to @bloknot, notice: 'Bloknot was successfully created.' }\n format.json { render :show, status: :created, location: @bloknot }\n else\n format.html { render :new }\n format.json { render json: @bloknot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @johari = Johari.new(johari_params)\n\n respond_to do |format|\n if @johari.save\n format.html { redirect_to johariscores_url, notice: 'Johari was successfully created.' }\n format.json { render :show, status: :created, location: @johari }\n else\n format.html { render :new }\n format.json { render json: @johari.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kemboi = Kemboi.new(kemboi_params)\n\n respond_to do |format|\n if @kemboi.save\n format.html { redirect_to @kemboi, notice: 'Kemboi was successfully created.' }\n format.json { render action: 'show', status: :created, location: @kemboi }\n else\n format.html { render action: 'new' }\n format.json { render json: @kemboi.errors, status: :unprocessable_entity }\n end\n end\n end", "def ra_khoi_dang_params\n params.require(:ra_khoi_dang).permit(:name, :description, :enabled, :ngay_ra_khoi_dang, :hinh_thuc_ra_khoi_dang)\n end", "def create\n @pendataan = Pendataan.new(pendataan_params)\n @pendataan.no_pendataan = generate_no_pendataan\n if @pendataan.kode_rekening == '1104' or @pendataan.kode_rekening == '1108'\n @pendataan.status = 4\n else\n @pendataan.status = 0\n end\n respond_to do |format|\n if @pendataan.save\n Penetapan.create!(\n pendataan_id:@pendataan.id, \n pemakaian_daya_teliti:@pendataan.pemakaian_daya,\n volume_pemakaian_teliti:@pendataan.volume_pemakaian,\n jumlah_volume_teliti:@pendataan.jumlah_volume,\n pajak_rokok_teliti:@pendataan.pajak_rokok,\n nilai_reklame_teliti:@pendataan.nilai_reklame,\n npa_teliti:@pendataan.npa,\n omzet_teliti:@pendataan.omzet,\n jumlah_pajak_teliti:@pendataan.jumlah_pajak, \n jumlah_reklame: @pendataan.jumlah_reklame,\n jumlah_hari_reklame: @pendataan.jumlah_hari_reklame, \n panjang_reklame: @pendataan.panjang_reklame, \n lebar_reklame: @pendataan.lebar_reklame, \n nilai_lokasi_reklame: @pendataan.nilai_lokasi_reklame, \n sudut_pandang_reklame: @pendataan.sudut_pandang_reklame, \n luas_reklame: @pendataan.luas_reklame, \n tinggi_reklame: @pendataan.tinggi_reklame\n )\n format.html { redirect_to @pendataan, notice: 'Pendataan berhasil tersimpan.' }\n format.json { render :show, status: :created, location: @pendataan }\n else\n format.html { render :new }\n format.json { render json: @pendataan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kuaisufenfawenjian = Kuaisufenfawenjian.new(kuaisufenfawenjian_params)\n\n respond_to do |format|\n if @kuaisufenfawenjian.save\n format.html { redirect_to @kuaisufenfawenjian, notice: 'Kuaisufenfawenjian was successfully created.' }\n format.json { render :show, status: :created, location: @kuaisufenfawenjian }\n else\n format.html { render :new }\n format.json { render json: @kuaisufenfawenjian.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n hang_hoa = HangHoa.find(params[:hang_hoa_id])\n so_luong = params[:so_luong]\n @gia = Gia.find(params[:hang_hoa_id])\n @chi_tiet_gio_hang = @gio_hang.them_hang_hoa(hang_hoa.id, so_luong)\n\n respond_to do |format|\n if @chi_tiet_gio_hang.save\n format.html { redirect_to @chi_tiet_gio_hang.gio_hang, notice: 'Thêm vào giỏ hàng thành công' }\n format.json { render :show, status: :created, location: @chi_tiet_gio_hang }\n else\n format.html { render :new }\n format.json { render json: @chi_tiet_gio_hang.errors, status: :unprocessable_entity }\n end\n end\n end", "def karutum_params\n params.require(:karutum).permit(:waka, :waka_kanji)\n end", "def create\n \n\n respond_to do |format|\n if @huati.save\n format.html { redirect_to @huati, notice: 'Huati was successfully created.' }\n format.json { render json: @huati, status: :created, location: @huati }\n else\n format.html { render action: \"new\" }\n format.json { render json: @huati.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kraj = Kraj.new(params[:kraj])\n\n respond_to do |format|\n if @kraj.save\n format.html { redirect_to @kraj, notice: 'Kraj was successfully created.' }\n format.json { render json: @kraj, status: :created, location: @kraj }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kraj.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @data_pendidikan_agama_katolik.update(data_pendidikan_agama_katolik_params)\n format.html { redirect_to @data_pendidikan_agama_katolik, notice: 'Data pendidikan agama katolik was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_pendidikan_agama_katolik }\n else\n format.html { render :edit }\n format.json { render json: @data_pendidikan_agama_katolik.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n logger.debug(params[:konyu_rireki])\n @konyuRireki = KonyuRireki.new(params[:konyu_rireki])\n set_image_to_model\n\n # 現在日付から年度を取得する\n nend = get_nend()\n\n # 購入履歴IDの年度内最大値を取得する\n maxId = KonyuRireki.maximum(:konyuRirekiId, :conditions => [\"\\\"konyuRirekiId\\\" BETWEEN ? AND ?\", (nend.to_s + \"0000000\").to_i, (nend.to_s + \"9999999\").to_i])\n if maxId.blank? then\n maxId = 0;\n end\n maxId_s = maxId.to_s\n if maxId_s.size > 7 then\n maxId = maxId_s[(maxId_s.size - 7),7].to_i\n end\n\n # 購入履歴IDを生成する -> 年度下2桁+7桁の連番\n @konyuRireki.konyuRirekiId = \"#{nend}#{format(\"%07d\",(maxId + 1))}\".to_i\n\n respond_to do |format|\n if @konyuRireki.save\n format.html { redirect_to action: \"index\", notice: 'KonyuRireki was successfully created.', reload: 'on' }\n format.json { render json: @konyuRireki, status: :created, location: @konyuRireki }\n else\n format.html { render action: \"new\" }\n format.json { render json: @konyuRireki.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mapping_data_tindakan_penunjang = MappingDataTindakanPenunjang.new(params[:mapping_data_tindakan_penunjang])\n\n respond_to do |format|\n if @mapping_data_tindakan_penunjang.save\n format.html { redirect_to(:action => \"index\", :notice => CREATE_MSG) }\n format.xml { render :xml => @mapping_data_tindakan_penunjang, :status => :created, :location => @mapping_data_tindakan_penunjang }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mapping_data_tindakan_penunjang.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @lugar = Lugar.new(lugar_params)\n\n if @lugar.save\n render json: @lugar, status: :created, location: @lugar\n else\n render json: @lugar.errors, status: :unprocessable_entity\n end\n end", "def create\n @penjualan_bahan = PenjualanBahan.new(params[:penjualan_bahan])\n\n respond_to do |format|\n if @penjualan_bahan.save\n format.html { redirect_to @penjualan_bahan, notice: 'Penjualan bahan was successfully created.' }\n format.json { render json: @penjualan_bahan, status: :created, location: @penjualan_bahan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @penjualan_bahan.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7352186", "0.7144841", "0.6938219", "0.6814624", "0.6757636", "0.668251", "0.6607814", "0.6591382", "0.65672886", "0.6493333", "0.6421687", "0.6409621", "0.63728374", "0.63635546", "0.63586664", "0.6349154", "0.6342618", "0.6315826", "0.626483", "0.62641585", "0.62149197", "0.62126154", "0.61883914", "0.61795616", "0.6171689", "0.61548394", "0.61413765", "0.61145794", "0.6094525", "0.6074485", "0.60649496", "0.60075974", "0.59984815", "0.5998441", "0.5992867", "0.59876895", "0.5979246", "0.5979198", "0.5971749", "0.59646094", "0.5962041", "0.5921937", "0.59193337", "0.59076726", "0.5905778", "0.589585", "0.589318", "0.5885027", "0.5884582", "0.5874604", "0.58527315", "0.583047", "0.58271605", "0.58254135", "0.58237386", "0.5819682", "0.5811232", "0.5810811", "0.58084184", "0.5806656", "0.58039016", "0.5798158", "0.57968473", "0.57964337", "0.57944447", "0.5791925", "0.5789439", "0.57831633", "0.5780697", "0.57804203", "0.57698256", "0.57677937", "0.57649934", "0.5763132", "0.57605505", "0.57582927", "0.57553893", "0.57551605", "0.57499224", "0.57494766", "0.5745872", "0.5739506", "0.572798", "0.5722472", "0.5720211", "0.57189775", "0.5718827", "0.5714835", "0.5709295", "0.57091814", "0.5709009", "0.570675", "0.570423", "0.5703876", "0.57028854", "0.57027763", "0.57002854", "0.5688561", "0.5686009", "0.568458" ]
0.7780069
0
PATCH/PUT /laporan_guru_agama_katolik/1 PATCH/PUT /laporan_guru_agama_katolik/1.json
def update respond_to do |format| if @laporan_guru_agama_katolik.update(laporan_guru_agama_katolik_params) format.html { redirect_to @laporan_guru_agama_katolik, notice: 'Laporan guru agama katolik was successfully updated.' } format.json { render :show, status: :ok, location: @laporan_guru_agama_katolik } else format.html { render :edit } format.json { render json: @laporan_guru_agama_katolik.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @data_pendidikan_agama_katolik.update(data_pendidikan_agama_katolik_params)\n format.html { redirect_to @data_pendidikan_agama_katolik, notice: 'Data pendidikan agama katolik was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_pendidikan_agama_katolik }\n else\n format.html { render :edit }\n format.json { render json: @data_pendidikan_agama_katolik.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @data_keagamaan_katolik.update(data_keagamaan_katolik_params)\n format.html { redirect_to @data_keagamaan_katolik, notice: 'Data keagamaan katolik was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_keagamaan_katolik }\n else\n format.html { render :edit }\n format.json { render json: @data_keagamaan_katolik.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kalo.update(kalo_params)\n format.html { redirect_to @kalo, notice: 'Kalo was successfully updated.' }\n format.json { render :show, status: :ok, location: @kalo }\n else\n format.html { render :edit }\n format.json { render json: @kalo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @klasa.update(klasa_params)\n format.html { redirect_to @klasa, notice: 'Klasa was successfully updated.' }\n format.json { render :show, status: :ok, location: @klasa }\n else\n format.html { render :edit }\n format.json { render json: @klasa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @aplikasi.update(aplikasi_params)\n format.html { redirect_to @aplikasi, notice: \"Aplikasi was successfully updated.\" }\n format.json { render :show, status: :ok, location: @aplikasi }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @aplikasi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kolegij = Kolegij.find(params[:id])\n\n respond_to do |format|\n if @kolegij.update_attributes(params[:kolegij])\n format.html { redirect_to @kolegij, notice: 'Kolegij was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kolegij.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kisalli = Kisalli.find_by_key(params[:id])\n\n respond_to do |format|\n if @kisalli.update_attributes(params[:kisalli])\n format.html { redirect_to @kisalli, notice: 'Kisalli was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kisalli.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @koran.update(koran_params)\n format.html { redirect_to @koran, notice: 'Koran was successfully updated.' }\n format.json { render :show, status: :ok, location: @koran }\n else\n format.html { render :edit }\n format.json { render json: @koran.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kata.update(kata_params)\n format.html { redirect_to @kata, notice: 'Kata was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kata.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kumo.update(kumo_params)\n format.html { redirect_to kumos_path, notice: 'Kumo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kumo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kolegiji = Kolegiji.find(params[:id])\n\n respond_to do |format|\n if @kolegiji.update_attributes(params[:kolegiji])\n format.html { redirect_to @kolegiji, notice: 'Kolegiji was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kolegiji.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kansei_buhin = KanseiBuhin.find(params[:id])\n\n respond_to do |format|\n if @kansei_buhin.update_attributes(params[:kansei_buhin])\n format.html { redirect_to @kansei_buhin, notice: 'Kansei buhin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kansei_buhin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @klienci_jaskula.update(klienci_jaskula_params)\n format.html { redirect_to @klienci_jaskula, notice: 'Klienci jaskula was successfully updated.' }\n format.json { render :show, status: :ok, location: @klienci_jaskula }\n else\n format.html { render :edit }\n format.json { render json: @klienci_jaskula.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kai2_tuan7.update(kai2_Kai2Tuan7_params)\n format.html { redirect_to edit_kai2_tuan7_path(@kai2_tuan7), notice: 'Kai2 Kai2Tuan7 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kai2_tuan7.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opiskelija.update(opiskelija_params)\n format.html { redirect_to @opiskelija, notice: 'Opiskelija was successfully updated.' }\n format.json { render :show, status: :ok, location: @opiskelija }\n else\n format.html { render :edit }\n format.json { render json: @opiskelija.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kontrahenci.update(kontrahenci_params)\n format.html { redirect_to @kontrahenci, notice: 'Kontrahenci został zaktualizowany.' }\n format.json { render :show, status: :ok, location: @kontrahenci }\n else\n format.html { render :edit }\n format.json { render json: @kontrahenci.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @koszyk.update(koszyk_params)\n format.html { redirect_to @koszyk, notice: 'Koszyk was successfully updated.' }\n format.json { render :show, status: :ok, location: @koszyk }\n else\n format.html { render :edit }\n format.json { render json: @koszyk.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kniha.update(kniha_params)\n format.html { redirect_to @kniha, notice: 'Kniha was successfully updated.' }\n format.json { render :show, status: :ok, location: @kniha }\n else\n format.html { render :edit }\n format.json { render json: @kniha.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @johari.update(johari_params)\n format.html { redirect_to @johari, notice: 'Johari was successfully updated.' }\n format.json { render :show, status: :ok, location: @johari }\n else\n format.html { render :edit }\n format.json { render json: @johari.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kegiatan.update(kegiatan_params)\n format.html { redirect_to @kegiatan, notice: 'Kegiatan was successfully updated.' }\n format.json { render :show, status: :ok, location: @kegiatan }\n else\n format.html { render :edit }\n format.json { render json: @kegiatan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kela.update(kela_params)\n format.html { redirect_to @kela, notice: 'Kela was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kela.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 update\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format|\n if @giang_vien.update_attributes(params[:giang_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @giang_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jabatan.update(jabatan_params)\n format.html { redirect_to @jabatan, notice: 'Jabatan berhasil tersimpan.' }\n format.json { render :show, status: :ok, location: @jabatan }\n else\n format.html { render :edit }\n format.json { render json: @jabatan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pakettipi.update(pakettipi_params)\n format.html { redirect_to pakettipis_path, notice: 'Kayıt başarıyla güncellendi.'}\n format.json { render :show, status: :ok, location: @pakettipi }\n else\n format.html { render :edit }\n format.json { render json: @pakettipi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ra_khoi_dang.update(ra_khoi_dang_params)\n format.html { redirect_to @ra_khoi_dang, notice: 'Ra khoi dang was successfully updated.' }\n format.json { render :show, status: :ok, location: @ra_khoi_dang }\n else\n format.html { render :edit }\n format.json { render json: @ra_khoi_dang.errors, status: :unprocessable_entity }\n end\n end\n end", "def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end", "def update\n @palabra = Palabra.find(params[:id])\n @palabra.significados = params[:significados] \n respond_to do |format|\n if @palabra.update_attributes(params[:palabra])\n format.html { redirect_to @palabra, notice: 'La Palabra fue actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @palabra.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @putnik.update(putnik_params)\n format.html { redirect_to @putnik, notice: 'Putnik was successfully updated.' }\n format.json { render :show, status: :ok, location: @putnik }\n else\n format.html { render :edit }\n format.json { render json: @putnik.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @imakoko.update(imakoko_params)\n format.html { redirect_to @imakoko, notice: 'Imakoko was successfully updated.' }\n format.json { render :show, status: :ok, location: @imakoko }\n else\n format.html { render :edit }\n format.json { render json: @imakoko.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plato = Plato.find(params[:id])\n\n if @plato.update(plato_params)\n head :no_content\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @alola.update(alola_params)\n format.html { redirect_to @alola, notice: 'Alola was successfully updated.' }\n format.json { render :show, status: :ok, location: @alola }\n else\n format.html { render :edit }\n format.json { render json: @alola.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n logger.debug(params[:kokyaku])\n # @kokyaku = Kokyaku.find(params[:id])\n @kokyaku = Kokyaku.find(:first, :conditions => {:kokyakuId => params[:id], :delFlg => 0})\n\n respond_to do |format| # TODO:ローカルでエラーになる…\n # if @kokyaku.update_attributes(params[:kokyaku])\n if @kokyaku.update_attributes(params[:kokyaku], {:kokyakuId => params[:id]})\n # if @kokyaku.update_attributes(params[:kokyaku], {:kokyakuId => params[:id], :delFlg => 0})\n format.html { redirect_to action: \"index\", notice: 'Kokyaku was successfully updated.', reload: 'on' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kokyaku.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pendaftaran_kela.update(pendaftaran_kela_params)\n format.html { redirect_to @pendaftaran_kela, notice: 'Pendaftaran kela was successfully updated.' }\n format.json { render :show, status: :ok, location: @pendaftaran_kela }\n else\n format.html { render :edit }\n format.json { render json: @pendaftaran_kela.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @data_kejuaraan.update(data_kejuaraan_params)\n format.html { redirect_to @data_kejuaraan, notice: 'Data kejuaraan was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_kejuaraan }\n else\n format.html { render :edit }\n format.json { render json: @data_kejuaraan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n kai2_ji7_params[:無齊記號].slice! '!'\n if @kai2_ji7.update(kai2_ji7_params)\n format.html { redirect_to edit_kai2_ji7_path(@kai2_ji7), notice: 'Kai2 ji7 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kai2_ji7.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @loja = Loja.find(params[:id])\n\n respond_to do |format|\n if @loja.update_attributes(params[:loja])\n format.html { redirect_to @loja, notice: 'Loja actualizada com sucesso' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @loja.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profilsekolah.update(profilsekolah_params)\n format.html { redirect_to @profilsekolah, notice: 'Profilsekolah was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profilsekolah.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n respond_to do |format|\n if @jalan.update(jalan_params)\n format.html { redirect_to @jalan, notice: \"Jalan was successfully updated.\" }\n format.json { render :show, status: :ok, location: @jalan }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @jalan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @aki.update(aki_params)\n format.html { redirect_to @aki, notice: 'Aki was successfully updated.' }\n format.json { render :show, status: :ok, location: @aki }\n else\n format.html { render :edit }\n format.json { render json: @aki.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @jamaat = Jamaat.find(params[:id])\n\n respond_to do |format|\n if @jamaat.update_attributes(params[:jamaat])\n format.html { redirect_to @jamaat, notice: 'Jamaat was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jamaat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @penyata_kehadiran.update(penyata_kehadiran_params)\n format.html { redirect_to @penyata_kehadiran, notice: 'Penyata kehadiran was successfully updated.' }\n format.json { render :show, status: :ok, location: @penyata_kehadiran }\n else\n format.html { render :edit }\n format.json { render json: @penyata_kehadiran.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kraj = Kraj.find(params[:id])\n\n respond_to do |format|\n if @kraj.update_attributes(params[:kraj])\n format.html { redirect_to @kraj, notice: 'Kraj was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kraj.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @toko.update(toko_params)\n format.html { redirect_to :back, notice: 'Toko telah diperbarui.' }\n format.json { render :show, status: :ok, location: @toko }\n else\n format.html { redirect_to :back }\n format.json { render json: @toko.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipomedalla = Tipomedalla.find(params[:id])\n\n respond_to do |format|\n if @tipomedalla.update_attributes(params[:tipomedalla])\n format.html { redirect_to @tipomedalla, notice: 'Tipomedalla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipomedalla.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kierownik.update(kierownik_params)\n format.html { redirect_to @kierownik, notice: 'Kierownik was successfully updated.' }\n format.json { render :show, status: :ok, location: @kierownik }\n else\n format.html { render :edit }\n format.json { render json: @kierownik.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n if @koti.update_attributes(params[:koti])\n format.html { redirect_to @koti, notice: 'Koti was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @koti.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 update\n respond_to do |format|\n if @holla.update(holla_params)\n format.html { redirect_to @holla, notice: 'Holla was successfully updated.' }\n format.json { render :show, status: :ok, location: @holla }\n else\n format.html { render :edit }\n format.json { render json: @holla.errors, status: :unprocessable_entity }\n end\n end\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 pai = params[:pai] ? Conta.find_by_id(params[:pai]): nil\n \n respond_to do |format|\n if @conta.update(nome: conta_params[:nome], status: conta_params[:status], pai: pai) \n #format.json { render :show, status: :ok, location: @conta }\n format.json { render json: @conta.to_json, status: :ok }\n else \n format.json { render json: @conta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bakusokukun.update(bakusokukun_params)\n format.html { redirect_to @bakusokukun, notice: 'Bakusokukun was successfully updated.' }\n format.json { render :show, status: :ok, location: @bakusokukun }\n else\n format.html { render :edit }\n format.json { render json: @bakusokukun.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @karteikarte = Karteikarte.find(params[:id])\n\n respond_to do |format|\n if @karteikarte.update_attributes(params[:karteikarte])\n format.html { redirect_to @karteikarte, notice: 'Karteikarte was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @karteikarte.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kehadiran.update(kehadiran_params)\n format.html { redirect_to @kehadiran, notice: 'Kehadiran was successfully updated.' }\n format.json { render :show, status: :ok, location: @kehadiran }\n else\n format.html { render :edit }\n format.json { render json: @kehadiran.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @aluno.update(aluno_params)\n format.html { redirect_to @aluno, notice: t('.update', default: t('helpers.messages.update')) }\n format.json { render :show, status: :ok, location: @aluno }\n else\n format.html { render :edit }\n format.json { render json: @aluno.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @zayavk.update(zayavk_params)\n format.html { redirect_to @zayavk, notice: 'Заявка была успешно изменена.' }\n format.json { render :show, status: :ok, location: @zayavk }\n else\n format.html { render :edit }\n format.json { render json: @zayavk.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tangazo.update(tangazo_params)\n format.html { redirect_to @tangazo, notice: 'Tangazo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tangazo }\n else\n format.html { render :edit }\n format.json { render json: @tangazo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update_almacen,Sigesp::Solicitud\n if @sigesp_solicitud.update(sigesp_solicitud_alamcen_params)\n return render json: { url: sigesp_solicitudsalmacen_path(@sigesp_solicitud)} \n else\n return render json:@sigesp_solicitud.errors ,status: :unprocessable_entity\n end \n end", "def update\n respond_to do |format|\n if @kodomo.update(kodomo_params)\n format.html { redirect_to @kodomo, notice: 'Kodomo was successfully updated.' }\n format.json { render :show, status: :ok, location: @kodomo }\n else\n format.html { render :edit }\n format.json { render json: @kodomo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prace_polozka.update(prace_polozka_params)\n format.html { redirect_to @prace_polozka, notice: 'Zaznam byl zmenen.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prace_polozka.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @status_akun.update(status_akun_params)\n format.html { redirect_to @status_akun, notice: 'Status akun was successfully updated.' }\n format.json { render :show, status: :ok, location: @status_akun }\n else\n format.html { render :edit }\n format.json { render json: @status_akun.errors, status: :unprocessable_entity }\n end\n end\n end", "def pro_farm_update\n respond_to do |format|\n activo = params[:pro_far][:activo_produc]\n farmacia_id = session[:farmacia_id]\n id = params[:id]\n ProFar.where(producto_id: id, farmacium_id:farmacia_id).update_all(activo_produc: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n @kullanici = Kullanici.find(params[:id])\n\n respond_to do |format|\n if @kullanici.update_attributes(params[:kullanici])\n format.html { redirect_to @kullanici, notice: 'Kullanici was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kullanici.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bloknot.update(bloknot_params)\n format.html { redirect_to @bloknot, notice: 'Bloknot was successfully updated.' }\n format.json { render :show, status: :ok, location: @bloknot }\n else\n format.html { render :edit }\n format.json { render json: @bloknot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cetak_blok.update(cetak_blok_params)\n format.html { redirect_to cetak_bloks_url, notice: 'Cetak blok was successfully updated.' }\n format.json { render :show, status: :ok, location: @cetak_blok }\n else\n format.html { render :edit }\n format.json { render json: @cetak_blok.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @uang_masuk.update(uang_masuk_params)\n format.html { redirect_to @uang_masuk, notice: 'Uang masuk was successfully updated.' }\n format.json { render :show, status: :ok, location: @uang_masuk }\n else\n format.html { render :edit }\n format.json { render json: @uang_masuk.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @appjayan.update(appjayan_params)\n format.html { redirect_to @appjayan, notice: 'Appjayan was successfully updated.' }\n format.json { render :show, status: :ok, location: @appjayan }\n else\n format.html { render :edit }\n format.json { render json: @appjayan.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 @kennkoukiroku.update(kennkoukiroku_params)\n format.html { redirect_to kennkoukirokus_path, notice: \"健康記録を更新しました\" }\n format.json { render :show, status: :ok, location: @kennkoukiroku }\n else\n format.html { render :edit }\n format.json { render json: @kennkoukiroku.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comentariu_licenta.update(comentariu_licenta_params)\n format.html { redirect_to @comentariu_licenta, notice: 'Comentariu licenta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comentariu_licenta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @nota_aluno.update(nota_aluno_params)\n format.html { redirect_to @nota_aluno, notice: 'Nota aluno was successfully updated.' }\n format.json { render :show, status: :ok, location: @nota_aluno }\n else\n format.html { render :edit }\n format.json { render json: @nota_aluno.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pegawai.update(pegawai_params)\n format.html { redirect_to @pegawai, notice: 'Pegawai berhasil tersimpan.' }\n format.json { render :show, status: :ok, location: @pegawai }\n else\n format.html { render :edit }\n format.json { render json: @pegawai.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @konyuRireki = KonyuRireki.find(params[:id])\n set_image_to_model\n respond_to do |format|\n if @konyuRireki.update_attributes(params[:konyu_rireki])\n format.html { redirect_to action: \"index\", notice: 'KonyuRireki was successfully updated.', reload: 'on' }\n # format.html { redirect_to action: \"index\", reload: 'on' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @konyuRireki.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 @abastecimento.update(abastecimento_params)\n format.html { redirect_to abastecimentos_url, notice: 'Abastecimento editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @abastecimento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lugar = Lugar.find(params[:id])\n\n if @lugar.update(lugar_params)\n head :no_content\n else\n render json: @lugar.errors, status: :unprocessable_entity\n end\n end", "def update\n \n\n respond_to do |format|\n if @huati.update_attributes(params[:huati])\n format.html { redirect_to @huati, notice: 'Huati was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @huati.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n if params[:id]==\"edit_familias_propiedades\"\n edit_familias_propiedades\n return\n end\n \n #if params[:familia][\"articulos_grupopropiedades_attributes\"]\n# componer_articulo\n# return\n #end \n \n respond_to do |format|\n if @familia.update(familia_params) \n \n format.html { redirect_to familias_path(:id => @familia.padre_id), notice: 'Familia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @familia.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update\n respond_to do |format|\n if @precio_boleto.update(precio_boleto_params)\n format.html { redirect_to @precio_boleto, notice: 'Precio boleto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @precio_boleto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sabre_de_luz.update(sabre_de_luz_params)\n format.html { redirect_to @sabre_de_luz, notice: 'Sabre de luz was successfully updated.' }\n format.json { render :show, status: :ok, location: @sabre_de_luz }\n else\n format.html { render :edit }\n format.json { render json: @sabre_de_luz.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sekilas_info.update(sekilas_info_params)\n format.html { redirect_to @sekilas_info, notice: 'Sekilas info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sekilas_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apologetic.update(apologetic_params)\n format.html { redirect_to @apologetic, notice: 'Apologetic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apologetic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kontoumsatz.update(kontoumsatz_params)\n format.html { redirect_to @kontoumsatz, notice: 'Kontoumsatz was successfully updated.' }\n format.json { render :show, status: :ok, location: @kontoumsatz }\n else\n format.html { render :edit }\n format.json { render json: @kontoumsatz.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @status_de_la_notificacion = StatusDeLaNotificacion.find(params[:id])\n\n respond_to do |format|\n if @status_de_la_notificacion.update_attributes(params[:status_de_la_notificacion])\n format.html { redirect_to @status_de_la_notificacion, notice: 'Status de la notificacion was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status_de_la_notificacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @laporan_kinerja_pegawai_bimkat_sumteng.update(laporan_kinerja_pegawai_bimkat_sumteng_params)\n format.html { redirect_to @laporan_kinerja_pegawai_bimkat_sumteng, notice: 'Laporan kinerja pegawai bimkat sumteng was successfully updated.' }\n format.json { render :show, status: :ok, location: @laporan_kinerja_pegawai_bimkat_sumteng }\n else\n format.html { render :edit }\n format.json { render json: @laporan_kinerja_pegawai_bimkat_sumteng.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @loa.update(loa_params)\n format.html { redirect_to @loa, notice: 'Letter of Applicaton was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @loa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @peliculass.update(peliculass_params)\n format.html { redirect_to @peliculass, notice: 'Peliculass was successfully updated.' }\n format.json { render :show, status: :ok, location: @peliculass }\n else\n format.html { render :edit }\n format.json { render json: @peliculass.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 respond_to do |format|\n if @informasi_berita_terkini.update(informasi_berita_terkini_params)\n format.html { redirect_to @informasi_berita_terkini, notice: 'Informasi berita terkini was successfully updated.' }\n format.json { render :show, status: :ok, location: @informasi_berita_terkini }\n else\n format.html { render :edit }\n format.json { render json: @informasi_berita_terkini.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sklad = Sklad.find(params[:id])\n\n respond_to do |format|\n if @sklad.update_attributes(params[:sklad])\n format.html { redirect_to @sklad, notice: 'Sklad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sklad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @gonullu.update(gonullu_params)\n format.html { redirect_to @gonullu, notice: 'Gonullu was successfully updated.' }\n format.json { render :show, status: :ok, location: @gonullu }\n else\n format.html { render :edit }\n format.json { render json: @gonullu.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n activo = params[:lab_far][:activo]\n farmacia_id = session[:farmacia_id]\n id = params[:id]\n LabFar.where(laboratorio_id: id, farmacium_id:farmacia_id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n @boat = Boat.find(params[:id], :include => [:members])\n @dockold = Dock.find(params[:Laituri]) unless params[:Laituri].blank?\n @berthold = @berth = Berth.where(:dock_id => @dockold.id, :number => params[:Laituripaikka]) unless params[:Laituri].blank?\n #@boat = Boat.find(params[:id])\n #changejnoToId\n parse_jno_from_omistajatxtbox\n change_jno_to_id_for_update\n if params[:boat][:BoatsMembers_attributes] == nil\n @onkoOk = false\n end\n\n @laituri_idt = Dock.all.map(&:id)\n @laituri_idt.insert(0,nil)\n\n @vapaat_laituripaikat = Berth.where(:dock_id => 1).all.map(&:number)\n @vapaat_laituripaikat.insert(0,nil)\n\n respond_to do |format|\n if @onkoOk && check_for_only_one_payer && @boat.update_attributes(params[:boat])\n check_dock_and_berth(format)\n format.html { redirect_to @boat, notice: 'Veneen muokkaus onnistui.' }\n format.json { head :no_content }\n else\n format.html {\n flash[:notice] = 'Virhe.'\n render action: \"edit\"\n }\n format.json { render json: @boat.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 update\n\n respond_to do |format|\n if @aplikace.update(aplikace_params)\n format.html { redirect_to @aplikace, notice: 'Aplikace was successfully updated.' }\n format.json { render :show, status: :ok, location: @aplikace }\n else\n format.html { render :edit }\n format.json { render json: @aplikace.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kelurahan.update(kelurahan_params)\n format.html { redirect_to @kelurahan, notice: 'Kelurahan berhasil tersimpan' }\n format.json { render :show, status: :ok, location: @kelurahan }\n else\n format.html { render :edit }\n format.json { render json: @kelurahan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @platoon.update(platoon_params)\n format.html { redirect_to @platoon, notice: 'Platoon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @platoon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kontum.update(kontum_params)\n format.html { redirect_to @kontum, notice: 'Kontum was successfully updated.' }\n format.json { render :show, status: :ok, location: @kontum }\n else\n format.html { render :edit }\n format.json { render json: @kontum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bahan = Bahan.find(params[:id])\n\n respond_to do |format|\n if @bahan.update_attributes(params[:bahan])\n format.html { redirect_to @bahan, notice: 'Bahan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bahan.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7039956", "0.6972694", "0.6805268", "0.66803", "0.6663917", "0.66434264", "0.65959215", "0.65685934", "0.65548205", "0.6520739", "0.6519527", "0.65147036", "0.6506645", "0.64959574", "0.64880997", "0.6486782", "0.6457795", "0.64471954", "0.6437101", "0.64309645", "0.6420189", "0.64146477", "0.6411884", "0.63998586", "0.639465", "0.6388399", "0.6387142", "0.63866234", "0.6377177", "0.63736546", "0.63708276", "0.6369583", "0.63694054", "0.63604516", "0.6355545", "0.6348515", "0.6347981", "0.6327937", "0.6325816", "0.6314134", "0.6310637", "0.629794", "0.6297553", "0.62928385", "0.6283842", "0.6278141", "0.62750596", "0.62699234", "0.626899", "0.6266898", "0.6265238", "0.6258436", "0.6256045", "0.6254423", "0.6233594", "0.623284", "0.6232298", "0.6231639", "0.62314254", "0.6230126", "0.6229612", "0.6223251", "0.62079006", "0.6200337", "0.61993325", "0.6194343", "0.61935014", "0.6190637", "0.61900616", "0.61896735", "0.6188468", "0.61879563", "0.6184231", "0.6182974", "0.6181898", "0.6181764", "0.6181479", "0.6179042", "0.61756057", "0.6175251", "0.617306", "0.61613816", "0.6160404", "0.61563814", "0.6155045", "0.61542803", "0.6152976", "0.61519235", "0.6151449", "0.61510044", "0.6150651", "0.6147946", "0.61478347", "0.61464214", "0.61424714", "0.61401546", "0.6139521", "0.61394197", "0.6139112", "0.6137538" ]
0.7289591
0
DELETE /laporan_guru_agama_katolik/1 DELETE /laporan_guru_agama_katolik/1.json
def destroy @laporan_guru_agama_katolik.destroy respond_to do |format| format.html { redirect_to laporan_guru_agama_katolik_index_url, notice: 'Laporan guru agama katolik was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @data_pendidikan_agama_katolik.destroy\n respond_to do |format|\n format.html { redirect_to data_pendidikan_agama_katolik_index_url, notice: 'Data pendidikan agama katolik was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @data_keagamaan_katolik.destroy\n respond_to do |format|\n format.html { redirect_to data_keagamaan_katolik_index_url, notice: 'Data keagamaan katolik was successfully destroyed.' }\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 destroy\n @kisalli = Kisalli.find_by_key(params[:id])\n @kisalli.destroy\n\n respond_to do |format|\n format.html { redirect_to kisallis_url }\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 @laporan_kinerja_pegawai_bimkat_sumteng.destroy\n respond_to do |format|\n format.html { redirect_to laporan_kinerja_pegawai_bimkat_sumteng_index_url, notice: 'Laporan kinerja pegawai bimkat sumteng telah berhasil dihapus.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kansei_buhin = KanseiBuhin.find(params[:id])\n @kansei_buhin.destroy\n\n respond_to do |format|\n format.html { redirect_to kansei_buhins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @giang_vien = GiangVien.find(params[:id])\n @giang_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @kullanici = Kullanici.find(params[:id])\n @kullanici.destroy\n\n respond_to do |format|\n format.html { redirect_to kullanicis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kanri_daicho.destroy\n respond_to do |format|\n format.html { redirect_to kanri_daichos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kalo.destroy\n respond_to do |format|\n format.html { redirect_to kalos_url, notice: 'Kalo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kolegiji = Kolegiji.find(params[:id])\n @kolegiji.destroy\n\n respond_to do |format|\n format.html { redirect_to kolegijis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kegiatan.destroy\n respond_to do |format|\n format.html { redirect_to kegiatans_url, notice: 'Kegiatan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ra_khoi_dang.destroy\n respond_to do |format|\n format.html { redirect_to ra_khoi_dangs_url, notice: 'Ra khoi dang was successfully destroyed.' }\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 @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 destroy\n @himalaya = Himalaya.find(params[:id])\n @himalaya.destroy\n\n respond_to do |format|\n format.html { redirect_to himalayas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kontrahenci.destroy\n respond_to do |format|\n format.html { redirect_to kontrahenci_index_url, notice: 'Kontrahenci został usunięty.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pakettipi.destroy\n respond_to do |format|\n format.html { redirect_to pakettipis_path, notice: 'Kayıt silindi.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kai2_tuan7.destroy\n respond_to do |format|\n format.html { redirect_to kai2_Kai2Tuan7s_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @kata.destroy\n respond_to do |format|\n format.html { redirect_to katas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nguoi_dung = NguoiDung.find(params[:id])\n @nguoi_dung.destroy\n\n respond_to do |format|\n format.html { redirect_to nguoi_dungs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @himalaya.destroy\n\n respond_to do |format|\n format.html { redirect_to himalayas_url }\n format.json { head :no_content }\n end\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 @adres_kontr.destroy\n respond_to do |format|\n format.html { redirect_to adres_kontr_index_url, notice: 'Adres kontr was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kolegij = Kolegij.find(params[:id])\n @kolegij.destroy\n\n respond_to do |format|\n format.html { redirect_to kolegijs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @loja = Loja.find(params[:id])\n @loja.destroy\n\n respond_to do |format|\n format.html { redirect_to lojas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @zayavka = Zayavka.find(params[:id])\n @zayavka.destroy\n\n respond_to do |format|\n format.html { redirect_to zayavkas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bahan = Bahan.find(params[:id])\n @bahan.destroy\n\n respond_to do |format|\n format.html { redirect_to bahans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kraj = Kraj.find(params[:id])\n @kraj.destroy\n\n respond_to do |format|\n format.html { redirect_to kraje_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kela.destroy\n respond_to do |format|\n format.html { redirect_to kelas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kumo.destroy\n respond_to do |format|\n format.html { redirect_to kumos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @jabatan.destroy\n respond_to do |format|\n format.html { redirect_to jabatans_url, notice: 'Jabatan berhasil terhapus.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kelurahan.destroy\n respond_to do |format|\n format.html { redirect_to kelurahans_url, notice: 'kelurahan berhasil dihapus.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @zakaz = Zakaz.find(params[:id])\n @zakaz.destroy\n\n respond_to do |format|\n format.html { redirect_to zakazs_url }\n format.json { head :ok }\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 @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to datos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kierownik.destroy\n respond_to do |format|\n format.html { redirect_to kierownik_index_url, notice: 'Kierownik was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kehadiran.destroy\n respond_to do |format|\n format.html { redirect_to kehadirans_url, notice: 'Kehadiran was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @aki.destroy\n respond_to do |format|\n format.html { redirect_to akis_url, notice: 'Aki was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @klienci_jaskula.destroy\n respond_to do |format|\n format.html { redirect_to klienci_jaskulas_url, notice: 'Klienci jaskula was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @putnik.destroy\n respond_to do |format|\n format.html { redirect_to putniks_url, notice: 'Putnik was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kullanici.destroy\n respond_to do |format|\n format.html { redirect_to kullanicis_url, notice: 'Kullanici was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kniha.destroy\n respond_to do |format|\n format.html { redirect_to knihy_url, notice: 'Kniha was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tubuyaki.destroy\n respond_to do |format|\n format.html { redirect_to tubuyakis_url, notice: 'Tubuyaki was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bakusokukun.destroy\n respond_to do |format|\n format.html { redirect_to bakusokukuns_url, notice: 'Bakusokukun was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @caballo = Caballo.find(params[:id])\n @caballo.destroy\n\n respond_to do |format|\n format.html { redirect_to caballos_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 destroy\n @karteikarte = Karteikarte.find(params[:id])\n @karteikarte.destroy\n\n respond_to do |format|\n format.html { redirect_to karteikartes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vodka = Vodka.find(params[:id])\n @vodka.destroy\n\n respond_to do |format|\n format.html { redirect_to vodkas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kadai.destroy\n respond_to do |format|\n format.html { redirect_to kadais_url, notice: 'Kadai was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @koran.destroy\n respond_to do |format|\n format.html { redirect_to korans_url, notice: 'Koran was successfully destroyed.' }\n format.json { head :no_content }\n end\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 destroy\n @klasa.destroy\n respond_to do |format|\n format.html { redirect_to klasas_url, notice: 'Klasa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @koti = Koti.find(params[:id])\n @koti.destroy\n\n respond_to do |format|\n format.html { redirect_to kotis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kishangarh_marble.destroy\n respond_to do |format|\n format.html { redirect_to kishangarh_marbles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @informasi_berita_terkini.destroy\n respond_to do |format|\n format.html { redirect_to informasi_berita_terkini_index_url, notice: 'Informasi berita terkini telah berhasil dihapus.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @toko.destroy\n respond_to do |format|\n format.html { redirect_to tokos_url, notice: 'Toko telah dihapus.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @grupa = Grupa.find(params[:id])\n @grupa.destroy\n\n respond_to do |format|\n format.html { redirect_to grupy_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 @jednani.destroy\n respond_to do |format|\n format.html { redirect_to jednanis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @walikela.destroy\n respond_to do |format|\n format.html { redirect_to walikelas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pegawai.destroy\n respond_to do |format|\n format.html { redirect_to pegawais_url, notice: 'Pegawai berhasil terhapus.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kundenkonto.destroy\n respond_to do |format|\n format.html { redirect_to kundenkontos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kecamatan.destroy\n respond_to do |format|\n format.html { redirect_to kecamatans_url, notice: 'Kecamatan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @zgloszeny.destroy\n respond_to do |format|\n format.html { redirect_to zgloszenies_url, notice: 'Zgłoszenie zostało usunięte.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @jamaat = Jamaat.find(params[:id])\n @jamaat.destroy\n\n respond_to do |format|\n format.html { redirect_to jamaats_url }\n format.json { head :ok }\n end\n end", "def destroy\n @kazoku = Kazoku.find(params[:id])\n @kazoku.destroy\n\n respond_to do |format|\n format.html { redirect_to kazokus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @jalan.destroy\n respond_to do |format|\n format.html { redirect_to jalans_url, notice: \"Jalan was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @pengeluaran_bulanan = PengeluaranBulanan.find(params[:id])\n @pengeluaran_bulanan.destroy\n\n respond_to do |format|\n format.html { redirect_to pengeluaran_bulanans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @galinha.destroy\n respond_to do |format|\n format.html { redirect_to galinhas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_haiku = Api::Haiku.find(params[:id])\n @api_haiku.destroy\n\n respond_to do |format|\n format.html { redirect_to api_haikus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @socio_dados_banco.destroy\n respond_to do |format|\n format.html { redirect_to socio_dados_bancos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lich_su_binh_bau = LichSuBinhBau.find(params[:id])\n @lich_su_binh_bau.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_lich_su_binh_baus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sklad = Sklad.find(params[:id])\n @sklad.destroy\n\n respond_to do |format|\n format.html { redirect_to sklads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @diaoboshang = Diaoboshang.find(params[:id])\n @diaoboshang.destroy\n\n respond_to do |format|\n format.html { redirect_to diaoboshangs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @zayavk.destroy\n respond_to do |format|\n format.html { redirect_to zayavks_url, notice: 'Заявка была успешно удалена.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dhokebaaz.destroy\n respond_to do |format|\n format.html { redirect_to dhokebaazs_url, notice: 'Dhokebaaz was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sezione = Sezione.find(params[:id])\n @sezione.destroy\n\n respond_to do |format|\n format.html { redirect_to sezioni_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 @shujukusqlguanli.destroy\n respond_to do |format|\n format.html { redirect_to shujukusqlguanlis_url, notice: 'Shujukusqlguanli was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def destroy\n @indicativo = Indicativo.find(params[:id])\n @indicativo.destroy\n\n respond_to do |format|\n format.html { redirect_to indicativos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uang_masuk.destroy\n respond_to do |format|\n format.html { redirect_to uang_masuks_url, notice: 'Uang masuk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @postavka.destroy\n respond_to do |format|\n format.html { redirect_to postavkas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_akun.destroy\n respond_to do |format|\n format.html { redirect_to status_akun_index_url, notice: 'Status akun was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @apolice.destroy\n respond_to do |format|\n format.html { redirect_to apolices_url, notice: 'Registro deletado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ulica.destroy\n respond_to do |format|\n format.html { redirect_to ulicas_url, notice: 'Ulica was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \n\n @gljdaima.destroy\n respond_to do |format|\n format.html { redirect_to gljdaimas_url, notice: 'Gljdaima was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pendaftaran_kela.destroy\n respond_to do |format|\n format.html { redirect_to pendaftaran_kelas_url, notice: 'Pendaftaran kela was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sekilas_info.destroy\n respond_to do |format|\n format.html { redirect_to sekilas_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hystory_zakaz.destroy\n respond_to do |format|\n format.html { redirect_to hystory_zakazs_url, notice: 'Hystory zakaz was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @penyata_kehadiran.destroy\n respond_to do |format|\n format.html { redirect_to penyata_kehadirans_url, notice: 'Penyata kehadiran was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @leccion_hiragana.destroy\n respond_to do |format|\n format.html { redirect_to leccion_hiraganas_url, notice: 'Leccion hiragana was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @apuesta_detail = ApuestaDetail.find(params[:id])\n @apuesta_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to apuesta_details_url }\n format.json { head :no_content }\n end\n end", "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" ]
[ "0.7438234", "0.7408621", "0.729889", "0.72764844", "0.7214719", "0.72103953", "0.7210284", "0.720453", "0.71473044", "0.7114095", "0.71108556", "0.70795846", "0.70492226", "0.70469266", "0.70319855", "0.7027935", "0.7024029", "0.7016501", "0.7012847", "0.7012417", "0.7011378", "0.70060736", "0.6998484", "0.6996942", "0.69959265", "0.6989532", "0.6989218", "0.69874513", "0.69797903", "0.69797903", "0.69737506", "0.69728625", "0.6972567", "0.6972434", "0.6969488", "0.69689703", "0.6950107", "0.6948401", "0.69432306", "0.69408816", "0.69319326", "0.6927144", "0.6926314", "0.69248927", "0.6923298", "0.6915448", "0.69119126", "0.69096124", "0.6903523", "0.6901388", "0.6893588", "0.6889108", "0.68871063", "0.6886397", "0.6880821", "0.6880122", "0.68723804", "0.6870476", "0.6870154", "0.68699884", "0.68689054", "0.6865575", "0.68618995", "0.6860278", "0.68581414", "0.68543947", "0.6847425", "0.68465215", "0.68463707", "0.684558", "0.68427175", "0.6840146", "0.68371844", "0.6836297", "0.68351245", "0.68336993", "0.6830805", "0.68301773", "0.6829803", "0.6829417", "0.68290013", "0.68288255", "0.6828555", "0.6828161", "0.6826544", "0.682594", "0.6825319", "0.68251455", "0.6822048", "0.6817378", "0.6815485", "0.68152654", "0.6814895", "0.6813488", "0.6811253", "0.6809353", "0.6808692", "0.6803205", "0.6801828", "0.68016565" ]
0.772773
0
Use callbacks to share common setup or constraints between actions.
def set_laporan_guru_agama_katolik @laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.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 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 setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\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 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 startcompany(action)\n @done = true\n action.setup\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 setup\n #implement in subclass;\n end", "def after_set_callback; 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 setup(easy)\n super\n easy.customrequest = @verb\n end", "def around_hooks; 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 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 shared_action(name, &block)\n @controller.shared_actions[name] = 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", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.53314966", "0.53114754", "0.52984965", "0.52977055", "0.5296272", "0.5260649", "0.5245076", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.5235081", "0.52321917", "0.5228592", "0.5220735", "0.52198535", "0.52139324", "0.5208539", "0.5206585", "0.5178542", "0.5175199", "0.5173538", "0.5167041", "0.51614195", "0.51577675", "0.5153909", "0.51528823", "0.5152225", "0.51429904", "0.5141399", "0.51345575", "0.51145", "0.5114052", "0.5114052", "0.5110216", "0.5108656", "0.50935394", "0.5089196", "0.5081936", "0.5079627", "0.50675833", "0.5056105", "0.5053687", "0.5050475", "0.5050475", "0.503471", "0.5028311", "0.501982", "0.50157547", "0.5013552", "0.50014806", "0.50011593", "0.49976763", "0.4990292", "0.4990292", "0.49882022", "0.4981269", "0.49792367", "0.49766538", "0.4967978", "0.49667212", "0.4958987", "0.49572337", "0.49550423", "0.4954479", "0.4952353", "0.494726", "0.4944055", "0.4935437", "0.4931248", "0.49283475", "0.49281213", "0.49268973", "0.4921738", "0.49204507", "0.4918924", "0.49182287", "0.4916538", "0.49158585", "0.49156788" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def laporan_guru_agama_katolik_params params.require(:laporan_guru_agama_katolik).permit(:judul, :tautan, :pengguna_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
Add given hash or block and return new config object
def add(config_or_block) self.class.new @config_list + Array.wrap(config_or_block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_block name, hash\n\t\t\t@blocks ||= {}\n\t\t\t@blocks[name] = hash\n\t\tend", "def add(name, &block)\n blocks[name.to_sym] = block\n end", "def ingest_configuration_block!(hash, &block)\n hash.each do |k, v|\n value = if v.is_a?(Hash)\n ingest_configuration_block!(v, &block)\n else\n zip_to_hash(block, *Array(v))\n end\n\n hash.merge! k => value\n end\n end", "def configure(config = nil, &block)\n config ||= Util::BlockHashBuilder.build(&block)\n @config = config.dup.freeze\n end", "def add(hash); end", "def configure(&block)\n @configure_blocks ||= []\n @configure_blocks << block\n end", "def new_block(transaction:, previous_hash: nil)\n block = {\n index: chain.length + 1,\n timestamp: Time.now.to_f,\n transaction: transaction,\n previous_hash: previous_hash || CryptoHelper.block_hash(last_block)\n }\n\n chain.push(block)\n block\n end", "def append_block(block)\n valid = block.transactions.all? do |tx|\n tx.coinbase? || verify_transaction?(tx)\n end\n\n unless valid\n puts \"Verify block failed!\"\n return\n end\n\n pow = ProofOfWork.new(block)\n catch :not_found do\n result = pow.run!\n nonce, hash = result.values_at(:nonce, :hash)\n puts \"Mining done - #{hash}\"\n block.hash = hash\n block.nonce = nonce\n save_block(block)\n\n self.hash = hash\n end\n end", "def add(&block)\n @block_args << block\n end", "def add_block block\n block.at self.length\n @blocks << block\n end", "def add_block(new_block, blockchain)\n blockchain.push(new_block) if valid_new_block?(new_block, latest_block(blockchain))\n end", "def config(&block_)\n ::Blockenspiel.invoke(block_, @config) if block_\n @config\n end", "def add_single_block(block)\n\n\t\tif @decoded[block.blocks[0]].nil? \n\t\t \t@decoded[block.blocks[0]] = block.data \n\t\t\t@num_valid += 1\n\t\tend\n\tend", "def add_config! key, config = nil, &block\n key = @schema.validate_new_key! key\n if config.nil?\n config = Configuration.new(&block)\n elsif block\n yield config\n end\n @values[key] = config\n @schema.add_config! key, config\n self\n end", "def config(&block)\n if block_given?\n block.call(@config)\n else\n @config\n end\n end", "def config(&block)\n instance_eval(&block) if block_given?\n end", "def setup_config(config=nil, &block)\n @config = config || ConfigStruct.block_to_hash(block)\n end", "def cxx_configuration(&block)\n @myblock = block\n @all_blocks = []\n end", "def addSetupBlock( &block ); self.class.addSetupBlock( &block ); end", "def config(&block)\n Merb::Config.configure(&block) if block_given?\n Config\n end", "def config(&block)\n Merb::Config.configure(&block) if block_given?\n Config\n end", "def block(hash)\n head = Sibit::Json.new(http: @http, log: @log).get(\n Iri.new('https://chain.api.btc.com/v3/block').append(hash)\n )\n data = head['data']\n raise Sibit::Error, \"The block #{hash} not found\" if data.nil?\n nxt = data['next_block_hash']\n nxt = nil if nxt == '0000000000000000000000000000000000000000000000000000000000000000'\n {\n provider: self.class.name,\n hash: data['hash'],\n orphan: data['is_orphan'],\n next: nxt,\n previous: data['prev_block_hash'],\n txns: txns(hash)\n }\n end", "def push_block_with_to_json(host_item,block_hash,batch_arr)\r\n tmp_hash = { host_to: host_item['host'], port_to: host_item['port'], format_to: 'json' }.merge(block_hash[:filebot] || {})\r\n block_hash[:filebot] = tmp_hash\r\n batch_arr.push(block_hash.to_json) rescue nil\r\n end", "def new_block(proof, previous_hash = hash(last_block))\n block = {\n index: chain.length + 1,\n timestamp: Time.now.to_i,\n transactions: current_transactions,\n proof: proof,\n previous_hash: previous_hash,\n }\n\n # Reset the current transactions\n @current_transactions = []\n\n # Add block to the chain\n chain << block\n\n block\n end", "def configure(&block)\n ConfigBlock.new(self, &block) if block_given?\n nil\n end", "def configure(&block)\n ConfigBlock.new(self, &block) if block_given?\n nil\n end", "def add_to_hash &block\n @hash_making_callbacks << block\n end", "def config(&block)\n instance_exec(&block)\n end", "def add_block(article_block)\n self.blocks << article_block\n end", "def add key, &block\n @config_items << ConfigItem.new(:posix, key, &block)\n end", "def build_block(transactions, prev_hash = hash)\n Block.new(transactions, prev_hash)\n end", "def <<(block)\n blocks << block\n end", "def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end", "def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end", "def add_block(block, state)\n start_time = Time.now\n\n mainchain_tip_hash = @storage.mainchain_tip_hash\n thischain_tip_hash = block.prev_block_hex\n\n mainchain_tip = @storage.block_header_for_hash(mainchain_tip_hash)\n thischain_tip = @storage.block_header_for_hash(thischain_tip_hash)\n\n # If the new work does not exceed the main chain work, stash this block away in a \"side branch\".\n # No further validations will be performed.\n if !thischain_tip.is_more_work?(mainchain_tip, block.hash, block.block_work)\n # This can only be possible on the sidechain, so we simply store the block without further validations.\n # Outputs will be validated when/if this block will become a part of the mainchain (see below).\n @storage.load_output_cache(block.tx)\n return persist_block_on_side_branch(block,\n @storage.height_for_block_header(thischain_tip) + 1,\n @storage.total_work_up_to_block_header(thischain_tip))\n end\n\n # New work is greater. Find the common ancestor block to rebuild the chain from there.\n # Scan both chains up to the common (minimum) height.\n # Then scan from there simultaneously until we hit the same hash.\n\n mainchain_ancestor = mainchain_tip\n thischain_ancestor = thischain_tip\n\n block_hashes_to_disconnect = []\n block_hashes_to_connect = []\n\n # 1. Scan each chain until the common min_height\n min_height = [ @storage.height_for_block_header(mainchain_ancestor),\n @storage.height_for_block_header(thischain_ancestor) ].min\n\n while @storage.height_for_block_header(mainchain_ancestor) > min_height\n block_hashes_to_disconnect << mainchain_ancestor.sha2_hash\n mainchain_ancestor = @storage.previous_block_header_for_block_header(mainchain_ancestor)\n end\n\n while @storage.height_for_block_header(thischain_ancestor) > min_height\n block_hashes_to_connect << thischain_ancestor.sha2_hash\n thischain_ancestor = @storage.previous_block_header_for_block_header(thischain_ancestor)\n end\n\n # 2. Scan both chains simultaneously until we get to the same common ancestor\n while !(thischain_ancestor == mainchain_ancestor)\n block_hashes_to_disconnect << mainchain_ancestor.sha2_hash\n block_hashes_to_connect << thischain_ancestor.sha2_hash\n mainchain_ancestor = @storage.previous_block_header_for_block_header(mainchain_ancestor)\n thischain_ancestor = @storage.previous_block_header_for_block_header(thischain_ancestor)\n end\n\n # Finally we arrive at the common ancestor.\n # Now we need to attempt to disconnect old mainchain blocks and connect new thischain blocks.\n common_ancestor = mainchain_ancestor\n\n # 1. Disconnect the blocks on the mainchain to move them into the sidechain\n # We start from the latest hash and move on to the one right before the common ancestor.\n # Most of the time this array is empty, so no blocks are being disconnected.\n block_hashes_to_disconnect.each do |hash|\n b = @storage.valid_block_for_hash(hash)\n @storage.load_output_cache(b.tx)\n # Wrap disconnect/connect in a DB transaction.\n @storage.transaction do\n if !self.disconnect_block(b, state)\n return false\n end\n end\n end\n\n # 2. Connect the blocks to form the new mainchain.\n # If any block is actually invalid (double-spends some outputs or has an invalid script),\n # this will fail and we would have to abort DB transaction to rollback all changes.\n block_hashes_to_connect.reverse.each do |hash|\n b = @storage.valid_block_for_hash(hash)\n @storage.load_output_cache(b.tx)\n # Wrap disconnect/connect in a DB transaction.\n @storage.transaction do\n begin\n if !self.connect_block(b, state)\n # This will likely never get hit as the above raises exceptions.\n @storage.remove_block_header(block)\n @output_cache.flush\n return false\n end\n rescue ValidationError => ex\n @storage.remove_block_header(b)\n @output_cache.flush\n raise ex\n end\n end\n end\n\n measure_method(:add_block, start_time)\n log_raw_block_events(block.hash, \"add_block processing time: #{(Time.now - start_time).to_f}\")\n\n # Connect this new block too.\n @storage.load_output_cache(block.tx)\n # Wrap disconnect/connect in a DB transaction.\n @storage.transaction do\n begin\n if !self.connect_block(block, state)\n # This will likely never get hit as the above raises exceptions.\n @storage.remove_block_header(block)\n @output_cache.flush\n return false\n end\n rescue ValidationError => ex\n @storage.remove_block_header(block)\n @output_cache.flush\n raise ex\n end\n end\n\n return true\n end", "def config(&block)\n if block_given?\n c = Config.new\n c.instance_eval(&block)\n @config = c\n end\n\n @config ||= Config.new\n end", "def update_block(hash, attrs)\n raise \"Not implemented\"\n end", "def add(block)\n if valid?(block)\n connect(block)\n consolidate_successors(block)\n else\n queue_unconsolidated(block)\n end\n end", "def config(&block)\n if block_given?\n @@config = Config.new\n @@config.tap(&block)\n else\n @@config\n end\n end", "def handle_store_block hex\n block = Bitcoin::P::Block.new(hex.htb)\n @node.queue << [:block, block]\n { queued: [ :block, block.hash ] }\n end", "def add_block(amount, payer, payee, miner, timestamp, signature, prev_hash, nonce, broadcast)\r\n hash = Digest::SHA256.new.hexdigest(amount.to_s + payer.to_s + payee.to_s + miner.to_s + timestamp.to_s + signature.to_s + prev_hash.to_s + nonce.to_s)\r\n if (hash.start_with?(\"0\" * NONCE_ZEROES)) # Hash Is Valid\r\n block = Block.new(amount.to_f, signature.to_i, timestamp.to_i, prev_hash.to_s, nonce.to_i, hash.to_s, payer.to_i, payee.to_i, miner.to_i)\r\n $blockchain << block\r\n broadcast_block(block) if (broadcast)\r\n puts $blockchain.length.to_s.green\r\n Thread.new { calc_net_worth } # Calculates net worth of all peers\r\n else\r\n puts \"Hash #{hash} Does Not Match Requirements! BLACKLISTING PEER WITH PORT #{payer}\".red\r\n $status = \"Hash #{hash} Does Not Match Requirements! BLACKLISTING PEER WITH PORT #{payer}\"\r\n peer = search_peers_by_port(payer)\r\n peer.node_type = 3 if (peer != -1)\r\n end\r\nend", "def set_blocks hash\n\t\t\t@blocks = hash\n\t\tend", "def configuration(name, &block)\n config = Configuration.new\n config.instance_eval(&block)\n @configurations[name] = config\n end", "def configure &block\n @config_helper = ConfigHelper.new(&block)\n end", "def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end", "def add_block\n block = params[:block].to_s.underscore\n if block.present? && BLOCKS.key?(block)\n @user = User.current\n layout = @user.pref[:my_page_layout] || {}\n # remove if already present in a group\n %w(top left right).each {|f| (layout[f] ||= []).delete block }\n # add it on top\n layout['top'].unshift block\n @user.pref[:my_page_layout] = layout\n @user.pref.save\n end\n redirect_to my_page_layout_path\n end", "def compile\n @config_list.inject({}) do |config, hash_or_proc|\n case hash_or_proc\n when Hash\n config.deep_merge hash_or_proc\n when Proc\n instance or raise InstanceNotBoundError\n c = instance.instance_eval(&hash_or_proc)\n c.is_a?(Hash) || c == nil or raise InvalidBlockReturnValue\n c ? config.deep_merge(c) : config\n end\n end\n end", "def create_hash(&block); end", "def create_hash(&block); end", "def add_block\n @user = User.current\n @user.pref.add_block params[:block]\n @user.pref.save\n redirect_to my_page_layout_path\n end", "def config(&block)\n @config ||= Configuration.new\n instance_exec(@config, &block) if block_given?\n @config\n end", "def cxx_configuration(&block)\n @all_blocks = []\n block.call\n end", "def block\n blockable.blocks.detect{|b| b.identifier == self.identifier.to_s} || \n blockable.blocks.build(:identifier => self.identifier.to_s)\n end", "def new_block(proof, previous_hash = nil)\n block = {\n index: @chain.length + 1,\n epoch: Time.now.utc.to_f,\n transactions: @current_transactions,\n cost: @current_transactions.length - 1,\n proof: proof,\n previous_hash: previous_hash || Blockchain.hash(@chain.last)\n }\n @current_transactions = []; @chain << block; block\n end", "def add_hash(id, hash, source)\n @hashes[id] = {:deletehash => hash, :source => source, :stamp => Time.now}\n end", "def processed_block_for_hash(hash)\n if Toshi::Models::Block.where(hsh: hash).empty?\n return nil\n end\n stored_block = Toshi::Models::RawBlock.where(hsh: hash).first\n if !stored_block\n return nil\n end\n Bitcoin::Protocol::Block.new(stored_block.payload)\n end", "def configure( &block )\n @configuration = block\n end", "def configure(&block)\n block.call Configuration\n end", "def configure(&block)\n yield config\n end", "def load_genesis_block\n self.transaction({}) do\n genesis_hash = Bitcoin.network[:genesis_hash]\n if ([:regtest, :mainnet].include?(Bitcoin.network_name) ||\n ![:test].include?(Toshi.env)) &&\n Toshi::Models::Block.head == nil &&\n Toshi::Models::Block.where(hsh: genesis_hash).empty?\n logger.info{ \"Inserting genesis block #{genesis_hash}\" }\n path_to_genesis_block = \"config/blocks/#{genesis_hash}.json\"\n genesis_block = Bitcoin::Protocol::Block.from_json_file(path_to_genesis_block)\n self.save_block_on_main_branch(genesis_block, 0)\n end\n end\n end", "def configure &block\n configuration.tap { |conf| yield conf }\n end", "def store_raw_block(block)\n payload = block.payload || block.to_payload\n if Toshi::Models::RawBlock.where(hsh: block.hash).empty?\n Toshi::Models::RawBlock.new(hsh: block.hash, payload: payload).save\n end\n end", "def configure(&block); end", "def configure(&block); end", "def config(name, &block)\n config = ConfigVariable.new(name)\n if block\n config.instance_eval(&block)\n end\n variables[name] = config\n end", "def configure(&block)\n yield config\n config\n end", "def configure(&block)\n raise ArgumentError, \"Block required in order to configure\" unless block_given?\n \n yield @config\n end", "def add(matcher, value)\n @configurations[parse_matcher(matcher)] = value\n end", "def hash(block, stored_hash, hash_calc, block_check, line)\r\n return 'Block empty' if block.nil?\r\n\r\n # calculate hash value for line\r\n error = \"Line #{line}: Invalid hash set to #{stored_hash.strip}\"\r\n\r\n # if hash stored as with capital letters, return error\r\n stored_hash = stored_hash.strip # get rid of trailing white space\r\n int_hash = stored_hash.to_i(16) # get stored hash and convert to decimal\r\n # check lenght of stored hash(max4)...may be optiaml to place elsewhere\r\n return error + \"\\nHash length is too big\" if stored_hash.size >= 5\r\n\r\n # check hash for leading 0's\r\n return error + \"\\nHash contains leading zeros\" if stored_hash[0] == '0' && stored_hash.size > 1\r\n\r\n # check to make sure value is valid hex values\r\n return error + \"\\nInvalid hex value, must be lowercase and from 0-f\" unless block_check.check_hex(stored_hash)\r\n\r\n # see if calculated hash and stored has match\r\n hash = block_check.get_hash(block, hash_calc) # get hash value\r\n # removes last hash from string\r\n output_string = block_check.parse(block, '|' + stored_hash)\r\n error_two = \"Line #{line}: String '#{output_string[0]}' hash set to #{stored_hash.strip},\"\\\r\n \"should be #{hash.to_s(16)}\"\r\n return error_two unless block_check.check_hash(hash, int_hash)\r\n\r\n nil\r\n end", "def configure\n yield config if block_given?\n end", "def configure\n yield config if block_given?\n end", "def set_block\n @request = JSON.parse(request.body.read, {:symbolize_names => true})\n @block = Block.find_by(prev_block: @request[:prev_block])\n end", "def define(name, options={}, &block)\n # Check if a block by this name is already defined.\n if blocks[name.to_sym].nil?\n # Store the attributes of the defined block in a container for later use\n block_container = BuildingBlocks::Container.new\n block_container.name = name\n block_container.options = options\n block_container.block = block\n \n blocks[name.to_sym] = block_container \n end\n \n nil\n end", "def update_config node, &block\n c = if config?(node)\n config(node)\n else\n {}\n end\n yield c\n File.write(config_file(node), YAML.dump(c))\n end", "def configure(&block)\n fail InvalidSyntax, '`configure` requires a block.' unless block_given?\n\n Vedeu::Configuration.configure(&block)\n end", "def add_block(block)\n return if ilp.has_variable?(block)\n ilp.add_variable(block)\n lhs = block_frequency(block) + [[block, -1]]\n ilp.add_constraint(lhs,\"equal\",0,\"block_#{block.qname}\", :structural)\n end", "def config(&block)\n yield(self)\n end", "def source_lib(name, hash)\n raise \"not a hash\" unless hash.is_a?(Hash)\n check_hash hash,[:sources, :includes, :dependencies, :toolchain, :file_dependencies, :output_dir]\n raise \":sources need to be defined\" unless hash.has_key?(:sources)\n bblock = SourceLibrary.new(name)\n bblock.set_sources(hash[:sources])\n bblock.set_includes(hash[:includes]) if hash.has_key?(:includes)\n bblock.set_tcs(hash[:toolchain]) if hash.has_key?(:toolchain)\n bblock.set_dependencies(hash[:dependencies]) if hash.has_key?(:dependencies)\n bblock.file_dependencies = hash[:file_dependencies] if hash.has_key?(:file_dependencies)\n bblock.set_output_dir(hash[:output_dir]) if hash.has_key?(:output_dir)\n all_blocks << bblock\n end", "def move_coinbase_tx_to_block_pool(tx_hash)\n Toshi::Models::Transaction.where(hsh: tx_hash).update({pool: Toshi::Models::Transaction::BLOCK_POOL})\n end", "def block(hash)\n best_of('block') do |api|\n api.block(hash)\n end\n end", "def configure(hash = nil, &_block)\n if block_given?\n carrier = Surrealist::Carrier.new\n yield(carrier)\n @default_args = carrier.parameters\n else\n @default_args = hash.nil? ? Surrealist::HashUtils::EMPTY_HASH : hash\n end\n end", "def save_block(block)\n db.transaction do\n db[:l] = block.hash\n db[block.hash] = block\n db.commit\n end\n block\n end", "def <<(block)\n # parent assignment pending refactor\n #block.parent = self\n @blocks << block\n end", "def configure(site = :default, &block)\n @configs ||= {}\n @configs[site.to_s] = block\n end", "def add_to_configuration(c, arg)\n kv = arg.split('=')\n kv.length == 2 || (raise \"Expected parameter #{kv} in key=value format\")\n c = org.apache.hadoop.hbase.HBaseConfiguration.create if c.nil?\n c.set(kv[0], kv[1])\n c\nend", "def test_new\n\n b = Blockchain.new\n\n b << 'Genesis'\n b << 'Transaction Data...'\n b << ['Transaction Data...']\n b << ['Transaction Data...', 'Transaction Data...']\n b << [] ## empty block (no transactions)\n\n ## add do-it-yourself built block\n b << Block.next( b.last, 'Transaction Data...' )\n\n b << 'Transaction Data...'\n\n pp b\n\n assert true ## (for now) everything ok if we get here\nend", "def add_multi_block(block)\n\t\t\t@encoded << block\n\tend", "def configure(&block)\n yield(configuration)\n end", "def configure(&block)\n @config = BeaconControl::Base::Config.new &block\n end", "def add(hash, opts = {})\n uuid = opts[:id] || SecureRandom.uuid\n thash = Treet::Hash.new(hash)\n repos[uuid] = thash.to_repo(\"#{root}/#{uuid}\", opts.merge(:repotype => repotype))\n end", "def action_add\n notifying_block do\n create_config\n end\n end", "def configure\n yield config if block_given?\n end", "def configure(&block)\n yield(configuration)\n end", "def _block_config_method(config_key, &block)\n unless @settings[config_key].value.is_a?(ConfigStruct)\n raise \"Block called for #{config_key} but it is not a nested config!\"\n end\n\n @settings[config_key].value.instance_eval(&block)\n end", "def split_multi_remotehost_config_blocks(config_block)\n split_config = []\n config_block['remoteHost'].each do |single_remote_host|\n # Clone the block containing the multiple remote hosts\n config_block_for_single_remote_host = config_block.clone\n # And replace them with a single remote host\n config_block_for_single_remote_host['remoteHost'] = single_remote_host\n split_config.push(config_block_for_single_remote_host)\n end\n # Return split config blocks that each have a single remote host\n split_config\nend", "def add_block_container_to_list(*args, &block)\n block_container = self.build_block_container(*args, &block)\n if blocks[block_container.name].nil?\n blocks[block_container.name] = [block_container]\n else\n blocks[block_container.name] << block_container\n end\n end", "def use\n if block_given?\n yield self.config\n end\n self.config\n end", "def add_config(name, config)\n\t\tend", "def register_block_for(type, &blk); end", "def push(block)\n @names[block.name.to_s] ||= []\n @names[block.name.to_s] << block\n end" ]
[ "0.6975591", "0.6295234", "0.61010134", "0.60714036", "0.6066916", "0.6050589", "0.59973544", "0.5941835", "0.59062546", "0.5904485", "0.5887665", "0.58731943", "0.5832744", "0.5749853", "0.57388467", "0.5735011", "0.5719758", "0.56737554", "0.56645495", "0.56559", "0.56559", "0.56360143", "0.55941415", "0.5577567", "0.55721945", "0.55721945", "0.55497754", "0.5548496", "0.55387974", "0.5525064", "0.551741", "0.55134404", "0.5464125", "0.5464125", "0.54608995", "0.5453006", "0.5406597", "0.5399944", "0.5398851", "0.5383158", "0.5368629", "0.53638905", "0.5363572", "0.5363299", "0.53536826", "0.53536826", "0.5352156", "0.5344534", "0.5344534", "0.5336015", "0.5312046", "0.52843344", "0.5271943", "0.52602226", "0.5251902", "0.52482396", "0.5243396", "0.5237433", "0.52373374", "0.5233409", "0.5228316", "0.52283", "0.52202994", "0.52202994", "0.52192503", "0.52170986", "0.52070314", "0.5205455", "0.52033126", "0.51999664", "0.51999664", "0.5197775", "0.5193165", "0.5191787", "0.5187461", "0.5182801", "0.5174235", "0.51647836", "0.5156104", "0.5148614", "0.5147772", "0.51444876", "0.5137952", "0.51377445", "0.5132578", "0.5129202", "0.51289135", "0.51198906", "0.51040924", "0.51014644", "0.50989646", "0.50969124", "0.50907356", "0.50903493", "0.50846493", "0.5084556", "0.507006", "0.5068232", "0.506664", "0.50663924" ]
0.72648376
0
Return a new configuration object bound to the given instance. This instance will be instance_eval'ed with any procs in the config.
def bind(instance) self.class.new @config_list.dup, instance end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile\n @config_list.inject({}) do |config, hash_or_proc|\n case hash_or_proc\n when Hash\n config.deep_merge hash_or_proc\n when Proc\n instance or raise InstanceNotBoundError\n c = instance.instance_eval(&hash_or_proc)\n c.is_a?(Hash) || c == nil or raise InvalidBlockReturnValue\n c ? config.deep_merge(c) : config\n end\n end\n end", "def config(&block)\n instance_exec(&block)\n end", "def config(&block)\n if block_given?\n c = Config.new\n c.instance_eval(&block)\n @config = c\n end\n\n @config ||= Config.new\n end", "def config(&block)\n instance_eval(&block) if block_given?\n end", "def configure &blk\n instance_eval &blk\n end", "def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end", "def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end", "def configure(&block)\n self.instance_eval(&block)\n end", "def config\n @config ||= lambda_config? ? @config_value.call(parent.config) : @config_value.clone\n end", "def configure(&block)\n instance_eval(&block)\n end", "def configure(&block)\n instance_eval(&block)\n end", "def configure(&blk)\n instance_eval &blk\n end", "def config(&block)\n @config ||= Configuration.new\n instance_exec(@config, &block) if block_given?\n @config\n end", "def build(&block)\n # provide access to 'this' in configuration block\n self.instance_exec(&block)\n end", "def configure(&block)\n self.instance_eval(&block) if block_given?\n end", "def config(&blk)\n scope &blk\n self\n end", "def config(&block)\n yield(self)\n end", "def initialize\n yield self\n Config.apply(self)\n end", "def configuration(name, &block)\n config = Configuration.new\n config.instance_eval(&block)\n @configurations[name] = config\n end", "def instance(config)\n PROVIDER_INSTANCES[config.provider] || MUTEX.synchronize do\n PROVIDER_INSTANCES[config.provider] ||= lookup(config.provider).new(config[:\"#{config.provider}_settings\"])\n end\n end", "def configure_with(config_options)\n config_options.each { |attribute, value| eval \"self.#{attribute} = #{value}\" }\n end", "def instance_by_config(config)\n klass = config[:klass] || config[:class_name].constantize\n klass.new(config)\n end", "def configure(&block)\n self.config = Config.new(self)\n config.instance_eval(&block)\n\n attr_accessor *config.accessors\n attr_reader *config.setters.keys\n\n config.setters.each do |name, definition|\n define_method(:\"#{name}=\", definition)\n end\n end", "def configure(&block)\n config.run_callbacks(:configure) do\n config.instance_eval(&block)\n end\n end", "def configure &block\n\t\tinstance_eval &block\n\tend", "def configuration\n instance\n end", "def configuration\n instance\n end", "def configure(&block)\n block.call(self) if block_given?\n return self if valid?\n end", "def use\n if block_given?\n yield self.config\n end\n self.config\n end", "def instance_eval\n end", "def config(&block)\n if block_given?\n @@config = Config.new\n @@config.tap(&block)\n else\n @@config\n end\n end", "def method_missing(method_name, *arguments, &block)\n if Configuration.instance.respond_to?(method_name)\n Configuration.instance.public_send(method_name, *arguments, &block)\n else\n super\n end\n end", "def config\n @_config ||= Config.new\n yield @_config if block_given?\n @_config\n end", "def config(&b)\n b.call\nend", "def config\n yield self\n end", "def config\n yield self\n end", "def config\n yield self\n end", "def method_missing(sym, *args, &block)\n if configuration.respond_to?(sym)\n configuration.send(sym, *args, &block)\n else\n super\n end\n end", "def method_missing(method_name, *args, &block)\n\n # TODO: document the block + arguments scenario when subclassing\n if block_given?\n @configurations[method_name] ||= self.class.new(*args.unshift(method_name))\n @configurations[method_name].instance_eval &block\n return @configurations[method_name]\n end\n\n return get(method_name) if args.length == 0\n\n assign(method_name, args)\n end", "def install_configure_in(base)\n base.instance_eval <<-EOF\n # Configuration class for host module\n #\n #{base.name}::Configuration = Class.new(Configurations::Configuration)\n\n # The central configure method\n # @params [Proc] block the block to configure host module with\n # @raise [ArgumentError] error when not given a block\n # @example Configure a configuration\n # MyGem.configure do |c|\n # c.foo = :bar\n # end\n #\n def self.configure(&block)\n fail ArgumentError, \"configure needs a block\" unless block_given?\n include_configuration_type!(#{base.name}::Configuration)\n\n set_configuration!(&block)\n end\n\n # A reader for Configuration\n #\n def configuration\n return Thread.current[configuration_name] if Thread.current.key?(configuration_name)\n\n @configuration_defaults && configure {}\n end\n\n\n private\n\n # Sets the configuration instance variable\n #\n def self.set_configuration!(&block)\n Thread.current[configuration_name] = #{base.name}::Configuration.__new__(\n configuration_options,\n &block\n )\n end\n\n def self.configuration_name\n :\"#{underscore_camelized(base.name)}\"\n end\n\n EOF\n end", "def configure( &block )\n @class_method_map ||= {}\n Parametrization.patch!\n Parametrization::Config.instance_eval(&block)\n Parametrization::Config.resolve!\n Parametrization::Base.speciate!\n @configured = true\n end", "def init_with config\n config.each { |key, value|\n self.send((key.to_s+\"=\").to_sym, value ) if respond_to? key.to_sym\n }\n end", "def method_missing method, *args, &block\n temp = @@config_options.send method\n if temp.is_a?(Proc)\n temp.call *args\n else\n temp\n end\n end", "def install_configure_in(base)\n base.instance_eval <<-EOF\n # Configuration class for host module\n #\n #{base.name}::Configuration = Class.new(Configurations::Configuration)\n\n # The central configure method\n # @params [Proc] block the block to configure host module with\n # @raise [ArgumentError] error when not given a block\n # @example Configure a configuration\n # MyGem.configure do |c|\n # c.foo = :bar\n # end\n #\n def self.configure(&block)\n semaphore.synchronize do\n fail ArgumentError, \"configure needs a block\" unless block_given?\n include_configuration_type!(#{base.name}::Configuration)\n\n set_configuration!(&block)\n end\n end\n\n # A reader for Configuration\n #\n def configuration\n semaphore.synchronize do\n return @configuration if @configuration\n\n if @configuration_defaults\n include_configuration_type!(#{base.name}::Configuration)\n set_configuration! { }\n end\n end\n end\n\n\n private\n\n # Sets the configuration instance variable\n #\n def self.set_configuration!(&block)\n @configuration = #{base.name}::Configuration.__new__(\n configuration_options,\n &block\n )\n end\n\n @semaphore = Mutex.new\n def self.semaphore\n @semaphore\n end\n\n EOF\n end", "def configuration\n return self\n end", "def config\n yield self\n end", "def instance_eval(*args, &block)\n file, line = __find_caller__(caller())\n $__gen_code__[[file, line]] = {\n :binding => self, \n :kind => :instance_eval, \n :code => args[0]\n }\n if block_given?\n $__instance_eval__.bind(self).call(&block)\n else\n $__instance_eval__.bind(self).call(*args)\n end\n end", "def method_missing(method, *_args, &_block)\n @config.send(method)\n end", "def construct( &block )\n self.instance_eval(&block)\n @options\n end", "def config\n @config ||= compile\n end", "def configure(&blk)\n @blk = blk if block_given?\n self\n end", "def with_instance(config)\n raise ArgumentError.new('Block required when calling JumpBox#with_instance') unless block_given?\n instance = create(config)\n yield instance\n ensure\n destroy\n end", "def configure(&block)\n Fastfood::Configuration.instance_eval( &block )\n end", "def configure(options=nil, &block)\n # We don't want ancestors to be searched. This is the default in 1.8,\n # but not in 1.9, hence this hackery.\n const_args = [\"Config\"]\n const_args << false if RUBY_VERSION >= \"1.9\"\n\n # We assume that every provisioner has a `Config` class beneath\n # it for configuring.\n return if !@provisioner || !@provisioner.const_defined?(*const_args)\n\n # Instantiate the config class and configure it\n @config = @provisioner.const_get(*const_args).new\n @config.top = top\n @config.set_options(options) if options\n block.call(@config) if block\n end", "def config(&block)\n if block_given?\n block.call(@config)\n else\n @config\n end\n end", "def in_the(instance, &block)\n instance.instance_eval(&block)\n end", "def to_proc\n name, options, registry, variable_name = @name, @options, @registry, @iv_name\n Proc.new do\n build name => options\n registry.inject(instance_variable_get(:\"@#{variable_name}\")) do |value, (method, args, block)|\n value.send(method, *args, &block)\n end\n end\n end", "def run_config(script)\n open(script) {|f| eval(f.read, proc {self}) }\n end", "def config()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = HotkeyConfig.new(Native.HotkeySystem_config(@handle.ptr))\n result\n end", "def singleton_instance_eval(&block)\n singleton_class.instance_eval(&block)\n end", "def singleton_class_eval &block\n self.singleton_class.class_eval &block\n end", "def install_configure_in(base)\n base.class_eval <<-EOF\n class << self\n # The central configure method\n # @params [Proc] block the block to configure host module with\n # @raise [ArgumentError] error when not given a block\n # @example Configure a configuration\n # MyGem.configure do |c|\n # c.foo = :bar\n # end\n #\n def configure(&block)\n raise ArgumentError, 'can not configure without a block' unless block_given?\n @configuration = #{self}::Configuration.new(@configuration_defaults, @configurable, &block)\n end\n end\n EOF\n end", "def _new_setting_object_method(config_key, &block)\n new_config = @setting_templates[config_key].clone_and_reset\n new_config.instance_eval(&block)\n @setting_objects[config_key] << new_config\n end", "def config(&block_)\n ::Blockenspiel.invoke(block_, @config) if block_\n @config\n end", "def configure validate: true, &block\n configuration.tap(&block)\n configuration.validate!(context: self) if validate\n end", "def configure(config = nil, &block)\n config ||= Util::BlockHashBuilder.build(&block)\n @config = config.dup.freeze\n end", "def configure\n # Create a new configuration and yield it to a block\n self.configuration ||= Configuration.new\n\n yield(configuration)\n\n return configuration\n end", "def configure\n return self\n end", "def configure(&block)\n cfg = self.class::CONFIGURATOR.new(self)\n block.call(cfg)\n # allow configuration tuning for derived recipes\n post_configure\n end", "def configure(args={}, &block)\n save_state\n configure_with_args args\n configure_with_block &block if block_given?\n self\n end", "def configure(args={}, &block)\n save_state\n configure_with_args args\n configure_with_block &block if block_given?\n self\n end", "def configure\n self.configuration = Configuration.new\n yield(configuration)\n end", "def create_trigger(command, block, extra_cfg=nil)\n trigger = VagrantConfigTrigger.new(command)\n if block.is_a?(Hash)\n trigger.set_options(block)\n else\n block.call(trigger, VagrantConfigTrigger)\n trigger.set_options(extra_cfg) if extra_cfg\n end\n return trigger\n end", "def configure\n yield self if block_given?\n self\n end", "def _configure &blk\n proxy = @receiver == @receiver_class ? self.dup : self\n proxy.__configure = blk\n proxy\n end", "def configure(&block)\n block.call Configuration\n end", "def configure\n yield(self.config) if block_given?\n end", "def config\n self\n end", "def config\n yield @@config_options\n end", "def method_missing method, *args, &block\n if args.empty?\n @config.send(method)\n else\n @config.send(\"#{method}=\", args.first)\n end\n end", "def configure\n self.configuration ||= Configuration.new\n yield(configuration)\n end", "def configure &block\n @config_helper = ConfigHelper.new(&block)\n end", "def configure\n self.configuration ||= Configuration.new\n yield(configuration)\n end", "def get_instance(payload)\n ConfigurationInstance.new(@version, payload)\n end", "def to_proc\n eval \"Proc.new do\\n#{self}\\nend\"\n end", "def configure\n self.configuration ||= Configuration.new\n yield(configuration)\n end", "def configure\n self.configuration ||= Configuration.new\n yield(configuration)\n end", "def config\n (null_config? ? NoConfig.instance : actual_config)\n end", "def instantiate_configuration(options={}) #:nodoc:\n Capistrano::Configuration.new(options)\n end", "def class_eval(*args, &block)\n singleton_class.class_eval(*args, &block)\n end", "def configure\n self.configuration ||= Configuration.new\n yield(configuration) if block_given?\n end", "def config\n @config ||= rule_applier.config\n end", "def configure\n self.configuration ||= Configuration.new\n yield(configuration) if block_given?\n end", "def configure\n yield configurable\n self\n end", "def configure(&block)\n ConfigBlock.new(self, &block) if block_given?\n nil\n end", "def configure(&block)\n ConfigBlock.new(self, &block) if block_given?\n nil\n end", "def configure\n self.configuration ||= Configuration.new\n yield configuration\n end", "def configure\n self.configuration ||= Configuration.new\n yield configuration\n end", "def configure\n yield(config)\n end", "def define &blk\n self.instance_eval(&blk)\n end" ]
[ "0.6568649", "0.6433652", "0.60249954", "0.5984646", "0.5959399", "0.5957815", "0.5957815", "0.5894475", "0.58758414", "0.5848547", "0.5848547", "0.5831501", "0.58245915", "0.57777625", "0.5754851", "0.57050693", "0.5634089", "0.5610126", "0.55681443", "0.55339044", "0.550874", "0.5489912", "0.5487204", "0.54783225", "0.54779434", "0.5473602", "0.5473602", "0.54680717", "0.5452129", "0.543249", "0.5427211", "0.5411941", "0.5378002", "0.5349252", "0.5344386", "0.5344386", "0.5344386", "0.53288573", "0.531635", "0.5249755", "0.5240593", "0.52171695", "0.5216546", "0.5207356", "0.5203322", "0.51992923", "0.5178975", "0.5176022", "0.5174731", "0.5173963", "0.51586807", "0.51581806", "0.5119167", "0.51142997", "0.50950485", "0.5079622", "0.5075651", "0.5071034", "0.5062989", "0.5058392", "0.5054059", "0.50526184", "0.5048308", "0.50474197", "0.5036024", "0.5032767", "0.5027474", "0.5022722", "0.50226647", "0.5017224", "0.5017224", "0.50164926", "0.5010858", "0.5001904", "0.49906826", "0.49871257", "0.49791417", "0.4978903", "0.49749509", "0.49731994", "0.4968336", "0.49682587", "0.4967322", "0.49587393", "0.49497804", "0.49486655", "0.49486655", "0.4947774", "0.49393073", "0.49386668", "0.49292594", "0.49262494", "0.49248344", "0.49209383", "0.49145734", "0.49145734", "0.49049023", "0.49049023", "0.48999423", "0.48965544" ]
0.67852825
0
Return the compiled config. This will be a hash built by combining added hashes and blocks.
def config @config ||= compile end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile\n @config_list.inject({}) do |config, hash_or_proc|\n case hash_or_proc\n when Hash\n config.deep_merge hash_or_proc\n when Proc\n instance or raise InstanceNotBoundError\n c = instance.instance_eval(&hash_or_proc)\n c.is_a?(Hash) || c == nil or raise InvalidBlockReturnValue\n c ? config.deep_merge(c) : config\n end\n end\n end", "def get_hash()\n\t\t\treturn @config.clone()\n\t\tend", "def _compile(config)\n default_configuration.deep_merge(config).deep_merge(overlay_configuration)\n end", "def cxx_configuration(&block)\n @all_blocks = []\n block.call\n end", "def config_body_for(config)\n res = <<-EOH.gsub(/^ +/, '')\n # This file is managed by Chef.\n # Any changes to it will be overwritten.\n EOH\n res << Hash[config.sort].map { |k, v| config_for(k, v) }.compact\n .join(\"\\n\")\n end", "def config_hash\n digest = Digest::MD5.hexdigest(\n \"#{@x}-#{@y}-#{@hires_factor}-#{@render_type}-#{@format}-#{CONVERTER_VERSION}\")\n digest\n end", "def cxx_configuration(&block)\n @myblock = block\n @all_blocks = []\n end", "def merged_config_for_generator\n return {}\n end", "def config_hash\n certs_path = File.join(__dir__, '..', 'our_certs')\n\n { contract_id: '356936003', # from CP signed contract\n customer_id: 'L03051', # from CP signed contract\n certificate_path: File.join(certs_path, 'squared_VCA12032726_2022.pem'),\n private_key_password: File.read(File.join(certs_path, 'keypass.txt')),\n private_key_path: File.join(certs_path, 'squared_private_2022.key'),\n sending_post_office_code: 12_000 }\n end", "def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.source)}\n return(cfg)\n end", "def cfg\n CFG.build @instructions\n end", "def config\n config = {}\n config['recipes'] = []\n config['recipes'] |= hash_path(@default_config, 'recipes', 'global') || []\n config['recipes'] |= hash_path(@default_config, 'recipes', @platform) || []\n @group_configs.each do |group_name, group_config|\n config['recipes'] |= hash_path(group_config, 'recipes', 'global') || []\n config['recipes'] |= hash_path(group_config, 'recipes', @platform) || []\n end\n people_recipes = @people_config['recipes'] || {}\n config['recipes'] |= people_recipes['global'] || []\n config['recipes'] |= people_recipes[@platform] || []\n config['attributes'] = {}\n config['attributes'].deep_merge!(@default_config['attributes'] || {}) { |key, old, new| Array.wrap(old) + Array.wrap(new) }\n @group_configs.each do |group_name, group_config|\n config['attributes'].deep_merge!(group_config['attributes']) { |key, old, new| Array.wrap(old) + Array.wrap(new) } unless group_config['attributes'].nil?\n end\n people_attributes = @people_config['attributes'] || {}\n config['attributes'].deep_merge!(people_attributes) { |key, old, new| Array.wrap(old) + Array.wrap(new) }\n config\n end", "def config(&block_)\n ::Blockenspiel.invoke(block_, @config) if block_\n @config\n end", "def build_config\n return unless build?\n build_config_terraform\n end", "def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end", "def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end", "def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end", "def get_config_data()\n return @evroots_config_data if !@evroots_config_data.nil?\n \n @evroots_config_data = \"\"\n File.open(@evroots_config_path, \"r\") do |file|\n file.each do |line|\n line.gsub!(/^#.*\\n/, '')\n next if line.empty?\n line.gsub!(/^\\s*\\n/, '')\n next if line.empty?\n @evroots_config_data += line\n end\n end\n @evroots_config_data\n end", "def basic_blocks\n cfg.blocks\n end", "def configuration\n cfg = {}\n if (@command)\n cfg[:command] = @command.source\n else\n cfg[:shell_command_object_group] = @shell_command_object_group.name\n end\n\n cfg[:acl] = @acl.name if (@acl)\n return(cfg)\n end", "def config\n @_config ||= Config.new\n yield @_config if block_given?\n @_config\n end", "def configuration\n cfg = {}\n cfg[:acl] = @acl.name if (@acl)\n\n if (@command)\n cfg[:command] = @command.source\n else\n cfg[:shell_command_object_group] = @shell_command_object_group.name\n end\n return(cfg)\n end", "def build_config\n file = [options[:config_file], DEFAULT_CONFIG_FILE_LOCATION].\n compact.find {|f| File.exists?(f) }\n\n hash =\n if file\n YAML.load_file(file).each do |key, value|\n stderr.puts(\"Warn: Unknown key in config file: #{key}\") unless\n self.class.configs.find {|opt| opt.first.to_s == key.to_s }\n end\n else\n {}\n end\n\n options[:config_option].map {|str| str.split('=') }.\n inject(hash) {|m, (k,v)| m.merge(k.to_sym => v) }\n end", "def configure(config = nil, &block)\n config ||= Util::BlockHashBuilder.build(&block)\n @config = config.dup.freeze\n end", "def config\n @config ||= Config.create ConfigLoader.new(root, CONFIG_FILE).to_hash, options.merge_config\n end", "def config\n @config ||= begin\n conf = Bolt::Config.new(Bolt::Project.default_project, config_data)\n conf.modulepath = [modulepath].flatten\n conf\n end\n end", "def config(&block)\n if block_given?\n c = Config.new\n c.instance_eval(&block)\n @config = c\n end\n\n @config ||= Config.new\n end", "def config(&block)\n @config ||= Configuration.new\n instance_exec(@config, &block) if block_given?\n @config\n end", "def init_compile_config\n # TODO\n end", "def init_compile_config\n # TODO\n end", "def init_compile_config\n end", "def to_hash\n self.config.to_hash\n end", "def to_hash\n configuration\n end", "def grifter_configuration\n @config.clone\n end", "def config_file_contents\n output = []\n output << HEADING\n output << 'linters:' if linters_with_lints.any?\n linters_with_lints.each do |linter, files|\n output << generate_config_for_linter(linter, files)\n end\n output.join(\"\\n\\n\")\n end", "def config\n @config ||= lambda_config? ? @config_value.call(parent.config) : @config_value.clone\n end", "def config_to_hash\n data = {}\n Pkg::Params::BUILD_PARAMS.each do |param|\n data.store(param, self.instance_variable_get(\"@#{param}\"))\n end\n data.store(:platform_data, platform_data)\n data\n end", "def config\n @config ||= begin\n conf = Bolt::Config.new(Bolt::Boltdir.new('.'), {})\n conf.modulepath = [modulepath].flatten\n conf\n end\n end", "def c\n configuration\n end", "def config\n Config.new(@sources, @deployments)\n end", "def config(&block)\n Merb::Config.configure(&block) if block_given?\n Config\n end", "def config(&block)\n Merb::Config.configure(&block) if block_given?\n Config\n end", "def config(&block)\n if block_given?\n block.call(@config)\n else\n @config\n end\n end", "def applied_config\n @applied_config ||= {}\n end", "def c\n configuration\n end", "def serialize_config\n final_conf = []\n config.each do |key, val|\n if val.respond_to?(:call)\n final_conf << Config.new(key, val.call)\n elsif val.is_a?(Array)\n final_conf += val.map { |v| Config.new(key, v) }\n\n # Hashes can have some inner nesting, but only to a certain point.\n elsif val.is_a?(Hash)\n val.each do |k, v|\n if v.is_a?(Array)\n final_conf += v.map { |e| Config.new(key, \"#{k}=#{e}\") }\n else\n final_conf << Config.new(key, \"#{k}=#{v}\")\n end\n end\n else\n final_conf << Config.new(key, val)\n end\n end\n final_conf\n end", "def config_data\n {}\n end", "def config_for(config_name, mode_name=nil)\n mode_name = :all if mode_name.nil? || mode_name.to_s.size == 0\n config_name = :all if config_name.nil? || config_name.to_s.size == 0\n\n # collect the hashes\n all_configs = configs[:all]\n cur_configs = configs[mode_name]\n ret = ::SC::Buildfile::Config.new\n\n # now merge em! -- note that this assumes the merge method will handle\n # self.merge(self) & self.merge(nil) gracefully\n ret.merge!(all_configs[:all]) if all_configs\n ret.merge!(cur_configs[:all]) if cur_configs\n ret.merge!(all_configs[config_name.to_sym]) if all_configs\n ret.merge!(cur_configs[config_name.to_sym]) if cur_configs\n\n # Done -- return result\n return ret\n end", "def build_config(config, allow_missing=false)\n all_definitions = config_meta.map {|p, l| l }.flatten\n Config.new(all_definitions, config, allow_missing)\n end", "def configs\n # Caching here is not necessary or preferred as configurations are\n # cached on the class (which allows late inclusion of configurable\n # modules to work properly).\n bound? ? receiver.class.configs : EMPTY_HASH\n end", "def config(&block)\n if block_given?\n @@config = Config.new\n @@config.tap(&block)\n else\n @@config\n end\n end", "def to_hash\n @configuration\n end", "def to_hash\n @configuration\n end", "def _compiled_assets_initial_hash\n CompiledAssetsHash.new\n end", "def to_hash\n @configuration_data\n end", "def process_config(hash)\n return _compile(hash).to_hash_struct unless keys_to_sym?\n _compile(hash).keys_to_sym.to_hash_struct\n end", "def config(&block)\n instance_eval(&block) if block_given?\n end", "def build_config(dir_or_config_hash)\n if dir_or_config_hash.is_a? String\n # Read config from config.yaml in given dir\n config_path = File.join(dir_or_config_hash, 'config.yaml')\n @config = DEFAULT_CONFIG.merge(YAML.load_file(config_path).symbolize_keys)\n @config[:data_sources].map! { |ds| ds.symbolize_keys }\n @config_mtime = File.stat(config_path).mtime\n else\n # Use passed config hash\n @config = DEFAULT_CONFIG.merge(dir_or_config_hash)\n @config_mtime = nil\n end\n\n # Merge data sources with default data source config\n @config[:data_sources].map! { |ds| DEFAULT_DATA_SOURCE_CONFIG.merge(ds) }\n end", "def config\n @config ||= Smartgen::Configuration.new\n end", "def to_h\n config\n end", "def config\n if Config.config.nil? or Config.config.empty?\n begin\n Config.config = Configuration.load_config(Config.config_file,\n Config.config_options)\n rescue Errno::ENOENT\n Config.config = {}\n end\n end\n\n return Config.config\n end", "def config\n self.class.configuration_builder.configuration\n end", "def config\n @config ||= @module_config || {}\n end", "def config_file_contents\n config = Brightbox::BBConfig.new\n File.read(config.config_filename)\n end", "def config\n @config ||= @module_config || {}\n end", "def config\n @config ||= {}\n end", "def config\n @config ||= {}\n end", "def configuration\n config = {}\n tag_configuration_plugins.each do |p|\n # the first submodule listed is the one which accepts the configuration\n key = p.plugin.modules.first.submodule_name\n config[key] = p.parameters;\n end\n config\n end", "def config\n @config = ActiveSupport::HashWithIndifferentAccess.new(@config) if @config.is_a? Hash\n @config\n end", "def configuration\n cfg = {:default_policy => @default_policy.to_s, :disabled_prompt => @disabled_prompt, :delimiter => @delimiter, :ip => @ip,\n :log_accounting => @log_accounting, :log_authentication => @log_authentication, :log_authorization => @log_authorization,\n :log_level => @logger_level, :login_prompt => @login_prompt, :max_clients => @max_clients, :password_expired_prompt => @password_expired_prompt,\n :password_prompt => @password_prompt, :port => @port, :sock_timeout => @sock_timeout, :testing => @testing }\n cfg[:dump_file] = @dump_file if (@dump_file)\n cfg[:key] = @key if (@key)\n cfg[:logger] = @logger if (@logger)\n cfg[:name] = @name if (@name)\n return(cfg)\n end", "def to_h\n @config\n end", "def to_h\n @config\n end", "def code\n # Start with config code\n code = @client ? generate_config_code : ''\n\n asset_files = AssetFiles.new(@component_name, @component_paths)\n asset_files.component_paths.each do |component_path, component_name|\n code << ComponentTemplates.new(component_path, component_name, @client).code\n code << \"\\n\\n\"\n end\n\n code\n end", "def generate_config(resource)\n resource = symbolize_hash(convert_to_hash(resource))\n config = []\n config << \"lxc.utsname = #{resource[:utsname]}\"\n if(resource[:aa_profile])\n config << \"lxc.aa_profile = #{resource[:aa_profile]}\"\n end\n [resource[:network]].flatten.each do |net_hash|\n nhsh = Mash.new(net_hash)\n flags = nhsh.delete(:flags)\n %w(type link).each do |k|\n config << \"lxc.network.#{k} = #{nhsh.delete(k)}\" if nhsh[k]\n end\n nhsh.each_pair do |k,v|\n config << \"lxc.network.#{k} = #{v}\"\n end\n if(flags)\n config << \"lxc.network.flags = #{flags}\"\n end\n end\n if(resource[:cap_drop])\n config << \"lxc.cap.drop = #{Array(resource[:cap_drop]).join(' ')}\"\n end\n %w(include pts tty arch devttydir mount mount_entry rootfs rootfs_mount pivotdir).each do |k|\n config << \"lxc.#{k.sub('_', '.')} = #{resource[k.to_sym]}\" if resource[k.to_sym]\n end\n prefix = 'lxc.cgroup'\n resource[:cgroup].each_pair do |key, value|\n if(value.is_a?(Array))\n value.each do |val|\n config << \"#{prefix}.#{key} = #{val}\"\n end\n else\n config << \"#{prefix}.#{key} = #{value}\"\n end\n end\n config.join(\"\\n\") + \"\\n\"\n end", "def source_config\n @source_config ||= config[self.class.type].is_a?(Hash) ? config[self.class.type] : {}\n end", "def process_config(parsed_config)\n final_config = []\n parsed_config.each do |config_block|\n # Skip any blocks that are explicitely not enabled\n next if config_block.key?('enabled') && !config_block['enabled']\n if config_block['remoteHost'].instance_of? Array\n final_config += split_multi_remotehost_config_blocks(config_block)\n else\n final_config << config_block\n end\n end\n final_config\nend", "def get_actual_config\n @config\n end", "def job_hash\n [@image,@config].hash\n end", "def job_hash\n [@image,@config].hash\n end", "def config\n yield self if block_given?\n OpenStruct.new(\n site_root: site_root,\n raise_errors: raise_errors\n ).freeze\n end", "def config\n storage_hash = get_api_node(['storage-pools', resource[:name]])\n config_hash = storage_hash['config']\n # Remove volatile.initial_source key from config as \n config_hash.delete(\"volatile.initial_source\")\n return config_hash\n end", "def config(&block)\n instance_exec(&block)\n end", "def config\n filter_config(static.merge(dynamic))\n end", "def config\n (null_config? ? NoConfig.instance : actual_config)\n end", "def configuration(name, &block)\n config = Configuration.new\n config.instance_eval(&block)\n @configurations[name] = config\n end", "def source\n\t\t\t@source_config ||= ConfigurationDefinition.new\n\t\t\tyield @source_config if block_given?\n\t\tend", "def to_rb\n configuration.map { |k,v| \"#{k}(#{v.inspect})\" }.join(\"\\n\")\n end", "def options_config\n unless @squeezed_options_config\n @squeezed_options_config = (cached_options ? cached_options : squeeze(struct_options))\n end\n @squeezed_options_config\n end", "def global_config\n # This entire VM Pooler config\n @config\n end", "def build_config(dir_or_config_hash)\n if dir_or_config_hash.is_a? String\n # Check whether it is supported\n if dir_or_config_hash != '.'\n warn 'WARNING: Calling Nanoc3::Site.new with a directory that is not the current working directory is not supported. It is recommended to change the directory before calling Nanoc3::Site.new. For example, instead of Nanoc3::Site.new(\\'abc\\'), use Dir.chdir(\\'abc\\') { Nanoc3::Site.new(\\'.\\') }.'\n end\n\n # Read config from config.yaml in given dir\n config_path = File.join(dir_or_config_hash, 'config.yaml')\n @config = DEFAULT_CONFIG.merge(YAML.load_file(config_path).symbolize_keys)\n @config[:data_sources].map! { |ds| ds.symbolize_keys }\n @config_mtime = File.stat(config_path).mtime\n else\n # Use passed config hash\n @config = DEFAULT_CONFIG.merge(dir_or_config_hash)\n @config_mtime = nil\n end\n\n # Merge data sources with default data source config\n @config[:data_sources].map! { |ds| DEFAULT_DATA_SOURCE_CONFIG.merge(ds) }\n end", "def raw_hash\n @raw_hash ||= raw_hash_with_cycles[:block]\n end", "def config\n \n # TODO: Re-enable:\n # # Display the value for a specific machine.\n # $ rudy -e prod -r db config param-name\n \n if @@config.nil? || @@config.empty?\n return if @@global.quiet\n raise Rudy::NoConfig\n end\n\n outform = @@global.format == :json ? :to_json : :to_yaml\n \n types = @option.marshal_dump.keys & @@config.keys # Intersections only\n types = @@config.keys if @option.all\n types = [:machines] if types.empty?\n \n if @option.project\n rf = File.join(RUDY_HOME, 'Rudyfile')\n raise \"Cannot find: #{rf}\" unless File.exists?(rf)\n li File.read(rf)\n \n elsif @option.script\n conf = fetch_script_config\n li conf.to_hash.send(outform) if conf\n \n else\n #li \"# ACCOUNTS: [not displayed]\" if types.delete(:accounts)\n types.each do |conftype|\n li \"# #{conftype.to_s.upcase}\"\n next unless @@config[conftype] # Nothing to output\n if conftype == :accounts\n skey = @@config[conftype][:aws][:secretkey]\n @@config[conftype][:aws][:secretkey] = hide_secret_key(skey)\n end\n \n li @@config[conftype].to_hash.send(outform)\n end\n end\n \n end", "def to_config\n HashWithIndifferentAccess.new({\n type: self.class.to_s,\n config: self.config,\n prices: self.prices,\n source_type: self.source\n })\n end", "def config\n @config_file\n end", "def config\n machined.config\n end", "def build_block(transactions, prev_hash = hash)\n Block.new(transactions, prev_hash)\n end", "def build\n { database: @config }\n end", "def to_hash\n ChefConfig::Config.save(true)\n end", "def get_region_config(name)\n if !@__finalized\n raise \"Configuration must be finalized before calling this method.\"\n end\n\n # Return the compiled region config\n @__compiled_region_configs[name] || self\n end", "def config\n yield self\n end" ]
[ "0.70549715", "0.645971", "0.62916964", "0.6029206", "0.5997004", "0.5885874", "0.58523005", "0.58463794", "0.5797542", "0.5766021", "0.57416266", "0.56729025", "0.5577945", "0.55507797", "0.5541904", "0.5541904", "0.5541904", "0.55350095", "0.5531994", "0.55010206", "0.5479835", "0.5465594", "0.54592234", "0.54449105", "0.5436318", "0.5435667", "0.54348135", "0.54108423", "0.53993076", "0.53993076", "0.53714406", "0.53585696", "0.53493834", "0.5345631", "0.53432596", "0.53318346", "0.53269464", "0.53098977", "0.5307939", "0.5302833", "0.5290261", "0.5290261", "0.5288691", "0.52810574", "0.5274408", "0.525223", "0.52470136", "0.5222433", "0.52219033", "0.52192646", "0.5215011", "0.5202638", "0.5202638", "0.51915693", "0.517858", "0.5156095", "0.5152273", "0.5147029", "0.51431406", "0.5141364", "0.5140163", "0.5130374", "0.5128004", "0.5125699", "0.512528", "0.5124776", "0.5124776", "0.51186687", "0.51184434", "0.51138526", "0.5112908", "0.5112908", "0.5109767", "0.51068723", "0.5099666", "0.5090787", "0.5072969", "0.5066707", "0.5066707", "0.5064971", "0.5064811", "0.5064587", "0.5027538", "0.5026864", "0.50159335", "0.5015415", "0.5012578", "0.5008134", "0.5000116", "0.49997893", "0.49974242", "0.4988077", "0.49869853", "0.49767163", "0.49728814", "0.4972286", "0.4971471", "0.49693304", "0.4966851", "0.49637145" ]
0.6664828
1
Merge list of hashes and blocks.
def compile @config_list.inject({}) do |config, hash_or_proc| case hash_or_proc when Hash config.deep_merge hash_or_proc when Proc instance or raise InstanceNotBoundError c = instance.instance_eval(&hash_or_proc) c.is_a?(Hash) || c == nil or raise InvalidBlockReturnValue c ? config.deep_merge(c) : config end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(*hashes, &block)\n dup.update(*hashes, &block)\n end", "def merge(*other_hashes, &blk); end", "def merge!(*other_hashes, &blk); end", "def deep_merge(*other_hashes, &blk); end", "def merge(hash); end", "def merge(hash); end", "def merge(hash); end", "def merge!(hsh)\n raise ArgumentError, 'block version not supported' if block_given?\n self.hmset(*hsh.to_a.flatten)\n self\n end", "def deep_merge!(*other_hashes, &blk); end", "def merge_configurations( list, options = {}, &block )\n invoke_merge = merge_configuration_method( options )\n \n list.inject( format_hash_keys({}) ) do |config, c|\n second = format_hash_keys( block_given? ? yield( c ) : c )\n config.send( invoke_merge, second ) if second\n config\n end\n end", "def blocklists; end", "def process_blocks(blocks); end", "def blocks_to_hash(blocks)\n blocks.each_with_object({}) do |block, hash|\n hash.merge!(block.to_hash)\n end\n end", "def update(*other_hashes, &blk); end", "def addhashes(h1, h2)\n if h1.respond_to?(:merge) && h2.respond_to?(:merge)\n return h1.merge(h2) { |_key, old, new| addhashes(old, new) }\n else\n return h1 + h2\n end\n end", "def set_blocks hash\n\t\t\t@blocks = hash\n\t\tend", "def merge(list) \n\t\treturn list if list.length <= 1\n\n\t\tlen = list.length/2\n\t\tleft = list.slice(0, len)\n\t\tright = list.slice(len, list.length)\n\n\t\tfuse(merge(left), merge(right))\n\tend", "def write_blocks(data, range)\n address_list = []\n length = (data.size.to_f / range).ceil\n\n for block in 0...length\n istart = block * range\n iend = istart + range\n block_data = data[istart...iend]\n block_data = block_data.join if range == 5\n address_list[block] = Digest::SHA1.digest block_data \n write_block(address_list[block], block_data) \n end\n address_list\n end", "def merge!(hash); end", "def parse_hash_list(hash_list)\n hash_list.map { |hash| Base.parse_hash(hash) }.compact\n end", "def combineHashes (hashes)\n mainHash = {}\n hashes.each_with_index do |hash, index|\n if index == 0\n mainHash = hash\n else\n mainHash = combineHashPair(mainHash, hash)\n end\n end\n\n return mainHash\n end", "def deep_merge_hashes(master_hash, other_hash); end", "def make_blocks\n data = compress block_sources\n id = put_blocks_in_cache(data) # would prefer qless id here if possible\n return id\n end", "def add_multi_block(block)\n\t\t\t@encoded << block\n\tend", "def deep_merge(source, hash); end", "def deep_merge(source, hash); end", "def merge(base_hash, derived_hash); end", "def add_block_container_to_list(*args, &block)\n block_container = self.build_block_container(*args, &block)\n if blocks[block_container.name].nil?\n blocks[block_container.name] = [block_container]\n else\n blocks[block_container.name] << block_container\n end\n end", "def scaffold_merge_hashes(*hashes)\n h = {}\n hashes.reverse.each{|hash| h.merge!(hash) if hash}\n h\n end", "def deep_merge!(other_hash, &block); end", "def rh_merge(data)\n _rh_merge(clone, data)\n end", "def deep_merge_hashes!(target, overwrite); end", "def merge!(list)\n\t\tcopy = []\n\t\tcopy << merge(list)\n\t\tlist.clear\n\t\t(copy).each do |v|\n\t\t\tlist << v\n\t\tend\n\tend", "def copy_blocks\n @blocks.map(&:dup)\n end", "def merge_hashes(hashes)\n keys = hashes.first.keys\n container = Hash[*keys.map{|k|[k,[]]}.flatten(1)]\n hashes.each { |hash| hash.each { |(k,v)| container[k] << v } }\n container\n end", "def copy_from(source_list, &block); end", "def block_list(context={})\n \n blocks = []\n blocks.concat(get_menus_as_blocks(context))\n blocks.concat(get_breadcrumb_as_block(context))\n blocks.concat(get_public_breadcrumb_as_block(context))\n blocks.concat(get_views_as_blocks(context))\n blocks.concat(get_contents_as_blocks(context))\n \n return blocks\n \n end", "def all_chunk_hashes\n\t\t\n\t\tbegin\n\t\t\t@all_chunk_map = \"\"\n\t\t\t0.upto(num_chunks-1) { |i|\n\t\t\t\t@all_chunk_map += sha1_chunk(i)\n\t\t\t}\n\n\t\tend unless @all_chunk_map\n\t\t@all_chunk_map\n\tend", "def commit_blob_blocks(container, blob, block_list, options={})\n query = { 'comp' => 'blocklist'}\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n uri = blob_uri(container, blob, query)\n\n headers = service_properties_headers\n unless options.empty?\n headers['Content-MD5'] = options[:content_md5] if options[:content_md5]\n headers['x-ms-blob-content-type'] = options[:blob_content_type] if options[:blob_content_type]\n headers['x-ms-blob-content-encoding'] = options[:blob_content_encoding] if options[:blob_content_encoding]\n headers['x-ms-blob-content-language'] = options[:blob_content_language] if options[:blob_content_language]\n headers['x-ms-blob-content-md5'] = options[:blob_content_md5] if options[:blob_content_md5]\n headers['x-ms-blob-cache-control'] = options[:blob_cache_control] if options[:blob_cache_control]\n headers['x-ms-blob-content-disposition'] = options[:blob_content_disposition] if options[:blob_content_disposition]\n\n add_metadata_to_headers(options[:metadata], headers) if options[:metadata]\n end\n\n body = Serialization.block_list_to_xml(block_list)\n call(:put, uri, body, headers)\n nil\n end", "def finalize_block(hash_val)\n index_hash = [\n 42, 21, 0,\n 1, 43, 22,\n 23, 2, 44,\n 45, 24, 3,\n 4, 46, 25,\n 26, 5, 47,\n 48, 27, 6,\n 7, 49, 28,\n 29, 8, 50,\n 51, 30, 9,\n 10, 52, 31,\n 32, 11, 53,\n 54, 33, 12,\n 13, 55, 34,\n 35, 14, 56,\n 57, 36, 15,\n 16, 58, 37,\n 38, 17, 59,\n 60, 39, 18,\n 19, 61, 40,\n 41, 20, 62,\n 63\n ]\n\n reordered_hash = (0..63).to_a.map { |i| [hash_val.getbyte(index_hash[i])].pack(\"*C\") }\n bytes_array = []\n reordered_hash.each_slice(3) { |b_slice|\n bytes_array << b_slice\n }\n three_byte_sets = bytes_array.first(21)\n last_byte = bytes_array.last\n (three_byte_sets.map { |tbs| encode_triple_bytes(tbs) }.join + encode_last_byte(last_byte))\n end", "def commit_blocks(uri, blocks_committed, blocks_uncommitted, file_path)\n doc = REXML::Document.new \"<BlockList />\"\n blocks_committed.each { |blockid| doc.root.add_element(REXML::Element.new(\"Committed\").add_text(blockid)) }\n blocks_uncommitted.each { |blockid| doc.root.add_element(REXML::Element.new(\"Uncommitted\").add_text(blockid)) }\n\n commit_msg = doc.to_s\n\n blocklist_uri = URI.parse(\"#{uri.to_s}&comp=blocklist\")\n request_id = SecureRandom.uuid\n put_blocklist_req = create_blob_put_request(blocklist_uri, commit_msg, request_id, file_path)\n http = OMS::Common.create_secure_http(blocklist_uri, @proxy_config)\n response = OMS::Common.start_request(put_blocklist_req, http, ignore404 = false, return_entire_response = true)\n\n headers = response.to_hash\n if headers.has_key?(\"etag\")\n etag_quoted = headers[\"etag\"]\n if etag_quoted.is_a?(Array)\n etag_quoted = etag_quoted[0]\n end\n etag = etag_quoted.gsub(/\"/, \"\")\n else\n @log.error(\"Cannot extract ETag from BLOB response #{response}.\")\n etag = \"\"\n end\n return etag\n end", "def add_for_block_size(words)\n # If we're running :truncate_all, then just append the block for this\n # document and return\n if last_block == :truncate_all\n if block_list.empty?\n name = I18n.t('lib.frequency.block_size_dataset',\n num: block_list.size + 1, size: block_size)\n block_list.push(Block.new(words: words[0...block_size],\n name: name))\n end\n return\n end\n\n # Make the first block, if needed\n unless block_list.last\n block_list.push(\n Block.new(\n words: [],\n name: I18n.t('lib.frequency.block_size_dataset',\n num: 1, size: block_size)\n )\n )\n end\n\n # Fill up the last block\n current_left = block_size - block_list.last.words.size\n if current_left.positive?\n block_list.last.words.concat(words.shift(current_left))\n end\n\n # Bail if there weren't enough words in the document to finish that block\n return if block_list.last.words.size < block_size\n\n # Turn the remaining words into blocks and append\n words.in_groups_of(block_size, false).each do |b|\n name = I18n.t('lib.frequency.block_size_dataset',\n num: block_list.size + 1, size: block_size)\n block_list.push(Block.new(words: b, name: name))\n end\n end", "def foldl(list, &block); end", "def add_for_num_blocks(words)\n # We just add to the single block, and we split this when we call\n # #blocks\n single_block.concat(words)\n end", "def update(*hashes, &block)\n hashes.each { |hash| __update__(hash, &block) }\n deep_transform_hashes! if hashes.any? { |hash| hash.class == Hash }\n self\n end", "def merge_data(input_files)\n for filename in input_files\n merge_into_hash(filename)\n end\n sanitize_hash\n end", "def merge(other_hash); end", "def blocks\n @blocks ||= []\n end", "def merge(hash)\n hash.each_value { |v| self << v }\n end", "def blocks\n object.blocks.map{ |x|\n ShallowBlockSerializer.new(x)\n }\n end", "def insert_blocks(blocks, validate: true)\n prev_block = blocks[0]\n blocks[1..-1].each do |block|\n unless block.number == prev_block.number + 1 && block.parent_hash == prev_block.get_hash\n raise InvalidBlockError.new(\"blocks insert orders not correct\")\n end\n end\n\n blocks.each do |block|\n import_block(block, validate: validate)\n end\n end", "def insert_blocks(blocks, validate: true)\n prev_block = blocks[0]\n blocks[1..-1].each do |block|\n unless block.number == prev_block.number + 1 && block.parent_hash == prev_block.get_hash\n raise InvalidBlockError.new(\"blocks insert orders not correct\")\n end\n end\n\n blocks.each do |block|\n import_block(block, validate: validate)\n end\n end", "def blocks_for_block_size\n # We're already done with the last block behavior, if we wanted a small\n # last block, or if we only generated a single block\n return block_list if block_list.size <= 1 || last_block == :small_last\n\n case last_block\n when :truncate_all\n # Implemented in add_for_block_size\n nil\n when :small_last\n # Implemented just above\n nil\n when :truncate_last\n block_list.pop\n else # default to :big_last behavior\n last = block_list.pop\n block_list.last.words.concat(last.words)\n end\n\n block_list\n end", "def merge(hash_1, hash_2)\n\nend", "def ingest_configuration_block!(hash, &block)\n hash.each do |k, v|\n value = if v.is_a?(Hash)\n ingest_configuration_block!(v, &block)\n else\n zip_to_hash(block, *Array(v))\n end\n\n hash.merge! k => value\n end\n end", "def merge(base_hash, derived_hash, **opts); end", "def combine_hashes(*hashes)\n final_hash = {}\n hashes.each do |this_hash|\n # where matching, add the values.\n final_hash = final_hash.merge(this_hash) {\n |_key, oldval, newval| newval + oldval \n }\n end\n return final_hash\nend", "def merge_cells\n inputs = []\n total_amount = 0\n total_capacity = 0\n get_unspent_cells.each do |cell|\n input = {\n previous_output: {\n hash: cell[:out_point][:hash],\n index: cell[:out_point][:index]\n },\n unlock: token_info.unlock_script_json_object(pubkey)\n }\n inputs << input\n input_capacity += cell[:capacity]\n input_amount += cell[:amount]\n end\n outputs = [\n {\n capacity: total_capacity,\n data: [total_amount].pack(\"Q<\"),\n lock: wallet.udt_cell_wallet(token_info).address,\n type: token_info.contract_script_json_object\n }\n ]\n tx = {\n version: 0,\n deps: [api.mruby_out_point],\n inputs: Ckb::Utils.sign_sighash_all_inputs(inputs, outputs, privkey),\n outputs: outputs\n }\n api.send_transaction(tx)\n end", "def merge(other, &block)\n dup.merge!(other, &block)\n end", "def build_block(transactions, prev_hash = hash)\n Block.new(transactions, prev_hash)\n end", "def deep_update(*other_hashes, &blk); end", "def decode_new_multi(block)\n\t\t\n\t\tnot_found = []\n\t\tblock.blocks.each do |bl_id|\n\t\t\tif @decoded[bl_id].nil?\n\t\t\t\tnot_found << bl_id\n\t\t\telse\n\t\t\t\tblock.data ^= @decoded[bl_id]\n\t\t\tend\n\t\tend\n\t\tblock.blocks = not_found\n\t\treturn block\n\tend", "def merge(event_list)\n\t@events = merge_event_lists(@events, event_list)\n end", "def calculate_block_hash(block)\n Digest::SHA256.hexdigest(block.block_index.to_s + block.previous_block_hash + block.timestamp + block.data)\n end", "def blocks\n @blocks ||= []\n end", "def merge_collections mine, other, other_files, &block # :nodoc:\n my_things = mine. group_by { |thing| thing.file }\n other_things = other.group_by { |thing| thing.file }\n\n remove_things my_things, other_files, &block\n add_things my_things, other_things, &block\n end", "def write_to_file\n File.open(config.block_list_path, 'a') do |f|\n block_count = old_newest_block ? (block_list.size - old_newest_block.height - 1) : block_list.size\n block_list = self.block_list.sort{|(k1, v1), (k2, v2)| v1.height <=> v2.height}\n block_list = block_list[(old_newest_block.height + 1)..-1] if old_newest_block\n block_list.each_with_index do |(k, b), index|\n f.write(b.to_payload)\n f.flush\n print \"\\r#{(((index + 1).to_f / block_count) * 100).to_i}% done write parsed block to #{config.block_list_path}.\"\n end\n f.write(newest_block.to_payload)\n puts\n end\n end", "def merge_templates(blocks)\n @content.gsub!(/{{ (\\S*) }}/) do |x|\n blocks[$1]\n end\n end", "def on_getblocks(version, hashes, stop_hash)\n log \">> getblocks: #{version}, #{hashes.size}, #{stop_hash}\"\n end", "def write_blocks(nonce, start_block, block_count, data)\n # TODO: transactional integrity\n \n hmacs = (0...block_count).map do |i|\n load_data = @tree_driver.load_update_path start_block + i\n load_data[:ops] <<\n { :op => :update, :path => load_data[:path], :nonce => nonce,\n :data => data[i * block_size, block_size],\n :block => start_block + i, :session_id => @sid }\n add_tree_data_to_ops load_data[:ops]\n response = @fpga.perform_ops load_data[:ops]\n @tree_driver.perform_ops load_data[:ops]\n response.first\n end\n @disk.write_blocks start_block + @data_start, block_count, data\n { :hmacs => hmacs }\n end", "def blocks(options = {}, &block)\n block_objects(options.merge(object: :blocks), block)\n end", "def merge(source); end", "def list_sync\n nodes = Node.all\n\n nodes.each do |node|\n begin\n response = RestClient.get(\"#{node.end_point}/blocks/list_api\")\n response_body = JSON.parse(response.body).deep_symbolize_keys\n\n response_body[:blocks].each do |block|\n mine_block = Block.create_with(\n blockchain_id: block[:blockchain_id],\n index: block[:index],\n generate_at: block[:generate_at],\n nonce: block[:nonce],\n previous_hash: block[:previous_hash],\n proof_of_work_history: block[:proof_of_work_history],\n confirmation_count: block[:confirmation_count],\n ).find_or_create_by!(\n hash_key: block[:hash_key],\n )\n\n if block[:transactions].present?\n block[:transactions].each do |transaction|\n trade_transaction = TradeTransaction.create_with(\n blockchain_id: transaction[:blockchain_id],\n block_id: mine_block.id,\n sender_address: transaction[:sender_address],\n input_amount: transaction[:input_amount],\n generate_at: transaction[:generate_at],\n ).find_or_create_by!(\n hash_key: transaction[:hash_key],\n )\n\n if block[:transaction_outputs].present?\n block[:transaction_outputs].each do |transaction|\n TransactionOutput.create_with(\n blockchain_id: transaction[:blockchain_id],\n block_id: mine_block.id,\n receiver_address: transaction[:receiver_address],\n output_amount: transaction[:output_amount],\n generate_at: transaction[:generate_at],\n trade_transaction_id: trade_transaction.id,\n ).find_or_create_by!(\n hash_key: transaction[:hash_key],\n )\n end\n end\n end\n end\n end\n\n if response_body[:confirmations].present?\n response_body[:confirmations].each do |confirmation|\n Confirmation.create_with(\n host: confirmation[:host],\n status: confirmation[:status],\n ).find_or_create_by!(\n block_hash_key: confirmation[:block_hash_key],\n )\n end\n end\n rescue => exception\n puts \"[ ---------- exception ---------- ]\"; exception.message.tapp;\n end\n end\n end", "def async_multi_insert_ignore_hash(hashes)\n if (hashes.empty?)\n yield if (block_given?)\n\n return\n end\n\n columns = hashes.first.keys\n\n insertions = hashes.collect do |row|\n columns.collect { |c| row[c] }\n end\n\n async_multi_insert_ignore(columns, insertions) do |n|\n yield(n) if (block_given?)\n end\n end", "def merge(other, &block)\n h = {}\n raise \"can't convert argument into Hash\" unless other.respond_to?(:to_hash)\n other = other.to_hash\n self.each_key{|k| h[k] = self[k]}\n if block\n other.each_key{|k|\n h[k] = (self.has_key?(k))? block.call(k, self[k], other[k]): other[k]\n }\n else\n other.each_key{|k| h[k] = other[k]}\n end\n h\n end", "def merge(boxes)\n content = []\n tracker = nil\n boxes.each do |b|\n content << b.contents\n unless b.tracker.nil?\n if tracker.nil?\n tracker = b.tracker\n else\n tracker = tracker.merge(b.tracker)\n end\n end\n end\n Box.new(content, tracker)\n end", "def merge(*sources); end", "def merge(event_list)\n @events = merge_event_lists(@events, event_list)\n end", "def merge(&block)\n signature = self.dup\n DSL.new(signature).execute(&block) unless block.nil?\n signature\n end", "def push_block_with_to_json(host_item,block_hash,batch_arr)\r\n tmp_hash = { host_to: host_item['host'], port_to: host_item['port'], format_to: 'json' }.merge(block_hash[:filebot] || {})\r\n block_hash[:filebot] = tmp_hash\r\n batch_arr.push(block_hash.to_json) rescue nil\r\n end", "def merge_sort!(&block)\n become_clone_of merge_sort(&block)\n end", "def merge_new list, raw_apps\n new_list = Hash.new\n\n raw_apps.each do\n |app|\n if list[app].class == NilClass\n new_list[app] = 0\n else\n new_list[app] = list[app]\n end\n end\n return new_list\nend", "def rh_merge!(data)\n _rh_merge(self, data)\n end", "def _rh_merge(result, data)\n return _rh_merge_choose_data(result, data) unless data.is_a?(Hash)\n\n data.each do |key, _value|\n next if [:__struct_changing, :__protected].include?(key)\n\n _do_rh_merge(result, key, data)\n end\n [:__struct_changing, :__protected].each do |key|\n # Refuse merge by default if key data type are different.\n # This assume that the first layer merge has set\n # :__unset as a Hash, and :__protected as an Array.\n\n _do_rh_merge(result, key, data, true) if data.key?(key)\n\n # Remove all control element in arrays\n _rh_remove_control(result[key]) if result.key?(key)\n end\n\n result\n end", "def <<(block)\n blocks << block\n end", "def merge(elements)\n elements.inject({}) do |memo, element|\n memo.merge! element\n end\n end", "def initialize(*items)\n @items = {}\n items.each {|item| merge(item)}\n end", "def merge(tuples)\n tuples.each(&method(:<<))\n self\n end", "def merge; end", "def hash\n lists.inject({}){ |hash, p| hash[p[0]] ||= []; hash[p[0]] << p[1]; hash }\n end", "def move_coinbase_tx_to_block_pool(tx_hash)\n Toshi::Models::Transaction.where(hsh: tx_hash).update({pool: Toshi::Models::Transaction::BLOCK_POOL})\n end", "def join(owned_chunks)\n \n end", "def merge(hash_1, hash_2)\n new_hash = Hash.new()\n\n hash_1.each {|key, value| new_hash[key] = value}\n\n hash_2.each {|key, value| new_hash[key] = value}\n new_hash\nend", "def get_hashes(items)\n hashes = []\n items.each do |item|\n hashes.push((Digest::SHA2.new << item).to_s)\n end\n\n return hashes\n end", "def on_getblocks(version, hashes, stop_hash)\n # remember the last few received getblocks messages and ignore duplicate ones\n # fixes unexplained issue where remote node is bombarding us with the same getblocks\n # message over and over (probably related to missing locator fallback handling)\n return if @last_getblocks && @last_getblocks.include?([version, hashes, stop_hash])\n @last_getblocks << [version, hashes, stop_hash]\n @last_getblocks.shift if @last_getblocks.size > 3\n\n blk = @node.store.db[:blk][hash: hashes[0].htb.blob]\n depth = blk[:depth] if blk\n log.info { \">> getblocks #{hashes[0]} (#{depth || 'unknown'})\" }\n\n return unless depth && depth <= @node.store.get_depth\n range = (depth+1..depth+500)\n blocks = @node.store.db[:blk].where(chain: 0, depth: range).order(:depth).select(:hash).all\n send_inv(:block, *blocks.map {|b| b[:hash].hth })\n end", "def add_for_num_blocks(words)\n # We just add to the single block, and we split this when we call\n # #blocks\n @single_block += words\n end", "def deep_merge(other, &block)\n merge(other) do |key, a, b|\n if a.is_a?(Hash) && b.is_a?(Hash)\n a.deep_merge(b, &block)\n elsif a.is_a?(Array) && b.is_a?(Array)\n a + b\n elsif block_given?\n yield key, a, b\n else\n b\n end\n end\n end", "def merge(with); end", "def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend", "def merge_2_array_of_hashes(a_arr, b_arr)\n merge_hash = a_hash = array_of_hashes_2_hash(a_arr) if a_arr\n merge_hash = b_hash = array_of_hashes_2_hash(b_arr) if b_arr\n merge_hash = a_hash.merge!(b_hash) if (a_arr and b_arr)\n merge_hash\nend", "def deep_merge(other_hash, &blk)\n dup.deep_update(other_hash, &blk)\n end" ]
[ "0.6799683", "0.6786558", "0.6630177", "0.6042747", "0.6007586", "0.6007586", "0.6007586", "0.5961966", "0.5896746", "0.5829935", "0.5690515", "0.56281096", "0.5524188", "0.5438165", "0.5432639", "0.54256326", "0.5409345", "0.5319474", "0.5302938", "0.5280837", "0.5239221", "0.5213628", "0.52133346", "0.5207666", "0.52035654", "0.52035654", "0.5200269", "0.51426125", "0.51152784", "0.5104344", "0.50988215", "0.5094602", "0.50695807", "0.50678664", "0.5061592", "0.50532496", "0.5032929", "0.5032596", "0.5031371", "0.5029677", "0.5001604", "0.49960333", "0.4990662", "0.4986735", "0.49830893", "0.49739346", "0.49701473", "0.49661088", "0.4951875", "0.49474543", "0.49462894", "0.49462894", "0.49315083", "0.49191555", "0.49190006", "0.49126735", "0.49066022", "0.48947316", "0.48883778", "0.48812887", "0.4874942", "0.48696598", "0.48621956", "0.4855449", "0.48460674", "0.48350647", "0.48285535", "0.48140612", "0.4803868", "0.4799646", "0.4774062", "0.4773804", "0.47684813", "0.4761397", "0.4753996", "0.47533926", "0.47529763", "0.47470167", "0.47445562", "0.47403774", "0.4737647", "0.47356582", "0.47352403", "0.4734708", "0.47346926", "0.4733297", "0.47330236", "0.47323054", "0.47274837", "0.47053346", "0.4702655", "0.4702332", "0.46962202", "0.46916902", "0.46908838", "0.4689839", "0.4688934", "0.46845818", "0.46778977", "0.4668163", "0.4666036" ]
0.0
-1
Order.tax_zone.tax_rates is used here to check if the order is taxable by Tax Cloud. It's not possible check against the order's tax adjustments because an adjustment is not created for 0% rates. However, US orders must be submitted to Tax Cloud even when the rate is 0%. Note that we explicitly use ship_address instead of tax_address, as per compliance with Tax Cloud instructions.
def is_taxed_using_tax_cloud? ::Spree::TaxRate.for_address(ship_address).any? { |rate| rate.calculator_type == 'Spree::Calculator::TaxCloudCalculator' } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tax_zone\n # Handle case of shipping across state boundaries first\n return nil if (retailer && (retailer.physical_address.state_id != ship_address.state_id))\n \n # Handle other cases:\n if Spree::Config[:tax_using_retailer_address]\n if retailer\n zone_address = retailer.physical_address\n else\n zone_address = nil\n end\n else\n zone_address = Spree::Config[:tax_using_ship_address] ? ship_address : bill_address\n end\n Spree::Zone.match(zone_address) || Spree::Zone.default_tax\n end", "def tax_rate\n self[:tax_rate] || TAX_RATE || product.try(:tax_rate).try(:rate_for, order) || BigDecimal(0)\n end", "def compute(order)\n rate = self.calculable\n tax = 0\n return 0 unless order.ship_address.nil? || order.ship_address.country.nil? || rate.zone.country_list.include?(order.ship_address.country)\n\n if rate.tax_category.is_default and !Spree::Config[ :show_price_inc_vat]\n order.adjustments.each do | adjust |\n next if adjust.originator_type == \"TaxRate\"\n add = adjust.amount * rate.amount\n puts \"Applying default rate to adjustment #{adjust.label} (#{adjust.originator_type} ), sum = #{add}\"\n tax += add\n end\n end\n order.line_items.each do | line_item|\n # do not apply tax_rate if product has no tax_category\n next unless line_item.product.tax_category_id?\n next unless line_item.product.tax_category == rate.tax_category\n next unless line_item.product.tax_category.tax_rates.include? rate\n tax += BigDecimal((line_item.price * rate.amount).to_s).round(2, BigDecimal::ROUND_HALF_UP) * line_item.quantity\n end\n tax\n end", "def delivery_tax_rate\n read_attribute(:delivery_tax_rate) ||\n delivery_service_price.try(:tax_rate).try(:rate_for, self) ||\n BigDecimal(0)\n end", "def create_tax_charge!\n #puts \"Adjustments #{adjustments} TAX #{tax_total}\"\n #puts \"CREATE TAX for #{ship_address} \"\n all_rates = Spree::TaxRate.all\n matching_rates = all_rates.select { |rate| rate.zone.include?(ship_address) }\n if matching_rates.empty?\n matching_rates = all_rates.select{|rate| # get all rates that apply to default country \n rate.zone.country_list.collect{|c| c.id}.include?(Spree::Config[:default_country_id])\n }\n end\n adjustments.where(:originator_type => \"TaxRate\").each do |old_charge|\n old_charge.destroy\n end\n matching_rates.each do |rate|\n #puts \"Creating rate #{rate.amount}\" \n rate.create_adjustment( rate.tax_category.description , self, self, true)\n end\n end", "def tax_rates\n @tax_rates ||= @api.get('TaxRates')['TaxRates'] || []\n end", "def create_tax_charge!\n unless self.account.try(:is_tax_exempt?)\n Spree::TaxRate.adjust(self, line_items)\n Spree::TaxRate.adjust(self, shipments) if shipments.any?\n end\n end", "def tax\n order.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.tax_amount }\n end", "def shipping_taxes\n if self.qualifies_for_free_shipping?\n cost = BigDecimal.new(\"0.0\")\n else\n sc = ShippingCalculator.get_default\n sc.calculate_for(self)\n cost = sc.taxes\n end\n return cost\n end", "def compute(order)\n rate = self.calculable\n tax = 0\n\n if rate.tax_category.is_default\n order.adjustments.each do | adjust |\n next if adjust.originator_type == \"TaxRate\"\n next if adjust.originator_type == \"ShippingMethod\" and not Spree::Config[:shipment_inc_vat]\n\n tax += (adjust.amount * rate.amount).round(2, BigDecimal::ROUND_HALF_UP)\n end\n end\n\n order.line_items.each do | line_item|\n if line_item.product.tax_category #only apply this calculator to products assigned this rates category\n next unless line_item.product.tax_category == rate.tax_category\n else\n next unless rate.tax_category.is_default # and apply to products with no category, if this is the default rate\n end\n tax += (line_item.price * rate.amount).round(2, BigDecimal::ROUND_HALF_UP) * line_item.quantity\n end\n\n tax\n end", "def tax\n self.delivery_tax_amount +\n order_items.inject(BigDecimal(0)) { |t, i| t + i.tax_amount }\n end", "def ship_address_tax_update\n if ship_address and (ship_address_id_changed? or ship_address.changed?)\n create_avalara_tax_adjustment\n end\n end", "def calculate_taxes\n\t\ttax = 0\n\t\t\n\t\tif self.sku.contains_merch?\n\t\t\t# because paypal orders will not have billing addresses, just set \n\t\t\t# billing == to shipping if billing_address is nil\n\t\t\tself.billing_address ||= self.shipping_address \n\t\t\t\n\t\t\ttax = (self.sku.price * self.tax_rate * self.sku_quantity).round if self.billing_address.state == self.nexus\n\t\tend\n\t\t\n\t\tself.tax_amount = tax\n\t\t\n\tend", "def calculate_tax\n if self.vendor.net_prices\n # this is for the US tax system. At this point, total is still net.\n self.tax_amount = self.total * self.tax / 100.0\n # here, total becomes gross\n self.total += tax_amount\n else\n # this is for the Europe tax system. self.total is already gross, so we don't have to modify it here.\n self.tax_amount = self.total * ( 1 - 1 / ( 1 + self.tax / 100.0 ) )\n end\n end", "def apply_tax(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n if self.compound_tax.to_i == 1\n if opts[:precision]\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax1_value/100.0)).to_d if tax1_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n amount += (amount* tax1_value/100.0) if tax1_enabled.to_i == 1\n amount += (amount* tax2_value/100.0) if tax2_enabled.to_i == 1\n amount += (amount* tax3_value/100.0) if tax3_enabled.to_i == 1\n amount += (amount* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n else\n tax = 0\n if opts[:precision]\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax1_value/100.0)).to_d if tax1_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n tax += (amount* tax1_value/100.0) if tax1_enabled.to_i == 1\n tax += (amount* tax2_value/100.0) if tax2_enabled.to_i == 1\n tax += (amount* tax3_value/100.0) if tax3_enabled.to_i == 1\n tax += (amount* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n amount += tax\n end\n amount\n end", "def apply_tax(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n if self.compound_tax.to_i == 1\n if opts[:precision]\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax1_value/100.0)).to_d if tax1_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n amount += format(\"%.#{opts[:precision].to_i}f\", (amount* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n amount += (amount* tax1_value/100.0) if tax1_enabled.to_i == 1\n amount += (amount* tax2_value/100.0) if tax2_enabled.to_i == 1\n amount += (amount* tax3_value/100.0) if tax3_enabled.to_i == 1\n amount += (amount* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n else\n tax = 0\n if opts[:precision]\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax1_value/100.0)).to_d if tax1_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n tax += (amount* tax1_value/100.0) if tax1_enabled.to_i == 1\n tax += (amount* tax2_value/100.0) if tax2_enabled.to_i == 1\n tax += (amount* tax3_value/100.0) if tax3_enabled.to_i == 1\n tax += (amount* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n amount += tax\n end\n amount\n end", "def query_tax_rates(options={})\n path = \"/api/v2/compliance/taxrates\"\n get(path, options)\n end", "def tax_address\n self.ship_address || self.bill_address\n end", "def compute_order(_order)\n raise 'Spree::TaxCloud is designed to calculate taxes at the shipment and line-item levels.'\n end", "def country_isos_requiring_price\n return [nil] unless variant.tax_category\n [nil] + variant_vat_rates.map(&:zone).flat_map(&:countries).flat_map(&:iso)\n end", "def applied_tax_list(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n list = []\n if self.compound_tax.to_i == 1\n if opts[:precision]\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0).to_d} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0).to_d} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0).to_d} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0).to_d} if tax4_enabled.to_i == 1\n else\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => amount*tax1_value/100.0, :amount => amount += amount*tax1_value/100.0} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => amount*tax2_value/100.0, :amount => amount += amount*tax2_value/100.0} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => amount*tax3_value/100.0, :amount => amount += amount*tax3_value/100.0} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => amount*tax4_value/100.0, :amount => amount += amount*tax4_value/100.0} if tax4_enabled.to_i == 1\n end\n else\n if opts[:precision]\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0).to_d} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0).to_d} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0).to_d} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0).to_d} if tax4_enabled.to_i == 1\n else\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => amount*tax1_value/100.0, :amount => amount*tax1_value/100.0} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => amount*tax2_value/100.0, :amount => amount*tax2_value/100.0} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => amount*tax3_value/100.0, :amount => amount*tax3_value/100.0} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => amount*tax4_value/100.0, :amount => amount*tax4_value/100.0} if tax4_enabled.to_i == 1\n end\n end\n list\n end", "def find_or_create_tax_rate(country, tax_rate)\n @tax_rate_cache ||= {}\n if cached_rate = @tax_rate_cache[[country, tax_rate]]\n return cached_rate\n end\n\n existing = tax_rates.find do |rate|\n rate['Status'] == 'ACTIVE' &&\n rate['ReportTaxType'] == tax_rate.xero_report_type &&\n rate['EffectiveRate'].to_d == tax_rate.rate.to_d &&\n (rate['Name'].include?(country.name) || rate['Name'].include?(country.code.upcase))\n end\n\n if existing\n @tax_rate_cache[[country, tax_rate]] = existing['TaxType']\n return existing['TaxType']\n end\n\n rates = @api.post('TaxRates', {\n 'Name' => tax_rate.xero_name(country),\n 'ReportTaxType' => tax_rate.xero_report_type,\n 'TaxComponents' => [\n {\n 'Name' => 'Tax',\n 'Rate' => tax_rate.rate\n }\n ]\n })\n\n type = rates['TaxRates'].first['TaxType']\n @tax_rate_cache[[country, tax_rate]] = type\n type\n end", "def reverse_charge_applies\n as_stripe_customer.tax_exempt == 'reverse'\n end", "def count_tax_amount(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n tax = amount\n if self.compound_tax.to_i == 1\n if opts[:precision]\n tax += format(\"%.#{opts[:precision].to_i}f\", (tax* tax1_value/100.0)).to_d if tax1_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (tax* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (tax* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (tax* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n tax += (tax* tax1_value/100.0) if tax1_enabled.to_i == 1\n tax += (tax* tax2_value/100.0) if tax2_enabled.to_i == 1\n tax += (tax* tax3_value/100.0) if tax3_enabled.to_i == 1\n tax += (tax* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n return tax - amount\n else\n if opts[:precision]\n tax = format(\"%.#{opts[:precision].to_i}f\", (amount* tax1_value/100.0)).to_d\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax2_value/100.0)).to_d if tax2_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax3_value/100.0)).to_d if tax3_enabled.to_i == 1\n tax += format(\"%.#{opts[:precision].to_i}f\", (amount* tax4_value/100.0)).to_d if tax4_enabled.to_i == 1\n else\n tax = amount* tax1_value/100.0\n tax += (amount* tax2_value/100.0) if tax2_enabled.to_i == 1\n tax += (amount* tax3_value/100.0) if tax3_enabled.to_i == 1\n tax += (amount* tax4_value/100.0) if tax4_enabled.to_i == 1\n end\n return tax\n end\n\n end", "def get_tax_rates\n response_xml = http_get(@client, \"#{xero_url}/TaxRates\")\n parse_response(response_xml, {}, {:request_signature => 'GET/tax_rates'})\n end", "def tax_amount\n self[:tax_amount] || (application_fee * tax_rate / 100)\n end", "def tax\n if defined?(tax_rate)\n calculated = subtotal * tax_rate\n return 0 if calculated < 0\n calculated\n else\n 0\n end\n end", "def applied_tax_list(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n list = []\n if self.compound_tax.to_i == 1\n if opts[:precision]\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0).to_d} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0).to_d} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0).to_d} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0), :amount => amount += format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0).to_d} if tax4_enabled.to_i == 1\n else\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => amount*tax1_value/100.0, :amount => amount += amount*tax1_value/100.0} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => amount*tax2_value/100.0, :amount => amount += amount*tax2_value/100.0} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => amount*tax3_value/100.0, :amount => amount += amount*tax3_value/100.0} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => amount*tax4_value/100.0, :amount => amount += amount*tax4_value/100.0} if tax4_enabled.to_i == 1\n end\n else\n if opts[:precision]\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax1_value).to_d/100.0).to_d} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax2_value).to_d/100.0).to_d} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax3_value).to_d/100.0).to_d} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0), :amount => format(\"%.#{opts[:precision].to_i}f\", (amount*tax4_value).to_d/100.0).to_d} if tax4_enabled.to_i == 1\n else\n list << {:name => tax1_name.to_s, :value => tax1_value.to_d, :tax => amount*tax1_value/100.0, :amount => amount*tax1_value/100.0} if tax1_enabled.to_i == 1\n list << {:name => tax2_name.to_s, :value => tax2_value.to_d, :tax => amount*tax2_value/100.0, :amount => amount*tax2_value/100.0} if tax2_enabled.to_i == 1\n list << {:name => tax3_name.to_s, :value => tax3_value.to_d, :tax => amount*tax3_value/100.0, :amount => amount*tax3_value/100.0} if tax3_enabled.to_i == 1\n list << {:name => tax4_name.to_s, :value => tax4_value.to_d, :tax => amount*tax4_value/100.0, :amount => amount*tax4_value/100.0} if tax4_enabled.to_i == 1\n end\n end\n list\n end", "def tax_rate\n Store.settings.tax_rate/100\n end", "def taxes\n calculation = BigDecimal.new(\"0\")\n absolutely_priced? ? base_price = sales_price : base_price = gross_price\n calculation = ( (base_price - rebate) / BigDecimal.new(\"100.0\")) * tax_class.percentage\n end", "def tax_exempt?\n as_stripe_customer.tax_exempt == 'exempt'\n end", "def delivery_tax_amount\n read_attribute(:delivery_tax_amount) ||\n delivery_price / BigDecimal(100) * delivery_tax_rate\n end", "def has_a_tax\n fields = %i[PST GST HST]\n\n errors.add(:base, \"Please specify a tax\") unless fields.any? { |field| send(field).present? }\n end", "def total_tax_amount_validation\n @items.each do |i|\n next if i[:total_tax_amount].to_i * 100 / (i[:total_amount].to_i - i[:total_tax_amount].to_i) == i[:tax_rate].to_i / 100\n\n raise Klarna::Checkout::Errors::OrderValidationError.new(\n 'inconsistent_order_line_total_tax', 'line_total_tax_amount_not_matching_tax_rate'\n )\n end\n end", "def tax_rate=(value)\n @tax_rate = BigDecimal(value.nil? ? 0 : value.to_s)\n end", "def tax_amount_validation\n return if @items.map { |i| i[:total_tax_amount].to_i }.sum == @header[:order_tax_amount].to_i\n\n raise Klarna::Checkout::Errors::OrderValidationError.new(\n 'inconsistent_values', 'total_tax_amount_not_matching_total_tax_amounts'\n )\n end", "def calculate_tax_for(total)\n if self.vat_rate.present? && self.vat_rate != 0.0\n ((self.vat_rate / 100) * total)\n else\n 0\n end\n end", "def tax_rate\n self[:tax_rate] ||= Float(line_items.inject(0) {|sum, l| sum + l.tax_rate}) / line_items.size\n end", "def tax_rate\n self[:tax_rate] || 19.0\n end", "def in_zone?(order)\n # shipping address is in promotional zones?\n if self.zone\n order.shipment && order.ship_address && self.zone.include?(order.ship_address)\n else\n true\n end\n end", "def tax_rate=(value)\n @tax_rate = BigDecimal.new(value.to_s)\n end", "def not_tax_exempt?\n as_stripe_customer.tax_exempt == 'none'\n end", "def taxable?\n true\n end", "def taxable?\n true\n end", "def taxes_amounts\n total_prices_te_by_taxes_rates.map do |taxes_rate, price_without_taxes|\n tax_amount = price_without_taxes.to_f * (taxes_rate / 100)\n\n {formatted_taxes_rate(taxes_rate) => formatted_price(tax_amount)}\n end.reduce({}, :merge)\n end", "def included_taxes(amount)\r\n tax_rate = BigDecimal.new('0')\r\n # perform approximate base amount calculation\r\n included = @taxes.find_all {|tax| tax.included}\r\n included.each do |tax|\r\n tax_rate += tax.effective_rate\r\n end\r\n approx_base = amount / (BigDecimal.new('1.0') + tax_rate)\r\n\r\n #use approximate base to calculate included taxes.\r\n included.each do |tax|\r\n tax.amount = approx_base * tax.effective_rate\r\n end\r\n included\r\n end", "def tax_included?(price_base)\n send(\"included_in_#{price_base}\".to_sym)\n end", "def sync_tax_rates\n subscription = as_stripe_subscription\n\n subscription.default_tax_rates = user.tax_rates\n\n subscription.save\n\n items.each do |item|\n stripe_subscription_item = item.as_stripe_subscription_item\n\n stripe_subscription_item.tax_rates = get_plan_tax_rates_for_payload(item.stripe_plan)\n\n stripe_subscription_item.save\n end\n end", "def get_plan_tax_rates_for_payload(plan)\n tax_rates = user.plan_tax_rates\n\n tax_rates[plan] || nil unless tax_rates.empty?\n end", "def gst_tax_rate\n if !self.tax_accounts.blank?\n self.tax_accounts.first.accountable.tax_rate\n end\n end", "def tax\n rate = 0.09\n tax_amount = (price.to_f * rate)\n return tax_amount\n end", "def get_tax(item_price, tax_rate)\n amt = compute_tax(item_price, tax_rate)\n round_tax(amt)\n end", "def conv_tax\n ((self.respond_to?(:tax) && tax) || 0).to_r\n end", "def set_tax(status, base_total, tax_rate)\n if status == true\n amt = compute_tax(base_total, tax_rate)\n round_tax(amt)\n else\n 0.0\n end\n end", "def sales_tax(options = {})\n options = options.inject({}) { |memo,(k, v)| memo[k.to_sym] = v; memo }\n required_options = %w(from to tax_values)\n\n # Raise an error if the required option is not defined\n required_options.each { |val| raise ArgumentError, \"Missing option :#{val}\" if !options.include?(val.to_sym) }\n\n response = client.request(:get_sales_tax_value) do |soap|\n soap.body = {\n 'UserID' => configuration.user_id,\n 'Password' => configuration.password,\n 'ShipFrom' => options[:from].to_soap,\n 'ShipTo' => options[:to].to_soap,\n 'TaxValueRequests' => { 'TaxValueRequest' => options[:tax_values].map(&:to_soap) }\n }\n end\n\n response_code = response[:get_sales_tax_value_response][:get_sales_tax_value_result][:service_status][:status_nbr]\n\n # Raise exceptions if there was an error when calculating the tax\n case response_code.to_i\n when 401\n raise RuntimeError, 'Invalid From address.'\n when 402\n raise RuntimeError, 'Invalid To address.'\n when 403\n raise RuntimeError, 'Invalid Taxability category.'\n when 500\n raise RuntimeError, 'Internal Strikeiron server error.'\n end\n\n Strikeiron::TaxResult.from_soap(response[:get_sales_tax_value_response][:get_sales_tax_value_result][:service_result])\n end", "def supplies_with_default_tax\n self.supplies_including_tax + self.supplies_excluding_tax.select{|s| [\"CAD\",\"USD\"].include?(s[:currency])}\n end", "def payment_price_tax\n\t\t\t\t\treturn nil\n\t\t\t\tend", "def flat_rate_shipping_cost(cart_or_order)\n if self.flat_rate_shippings.size > 0\n if GeneralConfiguration.shipping_calculated_by_weight?\n weight_total = cart_or_order.shipping_weight_total\n flat_rate_by_weight_total(weight_total)\n else\n order_total = order_total_minus_freely_shipped_products(cart_or_order)\n flat_rate_by_order_total(order_total)\n end\n else\n flat_rate_by_base_rate(cart_or_order.line_items)\n end\n end", "def amount\n estimate_total = self.estimate_line_items.sum(:amount)\n if self.tax_inclusive? \n tax_total = 0 \n else\n tax_total = 0 \n tax_line_items.each do |line_item|\n tax_account = line_item.account\n next if (tax_account.accountable_type=='DutiesAndTaxesAccounts' && tax_account.accountable.calculation_method==4 && tax_account.accountable.split_tax == 0) \n tax_total += line_item.amount\n end\n end\n ship_charge = self.shipping_line_items.sum(:amount)\n estimate_total + tax_total + ship_charge\n end", "def is_base_rate?\n !(GeneralConfiguration.shipping_calculated_by_weight? || is_order_range_flat_rated?)\n end", "def update_zone_prices\n # Same country do not update prices\n return if get_user_country_id == object.ship_address.country.id \n # Update the order prices using the ship to country\n @order.update_zone_prices(object.ship_address.country.id)\n # Update selected country with ship to country\n session[:zone_pricing_country] = object.ship_address.country.id\n end", "def taxable?\n self.taxable\n end", "def calculate current_tax_rate, delivery_price=nil\n delivery = delivery_price.nil? ? (delivery.try(:price) || 0) : delivery_price\n subtotal = (total_price + delivery)\n tax = subtotal * current_tax_rate\n return {\n subtotal: subtotal,\n tax: tax,\n delivery: delivery,\n total: subtotal + tax\n }\n end", "def tax_rate(region_id, time = Time.zone.now)\n TaxRate.for_region(region_id).at(time).active.order('start_date DESC').first\n end", "def shipping\n if defined?(shipping_rate)\n shipping_rate\n else\n 0\n end\n end", "def taxable?\n self[:taxable]\n end", "def tax_total\n adjustments.where(:originator_type => \"TaxRate\").map(&:amount).sum\n end", "def tax_calc\n tax = @quantity * @price * @taxe\n end", "def count_amount_without_tax(amount, options = {})\n opts = {}.merge(options)\n amount = amount.to_d\n if self.compound_tax.to_i == 1\n if opts[:precision]\n amount = format(\"%.#{opts[:precision].to_i}f\", (amount/(tax4_value.to_d+100)*100)).to_d if tax4_enabled.to_i == 1\n amount = format(\"%.#{opts[:precision].to_i}f\", (amount/(tax3_value.to_d+100)*100)).to_d if tax3_enabled.to_i == 1\n amount = format(\"%.#{opts[:precision].to_i}f\", (amount/(tax2_value.to_d+100)*100)).to_d if tax2_enabled.to_i == 1\n amount = format(\"%.#{opts[:precision].to_i}f\", (amount/(tax1_value.to_d+100)*100)).to_d if tax1_enabled.to_i == 1\n else\n amount = (amount/(tax4_value.to_d+100)*100) if tax4_enabled.to_i == 1\n amount = (amount/(tax3_value.to_d+100)*100) if tax3_enabled.to_i == 1\n amount = (amount/(tax2_value.to_d+100)*100) if tax2_enabled.to_i == 1\n amount = (amount/(tax1_value.to_d+100)*100) if tax1_enabled.to_i == 1\n end\n else\n amount = amount.to_d/((sum_tax.to_d/100.0)+1.0).to_d\n amount = format(\"%.#{opts[:precision].to_i}f\", amount) if opts[:precision]\n end\n amount\n end", "def paypal_variant_tax(sale_price, variant) \n 0.0\n end", "def tax_percentage(tax_rate)\n tax_rate ? tax_rate.tax_percentage : 0.0\n end", "def tax1_enabled\n return 1\n end", "def compute_order(_order)\n raise \"Spree::Calculator::HandlingFeeCalculator is designed to \" \\\n \"calculate taxes at the line-item level.\"\n end", "def tax1_enabled\n return 1\n end", "def qualifies_for_free_shipping?\n \n # Adjust default shipping rate based on customer tag\n customer = Input.cart.customer\n \n if customer\n \n if customer.tags.include?(\"swell_vip_silver\")\n DEFAULT_MINIMUM = Money.new(cents: 100) * 75.00\n end\n \n if customer.tags.include?(\"swell_vip_gold\")\n DEFAULT_MINIMUM = Money.new(cents: 100) * 75.00\n end\n \n end\n \n # Determine if the order qualifies for free shipping...\n \n # Case: Cart total is greater than the default minimum\n if Input.cart.subtotal_price >= DEFAULT_MINIMUM\n HIDE_FREE_SHIPPING = false\n end\n \nend", "def tax_rate\n write_attribute( :tax_rate, Float(line_items.inject(0) {|sum, l| sum + l.tax_rate}) / line_items.size)\n end", "def valid_shipping_cost?(cost)\n flatrate_shipping_option_costs.member? cost\n end", "def tax_money_owed\n if update_taxable <= 43953 && update_taxable >= 0\n update_taxable * 0.15\n elsif update_taxable >= 43954 && update_taxable <=87907\n (43953*0.15) + ((update_taxable-43953) * 0.22)\n elsif update_taxable >= 87908 && update_taxable <=136270\n (43953*0.15)+ (48363*0.22) + (update_taxable * 0.26)\n elsif update_taxable >= 136270\n (43953*0.15)+ (48363*0.22)+ (43954*0.26) + (update_taxable * 0.29)\n else\n update_taxable \n end\n end", "def tax_total\n self.tax_amount = line_items.inject(Money.new(0, self.currency || Money.default_currency)) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculates average rate, leave for compatibility reasons\n self.tax_amount\n end", "def test_return_tax_cost\n # Create a cart and add some products.\n a_cart = Order.new\n a_cart.add_product(items(:red_lightsaber), 2)\n a_cart.add_product(items(:blue_lightsaber), 4)\n \n # By default tax is zero.\n assert_equal a_cart.tax_cost, a_cart.total * a_cart.tax\n end", "def apply(taxes)\n @order.line_items.each do |item|\n taxed_items = taxes.line_item_taxes.select { |i| i.item_id == item.id }\n update_adjustments(item, taxed_items)\n end\n\n @order.shipments.each do |item|\n taxed_items = taxes.shipment_taxes.select { |i| i.item_id == item.id }\n update_adjustments(item, taxed_items)\n end\n end", "def compute_tax(item_price, tax_rate)\n item_price * tax_rate\n end", "def sum_of_tax_rates line_item\n line_item.adjustments.tax.\n joins(\"INNER JOIN spree_tax_rates ON spree_tax_rates.id = spree_adjustments.source_id\").\n where(spree_tax_rates: { included_in_price: true }).\n map(&:source).\n sum(&:amount)\n end", "def test_get_total_tax_cost\n expected_value = (@order.line_items_total) * (@order.tax/100)\n assert_equal expected_value, @order.tax_cost\n end", "def price_with_tax\n price_as_price.with_tax\n end", "def get_tax(price, quantity, tax_rate)\n\t\ttax = (price * quantity) * tax_rate\n\t\tround_tax(tax)\n\tend", "def product_tax_rate(state_id, tax_time = Time.now)\n product.tax_rate(state_id, tax_time)\n end", "def tax_amount(amount)\n return ((amount * 8.9)/100).round(2)\nend", "def calc_spec_tax(_amount)\n _amountret = _amount.to_f * @_taxpr\n return _amountret\n end", "def calcuate_tax\n @price * 0.12\n end", "def reset_tax_attributes(order)\n order.all_adjustments.tax.destroy_all\n order.line_items.each do |line_item|\n line_item.update_attributes!({\n additional_tax_total: 0,\n adjustment_total: 0,\n pre_tax_amount: 0,\n included_tax_total: 0,\n })\n\n Spree::Adjustable::AdjustmentsUpdater.new(line_item).update\n line_item.save!\n end\n\n order.update_attributes!({\n additional_tax_total: 0,\n adjustment_total: 0,\n included_tax_total: 0,\n })\n\n Spree::OrderUpdater.new(order).update\n order.save!\n end", "def original_price\n order.total_price_with_taxes\n end", "def test_rates_for_locations_with_only_zip_and_country \n setup_user\n response = @carrier.find_rates(\n @locations[:bare_beverly_hills],\n @locations[:bare_ottawa],\n @packages.values_at(:wii)\n )\n \n assert response.rates.size > 0\n end", "def apply_taxes(taxman)\n @taxes = BigDecimal.new(0)\n if @is_imported\n @taxes += taxman.apply_tax(@price, taxman.import_duty)\n end\n unless taxman.exempt_basic.include?(@type)\n @taxes += taxman.apply_tax(@price, taxman.sales_tax)\n end\n @price += @taxes\n end", "def tax_amount\n rounded(tax.percent_of(price))\n end", "def compute_shipment_or_line_item(item)\n rate.included_in_price ? raise('TaxCloud cannot calculate inclusive sales taxes.') : round_to_two_places(tax_for_item item)\n end", "def tax_total\n self.tax_amount = line_items.inject(0.to_money) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculates average rate, leave for compatibility reasons\n self.tax_amount\n end", "def test_rates_for_locations_with_only_zip_and_country \n response = @carrier.find_rates(\n @locations[:bare_beverly_hills],\n @locations[:bare_ottawa],\n @packages.values_at(:wii)\n )\n assert response.rates.size > 0\n end", "def test_get_shipping_prices\n # Test a national shipping order.\n assert_same_elements @order.get_shipping_prices, OrderShippingType.get_domestic\n \n # Turn it into an international one and test.\n an_address = order_addresses(:santa_address)\n an_address.country = countries(:GB)\n an_address.save\n @order.reload\n assert_same_elements @order.get_shipping_prices, OrderShippingType.get_foreign\n \n # Now we say that we are in that same other country.\n prefs = {\n \"store_home_country\" => countries(:GB).id\n }\n assert Preference.save_settings(prefs)\n \n # And that same shipment should be national now.\n assert_same_elements @order.get_shipping_prices, OrderShippingType.get_domestic\n end", "def tax\n price_as_price.tax\n end" ]
[ "0.67445195", "0.64885736", "0.64810884", "0.6389201", "0.6353229", "0.6327538", "0.6295835", "0.62660307", "0.6210555", "0.615835", "0.6079887", "0.60322136", "0.59983456", "0.59750485", "0.5974582", "0.59721017", "0.5966243", "0.59077084", "0.58879435", "0.58596754", "0.5852984", "0.58483744", "0.58320385", "0.5821488", "0.58117783", "0.5807546", "0.5799569", "0.5793859", "0.57839495", "0.57829434", "0.57511693", "0.572672", "0.57056296", "0.56942564", "0.569398", "0.56763744", "0.5672635", "0.5671126", "0.5661529", "0.56428486", "0.5623085", "0.56193084", "0.5611104", "0.5611104", "0.55968463", "0.55941594", "0.55839497", "0.55794996", "0.55721766", "0.5567244", "0.5549319", "0.55493075", "0.55271596", "0.5518745", "0.5512806", "0.5486803", "0.5479498", "0.5423575", "0.54095834", "0.53912956", "0.53829914", "0.53516036", "0.53436524", "0.5337348", "0.53140914", "0.52880126", "0.52828246", "0.5279419", "0.5277857", "0.5273251", "0.52654594", "0.5256702", "0.5249485", "0.524132", "0.52391213", "0.5235636", "0.5225481", "0.522523", "0.5221319", "0.5216034", "0.52051514", "0.51975447", "0.5196116", "0.5183732", "0.5177782", "0.5177502", "0.5176966", "0.51747495", "0.5168579", "0.51657057", "0.5148586", "0.5144924", "0.5142039", "0.5138469", "0.5136184", "0.5119443", "0.5114072", "0.5108551", "0.51048607", "0.5104693" ]
0.70569694
0
GET /hands/1 GET /hands/1.json
def show @hand = Hand.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @hand } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @hands = Hand.all\n end", "def show\n @hand_state = HandState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hand_state }\n end\n end", "def index\n @economy_hands = EconomyHand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @economy_hands }\n end\n end", "def show\n @hand_reciept = HandReciept.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hand_reciept }\n end\n end", "def new\n @hand = Hand.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hand }\n end\n end", "def hands\n @game_stats['hands']\n end", "def index\n @all_hands = AllHand.all\n end", "def hand\n hands.first\n end", "def show\n @handicapping_method = HandicappingMethod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @handicapping_method }\n end\n end", "def show\n @shichoson = Shichoson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shichoson }\n end\n end", "def show\n @human = Human.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @human }\n end\n end", "def show\n @human = Human.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @human }\n end\n end", "def show\n @thought = Thought.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thought }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @economy_hand }\n end\n end", "def show\n @shoot = Shoot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shoot }\n end\n end", "def show\n @rainbow = Rainbow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rainbow }\n end\n end", "def show\n @hetong = Hetong.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hetong }\n end\n end", "def show\n @hair_colour = HairColour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hair_colour }\n end\n end", "def hand\n return unless retrieve_active_hand?\n gon.watch.rabl template: 'app/views/active_hands/hand.rabl', as: 'hand'\n end", "def show\n @witch = Witch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @witch }\n end\n end", "def show\n @wash = Wash.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wash }\n end\n end", "def show\n @guitar = Guitar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guitar }\n end\n end", "def show\n @mood = Mood.find(params[:id])\n respond_to do |format|\n format.any { render :json => @mood }\n end\n end", "def show\n @harvest = Harvest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @harvest }\n end\n end", "def show\n @harvest = Harvest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @harvest }\n end\n end", "def show\n @he = He.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @he }\n end\n end", "def show\n @rock = Rock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rock }\n end\n end", "def show\n @cheer = Cheer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cheer }\n end\n end", "def show\n @shout = Shout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shout }\n end\n end", "def show\n @shout = Shout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shout }\n end\n end", "def show\n @handbook_division = HandbookDivision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @handbook_division }\n end\n end", "def show\n render json: @hero\n end", "def show\n @harvesting = Harvesting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @harvesting }\n end\n end", "def show\n @harvesting = Harvesting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @harvesting }\n end\n end", "def new\n @hand_state = HandState.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hand_state }\n end\n end", "def show\n @hive = Hive.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hive }\n end\n end", "def show\n @route = Route.find(params[:id])\n @driver = Hitchhiker.find(@route.hitchhiker_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @route }\n end\n end", "def show\n @habit = Habit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @habit }\n end\n end", "def send_hand\n hand = @@game_server.get_user_hand(user_id)\n puts hand.inspect\n payload = { 'type' => 'hand', 'data' => hand.map{ |c| c.to_hash } }.to_json\n @connection.send payload\n end", "def show\n @what = What.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @what }\n end\n end", "def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge }\n end\n end", "def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge }\n end\n end", "def show\n @heli_kit = HeliKit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heli_kit }\n end\n end", "def show\n @shooting = Shooting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shooting }\n end\n end", "def show\n @joy = Joy.find(params[:id])\n render json: @joy\n end", "def show\n @hardware = Hardware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hardware }\n end\n end", "def show\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @broad }\n end\n end", "def show\n story = Story.find(params[:id])\n render json: story\n end", "def show\n @house = House.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @house }\n end\n end", "def show\n @house = House.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @house }\n end\n end", "def show\n @house = House.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @house }\n end\n end", "def show\n @shunfengch = Shunfengche.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shunfengch }\n end\n end", "def create\n @hand = Hand.new(params[:hand])\n\n respond_to do |format|\n if @hand.save\n format.html { redirect_to @hand, notice: 'Hand was successfully created.' }\n format.json { render json: @hand, status: :created, location: @hand }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hand.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @scratcher = Scratcher.find(params[:id])\n\n render json: @scratcher\n end", "def destroy\n @hand = Hand.find(params[:id])\n @hand.destroy\n\n respond_to do |format|\n format.html { redirect_to hands_url }\n format.json { head :no_content }\n end\n end", "def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end", "def show\n @horace = Horace.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @horace }\n end\n end", "def show\n @chair = Chair.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chair }\n end\n end", "def show\n @chair = Chair.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chair }\n end\n end", "def show\n @study = Study.find(params[:id])\n render json: @study\n end", "def index\n @harvestings = Harvesting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end", "def show\n @hotele = Hotele.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hotele }\n end\n end", "def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @challenge }\n end\n end", "def show\n @powerchip = Powerchip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @powerchip }\n end\n end", "def show\n @heart_rate_type = HeartRateType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heart_rate_type }\n end\n end", "def show\n @open_shoot = OpenShoot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @open_shoot }\n end\n end", "def create\n @hand = Hand.new(hand_params)\n\n respond_to do |format|\n if @hand.save\n format.html { redirect_to @hand, notice: 'Hand was successfully created.' }\n format.json { render action: 'show', status: :created, location: @hand }\n else\n format.html { render action: 'new' }\n format.json { render json: @hand.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end", "def show\n @casefile = Casefile.find(params[:casefile_id])\n @hearing = @casefile.hearings.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hearing }\n end\n end", "def index\n champions = Champion.all\n render json: champions\n end", "def show\n @story_choice = StoryChoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story_choice }\n end\n end", "def show\n @railway = Railway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @railway }\n end\n end", "def show\n render json: @shelter\n end", "def set_hand\r\n @hand = Hand.find(params[:id])\r\n end", "def index\n @heroes = Hero.all\n\n render json: @heroes\n end", "def show\n @pick = @game.picks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pick }\n end\n end", "def show\n @energy = Energy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @energy }\n end\n end", "def show\n @squawk = Squawk.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @squawk }\n end\n end", "def heros\n get('/hero/')\n end", "def show\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @therapist }\n end\n end", "def show\n @piece = Piece.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @piece }\n end\n end", "def show\n @piece = Piece.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @piece }\n end\n end", "def show\n @plate = Plate.find(params[:id])\n\n render json: @plate\n end", "def hearings(options = {})\n get('/hearings', options)\n end", "def set_hand\n @hand = Hand.find(params[:id])\n end", "def index\n \n @steps = @quest.steps\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def show_hands(players)\n for player in players\n for hand in player.hands\n puts \"#{player.to_s} ------ #{hand.to_s}\"\n end\n end\n end", "def show\n @haptic_fidelity = HapticFidelity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @haptic_fidelity }\n end\n end", "def show\n @wig = Wig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wig }\n end\n end", "def show\n @scheme = Scheme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scheme }\n end\n end", "def show\n @person = Person.find(params[:id])\n @hair_colours = Person.get_hair_colours\n @eye_colours = Person.get_eye_colours\n @heights_feet = Person.get_heights_feet\n @heights_inches = Person.get_heights_inches\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show_hands\n puts \"\\nDealer hand: #{@dealer_hand}\" \" | Hand Value: #{hand_value(@dealer_hand)}\"\n puts \"\\nYour hand: #{@player_hand}\" \" | Hand Value: #{hand_value(@player_hand)}\"\n end", "def show\n @healthrecord = Healthrecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @healthrecord }\n end\n end", "def show\n @health_record = HealthRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @health_record }\n end\n end", "def show_hands_initial\n player.show_hand\n dealer.show_hand\n end", "def show\n @band = Band.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @band }\n end\n end", "def show\n @holdgame = Holdgame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holdgame }\n end\n end", "def show\n @holdgame = Holdgame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holdgame }\n end\n end", "def index\n @shots = Shot.all\n\n render json: @shots\n end" ]
[ "0.67723274", "0.6753142", "0.669063", "0.64312834", "0.63980657", "0.63737243", "0.63526034", "0.6323537", "0.6305141", "0.61993444", "0.6167534", "0.6167534", "0.61538374", "0.61430097", "0.6124894", "0.60230935", "0.60146844", "0.59938633", "0.5981042", "0.5971092", "0.59683913", "0.59604156", "0.59416074", "0.5918202", "0.5918202", "0.59121656", "0.59048086", "0.5902705", "0.5887211", "0.5886439", "0.58773816", "0.5845946", "0.58421767", "0.58421767", "0.58341885", "0.5828775", "0.5822304", "0.58122647", "0.57986575", "0.5783628", "0.5780254", "0.577945", "0.5779266", "0.57738495", "0.5772044", "0.57689595", "0.5754535", "0.57509637", "0.57492936", "0.57492936", "0.57492936", "0.57480603", "0.574436", "0.5742306", "0.5740937", "0.5734448", "0.57321024", "0.57220674", "0.57220674", "0.572103", "0.5718255", "0.5715138", "0.5709166", "0.5708353", "0.57061195", "0.57026494", "0.5702356", "0.5698169", "0.56924087", "0.5689387", "0.5666968", "0.56659883", "0.56584954", "0.5656351", "0.5655841", "0.5652662", "0.56459963", "0.56428444", "0.56415427", "0.56308657", "0.5626602", "0.5626602", "0.56256276", "0.5624417", "0.56243885", "0.56215465", "0.5620423", "0.56188303", "0.5613929", "0.5605495", "0.5603598", "0.5602169", "0.55957043", "0.55915785", "0.5584873", "0.55808693", "0.5574763", "0.5574763", "0.55726594" ]
0.7394412
1
Prepare things for rooms
def ready(packet) @connected = true send_nick() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_room\n unless @dungeon.first_room\n @enemy = Zarta::Enemy.new(@dungeon) if enemy_spawned\n end\n @dungeon.first_room = false\n @weapon = Zarta::Weapon.new(@dungeon) if weapon_spawned\n @stairs = stairs_spawned\n end", "def initialize\n @rooms = make_rooms\n @reservations = []\n @blocks = []\n end", "def initialize\n @reservations_list = []\n @block_list = []\n @all_rooms = []\n make_hotel_rooms\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 initialize(name, fee, capacity) #needs to be same number of arguments as @room_1 in setup\n @name = name\n @fee = fee\n @capacity = capacity\n @guests = []\n @playlist = []\n end", "def prepare_all\n reservations = []\n @items.each do |id, quantity|\n quantity.times do\n reservations << Reservation.new(reserver: reserver,\n start_date: @start_date,\n due_date: @due_date,\n equipment_model_id: id)\n end\n end\n reservations\n end", "def make_hotel_rooms\n (1..20).each do |num|\n @all_rooms << num #Hotel::Room.new(num) I don't think I have to do this\n end\n end", "def initialize\n @rooms = { #defines the rooms available for use on each floor\n :upstairs => [\"Master Bedroom\", \"A Guest Room\", \"Tower\", \"Balcony\", \"Observatory\", \"The Hole Room\"],\n :main => [\"Kitchen\", \"Library\", \"Study\", \"Dining Room\", \"Living Room\", \"Vault\"],\n :downstairs => [\"Furnace Room\", \"Chapel\", \"Storage Room\", \"The Pit\"]\n }\n\n @used_rooms = []\n @omen_count = 0 #Omens are a game event that change the story line. Once the omen count reaches 10 the haunt starts\n @player = Character.new\n intro #script\n entry_hall(\"Main Hallway\")\n game\n end", "def build_room_buildings()\n buildings = {}\n $item_by_id.fetch('/buildings/')[:map].each do |building, roomlist|\n roomlist = [] if roomlist.nil?\n\n bcode = building.to_s.upcase\n list = []\n roomlist.map(&$to_room_or_nil).reject(&:nil?).each do |r|\n list << r\n end\n rooms.select { |r| r[:slug].upcase.start_with? bcode }.each do |r|\n list << r\n end\n buildings[bcode] = list.uniq { |r| r[:slug] }.sort_by { |r| [r[:rank], r[:conference_room_id]] }\n buildings[bcode].each do |r|\n r[:building] = bcode\n end\n end\n\n # make sure there are no rooms left without a :building meta attribute\n begin\n errors = rooms.select { |r| r[:building].nil? }\n raise \"there are #{errors.size} room(s) without a building assignment, please put them into content/building.yaml: #{errors.map { |r| r[:slug] }.join(\", \")}\" unless errors.empty?\n end\n\n room_to_building = {}\n buildings.each do |bcode, rooms|\n rooms.each do |r|\n room_to_building[r[:slug]] = bcode\n end\n end\n\n [buildings, room_to_building]\n end", "def initialize\n @rooms = list_rooms\n @reservations = []\n end", "def room; end", "def initialize\n \t@grid_w = 50\n \t@grid_h = 40\n \t@grid = []\n\t\n\t\t@player_x = 0\n\t\t@player_y = 0\n\t\t@has_enviroment_rendered=false\n\t\t#setup and fill grid with walls\n \t@grid_w.times.with_index do |x|\n \t\t@grid[x] = []\n\t\t\t@grid_h.times.with_index do |y|\n \t\t\t@grid[x][y]= 1\n \t \tend\n \tend\n\t\tmin_rooms = 2\n\t\tmax_rooms = 10\n\t\t#setup number of rooms that will exist\n\t\t@n_rooms = rand(max_rooms - min_rooms) + min_rooms\n\t\tputs \"n rooms #{@n_rooms}\"\n\t\trooms = []\n\t\t#define the size of each room\n\t\t@n_rooms.times.with_index do |room|\n\t\t\trooms[room] = make_room 8,10\n\t\tend\n\t\n\t\t#clears the walls from where rooms will be \n\t\trooms.each_with_index do |r,i| \n\t\t\t(r[:x]..r[:x] + r[:w]).each do |x|\n\t\t\t\t(r[:y]..r[:y] + r[:h]).each do |y|\n\t\t\t\t\t@grid[x][y]= 0\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#create pathways towards the next room\n\t\trooms.each_cons(2) do |(cur_room, next_room)|\n\t\t\t#find the center of each room \n\t\t\tcenter_x = cur_room[:x] + cur_room[:w].idiv(2)\n\t\t\tcenter_y = cur_room[:y] + cur_room[:h].idiv(2)\n\n\t\t\tnext_center_x = next_room[:x] + next_room[:w].idiv(2)\n\t\t\tnext_center_y = next_room[:y] + next_room[:h].idiv(2)\n\n\t\t\t#loops between each rooms X and Y positions \n\t\t\t#this can be approached differently\n\t\t\t(min(center_x,next_center_x)..max(center_x,next_center_x)).each do |x|\n\t\t\t\t(min(center_y,next_center_y)..max(center_y,next_center_y)).each do |y|\n\t\t\t\t\t#checking if this position is in-line with either rooms x or y centres\n\t\t\t\t\t@grid[x][y] = 0 if y == center_y || y == next_center_y || x == center_x || x == next_center_x\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@new_grid = []\n\t\t#set new grid to prune unneeded walls to improve performance\n\t\t@grid_w.times.with_index do |x|\n\t \t@new_grid[x] = []\n\t \t@grid_h.times.with_index do |y|\n \t\t\t@new_grid[x][y]= @grid[x][y]\n\t\t\tend\n\t end\n\t\t#set up values\n\t\t@grid_w.times.with_index do |x|\n \t\t@grid_h.times.with_index do |y|\n\t\t\t\t#if surrounded it should not be filled in\n\t\t\t\tif check_surrounding_tiles x,y\n\t\t\t\t\t@grid[x][y] = 0\n\t\t\t\tend\n \t\tend\n \tend\n\t\t#this will set the players starting position to a known safe area\n\t\t@player_x = rooms[0][:x] + rooms[0][:w].idiv(2)\n\t\t@player_y = rooms[0][:y] + rooms[0][:h].idiv(2)\n\t\t@grid[@player_x][@player_y] = 2\n\tend", "def create_rooms(rooms_params)\n\t\trooms_params[:extra_info] ||= \"\"\n\n\t\trooms_params[:range].each do |number|\n\t\t\trooms << Room.create( number: number.to_i, \n\t\t\t\t\t\t\t\t\t\t\t\t\t capacity: rooms_params[:capacity].to_i, \n\t\t\t\t\t\t\t\t\t\t\t\t\t extra_info: rooms_params[:extra_info],\n\t\t\t\t\t\t\t\t\t\t\t\t\t name: rooms_params[:name] )\n\t\tend\n\tend", "def finalize\n\t\t@dest_room = Dungeon_Crawler.dungeon.room_at(@dest)\n\tend", "def prepare\n end", "def prepare\n end", "def initialize\n @credentials = Authenticate.get_credentials\n @db = CouchRest.database(\"http://#{@credentials[\"user\"]}:#{@credentials[\"password\"]}@localhost:5984/rooms\")\n @rooms = {}\n @db.get(\"_design/room\").\n view(\"all_rooms\")['rows'].map{|x| x['value']}.each do |room|\n id = room['_id']\n @rooms[id] = {}\n @rooms[id]['_id'] = id\n @rooms[id]['room'] = room\n devices = @db.get('_design/room').view('devices_for_room', {:key => id})['rows'].map{|x| x['value']}\n @rooms[id]['sources'] = @db.get('_design/cmdr_web').view('sources', {:key => id})['rows'].map{|x| x['value']}\n @rooms[id]['actions'] = @db.get('_design/cmdr_web').view('actions', {:key => id})['rows'].map{|x| x['value']}\n @rooms[id]['room_name'] = room['attributes']['name']\n devs = {}\n DEVICES.each do |r,_|\n devs[r] = room['attributes'][r]\n end\n @rooms[id]['devices'] = devs\n @rooms[id]['devices_by_id'] = {}\n @rooms[id]['device_record_by_resource'] = {}\n devs.each do |k,v|\n d = devices.find {|d| d['attributes']['name'] == v}\n if d\n @rooms[id]['devices_by_id'][d['_id']] ||= []\n @rooms[id]['devices_by_id'][d['_id']] << k\n end\n @rooms[id]['device_record_by_resource'][k] = d\n end\n end\n end", "def create_default_rooms\n wish_list_name = 'Wish List'\n self.dressing_rooms.create label: wish_list_name unless self.dressing_rooms.any? {|room| room.label == wish_list_name}\n\n closet_name = 'My Closet'\n self.dressing_rooms.create label: closet_name unless self.dressing_rooms.any? {|room| room.label == closet_name}\n\n session_name = \"My Cart\"\n session_room = self.dressing_rooms.create label: session_name unless self.dressing_rooms.any? {|room| room.label == session_name}\n self.recent_dressing_room = session_room if self.recent_dressing_room.nil?\n self.save!\n end", "def room\n end", "def update_rooms\n Room.find_or_create_by(name: @moving_item.room)\n end", "def allocate_rooms(sorted_teams_and_adjs, round, format)\n\t\t \tsorted_teams = sorted_teams_and_adjs[0].to_a;\n\t\t sorted_wings = sorted_teams_and_adjs[1].to_a;\n\t\t \n\t\t #seperate the chair judges\n\t\t num_rooms = sorted_teams.count / GlobalConstants::FORMAT[format][:num_teams_per_room];\n\t\t sorted_chairs = sorted_wings.pop(num_rooms);\n\n\t\t #shuffle adjs?\n\n\t\t #get list of rooms that are left\n\t\t rooms = round.tournament.rooms.shuffle;\n\n\t\t while(!sorted_teams.empty?) #assumes multiple of 4 num elts\n\t\t assign_top_bracket(num_rooms, sorted_teams, sorted_chairs, sorted_wings, rooms, round, format); #assign the top brack rooms\n\t\t end\n\t\t end", "def initialize_environment\n # Create items\n @key = Item.new(\"key\", \"Head to the livingroom and use it before the ghost finds you!\", \"d\", true)\n @phone = ScoreItem.new(\"phone\", \"This works better with charge\", \"You've used the phone to leave a good review and the ghost loved it! Your score has improved by one star.\", false, 1)\n @charger = ScoreItem.new(\"charger\", \"You could use this to charge up your phone!\", \"You've charged the phone.\", false, 1)\n @juice = ScoreItem.new(\"juice\", \"I'm sure the host won't mind if you finish it off.\", \"You've just drank all the ghost's favourite juice :( Your AirBnB score has dropped one star.\", false, -1)\n @toothbrush = ScoreItem.new(\"toothbrush\", \"You sure could use some fresh breath\", \"Ew! You've grossed out the ghost and lost a star.\", false, -1)\n \n # Store star characters used to print score\n @star1 = \"\\u2b50\"\n\n ## Create rooms and store items\n # livingroom\n @lroom_items = [\"charger\"]\n @lroom_exits = {:west => \"bedroom\"}\n @lroom = Room.new(\"livingroom\", @lroom_items, @lroom_exits)\n # bedroom\n @broom_items = [\"phone\", \"toothbrush\"]\n @broom_exits = {:east => \"livingroom\", :south => \"kitchen\"}\n @broom = Room.new(\"bedroom\", @broom_items, @broom_exits)\n # kitchen\n @kitchen_items = [\"juice\", \"key\"]\n @kitchen_exits = {:north => \"bedroom\"}\n @kitchen = Room.new(\"kitchen\", @kitchen_items, @kitchen_exits)\n\n # Store items together for validation\n @game_items = [@key, @phone, @charger, @juice, @toothbrush]\n # Store rooms together for validation\n @game_rooms = [@kitchen, @broom, @lroom]\n\n end", "def initialize\n @name = \"Purr Seasons\"\n @address = \"32 Cat St, Tabby Town\"\n @phone = \"1800 MEOW MEOW\"\n @email = \"say_meow@purrseasons.com\"\n @rooms = [] # Array of room objects\n @activities = [] #Array of activity objects\n @about = \"~ An Experience Your Cat Won\\'t Forget ~ \\n The Purr Seasons is a luxury cat hotel. \\n It's so good you'll wish you could stay too! \\n\\n All our rooms are heated to the purr-fect temperature,\\n are fitted with cosy furnishings,\\n include lots of cuddle time (if your cat likes that!),\\n and are designed to make your cat feel at home. \"\n end", "def createRoom()\n\t\twidth = rand(@areaWidth * 0.5 .. @areaWidth * 0.7).floor\n\t\theight = rand(@areaHeight * 0.5 .. @areaHeight * 0.7).floor\n\t\t@room = [\n\t\t\trand(@areaX + @areaWidth * 0.15 .. @areaX + @areaWidth - width * 1.15).ceil,\n\t\t\trand(@areaY + @areaHeight * 0.15 .. @areaY + @areaHeight - height * 1.15).ceil,\n\t\t\twidth,\n\t\t\theight,\n\t\t]\n\tend", "def prepare_for_new_round\n @units.clear\n @heroes.clear\n @minions.clear\n @mercenaries.clear\n end", "def prepare_for_new_round\n @units.clear\n @heroes.clear\n @minions.clear\n @mercenaries.clear\n end", "def initialize(starting_room_id = 0)\n @current_room_id = starting_room_id\n @inventory = []\n update\n end", "def cleanup_empty_room(room)\n # dump_round_vars 'Entering cleanup_empty_room()'\n # if !@@prev_round[room].nil?\n # finalize_round(@@prev_round[room]) # ...finalize any previous round\n # @@prev_round[room] = nil\n # end\n # if !@@curr_round[room].nil?\n # finalize_round(@@curr_round[room]) # ...finalize any in-progress round\n # # @@curr_round[room] = nil\n # end\n # dump_round_vars '', 'Exiting cleanup_empty_room()'\n end", "def room_list\n @roomtype = DetailRoom.all_types\n @time = Room.all_times\n @day_list = Room.all_days\n if session[:admin] == nil\n redirect_to rooms_path\n end\n @admin = session[:admin]\n @rooms = {} \n @roomtype.each do |type|\n @rooms[type] = DetailRoom.find_all_by_room_type(type)\n end \n end", "def create\n \n filteredParams = params.require(:room).permit(:name, :owner_id, :privacy, :password)\n\n if filteredParams[\"privacy\"] && filteredParams[\"privacy\"] == \"on\"\n filteredParams[\"privacy\"] = \"private\"\n else\n filteredParams[\"privacy\"] = \"public\"\n end \n\n if filteredParams[\"name\"].empty?\n res_with_error(\"Invalid parameters\", :bad_request)\n return (false)\n end\n if filteredParams[\"privacy\"] == \"private\"\n if filteredParams[\"password\"].empty?\n res_with_error(\"None empty password required if the room is private\", :bad_request)\n return (false)\n else\n roomPassword = BCrypt::Password.create filteredParams[\"password\"]\n filteredParams[\"password\"] = roomPassword\n end\n end\n\n if !filteredParams[\"name\"] || filteredParams[\"name\"].length == 0 || filteredParams[\"name\"].blank?\n res_with_error(\"Empty Room Name\", :bad_request)\n return (false)\n elsif filteredParams[\"name\"] && filteredParams[\"name\"].length > 42\n res_with_error(\"Room name too long\", :bad_request)\n return (false)\n end\n\n @room = Room.create(filteredParams)\n if @room && !current_user.rooms_as_admin.include?(@room)\n @rla = RoomLinkAdmin.new(room: @room, user: current_user)\n @rla.save\n end\n \n respond_to do |format|\n if @room.save\n ActionCable.server.broadcast \"room_channel\", type: \"rooms\", description: \"create\", user: current_user\n format.html { redirect_to @room, notice: 'Room was successfully created.' }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new }\n format.json { render json: {alert: \"Name already taken\"}, status: :unprocessable_entity }\n end\n end\n end", "def initialize(room)\n @room = room\n @actions = {}\n @events = {}\n end", "def set_room_user\n\t\t\t@room_user = {'owner': Room.find(params[:id]).owner, \"admins\": [], \"members\": []}\n\t\t\tRoom.find(params[:id]).admins.order(\"state DESC, nickname ASC\").each do |admin|\n\t\t\t\t@room_user[:admins] << admin unless @room_user[:owner] == admin\n\t\t\tend\n\t\t\tRoom.find(params[:id]).members.order(\"state DESC, nickname ASC\").each do |member|\n\t\t\t\t@room_user[:members] << member unless @room_user[:owner] == member || @room_user[:admins].include?(member)\n\t\t\tend\n\t\tend", "def create_Ant_Room\n @rooms.each do |room|\n if food > 0\n myAnt = Ant.new\n myAnt.x = room.x\n myAnt.y = room.y\n myAnt.anthill = self\n\n if room.type == \"foreger\"\n myAnt = create_Forager(myAnt)\n elsif room.type == \"builder\"\n myAnt = create_Builder(myAnt)\n else\n myAnt = create_Warrior(myAnt)\n end\n\n Meadow.instance.add_AntToCell(myAnt, @x, @y)\n @food -= 1 \n else\n break\n end\n\n end\n\n end", "def prepare\n super\n end", "def prepare\n end", "def prepare\n end", "def prepare\n end", "def prepare\n end", "def prepare\n end", "def prepare\n end", "def prepare\n end", "def initialize(*args)\n super(nil, *args)\n\n @generic = \"room\"\n end", "def setup_blueprint_rooms\n # hardcoded layout\n @corridors << @fort_entrance\n\n fx = @fort_entrance.x\n fy = @fort_entrance.y\n\n fz = @fort_entrance.z1\n setup_blueprint_workshops(fx, fy, fz, [@fort_entrance])\n \n fz = @fort_entrance.z1 -= 1\n setup_blueprint_utilities(fx, fy, fz, [@fort_entrance])\n \n fz = @fort_entrance.z1 -= 1\n setup_blueprint_stockpiles(fx, fy, fz, [@fort_entrance])\n \n 2.times {\n fz = @fort_entrance.z1 -= 1\n setup_blueprint_bedrooms(fx, fy, fz, [@fort_entrance])\n }\n end", "def setup_blueprint_rooms\n # hardcoded layout\n @corridors << @fort_entrance\n\n fx = @fort_entrance.x\n fy = @fort_entrance.y\n\n fz = @fort_entrance.z1\n setup_blueprint_workshops(fx, fy, fz, [@fort_entrance])\n \n fz = @fort_entrance.z1 -= 1\n setup_blueprint_utilities(fx, fy, fz, [@fort_entrance])\n \n fz = @fort_entrance.z1 -= 1\n setup_blueprint_stockpiles(fx, fy, fz, [@fort_entrance])\n \n 2.times {\n fz = @fort_entrance.z1 -= 1\n setup_blueprint_bedrooms(fx, fy, fz, [@fort_entrance])\n }\n end", "def prepare()\n end", "def initialize\r\n @rooms = {}\r\n @pack = BackPack.new\r\n end", "def initialize(rooms, times)\n\t\t@rooms = rooms\n\t\t@times = times\n\n\t\t# create 1 key per each room in hash\n\t\t@roomhash = Hash.new\n\t\t@rooms.each do |r|\n\t\t\t@roomhash[r] = Array.new\n\t\tend\n\n\t\t# initialize to all rooms available at all times\n\t\t@availability = Hash.new\n\t\t@times.each do |t|\n\t\t\tfor i in t[0]..t[1]\n\t\t\t\t@availability[i] = @rooms.dup\n\t\t\tend\n\t\tend\n\tend", "def prepare\n [ \"alpha\", \"bravo\", \"charly\" ].each do |name|\n\n @engine.register_participant(name) do |workitem|\n\n workitem.attributes[name] = true\n workitem.attributes[\"key\"] = name\n end\n end\n\n #@engine.register_participant(\"display_workitem\") do |workitem|\n # puts\n # puts\n #end\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 new_wizard_channel_room\n init_variables_from_sessions\n get_channel_room_types\n end", "def prepare\n set_title\n set_name\n end", "def place_room(w,h,room_id)\n \n max_tries = Dungeon::MAX_PLACEMENT_ITERATION\n c_try = 0\n while c_try < max_tries\n\n # Get the top left corner, must be even \n tli = (rand*@width).floor\n tli += 1 if tli.odd?\n tlj = (rand*@height).floor\n tlj += 1 if tlj.odd?\n\n # Check all the cells from this point are unallocated, \n # and an extra 1 width around for perimeter\n failed = false\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n if !failed\n failed = true if @cells[i][j].type != Cell::UNALLOCATED\n end\n end\n end\n\n \n # if checks ok, build the room and the perimeter\n if !failed\n\t\t\t\t# Probability falls so there are an average of 2 doors per room\n\t\t\t\tper = 2*(w+h)\n\t\t\t\tdoor_chance = Dungeon::ROOM_DOORS/per\n\n\t\t\t\t# Prep for building a logical object ready for dead end removal\n\t\t\t\troom_cells = []\n\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n @cells[i][j].type = Cell::ROOM\n @cells[i][j].room_id = room_id\n\t\t\t\t\t\t\t# If perimeter wall, assign door if random number is under the threshold\n \t\t\t\t\t\tif i == tli || i == tli+w+1 || j == tlj || j == tlj+h+1 \n @cells[i][j].type = Cell::PERIMETER \n\t\t\t\t\t\t\t\tif i.odd? || j.odd?\n\t\t @cells[i][j].type = Cell::ENTRANCE if rand < door_chance\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t# Store the room cells read for assignment to logical structure\n\t\t\t\t\t\t\troom_cells << @cells[i][j];\n end\n end\n # Meet loop criterea\n c_try = Dungeon::MAX_PLACEMENT_ITERATION\n\n\t\t\t\t# Build logical object and map entrance cells to the room\n\t\t\t\troom_obj = RoomBranch.new(room_cells)\n\t\t\t\troom_cells.each { |c| room_map[c] = room_obj if c.type == Cell::ENTRANCE }\n\n end\n \n c_try += 1\n end\n \n end", "def room_list\n\t\t@room = Accommodation.find_all_by_host_id(@current_user.id)\n\t\t@date = RoomBooking.find_all_by_room_id(@room)\n \tend", "def prepare\n end", "def initialize(room, superjclient = nil)\n \n ##ObjectSpace.define_finalizer(self, self.class.method(:finalize).to_proc)\n \n #Class Variables\n @status = :initialized # :initialized, :onhold, :ongame, :onpause, :onkill\n @status_on_end = nil\n @question = 0\n @current_question = {}\n \n update_config(room)\n \n #Class objects\n @logger = EventLogger.new(\"room-#{@slug}\")\n @logger.enabled = true\n $logger = @logger\n @logger.log \"This room is being initialized...\", :debug, 'Room Initialize'\n \n @players = TriviaActors::Players.new\n @superjclient = superjclient\n @redis = Redis.new\n \n \tconnect_and_presence\n \tcreate_muc_room\n \tset_callbacks\n update_room_pubsub\n \t\n end", "def set_extra_room_type_info\n begin\n if @room_type_channel_mapping.channel_id == ExpediaChannel.first.id\n ert = ExpediaChannel.first.room_type_fetcher.retrieve(current_admin_property, false)\n ert.each do |rt|\n if @room_type_channel_mapping.expedia_room_type_id == rt.id\n @room_type_channel_mapping.expedia_room_type_name = rt.name\n @room_type_channel_mapping.expedia_rate_plan_id = rt.rate_plan_id\n session[:room_type_channel_mapping_params].deep_merge!(@room_type_channel_mapping.attributes)\n end\n end\n elsif @room_type_channel_mapping.channel_id == BookingcomChannel.first.id\n ert = BookingcomChannel.first.room_type_fetcher.retrieve(current_admin_property, false)\n ert.each do |rt|\n if @room_type_channel_mapping.bookingcom_room_type_id == rt.id\n @room_type_channel_mapping.bookingcom_room_type_name = rt.name\n @room_type_channel_mapping.bookingcom_rate_plan_id = rt.rate_plan_id\n session[:room_type_channel_mapping_params].deep_merge!(@room_type_channel_mapping.attributes)\n end\n end\n # GTA travel room type\n elsif @room_type_channel_mapping.channel_id == GtaTravelChannel.first.id\n ert = GtaTravelChannel.first.room_type_fetcher.retrieve(current_property, false)\n ert.each do |rt|\n if @room_type_channel_mapping.gta_travel_room_type_id == rt.id\n @room_type_channel_mapping.gta_travel_room_type_name = rt.name\n @room_type_channel_mapping.gta_travel_rate_basis = rt.rate_basis\n @room_type_channel_mapping.gta_travel_max_occupancy = rt.max_occupancy\n session[:room_type_channel_mapping_params].deep_merge!(@room_type_channel_mapping.attributes) unless skip_session\n end\n end\n else\n room_types = @room_type_channel_mapping.channel.room_type_fetcher.retrieve(current_property, false)\n room_types.each do |rt|\n if @room_type_channel_mapping.ota_room_type_id == rt.id and\n @room_type_channel_mapping.ota_rate_type_id == rt.rate_type_id\n @room_type_channel_mapping.ota_room_type_name = rt.name\n @room_type_channel_mapping.ota_rate_type_name = rt.rate_type_name\n session[:room_type_channel_mapping_params].deep_merge!(@room_type_channel_mapping.attributes) unless skip_session\n end\n end\n end\n rescue Exception\n flash[:notice] = t('room_type_channel_mappings.edit.message.timeout', :channel => @room_type_channel_mapping.channel.name)\n end\n end", "def prepare!; end", "def prepare!; end", "def checkroom(r)\n case r.status\n when :plan\n # moot\n when :dig\n # designation cancelled: damp stone etc\n r.dig\n when :dug, :finished\n # cavein / tree\n r.dig\n # tantrumed furniture\n r.layout.each { |f|\n next if f[:ignore]\n if f[:bld_id] and not df.building_find(f[:bld_id])\n df.add_announcement(\"AI: fix furniture #{f[:item]} in #{r.type} #{r.subtype}\", 7, false) { |ann| ann.pos = [r.x1+f[:x].to_i, r.y1+f[:y].to_i, r.z1+f[:z].to_i] }\n f.delete :bld_id\n @tasks << [:furnish, r, f]\n end\n }\n # tantrumed building\n if r.misc[:bld_id] and not r.dfbuilding\n df.add_announcement(\"AI: rebuild #{r.type} #{r.subtype}\", 7, false) { |ann| ann.pos = r }\n r.misc.delete :bld_id\n construct_room(r)\n end\n end\n end", "def set_empty_room\n @empty_room = EmptyRoom.find(params[:id])\n end", "def assign_room\n total_rooms, available_rooms = [], []\n room_type = RoomType.find(self.room_type_id)\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 self.update_column(:room_id, available_rooms.first)\n end", "def initialize(name, owner)\n super(name, owner)\n self.exits=[] # The list of exits for this room.\n end", "def initialize\n\t\t\t@rooms = []\n\t\t\t@reservation_blocks = []\n\n\t\t\t20.times do |index|\n\t\t\t\t@rooms << HotelManager::Room.new(id: index + 1)\n\t\t\tend\n\t\tend", "def initialize(room, template)\n @room = room\n @template = template\n end", "def initialize\n @name = \"Purr Seasons\"\n @address = \"32 Cat St, Tabby Town\"\n @phone = \"1800 MEOW MEOW\"\n @email = \"say_meow@purrseasons.com\"\n @about = \"~ An Experience Your Cat Won\\'t Forget ~ \\n The Purr Seasons is a luxury cat hotel. \\n It's so good you'll wish you could stay too! \\n\\n All our rooms are heated to the purr-fect temperature,\\n are fitted with cosy furnishings,\\n include lots of cuddle time (if your cat likes that!),\\n and are designed to make your cat feel at home. \"\n @rooms = [] # Array of room objects - one advantage of having this array is that when new rooms are added to the Hotel class, the rest of the code does not have to be changed, and it will display in the main application. \n end", "def set_room\n @launch_params = nil\n @room = nil\n @error = nil\n begin\n @room = Room.find(params[:id])\n unless cookies[@room.handler] || session['admin']\n @room = nil\n @error = { key: t('error.room.forbiden.code'), message: t('error.room.forbiden.message'), suggestion: t('error.room.forbiden.suggestion'), :status => :forbidden }\n return\n end\n @launch_params = JSON.parse(cookies[@room.handler])\n rescue ActiveRecord::RecordNotFound => e\n @error = { key: t('error.room.notfound.code'), message: t('error.room.notfound.message'), suggestion: t('error.room.notfound.suggestion'), :status => :not_found }\n end\n end", "def prepare(item)\n stringify_on_conflict_hash(item)\n add_lock_type(item)\n add_lock_timeout(item)\n add_lock_ttl(item)\n add_digest(item)\n end", "def finalize\n\t\tbuild_event_hash\n\t\t\n\t\teach_room { |room| room.finalize }\n\tend", "def create\n @reservation = Reservation.new(reservation_params) \n respond_to do |format|\n if @reservation.save\n\n Reservation.last.reservation_rooms.each do |reservation|\n #Cambio el estado de la habitacion\n reservation.update({start: reservation.check_in, end: (reservation.check_out.to_date)+1,title: \"Reserva: \"+Room.find(reservation.room_id).identificador ,textColor: \"#ffffff\"})\n #Le pongo check_in y check_out para el calendario\n Room.find(reservation.room_id).update({state_id: 3})\n end\n\n format.html { redirect_to reservations_path(), notice: 'Reservacion creada exitosamente.' }\n #format.json { render :show, status: :created, location: @reservation }\n else\n #@my_reservation_requests = ReservationRequest.find(reservation_params[:reservation_request_id])\n #@reservation.reservation_requests.build()\n @reservation.reservation_rooms.build() \n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def setup_board\r\n place_pawns\r\n place_bishops\r\n place_rooks\r\n place_knights\r\n place_queens\r\n place_kings\r\n end", "def room_params\n params.require(:room).permit(:name, :description, :floor_id, :capacity,\n :computers, :roomtype_id)\n end", "def prepare; end", "def prepare; end", "def prepare; end", "def initialize(roomNum)\n\n @roomNum=roomNum \n end", "def generate_rooms\n\n allocated_cells = get_allocated_cells\n taken_cells = 0\n room_id = 1\n\n max_room_w = @width * Dungeon::ROOM_SIZE_WEIGHT - 1\n max_room_h = @height * Dungeon::ROOM_SIZE_WEIGHT - 1\n\n # Make rooms until all the allocation has dried out\n while taken_cells < allocated_cells\n\n r_w = (rand*max_room_w).ceil + 1\n r_h = (rand*max_room_h).ceil + 1\n if r_w.odd? && r_h.odd?\n place_room(r_w, r_h, room_id)\n taken_cells += r_w*r_h\n room_id += 1\n end\n end\n end", "def prepare_equipment\n show do\n title 'Gather materials'\n check 'Fill 2 buckets with ice.'\n check \"Get the 24-well aluminum block out of the 4 #{DEGREES_C}\" \\\n 'refrigerator and place it in one of the ice buckets.'\n check \"Set the refigerated centrifuge to 4 #{DEGREES_C}.\"\n end\n end", "def sync_rooms\n create_rooms if hotel.rooms.size.zero?\n hotel.rooms.real.each do |room|\n room_id = room.send(connector_room_id_key)\n setup_room_prices(room_id, room.id)\n end\n end", "def checkroom(r)\n case r.status\n when :plan\n # moot\n when :dig\n # designation cancelled: damp stone etc\n r.dig\n when :dug, :finished\n # cavein / tree\n r.dig\n # tantrumed furniture\n r.layout.each { |f|\n next if f[:ignore]\n t = df.map_tile_at(r.x1+f[:x].to_i, r.y1+f[:y].to_i, r.z1+f[:z].to_i)\n if (f[:bld_id] and not df.building_find(f[:bld_id]))\n df.add_announcement(\"AI: fix furniture #{f[:item]} in #{r.type} #{r.subtype}\", 7, false) { |ann| ann.pos = t }\n f.delete :bld_id\n @tasks << [:furnish, r, f]\n end\n if f[:construction]\n try_furnish_construction(r, f, t)\n end\n }\n # tantrumed building\n if r.misc[:bld_id] and not r.dfbuilding\n df.add_announcement(\"AI: rebuild #{r.type} #{r.subtype}\", 7, false) { |ann| ann.pos = r }\n r.misc.delete :bld_id\n construct_room(r)\n end\n end\n end", "def new_rooms\n min_rooms = MIN_NEXT_ROOMS\n max_rooms = MAX_NEXT_ROOMS\n rand(min_rooms..max_rooms).times do\n @next_rooms << Zarta::Room.new(@dungeon)\n end\n end", "def create\n @room = Room.new(room_params)\n \n if @room.user == nil\n room.user = \"\"\n end\n \n respond_to do |format|\n if @room.save\n format.html { redirect_to rooms_path, notice: \"Sala '\" + @room.name + \"' criada com sucesso!\" }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def place_room(w, h, room_id)\n\n max_tries = Dungeon::MAX_PLACEMENT_ITERATION\n c_try = 0\n while c_try < max_tries\n\n # Get the top left corner, must be even \n tli = (rand*@width).floor\n tli += 1 if tli.odd?\n tlj = (rand*@height).floor\n tlj += 1 if tlj.odd?\n\n # Check all the cells from this point are unallocated, \n # and an extra 1 width around for perimeter\n failed = false\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n if !failed\n failed = true if @cells[i][j].type != Cell::UNALLOCATED\n end\n end\n end\n\n\n # if checks ok, build the room and the perimeter\n if !failed\n # Probability falls so there are an average of 2 doors per room\n per = 2*(w+h)\n door_chance = Dungeon::ROOM_DOORS/per\n\n # Prep for building a logical object ready for dead end removal\n room_cells = []\n\n (tli..tli+w+1).each do |i|\n (tlj..tlj+h+1).each do |j|\n @cells[i][j].type = Cell::ROOM\n @cells[i][j].room_id = room_id\n # If perimeter wall, assign door if random number is under the threshold\n if i == tli || i == tli+w+1 || j == tlj || j == tlj+h+1\n @cells[i][j].type = Cell::PERIMETER\n if i.odd? || j.odd?\n @cells[i][j].type = Cell::ENTRANCE if rand < door_chance\n end\n end\n\n # Store the room cells read for assignment to logical structure\n room_cells << @cells[i][j];\n end\n end\n # Meet loop criterea\n c_try = Dungeon::MAX_PLACEMENT_ITERATION\n\n # Build logical object and map entrance cells to the room\n room_obj = RoomBranch.new(room_cells)\n room_cells.each { |c| room_map[c] = room_obj if c.type == Cell::ENTRANCE }\n\n end\n\n c_try += 1\n end\n\n end", "def create\n @room = Room.new(params[:room])\n \n @room.site_id = params[:site_id]\n \n params[:criteria].each_pair do |k,v|\n @room.criterias << Criteria.find(k.to_i) if v == \"1\"\n end\n \n params[:not_criteria].each_pair do |k,v|\n @room.not_criterias << Criteria.find(k.to_i) if v == \"1\"\n end\n \n respond_to do |format|\n if @room.save\n flash[:notice] = 'Room was successfully created.'\n format.html { redirect_to agency_site_rooms_path(params[:agency_id], params[:site_id]) }\n format.xml { render :xml => @room, :status => :created, :location => @room }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @room.errors, :status => :unprocessable_entity }\n end\n end\n end", "def start\n rooms = get_rooms \n lookup_table = get_room_lookup_table(rooms)\n EventMachine::run do\n rooms.each do |room_id|\n room_manager(room_id, lookup_table)\n end\n end\nend", "def generate_questions!(room)\n room.questions = room.room_mode.generate_questions(room)\n end", "def generate_rooms\n\n allocated_cells = get_allocated_cells\n taken_cells = 0\n room_id = 1\n\n max_room_w = @width * Dungeon::ROOM_SIZE_WEIGHT - 1\n max_room_h = @height * Dungeon::ROOM_SIZE_WEIGHT - 1\n\n # Make rooms until all the allocation has dried out\n while taken_cells < allocated_cells\n \n r_w = (rand*max_room_w).ceil + 1\n r_h = (rand*max_room_h).ceil + 1\n if r_w.odd? && r_h.odd? \n place_room(r_w, r_h, room_id) \n taken_cells += r_w*r_h\n room_id += 1\n end\n end\n \n puts \"Alloc: #{allocated_cells} Placed:#{taken_cells}\"\n\n end", "def prepare(snip, part, args, enclosing_snip)\n # do nothing, by default\n end", "def room_params\n params.require(:room).permit(:name, :ubication, :location_id, :noise, :sockets, :availability)\n end", "def initialize(player_name) #initialize player_name so we can create a local variable.\n @player = Player.new(player_name)\n @rooms = [] #could also do @rooms = Array.new\n end", "def create_rooms(rooms_id_array)\n if self.room_areas.empty?\n 1.upto(self.bedrooms) do \n room_area = RoomArea.new(:property_id => self.id,\n :room_id => Room.find_by_name(\"Room\").id)\n room_area.save\n end\n end\n for room_id in rooms_id_array do\n room_area = RoomArea.new(:property_id => self.id,\n :room_id => room_id)\n room_area.save\n end\n end", "def create\n @room = Room.new(room_params)\n @room.name = \"Room \" +@room.name\n @room.admin_id = current_admin.id\n respond_to do |format|\n if @room.save\n format.html { redirect_to rooms_path , notice: 'Room was successfully created.' }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_current_room\n if cr.defeated\n $map.level_rooms.each do |r|\n if self.bounding_box_collision?(r)\n @cr = r\n end\n end\n $map.hallways.each do |h|\n if self.bounding_box_collision?(h)\n @cr = h\n end\n end\n end\n end", "def create(id, alas, users, timestamp)\n room = rooms[id]\n room.alias = alas unless alas.nil? || alas.empty?\n room.users = users unless users.nil? || users.empty?\n room.timestamp = timestamp unless timestamp.nil?\n room\n end", "def room_params\n params.require(:room).permit(:title, :content, :room_category_id, :expired_at)\n end", "def create_room(attributes, options = {})\n options.defaults = {\n set_recent: true\n }\n room = dressing_rooms.create(attributes)\n room.prepare(prepare_all: true)\n\n set(:recent_dressing_room_id, room.id) if options[:set_recent]\n end", "def destroy\n super\n @area.rooms.delete self\n if @exits\n @exits.dup.each do |exit|\n exit.destroy\n end\n end\n if @entrances\n @entrances.dup.each do |entrance|\n entrance.destroy\n end\n end\n @inventory.items.dup.each do |item|\n item.destroy\n end\n if @mobiles\n @mobiles.dup.each do |mob|\n mob.destroy\n end\n end\n if @players\n @players.dup.each do |player|\n player.move_to_room(Game.instance.starting_room)\n end\n end\n @area = nil\n @exits = nil\n @inventory = nil\n @mobiles = nil\n @players = nil\n Game.instance.remove_room(self)\n end", "def room_params\n params.require(:room).permit(:title, :location, :description, :user_id)\n end", "def index\n @cleaning_rooms = CleaningRoom.all\n @room = Room.new;\n end", "def fill_locker_room_for(locker_type)\n if locker_type == 'all'\n @small = Array.new(DEFAULT_SIZE, true)\n @medium = Array.new(DEFAULT_SIZE, true)\n @large = Array.new(DEFAULT_SIZE, true)\n end\n\n instance_variable_set(\"@#{locker_type}\".to_sym, Array.new(DEFAULT_SIZE, true))\n end", "def add_rooms_to_dungeon(dungeon)\n dungeon.add_room(:largecave,\n \"Large Cave\",\n \"a large cavernous cave\",\n { :west => :smallcave })\n\n dungeon.add_room(:smallcave,\n \"Small Cave\",\n \"a small, claustrophobic cave\",\n { :east => :largecave })\n\nend", "def prepare\n #this is the fate thing, its included with the Rules module\n @toggle = fate\n @prepared = true\n end" ]
[ "0.6710112", "0.63357824", "0.60576016", "0.6022315", "0.59045017", "0.588234", "0.5855475", "0.58454466", "0.5801395", "0.57919294", "0.5782438", "0.5776175", "0.57736516", "0.5736357", "0.5708833", "0.5708833", "0.5708429", "0.56951797", "0.5641942", "0.56294656", "0.56286985", "0.5615554", "0.5615051", "0.56107545", "0.5562187", "0.5562187", "0.55514395", "0.5547012", "0.55159706", "0.5496132", "0.5494357", "0.5490087", "0.5472253", "0.54641116", "0.54398113", "0.54398113", "0.54398113", "0.54398113", "0.54398113", "0.54398113", "0.54398113", "0.5434971", "0.54202354", "0.54202354", "0.540237", "0.5392968", "0.53885835", "0.5388378", "0.53870976", "0.5374238", "0.53735244", "0.5353954", "0.53537095", "0.53514445", "0.5348886", "0.5348108", "0.53370243", "0.53370243", "0.5331879", "0.53267753", "0.5322393", "0.5320013", "0.531807", "0.53167784", "0.53091633", "0.5308777", "0.5308114", "0.5302528", "0.52925116", "0.5291693", "0.52887976", "0.5285438", "0.5285438", "0.5285438", "0.52832514", "0.5280227", "0.5273521", "0.5267764", "0.52627707", "0.52558726", "0.5254388", "0.5247491", "0.5238462", "0.5237712", "0.5232532", "0.5231226", "0.5229622", "0.52158976", "0.5214451", "0.5199599", "0.51980686", "0.51769394", "0.51719433", "0.51688266", "0.5163707", "0.51578003", "0.5157713", "0.51456416", "0.51449484", "0.5140096", "0.51353633" ]
0.0
-1
Identify by a nick in the room
def send_nick(n=@nick) @nick = n @connection.send_data(make_packet("nick", {"name" => n})) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nickname\n @nick\n end", "def invent_nick(jid)\n /^([^@]+)/ =~ jid.to_s\n return jid if not $1 or not User.valid_nick?($1)\n return $1 if not get_user_with_nick($1)\n (2 .. 100).each do |i|\n new_nick = \"#{$1}#{i}\"\n return new_nick if not get_user_with_nick(new_nick)\n end\n jid\n end", "def nick\n @name\n end", "def nick\n @bot.nick\n end", "def nick\r\n return for_context(nil, false) { |c| c.nick }\r\n end", "def nick\n @prefix =~ PREFIX_PAT and $1\n end", "def nick(nick)\n @nick = nick\n sendmsg(\"NICK #{nick}\")\n end", "def nick(msg)\n if msg.user.last_nick == @settings['identity']['nick']\n bot.nick = @settings['identity']['nick']\n return\n end\n str = sprintf('*** %s is now known as %s',msg.user.last_nick,msg.user.nick)\n # gotta log to every channel this user is in\n (msg.user.channels & msg.bot.channels).each do |channel|\n log(msg,str,channel)\n end\n @beans[:nick]+=1\n end", "def on_nick msg\n return unless msg.connection == self\n\n if msg.me?\n @nick = msg.text\n return\n end\n end", "def find(nick)\n @users.find { |u| u.nick.downcase == nick.downcase }\n end", "def r_nick(fullactor, actor, nickname)\n report \"#{actor} changed nick to #{nickname}\" unless nickname == @me\n end", "def r_nick(event)\n report \"#{event.nick} changed nick to #{event.message}\" unless event.nick == @yail.me\n end", "def nickname\n @nickname\n end", "def nickname\n user_info['nickname']\n end", "def nicks\n match(/Nicks\\s+:\\s+([^\\s]+(?:\\s[^\\s]+)*)$/).split.map{|nick| Atheme::User.new(@session, nick)} rescue []\n end", "def nick(nick)\n @socket << \"NICK #{nick}\"\n end", "def nick_canon\n @nick_canon ||= @connection.canonize @nick\n end", "def on_nick(connection, before, after)\n end", "def getNickFromId id\n\t\tuser = @users.read [\"nick\"], [\"id\", id]\n\t\tif user.count > 0\n\t\t\tuser[0]['nick']\n\t\telse\n\t\t\tnil\n\t\tend\n\tend", "def isNickAuthed(usr)\n msg(\"NickServ\", \"ACC #{usr}\")\n data = nickservData(@IRCsocket.readline.split(\" \"))\n if(data[\"rusr\"] == \"NickServ\" && data[\"to\"] == @name && data[\"usr\"] == usr && data[\"status\"] == \"3\")\n return true\n else\n return false\n end\n end", "def getnick(nickname)\n send_command(:getnick, @options[:nickname] = nickname.to_s)\n read_response # \"Nickname set to #{nickname}\"\n self\n end", "def nick(nicknam)\n raise 'invalid nick' unless IRC.nickname?(nicknam)\n @nickname = nicknam\n send_msg(\"NICK #{@nickname}\")\n end", "def get_user_with_nick(nick)\n @users.values.each do |u|\n return u if u.nick == nick\n end\n nil\n end", "def nick(nickname)\n raw \"NICK #{nickname}\\r\\n\"\n end", "def nickname\n return @nickname\n end", "def nick?(str)\n str.match(nick_regex) != nil\n end", "def nickname\n data = get 'name', resource: 'leaderboard'\n data.name\n end", "def getNick jid\n\t\tuser = @users.read [\"nick\"], [\"jid\", jid]\n\t\tif user.count > 0\n\t\t\tuser[0]['nick']\n\t\telse\n\t\t\tnil\n\t\tend\n\tend", "def to_label\n nick\n end", "def irc_nick_event(stem, sender, arguments) # :nodoc:\n @nick = arguments[:nick] if sender[:nick] == @nick\n @chan_mutex.synchronize do\n @channel_members.each { |chan, members| members[arguments[:nick]] = members.delete(sender[:nick]) }\n #TODO what should we do if we are in the middle of receiving NAMES replies?\n end\n end", "def on_nick_already_in_use(connection, nick_name)\n end", "def single_nick?\n @nick != '*'\n end", "def change_nick(new_nick)\n nick new_nick\n end", "def set_nickname\n @nickname = Nickname.find(params[:id])\n end", "def nickname\r\n return @user.nickname\r\n end", "def register_nickname(nick)\n #TODO: fiber blocks on getting the registration form\n # user fills-in the form and submit\n # rooms returns result\n raise NotImplementedError\n end", "def register_nick(m, query)\n if check_op(m) \n (nick, name, cam_number) = query.split(/\\s*,\\s*/)\n user = User(nick)\n hostmask = user.host\n @bot.debug \"In register_nick.\"\n @bot.debug \"Nick: #{nick} Name: #{name}: Cam Number: #{cam_number} -- Host: #{hostmask}.\"\n query = config[:dbh].prepare \"SELECT cam_number, name, hostmask FROM nick_database WHERE nick = ?\"\n query.execute(nick)\n \n if row = query.fetch\n query = config[:dbh].prepare \"UPDATE nick_database SET name = ?, hostmask = ?, cam_number = ? WHERE nick = ?\"\n query.execute( name, hostmask, cam_number, nick )\n else \n query = config[:dbh].prepare \"INSERT INTO nick_database (nick, name, cam_number, hostmask) values(?, ?, ?, ?)\"\n query.execute( nick, name, cam_number, hostmask )\n end\n m.reply \"#{name} - #{cam_number} - #{hostmask} for #{nick}\"\n end\n end", "def nickname\n @attributes[:nickname]\n end", "def nick_part(nick, reason=nil)\n return if not @names.include?(nick)\n\n @names.delete(nick)\n reason = \" (#{reason})\" if reason\n @bridge.add(:xmpp, :irc, SYSTEM_USER, \"#{nick} just left the IRC channel#{reason}\")\n end", "def nick(m)\n channel_users do |users|\n unless users.has_key?(m.user.last_nick)\n fail \"user '#{m.user.last_nick}' not found\"\n end\n\n users[m.user.nick] = users[m.user.last_nick]\n users.delete(m.user.last_nick)\n\n users[m.user.nick].each do |chan|\n @loggers[chan].each { |l| l.log(:nick, m) }\n end\n end\n end", "def on_nick_in_use msg\n return if @registered or msg.connection != self\n\n if @nick == Bot::Conf[:core][:nick]\n\n if Bot::Conf[:core].key? :altnick\n @nick =Bot::Conf[:core][:altnick]\n else\n @nick = 'TerminusBot'\n end\n\n raw \"NICK #{@nick}\"\n return\n end\n\n @nick << \"_\"\n\n raw \"NICK #{@nick}\"\n end", "def get_nickname(member)\n nickname = \"\"\n entry = @client[:nicknamer].first(server_id: member.server.id, role: member.colour_role.id)\n if entry\n nickname += (entry[:upper_prefix] || \"\") + \" \"\n end \n\n nickname += member.roles.map {|role| \n role_entry = @client[:nicknamer].first(server_id: role.server.id, role: role.id)\n role_entry[:normal_prefix] if role_entry\n }.join(\" \")\n nickname += member.name + \" \"\n \n nickname += member.roles.map {|role| \n role_entry = @client[:nicknamer].first(server_id: role.server.id, role: role.id)\n role_entry[:normal_suffix] if role_entry\n }.join(\" \")\n\n if entry\n nickname += (entry[:upper_suffix] || \"\")\n end \n nickname\n end", "def change_nick(nick)\n join(nick)\n end", "def local_nick(body)\n name1 = _pop_token(body)\n name2 = _pop_token(body)\n raise \"Usage: /nick <old_name> <new_name>\" if name1.to_s.empty?\n if name2.to_s.empty?\n name2 = name1\n name1 = @var[:our_name]\n end\n raise \"Name '#{name2}' is already in use\" if @var[:user_keys][name2]\n\n # Perform the renaming\n kh = @connection.comm.sender_keyhash(name1)\n key = @connection.comm.rsa_keys[name1]\n raise \"Invalid user name: '#{name1}'\" unless kh and key\n @connection.comm.rsa_keys[name2] = key\n @connection.comm.rsa_keys.delete(name1)\n @connection.comm.names[kh] = name2\n @var[:user_keys][name2] = key\n @var[:user_keys].delete name1\n @var[:granted].collect! { |x| x = name2 if x == name1 ; x }\n @var[:granted_by].collect! { |x| x = name2 if x == name1 ; x }\n @var[:revoked].collect! { |x| x = name2 if x == name1 ; x }\n \n # And lastly, if this is us, update our special name attribute\n @var[:our_name] = name2 if @var[:our_name] == name1\n _notice(\"#{name1} is now known as #{name2}\")\n _save_env\nend", "def update_nick(new_nick)\n @last_nick, @name = @name, new_nick\n @last_id, @id = @id, sanitize(new_nick)\n @bot.user_list.update_nick(self)\n end", "def _nicknameinuse(text, args)\n text =~ /^(\\S+)/\n report \"Nickname #{$1} is already in use.\"\n\n if (!@registered)\n begin\n nextnick = @nicknames[(0...@nicknames.length).find { |i| @nicknames[i] == $1 } + 1]\n if (nextnick != nil)\n nick nextnick\n else\n report '*** All nicknames in use. ***'\n quit 'All nicknames in use.'\n end\n rescue\n report '*** Nickname selection error. ***'\n quit 'Nickname selection error.'\n end\n end\n end", "def change_own_nickname(token, server_id, nick)\n request(\n __method__,\n :patch,\n \"#{api_base}/guilds/#{server_id}/members/@me/nick\",\n { nick: nick }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def nickname(user)\n nickname = (!user.blank? && !user.nickname.blank?)? user.nickname : I18n.t('guest_name')\n nickname\n end", "def who(mask, mode = 'o')\n send_data(\"WHO #{mask} #{mode}\")\n end", "def searchNick(nick)\n #use %! string delimiters because to avoid escaping doublequotes in URI while\n #also keeping the #{nick} substitution\n uri=URI.escape(%!_design/filter/_view/nymIDByNick?key=\"#{nick}\"!)\n resjson=get(uri).body\n end", "def nickname\n (f, l) = full_name.split(\" \", 2)\n \"#{f}#{l.split(/[\\s']/).collect(&:first).join}\"\n end", "def reveal_author(nick)\n case nick\n when 'lddev' then 'MM'\n when '1bardesign' then 'Geti'\n when 'flieslikeabrick' then 'FliesLikeABrick'\n else I18n.news_fetcher.someone\n end\n end", "def get_nickname(user_info)\n return user_info[\"screen_name\"]\n end", "def nickname=(value)\n @nickname = value\n end", "def renickify \n @bot.msg(\"nickserv\", \"ghost #{bot.nick} pearljam\")\n @bot.msg(\"nickserv\", \"identify pearljam\")\n @bot.nick = 'infobot-clone'\n return \"Renickifying!\"\n end", "def change_nick(new_nick)\n return false if not User.valid_nick?(new_nick)\n @nick = new_nick.to_s\n true\n end", "def nick_change(nick, new_nick)\n @names.delete(nick) if @names.include?(nick)\n @names << new_nick \n\n @bridge.add(:xmpp, :irc, SYSTEM_USER, \"#{nick} is now known as #{new_nick}\")\n end", "def me?\n nick_canon == @connection.canonize(@connection.nick)\n end", "def nickname\n return @poco_data[:nickname] unless @poco_data == nil\n pick_first_node(@poco.xpath('./poco:nickname'))\n end", "def nick_did_change(stem, person, nick)\n end", "def normalise_nick(nick)\n return /^[@+]?(.*)$/.match(nick)[1]\n end", "def random_nick() (0..8).map { rand(65..90).chr }.join'' end", "def hasOp(usr)\n @IRCsocket.write(\"NAMES #{@ch}\\n\")\n data = namesData(@IRCsocket.readline.split(\" \"))\n @IRCsocket.readline # for the second worthless line of answer to the NAMES request\n if(data[\"to\"] == @name && data[\"names\"].include?(\"@#{usr}\"))\n return true\n else\n false\n end\n end", "def change_nickname(token, server_id, user_id, nick)\n request(\n __method__,\n :patch,\n \"#{api_base}/guilds/#{server_id}/members/#{user_id}\",\n { nick: nick }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def update_nick!\n discord_user.on(game.text_channel.server).nick = \"(#{score} AP) #{discord_nick}\"\n rescue\n # Fail silently if we can't change nicks\n end", "def check_new_nick\n if (params[:user][:nick] != @user.nick)\n if (User.where(:nick => User.clean_nick(params[:user][:nick])).count > 0)\n false\n else\n true\n end\n else\n true\n end\n end", "def connection_for nick\n @connection_cache[nick]\n end", "def visible_to_nick_str=(str)\n if str==VISIBLE_TO_SELF\n return self.visible_to = [VISIBLE_TO_SELF]\n end\n ary = Array.new\n str.split(%r{\\s*,\\s*}).each do |nick|\n user = User.first(conditions: {nick_name: nick})\n ary << user._id if user\n end\n self.visible_to = ary\n end", "def modify_current_user_nick(guild_id, nick:)\n response = request(\n :guilds_gid_members_me_nick, guild_id,\n :patch,\n \"guilds/#{guild_id}/members/@me/nick\",\n nick: nick,\n )\n response.body\n end", "def changenick(m, n)\n @lastchanged = m.user.nick\n bot.nick = n\n end", "def initialize(nickname)\n @nick = nickname\n end", "def nickname=(nick)\n @nickname ? find_and_update('//apps:nickname', name: [@nickname, nick]) : create('nickname', nick)\n\n @nickname = nick\n end", "def find_member_by_username(username)\n @board.members.find { |m| m.username == username }\n end", "def who\n\t\t\t@username\n\t\tend", "def without_nick(message)\n possible_nick, command = message.split(' ', 2)\n if possible_nick.casecmp(at_nick) == 0\n command\n else\n message\n end\n end", "def nickname\n (preferred_name && !preferred_name.strip.empty?) ? preferred_name : first_name\n end", "def change_nick msg\n return if msg.connection != @connection\n return unless has_key? msg.nick_canon\n\n $log.debug(\"Users.add_user\") { \"Renaming user #{msg.nick} on #{@connection.name}\" }\n\n changed_nick_canon = msg.connection.canonize msg.text\n\n # Apparently structs don't let you change values. So just make a\n # new user.\n changed_user = User.new @connection, changed_nick_canon,\n self[msg.nick_canon].user,\n self[msg.nick_canon].host,\n self[msg.nick_canon].level,\n self[msg.nick_canon].account\n\n delete_user msg.nick_canon\n\n self[changed_nick_canon] = changed_user\n end", "def colorize_nick(gamer)\n if gamer[:premium?]\n case gamer.role\n when 2\n Format(:green, gamer.irc_nick)\n else\n Format(:yellow, gamer.irc_nick)\n end\n else\n gamer.irc_nick\n end\n end", "def set_pknick(value, index = 0)\n value = value.given_name if value.is_a?(PFM::Pokemon)\n set_variable(PKNICK[index].to_s, value.to_s)\n end", "def update_nickname(member)\n nickname = get_nickname(member)\n if member.display_name != nickname\n member.set_nick nickname\n end\n end", "def chk_nickname_available\n @status, @msg, @data = UserValidator.chk_nickname(params)\n end", "def winner_id\n return self.send(\"#{winner}_id\".intern)\n end", "def is_npc(id)\n\t\t!id.start_with?('user')\n\tend", "def winning_nominator\n nominations.detect { |nom| nom.movie == movie }.try(:user)\n end", "def send_whois(nick)\n send_raw(WHOIS, nick)\n end", "def _user_name(kh)\n @connection.comm.sender_name(kh) || 'unknown_user'\nend", "def username\n @username ||= match[3]\n end", "def toggle_nick(bot, channel)\n @use_nicks[channel] = (not @use_nicks[channel] == true)\n \n if use_nicks?(channel)\n bot.say(\"Nicks will be sent with messages.\")\n else\n bot.say(\"Nicks will not be sent (omegle users will just see anonymous text)\")\n end\n end", "def find_member\n @trello.find_member_by_username(users[@selected_commander][:trello_name])\n end", "def nick_change_line(line)\n other_person = /-!- ([^ ]+) is now known as ([^ ]+)/.match(line)\n you_person = /-!- You're now known as ([^ ]+)/.match(line)\n if other_person\n old_nick, new_nick = other_person.captures\n<<-END\n<span class=\"old_nick\">#{old_nick}</span> is now known as <span class=\"new_nick\">#{new_nick}</span>\nEND\n elsif you_person\n new_nick = other_person.captures.first\n<<-END\nYou're now known as <span class=\"new_nick\">#{new_nick}</span>\nEND\n end\nend", "def nickname?\r\n return @user.nickname != nil && @user.nickname != \"\"\r\n end", "def cwhois(m, nick)\n nick = User(nick)\n if is_supadmin?(m.user) || is_admin?(m.user) || is_chanadmin?(m.channel, m.user) || is_mod?(m.user)\n if userroles(m.channel,nick).empty?\n m.reply \"That's #{nick},\" + (!User(nick).authname.nil? ? \" authenticated as #{User(nick).authname},\" : \" unauthenticated,\") + \" with no roles.\"\n else\n m.reply \"That's #{nick}, \" + (!User(nick).authname.nil? ? \" authenticated as #{User(nick).authname},\" : \" unauthenticated,\") + \" with the following roles #{userroles(m.channel,nick)}.\", true\n end\n else\n m.reply NOTADMIN, true\n end\n end", "def challenger\n Competitor.find_by(id: self.game.challenger_id).username\n end", "def visible_to_nick_str\n return '' if !visible_to || visible_to_self\n ary = Array.new\n visible_to.each do |uid|\n user = User.find(uid)\n ary << user.nick_name if user && !ary.include?(user.nick_name)\n end\n return ary.sort.join(',')\n end", "def irc_err_nicknameinuse_response(stem, sender, recipient, arguments, msg) # :nodoc:\n return unless nick_generator\n newnick = nick_generator.call(arguments[0])\n nick newnick if newnick\n end", "def username\n @username ||= match[3]\n end", "def setnick(nickname)\n send_command(:setnick, @options[:nickname] = nickname.to_s)\n read_response # \"Nickname set to #{nickname}\"\n self\n end", "def person_for sender\n room.people[sender.stripped.to_s] || Person.new(identity: sender)\n end", "def listen(m)\r\n oldmask = m.user.mask.to_s.split('!')\r\n oldmask[0] = m.user.last_nick\r\n oldmask = oldmask.join('!')\r\n s = Justbot::Session.for(oldmask)\r\n if s\r\n synchronize(:session) do\r\n s.mask = m.user.mask\r\n end\r\n else\r\n debug \"no session found for mask '#{oldmask}'\"\r\n end\r\n end", "def setNick(server,nick)\n if(@connectors.has_key?(server))\n @connectors[server].nick=nick\n end\n end" ]
[ "0.71576816", "0.70470214", "0.7014333", "0.6997151", "0.6871745", "0.6869566", "0.68179", "0.66965264", "0.6646179", "0.6578393", "0.6558349", "0.6550459", "0.6544399", "0.6506802", "0.6491552", "0.6444606", "0.6355535", "0.6350498", "0.6338591", "0.6299051", "0.6296539", "0.6293563", "0.62814903", "0.62613285", "0.6256142", "0.6254948", "0.624221", "0.62411296", "0.62254584", "0.62191194", "0.62112904", "0.62043875", "0.6132307", "0.6128979", "0.61164045", "0.61090636", "0.60987717", "0.607864", "0.607842", "0.60614276", "0.6047961", "0.6040859", "0.6026353", "0.6000281", "0.59904814", "0.5987014", "0.5970856", "0.597081", "0.5948959", "0.59401846", "0.58724403", "0.5842922", "0.5830533", "0.58231395", "0.58062714", "0.5789589", "0.5786073", "0.5771462", "0.5756257", "0.5752596", "0.57366604", "0.57327914", "0.5712602", "0.5683773", "0.56664485", "0.5653559", "0.56448185", "0.5640635", "0.56188494", "0.5599687", "0.55987257", "0.55900246", "0.5580074", "0.555761", "0.55241185", "0.5520757", "0.5513564", "0.55070966", "0.5504569", "0.54918104", "0.54840547", "0.54814446", "0.545803", "0.54558235", "0.5437368", "0.5437", "0.54263514", "0.5407218", "0.5405712", "0.53929484", "0.5385355", "0.53809416", "0.53799915", "0.53716034", "0.53661233", "0.5363899", "0.53578347", "0.5340281", "0.5338479", "0.53377396" ]
0.6038118
42
Send a message in the room
def send_message(content, parent=nil) if parent @connection.send_data(make_packet("send", {"content" => content.to_s, "parent" => parent})) else @connection.send_data(make_packet("send", {"content" => content.to_s})) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_room_msg\n r = params[:r]\n m = params[:m]\n u = params[:u]\n MsgUtil.send_room_msg(u, r, m)\n success()\n end", "def send_message(data)\n current_user.messages.create!(body: data[\"message\"], chat_room_id: data[\"chat_room_id\"])\n # the next line broadcasts the message without a job. BUT: that is only the message.\n # We want do more :)\n # ActionCable.server.broadcast(\"chat_rooms_channel\", message: data[\"message\"])\n end", "def send_message message\n payload = { \"text\" => message }.to_json\n data = client.post \"#{api_prefix}/rooms/#{id}/chatMessages\", payload\n\n Message.new client, id, data\n end", "def send_message(jid,text)\n m = Jabber::Message.new(jid, text)\n m.set_type :chat\n @client.send m\n end", "def send_message(message)\n self.broadcast({\n type: \"chat_message\",\n message: message\n })\n end", "def send(message)\n\t\t\t@conn.send(message)\n\t\tend", "def send_message(msg)\n send_data({:type => :message, :body => msg})\n end", "def send_message(msg)\n session.transport.send_message(msg)\n end", "def send_message\n message = render_to_string(:partial => 'messages/message', :object => @message)\n Juggernaut.send_to_channel(javascript_chat_message(message), @message.channel_id)\n end", "def send_message( msg )\n @session.send_message msg\n self\n end", "def send_message(message)\n check_parenthesis(message)\n puts \"Send: #{message}\" if @debug\n connection{|c| c.write(message)}\n end", "def send_message\n if message.present?\n sender.send_message(receiver, message, I18n.t(\"activity.verb.#{ contact_verb }.#{ receiver.subject_type }.message\", :name => sender.name))\n end\n end", "def send_message(message); end", "def send_message(message); end", "def send_message_to_room(company, room_id, params = {})\n $LOG.i \"running \" + __method__.to_s\n @client.post '/messages/v3/' + company + '/rooms/' + room_id + '/stories', params\n end", "def send(message)\n info(\"[Smartfocus] Send -> #{message}\")\n end", "def send_message(message)\n @networking.send_message(message)\n end", "def send(message)\n message\n end", "def post_message(text)\n body ={\n \"title\" => @from_name,\n \"picture\" => @from_picture,\n \"message\" => text\n }\n\n self.class.post(room_path, request_options(body))\n end", "def send_message(message)\n # currently use notifications to send message, as send message doesn't seem to \n # work to android devices. Otherwise would have used this:\n #\n # JSON.parse(User.notifo.send_message(self.username, message))\n send_notification(message)\n end", "def sendM(message)\n\t\t@conexion.puts(message)\t\n\tend", "def send_message(data)\n @chatroom = Chatroom.find(data[\"chatroom_id\"])\n message = @chatroom.messages.create(body: data[\"body\"], user: current_user)\n MessageRelayJob.perform_later(message)\n #Rails.logger.info data\n end", "def send_message(message)\n @socket.send(message << \"\\n\", 0, nil, @client)\n end", "def send_message(msg); end", "def send_message (*params)\n send_line Message.new(*params)\n end", "def send_to(other_player, msg)\n\t\t\tm = GreyGoo::Message.new({ from: self, to: other_player, text: msg })\n\t\t\tm.save!\n\t\t\tother_player.send_message(m)\n\t\tend", "def broadcast_to(room, msg)\n\t\t\tm = GreyGoo::Message.new({ from: self, to: room, text: msg })\n\t\t\tm.save!\n\t\t\troom.broadcast(m)\n\t\tend", "def say(msg)\n self.signed_request '/api/v1/chat.postMessage', 'POST', {roomId: @channel_id, text: '>' + msg}\n end", "def send(message)\n ## empty\n end", "def send_message(chat_id, message)\n ActionCable.server.broadcast \"Chat:#{chat_id}\", response: chat_message(message), type: 'message'\n end", "def send_message(message)\n socket.enqueue_packet(message)\n end", "def send_message(*args, **kwargs)\n bot = kwargs.fetch(:bot) { args.fetch(0) }\n args[0] = id\n kwargs[:chat_id] = id\n bot.send_message(*args, **kwargs)\n end", "def send(to, text)\n begin\n @log.info \"Sending message to '#{to}'\"\n @client.send Message::new(to, text).set_type(:chat).set_id('1').set_subject('Boti')\n return true\n rescue\n @log.error \"Error sending message to '#{to}'\"\n return false\n end\n end", "def send(message)\n socket.send(message, 0, address, port)\n end", "def send_channel(message)\n @bot.message_queue.push(\"PRIVMSG ##{bot.channel.name} :#{message}\")\n end", "def send_message(text)\n end", "def send_message(payload)\n message = Message.new(author: current_user, text: payload[\"message\"])\n\n ActionCable.server.broadcast \"chat\", message: render(message) if message.save\n end", "def sendChatMessage(a_to, a_text)\n\t\tp 'JabberClient.sendChatMessage'\n\tend", "def send_mess(mess)\n\t@client.puts(mess)\t\nend", "def send_message(payload)\n message = Message.new(user: current_user, chat_id: payload[\"id\"], body: payload[\"message\"])\n\n ActionCable.server.broadcast \"chat_#{payload['id']}\", message: render(message) if message.save\n end", "def send(message)\n @chats.each do |chat|\n begin\n chat.send(message)\n rescue\n @chats.delete(chat)\n end\n end\n end", "def send(msg=\"\")\n\t\tif @connected\n\t\t\t@sock.write \"\\1#{msg}\\r\\n\" # leading \\1 for terse reply\n\t\tend\n\tend", "def send(body=nil)\n msg = Jabber::Message.new(@to)\n msg.type = :chat\n msg.body = body || @message\n @base.stanza(msg)\n end", "def send_message\n chat = Chat.find(params[:chat])\n SendMessageToChat.call(@previa_group, chat, params[:message])\n\n respond_to do |format|\n format.html { redirect_to previa_group_chat_path(@previa_group, :chat => chat) }\n format.json { head :no_content }\n end\n end", "def send_message\n unless message_sent\n twilio_client.messages.create(\n from: ENV.fetch(\"TWILIO_PHONE_NUMBER\"),\n to: contact.phone_number,\n body: content,\n )\n update(message_sent: true)\n end\n end", "def send_message(other_user, room_id, content)\n from_messages.create!(to_id: other_user.id, room_id: room_id, content: content)\n end", "def send_message(message_text)\n @selected.send_message(message_text)\n end", "def send_message\n if self.id != 1\n admin_sender = User.find(1)\n user_receiver = self\n message = Message.new\n message.subject = \"It's Official! You're in.\"\n message.body = \"As a member of the VVI community, you're now able to contact other volunteers directly, share your own experiences online, and stay active in our mission to make the world of international volunteering more transparent, more organized, and more excellent. \n <br /><br />We can't thank you enough for joining the cause! And we're here if you need anything.\n <br /><br />--VolunteerVoice Team\"\n message.recipient = user_receiver\n message.sender = admin_sender\n message.save\n end\n end", "def send_msg(data, connection)\n connection.send_msg(data)\n end", "def send(msg)\n @socket.puts msg\n puts '<< ' << msg\n end", "def send(msg)\n @connection.write(\n @serializer.en(msg))\n rescue Exception => e\n raise\n end", "def raw_send(message)\n TalkerBase.instance.output << \"#{id} send #{message}\"\n end", "def send(target, message)\n @irc.send_msg(target, message)\n end", "def peer_send(peer,message)\r\n\t\t\tpeer.socket.puts(message)\r\n\t\tend", "def notify(msg)\n @room_queue.push(msg)\n end", "def send_message(msg)\n self.class.send_message queue_url, msg\n end", "def sending_message(to, msg)\n\t begin\n\t\t @client = Twilio::REST::Client.new @account_sid, @auth_token\n\t\t data = {\n\t\t\t\t:from => \"+\" + Rails.application.secrets.from_number.to_s, \n\t\t\t\t:to => to,\n\t\t\t\t:body => msg, \n\t\t\t}\n\t\t\tputs data.inspect\n\t\t\t@client.account.messages.create(data)\n\t\trescue\n raise \"Message not send\"\n\t\tend\n end", "def enviarMensaje(mensaje)\n @@socket.puts mensaje\n end", "def send_my_message\n account_sid = 'ACe330ba04d082392df4cb3511dcb72cec'\n auth_token = '2008ea097713e401a16c54029058da82'\n @client = Twilio::REST::Client.new account_sid, auth_token\n @client.account.messages.create(\n :from => @from,\n :to => @to,\n :body => @body\n )\n end", "def send_message!(params = {})\n call_api(\"directmessage/#{secret}/#{token}\",params)\n end", "def sendmsg(message)\n text = message.respond_to?(:sendmsg) ? message.sendmsg : message.to_s\n message = \"sendmsg\\n%s\\n\" % text\n self.respond_to?(:send_data) ? send_data(message) : message\n end", "def send( a )\n\t\tbegin\n\t @jabbermsg.body = a\n \t @jabberchatroom.send( @jabbermsg )\n \trescue Jabber::ServerDisconnected\n \t\tputs \"Server disconnected. Trying reconnect\"\n \t\t@jabberReconnect = true\n \t\t@jabberRetryMessage = a\n \trescue Jabber::JabberError => e\n \t\tputs \"Error for #{e.error.to_s.inspect}\"\n \t\tputs \"Trying reconnect\"\n \t\t@jabberReconnect = true\n \t\t@jabberRetryMessage = a\n \tend\n\tend", "def send_message(message)\n message = JSON.generate(message)\n @log.debug(\"Sending #{message}\")\n @ws.send(message)\n end", "def send_message(to:, body:)\n twilio_client.api.account.messages.create(\n from: ENV['TWILIO_PHONE_NUMBER'],\n to: \"+1#{to}\",\n body: body\n )\n end", "def send_channel(message)\n @handler.send_channel message\n end", "def send(message)\n info(\"[Emailvision] Send -> #{message}\")\n end", "def send_msg(conn,args)\n p = @app.get_client(conn) #pega objeto Player da lista de clientes\n unless p.nil?\n @app.broadcast(Message.new('chat','txt',\n {'author' => CGI::escapeHTML(p.to_s), 'msg' => CGI::escapeHTML(args['msg'])}\n )) #envia a mensagem para todos os clientes\n end\n end", "def send_telegram message = nil\n chat_id = self.telegram\n if chat_id and !!@@telegram_client\n if message\n begin\n puts \"Enviando: #{message}\n to: #{chat_id}\"\n @@telegram_client.send_message(chat_id: chat_id, text: message)\n true\n rescue\n puts \"Error sending message to telegram group #{group_id}\"\n false\n end\n end\n end\n end", "def send_message(arg1, arg2)\n account_sid = 'AC5XXXXXXXXXXXXXXXXXXX' # place twilio sid here\n auth_token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX' # place twilio auth token here\n client = Twilio::REST::Client.new(account_sid, auth_token)\n \n from = '' # Your Twilio number\n to = arg1 # Your mobile phone number\n \n client.messages.create(\n from: from,\n to: to,\n body: arg2\n )\n\n end", "def send(message, options = { channelID: 1 })\n params = { message: message, channelID: options[:channelID] }\n rest.post chat_path, params: params\n end", "def send_message(_target, text) # rubocop:disable Metrics/AbcSize\n url = \"https://api.gitter.im/v1/rooms/#{config.room_id}/chatMessages\"\n uri = URI.parse(url)\n\n Net::HTTP.start(\n uri.host,\n uri.port,\n use_ssl: true,\n verify_mode: OpenSSL::SSL::VERIFY_NONE,\n ) do |http|\n request = Net::HTTP::Post.new(uri.path)\n request.add_field('Content-Type', 'application/json')\n request.add_field('Accept', 'application/json')\n request.add_field('Authorization', \"Bearer #{config.token}\")\n request.body = { 'text' => text }.to_json\n response = http.request(request)\n\n @user_id = MultiJson.load(response.body)['fromUser']['id']\n end\n end", "def send_message message\n raise \"not on the reactor thread\" unless EM.reactor_thread?\n transition_on_send message_name(message), message do |msg|\n send_object msg\n end\n end", "def send_message(message)\n @socket.write(message)\n @socket.write(\"\\004\")\n end", "def sent_telegram( message )\n\tTelegram::Bot::Client.run($telegram_token) do |bot|\n\t\tbot.api.send_message( chat_id: 43716964, text: message)\n\tend\nend", "def send_message!\n msg = Message::Request.from_job(self)\n msg.send!\n end", "def send_to_single(pars)\n @message = Message.new(pars)\n @message.sender = current_user\n if @message.save\n flash[:info] = \"Your message has been sent to #{@message.receiver.full_name}\"\n else\n flash[:error] = \"Your message could not be sent to #{@message.receiver.full_name}\"\n end\n end", "def send_sms(to_phone_number, message)\n # message = {to:, from:, body: \"Hello\\n\\nWorld\"}\n # binding.pry\n @@client.messages.create(\n from: @@from,\n to: to_phone_number,\n body: message\n )\n end", "def send_msg(data, connection)\n # TODO\n end", "def sendMsg(msg)\r\n @pubNub.publish(:message => msg, :channel => @channel, :http_sync => true)\r\n end", "def send_message( message )\n if @logger.debug?\n @logger.debug \"sending message >>#{message.to_s.inspect}<<\"\n end\n\n @packet_sender.send message\n end", "def speak(data)\n sender = current_user\n message = data['message']\n\n # Save message in database as historical data\n msg = Message.new\n msg.user_id = current_user.id \n msg.recipient_id = data[\"target_user\"]\n msg.content = data['message']\n puts msg\n msg.save!\n\n # Sends back the data in realtime using websockets\n ActionCable.server.broadcast \"RoomChannel\", {message: message, sender: current_user, recipient: User.find(msg.recipient_id)}\n\n end", "def send(message)\n if message.length > 0\n # The client will return an empty string\n # on success, or it will return an error\n error = @client.transmit(message)\n if error.length > 0\n new_message(error)\n end\n end\n end", "def chat_message\n @room=current_user.room\n\n @chat_message=ChatMessage.create! content: params[:message],owner_id: current_user.id\n chat_message=render_to_string partial: \"chat_message/chat_message\"\n\n publish_async(\"presence-room_#{@room.id}\", \"chat_message\", {\n message: chat_message\n })\n\n render json: {\n message: chat_message\n }\n end", "def sendChatAction to, act\n self.query(\"sendChatAction\", {:chat_id=>to, :action=>act})\n end", "def respond(message)\n @channel.send_message(message) if @channel\n end", "def send_message msg\n timeline << Spinoza::Event[actor: dst, time: time_now + latency,\n action: :recv, msg: msg]\n end", "def send_message(opts = {})\n @client.update(opts[:message])\n end", "def send_message(mesg, options = {})\n @client.ping mesg, options\n end", "def send_message(message, wparam = 0, lparam = 0)\n with_handle { User32.SendMessage(@handle, User32::EditMessage[message], wparam, lparam) }\n end", "def set_message\n @message = RoomMessage.find(param[:id])\n end", "def send_message(message)\n @message = message\n\n mail to: \"debbieblass@web.de\",\n subject: \"Message from GoLunch Visitor\"\n end", "def sendmsg(*args, &block)\n inbox.sendmsg(*args, &block)\n end", "def send_notification(params)\n room_id = self.room_id || params.delete(:room_id)\n raise ArgumentError.new(\"room_id required\") unless room_id\n call_api(:method => :post, :uri => @api_base.merge(\"room/#{room_id}/notification\"), :body_params => params)\n end", "def send_message(message, even_if_busy = false)\n if connect = choose_peer(even_if_busy)\n connect.send_strings(message)\n true\n end\n end", "def write(rawmsg)\r\n @connection.send(rawmsg)\r\n end", "def create\n message = msg_params\n @msg = Msg.new(msg_params)\n thesender = @msg.sender\n thesentdate = @msg.sent\n theservertime = DateTime.now\n unless @msg.content.empty? || @msg.sender.empty?\n ActionCable.server.broadcast 'room_channel',\n content: @msg.content,\n sender: thesender,\n servertime: theservertime\n end\n end", "def perform(message)\n\t\t# Broadcast the rendered message to the channel\n\t\tActionCable.server.broadcast 'chatroom_channel', message: render_message(message)\n\tend", "def send_message(message)\n raise NotImplementedError, 'Raw connections do not support send_message. Please subclass and define a send_message method.'\n end", "def send_message(subject, message, recipients, adminEmail, params)\n # execute_operation(:send_message, { nickname: nickname, subject: subject, recipients: recipients, message: message, adminEmail: adminEmail params: params })\n raise RuntimeError, 'Not implemented'\n end", "def send_message\n self.get_message\n self.conn.get.status\n end", "def send_message(msg)\n\t\t\tdb_update({}, {'$push' => { 'messages' => msg.id.to_db } })\n\t\t\tmessages.add(msg)\n\t\tend" ]
[ "0.7930646", "0.78040284", "0.7580107", "0.75514656", "0.75463784", "0.7443277", "0.73897904", "0.7365156", "0.7352317", "0.7342158", "0.7251314", "0.72377723", "0.7229373", "0.7229373", "0.72246164", "0.7217412", "0.71843445", "0.7152043", "0.7126366", "0.7101068", "0.7085528", "0.7079511", "0.7062194", "0.7061056", "0.70359164", "0.702802", "0.70170546", "0.70023125", "0.69974154", "0.6996323", "0.6978998", "0.6974369", "0.6916512", "0.691058", "0.689355", "0.68857944", "0.68777335", "0.6873462", "0.68636686", "0.6850705", "0.6847706", "0.6809932", "0.6779435", "0.6765349", "0.67650163", "0.676368", "0.6763503", "0.6745813", "0.6731105", "0.6719747", "0.67128193", "0.67120194", "0.6704262", "0.67032367", "0.6702687", "0.6691095", "0.6686533", "0.6686132", "0.66672283", "0.6661924", "0.66584855", "0.6653667", "0.66444105", "0.66428083", "0.6640263", "0.66389966", "0.6625969", "0.661367", "0.66119444", "0.66013616", "0.65777177", "0.6574428", "0.65740484", "0.65733117", "0.6565416", "0.65639985", "0.6556625", "0.65531284", "0.65529406", "0.65421593", "0.65410095", "0.65352285", "0.6534412", "0.6524371", "0.6516713", "0.65080154", "0.6507063", "0.6501298", "0.6487296", "0.647183", "0.64678496", "0.6466954", "0.64656276", "0.6462932", "0.645385", "0.64436805", "0.6435521", "0.64347494", "0.64336246", "0.64190936", "0.64133584" ]
0.0
-1
Close connections and timers
def disconnect() @connection.stop() @timer.stop() @broadcast.stop() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n inactive!\n close_connections\n end", "def close\n @closing = true\n cancel_ping_timer\n cancel_reconnect_timer\n close_connection_after_writing if connected?\n process_disconnect if reconnecting?\n end", "def close_connections\n @connections.values.each(&:close)\n end", "def close_all\n @connections.close_all\n end", "def __close_connections\n # to be implemented by specific transports\n end", "def closeConnections()\n #N Without this, the connections won't be closed\n @sshAndScp.close()\n end", "def close()\n @connection.disconnect\n @connection = nil\n end", "def close()\n\t\t@connection.disconnect\n\t\t@connection = nil\n\tend", "def close\n @clients.each { |c| c.reset(); c.close() } if @clients\n end", "def close\n stop_monitoring_connection\n close_connection\n end", "def close_client_connections\n @pending_data.each_key(&:close)\n @pending_data.clear\n end", "def close\n @conn.disconnect\n end", "def close\n\t\t@conn.disconnect\n\tend", "def disconnect; @connection.close end", "def close\n log \"Closing connection\", level: :warning\n close_stream\n close_socket\n stop_reader\n set_state :disconnected\n notify_error DisconnectError.new(\"Connection was closed\")\n\n # stop timer\n # as we're running inside the timer, code after stop_timer() will not be called,\n # unless it's in the ensure block\n stop_timer\n end", "def clean_up()\n puts \"Closing MQTT and DB connections\"\n closeMQTTConn()\n closeDBConn()\n end", "def connection_closed\n close\n end", "def close_connection; end", "def close_connection\n @connection.expunge\n @connection.logout\n @connection.disconnect\n end", "def shutdown_connection\n teardown_timers\n @conn.shutdown if @conn.respond_to? :shutdown\n @conn.terminate if @conn.respond_to? :terminate\n @conn = nil\n end", "def close\n @sockets.each do |sock|\n sock.close\n end\n @host = @port = nil\n @sockets.clear\n @checked_out.clear\n end", "def close_connection\n current_connection.logout if current_connection?\n current_connection = nil\n end", "def close\n # by default do nothing - close any cached connections\n end", "def close_expired_connections\n # By default the keep alive timeout is 15 sec, which is the HTTP 1.1\n # standard. To change the value, use keep_alive_timeout= method\n # do nothing, handled by HTTPClient\n end", "def close_expired_connections\n # By default the keep alive timeout is 15 sec, which is the HTTP 1.1\n # standard. To change the value, use keep_alive_timeout= method\n # do nothing, handled by HTTPClient\n end", "def close\n @connection_manager.close\n end", "def closeConnections\n #N Without this the cached connections won't get closed\n @contentHost.closeConnections()\n end", "def close_connections\n @connections ||= {}\n @connections.values.each do |connection|\n begin\n connection.disconnect!\n rescue\n end\n end\n\n @connections = {}\n end", "def close\n @timer.detach if @timer.attached?\n @reqtable = {}\n @transport.close\n @seqid = 0\n self\n end", "def disconnect\n @conn.close\nend", "def close_expired_connections\n raise NotImplementedError\n end", "def close\n close_connection(CLOSED, true)\n end", "def close\n @mutex.synchronize { @conn.close }\n end", "def close\n @mutex.synchronize { @conn.close }\n end", "def test_double_close()\n rdht = Scalaroid::ReplicatedDHT.new()\n rdht.close_connection()\n rdht.close_connection()\n end", "def close\n @connection.close\n end", "def close\n @connection.close\n end", "def close\n if self.conn && !self.conn.closed?\n self.conn.shutdown\n self.conn.close\n end\n\n self.conn = nil\n end", "def clean_up()\n puts \"Closing MQTT and DB connections\"\n closeMQTTConn($mqtt_client)\n closeDBConn($db_conn)\nend", "def close()\n @connected = false\n @my.close()\n @my = nil\n end", "def close\n connection.close if connection\n end", "def close\n @work_queue.shutdown if @work_queue\n @connection.close\n end", "def close\n parser_thread.kill if parser_thread # why if?\n poll_thread.kill\n socket.close if socket\n\n @status = DISCONNECTED\n end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def terminate_connection\n @intentionally_closed = true\n close_connection\n end", "def connection_closed\n end", "def close\n close_connection_after_writing\n end", "def close_connection\n @connection.close\n end", "def cleanup\n\t\tputs \"Reconectando...\"\n\t\t@reconect = true\n\t\tcheck_ip_integrity\n\t\t@server.close\n\t\t@response.kill\n\t\t@request.kill\n\tend", "def close_clients\n verify_not_closed\n @clients.each do |pub|\n pub.close()\n end\n @closed = true\n end", "def close\n\t\t\t@clients.map(&:close)\n\t\t\t@clients = nil\n\t\tend", "def shutdown\n @conn.shutdown\n end", "def disconnect!() @connections.each_value(&:disconnect) end", "def close\n @connection.close\n end", "def close\n @connection.close\n end", "def close\n\t\t\t\t@workers.each do |x|\n\t\t\t\t\tx.close\n\t\t\t\t\t@workers.delete x\n\t\t\t\tend\n\n\t\t\t\t@server.close\n\t\t\t\t@server = nil\n\t\t\tend", "def cleanup \n # close the sockets \n @servers.each{ |server| server[:listner].stop }\n @monitor.close\n end", "def close\n @channel.close\n @conn.close\n end", "def testDoubleClose()\n rdht = Scalaris::ReplicatedDHT.new()\n rdht.close_connection()\n rdht.close_connection()\n end", "def testDoubleClose()\n rdht = Scalaris::ReplicatedDHT.new()\n rdht.close_connection()\n rdht.close_connection()\n end", "def close\r\n\t\t@connection.Close\r\n\tend", "def close\n connection.close\n end", "def shutdown\n\t\tself.log.info \"Shutting down.\"\n\t\tself.reactor.stop_polling\n\t\t@conn.close\n\tend", "def close\n server_list.each { |server| server.close_channels }\n loop(0) { busy?(true) }\n server_list.each { |server| server.close }\n default_gateway.shutdown! if default_gateway\n end", "def close_tcp_sockets()\n\n if (@tcp_sockets.length > 0)\n\n @tcp_sockets.each do |tcp_socket|\n begin\n tcp_socket.close\n rescue Exception => e\n puts \"close_tcp_sockets:exception: #{e}\"\n end\n end\n\n end\n\n end", "def close_connection\n @connection.finish\n end", "def teardown_cleanup\n [reader, writer].each do |r_con|\n if(r_con && r_con.alive?)\n begin\n r_con.terminate\n rescue Celluloid::Task::TerminatedError\n warn 'Terminated task error when cleaning NSQ connections. Moving on.'\n end\n end\n end\n super\n end", "def do_close; end", "def close &on_disconnect\n @heartbeat_timer.cancel if @heartbeat_timer\n @heartbeat_timer = nil\n if on_disconnect\n @closing = true\n @on_disconnect = proc{\n on_disconnect.call\n @closing = false\n }\n end\n\n callback{ |c|\n if c.channels.any?\n c.channels.each do |ch, mq|\n mq.close\n end\n else\n send Protocol::Connection::Close.new(:reply_code => 200,\n :reply_text => 'Goodbye',\n :class_id => 0,\n :method_id => 0)\n end\n }\n end", "def close\n conn.write(\"(api-quit)\") if connected?\n rescue Errno::ECONNRESET\n ensure\n self.conn = nil\n end", "def close\n info { \"closing connection\" }\n socket.shutdown\n end", "def close\n @conn.close\n end", "def disconnect\n _logout\n @connection.close\n end", "def teardown_connections_to(servers)\n servers.each do |server|\n sessions[server].close\n sessions.delete(server)\n end\n end", "def close(timeout=10)\n # Prevent any new connections from being handed out\n self.pool_size = 0\n start_time = Time.now\n while (Time.now - start_time) < timeout\n sleep 1\n @mutex.synchronize do\n return if @connections.empty?\n @logger.info \"#{@name}: Waiting to close, #{@connections.size} connections are still in use\"\n end\n end\n @logger.warn \"#{@name}: Timed out while waiting to close, #{@connections.size} connections are still in use\"\n end", "def close\n send_termination_event\n end", "def close\n return if @conn.nil?\n @conn.close\n @conn = nil\n end", "def on_close(env)\n @connection.destroy if @connection\n end", "def close\n self.disconnect\n end", "def close\n close_client_connections\n @event_file.close\n end", "def killall\n begin\n\t @connections.each do |k,v| \n\t v[:thread].exit! unless v[:thread].nil?\n\t v.shutdown!\n\t end\n rescue Exception\n end\n initialize\n end", "def close_idle_connections(idle_time) # in sec\n @http_client.keep_alive_timeout = idle_time # set timeout value\n close_expired_connections\n end", "def close_idle_connections(idle_time) # in sec\n @http_client.keep_alive_timeout = idle_time # set timeout value\n close_expired_connections\n end", "def close\n @notification_server.close_connection\n end", "def close #:nodoc:\n @server.shutdown\n end", "def close\n if @http && @http.started?\n @http.finish\n Log.info \"Closing HTTP connection for #{@host} from #{@connection_opened_at}\"\n end\n @http = nil\n end", "def close_connection\n cls if connected?\n stop_read_loop\n stop_write_loop\n @socket.close if @socket\n @socket = nil\n @connected = false\n end", "def close(context)\n context.debug('Logout connection')\n @connection_info = nil\n @client.logout\n @client = nil\n @system = nil\n end", "def closeConnections\n #N Without this, cached SSH connections to the remote system won't get closed\n destinationLocation.closeConnections()\n end", "def close\n @socket.close\n @socket=\"\"\n end", "def close\n redis.disconnect!\n end", "def close\n @channel.close\n @connection.close\n end", "def disconnect()\r\n @callbacks.each { |block| block.call }.clear()\r\n @conn.close if @conn\r\n @conn = nil\r\n end", "def destroy_connection\r\n\tbegin\r\n\t\t@sock.close if @sock\r\n\tensure\r\n\t\t@connected=false\r\n\tend\r\n end", "def close\n @pool.close\n end", "def destroy_connection\n begin\n @ssock.close if @ssock\n @rsock.close if @rsock\n ensure\n @connected=false\n end\n end", "def close\n @pool.dispose\n end" ]
[ "0.80322015", "0.7925483", "0.77167", "0.7532413", "0.7518587", "0.7509835", "0.7364152", "0.73387057", "0.72770107", "0.72552776", "0.7254143", "0.7215758", "0.72124654", "0.7210961", "0.7174869", "0.7124224", "0.71160007", "0.71075135", "0.7094734", "0.70744544", "0.7073709", "0.7044935", "0.7021401", "0.70097935", "0.70097935", "0.7006887", "0.70026004", "0.6997865", "0.69960535", "0.6987606", "0.69733536", "0.6956571", "0.6945882", "0.6945882", "0.69353354", "0.6927514", "0.6927514", "0.69168574", "0.69151694", "0.6875948", "0.68522793", "0.6841079", "0.68381274", "0.68330073", "0.68330073", "0.68330073", "0.68330073", "0.68312824", "0.6830947", "0.6827514", "0.68090755", "0.6796396", "0.677489", "0.67698234", "0.6769792", "0.67619336", "0.675731", "0.675731", "0.6749647", "0.6736252", "0.6735629", "0.6716494", "0.6716494", "0.6700349", "0.66993093", "0.6698944", "0.66740614", "0.6652334", "0.6651904", "0.6651816", "0.6646606", "0.6642044", "0.66319543", "0.6621082", "0.6609346", "0.6608428", "0.6605931", "0.66057086", "0.6601445", "0.6593401", "0.6591977", "0.65892774", "0.65889335", "0.65870756", "0.65867656", "0.65867656", "0.65851986", "0.6578763", "0.657717", "0.65698403", "0.65682095", "0.6546201", "0.6539116", "0.65377635", "0.6528795", "0.65276283", "0.65233827", "0.65186995", "0.6514544", "0.6512331" ]
0.6533878
94
retrieve fs entries from /etc/fstab or /etc/mtab or /proc/mounts
def initialize (file = '/etc/fstab') @source_file = file @fs_by_id = Hash.new File.foreach(file) do |line| dev, mp, fstype, options = line.split next if options == nil next if line[0] == ?# next if mp[0] != ?/ # skip pseudo fs next if NOFS.has_key? fstype next if options =~ /loop/ # no need to readahead loop fs fs = FileSystem.new(dev, mp, fstype) @fs_by_id[fs.device_id] ||= fs end @fs_by_id.delete(0) # in case we get device_id=0 for hotplug devices. # the filesystem for block special files @fs_by_id[$BDEV_ID] = FileSystem.new($BDEV_NAME, '', $BDEV_NAME) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mounts\n mount_hash = {}\n mounts = File.open(\"/etc/mtab\", \"r\").read.split(\"\\n\").map{|l| l.split(/\\s+/)}\n mounts.each{|m| mount_hash[m[1]] = m[0] unless %w[devpts udev sysfs tmpfs none proc].include?(m[0])}\n mount_hash\nend", "def mounts\r\n @mounts.list\r\n end", "def disk_space()\n\n instructions = 'df -h'\n r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`\n\n @results[:disk_usage] = {}\n\n a = r.lines.grep(/\\/dev\\/root/)\n\n puts ('a: ' + a.inspect).debug if @debug\n\n if a.any? then\n size, used, avail = a[0].split(/ +/).values_at(1,2,3)\n\n @results[:disk_usage][:root] = {size: size, used: used, \n avail: avail}\n end\n\n a2 = r.lines.grep(/\\/dev\\/sda1/)\n\n puts ('a2: ' + a2.inspect).debug if @debug\n\n if a2.any? then\n size, used, avail = a2[0].split(/ +/).values_at(1,2,3)\n\n @results[:disk_usage][:sda1] = {size: size, used: used, \n avail: avail}\n end\n\n end", "def mount_list(www_root)\n arr = []\n %x{mount -t iso9660}.scan(/\\S+ on (\\S+)/) do |a|\n mountpoint = a[0]\n arr << mountpoint if mountpoint.match %r{#{www_root}}\n end\n arr\nend", "def getmountedvolumes\n # only support Linux for now\n return {} unless Facter['kernel'] && Facter['kernel'].value == 'Linux'\n\n dir = \"/etc\"\n mounted = {}\n\n # AUTOFS - gather only files named auto[._]*\n Dir.glob(File.join(dir, \"*\")).each do |file|\n next if file !~ /^auto[._].*/\n\n # AUTOFS - match only lines that look like nfs syntax such as host:/path\n IO.foreach(file) do |line|\n if line =~ /\\w:\\S/ && line !~ /^\\s*#/\n # Parse it, Example : \" nventory_backup -noatime,intr irvnetappbk:/vol/nventory_backup \"\n if line =~ /^(\\w[\\w\\S]+)\\s+\\S+\\s+(\\w[\\w\\S]+):(\\S+)/\n mnt = $1\n host = $2\n vol = $3\n mounted[\"volumes[mounted][/mnt/#{mnt}][config]\"] = file\n mounted[\"volumes[mounted][/mnt/#{mnt}][volume_server]\"] = host\n mounted[\"volumes[mounted][/mnt/#{mnt}][volume]\"] = vol\n mounted[\"volumes[mounted][/mnt/#{mnt}][type]\"] = 'nfs'\n end\n end\n end # IO.foreach\n end # Dir.glob\n\n # FSTAB - has diff syntax than AUTOFS. Example: \"server:/usr/local/pub /pub nfs rsize=8192,wsize=8192,timeo=14,intr\"\n IO.foreach(\"/etc/fstab\") do |line|\n if line =~ /^(\\w[\\w\\S]+):(\\S+)\\s+(\\S+)\\s+nfs/\n host = $1\n vol = $2\n mnt = $3\n mounted[\"volumes[mounted][#{mnt}][config]\"] = \"/etc/fstab\"\n mounted[\"volumes[mounted][#{mnt}][volume_server]\"] = host\n mounted[\"volumes[mounted][#{mnt}][volume]\"] = vol\n mounted[\"volumes[mounted][#{mnt}][type]\"] = 'nfs'\n end\n end # IO.foreach\n return mounted\n end", "def other_mounts\n others = []\n fstab_lines.each do |line|\n localdevice, localmount, _fstype, _options, _freq, _pass = line.split(/\\s+/)\n others << line if localmount == mount && localdevice != device\n end\n others\n end", "def mountpoints\n mtab = IO.readlines '/proc/mounts'\n mountpoints = mtab.map{ |line| line.split(/\\s+/)[1]}\n mountpoints.map!{ |mount| unescape(mount) }\n # Ignore common system mountpoints.\n mountpoints.reject!{ |mount| mount =~ /^\\/$/ }\n mountpoints.reject!{ |mount| mount =~ /^\\/(proc|sys|usr|boot|tmp|dev|var|bin|etc|lib).*/ }\n # Mount /run/media/* but ignore other /run/ mountpoints.\n mountpoints.reject!{ |mount| mount =~ /^\\/run.*/ unless mount =~ /^\\/run\\/(media.*)/ }\n\n # Add home dir.\n mountpoints << home\n end", "def tmpfs\n\t\t\t\tret = {}\n\t\t\t\tmounts.each { |x|\n\t\t\t\t\tret.merge!({x.split[1] => x}) if x.start_with?('tmpfs '.freeze)\n\t\t\t\t}\n\t\t\t\tret\n\t\t\tend", "def mounts_info\n @mounts_info ||= vault_client.request(:get, \"/v1/sys/internal/ui/mounts\")\n rescue Vault::VaultError\n unable_to_determine_version\n raise\n end", "def tmpfs_mount_status(desired)\n # Start with checking if it was mounted the way we would mount it\n # this is ALMOST the same as the 'is it identical' check for non-tmpfs\n # filesystems except that with tmpfs we don't treat 'auto' as equivalent and\n # that we skip inode64 option on current mount status - because it's activated\n # by default on Linux kernel >= 5.9\n fs_data = node.filesystem_data\n key = \"#{desired['device']},#{desired['mount_point']}\"\n if fs_data['by_pair'][key]\n mounted = fs_data['by_pair'][key].to_hash\n if mounted['fs_type'] == 'tmpfs'\n Chef::Log.debug(\n \"fb_fstab: tmpfs #{desired['device']} on \" +\n \"#{desired['mount_point']} is currently mounted...\",\n )\n\n skipped_opts = []\n if _are_tmpfs_using_inode64?\n\n # inode64 is active by default on tmpfs for Linux kernel > 5.9\n skipped_opts.push('inode64')\n end\n\n if compare_opts(desired['opts'], mounted['mount_options'], skipped_opts)\n Chef::Log.debug('fb_fstab: ... with identical options.')\n return :same\n else\n Chef::Log.debug(\n \"fb_fstab: ... with different options #{desired['opts']} vs \" +\n mounted['mount_options'].join(','),\n )\n Chef::Log.info(\n \"fb_fstab: #{desired['mount_point']} is mounted with options \" +\n \"#{canonicalize_opts(mounted['mount_options'])} instead of \" +\n canonicalize_opts(desired['opts']).to_s,\n )\n return :remount\n end\n end\n end\n # OK, if that's not the case, we don't have the same device, which\n # is OK. Find out if we have something mounted at the same spot, and\n # get its device name so we can find it's entry in node['filesystem']\n if fs_data['by_mountpoint'][desired['mount_point']]\n # If we are here the mountpoints are the same...\n mounted = fs_data['by_mountpoint'][desired['mount_point']].to_hash\n # OK, if it's tmpfs as well, we're diong good\n if mounted['fs_type'] == 'tmpfs'\n Chef::Log.warn(\n \"fb_fstab: Treating #{mounted['devices']} on \" +\n \"#{desired['mount_point']} the same as #{desired['device']} on \" +\n \"#{desired['mount_point']} because they are both tmpfs.\",\n )\n Chef::Log.debug(\n \"fb_fstab: tmpfs #{desired['device']} on \" +\n \"#{desired['mount_point']} is currently mounted...\",\n )\n Chef::Log.debug(\"fb_fstab: #{desired} vs #{mounted}\")\n if compare_opts(desired['opts'], mounted['mount_options'])\n Chef::Log.debug('fb_fstab: ... with identical options.')\n return :same\n else\n Chef::Log.debug(\n \"fb_fstab: ... with different options #{desired['opts']} vs \" +\n mounted['mount_options'].join(','),\n )\n Chef::Log.info(\n \"fb_fstab: #{desired['mount_point']} is mounted with options \" +\n \"#{canonicalize_opts(mounted['mount_options'])} instead of \" +\n canonicalize_opts(desired['opts']).to_s,\n )\n return :remount\n end\n end\n Chef::Log.warn(\n \"fb_fstab: tmpfs is desired on #{desired['mount_point']}, but \" +\n \"non-tmpfs #{mounted['devices']} (#{mounted['fs_type']}) currently \" +\n 'mounted there.',\n )\n return :conflict\n end\n :missing\n end", "def filesystem_usage\n\n usage = {}\n\n df = capture_command_output('df', '-k')[1..-1] # Don't include the column headers.\n df.each do |df_line|\n\n df_line.strip!\n device = df_line.match(/^(.*?)\\s{2,}/)[1]\n tokens = df_line.gsub(/^#{Regexp.quote(device)}\\s+/, '').split(/\\s+/, 5)\n \n # Convert all KB values to bytes.\n size = tokens[0].to_i * 1024\n used = tokens[1].to_i * 1024\n available = tokens[2].to_i * 1024\n used_percentage = tokens[3].to_i\n\n usage[device] = {\n :size => size,\n :used => used,\n :used_percentage => used_percentage,\n :available => available\n }\n\n end\n\n usage\n\n end", "def find_fstab(partitions, path)\n fstab = ''\n partitions.each do |p|\n OpenNebula.log(\"Looking for fstab on #{p['path']}\")\n\n rc = mount_dev(p['path'], path)\n next unless rc\n\n bin = COMMANDS[:catfstab]\n bin = COMMANDS[:cat] unless path.include?('containers/one-')\n\n cmd = \"#{bin} #{path}/etc/fstab\"\n\n _rc, fstab, _e = Command.execute(cmd, false)\n\n if fstab.empty?\n return false unless umount_dev(p['path'])\n\n next\n end\n\n OpenNebula.log(\"Found fstab on #{p['path']}\")\n break\n end\n\n return fstab unless fstab.empty?\n\n OpenNebula.log_error('No fstab file found')\n\n false\n end", "def ReadFstab(dir)\n ret = []\n vinfos = ::Storage::DequeVolumeInfo.new()\n r = @sint.readFstab(dir, vinfos)\n if !r\n Builtins.y2error(\"ReadFstab sint dir %1 ret %2\", dir, r)\n else\n vinfos.each do |info|\n p = {}\n p = volumeMap(info, p)\n ret = Builtins.add(ret, p)\n end\n end\n Builtins.y2milestone(\"ReadFstab from %1 ret %2\", dir, ret)\n ret\n end", "def filesystem_labels\n\n labels = {}\n\n mount = capture_command_output('mount')\n mount.each do |mount_line|\n\n mount_line.strip!\n device = mount_line.match(/^(.*?) on/)[1]\n\n if PlatformInfo.linux?\n\n # /dev/hda3 on / type ext4 (rw,errors=remount-ro)\n mount_point = mount_line.match(/^#{Regexp.quote(device)} on (.*?) type/)[1]\n fs_type = mount_line.match(/type (.*?) \\(/)[1]\n\n elsif PlatformInfo.osx?\n\n # /dev/disk0s2 on / (hfs, local, journaled)\n mount_point = mount_line.match(/^#{Regexp.quote(device)} on (.*?) \\(/)[1]\n fs_type = mount_line.match(/ \\((.*?), /)[1]\n \n else\n unsupported_platform\n end\n\n labels[device] = {\n :mount_point => mount_point,\n :file_system => fs_type\n }\n\n end\n\n labels\n\n end", "def list_partitions #by nelsongs\n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{print $1}'`.chomp.split\nend", "def lsof\n Dir.new(\"/proc/#{Process.pid}/fd/\").entries\n end", "def mount_status(desired)\n # We treat tmpfs specially. While we don't want people to mount tmpfs with\n # a device of 'none' or 'tmpfs', we also don't want to make them remount\n # (and lose all their data) just to convert to fb_fstab. So we'll make\n # them use a new name in the config, but we will treat the pre-mounted\n # mounts as valid/the same. Besides, since the device is meaningless, we\n # can just ignore it for the purposes of this test anyway.\n if desired['type'] == 'tmpfs'\n return tmpfs_mount_status(desired)\n end\n\n key = \"#{desired['device']},#{desired['mount_point']}\"\n fs_data = node.filesystem_data\n mounted = nil\n if fs_data['by_pair'][key]\n mounted = fs_data['by_pair'][key].to_hash\n else\n key = \"#{desired['device']}/,#{desired['mount_point']}\"\n if fs_data['by_pair'][key]\n mounted = fs_data['by_pair'][key].to_hash\n end\n end\n\n if mounted\n Chef::Log.debug(\n \"fb_fstab: There is an entry in node['filesystem'] for #{key}\",\n )\n # If it's a virtual device, we require the fs type to be identical.\n # otherwise, we require them to be similar. This is because 'auto'\n # is meaningless without a physical device, so we don't want to allow\n # it to be the same.\n if compare_fstype(desired['type'], mounted['fs_type']) ||\n (desired['device'].start_with?('/') &&\n [desired['type'], mounted['fs_type']].include?('auto'))\n Chef::Log.debug(\n \"fb_fstab: FS #{desired['device']} on #{desired['mount_point']}\" +\n ' is currently mounted...',\n )\n if compare_opts(desired['opts'], mounted['mount_options'])\n Chef::Log.debug('fb_fstab: ... with identical options.')\n return :same\n else\n Chef::Log.debug(\n \"fb_fstab: ... with different options #{desired['opts']} vs \" +\n mounted['mount_options'].join(','),\n )\n Chef::Log.info(\n \"fb_fstab: #{desired['mount_point']} is mounted with options \" +\n \"#{canonicalize_opts(mounted['mount_options'])} instead of \" +\n canonicalize_opts(desired['opts']).to_s,\n )\n return :remount\n end\n else\n Chef::Log.warn(\n \"fb_fstab: Device #{desired['device']} is mounted at \" +\n \"#{mounted['mount']} as desired, but with fstype \" +\n \"#{mounted['fs_type']} instead of #{desired['type']}\",\n )\n return :conflict\n end\n end\n\n # In this case we don't have the device we expect at the mountpoint we\n # expect. Assuming it's not NFS/Gluster which can be mounted in more than\n # once place, we look up this device and see if it moved or just isn't\n # mounted\n unless ['nfs', 'nfs4', 'glusterfs'].include?(desired['type'])\n device = fs_data['by_device'][desired['device']]\n # Here we are checking if the device we want\n # has already a mount defined\n # We want to return :moved if it does except\n # in the case when it's a btrfs\n # disk and our desired and current options\n # are trying to mount different subvolumes\n if device && device['mounts'] && !device['mounts'].empty? &&\n !(\n FB::Fstab.btrfs_subvol?(\n device['fs_type'],\n device['mount_options'].join(','),\n ) &&\n FB::Fstab.btrfs_subvol?(\n desired['type'],\n desired['opts'],\n ) &&\n !FB::Fstab.same_subvol?(\n device['mounts'][0],\n device['mount_options'].join(','),\n desired['opts'],\n )\n )\n\n Chef::Log.warn(\n \"fb_fstab: #{desired['device']} is at #{device['mounts']}, but\" +\n \" we want it at #{desired['mount_point']}\",\n )\n return :moved\n end\n end\n\n # Ok, this device isn't mounted, but before we return we need to check\n # if anything else is mounted where we want to be.\n if fs_data['by_mountpoint'][desired['mount_point']]\n devices = fs_data['by_mountpoint'][\n desired['mount_point']]['devices']\n Chef::Log.warn(\n \"fb_fstab: Device #{desired['device']} desired at \" +\n \"#{desired['mount_point']} but something #{devices} already \" +\n 'mounted there.',\n )\n return :conflict\n end\n :missing\n end", "def filesystem_file(host)\n case host['platform']\n when %r{aix}\n '/etc/filesystems'\n when %r{el-|centos|fedora|sles|debian|ubuntu}\n '/etc/fstab'\n else\n # TODO: Add Solaris and OSX support, as per PUP-5201 and PUP-4823\n fail_test(\"Unable to determine filesystem table file location for #{host['platform']}\")\n end\n end", "def enum_recent_mounts(base_key)\n\trecent_mounts = []\n\tpartial_path = base_key + '\\Software\\\\Microsoft\\Windows\\CurrentVersion\\Explorer'\n\tfull_path = \"#{partial_path}\\\\Map Network Drive MRU\"\n\texplorer_keys = registry_enumkeys(partial_path)\n\tif explorer_keys.include?(\"Map Network Drive MRU\")\n\t\tregistry_enumvals(full_path).each do |k|\n\t\t\tif not k =~ /MRUList/\n\t\t\t\trecent_mounts << registry_getvaldata(full_path,k)\n\t\t\tend\n\t\tend\n\tend\n\treturn recent_mounts\nend", "def __nrpe_fstab\n\t\t\t\tdata = call_nrpe \"check_fstab\"\n\t\t\t\treturn false if data == false\n\t\t\t\tdisks = data.chomp.split(\"|\").map! {|x| x.strip }\n\t\t\t\tdisks.delete(\"$\") if disks.include?(\"$\")\n\t\t\t\treturn disks\n\t\tend", "def all_entries\n inclusively do\n [Mount::Entry.new(\n shared_dir.path,\n shared_dir.mountpoint,\n 'none',\n 'bind,create=dir,ro',\n true\n )] + entries.select { |m| m.in_config? || (m.automount? && !m.temp?) }\n end\n end", "def all_devices search = nil\n partitions = []\n devices = []\n device = nil\n has_extended = false\n if DEBUG_MODE or Platform.ubuntu? or Platform.fedora?\n command = \"lsblk\"\n params = \" #{search} -b -P -o VENDOR,MODEL,TYPE,SIZE,KNAME,UUID,LABEL,MOUNTPOINT,FSTYPE,RM\"\n end\n lsblk = CommandsExecutor.new command, params\n lsblk.execute\n raise \"Command execution error: #{lsblk.stderr.read}\" if not lsblk.success?\n\n lsblk.result.each_line do |line|\n data_hash = {}\n line.squish!\n line_data = line.gsub!(/\"(.*?)\"/, '\\1#').split \"#\"\n line_data.each do |data|\n data.strip!\n key, value = data.split \"=\"\n data_hash[key.downcase] = value\n end\n data_hash['rm'] = data_hash['rm'].to_i # rm = 1 if device is a removable/flash device, otherwise 0\n if data_hash['type'] == 'mpath'\n data_hash.except!('uuid', 'label', 'mountpoint', 'fstype')\n if device\n multipath_info = {'mkname' => data_hash['kname'], 'multipath' => true, 'size' => data_hash['size']}\n device.merge! multipath_info\n else\n data_hash['multipath'] = true\n device = data_hash\n devices.push device\n end\n next\n end\n if data_hash['type'] == 'disk'\n data_hash.except!('uuid', 'label', 'mountpoint', 'fstype')\n unless device.nil?\n device['partitions'] = partitions\n partitions = []\n devices.push device\n device = nil # cleanup the variable\n end\n device = data_hash\n next\n end\n if data_hash['type'] == 'part'\n data_hash.except!('model', 'vendor')\n data_hash.merge! self.usage data_hash['kname']\n\n partition_number = get_partition_number \"/dev/#{data_hash['kname']}\" # For reference: data_hash['kname'].match(/[0-9]*$/)[0].to_i\n extended_partition_types = ['0x05'.hex, '0x0F'.hex]\n if partition_type_hex(data_hash['kname']).in? extended_partition_types\n has_extended = true\n next\n end\n if has_extended and partition_number > 4\n data_hash['logical'] = true\n end\n # device['partitions'].nil? ? device['partitions'] = [data_hash] : device['partitions'].push(data_hash)\n partitions.push(data_hash)\n end\n end\n device['partitions'] = partitions if device\n devices.push device\n if search\n return devices.first || partitions.first\n else\n return devices\n end\n end", "def parse_fstab(partitions, path, fstab)\n fstab.each_line do |l|\n next if l.strip.chomp.empty?\n next if l =~ /\\s*#/\n\n fs, mount_point, _type, _opts, _dump, _pass = l.split\n\n if l =~ /^\\s*LABEL=/ # disk by LABEL\n value = fs.split('=').last.strip.chomp\n key = 'label'\n elsif l =~ /^\\s*UUID=/ # disk by UUID\n value = fs.split('=').last.strip.chomp\n key = 'uuid'\n else # disk by device - NOT SUPPORTED or other FS\n next\n end\n\n next if %w[/ swap].include?(mount_point)\n\n partitions.each do |p|\n next if p[key] != value\n\n return false unless mount_dev(p['path'], path + mount_point)\n\n break\n end\n end\n\n true\n end", "def fstab_contents(os_part_label)\n fsopts = \"defaults,errors=remount-ro\"\n # We assume (safely) that there'll only be ONE grub cfg partition.\n # There can't be more than one since grub cannot read from more than one.\n grub_part = first_grub_cfg_partition\n\n [\n ['# <filesystem>', '<mnt>', '<type>', '<opts>', '<dump>', '<pass>'],\n [\"LABEL=#{os_part_label}\", '/', 'ext4', fsopts, '0', '1'],\n [\"LABEL=#{grub_part.label}\", '/grub', 'ext4', fsopts, '0', '1'],\n ].reduce('') { |memo, line_tokens|\n memo << line_tokens.join(\"\\t\")\n memo << \"\\n\"\n memo\n }\n end", "def check_unwanted_filesystems\n # extra things to skip\n devs_to_skip = node['fb_fstab']['umount_ignores']['devices'].dup\n dev_prefixes_to_skip =\n node['fb_fstab']['umount_ignores']['device_prefixes'].dup\n mounts_to_skip =\n node['fb_fstab']['umount_ignores']['mount_points'].dup\n mount_prefixes_to_skip =\n node['fb_fstab']['umount_ignores']['mount_point_prefixes'].dup\n mount_regexes_to_skip =\n node['fb_fstab']['umount_ignores']['mount_point_regexes'].dup\n fstypes_to_skip = node['fb_fstab']['umount_ignores']['types'].dup\n\n base_mounts = get_unmasked_base_mounts(:hash)\n\n # we're going to iterate over specified mounts a lot, lets dump it\n desired_mounts = node['fb_fstab']['mounts'].to_hash\n\n fs_data = node.filesystem_data\n fs_data['by_pair'].to_hash.each_value do |mounted_data|\n # ohai uses many things to populate this structure, one of which\n # is 'blkid' which gives info on devices that are not currently\n # mounted. This skips those, plus swap, of course.\n unless mounted_data['mount']\n Chef::Log.debug(\n \"fb_fstab: Skipping umount check for #{mounted_data['device']} \" +\n \"- it isn't mounted.\",\n )\n next\n end\n # Work around chef 12 ohai bug\n if mounted_data.key?('inodes_used') && !mounted_data.key?('kb_used')\n Chef::Log.debug(\n 'fb_fstab: Skipping mal-formed Chef 12 \"df -i\" entry ' +\n mounted_data.to_s,\n )\n next\n end\n # skip anything seemingly magical\n if devs_to_skip.include?(mounted_data['device'])\n Chef::Log.debug(\n \"fb_fstab: Skipping umount check for #{mounted_data['device']} \" +\n \"(#{mounted_data['mount']}): exempted device\",\n )\n next\n elsif mounts_to_skip.include?(mounted_data['mount'])\n Chef::Log.debug(\n \"fb_fstab: Skipping umount check for #{mounted_data['device']} \" +\n \"(#{mounted_data['mount']}): exempted mountpoint\",\n )\n next\n elsif fstypes_to_skip.include?(mounted_data['fs_type'])\n Chef::Log.debug(\n \"fb_fstab: Skipping umount check for #{mounted_data['device']} \" +\n \"(#{mounted_data['mount']}): exempted fstype\",\n )\n next\n elsif dev_prefixes_to_skip.any? do |i|\n mounted_data['device']&.start_with?(i)\n end\n Chef::Log.debug(\n \"fb_fstab: Skipping umount check for #{mounted_data['device']} \" +\n \"(#{mounted_data['mount']}) - exempted device prefix\",\n )\n next\n elsif mount_prefixes_to_skip.any? do |i|\n mounted_data['mount']&.start_with?(i)\n end\n Chef::Log.debug(\n \"fb_fstab: Skipping umount check for #{mounted_data['device']} \" +\n \"(#{mounted_data['mount']}) - exempted mount_point prefix\",\n )\n next\n elsif mount_regexes_to_skip.any? do |i|\n mounted_data['mount'] =~ /#{i}/\n end\n Chef::Log.debug(\n \"fb_fstab: Skipping umount check for #{mounted_data['device']} \" +\n \"(#{mounted_data['mount']}) - exempted mount_point regex\",\n )\n next\n end\n\n # Is this device in our list of desired mounts?\n next if should_keep(mounted_data, desired_mounts, base_mounts)\n\n if node['fb_fstab']['enable_unmount']\n converge_by \"unmount #{mounted_data['mount']}\" do\n umount(mounted_data['mount'], mounted_data['lock_file'], node['fb_fstab']['umount_delete_empty_mountdir'])\n end\n else\n Chef::Log.warn(\n \"fb_fstab: Would umount #{mounted_data['device']} from \" +\n \"#{mounted_data['mount']}, but \" +\n 'node[\"fb_fstab\"][\"enable_unmount\"] is false',\n )\n Chef::Log.debug(\"fb_fstab: #{mounted_data}\")\n end\n end\n end", "def get_disk_util\n used_info = query_data(params[:host], 'df.1kblocks.used', params[:from_ts], params[:to_ts])\n total_info = query_data(params[:host], 'df.1kblocks.total', params[:from_ts], params[:to_ts])\n\n used_info.delete_if { |k, v|\n k.index(\"fstype=tmpfs\")\n }\n total_info.delete_if { |k, v|\n k.index(\"fstype=tmpfs\")\n }\n \n results = {}\n used_info.each { |k, v|\n matcher = /mount=([\\/\\w]+) /.match(k)\n if matcher\n path = matcher[1]\n\n if total_info.has_key?(k)\n total_v = total_info[k]\n total_v_map = Hash[total_v]\n results[path] = v.collect { |point|\n ts = point[0]\n if (total_v_map.has_key?(ts))\n [ts, format(\"%.2f\", point[1] * 100.0 / total_v_map[ts]).to_f]\n end\n }.keep_if { |v| v }\n end\n end\n }\n\n render json: results\n end", "def mount_paths_listing\n Dir[\"#{mounts_path}/*\"]\n end", "def fslistf(name)\n if fexistf name\n return eval \"$#{name}['#{name},set'].to_a\"\n else\n return []\n end\nend", "def get_available_fusion_vms(options)\n vm_list = []\n if File.directory?(options['fusiondir']) or File.symlink?(options['fusiondir'])\n vm_list = %x[find \"#{options['fusiondir']}/\" -name \"*.vmx'].split(\"\\n\")\n end\n return vm_list\nend", "def get_partition_info\n # remove leading slash so it matches the packages.DU path\n remove_slash = true\n\n if !Stage.initial\n # read /proc/mounts as a list of maps\n # $[\"file\":\"/boot\", \"freq\":0, \"mntops\":\"rw\", \"passno\":0, \"spec\":\"/dev/sda1\", \"vfstype\":\"ext2\"]\n mounts = Convert.convert(\n SCR.Read(path(\".proc.mounts\")),\n :from => \"any\",\n :to => \"list <map <string, any>>\"\n )\n Builtins.y2milestone(\"mounts %1\", mounts)\n\n partitions = []\n Builtins.foreach(mounts) do |mpoint|\n name = Ops.get_string(mpoint, \"file\", \"\")\n if Builtins.substring(name, 0, 1) == \"/\" &&\n Builtins.substring(name, 0, 5) != \"/dev/\" && # filter out /dev/pts etc.\n Ops.get_string(mpoint, \"vfstype\", \"\") != \"rootfs\" # filter out duplicate \"/\" entry\n capacity = Pkg.TargetCapacity(name)\n if capacity != 0 # dont look at pseudo-devices (proc, shmfs, ...)\n used = Pkg.TargetUsed(name)\n partitions = Builtins.add(\n partitions,\n {\n \"name\" => name,\n \"free\" => Ops.subtract(capacity, used),\n \"used\" => used\n }\n )\n end\n end\n end\n Pkg.TargetInitDU(partitions)\n Builtins.y2milestone(\"get_partition_info: %1\", partitions)\n return deep_copy(partitions)\n end # !Stage::initial ()\n\n # remove the previous failures\n @failed_mounts = []\n\n # installation stage - Storage:: is definitely present\n # call Storage::GetTargetMap()\n targets = Convert.convert(\n WFM.call(\"wrapper_storage\", [\"GetTargetMap\"]),\n :from => \"any\",\n :to => \"map <string, map>\"\n )\n\n if targets == nil\n Builtins.y2error(\"Target map is nil, Storage:: is probably missing\")\n end\n\n if Mode.test\n targets = Convert.convert(\n SCR.Read(path(\".target.yast2\"), \"test_target_map.ycp\"),\n :from => \"any\",\n :to => \"map <string, map>\"\n )\n end\n\n target_partitions = []\n min_spare = 20 * 1024 * 1024 # minimum free space ( 20 MB )\n\n Builtins.foreach(targets) do |disk, diskinfo|\n part_info = Ops.get_list(diskinfo, \"partitions\", [])\n Builtins.foreach(part_info) do |part|\n Builtins.y2milestone(\"Adding partition: %1\", part)\n used_fs = Ops.get_symbol(part, \"used_fs\", :unknown)\n # ignore VFAT and NTFS partitions (bnc#)\n if used_fs == :vfat || used_fs == :ntfs\n Builtins.y2warning(\n \"Ignoring partition %1 with %2 filesystem\",\n Ops.get_string(part, \"device\", \"\"),\n used_fs\n )\n else\n free_size = 0\n\n if Ops.get(part, \"mount\") != nil &&\n Builtins.substring(Ops.get_string(part, \"mount\", \"\"), 0, 1) == \"/\"\n if Ops.get(part, \"create\") == true ||\n Ops.get(part, \"delete\") == false ||\n Ops.get(part, \"create\") == nil &&\n Ops.get(part, \"delete\") == nil\n Builtins.y2debug(\n \"get_partition_info: adding partition: %1\",\n part\n )\n\n # get free_size on partition in kBytes\n free_size = Ops.multiply(\n Ops.get_integer(part, \"size_k\", 0),\n 1024\n )\n free_size = Ops.subtract(free_size, min_spare)\n\n # free_size smaller than min_spare, fix negative value\n if Ops.less_than(free_size, 0)\n Builtins.y2milestone(\"Fixing free size: %1 to 0\", free_size)\n free_size = 0\n end\n\n used = 0\n if !(Ops.get_boolean(part, \"create\", false) ||\n Ops.get_boolean(part, \"format\", false))\n tmpdir = Convert.to_string(SCR.Read(path(\".target.tmpdir\")))\n tmpdir = Ops.add(tmpdir, \"/diskspace_mount\")\n SCR.Execute(\n path(\".target.bash\"),\n Builtins.sformat(\"test -d %1 || mkdir -p %1\", tmpdir)\n )\n\n # mount in read-only mode (safer)\n mount_options = [\"ro\"]\n\n # add \"nolock\" if it's a NFS share (bnc#433893)\n if used_fs == :nfs\n Builtins.y2milestone(\"Mounting NFS with 'nolock' option\")\n mount_options = Builtins.add(mount_options, \"nolock\")\n end\n\n # join the options\n mount_options_str = Builtins.mergestring(mount_options, \",\")\n\n mount_command = Builtins.sformat(\n \"/bin/mount -o %1 %2 %3\",\n mount_options_str,\n Ops.get_string(part, \"device\", \"\"),\n tmpdir\n )\n\n Builtins.y2milestone(\n \"Executing mount command: %1\",\n mount_command\n )\n\n result = Convert.to_integer(\n SCR.Execute(path(\".target.bash\"), mount_command)\n )\n Builtins.y2milestone(\"Mount result: %1\", result)\n\n if result == 0\n partition = Convert.convert(\n SCR.Read(path(\".run.df\")),\n :from => \"any\",\n :to => \"list <map <string, string>>\"\n )\n Builtins.foreach(partition) do |p|\n if Ops.get_string(p, \"name\", \"\") == tmpdir\n Builtins.y2internal(\"P: %1\", p)\n free_size = Ops.multiply(\n Builtins.tointeger(Ops.get_string(p, \"free\", \"0\")),\n 1024\n )\n used = Ops.multiply(\n Builtins.tointeger(Ops.get_string(p, \"used\", \"0\")),\n 1024\n )\n end\n end\n SCR.Execute(\n path(\".target.bash\"),\n Builtins.sformat(\"/bin/umount %1\", tmpdir)\n )\n else\n Builtins.y2error(\n \"Mount failed, ignoring partition %1\",\n Ops.get_string(part, \"device\", \"\")\n )\n @failed_mounts = Builtins.add(@failed_mounts, part)\n\n next\n end\n else\n # for formatted partitions estimate free system size\n # compute fs overhead\n used = EstimateFsOverhead(part)\n\n if Ops.greater_than(used, 0)\n Builtins.y2milestone(\n \"Partition %1: assuming fs overhead: %2kB\",\n Ops.get_string(part, \"device\", \"\"),\n Ops.divide(used, 1024)\n )\n end\n\n # journal size\n js = 0\n\n if ExtFs(used_fs)\n js = ExtJournalSize(part)\n reserved = ReservedSpace(part)\n\n if Ops.greater_than(reserved, 0)\n used = Ops.add(used, reserved)\n end\n elsif used_fs == :xfs\n js = XfsJournalSize(part)\n elsif used_fs == :reiser\n js = ReiserJournalSize(part)\n elsif used_fs == :jfs\n js = JfsJournalSize(part)\n else\n Builtins.y2warning(\n \"Unknown journal size for filesystem: %1\",\n used_fs\n )\n end\n\n if Ops.greater_than(js, 0)\n Builtins.y2milestone(\n \"Partition %1: assuming journal size: %2kB\",\n Ops.get_string(part, \"device\", \"\"),\n Ops.divide(js, 1024)\n )\n used = Ops.add(used, js)\n end\n\n # decrease free size\n free_size = Ops.subtract(free_size, used)\n\n # check for underflow\n if Ops.less_than(free_size, 0)\n Builtins.y2milestone(\"Fixing free size: %1 to 0\", free_size)\n free_size = 0\n end\n end\n\n # convert into kB for TargetInitDU\n free_size = Ops.divide(free_size, 1024)\n used = Ops.divide(used, 1024)\n\n Builtins.y2milestone(\n \"available partition: mount: %1, free: %2 KB, used: %3 KB\",\n Ops.get_string(part, \"mount\", \"\"),\n free_size,\n used\n )\n if !remove_slash\n target_partitions = Builtins.add(\n target_partitions,\n {\n \"name\" => Ops.get_string(part, \"mount\", \"\"),\n \"used\" => used,\n \"free\" => free_size\n }\n )\n else\n part_name = \"\"\n mount_name = Ops.get_string(part, \"mount\", \"\")\n\n if mount_name != \"/\"\n part_name = Builtins.substring(\n mount_name,\n 1,\n Builtins.size(mount_name)\n )\n else\n part_name = mount_name\n end\n\n target_partitions = Builtins.add(\n target_partitions,\n { \"name\" => part_name, \"used\" => used, \"free\" => free_size }\n )\n end\n end\n end\n end\n end # foreach (`part)\n end # foreach (`disk)\n\n # add estimated size occupied by non-package files\n target_partitions = EstimateTargetUsage(target_partitions)\n\n Builtins.y2milestone(\"get_partition_info: part %1\", target_partitions)\n Pkg.TargetInitDU(target_partitions)\n\n deep_copy(target_partitions)\n end", "def readFsTab(fstab)\n fstab_file = Ops.add(Installation.destdir, \"/etc/fstab\")\n\n if FileUtils.Exists(fstab_file)\n SCR.RegisterAgent(\n path(\".target.etc.fstab\"),\n term(\n :ag_anyagent,\n term(\n :Description,\n term(:File, fstab_file),\n \"#\\n\", # Comment\n false, # read-only\n term(\n :List,\n term(\n :Tuple,\n term(:spec, term(:String, \"^\\t \")),\n term(:Separator, \"\\t \"),\n term(:file, term(:String, \"^\\t \")),\n term(:Separator, \"\\t \"),\n term(:vfstype, term(:String, \"^\\t \")),\n term(:Separator, \"\\t \"),\n term(:mntops, term(:String, \"^ \\t\\n\")),\n term(:Optional, term(:Whitespace)),\n term(:Optional, term(:freq, term(:Number))),\n term(:Optional, term(:Whitespace)),\n term(:Optional, term(:passno, term(:Number))),\n term(:Optional, term(:Whitespace)),\n term(:Optional, term(:the_rest, term(:String, \"^\\n\")))\n ),\n \"\\n\"\n )\n )\n )\n )\n\n fstab.value = Convert.convert(\n SCR.Read(path(\".target.etc.fstab\")),\n :from => \"any\",\n :to => \"list <map>\"\n )\n\n SCR.UnregisterAgent(path(\".target.etc.fstab\"))\n else\n Builtins.y2error(\"No such file %1. Not using fstab.\", fstab_file)\n end\n\n nil\n end", "def get_current_devices(proc_partitions_output)\n lines = proc_partitions_output.split(\"\\n\")\n partitions = lines.drop(2).map do |line|\n line.chomp.split.last\n end.reject do |partition|\n partition =~ /^dm-\\d/\n end\n devices = partitions.select do |partition|\n partition =~ /[a-z]$/\n end.sort.map {|device| \"/dev/#{device}\"}\n if devices.empty?\n devices = partitions.select do |partition|\n partition =~ /[0-9]$/\n end.sort.map {|device| \"/dev/#{device}\"}\n end\n devices\n end", "def get_fs_type(device)\n fs_check = Mixlib::ShellOut.new(\"blkid -c /dev/null #{device}\")\n fs_check.run_command\n match = fs_check.stdout.match(/\\sTYPE=\\\"(.*?)\\\"/)\n match = '' if match.nil?\n\n Chef::Log.info(\"File system type for device #{device}: #{match[1]}\")\n match[1]\nend", "def gen_fb_fstab(node)\n use_labels = node['fb_storage']['fstab_use_labels']\n fstab = {}\n fstab_fields =\n %w{type mount_point opts pass enable_remount allow_mount_failure}\n if node['fb_storage']['hybrid_xfs_use_helper']\n node.default['fb_fstab']['type_normalization_map']['rtxfs'] = 'xfs'\n node.default['fb_fstab']['ignorable_opts'] << /^rtdev=.*/\n end\n @config.each do |device, devconf|\n next if devconf['_skip']\n\n if devconf['whole_device']\n partconf = devconf['partitions'][0]\n if partconf['_swraid_array'] || partconf['_no_mount'] ||\n partconf['_swraid_array_journal']\n next\n end\n\n name = \"storage_#{device}_whole\"\n fstab[name] = {\n 'device' => use_labels ? \"LABEL=#{devconf['label']}\" : device,\n }\n fstab_fields.each do |field|\n fstab[name][field] = devconf['partitions'][0][field]\n end\n next\n end\n # rubocop:disable Lint/ShadowingOuterLocalVariable\n devconf['partitions'].each_with_index do |partconf, index|\n # If we are a member of a SW raid array, or we are a member\n # of a hybrid-xfs FS or we've been asked not to mount, then we skip\n # generating the fstab entry.\n if partconf['_no_mount'] ||\n partconf['_swraid_array'] || partconf['_swraid_array_journal'] ||\n partconf['_xfs_rt_data'] || partconf['_xfs_rt_rescue'] ||\n partconf['_xfs_rt_metadata']\n next\n end\n\n partnum = index + 1\n partition = FB::Storage.partition_device_name(\n device, partnum\n )\n name = \"storage_#{partition}\"\n fstab[name] = {\n 'device' => use_labels ? \"LABEL=#{partconf['label']}\" : partition,\n }\n fstab_fields.each do |field|\n fstab[name][field] = partconf[field]\n end\n end\n # rubocop:enable Lint/ShadowingOuterLocalVariable\n end\n @arrays.each do |array, arrayconf|\n next if arrayconf['_skip'] || arrayconf['_no_mount']\n\n name = \"storage_#{array}\"\n if use_labels\n device = \"LABEL=#{arrayconf['label']}\"\n elsif arrayconf['raid_level'] == 'hybrid_xfs'\n device = arrayconf['journal']\n else\n device = array\n end\n fstab[name] = {\n 'device' => device,\n }\n fstab_fields.each do |field|\n fstab[name][field] = arrayconf[field]\n end\n if arrayconf['raid_level'] == 'hybrid_xfs'\n if node['fb_storage']['hybrid_xfs_use_helper']\n fstab[name]['type'] = 'rtxfs'\n else\n # point the XFS filesystem to it's data device (rtdev)\n fstab[name]['opts'] << \",rtdev=#{arrayconf['members'].first}\"\n end\n end\n end\n fstab\n end", "def format_filesystem(system_arch, device)\n fs_type = system_arch == \"x86_64\" ? \"XFS\" : \"ext4\"\n puts \"Formatting #{fs_type} filesystem on #{device} ...\"\n\n command = case system_arch\n when \"x86_64\" then \"/sbin/mkfs.xfs -f #{device}\"\n else \"/sbin/mkfs.ext4 -F #{device}\"\n end\n IO.popen(command) do |f|\n while ! f.eof\n puts f.gets\n end\n end\n end", "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 device_of_mount(m)\n unless Pathname.new(m).mountpoint?\n Chef::Log.warn(\n \"#{m} is not a mount point - I can't determine its device.\",\n )\n return nil\n end\n node['filesystem2']['by_pair'].to_hash.each do |pair, info|\n # we skip fake filesystems 'rootfs', etc.\n next unless pair.start_with?('/')\n # is this our FS?\n next unless pair.end_with?(\",#{m}\")\n # make sure this isn't some fake entry\n next unless info['kb_size']\n return info['device']\n end\n Chef::Log.warn(\n \"#{m} shows as valid mountpoint, but Ohai can't find it.\",\n )\n return nil\n end", "def filesystem\n platform_service(:filesystem)\n end", "def device_of_mount(m)\n fs = self.filesystem_data\n unless Pathname.new(m).mountpoint?\n Chef::Log.warn(\n \"fb_helpers: #{m} is not a mount point - I can't determine its \" +\n 'device.',\n )\n return nil\n end\n unless fs && fs['by_pair']\n Chef::Log.warn(\n 'fb_helpers: no filesystem data so no node.device_of_mount',\n )\n return nil\n end\n fs['by_pair'].to_hash.each do |pair, info|\n # we skip fake filesystems 'rootfs', etc.\n next unless pair.start_with?('/')\n # is this our FS?\n next unless pair.end_with?(\",#{m}\")\n # make sure this isn't some fake entry\n next unless info['kb_size']\n\n return info['device']\n end\n Chef::Log.warn(\n \"fb_helpers: #{m} shows as valid mountpoint, but Ohai can't find it.\",\n )\n nil\n end", "def filesystem_data\n self['filesystem2'] || self['filesystem']\n end", "def is_mounted?(device)\n system(\"grep -q '#{device}' /proc/mounts\")\nend", "def bindfs_fuse_loaded(machine)\n machine.guest.capability(:bindfs_fuse_installed)\n end", "def get_current_devices(output)\n lines = output.split(\"\\n\")\n partitions = lines.drop(2).map do |line|\n line.chomp.split.last\n end\n partitions.reject! do |partition|\n partition =~ /^dm-\\d/\n end\n devices = partitions.select do |partition|\n partition =~ /[a-z]$/\n end\n devices.sort!.map! {|device| \"/dev/#{device}\"}\n if devices.empty?\n devices = partitions.select do |partition|\n partition =~ /[0-9]$/\n end.sort.map {|device| \"/dev/#{device}\"}\n end\n devices\n end", "def forks\n `vmstat -f`.split.first\n end", "def mount_files\n Dir.glob('proc/*', base: mountpoint)\n end", "def statfs(ctx,path)\n return wrap_context(ctx,__method__,path) if ctx\n block_size = 1024\n\n stats = @root.statistics(path)\n case stats\n when Array\n used_space, used_files, total_space, total_files = stats\n used_files ||= 0\n used_space ||= 0\n total_files ||= used_files\n total_space ||= used_space\n result = RFuse::StatVfs.new(\n \"bsize\" => block_size,\n \"frsize\" => block_size,\n \"blocks\" => total_space / block_size,\n \"bfree\" => (total_space - used_space)/block_size,\n \"bavail\" => (total_space - used_space)/block_size,\n \"files\" => total_files,\n \"ffree\" => (total_files - used_files)\n )\n return result\n else\n #expected to quack like rfuse:statvfs\n return stats\n end\n end", "def list_nix_partitions # nelsongs\n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"83\") print $1;else {if ($5==\"83\") print $1}}'`.chomp.split\nend", "def get_fs_type(device)\n fs_check = Mixlib::ShellOut.new(\"blkid -c /dev/null #{device}\")\n fs_check.run_command\n match = fs_check.stdout.match(/TYPE=\\\"(.*)\\\"/)\n match = '' if match.nil?\n\n match[1]\nend", "def info\n info = Hash.new\n output = @filer.invoke(\"system-get-info\")\n if(output.results_errno() != 0)\n r = output.results_reason()\n raise \"Failed : \\n\" + r\n else \n output.children_get[0].children_get.each do |naelem|\n info[naelem.name] = naelem.content\n end\n end\n info\n end", "def getservedvolumes\n # only support Linux for now\n return {} unless Facter['kernel'] && Facter['kernel'].value == 'Linux'\n\n # Don't do anything if exports file is not there\n return {} if !File.exists?(\"/etc/exports\")\n\n served = {}\n\n IO.foreach(\"/etc/exports\") do |line|\n if line =~ /(\\S+)\\s+/\n vol = $1\n served[\"volumes[served][#{vol}][config]\"] = \"/etc/exports\"\n served[\"volumes[served][#{vol}][type]\"] = 'nfs'\n end\n end\n return served\n end", "def stat(path = nil, mode = StatNormal)\n\n # Find entry, and return. Dead simple :-p.\n path = Path.new(path) unless path.kind_of?(Path)\n mmap, cmap = dir_walk(path, mode == StatStrict ? DW_Fail : DW_Nil)\n [mmap, cmap, path]\n\n end", "def dir_entries(base_path, path)\n entries = {}\n effective_path = base_path + path\n Dir.foreach(effective_path) do |fname|\n next if fname == '.' || fname == '..' || filter_fname(path + fname)\n entries[fname] = File.ftype(effective_path + fname).to_sym\n end\n entries\n end", "def disk_summary(flags=\"\")\n output = `vmstat #{flags}` \n keys = output.split(/\\d/).compact.join.split(\"\\n\").map(&:strip) \n keys.map(&:downcase).map {|s| \n s.gsub(\" \", \"_\")}.map {|s| \n s.gsub(\"-\", \"_\")}.map {|s|}.map(&:to_sym)\n end", "def GetMountPoints\n mountPoints = {}\n swapPoints = []\n tg = GetTargetMap()\n Builtins.foreach(tg) do |targetdevice, target|\n partitions = Ops.get_list(target, \"partitions\", [])\n Builtins.foreach(partitions) do |partition|\n partitionName = Ops.get_string(partition, \"device\", \"\")\n mountPoint = Ops.get_string(partition, \"mount\", \"\")\n fsid = Ops.get_integer(partition, \"fsid\", 0)\n if mountPoint != \"\"\n raid_type = \"\"\n if Ops.get_symbol(partition, \"type\", :undefined) == :sw_raid\n raid_type = Ops.get_string(partition, \"raid_type\", \"\")\n end\n # partition has a mount point\n if mountPoint == \"swap\"\n swapPoints = Builtins.add(\n swapPoints,\n [partitionName, fsid, targetdevice, raid_type]\n )\n else\n mountPoints = Builtins.add(\n mountPoints,\n mountPoint,\n [partitionName, fsid, targetdevice, raid_type]\n )\n end\n end\n end\n end\n if Ops.greater_than(Builtins.size(swapPoints), 0)\n mountPoints = Builtins.add(mountPoints, \"swap\", swapPoints)\n end\n if !Stage.initial\n cm = Builtins.filter(Partitions.CurMounted) do |e|\n Builtins.search(Ops.get_string(e, \"spec\", \"\"), \"/dev/\") == 0\n end\n Builtins.foreach(cm) do |e|\n if !Builtins.haskey(mountPoints, Ops.get_string(e, \"file\", \"\"))\n p = GetPartition(tg, Ops.get_string(e, \"spec\", \"\"))\n if Ops.greater_than(Builtins.size(p), 0)\n raid_type = \"\"\n if Ops.get_symbol(p, \"type\", :undefined) == :sw_raid\n raid_type = Ops.get_string(p, \"raid_type\", \"\")\n end\n d = GetDiskPartition(Ops.get_string(e, \"spec\", \"\"))\n Ops.set(\n mountPoints,\n Ops.get_string(e, \"file\", \"\"),\n [\n Ops.get_string(p, \"device\", \"\"),\n Ops.get_integer(p, \"fsid\", 0),\n Ops.get_string(d, \"disk\", \"\"),\n raid_type\n ]\n )\n end\n end\n end\n end\n Builtins.y2milestone(\"ret %1\", mountPoints)\n deep_copy(mountPoints)\n end", "def selected_fs(view)\n fs = []\n view.selected_each do |iconview, path|\n iter = view.model.get_iter(path)\n if iter.get_value(COL_TYPE) == \"local\"\n fs << iter.get_value(COL_PATH) + File::SEPARATOR + iter.get_value(COL_DISPLAY_NAME)\n else\n fs << iter.get_value(COL_PATH) + \"\\\\\" + iter.get_value(COL_DISPLAY_NAME)\n end\n end\n fs.select { |x| x != nil }\n end", "def info\n Plist::parse_xml(diskutil 'info', '-plist', @dev_node)\n end", "def fs_value(p, val)\n key = case val\n when 'size'\n 'kb_size'\n when 'used'\n 'kb_used'\n when 'available'\n 'kb_available'\n when 'percent'\n 'percent_used'\n else\n fail \"fb_helpers: Unknown FS val #{val} for node.fs_value\"\n end\n fs = self.filesystem_data\n # Some things like /dev/root and rootfs have same mount point...\n if fs && fs['by_mountpoint'] && fs['by_mountpoint'][p] &&\n fs['by_mountpoint'][p][key]\n return fs['by_mountpoint'][p][key].to_f\n end\n\n Chef::Log.warn(\n \"fb_helpers: Tried to get filesystem information for '#{p}', but it \" +\n 'is not a recognized filesystem, or does not have the requested info.',\n )\n nil\n end", "def file_system(op, path)\n path = @mudlib_path + path\n if op == :ls\n return Dir.entries(path)\n elsif op == :cat\n if File.file?(path)\n\treturn File.read(path)\n else\n\treturn \"File not found\"\n end\n end\n end", "def FindPartitionInFstab(fstab, mountpoint)\n if Builtins.substring(\n mountpoint,\n Ops.subtract(Builtins.size(mountpoint), 1),\n 1\n ) == \"/\"\n mountpoint = Builtins.substring(\n mountpoint,\n 0,\n Ops.subtract(Builtins.size(mountpoint), 1)\n )\n end\n\n tmp = Builtins.filter(fstab.value) do |entry|\n Ops.get_string(entry, \"file\", \"\") == mountpoint ||\n Ops.get_string(entry, \"file\", \"\") == Ops.add(mountpoint, \"/\")\n end\n\n return nil if Builtins.size(tmp) == 0\n\n Ops.get_string(tmp, [0, \"spec\"], \"\")\n end", "def fetch_mounted_nfs_shares\n if resource[:nfs_hostname]\n # Get list of all mounted NFS datastores, and add it to mounted NFS shares\n Puppet.debug(\"Getting list of mounted NFS datastores...\")\n host.esxcli.storage.nfs.list.each do |nfs_store|\n if nfs_store[:Host] && nfs_store[:Share] && nfs_store[:Mounted]\n key = nfs_store[:Host] + \":\" + nfs_store[:Share]\n @mounted_nfs_shares[key] = { :volume_name => nfs_store[:VolumeName], :new_mount => false }\n Puppet.debug(\"Found existing NFS mount #{key} on the ESX host\")\n end\n end\n end\n end", "def keys\n @disk.keys\n end", "def disk_all(cfg)\n ignored = cfg['ignore_fs'] || 'tmpfs'\n ignore_fs = \"fstype!~\\\"#{ignored}\\\"\"\n query = @client.percent_query_free(\n \"node_filesystem_files{#{ignore_fs}}\",\n \"node_filesystem_files_free{#{ignore_fs}}\"\n )\n prepare_metrics('disk_all', @client.query(query))\n end", "def autodiscover_devices\n logger.debug 'Discovering information about storage subsystem (HDD and MD devices)'\n @storage_information = HddAutodiscover.new(STORAGE_CONFIG[:volume_name])\n collected = @storage_information.collect()\n\n assert [:storage, :free_space, collected[:lvm][:free]]\n collected[:hdd].each do |hdd|\n assert [:hdd, hdd.device, :sn, hdd.sn]\n assert [:hdd, hdd.device, :temperature, hdd.temperature]\n assert [:hdd, hdd.device, :health, hdd.health]\n end\n end", "def mountpoint\n 'dev/.osctl-mount-helper'\n end", "def system_lists\n cmds = [ ['gem list', 'gems'], ['port installed','ports'], ['ls ~/apps', 'apps.ls'],\n ['find /mnt/m', 'm.find'], ['find ~/Music/mine', 'music.find'], ['find ~/Pictures',\n 'pictures.find'], ['find ~/misc', 'misc.find']\n ]\n cmds.each do |shell_cmd, file|\n cmd = \"#{shell_cmd} > #{File.join('~/backup/lists', file)}\"\n system cmd\n end\n end", "def disks\n \tbs = {}\n\tnoko_details.xpath('/domain/devices/disk').map do |ddsk|\n\t next if ddsk.xpath('@device').text != \"disk\"\n\t next if ddsk.xpath('@snapshot').text == \"external\"\n\t sf = ddsk.xpath('source/@dev','source/@file').text\n\t td = ddsk.xpath('target/@dev').text\n\t bs[td] = sf\n\tend\n\tbs\n end", "def linux_processes\n\t\tlist = []\n\t\t::Dir[\"/proc/*/stat\"].select { |file| file =~ /\\/proc\\/\\d+\\// }.each do |file|\n\t\t\tbegin\n\t\t\t\tlist << read_proc_file(file)\n\t\t\trescue\n\t\t\t\t# process died between the dir listing and accessing the file\n\t\t\tend\n\t\tend\n\t\tlist\n\tend", "def linux_processes\n\t\tlist = []\n\t\t::Dir[\"/proc/*/stat\"].select { |file| file =~ /\\/proc\\/\\d+\\// }.each do |file|\n\t\t\tbegin\n\t\t\t\tlist << read_proc_file(file)\n\t\t\trescue\n\t\t\t\t# process died between the dir listing and accessing the file\n\t\t\tend\n\t\tend\n\t\tlist\n\tend", "def get_storage_names\n # This gets all the non view tables, but has to strip column 0 out of the two column response.\n select(\"SHOW FULL TABLES FROM #{options[:path][1..-1]} WHERE Table_type = 'BASE TABLE'\").map { |item| item.first }\n end", "def df( opts = {} )\r\n \r\n outf = {:format => 'text' } if opts[:format] == :text\r\n args = { :detail => true } if opts[:size_div]\r\n \r\n got = @ndev.rpc.get_system_storage( args, outf )\r\n \r\n return got.text if opts[:format] == :text\r\n return got if opts[:format] == :xml\r\n \r\n df_h = {}\r\n ### need to turn this into a Hash\r\n got.xpath('filesystem').each do |fs|\r\n fs_name = fs.xpath('filesystem-name').text.strip\r\n fs_h = {}\r\n df_h[fs_name] = fs_h\r\n \r\n fs_h[:mounted_on] = fs.xpath('mounted-on').text.strip \r\n datum = fs.xpath('total-blocks')\r\n fs_h[:total_blocks] = datum.text.to_i\r\n fs_h[:total_size] = datum.attribute('format').value\r\n \r\n datum = fs.xpath('used-blocks')\r\n fs_h[:used_blocks] = datum.text.to_i\r\n fs_h[:used_size] = datum.attribute('format').value\r\n fs_h[:used_percent] = fs.xpath('used-percent').text.to_i\r\n \r\n datum = fs.xpath('available-blocks')\r\n fs_h[:avail_blocks] = datum.text.to_i\r\n fs_h[:avail_size] = datum.attribute('format').value\r\n if opts[:size_div]\r\n fs_h[:total_size] = fs_h[:total_size].to_i / opts[:size_div]\r\n fs_h[:used_size] = fs_h[:used_size].to_i / opts[:size_div]\r\n fs_h[:avail_size] = fs_h[:avail_size].to_i / opts[:size_div]\r\n end\r\n end\r\n df_h\r\n end", "def root_fs\n\t\t\t\tfind_root[2].to_s\n\t\t\tend", "def full_entries(dirname=mpwd)\n simple_entries(dirname).map {|e| File.join(dirname,e) }\n end", "def disk_specs(path)\n specs = []\n unit = 0\n if resource[:virtual_disks]\n resource[:virtual_disks].each do |vd|\n size = vd[\"size\"].to_i * 1024 * 1024\n specs << disk_spec(path, size, unit)\n unit += 1\n end\n else\n specs << disk_spec(path, resource[:disk_size], unit)\n end\n\n specs\n end", "def read_fstab_and_cryptotab(fstab, crtab, root_device_current)\n default_scr = WFM.SCRGetDefault\n new_scr = nil\n @backward_translation = {}\n\n if Stage.initial\n fstab_ref = arg_ref(fstab.value)\n readFsTab(fstab_ref)\n fstab.value = fstab_ref.value\n crtab_ref = arg_ref(crtab.value)\n readCryptoTab(crtab_ref)\n crtab.value = crtab_ref.value\n else\n fstab.value = Convert.convert(\n SCR.Read(path(\".etc.fstab\")),\n :from => \"any\",\n :to => \"list <map>\"\n )\n crtab.value = Convert.convert(\n SCR.Read(path(\".etc.cryptotab\")),\n :from => \"any\",\n :to => \"list <map>\"\n )\n end\n\n fstab_has_separate_var = (\n fstab_ref = arg_ref(fstab.value);\n _FstabHasSeparateVar_result = FstabHasSeparateVar(fstab_ref);\n fstab.value = fstab_ref.value;\n _FstabHasSeparateVar_result\n )\n # mount /var\n if fstab_has_separate_var\n Builtins.y2warning(\"Separate /var partition!\")\n MountVarIfRequired(fstab.value, root_device_current, false)\n else\n Builtins.y2milestone(\"No separate /var partition found\")\n end\n\n Builtins.y2milestone(\"fstab: %1\", fstab.value)\n fstab.value = TranslateFsOrCryptoTab(fstab.value, \"spec\", \"spec_old\")\n Builtins.y2milestone(\"fstab: (translated) %1\", fstab.value)\n\n Builtins.y2milestone(\"crtab: %1\", crtab.value)\n crtab.value = TranslateFsOrCryptoTab(crtab.value, \"file\", \"file_old\")\n Builtins.y2milestone(\"crtab: (translated) %1\", crtab.value)\n\n # umount /var\n if fstab_has_separate_var\n SCR.Execute(\n path(\".target.umount\"),\n Ops.add(Installation.destdir, \"/var\")\n )\n @activated = Builtins.remove(@activated, 0)\n end\n\n true\n end", "def getDataEntries(fBuf, rsc_id = nil)\n result = {}\n getBaseResDir(fBuf) { |baseResDir| dumpResourceDirectory(baseResDir, 0, result, rsc_id) }\n result\n end", "def lsblk_path(p)\n return unless !p['path'] && p['name']\n\n if File.exist?(\"/dev/#{p['name']}\")\n p['path'] = \"/dev/#{p['name']}\"\n elsif File.exist?(\"/dev/mapper/#{p['name']}\")\n p['path'] = \"/dev/mapper/#{p['name']}\"\n end\n end", "def setup_device_for_mount\n # use ramdisk for creating a test device for mount.\n # This can cleaner if we have chef resource/provider for ramdisk.\n case ohai[:platform_family]\n when \"aix\"\n # On AIX, we can't create a ramdisk inside a WPAR, so we use\n # a \"namefs\" mount against / to test\n # https://www-304.ibm.com/support/knowledgecenter/ssw_aix_71/com.ibm.aix.performance/namefs_file_sys.htm\n device = \"/\"\n fstype = \"namefs\"\n when \"debian\", \"rhel\", \"amazon\"\n device = \"/dev/ram1\"\n unless File.exist?(device)\n shell_out(\"mknod -m 660 #{device} b 1 0\")\n shell_out(\"chown root:disk #{device}\")\n end\n shell_out(\"ls -1 /dev/ram*\").stdout.each_line do |d|\n if shell_out(\"mount | grep #{d}\").exitstatus == \"1\"\n # this device is not mounted, so use it.\n device = d\n break\n end\n end\n fstype = \"tmpfs\"\n shell_out!(\"mkfs -q #{device} 512\")\n when \"solaris2\"\n device = \"swap\"\n fstype = \"tmpfs\"\n else\n end\n [device, fstype]\n end", "def list_swap_partitions_with_type_and_size # nelsongs\n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"82\") print $1\":\"$5\":\"$6;else {if ($5==\"82\") print $1\":\"$4\":\"$5}}' | sed s/+//g`.chomp.split\nend", "def file_info(path)\n if manifest_entry # have we loaded our manifest yet? if so, use that sucker\n result = [manifest_entry[path], manifest_entry.flags[path]]\n if result[0].nil?\n return [NULL_ID, '']\n else\n return result\n end\n end\n if manifest_delta || files[path] # check if it's in the delta... i dunno\n if manifest_delta[path]\n return [manifest_delta[path], manifest_delta.flags[path]]\n end\n end\n # Give us, just look it up the long way in the manifest. not fun. slow.\n node, flag = @repo.manifest.find(raw_changeset[0], path)\n if node.nil?\n return [NULL_ID, '']\n end\n return [node, flag]\n end", "def backing_store\n \tbs = {}\n\tnoko_details.xpath('/domainsnapshot/domain/devices/disk').map do |ddsk|\n\t next if ddsk.xpath('@device').text != \"disk\"\n\t next if ddsk.xpath('@snapshot').text == \"external\"\n\t sf = ddsk.xpath('source/@file').text\n\t td = ddsk.xpath('target/@dev').text\n\t bs[td] = sf\n\tend\n\tbs\n end", "def get_device_mount_point( incoming_path )\n mount_lines = `mount`\n raise EBSRemoteExecException.new(nil,$?,mount_lines) if $? != 0\n path = File.ftype(incoming_path) != 'directory'? File.dirname(incoming_path) : incoming_path\n device=nil\n longest = \"\"\n mount_lines.each_line {|line|\n match = line =~ /(.+)\\son\\s(.+?)\\s.*/\n candidate = $2.strip\n candidate_device = $1.strip\n # Keep the longest prefix matching\n if match && path =~ /^#{candidate}/ && candidate.length > longest.length\n longest = candidate\n device = candidate_device\n end\n }\n unless device\n STDERR.puts \"Couldn't find the device for mount point #{path}\"\n Kernel.exit(-1)\n end\n device\n end", "def list\n factory.system.list(@path).collect do |item|\n candidate = dir(item)\n if (not candidate.exists?)\n candidate = file(item)\n end\n candidate\n end\n end", "def get_sysinfo\n\t\tsystem_data = {}\n\t\tkernel_version = cmd_exec(\"uname -a\")\n\t\tversion = read_file(\"/etc/release\").split(\"\\n\")[0].strip\n\t\tsystem_data[:version] = version\n\t\tsystem_data[:kernel] = kernel_version\n\t\tsystem_data[:hostname] = kernel_version.split(\" \")[1]\n\t\treturn system_data\n\tend", "def add_entry_to_filesystem_table(host, mount_name)\n fs_file = filesystem_file(host)\n fs_type = filesystem_type(host)\n\n case host['platform']\n when %r{aix}\n # NOTE: /dev/hd8 is the default jfs logging device on AIX.\n on(host, \"echo '/#{mount_name}:\\n dev = /dev/#{mount_name}\\n vfs = #{fs_type}\\n log = /dev/hd8' >> #{fs_file}\")\n when %r{el-|centos|fedora|sles|debian|ubuntu}\n # Correctly munge whitespaces in mountpoints\n munged_mount_name = mount_name.gsub(' ', '\\\\\\040')\n on(host, \"echo '/tmp/#{munged_mount_name} /#{munged_mount_name} #{fs_type} loop 0 0' >> #{fs_file}\")\n else\n # TODO: Add Solaris and OSX support, as per PUP-5201 and PUP-4823\n fail_test(\"Adding entries to the filesystem table on #{host['platform']} is not currently supported.\")\n end\n end", "def dev_stat\n begin\n @dev_stat ||= Sys::Filesystem.stat dev_path\n rescue SystemCallError\n @dev_stat = nil\n end\n end", "def provider_readdir(dirname, recursive=true, allowed_types = [:regular, :directory]) #:nodoc:\n\n dirname = Pathname.new(dirname)\n allowed_types = Array(allowed_types)\n\n list = []\n\n # Syscall caches\n uid_to_owner = {}\n gid_to_group = {}\n\n # Call the datalad repository method to get the short\n # reports about each entry\n DataladRepository.list_contents_from_dataset(dirname,recursive).each do |fname|\n\n # There are only three attributes in the reports\n name = fname[:name] # relative path, e.g. \"a/b/c.txt\"\n size = fname[:size_in_bytes]\n type = fname[:type]\n\n dl_full_path = dirname.join(name)\n\n # fix type\n type = :regular if type == :file || type == :gitannexlink\n\n next unless allowed_types.include? type\n next if is_excluded?(name)\n\n # get stat with lstat\n stat = File.lstat(dl_full_path)\n\n # Look up user name from uid\n uid = stat.uid\n owner_name = (uid_to_owner[uid] ||= (Etc.getpwuid(uid).name rescue uid.to_s))\n\n # Lookup group name from gid\n gid = stat.gid\n group_name = (gid_to_group[gid] ||= (Etc.getgrgid(gid).name rescue gid.to_s))\n\n # Create a FileInfo\n fileinfo = FileInfo.new\n\n # From Datalad\n fileinfo.name = name\n fileinfo.symbolic_type = type\n fileinfo.size = size\n\n # From lstat():\n fileinfo.permissions = stat.mode\n fileinfo.atime = stat.atime\n fileinfo.ctime = stat.ctime\n fileinfo.mtime = stat.mtime\n fileinfo.uid = uid\n fileinfo.owner = owner_name\n fileinfo.gid = gid\n fileinfo.group = group_name\n\n list << fileinfo\n end\n\n list.sort! { |a,b| a.name <=> b.name }\n list\n end", "def read\n\n\t\t\t# initialise an array with zeroes\n\n\t\t\tret =\n\t\t\t\t(0...(COLS.size)).map { 0 }\n\n\t\t\t# iterate lines from the diskstats file\n\n\t\t\tFile.new(\"/proc/diskstats\").each \\\n\t\t\t\tdo |line|\n\n\t\t\t\t\t# split columns\n\n\t\t\t\t\tcols =\n\t\t\t\t\t\tline.strip.split /\\s+/\n\n\t\t\t\t\t# ignore irrelevant lines\n\n\t\t\t\t\tnext \\\n\t\t\t\t\t\tunless @disk == \"all\" \\\n\t\t\t\t\t\t\t|| cols[2] == @disk\n\n\t\t\t\t\t# add this lines data to the totals\n\n\t\t\t\t\t(0...(COLS.size)).each do |i|\n\n\t\t\t\t\t\tret[i] +=\n\t\t\t\t\t\t\tcols[i + 3].to_i\n\n\t\t\t\t\tend\n\n\t\t\t\tend\n\n\t\t\t# and return\n\n\t\t\treturn ret\n\n\t\tend", "def file_get_initialization(structure = ENV[\"HOME\"]) # this is linux specific for now\n @file_information = {} # {\"/directory\"=>[\"file\"], \"/directory/directory\"=>[\"file\", \"file\"]\n files = [] \n directory = \"\"\n directories = [] \n things = structure.split('/')\n things.each do |thing|\n if thing == \"\"\n directories.push(\"/root\")\n else\n directory = \"#{directory}/#{thing}\" \n @current_directory = directory\n directories.push(\"#{directory}\") if File.directory?(\"#{directory}\")\n end\n end \n return directories\n end", "def list_kvms\n info = Hash[\n *Dir.glob(File.join(KVM_HOME, 'storage', '*.qcow2')).map{|dir|\n key = File.basename(dir).sub('.qcow2', '')\n [key, {:address => kvm_ip(key), :type => kvm_type(key)}]\n }.sort{|a,b|\n a.first <=> b.first\n }.flatten\n ]\n info.each do |name, info|\n puts \"#{name}\"\n puts \" Type: #{info[:type]}\"\n puts \" Address: #{info[:address]}\"\n end\nend", "def DetectFs(device)\n ret = :unknown\n Builtins.y2milestone(\"DetectFs:%1\", device)\n vinfo = ::Storage::VolumeInfo.new()\n r = @sint.getVolume(device, vinfo)\n if r != 0\n Builtins.y2error(\"DetectFs device:%1 not found (ret:%2)\", device, r)\n else\n curr = {}\n curr = volumeMap(vinfo, curr)\n ret = Ops.get_symbol(curr, \"detected_fs\", :unknown)\n end\n Builtins.y2milestone(\"DetectFs ret %1\", ret)\n ret\n end", "def get_local_storage\n storage = {:hostname => Socket.gethostname, :mounts => [], :vgs => []}\n\n LVM::LVM.new({:command => \"/usr/bin/sudo /sbin/lvm\"}) do |lvm|\n lvm.volume_groups.each do |vg|\n vg.logical_volumes.each do |lv|\n mnt = get_mount(lv.name)\n fs = {:mount => mnt.mount_point, :fs => mnt.name, :lv => lv.name, :vg => vg.name}\n storage[:mounts] << fs\n end\n\n volg = {:vg => vg.name, :pvs => []}\n vg.physical_volumes.each do |pv|\n volg[:pvs] << {:pv => pv.name}\n end\n storage[:vgs] << volg\n end\n end\n storage\n end", "def get_mount_path(filepath)\n cmd_exec(\"df \\\"#{filepath}\\\" | tail -1\").split(' ')[0]\n rescue\n raise \"Unable to get mount path of #{filepath}\"\n end", "def fs_for_select(selected)\n fs_values = [\n \"ext3\",\n \"ext4\",\n \"xfs\",\n \"btrfs\"\n ]\n options_for_select(\n fs_values.zip(fs_values),\n selected.to_s\n )\n end", "def get_sysinfo\n\t\tsystem_data = {}\n\t\tetc_files = cmd_exec(\"ls /etc\").split()\n\n\t\tkernel_version = cmd_exec(\"uname -a\")\n\t\tsystem_data[:kernel] = kernel_version\n\n\t\t# Debian\n\t\tif etc_files.include?(\"debian_version\")\n\t\t\tif kernel_version =~ /Ubuntu/\n\t\t\t\tversion = read_file(\"/etc/issue\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\t\tsystem_data[:distro] = \"ubuntu\"\n\t\t\t\tsystem_data[:version] = version\n\t\t\telse\n\t\t\t\tversion = read_file(\"/etc/issue\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\t\tsystem_data[:distro] = \"debian\"\n\t\t\t\tsystem_data[:version] = version\n\t\t\tend\n\n\t\t# Amazon\n\t\telsif etc_files.include?(\"system-release\")\n\t\t\tversion = read_file(\"/etc/system-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"amazon\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Fedora\n\t\telsif etc_files.include?(\"fedora-release\")\n\t\t\tversion = read_file(\"/etc/fedora-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"fedora\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Oracle Linux\n\t\telsif etc_files.include?(\"enterprise-release\")\n\t\t\tversion = read_file(\"/etc/enterprise-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"oracle\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# RedHat\n\t\telsif etc_files.include?(\"redhat-release\")\n\t\t\tversion = read_file(\"/etc/redhat-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"redhat\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Arch\n\t\telsif etc_files.include?(\"arch-release\")\n\t\t\tversion = read_file(\"/etc/arch-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"arch\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Slackware\n\t\telsif etc_files.include?(\"slackware-version\")\n\t\t\tversion = read_file(\"/etc/slackware-version\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"slackware\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Mandrake\n\t\telsif etc_files.include?(\"mandrake-release\")\n\t\t\tversion = read_file(\"/etc/mandrake-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"mandrake\"\n\t\t\tsystem_data[:version] = version\n\n\t\t#SuSE\n\t\telsif etc_files.include?(\"SuSE-release\")\n\t\t\tversion = read_file(\"/etc/SuSE-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"suse\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Gentoo\n\t\telsif etc_files.include?(\"gentoo-release\")\n\t\t\tversion = read_file(\"/etc/gentoo-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"gentoo\"\n\t\t\tsystem_data[:version] = version\n\t\telse\n\n\t\t\t# Others\n\t\t\tversion = read_file(\"/etc/issue\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"linux\"\n\t\t\tsystem_data[:version] = version\n\t\tend\n\t\treturn system_data\n\tend", "def ls\n table Dir.entries( Dir.pwd ).reject { |f| f.match /^\\..*$/ }\n end", "def list_swap_partitions_with_size # nelsongs\n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"82\") print $1\":\"$5;else {if ($5==\"82\") print $1\":\"$4}}' | sed s/+//g`.chomp.split\nend", "def ls\n Dir.entries(@working_dir)\n end", "def [] file\n code = `xattr -p com.apple.FinderInfo #{file.shellescape} 2>&1`.split(/\\s+/m)\n if code.size == 32\n code\n else\n ['00']*32\n end\n end", "def list_fs_files\n all_files = []\n current_user_role_names.each do |role_name|\n next unless Filesystem.test_dir role_name, self, :read\n\n p = path_for role_name: role_name\n # Don't use Regex - it breaks if there are special characters\n paths = Dir.glob(\"#{p}/**/*\").reject do |f|\n Pathname.new(f).directory?\n end\n\n all_files += paths.map { |f| f.sub(\"#{p}/\", '').sub(p, '') }\n end\n\n all_files.uniq\n end", "def beaker_stat(host, path)\n ruby = ruby_command(host)\n owner = on(host,\n \"#{ruby} -e 'require \\\"etc\\\"; puts (Etc.getpwuid(File.stat(\\\"#{path}\\\").uid).name)'\").stdout.chomp\n group = on(host,\n \"#{ruby} -e 'require \\\"etc\\\"; puts (Etc.getgrgid(File.stat(\\\"#{path}\\\").gid).name)'\").stdout.chomp\n mode = on(host, \"#{ruby} -e 'puts (File.stat(\\\"#{path}\\\").mode & 0777).to_s(8)'\").stdout.chomp.to_i\n\n [owner, group, mode]\n end" ]
[ "0.81046075", "0.6686974", "0.6630306", "0.660275", "0.65633863", "0.6548901", "0.65109235", "0.64918053", "0.63250965", "0.6243402", "0.6198823", "0.6193169", "0.617897", "0.6118589", "0.61134255", "0.60924166", "0.60812926", "0.60573554", "0.6041964", "0.6037892", "0.5967328", "0.59333116", "0.5933292", "0.5897031", "0.5889541", "0.5820679", "0.5812687", "0.5808684", "0.5802759", "0.5792173", "0.5790775", "0.5756962", "0.5735928", "0.5734384", "0.5729502", "0.5725983", "0.56957185", "0.56424403", "0.56395686", "0.5555419", "0.55410075", "0.55364764", "0.5529517", "0.549856", "0.5492963", "0.5472653", "0.5462825", "0.5455657", "0.5448005", "0.5437611", "0.5420655", "0.541667", "0.5403219", "0.5390755", "0.5378535", "0.5363459", "0.53528315", "0.5321839", "0.53145295", "0.5311569", "0.530671", "0.5305445", "0.5303319", "0.5301504", "0.5286649", "0.5281124", "0.5271567", "0.5271567", "0.5270001", "0.5264479", "0.5243602", "0.5239958", "0.52305996", "0.5220961", "0.52196896", "0.52141786", "0.5204097", "0.5198268", "0.51863354", "0.5173335", "0.5167559", "0.51667994", "0.5165187", "0.51599705", "0.51590484", "0.5141195", "0.5131351", "0.51309425", "0.513071", "0.5124461", "0.51120853", "0.50998294", "0.5091782", "0.5081654", "0.5076121", "0.5070066", "0.5056293", "0.5053653", "0.5052284", "0.50493443" ]
0.51574713
85
a = a | b
def union(b) @pages.update b.pages self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bitSetOr (a,b)\n\t\tresult = Array.new\n\t\tfor i in 0...(a.size)\n\t\t\tresult[i] = a[i] || b[i]\n\t\tend\n\t\treturn result\n\tend", "def |(other)\n\t\tself.class.new(value | other)\n\tend", "def xor(a,b)\n (a | b) - (a & b)\n end", "def &(other)\n false\n end", "def |(other)\n return self.class.new(super.|(other)) \n end", "def union(a,b)\n print a | b # union([1,2,3],[2,3,4]) => [1, 2, 3, 4] \nend", "def bitwise_or(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif val == '1' || b[index] == '1'\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend", "def bitwise_exclusive(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif (val == '1' && b[index] == '0') || (val == '0' && b[index] == '1')\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend", "def merge(arr1, arr2)\n arr1 | arr2\nend", "def merge(arr1, arr2)\n arr1 | arr2\nend", "def merge(arr1, arr2)\n arr1 | arr2\nend", "def swap(a,b)\na,b = b,a\nend", "def test(a, b)\n a = b - 1\n b = a + 3\nend", "def mask(a, b)\n a ^ b\n end", "def merge(array1, array2)\n array1 | array2\nend", "def or_(a)\n if ((a).nil?)\n return self\n end\n s = self.clone\n s.or_in_place(a)\n return s\n end", "def |(other)\n self.class.new(values: (to_a | other.to_a))\n end", "def |(other)\n `return other.$r ? Qtrue : Qfalse;`\n end", "def method4(first, second)\n first = first << second\nend", "def |(other)\n other.inject(clone) do |copy, e|\n copy << e\n end\n end", "def swap(a, b)\n\ta,b=b,a\nend", "def exclusive_or (p,q)\n p ^ q\nend", "def xor_a\n end", "def or a, b\n a.prove { yield }\n b.prove { yield }\n end", "def |(p0) end", "def |(p0) end", "def |(p0) end", "def |(p0) end", "def |(p0) end", "def |(p0) end", "def union itemA, itemB\n\tend", "def swap(a,b)\n return b,a\nend", "def swap!(a,b)\n self[a], self[b] = self[b], self[a]\n self\n end", "def |\n a = pop\n b = pop\n push (a == -1) || (b == -1) ? -1 : 0\n end", "def bitSetAnd (a,b)\n\t\tresult = Array.new\n\t\tfor i in 0...(a.size)\n\t\t\tresult[i] = a[i] && b[i]\n\t\tend\n\t\treturn result\n\tend", "def |(arg0)\n end", "def |(arg0)\n end", "def |(arg0)\n end", "def array_or(a,b)\n c = []\n for i in 0...a.length\n if a[i] or b[i]\n c[i] = true\n else\n c[i] = false\n end\n end\n c\nend", "def or_b\n end", "def bitwise_and(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif val == b[index]\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend", "def union(lb)\n\n\n\n\n\n end", "def swap_elements_from_to(array,a,b)\n array[a] = array[a]^array[b]\n array[b] = array[b]^array[a]\n array[a] = array[a]^array[b]\nend", "def swap!(a,b)\n self[a], self[b] = self[b], self[a]\n end", "def xor(argument1, argument2)\n argument1 && !argument2 || !argument1 && argument2\n end", "def &\n a = pop\n b = pop\n push (a == -1) && (b == -1) ? -1 : 0\n end", "def xor_b\n end", "def union(other)\n self.class.from_a(to_a | other.to_a)\n end", "def swap(a, b)\n\ta, b = [b, a]\n\t[a, b]\nend", "def f6; return *['a','b'] &['a','Y','Z'] end", "def execute_OR(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value |= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend", "def |(value)\n value = _arg2int(value)\n value &= self.mask if (bounded?)\n bs = dup\n bs.from_i(value | bs.to_i)\n bs\n end", "def and_b\n end", "def |(other)\n# new_z = self.z unless self.z != other.z\n self.class.new(self.x + other.x, self.y + other.y, self.z)\n end", "def swap!(a,b)\n av = self[a]\n self[a] = self[b]\n self[b] = av\n return self\n end", "def merge(array1, array2)\n # (array1 + array2).uniq\n array1 | array2\nend", "def p1(x, y, z)\n # x or y\n xor(x, y)\nend", "def swap_first_last_characters(a, b)\n a, b = b, a\nend", "def sum_double (a,b)\n\t\n\tif a != b \n\t\treturn a + b \n\tend \n\n\tif a = b \n\t\treturn 2 * (a + b)\n\tend\n\nend", "def execute_XOR(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value ^= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend", "def permutation_one(m1, m2)\n m1.team_a, m2.team_b = m2.team_b, m1.team_a\n end", "def and_ a, b\n self.and a, b\n end", "def &(other)\n self.class.new(values: (to_a & other.to_a))\n end", "def or(argument1, argument2)\n argument1 || argument2\n end", "def demo(a,b)\n\ta = a+2\n\tb = b+ 3\nend", "def []=(i,b)\n b = (b && b!=0) ? 1 : 0\n @v &= ~(1 << i)\n @v |= (b << i)\n b\n end", "def union(other)\n new(to_ary | other.to_ary)\n end", "def compine(a, b)\n\ta.each do |i|\n\t\tb.delete_at(b.index(i)) unless b.index(i) == nil\n\tend\n\treturn a + b\nend", "def non_start(value_a, value_b)\n # value_a[1..-1] + value_b[1..-1]\n value_a[1...value_a.length + 1] + value_b[1..-1]\n end", "def ^ other\n left = uniq\n right = []\n other.uniq.each do |x|\n if left.include? x\n left.delete x\n elsif ! right.include?(x)\n right << x\n end\n end\n left + right\n end", "def ^(other)\n `return other.$r ? Qtrue : Qfalse;`\n end", "def remove_duplicates(list)\n list & list # list | list would work too\nend", "def alpha_blend(other)\n dup.alpha_blend!(other)\n end", "def exclusive_or(num1, num2)\r\n\t# your code here\r\nend", "def union(other)\n self.class.from_a(to_a | other.to_a)\n end", "def &(other)\n\t\tself.class.new(value & other)\n\tend", "def |(other)\n Index.new(to_a | other.to_a)\n end", "def or\n x, y = stack.pop(2)\n push x | y\n end", "def a_plus_abs_b(a, b)\n op = b > 0 ? :+ : :-\n a.send(op, b)\nend", "def execute_AND(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value &= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend", "def |(enum); end", "def swap(one, two)\n if include? one\n exclude one\n add two\n else\n exclude two\n add one\n end\n end", "def and_a\n end", "def &(second)\n @operations << AndOperationsGroup.new(tail_ops!(2))\n self\n end", "def a(b)\nend", "def encode(a, b)\n check_ab_bounds(a, b)\n i = (a << @b_size) ^ b\n interlace(i)\n end", "def ^(other)\n\t\tself.class.new(value ^ other)\n\tend", "def *(other)\n @a=other.a*@a\n @b=other.b*@b\n self.to_s #devuelve el resultado como cadena. la operacion modifica el valor del objeto.\n\n end", "def |(other)\n Or.new(self, other)\n end", "def xor(x, y)\n\nend", "def xor?(a,b)\n if a && !b\n true\n elsif !a && b\n true\n else\n false\n end\nend", "def union(other)\n @bits | bits_from_object(other)\n end", "def iff a,b\n all(a,b) { all(b,a) { yield } }\n end", "def -\n a = pop\n b = pop\n push b - a\n end", "def union! newFA\n end", "def swap(a,b)\n i = self.clone\n av = i[a]\n i[a] = i[b]\n i[b] = av\n return i\n end", "def or(e1, e2)\n eval_ex(e1) | eval_ex(e2)\n end", "def permutation_two(m1, m2)\n m1.team_a, m2.team_a = m2.team_a, m1.team_a\n end", "def xor(a,b)\n if (a == true && b == true) || (a == false && b == false)\n return false\n else\n return true\n end\nend", "def swap!(a, b) self[a], self[b] = self[b], self[a]; self; end", "def reject!(&b)\n a = reject(&b)\n if a.size == size\n nil # no changes, return nil\n else\n replace(a)\n self\n end\n end" ]
[ "0.67818004", "0.6722981", "0.6710898", "0.66848433", "0.6599816", "0.6557163", "0.6551164", "0.6520654", "0.65160024", "0.65160024", "0.65160024", "0.6456418", "0.63838387", "0.6294935", "0.62922597", "0.62276864", "0.6211043", "0.6210711", "0.6205724", "0.6183703", "0.61832815", "0.61694777", "0.61613333", "0.6157077", "0.6147757", "0.6147757", "0.6147757", "0.6147757", "0.6147757", "0.6147757", "0.61237913", "0.6113361", "0.60944283", "0.60896087", "0.6068675", "0.6056732", "0.6056732", "0.6056732", "0.599457", "0.59926325", "0.5984376", "0.59742475", "0.59730375", "0.5966169", "0.59631866", "0.5959602", "0.59403837", "0.5935814", "0.59281874", "0.59230703", "0.5902167", "0.5900343", "0.58778465", "0.5877711", "0.58357614", "0.58179104", "0.58024585", "0.5801774", "0.5798293", "0.5794668", "0.57913816", "0.5790958", "0.579081", "0.57888865", "0.57865465", "0.5762713", "0.5752136", "0.5742327", "0.5738218", "0.57302725", "0.5729407", "0.5728442", "0.57274663", "0.57272744", "0.5727037", "0.57250494", "0.570968", "0.5691178", "0.5680957", "0.5668455", "0.5667099", "0.5658403", "0.5654866", "0.5636896", "0.56367654", "0.5611104", "0.56037956", "0.55849224", "0.558421", "0.5580877", "0.558052", "0.5578644", "0.5577954", "0.5577735", "0.5572914", "0.5566126", "0.556433", "0.5563526", "0.55633223", "0.5560642", "0.55602986" ]
0.0
-1
a = a & b
def intersection(b) @pages.delete_if { |k, v| not b.pages.include?(k) } self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bitSetAnd (a,b)\n\t\tresult = Array.new\n\t\tfor i in 0...(a.size)\n\t\t\tresult[i] = a[i] && b[i]\n\t\tend\n\t\treturn result\n\tend", "def bitwise_and(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif val == b[index]\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend", "def mask(a, b)\n a ^ b\n end", "def xor(a,b)\n (a | b) - (a & b)\n end", "def bitwise_exclusive(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif (val == '1' && b[index] == '0') || (val == '0' && b[index] == '1')\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend", "def bitSetOr (a,b)\n\t\tresult = Array.new\n\t\tfor i in 0...(a.size)\n\t\t\tresult[i] = a[i] || b[i]\n\t\tend\n\t\treturn result\n\tend", "def and_ a, b\n self.and a, b\n end", "def bitnot(b)\n (~b)&1\nend", "def execute_AND(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value &= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend", "def bitwise_or(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif val == '1' || b[index] == '1'\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend", "def carry_out (p,q)\n p & q\nend", "def intersection(a, b)\n negate(union(negate(a), negate(b)))\n end", "def encode(a, b)\n check_ab_bounds(a, b)\n i = (a << @b_size) ^ b\n interlace(i)\n end", "def &(other)\n false\n end", "def &(other)\n self.class.new(values: (to_a & other.to_a))\n end", "def and_b\n end", "def And(a, b)\n return a && b\nend", "def merge(arr1, arr2)\n arr1 | arr2\nend", "def merge(arr1, arr2)\n arr1 | arr2\nend", "def merge(arr1, arr2)\n arr1 | arr2\nend", "def test_difference_one_from_two\n array = []\n array_one = [1,2,3,4,5]\n array_two = [2,5,9]\n array = array_one &! array_two\n assert_equal [1,3,4], array\n end", "def xor?(a,b)\n if a && !b\n true\n elsif !a && b\n true\n else\n false\n end\nend", "def swap_elements_from_to(array,a,b)\n array[a] = array[a]^array[b]\n array[b] = array[b]^array[a]\n array[a] = array[a]^array[b]\nend", "def test_difference_two_from_one\n array = []\n array_one = [1,2,3,4,5]\n array_two = [2,5,9]\n array = array_one &! array_two\n assert_equal [9], array\n end", "def OF_CHECKING(a,b,sum) \n\tAND(XOR(sum,a),NOT(XOR(a,b)))\nend", "def xor?(first, second)\n (first && !second) || (!first && second)\nend", "def remove_duplicates(list)\n list & list # list | list would work too\nend", "def bitwise_and(num1, num2)\n bnum1 = num1.to_s(2)\n bnum2 = num2.to_s(2)\n band = (num1 & num2).to_s(2)\n puts \"num1 = \" + ( ' ' * bnum2.length ) + num1.to_s(2)\n puts \"num2 = \" + ( ' ' * bnum1.length ) + num2.to_s(2)\n puts \"b2& = \" + ( ' ' * ([bnum1.length, bnum2.length].max ) + band)\n # puts \"base 10 & = \" + (num1 & num2).to_s(10)\nend", "def xor(argument1, argument2)\n argument1 && !argument2 || !argument1 && argument2\n end", "def f6; return *['a','b'] &['a','Y','Z'] end", "def xor?(one, two)\n (one && !two) || (two && !one)\nend", "def and_to_a(to_and)\n @a &= to_and\n @f = 0x00\n @f |= H_FLAG\n @f |= Z_FLAG if @a == 0x00\n end", "def xor?(value1, value2)\n (value1 && !value2) || (value2 && !value1)\nend", "def xor?(value1, value2)\n (value1 && !value2) || (value2 && !value1)\nend", "def xor?(value1, value2)\n !!((value1 && !value2) || (value2 && !value1))\nend", "def xor?(this, that)\n (!this && that) || (this && !that)\nend", "def xor?(a, b)\n return true if a && !b\n return true if !a && b\n false\nend", "def exclusive_or (p,q)\n p ^ q\nend", "def intersect(other)\n @bits & bits_from_object(other)\n end", "def intersection(nums1, nums2)\n nums1 & nums2\n end", "def &(other)\n\t\tself.class.new(value & other)\n\tend", "def & other\n if self\n other ? true : false\n else\n false\n end\n end", "def xor?(x, y)\n (x && !y) || (!x && y)\nend", "def and\n x, y = stack.pop(2)\n push x & y\n end", "def xor?(x, y)\n (x || !y) || (y && !x)\nend", "def AND(x,y); \tif x==1 && y==1 \tthen 1 else 0 end; end", "def &(other)\n if self.size < other.size\n return other & self\n end\n\n skip = self.size - other.size\n result = BitField.new(self.size)\n prefix = [0] * skip\n rest = (self.field[skip..-1]).zip(other.field).map do |left, right|\n left & right\n end\n result.field = prefix + rest\n return result\n end", "def and(e1, e2)\n eval_ex(e1) & eval_ex(e2)\n end", "def set?(num, mask)\n (num & mask) != 0\nend", "def merge(array1, array2)\n array1 | array2\nend", "def intersect(xs, ys)\n result = []\n result = xs & ys\n puts result\nend", "def &\n a = pop\n b = pop\n push (a == -1) && (b == -1) ? -1 : 0\n end", "def xor?(arg1, arg2)\r\n (arg1 && !arg2) || (arg2 && !arg1)\r\nend", "def xor?(value1, value2)\n (value1 || value2) && !(value1 && value2)\nend", "def bit_add(a, b)\n\t(7).downto(0).each do |x|\n\tend\nend", "def test_combine_arrays\n array = []\n array_one = [1,2,3,4,5]\n array_two = [2,5,9]\n array = array_one & array_two\n assert_equal [2,5], array\n end", "def xor?(a, b)\n if (a == true && b == false) || (a == false && b == true)\n true\n end\nend", "def a_plus_abs_b(a, b)\n op = b > 0 ? :+ : :-\n a.send(op, b)\nend", "def ampersand(&block)\n block.call\n yield\nend", "def xor(a,b)\n if (a == true && b == true) || (a == false && b == false)\n return false\n else\n return true\n end\nend", "def iff a,b\n all(a,b) { all(b,a) { yield } }\n end", "def xor?(value1, value2)\r\n !!((value1 && !value2) || (value2 && !value1)) # !! forces the return to be a boolean\r\nend", "def -(other)\n self & other.complement\n end", "def xor?(arg1, arg2)\n (arg1 && !arg2) || (arg2 && !arg1) ? true : false\nend", "def xor?(value1, value2)\n return true if value1 && !value2\n return true if value2 && !value1\n false\nend", "def intersections(list_a, list_b)\n list_a & list_b\nend", "def and_a\n end", "def & other\n call_enum \"boolean\", other, :and\n end", "def xor?(bool1, bool2)\n !!bool1 != !!bool2\nend", "def []=(i,b)\n b = (b && b!=0) ? 1 : 0\n @v &= ~(1 << i)\n @v |= (b << i)\n b\n end", "def execute_XOR(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value ^= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend", "def alpha_blend(other)\n dup.alpha_blend!(other)\n end", "def a(value)\n value & 0x000000ff\n end", "def a(value)\n value & 0x000000ff\n end", "def array_or(a,b)\n c = []\n for i in 0...a.length\n if a[i] or b[i]\n c[i] = true\n else\n c[i] = false\n end\n end\n c\nend", "def intersection_of_arrays(nums1, nums2)\n # nums1 = nums1.sort!\n # nums2 = nums2.sort!\n nums1 & nums2\nend", "def xor?(one, two)\n return true if one && !two\n return true if two && !one\n\n false\nend", "def xor?(value1, value2)\n return true if value1 && !value2\n return true if value2 && !value1\n\n false\nend", "def test(a, b)\n a = b - 1\n b = a + 3\nend", "def find_ucs a, b\n\tfind_uocs(a) & find_uocs(b)\nend", "def xor2?(arg1, arg2)\n (arg1 && !arg2) || (!arg1 && arg2)\nend", "def xor?(x, y)\n return true if x && !y\n return true if y && !x\n false\nend", "def xor?(x, y)\n return true if x && !y\n return true if y && !x\n false\nend", "def secure_compare(a, b)\n\tif a.length == b.length\n\t\tresult = 0\n\t\tfor i in 0..(a.length - 1)\n\t\t\tresult |= a[i] ^ b[i]\n\t\tend\n\t\tresult == 0\n\telse\n\t\tfalse\n\tend\nend", "def swap(a,b)\na,b = b,a\nend", "def overlap(a, b)\n o = a.to_a & b.to_a\n o.size < 2 ? nil : (o.first..o.last)\nend", "def and\n self\n end", "def swap(a, b)\n\ta,b=b,a\nend", "def xor?(one, two)\n if one && two\n false\n elsif one || two\n true\n else\n false\n end\nend", "def bitSwapRequired(a, b)\n\tcount = 0\n\t(a ^ b).to_s(2).split('').each do |x|\n\t\tcount += 1 if x == '1'\n\tend\n\tputs count\nend", "def method4(first, second)\n first = first << second\nend", "def bitwise_not(a)\n\tresult = ''\n\ta.each_char do |val|\n\t\tif val == '1' \n\t\t\tresult.concat '0'\n\t\telse\n\t\t\tresult.concat '1'\n\t\tend\n\tend\n\treturn result\nend", "def xor?(bool1, bool2)\n !(bool1 && bool2) && (bool1 || bool2)\nend", "def and_(a)\n raise NotImplementedError\n end", "def interleave_bits(x, y)\n c = 0\n 31.downto(0) do |i|\n c = (c << 1) | ((x >> i) & 1)\n c = (c << 1) | ((y >> i) & 1)\n end\n c\n end", "def xor?(arg1, arg2)\n if !!arg1 == !!arg2\n false\n else\n true\n end \nend", "def xor?(first_arg, second_arg)\n return true if first_arg == false && second_arg == true\n return true if first_arg == true && second_arg == false\nend", "def union(a,b)\n print a | b # union([1,2,3],[2,3,4]) => [1, 2, 3, 4] \nend", "def xor_b\n end", "def xor?(arg1, arg2)\n if arg1 && !arg2 || !arg1 && arg2\n true\n else\n false\n end\nend", "def ^ other\n left = uniq\n right = []\n other.uniq.each do |x|\n if left.include? x\n left.delete x\n elsif ! right.include?(x)\n right << x\n end\n end\n left + right\n end" ]
[ "0.7705294", "0.7310903", "0.7205983", "0.71032614", "0.7067119", "0.6854914", "0.6769599", "0.66577524", "0.6569824", "0.65206575", "0.64865756", "0.6371127", "0.62811446", "0.62763906", "0.6250348", "0.6241451", "0.62333244", "0.6222573", "0.6222573", "0.6222573", "0.617811", "0.61777645", "0.6159992", "0.6156275", "0.6146879", "0.6140238", "0.6138544", "0.6134428", "0.6133745", "0.61249644", "0.60734004", "0.6055347", "0.604843", "0.604843", "0.6039187", "0.6015521", "0.6013922", "0.60119206", "0.5995531", "0.59895414", "0.5980973", "0.5973979", "0.5968837", "0.5967167", "0.59561586", "0.5955633", "0.59551525", "0.59530336", "0.5940682", "0.59253675", "0.59224594", "0.59144557", "0.5910272", "0.5906449", "0.5865432", "0.58404684", "0.58312225", "0.58303946", "0.5814595", "0.5807379", "0.5807308", "0.5804403", "0.5802251", "0.57976854", "0.5795531", "0.5795456", "0.5794265", "0.5794118", "0.5784966", "0.5784524", "0.57820153", "0.5776784", "0.5770148", "0.5770148", "0.57701325", "0.57668746", "0.5760265", "0.57592326", "0.5758064", "0.5745818", "0.5738342", "0.5738069", "0.5738069", "0.5736197", "0.5722587", "0.5720668", "0.57091373", "0.57036066", "0.56856877", "0.56760496", "0.567433", "0.5672024", "0.5655112", "0.56519026", "0.5642822", "0.56410193", "0.5637998", "0.5635799", "0.562962", "0.5622568", "0.5614688" ]
0.0
-1
a = a b
def difference(b) @pages.delete_if { |k, v| b.pages.include?(k) } self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swap(a,b)\na,b = b,a\nend", "def swap(a, b)\n\ta,b=b,a\nend", "def test(a, b)\n a = b - 1\n b = a + 3\nend", "def swap!(a,b)\n self[a], self[b] = self[b], self[a]\n end", "def demo(a,b)\n\ta = a+2\n\tb = b+ 3\nend", "def swap(a,b)\n return b,a\nend", "def swap!(a,b)\n self[a], self[b] = self[b], self[a]\n self\n end", "def method(a,b)\ntemp=a\na=b\nb=temp\nputs \"a = #{a}\"\nputs \"b = #{b}\"\nend", "def swap!(a,b)\n av = self[a]\n self[a] = self[b]\n self[b] = av\n return self\n end", "def swap(a, b)\n\ta, b = [b, a]\n\t[a, b]\nend", "def swap!(a, b) self[a], self[b] = self[b], self[a]; self; end", "def swap(a,b)\n i = self.clone\n av = i[a]\n i[a] = i[b]\n i[b] = av\n return i\n end", "def method(a, b)\n c=a\n a=b\n b=c\n return a,b\nend", "def swap(a, b)\n a += b\n b = a - b\n a -= b\n puts \"a = #{a} b = #{b}\"\n end", "def swap #\\\n a = pop\n b = pop\n push a\n push b\n end", "def swap_elements(a)\n a[0], a[1], a[2] = a[0], a[2], a[1]\nend", "def swap_version2(a, b, vars)\n\told_a = eval a, vars\n\told_b = eval b, vars\n eval \"#{a} = #{old_b}\", vars\n\teval \"#{b} = #{old_a}\", vars\n\t\n\t# this method parameter type is String\n\t# eval use #{}, eval \"#{a} = ..\", \"#{b} = ..\", so parameter name can be any other string. \n\tputs a \n\tputs b\nend", "def method4(first, second)\n first = first << second\nend", "def slow\n a, b = 1,2\nend", "def swap; end", "def swap_first_last_characters(a, b)\n a, b = b, a\nend", "def get_to_work\n a = \"old thing\"\n b = a\n puts \"this is a before: \" + a\n puts \"this is b before: \" + b\n\n a.replace(\"new thing\")\n# a = a + \"str\"\n\n print \"\\n\"\n\n puts \"this is a now: \" + a\n puts \"this is b now: \" + b\nend", "def swap!\n @left, @right = @right, @left\n end", "def a(b)\nend", "def cop=(_); end", "def cop=(_); end", "def swap_elements_from_to(array,a,b)\n array[a] = array[a]^array[b]\n array[b] = array[b]^array[a]\n array[a] = array[a]^array[b]\nend", "def test_assignment_sample03\n x, y = 1, 2\n a, b = \"CharA\", \"CharB\"; a, b = b, a\n c, d, e = [1, 2, 3]\n assert_equal(1, x)\n assert_equal(2, y)\n assert_equal(\"CharB\", a)\n assert_equal(\"CharA\", b)\n assert_equal(1, c)\n assert_equal(2, d)\n assert_equal(3, e)\n end", "def swap(arr, x, y)\n array = arr.clone\n array[x], array[y] = array[y], array[x]\n array\nend", "def swap_fix_it(p1, p2)\n\n p1_copy = p1.dup\n \n p1.x = p2.x\n p1.y = p2.y\n\n p2.x = p1_copy.x\n p2.y = p1_copy.y\n\n p \"Inside swap_fix_it p1 is #{p1}\"\n p \"Inside swap_fix_it p2 is #{p2}\"\n\n \t\nend", "def a\n\tb\nend", "def swap_elements_from_to(array, i_a, i_b)\n array[i_a], array[i_b] = array[i_b], array[i_a]\n return array\nend", "def []=(a, b, results)\n return if a == b\n\n if a < b\n @data[a][b-a - 1] = results\n else\n @data[b][a-b - 1] = results.map { |r| -r }\n end\n end", "def mess_with_vars1(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def increaseByThree(a)\n\n\tb = 3\n\n\ta = a + b\n\nend", "def swap (array, first, second)\n original_first = array[first]\n array[first] = array[second]\n array[second] = original_first\nend", "def swap_elements(array)\n array[1],array[2] = array[2], array[1] \n array\nend", "def permutation_two(m1, m2)\n m1.team_a, m2.team_a = m2.team_a, m1.team_a\n end", "def swap_elements (array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def permutation_one(m1, m2)\n m1.team_a, m2.team_b = m2.team_b, m1.team_a\n end", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap(a, i, j) \n\ttemp = a[i]\n\ta[i] = a[j]\n\ta[j] = temp\n\treturn a\nend", "def swap_elements(any_array)\n any_array[1], any_array[2] = any_array[2], any_array[1]\n any_array\n end", "def swap\n\t\t\ta = pop\n\t\t\tb = pop\n\t\t\tpush a\n\t\t\tpush b\n\t\tend", "def swapper(arr, idx1, idx2)\n arr[idx1], arr[idx2] = arr[idx2], arr[idx1]\n arr\nend", "def swap_elements(array)\n array[0], array[1], array[2] = array[0], array[2], array[1]\nend", "def swap_values(value1, value2)\n temp = value1\n value1 = value2\n value2 = temp\n [value1, value2]\n end", "def swap(array, a_index, b_index)\n temp = array[a_index]\n\tarray[a_index] = array[b_index]\n\tarray[b_index] = temp\n return array\nend", "def just_assignment(number)\r\n foo = number + 3\r\nend", "def swap(arr, first, second)\n temp = arr[first]\n arr[first] = arr[second]\n arr[second] = temp\nend", "def swapper(arr, idx_1, idx_2)\n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend", "def just_assignment(number)\n foo = number + 3\nend", "def just_assignment(number)\n foo = number + 3\nend", "def operator=(_arg0); end", "def swap(array, first_index, second_index)\n temp = array[first_index]\n array[first_index] = array[second_index]\n array[second_index] = temp\nend", "def just_assignment(number)\n foo = number + 3 \nend", "def swap(array, index_one, index_two)\n temp = array[index_one]\n array[index_one] = array[index_two]\n array[index_two] = temp\nend", "def *(other)\n @a=other.a*@a\n @b=other.b*@b\n self.to_s #devuelve el resultado como cadena. la operacion modifica el valor del objeto.\n\n end", "def []=(p0, p1) end", "def []=(p0, p1) end", "def from_b!\n self.replace(from_b)\n end", "def swap_elements(array)\n\tarray[0], array[1], array[2] = array[0], array[2], array[1]\nend", "def swap_elements(array)\n\tarray[0], array[1], array[2] = array[0], array[2], array[1]\nend", "def copy_to(other); end", "def swap_elements(array)\n array[1], array[2], = array[2], array[1]\n return array\nend", "def merge!(other); end", "def swap_elements(arry)\n #oldx = x x = y y = oldx\n\n val1 = arry[2]\n val2 = arry[1]\n\n arry[1] = val1\n arry[2] = val2\n\n arry\nend", "def ovwrite_me(other)\n @x = other.x\n @y = other.y\n @z = other.z\n self\n end", "def swap(a, i1, i2)\n a = a.dup\n t = a[i1]\n a[i1] = a[i2]\n a[i2] = t\n a\n end", "def copy\n self.class.new(@x,@y)\n end", "def swap(arr, x, y)\n aux = arr[x]\n arr[x] = arr[y]\n arr[y] = aux\n nil\nend", "def flip!\n left = @left\n right = @right\n @right = left\n @left = right\n end", "def swapper(arr, idx_1, idx_2)\n \n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend", "def swapper(arr, idx_1, idx_2)\n \n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend", "def my_value(b)\n puts b[2]\n b[2] = '-' # this method initializes variable b local to my_value and points it to the value of a, \n # which is the string\"Xyzzy\". Strings are mutable, so when b[2] = '-' is called, \n # it also changes a\n puts b[2]\nend", "def execute_XCHG(left, right)\n\t\tleft.value, right.value = right.value, left.value\n\tend", "def move_over(a, b)\n reveal(a)\n move_single(a, b)\n end", "def swap_elements(elements)\n hold = elements[1]\n elements[1] = elements[2]\n elements[2] = hold\n elements\nend", "def swap_first_last_characters(a, b)\n temp = a.clone\n a.replace(b)\n b.replace(temp)\nend", "def assignment\n name = get_name\n comment name\n define_variable name\n match \"=\"\n comment \"=\"\n expression\n emitln \"leaq #{name}(%rip), %rdx\"\n emitln \"movl %eax, (%rdx)\"\nend", "def procedure_a(a,b)\n a=a+3\n b=b+4\n return a,b\nend" ]
[ "0.8211058", "0.7870475", "0.76075286", "0.7331097", "0.7291055", "0.72858477", "0.7265086", "0.70428467", "0.70089567", "0.6951317", "0.6930363", "0.6837598", "0.682915", "0.6754721", "0.66394323", "0.6613401", "0.66041356", "0.643501", "0.6426306", "0.6421003", "0.6399016", "0.6380235", "0.6360897", "0.62317824", "0.62147284", "0.62147284", "0.619612", "0.61812747", "0.6114047", "0.6087027", "0.6060059", "0.60307056", "0.59423715", "0.59409547", "0.5938533", "0.5938533", "0.5938533", "0.5938533", "0.5938533", "0.5938533", "0.5938533", "0.5938533", "0.5938533", "0.5938533", "0.5935245", "0.592908", "0.5924304", "0.59056294", "0.59002465", "0.58897066", "0.5887569", "0.58871543", "0.58866006", "0.58866006", "0.58866006", "0.58866006", "0.58866006", "0.58866006", "0.58866006", "0.58866006", "0.58866006", "0.58848727", "0.58729756", "0.58634526", "0.58596665", "0.58552635", "0.5832516", "0.5809684", "0.58078426", "0.5800854", "0.5782875", "0.5754761", "0.5754761", "0.5753362", "0.5751955", "0.5746689", "0.5734055", "0.5727924", "0.5707227", "0.5707227", "0.56982696", "0.5690568", "0.5690568", "0.5686369", "0.5683993", "0.56742823", "0.5668883", "0.5656728", "0.5651472", "0.5648807", "0.56469154", "0.56460804", "0.56451935", "0.56451935", "0.5643135", "0.56273896", "0.5622289", "0.56051165", "0.5602655", "0.5598478", "0.55876946" ]
0.0
-1
a = a | b
def union(b) b.each do |bf| af = @cfile_by_name[bf.file] if af af.union bf else @cfile_by_name[bf.file] = bf end end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bitSetOr (a,b)\n\t\tresult = Array.new\n\t\tfor i in 0...(a.size)\n\t\t\tresult[i] = a[i] || b[i]\n\t\tend\n\t\treturn result\n\tend", "def |(other)\n\t\tself.class.new(value | other)\n\tend", "def xor(a,b)\n (a | b) - (a & b)\n end", "def &(other)\n false\n end", "def |(other)\n return self.class.new(super.|(other)) \n end", "def union(a,b)\n print a | b # union([1,2,3],[2,3,4]) => [1, 2, 3, 4] \nend", "def bitwise_or(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif val == '1' || b[index] == '1'\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend", "def bitwise_exclusive(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif (val == '1' && b[index] == '0') || (val == '0' && b[index] == '1')\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend", "def merge(arr1, arr2)\n arr1 | arr2\nend", "def merge(arr1, arr2)\n arr1 | arr2\nend", "def merge(arr1, arr2)\n arr1 | arr2\nend", "def swap(a,b)\na,b = b,a\nend", "def test(a, b)\n a = b - 1\n b = a + 3\nend", "def mask(a, b)\n a ^ b\n end", "def merge(array1, array2)\n array1 | array2\nend", "def or_(a)\n if ((a).nil?)\n return self\n end\n s = self.clone\n s.or_in_place(a)\n return s\n end", "def |(other)\n self.class.new(values: (to_a | other.to_a))\n end", "def |(other)\n `return other.$r ? Qtrue : Qfalse;`\n end", "def method4(first, second)\n first = first << second\nend", "def |(other)\n other.inject(clone) do |copy, e|\n copy << e\n end\n end", "def swap(a, b)\n\ta,b=b,a\nend", "def exclusive_or (p,q)\n p ^ q\nend", "def xor_a\n end", "def or a, b\n a.prove { yield }\n b.prove { yield }\n end", "def |(p0) end", "def |(p0) end", "def |(p0) end", "def |(p0) end", "def |(p0) end", "def |(p0) end", "def union itemA, itemB\n\tend", "def swap(a,b)\n return b,a\nend", "def swap!(a,b)\n self[a], self[b] = self[b], self[a]\n self\n end", "def |\n a = pop\n b = pop\n push (a == -1) || (b == -1) ? -1 : 0\n end", "def bitSetAnd (a,b)\n\t\tresult = Array.new\n\t\tfor i in 0...(a.size)\n\t\t\tresult[i] = a[i] && b[i]\n\t\tend\n\t\treturn result\n\tend", "def |(arg0)\n end", "def |(arg0)\n end", "def |(arg0)\n end", "def array_or(a,b)\n c = []\n for i in 0...a.length\n if a[i] or b[i]\n c[i] = true\n else\n c[i] = false\n end\n end\n c\nend", "def or_b\n end", "def bitwise_and(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif val == b[index]\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend", "def union(lb)\n\n\n\n\n\n end", "def swap_elements_from_to(array,a,b)\n array[a] = array[a]^array[b]\n array[b] = array[b]^array[a]\n array[a] = array[a]^array[b]\nend", "def swap!(a,b)\n self[a], self[b] = self[b], self[a]\n end", "def xor(argument1, argument2)\n argument1 && !argument2 || !argument1 && argument2\n end", "def &\n a = pop\n b = pop\n push (a == -1) && (b == -1) ? -1 : 0\n end", "def xor_b\n end", "def union(other)\n self.class.from_a(to_a | other.to_a)\n end", "def swap(a, b)\n\ta, b = [b, a]\n\t[a, b]\nend", "def f6; return *['a','b'] &['a','Y','Z'] end", "def execute_OR(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value |= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend", "def |(value)\n value = _arg2int(value)\n value &= self.mask if (bounded?)\n bs = dup\n bs.from_i(value | bs.to_i)\n bs\n end", "def and_b\n end", "def |(other)\n# new_z = self.z unless self.z != other.z\n self.class.new(self.x + other.x, self.y + other.y, self.z)\n end", "def swap!(a,b)\n av = self[a]\n self[a] = self[b]\n self[b] = av\n return self\n end", "def merge(array1, array2)\n # (array1 + array2).uniq\n array1 | array2\nend", "def p1(x, y, z)\n # x or y\n xor(x, y)\nend", "def swap_first_last_characters(a, b)\n a, b = b, a\nend", "def sum_double (a,b)\n\t\n\tif a != b \n\t\treturn a + b \n\tend \n\n\tif a = b \n\t\treturn 2 * (a + b)\n\tend\n\nend", "def execute_XOR(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value ^= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend", "def and_ a, b\n self.and a, b\n end", "def &(other)\n self.class.new(values: (to_a & other.to_a))\n end", "def permutation_one(m1, m2)\n m1.team_a, m2.team_b = m2.team_b, m1.team_a\n end", "def or(argument1, argument2)\n argument1 || argument2\n end", "def demo(a,b)\n\ta = a+2\n\tb = b+ 3\nend", "def []=(i,b)\n b = (b && b!=0) ? 1 : 0\n @v &= ~(1 << i)\n @v |= (b << i)\n b\n end", "def union(other)\n new(to_ary | other.to_ary)\n end", "def compine(a, b)\n\ta.each do |i|\n\t\tb.delete_at(b.index(i)) unless b.index(i) == nil\n\tend\n\treturn a + b\nend", "def non_start(value_a, value_b)\n # value_a[1..-1] + value_b[1..-1]\n value_a[1...value_a.length + 1] + value_b[1..-1]\n end", "def ^ other\n left = uniq\n right = []\n other.uniq.each do |x|\n if left.include? x\n left.delete x\n elsif ! right.include?(x)\n right << x\n end\n end\n left + right\n end", "def ^(other)\n `return other.$r ? Qtrue : Qfalse;`\n end", "def remove_duplicates(list)\n list & list # list | list would work too\nend", "def exclusive_or(num1, num2)\r\n\t# your code here\r\nend", "def alpha_blend(other)\n dup.alpha_blend!(other)\n end", "def union(other)\n self.class.from_a(to_a | other.to_a)\n end", "def &(other)\n\t\tself.class.new(value & other)\n\tend", "def |(other)\n Index.new(to_a | other.to_a)\n end", "def or\n x, y = stack.pop(2)\n push x | y\n end", "def a_plus_abs_b(a, b)\n op = b > 0 ? :+ : :-\n a.send(op, b)\nend", "def execute_AND(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value &= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend", "def |(enum); end", "def swap(one, two)\n if include? one\n exclude one\n add two\n else\n exclude two\n add one\n end\n end", "def and_a\n end", "def &(second)\n @operations << AndOperationsGroup.new(tail_ops!(2))\n self\n end", "def a(b)\nend", "def encode(a, b)\n check_ab_bounds(a, b)\n i = (a << @b_size) ^ b\n interlace(i)\n end", "def ^(other)\n\t\tself.class.new(value ^ other)\n\tend", "def *(other)\n @a=other.a*@a\n @b=other.b*@b\n self.to_s #devuelve el resultado como cadena. la operacion modifica el valor del objeto.\n\n end", "def |(other)\n Or.new(self, other)\n end", "def xor(x, y)\n\nend", "def xor?(a,b)\n if a && !b\n true\n elsif !a && b\n true\n else\n false\n end\nend", "def union(other)\n @bits | bits_from_object(other)\n end", "def iff a,b\n all(a,b) { all(b,a) { yield } }\n end", "def -\n a = pop\n b = pop\n push b - a\n end", "def union! newFA\n end", "def swap(a,b)\n i = self.clone\n av = i[a]\n i[a] = i[b]\n i[b] = av\n return i\n end", "def or(e1, e2)\n eval_ex(e1) | eval_ex(e2)\n end", "def xor(a,b)\n if (a == true && b == true) || (a == false && b == false)\n return false\n else\n return true\n end\nend", "def permutation_two(m1, m2)\n m1.team_a, m2.team_a = m2.team_a, m1.team_a\n end", "def swap!(a, b) self[a], self[b] = self[b], self[a]; self; end", "def reject!(&b)\n a = reject(&b)\n if a.size == size\n nil # no changes, return nil\n else\n replace(a)\n self\n end\n end" ]
[ "0.67822003", "0.6723063", "0.6710966", "0.66846085", "0.6600051", "0.6557301", "0.65520406", "0.6521133", "0.65154725", "0.65154725", "0.65154725", "0.6456149", "0.6384036", "0.6294734", "0.6291878", "0.6227479", "0.6211261", "0.6210893", "0.62051284", "0.6183759", "0.6183319", "0.6169603", "0.6160858", "0.615759", "0.6147303", "0.6147303", "0.6147303", "0.6147303", "0.6147303", "0.6147303", "0.61237776", "0.6113318", "0.60945785", "0.6089537", "0.60692555", "0.6056644", "0.6056644", "0.6056644", "0.599479", "0.5992671", "0.5985152", "0.59744185", "0.59730226", "0.596615", "0.59630483", "0.595957", "0.594031", "0.59358937", "0.5928184", "0.59233475", "0.590286", "0.5900226", "0.58782524", "0.5877307", "0.5836111", "0.5817277", "0.5802193", "0.5801747", "0.579849", "0.5794861", "0.5791607", "0.5790954", "0.5790828", "0.5788907", "0.57864934", "0.57624644", "0.5752226", "0.57422256", "0.5737903", "0.573022", "0.5729239", "0.5728181", "0.57275665", "0.5727314", "0.5727028", "0.5725015", "0.5709519", "0.5690773", "0.5681294", "0.56692296", "0.566759", "0.5658563", "0.5654948", "0.5637562", "0.56369245", "0.56112725", "0.5603512", "0.5584947", "0.5583969", "0.5580627", "0.5580429", "0.55791754", "0.5578566", "0.5577283", "0.55737376", "0.55663145", "0.55644834", "0.5563619", "0.5563133", "0.55606234", "0.5560351" ]
0.0
-1
a = a & b
def intersection(b) @cfile_by_name.each_value do |af| bf = b[af.file] if bf af.intersection bf else @cfile_by_name.delete af.file end end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bitSetAnd (a,b)\n\t\tresult = Array.new\n\t\tfor i in 0...(a.size)\n\t\t\tresult[i] = a[i] && b[i]\n\t\tend\n\t\treturn result\n\tend", "def bitwise_and(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif val == b[index]\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend", "def mask(a, b)\n a ^ b\n end", "def xor(a,b)\n (a | b) - (a & b)\n end", "def bitwise_exclusive(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif (val == '1' && b[index] == '0') || (val == '0' && b[index] == '1')\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend", "def bitSetOr (a,b)\n\t\tresult = Array.new\n\t\tfor i in 0...(a.size)\n\t\t\tresult[i] = a[i] || b[i]\n\t\tend\n\t\treturn result\n\tend", "def and_ a, b\n self.and a, b\n end", "def bitnot(b)\n (~b)&1\nend", "def execute_AND(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value &= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend", "def bitwise_or(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif val == '1' || b[index] == '1'\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend", "def carry_out (p,q)\n p & q\nend", "def intersection(a, b)\n negate(union(negate(a), negate(b)))\n end", "def encode(a, b)\n check_ab_bounds(a, b)\n i = (a << @b_size) ^ b\n interlace(i)\n end", "def &(other)\n false\n end", "def &(other)\n self.class.new(values: (to_a & other.to_a))\n end", "def and_b\n end", "def And(a, b)\n return a && b\nend", "def merge(arr1, arr2)\n arr1 | arr2\nend", "def merge(arr1, arr2)\n arr1 | arr2\nend", "def merge(arr1, arr2)\n arr1 | arr2\nend", "def test_difference_one_from_two\n array = []\n array_one = [1,2,3,4,5]\n array_two = [2,5,9]\n array = array_one &! array_two\n assert_equal [1,3,4], array\n end", "def xor?(a,b)\n if a && !b\n true\n elsif !a && b\n true\n else\n false\n end\nend", "def swap_elements_from_to(array,a,b)\n array[a] = array[a]^array[b]\n array[b] = array[b]^array[a]\n array[a] = array[a]^array[b]\nend", "def test_difference_two_from_one\n array = []\n array_one = [1,2,3,4,5]\n array_two = [2,5,9]\n array = array_one &! array_two\n assert_equal [9], array\n end", "def OF_CHECKING(a,b,sum) \n\tAND(XOR(sum,a),NOT(XOR(a,b)))\nend", "def xor?(first, second)\n (first && !second) || (!first && second)\nend", "def remove_duplicates(list)\n list & list # list | list would work too\nend", "def bitwise_and(num1, num2)\n bnum1 = num1.to_s(2)\n bnum2 = num2.to_s(2)\n band = (num1 & num2).to_s(2)\n puts \"num1 = \" + ( ' ' * bnum2.length ) + num1.to_s(2)\n puts \"num2 = \" + ( ' ' * bnum1.length ) + num2.to_s(2)\n puts \"b2& = \" + ( ' ' * ([bnum1.length, bnum2.length].max ) + band)\n # puts \"base 10 & = \" + (num1 & num2).to_s(10)\nend", "def xor(argument1, argument2)\n argument1 && !argument2 || !argument1 && argument2\n end", "def f6; return *['a','b'] &['a','Y','Z'] end", "def xor?(one, two)\n (one && !two) || (two && !one)\nend", "def and_to_a(to_and)\n @a &= to_and\n @f = 0x00\n @f |= H_FLAG\n @f |= Z_FLAG if @a == 0x00\n end", "def xor?(value1, value2)\n (value1 && !value2) || (value2 && !value1)\nend", "def xor?(value1, value2)\n (value1 && !value2) || (value2 && !value1)\nend", "def xor?(value1, value2)\n !!((value1 && !value2) || (value2 && !value1))\nend", "def xor?(this, that)\n (!this && that) || (this && !that)\nend", "def xor?(a, b)\n return true if a && !b\n return true if !a && b\n false\nend", "def exclusive_or (p,q)\n p ^ q\nend", "def intersect(other)\n @bits & bits_from_object(other)\n end", "def intersection(nums1, nums2)\n nums1 & nums2\n end", "def &(other)\n\t\tself.class.new(value & other)\n\tend", "def & other\n if self\n other ? true : false\n else\n false\n end\n end", "def xor?(x, y)\n (x && !y) || (!x && y)\nend", "def and\n x, y = stack.pop(2)\n push x & y\n end", "def xor?(x, y)\n (x || !y) || (y && !x)\nend", "def AND(x,y); \tif x==1 && y==1 \tthen 1 else 0 end; end", "def &(other)\n if self.size < other.size\n return other & self\n end\n\n skip = self.size - other.size\n result = BitField.new(self.size)\n prefix = [0] * skip\n rest = (self.field[skip..-1]).zip(other.field).map do |left, right|\n left & right\n end\n result.field = prefix + rest\n return result\n end", "def and(e1, e2)\n eval_ex(e1) & eval_ex(e2)\n end", "def set?(num, mask)\n (num & mask) != 0\nend", "def merge(array1, array2)\n array1 | array2\nend", "def intersect(xs, ys)\n result = []\n result = xs & ys\n puts result\nend", "def &\n a = pop\n b = pop\n push (a == -1) && (b == -1) ? -1 : 0\n end", "def xor?(arg1, arg2)\r\n (arg1 && !arg2) || (arg2 && !arg1)\r\nend", "def xor?(value1, value2)\n (value1 || value2) && !(value1 && value2)\nend", "def bit_add(a, b)\n\t(7).downto(0).each do |x|\n\tend\nend", "def test_combine_arrays\n array = []\n array_one = [1,2,3,4,5]\n array_two = [2,5,9]\n array = array_one & array_two\n assert_equal [2,5], array\n end", "def xor?(a, b)\n if (a == true && b == false) || (a == false && b == true)\n true\n end\nend", "def a_plus_abs_b(a, b)\n op = b > 0 ? :+ : :-\n a.send(op, b)\nend", "def ampersand(&block)\n block.call\n yield\nend", "def xor(a,b)\n if (a == true && b == true) || (a == false && b == false)\n return false\n else\n return true\n end\nend", "def iff a,b\n all(a,b) { all(b,a) { yield } }\n end", "def xor?(value1, value2)\r\n !!((value1 && !value2) || (value2 && !value1)) # !! forces the return to be a boolean\r\nend", "def -(other)\n self & other.complement\n end", "def xor?(arg1, arg2)\n (arg1 && !arg2) || (arg2 && !arg1) ? true : false\nend", "def xor?(value1, value2)\n return true if value1 && !value2\n return true if value2 && !value1\n false\nend", "def intersections(list_a, list_b)\n list_a & list_b\nend", "def and_a\n end", "def & other\n call_enum \"boolean\", other, :and\n end", "def xor?(bool1, bool2)\n !!bool1 != !!bool2\nend", "def []=(i,b)\n b = (b && b!=0) ? 1 : 0\n @v &= ~(1 << i)\n @v |= (b << i)\n b\n end", "def execute_XOR(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value ^= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend", "def alpha_blend(other)\n dup.alpha_blend!(other)\n end", "def a(value)\n value & 0x000000ff\n end", "def a(value)\n value & 0x000000ff\n end", "def array_or(a,b)\n c = []\n for i in 0...a.length\n if a[i] or b[i]\n c[i] = true\n else\n c[i] = false\n end\n end\n c\nend", "def intersection_of_arrays(nums1, nums2)\n # nums1 = nums1.sort!\n # nums2 = nums2.sort!\n nums1 & nums2\nend", "def xor?(one, two)\n return true if one && !two\n return true if two && !one\n\n false\nend", "def xor?(value1, value2)\n return true if value1 && !value2\n return true if value2 && !value1\n\n false\nend", "def test(a, b)\n a = b - 1\n b = a + 3\nend", "def find_ucs a, b\n\tfind_uocs(a) & find_uocs(b)\nend", "def xor2?(arg1, arg2)\n (arg1 && !arg2) || (!arg1 && arg2)\nend", "def xor?(x, y)\n return true if x && !y\n return true if y && !x\n false\nend", "def xor?(x, y)\n return true if x && !y\n return true if y && !x\n false\nend", "def secure_compare(a, b)\n\tif a.length == b.length\n\t\tresult = 0\n\t\tfor i in 0..(a.length - 1)\n\t\t\tresult |= a[i] ^ b[i]\n\t\tend\n\t\tresult == 0\n\telse\n\t\tfalse\n\tend\nend", "def swap(a,b)\na,b = b,a\nend", "def overlap(a, b)\n o = a.to_a & b.to_a\n o.size < 2 ? nil : (o.first..o.last)\nend", "def and\n self\n end", "def swap(a, b)\n\ta,b=b,a\nend", "def xor?(one, two)\n if one && two\n false\n elsif one || two\n true\n else\n false\n end\nend", "def bitSwapRequired(a, b)\n\tcount = 0\n\t(a ^ b).to_s(2).split('').each do |x|\n\t\tcount += 1 if x == '1'\n\tend\n\tputs count\nend", "def method4(first, second)\n first = first << second\nend", "def bitwise_not(a)\n\tresult = ''\n\ta.each_char do |val|\n\t\tif val == '1' \n\t\t\tresult.concat '0'\n\t\telse\n\t\t\tresult.concat '1'\n\t\tend\n\tend\n\treturn result\nend", "def xor?(bool1, bool2)\n !(bool1 && bool2) && (bool1 || bool2)\nend", "def and_(a)\n raise NotImplementedError\n end", "def interleave_bits(x, y)\n c = 0\n 31.downto(0) do |i|\n c = (c << 1) | ((x >> i) & 1)\n c = (c << 1) | ((y >> i) & 1)\n end\n c\n end", "def xor?(arg1, arg2)\n if !!arg1 == !!arg2\n false\n else\n true\n end \nend", "def xor?(first_arg, second_arg)\n return true if first_arg == false && second_arg == true\n return true if first_arg == true && second_arg == false\nend", "def union(a,b)\n print a | b # union([1,2,3],[2,3,4]) => [1, 2, 3, 4] \nend", "def xor_b\n end", "def xor?(arg1, arg2)\n if arg1 && !arg2 || !arg1 && arg2\n true\n else\n false\n end\nend", "def ^ other\n left = uniq\n right = []\n other.uniq.each do |x|\n if left.include? x\n left.delete x\n elsif ! right.include?(x)\n right << x\n end\n end\n left + right\n end" ]
[ "0.7705294", "0.7310903", "0.7205983", "0.71032614", "0.7067119", "0.6854914", "0.6769599", "0.66577524", "0.6569824", "0.65206575", "0.64865756", "0.6371127", "0.62811446", "0.62763906", "0.6250348", "0.6241451", "0.62333244", "0.6222573", "0.6222573", "0.6222573", "0.617811", "0.61777645", "0.6159992", "0.6156275", "0.6146879", "0.6140238", "0.6138544", "0.6134428", "0.6133745", "0.61249644", "0.60734004", "0.6055347", "0.604843", "0.604843", "0.6039187", "0.6015521", "0.6013922", "0.60119206", "0.5995531", "0.59895414", "0.5980973", "0.5973979", "0.5968837", "0.5967167", "0.59561586", "0.5955633", "0.59551525", "0.59530336", "0.5940682", "0.59253675", "0.59224594", "0.59144557", "0.5910272", "0.5906449", "0.5865432", "0.58404684", "0.58312225", "0.58303946", "0.5814595", "0.5807379", "0.5807308", "0.5804403", "0.5802251", "0.57976854", "0.5795531", "0.5795456", "0.5794265", "0.5794118", "0.5784966", "0.5784524", "0.57820153", "0.5776784", "0.5770148", "0.5770148", "0.57701325", "0.57668746", "0.5760265", "0.57592326", "0.5758064", "0.5745818", "0.5738342", "0.5738069", "0.5738069", "0.5736197", "0.5722587", "0.5720668", "0.57091373", "0.57036066", "0.56856877", "0.56760496", "0.567433", "0.5672024", "0.5655112", "0.56519026", "0.5642822", "0.56410193", "0.5637998", "0.5635799", "0.562962", "0.5622568", "0.5614688" ]
0.0
-1
a = a b
def difference(b) @cfile_by_name.each_value do |af| bf = b[af.file] if bf != nil af.difference bf end end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swap(a,b)\na,b = b,a\nend", "def swap(a, b)\n\ta,b=b,a\nend", "def test(a, b)\n a = b - 1\n b = a + 3\nend", "def swap!(a,b)\n self[a], self[b] = self[b], self[a]\n end", "def demo(a,b)\n\ta = a+2\n\tb = b+ 3\nend", "def swap(a,b)\n return b,a\nend", "def swap!(a,b)\n self[a], self[b] = self[b], self[a]\n self\n end", "def method(a,b)\ntemp=a\na=b\nb=temp\nputs \"a = #{a}\"\nputs \"b = #{b}\"\nend", "def swap!(a,b)\n av = self[a]\n self[a] = self[b]\n self[b] = av\n return self\n end", "def swap(a, b)\n\ta, b = [b, a]\n\t[a, b]\nend", "def swap!(a, b) self[a], self[b] = self[b], self[a]; self; end", "def swap(a,b)\n i = self.clone\n av = i[a]\n i[a] = i[b]\n i[b] = av\n return i\n end", "def method(a, b)\n c=a\n a=b\n b=c\n return a,b\nend", "def swap(a, b)\n a += b\n b = a - b\n a -= b\n puts \"a = #{a} b = #{b}\"\n end", "def swap #\\\n a = pop\n b = pop\n push a\n push b\n end", "def swap_elements(a)\n a[0], a[1], a[2] = a[0], a[2], a[1]\nend", "def swap_version2(a, b, vars)\n\told_a = eval a, vars\n\told_b = eval b, vars\n eval \"#{a} = #{old_b}\", vars\n\teval \"#{b} = #{old_a}\", vars\n\t\n\t# this method parameter type is String\n\t# eval use #{}, eval \"#{a} = ..\", \"#{b} = ..\", so parameter name can be any other string. \n\tputs a \n\tputs b\nend", "def method4(first, second)\n first = first << second\nend", "def slow\n a, b = 1,2\nend", "def swap; end", "def swap_first_last_characters(a, b)\n a, b = b, a\nend", "def get_to_work\n a = \"old thing\"\n b = a\n puts \"this is a before: \" + a\n puts \"this is b before: \" + b\n\n a.replace(\"new thing\")\n# a = a + \"str\"\n\n print \"\\n\"\n\n puts \"this is a now: \" + a\n puts \"this is b now: \" + b\nend", "def swap!\n @left, @right = @right, @left\n end", "def a(b)\nend", "def cop=(_); end", "def cop=(_); end", "def swap_elements_from_to(array,a,b)\n array[a] = array[a]^array[b]\n array[b] = array[b]^array[a]\n array[a] = array[a]^array[b]\nend", "def test_assignment_sample03\n x, y = 1, 2\n a, b = \"CharA\", \"CharB\"; a, b = b, a\n c, d, e = [1, 2, 3]\n assert_equal(1, x)\n assert_equal(2, y)\n assert_equal(\"CharB\", a)\n assert_equal(\"CharA\", b)\n assert_equal(1, c)\n assert_equal(2, d)\n assert_equal(3, e)\n end", "def swap(arr, x, y)\n array = arr.clone\n array[x], array[y] = array[y], array[x]\n array\nend", "def swap_fix_it(p1, p2)\n\n p1_copy = p1.dup\n \n p1.x = p2.x\n p1.y = p2.y\n\n p2.x = p1_copy.x\n p2.y = p1_copy.y\n\n p \"Inside swap_fix_it p1 is #{p1}\"\n p \"Inside swap_fix_it p2 is #{p2}\"\n\n \t\nend", "def a\n\tb\nend", "def swap_elements_from_to(array, i_a, i_b)\n array[i_a], array[i_b] = array[i_b], array[i_a]\n return array\nend", "def []=(a, b, results)\n return if a == b\n\n if a < b\n @data[a][b-a - 1] = results\n else\n @data[b][a-b - 1] = results.map { |r| -r }\n end\n end", "def mess_with_vars1(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def increaseByThree(a)\n\n\tb = 3\n\n\ta = a + b\n\nend", "def swap (array, first, second)\n original_first = array[first]\n array[first] = array[second]\n array[second] = original_first\nend", "def swap_elements(array)\n array[1],array[2] = array[2], array[1] \n array\nend", "def permutation_two(m1, m2)\n m1.team_a, m2.team_a = m2.team_a, m1.team_a\n end", "def swap_elements (array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def permutation_one(m1, m2)\n m1.team_a, m2.team_b = m2.team_b, m1.team_a\n end", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap(a, i, j) \n\ttemp = a[i]\n\ta[i] = a[j]\n\ta[j] = temp\n\treturn a\nend", "def swap_elements(any_array)\n any_array[1], any_array[2] = any_array[2], any_array[1]\n any_array\n end", "def swap\n\t\t\ta = pop\n\t\t\tb = pop\n\t\t\tpush a\n\t\t\tpush b\n\t\tend", "def swapper(arr, idx1, idx2)\n arr[idx1], arr[idx2] = arr[idx2], arr[idx1]\n arr\nend", "def swap_elements(array)\n array[0], array[1], array[2] = array[0], array[2], array[1]\nend", "def swap_values(value1, value2)\n temp = value1\n value1 = value2\n value2 = temp\n [value1, value2]\n end", "def swap(array, a_index, b_index)\n temp = array[a_index]\n\tarray[a_index] = array[b_index]\n\tarray[b_index] = temp\n return array\nend", "def just_assignment(number)\r\n foo = number + 3\r\nend", "def swap(arr, first, second)\n temp = arr[first]\n arr[first] = arr[second]\n arr[second] = temp\nend", "def swapper(arr, idx_1, idx_2)\n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend", "def just_assignment(number)\n foo = number + 3\nend", "def just_assignment(number)\n foo = number + 3\nend", "def operator=(_arg0); end", "def swap(array, first_index, second_index)\n temp = array[first_index]\n array[first_index] = array[second_index]\n array[second_index] = temp\nend", "def just_assignment(number)\n foo = number + 3 \nend", "def swap(array, index_one, index_two)\n temp = array[index_one]\n array[index_one] = array[index_two]\n array[index_two] = temp\nend", "def *(other)\n @a=other.a*@a\n @b=other.b*@b\n self.to_s #devuelve el resultado como cadena. la operacion modifica el valor del objeto.\n\n end", "def []=(p0, p1) end", "def []=(p0, p1) end", "def from_b!\n self.replace(from_b)\n end", "def swap_elements(array)\n\tarray[0], array[1], array[2] = array[0], array[2], array[1]\nend", "def swap_elements(array)\n\tarray[0], array[1], array[2] = array[0], array[2], array[1]\nend", "def copy_to(other); end", "def swap_elements(array)\n array[1], array[2], = array[2], array[1]\n return array\nend", "def merge!(other); end", "def swap_elements(arry)\n #oldx = x x = y y = oldx\n\n val1 = arry[2]\n val2 = arry[1]\n\n arry[1] = val1\n arry[2] = val2\n\n arry\nend", "def ovwrite_me(other)\n @x = other.x\n @y = other.y\n @z = other.z\n self\n end", "def swap(a, i1, i2)\n a = a.dup\n t = a[i1]\n a[i1] = a[i2]\n a[i2] = t\n a\n end", "def copy\n self.class.new(@x,@y)\n end", "def swap(arr, x, y)\n aux = arr[x]\n arr[x] = arr[y]\n arr[y] = aux\n nil\nend", "def flip!\n left = @left\n right = @right\n @right = left\n @left = right\n end", "def swapper(arr, idx_1, idx_2)\n \n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend", "def swapper(arr, idx_1, idx_2)\n \n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend", "def my_value(b)\n puts b[2]\n b[2] = '-' # this method initializes variable b local to my_value and points it to the value of a, \n # which is the string\"Xyzzy\". Strings are mutable, so when b[2] = '-' is called, \n # it also changes a\n puts b[2]\nend", "def execute_XCHG(left, right)\n\t\tleft.value, right.value = right.value, left.value\n\tend", "def move_over(a, b)\n reveal(a)\n move_single(a, b)\n end", "def swap_elements(elements)\n hold = elements[1]\n elements[1] = elements[2]\n elements[2] = hold\n elements\nend", "def swap_first_last_characters(a, b)\n temp = a.clone\n a.replace(b)\n b.replace(temp)\nend", "def assignment\n name = get_name\n comment name\n define_variable name\n match \"=\"\n comment \"=\"\n expression\n emitln \"leaq #{name}(%rip), %rdx\"\n emitln \"movl %eax, (%rdx)\"\nend", "def procedure_a(a,b)\n a=a+3\n b=b+4\n return a,b\nend" ]
[ "0.8211058", "0.7870475", "0.76075286", "0.7331097", "0.7291055", "0.72858477", "0.7265086", "0.70428467", "0.70089567", "0.6951317", "0.6930363", "0.6837598", "0.682915", "0.6754721", "0.66394323", "0.6613401", "0.66041356", "0.643501", "0.6426306", "0.6421003", "0.6399016", "0.6380235", "0.6360897", "0.62317824", "0.62147284", "0.62147284", "0.619612", "0.61812747", "0.6114047", "0.6087027", "0.6060059", "0.60307056", "0.59423715", "0.59409547", "0.5938533", "0.5938533", "0.5938533", "0.5938533", "0.5938533", "0.5938533", "0.5938533", "0.5938533", "0.5938533", "0.5938533", "0.5935245", "0.592908", "0.5924304", "0.59056294", "0.59002465", "0.58897066", "0.5887569", "0.58871543", "0.58866006", "0.58866006", "0.58866006", "0.58866006", "0.58866006", "0.58866006", "0.58866006", "0.58866006", "0.58866006", "0.58848727", "0.58729756", "0.58634526", "0.58596665", "0.58552635", "0.5832516", "0.5809684", "0.58078426", "0.5800854", "0.5782875", "0.5754761", "0.5754761", "0.5753362", "0.5751955", "0.5746689", "0.5734055", "0.5727924", "0.5707227", "0.5707227", "0.56982696", "0.5690568", "0.5690568", "0.5686369", "0.5683993", "0.56742823", "0.5668883", "0.5656728", "0.5651472", "0.5648807", "0.56469154", "0.56460804", "0.56451935", "0.56451935", "0.5643135", "0.56273896", "0.5622289", "0.56051165", "0.5602655", "0.5598478", "0.55876946" ]
0.0
-1
Take a snapshot of /proc/filecache.
def snapshot(condition = 'true') filecache = CachedFile.filecache read_filecache_index filecache @cfile_by_name.each_value do |cfile| if cfile.cached > 0 cfile.init_pages { |idx, len, state, refcnt| eval condition } end end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snapshot_filesystem\n mtimes = {}\n\n files = @files.map { |file| Dir[file] }.flatten.uniq\n\n files.each do |file|\n if File.exists? file\n mtimes[file] = File.stat(file).mtime\n end\n end\n\n mtimes\n end", "def cached_render_memory\n cache = Cache.actions\n options = cache_options\n store_options = {}\n key = full_path\n\n if options.respond_to?(:values_at)\n block, ttl = options.values_at(:key, :ttl)\n\n key = [full_path, block.call] if block\n store_options[:ttl] = ttl if ttl\n end\n\n cached_memory_process(cache, key, store_options)\n end", "def data_cache(fpath)\n (@data_caches ||= []) << fpath\n return fpath\n end", "def determine_private_dirty_rss(pid)\n total = 0\n File.read(\"/proc/#{pid}/smaps\").split(\"\\n\").each do |line|\n line =~ /^(Private)_Dirty: +(\\d+)/\n if $2\n total += $2.to_i\n end\n end\n if total == 0\n return nil\n else\n return total\n end\n rescue Errno::EACCES, Errno::ENOENT\n return nil\n end", "def read_filecache_index(filecache)\n CachedFile.reset_seq\n headers = []\n filecache.syswrite('ls')\n filecache.rewind\n filecache.each_line do |line|\n if line[0] == ?#\n headers = line.split\n headers.shift\n if headers[0] == 'filecache' then\n module_version = headers[1]\n end\n next\n end\n\n fields = {}\n tmp = line.split\n headers.each_index { |index| fields[headers[index]] = tmp[index] }\n\n file = fields['file']\n dev = fields['dev']\n next if file == '(noname)'\n if file.include? ?\\\\\n file.gsub! '\\011', \"\\011\" # ht\n file.gsub! '\\012', \"\\012\" # nl\n file.gsub! '\\040', \"\\040\" # sp\n file.gsub! '\\\\', \"\\\\\" # \\\n end\n\n if file =~ /\\([0-9a-f]{2}:[0-9a-f]{2}\\)/ then\n # handle block device\n # - transform file name from digital form to real ones\n fs = @@fstab[file.delete('(:)').hex]\n next unless fs\n file = fs.device_file\n dev = $BDEV_ID\n else\n # handle normal files\n # - expand file name to full path name\n # - ignore dirs/symlinks\n dev = dev[0,5].delete(':').hex\n fs = @@fstab[dev]\n next unless fs\n file = fs.mount_point + file unless fs.mount_point == '/'\n next unless File.file?(file)\n end\n\n cfile = CachedFile.new file\n cfile.dev = dev\n cfile.state = fields['state']\n cfile.ino = fields['ino'].to_i\n cfile.size = fields['size'].to_i\n cfile.cached = fields['cached'].to_i\n cfile.cachedp = fields['cached%'].to_i\n cfile.refcnt = fields['refcnt'].to_i\n cfile.process = fields['process']\n cfile.uid = fields['uid'].to_i\n cfile.accessed = fields['accessed'].to_i\n @cfile_by_name[file] = cfile\n end # filecache.each_line\n end", "def cache_read(cache_file)\n _data = nil\n File.open(cache_file, \"r\") do |cache_data|\n cache_data.flock(File::LOCK_EX)\n _data = cache_data.read\n cache_data.flock(File::LOCK_UN)\n end\n _data\n end", "def drop_caches\n # old habits die hard\n logger.info \" dropping caches\"\n 3.times { %x[ /bin/sync ] }\n File.open( \"/proc/sys/vm/drop_caches\", \"w\" ) do |f|\n f.puts 3\n end\n end", "def system_cache_file\n @sysetm_cache ||= File.join(Gem.dir, \"source_cache\")\n end", "def read_cache_file key\n f = File.open( cache_file(key), \"r\" )\n f.flock(File::LOCK_SH)\n out = f.read\n f.close\n return out\n end", "def file_cache(token, caching_time_in_minutes=30, &payload)\n file = file_name token\n if FileHelper.not_cached_or_to_old? file, caching_time_in_minutes\n load_from_file_cache file\n else\n write_to_file_cache file, (yield payload)\n end\n end", "def update_cache\n Rails.logger.debug \"Updating cache for... #{@@cache_file}\"\n fp = File.new(@@cache_file, 'w')\n if fp\n # acquire an exclusive lock (writer)\n if fp.flock(File::LOCK_EX)\n content = open(@@file_path).read\n \n if content\n #logger.debug \"Generate cache file: #{@@cache_file}\"\n fp.write(content) # writes to the file\n end\n \n fp.flock(File::LOCK_UN) # release a lock\n end\n fp.close\n end\n end", "def file_cache_path\n Chef::Config[:file_cache_path]\n end", "def stale?\n if config.cache.is_a?(Proc)\n proc_timestamp != mem_timestamp\n else\n file_timestamp != mem_timestamp\n end\n end", "def cached_command_output(command, cache_time = 86400)\n\n cache_directory = '/var/opt/lib/pe-puppet/facts/cached_command_output'\n Dir.mkdir cache_directory unless File.exist? cache_directory\n\n cache_file = cache_directory + '/' + command.gsub(\"/\", \"_\")\n\n if File.exist?(cache_file) && File.mtime(cache_file) > (Time.now - cache_time) then\n command_output = File.read(cache_file).chomp\n else\n command_output = %x{#{command}}\n f = File.open(cache_file, 'w')\n f.puts command_output\n f.close\n end\n\n return command_output\n\nend", "def disk_cache_enabled; end", "def cache\n @@cache ||= PStore.new(File.expand_path(@@cache_file))\n end", "def user_cache_file\n @user_cache ||=\n\tENV['GEMCACHE'] || File.join(Gem.user_home, \".gem/source_cache\")\n end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def flush_memos\n CACHE.clear\n end", "def cache_file\n @cache_file ||= File.join cache_dir, \"#{full_name}.gem\"\n end", "def uncache file \n refresh = nil\n begin\n is_a_file = F === file\n path = (is_a_file ? file.path : file.to_s) \n stat = (is_a_file ? file.stat : F.stat(file.to_s)) \n refresh = tmpnam(F.dirname(path))\n ignoring_errors do\n F.link(path, refresh) rescue F.symlink(path, refresh)\n end\n ignoring_errors do\n F.chmod(stat.mode, path)\n end\n ignoring_errors do\n F.utime(stat.atime, stat.mtime, path)\n end\n ignoring_errors do\n open(F.dirname(path)){|d| d.fsync}\n end\n ensure \n ignoring_errors do\n F.unlink(refresh) if refresh\n end\n end\n end", "def find_caches\n Dir.glob(File.join(@root, '**/*.cache')).reduce([]) { |stats, filename|\n stat = safe_stat(filename)\n # stat maybe nil if file was removed between the time we called\n # dir.glob and the next stat\n stats << [filename, stat] if stat\n stats\n }.sort_by { |_, stat| stat.mtime.to_i }\n end", "def cache\n @cache ||= Chef::Cache.new()\n end", "def get_cached(cache_key, proc, expiry_time = 5.minute)\n @data = Rails.cache.fetch(cache_key) || proc.call\n @data && Rails.cache.write(cache_key, @data, expires_in: expiry_time)\n\n @data\n end", "def cached_stored_files\n @cached_stored_files ||= storage.files\n end", "def cached_stats\n generate 'sufia:cached_stats'\n end", "def cache_file_path\n raise IOError.new 'Write permission is required for cache directory' unless File.writable?(@args[:cache_directory])\n \"#{@args[:cache_directory]}/#{Digest::SHA1.hexdigest((@args[:cache_ref] || @path).to_s + size.to_s + last_modified.to_s)}.cache\"\n end", "def cache!\n @@cache\n end", "def disable_disk_cache!; end", "def get_cached_gist(gist, file)\n return nil if @cache_disabled\n cache_file = get_cache_file_for gist, file\n File.read cache_file if File.exist? cache_file\n end", "def get_cache_file(key)\n _find_file_key(key)\n end", "def cache!(new_file)\n super\n @old_tmp_file = new_file\n end", "def cache!(new_file)\n super\n @old_tmp_file = new_file\n end", "def update\n download_page if cache_expired?\n read_cache\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def stash_perf( path, elapsed, timestamp )\n perf = find_perf( path )\n if perf\n perf.update( timestamp )\n return true\n end\n perf = create_perf( path, elapsed, timestamp )\n perfs[path] = perf\n false\n end", "def reserve\n FileUtils.touch(self.cache_dir + self.local_filename)\n end", "def read_cache_mtime key\n return nil unless File.exists?(cache_file(key))\n File.mtime( cache_file(key) )\n end", "def cache_file\n File.join(Rscons.application.build_dir, \".rsconscache\")\n end", "def write_cache\n data = cache_data\n open(writable_file, \"wb\") do |f|\n\tf.puts Marshal.dump(data)\n end\n end", "def write_cache(cache, path)\n if @use_cache then\n File.open path, \"wb\" do |cache_file|\n Marshal.dump cache, cache_file\n end\n end\n\n cache\n rescue Errno::EISDIR # HACK toplevel, replace with main\n cache\n end", "def flush\n File.open(\"data/#{Time.now.to_i.to_s}\",'w') { |f| Marshal.dump(@cache, f) }\n File.open(\"data2/#{Time.now.to_i.to_s}\",'w') { |f| Marshal.dump(@cache, f) }\n puts \"=\"\n end", "def cache!( new_file )\n super\n @old_tmp_file = new_file\n end", "def cache\n # Do a deep copy\n Marshal.load(Marshal.dump(@@cache))\n end", "def reset_cache\n Facter.debug('Resetting Facter cache')\n\n # We just create the directory and let Puppet fix the permissions.\n dir = File::dirname(@cache_path)\n FileUtils::mkdir_p(dir) unless Dir.exists?(dir)\n\n lock(@cache_path) do\n FileUtils.safe_unlink(@cache_path)\n end\n\n @cached_facts_data = {}\n end", "def refresh_cache\n @cache = build_cache\n end", "def cache\n env[CACHE] ||= Hash.new {|hash, sha| hash[sha] = read(sha) }\n end", "def cache\n store = Moneta.new :File, dir: 'moneta'\n Cachy.cache_store = store\n Cachy\n end", "def cache_file key\n File.join( store, key+\".cache\" )\n end", "def memory_usage\n return File.read('/proc/self/status').match(/VmRSS:\\s+(\\d+)/)[1].to_i * 1024\nend", "def cache_dir\n '/var/cache'\n end", "def cache_dir\n '/var/cache'\n end", "def cache_file_path\n File.join @homepath, 'cache'\n end", "def warm_cache(target_files); end", "def cache_path\n File.join @path, 'cache.ri'\n end", "def read_cache\n @cache_file = select_cache_file\n begin\n\topen(@cache_file, \"rb\") { |f| load_local_cache(f) } || {}\n rescue StandardError => ex\n\t{}\n end\n end", "def page_cache_file(url)\n ActionController::Base.send :page_cache_file, url.gsub(/^https?:\\/\\//, '')\n end", "def writable_file\n @cache_file\n end", "def cache(gist, file, data)\n cache_file = get_cache_file_for gist, file\n File.open(cache_file, \"w\") do |io|\n io.write data\n end\n end", "def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end", "def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end", "def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end", "def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end", "def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end", "def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end", "def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end", "def cache\n if self.cache_store\n self.cache_store\n else\n self.cache_store = :file_store, root.join(\"tmp\").to_s\n self.cache_store\n end\n end", "def memo\n return @memo_file\n end", "def cache\n @cache ||= {}\n end", "def memmap\n pid = $$\n f= File.open \"/proc/#{pid}/cmdline\"\n cmd= f.read.split \"\\0\" \n f= File.open \"/proc/#{pid}/maps\"\n\n stack = heap = nil\n data = Array.new\n f.each_line do |line|\n data << line.split(' ').first.split('-') if line.match cmd.first\n stack = line.split(' ').first.split('-') if line.match \"stack\"\n heap = line.split(' ').first.split('-') if line.match \"heap\"\n end\n\n unless data.empty?\n @data= data.map do |a|\n a= a.map do |e|\n e.to_i(16)\n end\n end\n end\n\n unless stack.nil?\n @stack= stack.map do |e|\n e.to_i(16)\n end\n end\n\n unless heap.nil?\n @heap= heap.map do |e|\n e.to_i(16)\n end\n end\n\n end", "def snapshotInfo(_refresh = false)\n sni = nil\n @cacheLock.synchronize(:SH) do\n sni = @invObj.dupObj(snapshotInfo_locked)\n end\n (sni)\n end", "def cache\n DataCache\n end", "def get(file)\n binding.pry\n #return the values from cached first\n @cached[file] || \n @file_metadata[file] || \n read_metadata_from_yaml(file) || \n cache(file, read_metadata_from_disk(file)) \n end", "def refill\n now = Time.now.to_i\n cache_set.each {|rec|\n ttl = rec[:end_ts].to_i - now\n cache_write( rec[:key], rec[:value], ttl ) if ttl > 0 \\\n if rec[:value] and rec[:value].length > MAX_OBJ_SIZE and ttl > 0\n }\n end", "def delete_cache_files; end", "def delete_cache_files; end", "def pid_memory\n file_format.pids[self[:pid]] ||= { :last_memory_reading => -1, :current_memory_reading => -1 }\n end", "def get_timer_cache_file\n @log_file || File.expand_path('~') + '/lightwaverf-timer-cache.yml'\n end", "def cache_store; end", "def cache_store; end", "def view_timestamp(file)\n\t#stamp = commandz(\"stat #{file}\")\n\t#if not stamp.empty?\n\t#\tputs \"#{FGRN}Current Time Stamp for #{HC}#{FWHT}: #{file.chomp}#{RS}\"\n\t#\tstamp.each { |x| puts \"#{FWHT}#{x.chomp}#{RS}\" }\n\t#end\n\n\t# Now we do it with just pure ruby :)\n\t#Stat our target file so we can enumerate all the info normal stat command might show.....\n\tfoo = File.stat(file)\n\tputs \"#{HC}#{FGRN}File#{FWHT}: #{file}\\t#{FGRN}Type#{FWHT}: #{foo.ftype}#{RS}\"\n\tputs \"#{HC}#{FGRN}Size#{FWHT}: #{foo.size}\\t#{FGRN}Blocks#{FWHT}: #{foo.blocks}\\t#{FGRN}IO Blocks#{FWHT}: #{foo.blksize}#{RS}\"\n\tputs \"#{HC}#{FGRN}Dev#{FWHT}: #{foo.dev}\\t#{FGRN}Inode#{FWHT}: #{foo.ino}\\t#{FGRN}Links#{FWHT}: #{foo.nlink}#{RS}\"\n\tputs \"#{HC}#{FGRN}Access#{FWHT}: #{sprintf(\"%o\", foo.mode)}\\t#{FGRN}UID#{FWHT}: #{foo.uid}\\t#{FGRN}GID#{FWHT}: #{foo.gid}#{RS}\"\n\tputs \"#{HC}#{FGRN}Access Time#{FWHT}: #{foo.atime}#{RS}\"\n\tputs \"#{HC}#{FGRN}Modify Time#{FWHT}: #{foo.mtime}#{RS}\"\n\tputs \"#{HC}#{FGRN}Change Time#{FWHT}: #{foo.ctime}#{RS}\"\n\tputs\nend", "def load_cache\n @load_cache\n end", "def cache\n @cache ||= begin\n if @old_commit_oid == @commit_oid\n @old_stats\n else\n compute_stats(@old_commit_oid, @old_stats)\n end\n end\n end", "def cache_dir; end", "def cache_dir; end", "def load_from_file_cache(file)\n puts \"loading stuff from #{file}\"\n File.open(file, 'r') do |input|\n Marshal.load(input.read)\n end\n end", "def now_at_fs_resolution\n test_filename = \"#{Dir.pwd}/deleteme\"\n FileUtils.touch test_filename\n File.atime(test_filename)\nend", "def cached_wget(url, override_cache=false)\n\tputs \" Fetching #{url}\"\n\tcache_file_name = File.join CACHE_DIR, Digest::MD5.hexdigest(url)\n\tif override_cache or not File.exists? cache_file_name\n\t\tFile.open(cache_file_name, 'w') do |cache_file| \n\t\t\topen(url) do |remote_file|\n\t\t\t\tremote_file.each_line do |remote_line| \n\t\t\t\t\tcache_file.puts remote_line\n\t\t\t\tend\n\t\t\tend\n\t\tend \n\t\tputs \" (downloaded fresh copy to #{cache_file_name})\"\n\telse\n\t\tputs \" (loaded from cache #{cache_file_name})\"\n\tend\n\tcache_file_name\nend", "def local_cache(basebox_name)\n cache_dir = Vagrant::Environment.new.home_path.join('cache', 'apt', basebox_name)\n # Vagrant::Environment.new.home_path\n print cache_dir\n cache_dir.mkpath unless cache_dir.exist?\n partial_dir = cache_dir.join('partial')\n partial_dir.mkdir unless partial_dir.exist?\n cache_dir\nend", "def file_digest(path)\n if stat = self.stat(path)\n # Caveat: Digests are cached by the path's current mtime. Its possible\n # for a files contents to have changed and its mtime to have been\n # negligently reset thus appearing as if the file hasn't changed on\n # disk. Also, the mtime is only read to the nearest second. Its\n # also possible the file was updated more than once in a given second.\n cache.fetch(['file_digest', path, stat.mtime.to_i]) do\n if stat.directory?\n # If its a directive, digest the list of filenames\n digest_class.digest(self.entries(path).join(','))\n elsif stat.file?\n # If its a file, digest the contents\n digest_class.file(path.to_s).digest\n end\n end\n end\n end", "def [](key)\n File.read(cache_path(key))\n rescue Errno::ENOENT\n nil\n end" ]
[ "0.58968955", "0.5805835", "0.58024514", "0.5715185", "0.56952596", "0.5673774", "0.5643448", "0.5602026", "0.55706", "0.55423516", "0.5524746", "0.55000186", "0.54993767", "0.5496851", "0.5496111", "0.5492397", "0.5485572", "0.5474943", "0.5474943", "0.5474943", "0.5474943", "0.5474943", "0.5474943", "0.5474943", "0.54714227", "0.54559165", "0.5430459", "0.5423173", "0.5394616", "0.53839076", "0.5382139", "0.5380782", "0.5364782", "0.5359751", "0.5342301", "0.5341123", "0.5336851", "0.5336223", "0.5336223", "0.53348243", "0.53237265", "0.53237265", "0.53237265", "0.53237265", "0.5322745", "0.53175277", "0.52940154", "0.5283121", "0.5258665", "0.5248078", "0.5247883", "0.5239552", "0.5230675", "0.52274656", "0.52248615", "0.5215089", "0.51867276", "0.5181566", "0.51793516", "0.5175483", "0.5175483", "0.51751554", "0.51675606", "0.5166679", "0.51611155", "0.51605606", "0.5156025", "0.51322603", "0.5121773", "0.5121773", "0.5121773", "0.5121773", "0.5121773", "0.5121773", "0.5121773", "0.51200914", "0.5119238", "0.5097821", "0.5086305", "0.5085115", "0.5080813", "0.50787956", "0.50670874", "0.5066569", "0.5066569", "0.5060706", "0.5053602", "0.5053412", "0.5053412", "0.50514185", "0.50498766", "0.5045884", "0.50371003", "0.50371003", "0.5036525", "0.5029023", "0.50263405", "0.502589", "0.5025634", "0.50209236" ]
0.57338977
3
get the cached file list from /proc/filecache.
def read_filecache_index(filecache) CachedFile.reset_seq headers = [] filecache.syswrite('ls') filecache.rewind filecache.each_line do |line| if line[0] == ?# headers = line.split headers.shift if headers[0] == 'filecache' then module_version = headers[1] end next end fields = {} tmp = line.split headers.each_index { |index| fields[headers[index]] = tmp[index] } file = fields['file'] dev = fields['dev'] next if file == '(noname)' if file.include? ?\\ file.gsub! '\011', "\011" # ht file.gsub! '\012', "\012" # nl file.gsub! '\040', "\040" # sp file.gsub! '\\', "\\" # \ end if file =~ /\([0-9a-f]{2}:[0-9a-f]{2}\)/ then # handle block device # - transform file name from digital form to real ones fs = @@fstab[file.delete('(:)').hex] next unless fs file = fs.device_file dev = $BDEV_ID else # handle normal files # - expand file name to full path name # - ignore dirs/symlinks dev = dev[0,5].delete(':').hex fs = @@fstab[dev] next unless fs file = fs.mount_point + file unless fs.mount_point == '/' next unless File.file?(file) end cfile = CachedFile.new file cfile.dev = dev cfile.state = fields['state'] cfile.ino = fields['ino'].to_i cfile.size = fields['size'].to_i cfile.cached = fields['cached'].to_i cfile.cachedp = fields['cached%'].to_i cfile.refcnt = fields['refcnt'].to_i cfile.process = fields['process'] cfile.uid = fields['uid'].to_i cfile.accessed = fields['accessed'].to_i @cfile_by_name[file] = cfile end # filecache.each_line end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_files\n Dir.glob(File.join(@cache_dir, '*'))\n .map{|f| f.gsub(/#{@cache_dir}\\/?/, '')}\n .sort\n end", "def find_caches\n Dir.glob(File.join(@root, '**/*.cache')).reduce([]) { |stats, filename|\n stat = safe_stat(filename)\n # stat maybe nil if file was removed between the time we called\n # dir.glob and the next stat\n stats << [filename, stat] if stat\n stats\n }.sort_by { |_, stat| stat.mtime.to_i }\n end", "def cache_file_list_path\n File.join config.config_dir, 'file_cache'\n end", "def all_cache_files\n cache_incompletes + cache_completes\n end", "def data_cache(fpath)\n (@data_caches ||= []) << fpath\n return fpath\n end", "def cached_stored_files\n @cached_stored_files ||= storage.files\n end", "def data_caches\n (@data_caches || [])\n end", "def content_files\n @cache_content_files ||= cached_datafiles.reject { |df| sip_descriptor == df }\n end", "def file_list\n @file_list\n end", "def local_gems\n %x(ls #{local_cache_path}).split(/\\s+/)\n end", "def files\n cached = FileAttachment.list_cache\n files = cached.select{|f|f.post_id == id}\n end", "def get_list_of_files\n\t\t@list_of_files = Dir.entries(@wallpaper_dir) \n\tend", "def listFileHashes\n return contentHost.listFileHashes(baseDir)\n end", "def read_cache\n @cache_file = select_cache_file\n begin\n\topen(@cache_file, \"rb\") { |f| load_local_cache(f) } || {}\n rescue StandardError => ex\n\t{}\n end\n end", "def file_cache_path\n Chef::Config[:file_cache_path]\n end", "def get_cache_path_names\n if File.exists?(CachedAssetPackager::Config.send(\"#{self.asset_type}_cache_path_config\"))\n @cache_path_names = YAML::load(File.read(CachedAssetPackager::Config.send(\"#{self.asset_type}_cache_path_config\")))\n else\n @cache_path_names = {}\n each_file_set(:cache_path_name)\n write_cache_path_file\n end\n end", "def file_list(nginx_log_path)\n list=[]\n list.push(nginx_log_path)\n file_1hour_ago=\"#{nginx_log_path}.#{(Time.now-3600).strftime(\"%Y%m%d%H\").to_s}\"\n list.push(file_1hour_ago) if File.exist?(file_1hour_ago)\n list\n end", "def get_files\n\tstart_dir = C_start_dir\n\tstart_dir += \"/\" if start_dir[-1..-1] != \"/\"\n\n\t# collect all file names recursively\n\tres = Dir.glob(\"#{start_dir}**/*\", File::FNM_DOTMATCH)\n\n\t# remove excluded dirs\n\tC_exclude_dir.each{|d| res = res.select{|x| not x[/^#{start_dir}#{d}\\//]} }\n\n\t# get db mod time for compare\n\tt = test_file(db_name) ? File.mtime(db_name).to_s[/[0-9]+\\-[0-9]+\\-[0-9]+\\ *[0-9]+\\:[0-9]+\\:[0-9]+/] : \"\"\n\n\t# remove files from os update\n\n\t# -------------------\n\t# --- dpkg plugin ---\n\t# -------------------\n\t# collect package names changed by os update from dpkg.log\n\td1 = Dir[\"/var/log/dpkg.log*.gz\"]\n\td2 = Dir[\"/var/log/dpkg.log*\"] - d1\n\tlog = \"\"\n\td1.each{|f| log += gunzip(f) }\n\td2.each{|f| log += File.read(f) }\n\t# find package name entries more recent than our db\n\tpkg = log.split(\"\\n\").sort.select{|x|x > t}.select{|x| x[/status *installed/]}.map{|x|x[/status *installed *[^\\:]+/].split[2]} - [\"man-db\"]\n\t# collect file names of all these package names\n\tlist = []\n\tpkg.sort.uniq.each {|x|\n\t\tDir.glob(\"/var/lib/dpkg/info/#{x}*.list\") {|y|\n\t\t\tlist << File.read(y).split(\"\\n\").select{|z| test_file(z)}\n\t\t}\n\t}\n\t# remove list to recursive dir list\n\tres -= list.sort.uniq\n\n\treturn [res, pkg]\nend", "def described_datafiles\n if sip_descriptor\n sip_paths = sip_descriptor_datafile_info.keys\n\n cached_datafiles.inject([]) do |acc, df|\n sp = df['sip-path']\n acc << df if sip_descriptor_datafile_info.has_key? sp\n acc\n end\n\n else\n []\n end\n end", "def get_file_listing\n execute!(drive.files.list).data\n end", "def build_cache\n []\n end", "def get_cache_file(key)\n _find_file_key(key)\n end", "def build_cache\n all_files = []\n\n Find.find(@root) do |path|\n if FileTest.directory?(path)\n if File.basename(path)[0] == ?.\n Find.prune\n else\n next\n end\n else\n path.slice!(\"#{@root}/\")\n all_files << path\n end\n end\n\n return all_files\n end", "def read_cache_file key\n f = File.open( cache_file(key), \"r\" )\n f.flock(File::LOCK_SH)\n out = f.read\n f.close\n return out\n end", "def files\n array = []\n @list.each do |k,v|\n array += v.filename\n end\n array\n end", "def load_cache\n @list = YAML::load_file Settings[:cache_file]\n end", "def list\n @file_list.to_a\n end", "def files\n @files ||= []\n end", "def get_api_cache\n Rails.logger.debug \"get api file cache - #{@@cache_file}, exist?... #{File.exist?(@@cache_file)}\" if $DEBUG == true\n \n a=Time.new.to_i\n \n if File.exist?(@@cache_file)\n b=File.ctime(@@cache_file).to_i\n else\n b=0\n end\n c=a-b\n Rails.logger.debug \"Cache File.ctime(@@cache_file)... #{b}\" if $DEBUG == true\n Rails.logger.debug \"if #{!File.exist?(@@cache_file)} or #{c} > #{@@update_interval}...\" if $DEBUG == true\n\n if !File.exist?(@@cache_file) or c > @@update_interval\n Rails.logger.debug \"file cache does not exist or not up to date...\" if $DEBUG == true\n self.update_cache()\n end\n Rails.logger.debug \"cache get contents...\" if $DEBUG == true\n return self.get_cache_content\n end", "def file_path\n Dir.glob(config.cache).first || File.join(File.dirname(config.cache),\n File.basename(config.cache).gsub(/_.+\\.txt/, '_0.txt'))\n end", "def get_cached_forums\n #values = Dir.glob(\"*.yml\").map{|a| a.sub(\".yml\",\"\").gsub(\"__\",\"/\"); }\n cp = File.expand_path $cache_path\n values = Dir.entries(cp).grep(/\\.yml$/).map{|a| a.sub(\".yml\",\"\").gsub(\"__\",\"/\"); }\nend", "def get_file_load_list\n json_file_path = File.join(SDESK_ROOT_PATH, 'configs', 'file_list.json')\n json_data = load_json_file json_file_path\n return [] unless json_data\n\n flist_arr = []\n json_data.each_pair do |dir_name, file_h|\n file_h.each_pair do |fname, queue_id|\n flist_arr << [File.join(dir_name, fname+'.rb'), queue_id]\n end\n end\n flist_arr.sort_by!{|arr| arr.last}\n flist_arr.map(&:first)\n end", "def file_list\n end", "def cache_found\n found = true\n\n Open3.popen3('klist') do |stdin, stdout, stderr|\n found = false unless stderr.gets.nil?\n end\n\n found\n end", "def list_files\n [].tap do |files|\n remote_files do |file|\n files << file\n end\n end\n end", "def cache\n @cache ||= Chef::Cache.new()\n end", "def get(file)\n binding.pry\n #return the values from cached first\n @cached[file] || \n @file_metadata[file] || \n read_metadata_from_yaml(file) || \n cache(file, read_metadata_from_disk(file)) \n end", "def cache_read(cache_file)\n _data = nil\n File.open(cache_file, \"r\") do |cache_data|\n cache_data.flock(File::LOCK_EX)\n _data = cache_data.read\n cache_data.flock(File::LOCK_UN)\n end\n _data\n end", "def [](key)\n File.read(cache_path(key))\n rescue Errno::ENOENT\n nil\n end", "def get(keys)\n log(\"get :Cache, #{keys.inspect}\")\n connection.multi_get(:Cache, Array(keys)).values.map { |v| v['blob'] }\n end", "def list\n BakFile.where('saved = ?', true).each do |file|\n Log.instance.info(\"#{file.fid},#{file.dkey},#{file.length},#{file.classname}\")\n break if SignalHandler.instance.should_quit\n end\n end", "def get_all_image_cache_paths\n page_cache_directory = ActionController::Base.page_cache_directory.to_s\n page_cache_directory = page_cache_directory.split('/').join('/')\n paths = Dir.glob(\"#{page_cache_directory}#{GLOBAL_CONFIG[:location_images_cache_dir]}/\" +\n \"#{self.url_directory}/#{self.id}/**/*.*\".gsub('//', '/'))\n return paths.map{|p| p.gsub(/^#{page_cache_directory}/, '')}\n end", "def snapshot_filesystem\n mtimes = {}\n\n files = @files.map { |file| Dir[file] }.flatten.uniq\n\n files.each do |file|\n if File.exists? file\n mtimes[file] = File.stat(file).mtime\n end\n end\n\n mtimes\n end", "def get_current_files\n get_files(OcflTools::Utils.version_string_to_int(@head))\n end", "def read_files(file_path)\n\tlist=Dir.entries(file_path)\n\treturn list\nend", "def files\n entries.map(&:filepath)\n end", "def list\n ret = get()\n return [] if ret.is_a? Hash and ret.has_key? :error\n ret.map{|i| FileItem.new(i)}\n end", "def list\n Enumerator.new do |y|\n Dir.foreach(@path) do |de| file = File.basename(de)\n (file =~ IP_RE) && (value = self[file]) && (y << [file, value])\n end\n end\n end", "def getCachedContentTreeMapOfHashes\n #N Without this, we won't know the name of the specified cached content file (if it is specified)\n file = getExistingCachedContentTreeFile\n #N Without this check, we would attempt to read a non-existent file\n if file\n #N Without this, there won't be feedback to the user that we are reading the cached file hashes\n puts \"Reading cached file hashes from #{file} ...\"\n #N Without this, a map of cached file hashes won't be returned\n return ContentTree.readMapOfHashesFromFile(file)\n else\n #N Without this, the method wouldn't consistently return an array of timestamp + map of hashes in the case where there is no cached content file\n return [nil, {}]\n end\n end", "def files\n return get_result('files')\n end", "def cache\n @cache ||= {}\n end", "def files\n FileList.new(`#@native.files`)\n end", "def cache\n @@cache ||= PStore.new(File.expand_path(@@cache_file))\n end", "def cache_dir\n '/var/cache'\n end", "def cache_dir\n '/var/cache'\n end", "def get key\n if key.is_a? Array\n ret = {}\n key.each do |k|\n ret[k] = Marshal::load(read_cache_file(k)) unless expired?(k)\n end\n\n raise if ret.empty?\n return ret\n end\n\n raise if expired?(key)\n\n return Marshal::load(read_cache_file(key))\n rescue\n raise Diskcached::NotFound\n ensure\n flush_expired if gc_auto\n end", "def get_files_by_mtime dir='*'\n gfb dir, :mtime\nend", "def cache_path\n return @cache_resources unless @cache_resources.nil?\n\n @cache_resources = Chef::Resource::Directory.new(::File.join(new_resource.cache_path), run_context)\n @cache_resources.recursive(true)\n\n return @cache_resources\n end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= {}\n end", "def load_cached\n content = File.open(self.cache_file_name, \"rb\") { |f| f.read }\n puts(\"[MODEL_FILE] Loaded #{self.cache_file_name} from cache\")\n return content\n end", "def listFiles()\n #N Without this the files won't get listed\n contentHost.listFiles(baseDir)\n end", "def metadata_files\n return @metadata_files unless @metadata_files.nil?\n @metadata_files = MetadataFile.all\n @existing_files, @new_files = [], []\n @metadata_files.each do |f|\n if f.cached?\n @existing_files << f\n else\n @new_files << f\n end\n end\n end", "def cached_references\n @cached_references ||= []\n end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= {}\n end", "def list_files\n files = remote_directory.files.map { |file| file.key }\n\n # The first item in the array is only the path an can be discarded.\n files = files.slice(1, files.length - 1) || []\n\n files\n .map { |file| Pathname.new(file).basename.to_s }\n .sort\n .reverse\n end", "def [](key)\n\thash = hash(key)\n\n\tvalue = nil\n\tif File.exist?(File.join(@cache_dir, hash))\n\t value = ''\n\t File.open(File.join(@cache_dir, hash), 'rb') { |f|\n\t\tvalue += f.read\n\t }\n\tend\n\n\treturn value\n end", "def cache_file_path\n File.join @homepath, 'cache'\n end", "def list\n factory.system.list(@path).collect do |item|\n candidate = dir(item)\n if (not candidate.exists?)\n candidate = file(item)\n end\n candidate\n end\n end", "def list_files_from path,opts = {}\n unless Dir.exists? path\n Logger.<<(__FILE__,\"ERROR\",\"Local fetcher: path does not exists for listing... #{path} \")\n raise \"Error LocalFileFetcher !\"\n end\n if opts[:directories]\n cmd = \"ls -td #{path}/*/\"\n else\n cmd = \"ls #{path}\"\n cmd += \"/#{opts[:regexp]}\" if opts[:regexp]\n end\n out = `#{cmd}`\n return out.split(\"\\n\")\n end", "def files(id=nil, &block)\n return @ruhoh.cache.get(files_cache_key) if @ruhoh.cache.get(files_cache_key)\n\n dict = _all_files\n dict.keep_if do |id, pointer|\n block_given? ? yield(id, self) : valid_file?(id)\n end\n\n @ruhoh.cache.set(files_cache_key, dict)\n dict\n end", "def all_files\n return manifest_entry.files\n end", "def get_stored_paths\n redis.smembers stored_paths_key\n end", "def cache\n @cache ||= build_cache\n end", "def get_app_file_list()\n if !File.directory?($itunes_dir) and !File.symlink?($itunes_dir)\n puts \"Could not find iTunes directory \"+$itunes_dir\n exit\n end\n app_dir = $itunes_dir+\"/iTunes Media/Mobile Applications\"\n if !File.directory?(app_dir) and !File.symlink?(app_dir)\n puts \"Could not find Mobile Applications directory \"+app_dir\n exit\n end\n file_list = Dir.entries(app_dir)\n return file_list\nend", "def file_path_list\n @file_path_list ||= self.class.default_file_path_list\n end", "def cache\n DataCache\n end", "def read_from_cache\n if config.cache.is_a?(Proc)\n config.cache.call(nil)\n elsif (config.cache.is_a?(String) || config.cache.is_a?(Pathname)) &&\n File.exist?(file_path)\n open(file_path).read\n end\n end", "def write_file_list\n if EventMachine.reactor_thread? || !@update_lock.locked?\n raise 'Should not write file list in reactor thread or without' \\\n ' the local list lock!'\n end\n\n FileUtils.mkdir_p config.config_dir\n @local_file_list.root['CID'] = SecureRandom.hex(12).upcase\n output = @local_file_list.to_s(:indent => true)\n Bzip2::Writer.open(local_file_list_path, 'wb') { |f| f << output }\n @share_size = nil\n\n output = Marshal.dump([@local_file_info, @shared_directories])\n File.open(cache_file_list_path, 'wb'){ |f| f << output }\n end", "def open_files\n `lsof -p #{Process.pid} -F n`.split(/\\n/).sort\n end", "def create_cache_files\n @cache_path_names = {}\n each_file_set(:create_cache_file)\n write_cache_path_file\n end", "def files\n @files ||= {}\n end", "def filelist\n @filelist ||= begin\n list = common_filelist(super) # Always pick up the parent list\n list\n end\n end", "def fslistf(name)\n if fexistf name\n return eval \"$#{name}['#{name},set'].to_a\"\n else\n return []\n end\nend", "def get_all_image_cache_paths\n page_cache_directory = ActionController::Base.page_cache_directory.to_s\n page_cache_directory = page_cache_directory.split('/').join('/')\n all_irs_keys = IMAGE_RENDER_SIZES.values.map{|v| v.keys}.flatten.uniq.join(',')\n paths = Dir.glob(\"#{page_cache_directory}#{GLOBAL_CONFIG[:coupon_merchant_images_cache_dir]}/\" +\n \"{#{IMAGE_TYPES.join(',')}}/{#{all_irs_keys}}/\" +\n \"#{self.url_directory}/#{self.id}.*\".gsub('//', '/'))\n return paths.map{|p| p.gsub(/^#{page_cache_directory}/, '')}\n end", "def all_files\n @files_hash.values\n end", "def read_cache_file()\n #\n # Update to Google Domains may be forced by forgetting cached\n # values. This is controlled by the [-u|--force_update] option\n #\n if options[:force_update]\n if File.exists?(options[:cache_file])\n File.delete(options[:cache_file])\n end\n end\n\n #\n # Load the cache file\n #\n return File.exists?(options[:cache_file]) ? YAML.load_file(options[:cache_file]) : {}\n end", "def disk_cache_enabled; end", "def cache_path\n File.join @path, 'cache.ri'\n end", "def cache_dir; end", "def cache_dir; end", "def files\n @exported_pr_dir ? Dir.glob(@exported_pr_dir) : []\n end", "def system_cache_file\n @sysetm_cache ||= File.join(Gem.dir, \"source_cache\")\n end", "def get_files(version)\n my_state = get_state(version)\n my_files = {}\n\n my_state.each do |digest, filepaths| # filepaths is [Array]\n filepaths.each do |logical_filepath|\n # look up this file via digest in @manifest.\n physical_filepath = @manifest[digest]\n # physical_filepath is an [Array] of files, but they're all the same so only need 1.\n my_files[logical_filepath] = physical_filepath[0]\n end\n end\n my_files\n end", "def cache\n @cache ||= MemoryCache.new\n end", "def cache_files(dir, files, cache_file)\n cache_content = files.collect do |f|\n File.read(File.join(dir, f))\n end .join(\"\\n\\n\")\n\n cache_path = File.join(dir, cache_file)\n File.delete(cache_path) if File.exists?(cache_path)\n File.open(cache_path, 'w+') { |f| f.write(cache_content) }\n end", "def linux_processes\n\t\tlist = []\n\t\t::Dir[\"/proc/*/stat\"].select { |file| file =~ /\\/proc\\/\\d+\\// }.each do |file|\n\t\t\tbegin\n\t\t\t\tlist << read_proc_file(file)\n\t\t\trescue\n\t\t\t\t# process died between the dir listing and accessing the file\n\t\t\tend\n\t\tend\n\t\tlist\n\tend", "def linux_processes\n\t\tlist = []\n\t\t::Dir[\"/proc/*/stat\"].select { |file| file =~ /\\/proc\\/\\d+\\// }.each do |file|\n\t\t\tbegin\n\t\t\t\tlist << read_proc_file(file)\n\t\t\trescue\n\t\t\t\t# process died between the dir listing and accessing the file\n\t\t\tend\n\t\tend\n\t\tlist\n\tend", "def filenames\n file_stats.map(&:filename)\n end" ]
[ "0.7370528", "0.7268852", "0.7172068", "0.6951984", "0.68737113", "0.64663565", "0.6286145", "0.6278183", "0.62148064", "0.62046677", "0.61141175", "0.60531807", "0.60452783", "0.60034126", "0.59824866", "0.5980867", "0.5967219", "0.59614074", "0.59545743", "0.59450203", "0.5937836", "0.5917919", "0.580608", "0.57957566", "0.5792801", "0.5768865", "0.576386", "0.57488656", "0.5739859", "0.5730771", "0.5729411", "0.5727181", "0.5725393", "0.57251", "0.5719149", "0.57079923", "0.57025415", "0.5687666", "0.56658506", "0.566129", "0.56607115", "0.5653668", "0.56511265", "0.56505275", "0.5648315", "0.5646349", "0.56397396", "0.56317145", "0.5622398", "0.56207925", "0.55936754", "0.5588159", "0.5584852", "0.55770576", "0.55770576", "0.55696917", "0.5563784", "0.55574536", "0.5545247", "0.5545247", "0.5522684", "0.5522561", "0.55139387", "0.55098253", "0.54904735", "0.54904735", "0.5486414", "0.5482729", "0.5480909", "0.5479855", "0.54767853", "0.54731274", "0.546991", "0.5468352", "0.5459855", "0.5457587", "0.54495853", "0.5446095", "0.5431187", "0.54300106", "0.54246664", "0.54236394", "0.54232967", "0.5419948", "0.5419818", "0.5419104", "0.54004395", "0.5378896", "0.5370187", "0.53630495", "0.5362177", "0.5362177", "0.53602546", "0.53589433", "0.53567487", "0.5351952", "0.53496385", "0.53391916", "0.53391916", "0.533769" ]
0.66212994
5
Load the presaved snapshot of /proc/filecache from a file or dir
def load(path) if File.file? path load_file path elsif File.directory? path Dir.foreach(path) do |file| file = "#{path}/#{file}" next unless File.stat(file).file? load_file file end else $stderr.puts "#{path} not a file or directory." exit 1 end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_from_file_cache(file)\n puts \"loading stuff from #{file}\"\n File.open(file, 'r') do |input|\n Marshal.load(input.read)\n end\n end", "def data_cache(fpath)\n (@data_caches ||= []) << fpath\n return fpath\n end", "def load_local_cache\n return nil unless File.exists?(LOCAL_CACHE_PATH)\n yaml = File.read(LOCAL_CACHE_PATH)\n YAML.load(yaml)\n end", "def read_from_cache\n if config.cache.is_a?(Proc)\n config.cache.call(nil)\n elsif (config.cache.is_a?(String) || config.cache.is_a?(Pathname)) &&\n File.exist?(file_path)\n open(file_path).read\n end\n end", "def load_cache_for(klassname)\n path = cache_file_for klassname\n\n cache = nil\n\n if File.exist? path and\n File.mtime(path) >= File.mtime(class_cache_file_path) and\n @use_cache then\n open path, 'rb' do |fp|\n begin\n cache = Marshal.load fp.read\n rescue\n #\n # The cache somehow is bad. Recreate the cache.\n #\n $stderr.puts \"Error reading the cache for #{klassname}; recreating the cache!\"\n cache = create_cache_for klassname, path\n end\n end\n else\n cache = create_cache_for klassname, path\n end\n\n cache\n end", "def load\n if File.exist?(@file_path)\n\n @_cache = JSON File.open(@file_path, &:read).strip\n else\n $stderr.puts \"#{@file_path} does not exist\"\n end\n end", "def load_cache\n @load_cache\n end", "def load_cache\n @list = YAML::load_file Settings[:cache_file]\n end", "def load_cached\n content = File.open(self.cache_file_name, \"rb\") { |f| f.read }\n puts(\"[MODEL_FILE] Loaded #{self.cache_file_name} from cache\")\n return content\n end", "def cache\n @@cache ||= PStore.new(File.expand_path(@@cache_file))\n end", "def read_cache\n @cache_file = select_cache_file\n begin\n\topen(@cache_file, \"rb\") { |f| load_local_cache(f) } || {}\n rescue StandardError => ex\n\t{}\n end\n end", "def user_cache_file\n @user_cache ||=\n\tENV['GEMCACHE'] || File.join(Gem.user_home, \".gem/source_cache\")\n end", "def cache_read(cache_file)\n _data = nil\n File.open(cache_file, \"r\") do |cache_data|\n cache_data.flock(File::LOCK_EX)\n _data = cache_data.read\n cache_data.flock(File::LOCK_UN)\n end\n _data\n end", "def file_cache(token, caching_time_in_minutes=30, &payload)\n file = file_name token\n if FileHelper.not_cached_or_to_old? file, caching_time_in_minutes\n load_from_file_cache file\n else\n write_to_file_cache file, (yield payload)\n end\n end", "def cache_file\n @cache_file ||= File.join cache_dir, \"#{full_name}.gem\"\n end", "def get(key)\n unless @store[key].present?\n path = path_for_key(key)\n if File.exists?(path)\n begin\n data = File.open(path, 'r') { |f| Marshal.load(f) }\n @store[key] = data\n rescue Exception => e\n Honeybadger.notify(\"Something went wrong reading RSSCache file from disk: #{path} #{e}\")\n end\n end\n end\n @store[key]\n end", "def cache_file key\n File.join( store, key+\".cache\" )\n end", "def get_cache_file(key)\n _find_file_key(key)\n end", "def get_cached_gist(gist, file)\n return nil if @cache_disabled\n cache_file = get_cache_file_for gist, file\n File.read cache_file if File.exist? cache_file\n end", "def get(file)\n binding.pry\n #return the values from cached first\n @cached[file] || \n @file_metadata[file] || \n read_metadata_from_yaml(file) || \n cache(file, read_metadata_from_disk(file)) \n end", "def get_data(key) \n filename = _find_file_key(key)\n return nil if filename.nil?\n file = File.open(@cache_dir + filename, \"rb\")\n contents = file.read\n return Marshal.load(contents)\n end", "def file(path, *args)\n return file_via_connection(path, *args) unless cache_enabled?(:file)\n\n @cache[:file][path] ||= file_via_connection(path, *args)\n end", "def system_cache_file\n @sysetm_cache ||= File.join(Gem.dir, \"source_cache\")\n end", "def read_cache_file key\n f = File.open( cache_file(key), \"r\" )\n f.flock(File::LOCK_SH)\n out = f.read\n f.close\n return out\n end", "def file_cache_path\n Chef::Config[:file_cache_path]\n end", "def [](key)\n File.read(cache_path(key))\n rescue Errno::ENOENT\n nil\n end", "def read(key)\n File.read(cache_path(key))\n rescue Errno::ENOENT\n nil\n end", "def load_cache\n #orig_enc = @encoding\n\n File.open cache_path, 'rb' do |io|\n @cache = Marshal.load io.read\n end\n\n load_enc = @cache[:encoding]\n\n # TODO this feature will be time-consuming to add:\n # a) Encodings may be incompatible but transcodeable\n # b) Need to warn in the appropriate spots, wherever they may be\n # c) Need to handle cross-cache differences in encodings\n # d) Need to warn when generating into a cache with different encodings\n #\n #if orig_enc and load_enc != orig_enc then\n # warn \"Cached encoding #{load_enc} is incompatible with #{orig_enc}\\n\" \\\n # \"from #{path}/cache.ri\" unless\n # Encoding.compatible? orig_enc, load_enc\n #end\n\n @encoding = load_enc unless @encoding\n\n @cache[:pages] ||= []\n @cache[:main] ||= nil\n @cache[:c_class_variables] ||= {}\n @cache[:c_singleton_class_variables] ||= {}\n\n @cache[:c_class_variables].each do |_, map|\n map.each do |variable, name|\n @c_enclosure_names[variable] = name\n end\n end\n\n @cache\n rescue Errno::ENOENT\n end", "def read_filecache_index(filecache)\n CachedFile.reset_seq\n headers = []\n filecache.syswrite('ls')\n filecache.rewind\n filecache.each_line do |line|\n if line[0] == ?#\n headers = line.split\n headers.shift\n if headers[0] == 'filecache' then\n module_version = headers[1]\n end\n next\n end\n\n fields = {}\n tmp = line.split\n headers.each_index { |index| fields[headers[index]] = tmp[index] }\n\n file = fields['file']\n dev = fields['dev']\n next if file == '(noname)'\n if file.include? ?\\\\\n file.gsub! '\\011', \"\\011\" # ht\n file.gsub! '\\012', \"\\012\" # nl\n file.gsub! '\\040', \"\\040\" # sp\n file.gsub! '\\\\', \"\\\\\" # \\\n end\n\n if file =~ /\\([0-9a-f]{2}:[0-9a-f]{2}\\)/ then\n # handle block device\n # - transform file name from digital form to real ones\n fs = @@fstab[file.delete('(:)').hex]\n next unless fs\n file = fs.device_file\n dev = $BDEV_ID\n else\n # handle normal files\n # - expand file name to full path name\n # - ignore dirs/symlinks\n dev = dev[0,5].delete(':').hex\n fs = @@fstab[dev]\n next unless fs\n file = fs.mount_point + file unless fs.mount_point == '/'\n next unless File.file?(file)\n end\n\n cfile = CachedFile.new file\n cfile.dev = dev\n cfile.state = fields['state']\n cfile.ino = fields['ino'].to_i\n cfile.size = fields['size'].to_i\n cfile.cached = fields['cached'].to_i\n cfile.cachedp = fields['cached%'].to_i\n cfile.refcnt = fields['refcnt'].to_i\n cfile.process = fields['process']\n cfile.uid = fields['uid'].to_i\n cfile.accessed = fields['accessed'].to_i\n @cfile_by_name[file] = cfile\n end # filecache.each_line\n end", "def load_tracker_cache(load_soa_serial = true)\n # Need to store the time that the state change was first noticed.\n # Need to load this from file, store in cache, add to new cache values,\n # and write back to file.\n cache = Cache.new\n filename = get_tracker_filename\n dir = File.dirname(filename)\n begin\n Dir.mkdir(dir) unless File.directory?(dir)\n rescue Errno::ENOENT\n @parent.log(LOG_ERR, \"Can't create working folder : #{dir}\")\n KASPAuditor.exit(\"Can't create working folder : #{dir}\", 1)\n end\n File.open(filename, File::CREAT) { |f|\n # Now load the cache\n # Is there an initial timestamp and a current SOA serial to load?\n count = 0\n while (line = f.gets)\n count += 1\n if (count == 1)\n @initial_timestamp = line.chomp.to_i\n next\n elsif (count == 2)\n if (load_soa_serial)\n @last_soa_serial = line.chomp.to_i\n end\n next\n end\n key_string, status_string, time, first_time = line.split(SEPARATOR)\n if (!first_time)\n first_time = time\n end\n key = RR.create(key_string)\n eval \"cache.add_#{status_string.downcase}_key_with_time(key, time.to_i, first_time.to_i)\".untaint\n end\n }\n return cache\n end", "def read_disk_cache\n\t\t\t\tif File.exists?(\"#{$cache_path}/#{@host}_disks.yaml\")\n\t\t\t\t\t\t@disks = YAML::load(File.read(\"#{$cache_path}/#{@host}_disks.yaml\"))\n\t\t\t\t\t\t$log.info \"Loaded cachefile for #{@host}.\"\n\t\t\t\telse\n\t\t\t\t\t\t$log.warn \"No cachefile found. Need to get a new one.\"\n\t\t\t\t\t\treturn false\n\t\t\t\tend\n\t\tend", "def reload; @data = File.read @path end", "def restore_from_disk\n log(\"Loading Data in...\")\n\n if File.directory?('buckets') then\n entries = Dir.entries(\"buckets\").collect do |f| f unless f.match(\"bucket\").nil? end.compact\n\n entries.each do |e|\n File.open(\"buckets/\" + e) do |f|\n @contents = Marshal.load(f)\n end\n\n buckets[\"#{e.gsub(\".bucket\", \"\")}\"] = @contents\n\n end\n\n end\n\n end", "def load_cache\n return false\n\n if File.exists?(cache_filename)\n File.open(cache_filename, \"r\") do |f|\n save_date = f.readline.to_datetime\n if ( save_date + @@cache_expiration > DateTime.now )\n @data = JSON.parse(f.readline)\n end\n end\n end\n end", "def cached_stored_files\n @cached_stored_files ||= storage.files\n end", "def load_cachefile(cache_filename, template)\n s = File.read(cache_filename)\n if s.sub!(/\\A\\#\\@ARGS (.*?)\\r?\\n/, '')\n template.args = $1.split(',')\n end\n template.script = s\n end", "def get(key)\n path = File.join(@root, \"#{key}.cache\")\n\n value = safe_open(path) do |f|\n begin\n EncodingUtils.unmarshaled_deflated(f.read, Zlib::MAX_WBITS)\n rescue Exception => e\n @logger.error do\n \"#{self.class}[#{path}] could not be unmarshaled: \" +\n \"#{e.class}: #{e.message}\"\n end\n nil\n end\n end\n\n if value\n FileUtils.touch(path)\n value\n end\n end", "def load\n @cache = JSON.parse(File.read(file))\n rescue\n @cache = {}\n end", "def open(key)\n BlockFile.open(cache_path(key), 'rb')\n rescue Errno::ENOENT\n nil\n end", "def try_load_object(name, cache_path); end", "def attach_cached\n return file_attacher.file if file_attacher.cached?\n return if file_attacher.stored? || file_data.blank?\n=begin # TODO: remove when :json resolved\n file_attacher.load_data(file_data)\n=end\n file_attacher_load\n file_attacher.set(nil) unless file_attacher.cached?\n file_attacher.file\n end", "def uncache file \n refresh = nil\n begin\n is_a_file = F === file\n path = (is_a_file ? file.path : file.to_s) \n stat = (is_a_file ? file.stat : F.stat(file.to_s)) \n refresh = tmpnam(F.dirname(path))\n ignoring_errors do\n F.link(path, refresh) rescue F.symlink(path, refresh)\n end\n ignoring_errors do\n F.chmod(stat.mode, path)\n end\n ignoring_errors do\n F.utime(stat.atime, stat.mtime, path)\n end\n ignoring_errors do\n open(F.dirname(path)){|d| d.fsync}\n end\n ensure \n ignoring_errors do\n F.unlink(refresh) if refresh\n end\n end\n end", "def read_cache_file()\n #\n # Update to Google Domains may be forced by forgetting cached\n # values. This is controlled by the [-u|--force_update] option\n #\n if options[:force_update]\n if File.exists?(options[:cache_file])\n File.delete(options[:cache_file])\n end\n end\n\n #\n # Load the cache file\n #\n return File.exists?(options[:cache_file]) ? YAML.load_file(options[:cache_file]) : {}\n end", "def cache_file(file)\n FileUtils.cp(file, path)\n end", "def cache_file_path\n File.join @homepath, 'cache'\n end", "def cache_file\n File.join(Rscons.application.build_dir, \".rsconscache\")\n end", "def cache_file(input)\n key = Digest.hexencode(Digest::SHA2.digest(input.to_yaml))\n return @directory + \"/\" + key + \".yaml\"\n end", "def get_timer_cache_file\n @log_file || File.expand_path('~') + '/lightwaverf-timer-cache.yml'\n end", "def cache_path\n File.join @path, 'cache.ri'\n end", "def read_cache_file\n return nil unless File.file? @cache_file\n\n cache = YAML.load_file(@cache_file)\n\n return nil unless cache.is_a? Hash\n return nil unless cache[:userid] == @userid\n\n @token = cache[:token]\n @prev_account_info = cache[:account_info]\n @remote_folders = cache[:remote_folders]\n @remote_contexts = cache[:remote_contexts]\n @last_sync = cache[:last_sync]\n end", "def load_file(file)\n\n CachedFile.reset_seq\n\n cfile = nil\n File.foreach(file) do |line|\n next if line.empty?\n next if line[0] == ?#\n\n line.chomp!\n if line[0] == ?/\n cfile = CachedFile.new line\n next unless File.exist?(line) # sorry for the creat and abandon fuss\n cfile.init_attrs\n @cfile_by_name[cfile.file] = cfile if @@fstab[cfile.dev]\n elsif line =~ /^\\d+\\s+\\d+/\n idx, len = line.split\n cfile.add_page_range idx.to_i, len.to_i\n end\n\n end # File.foreach\n self\n end", "def cache(filepath, &block)\n\t\t# c3) data was already generated, load it from the disk\n\t\t# c4) data was generated, but is out of date\n\t\tif filepath.exist?\n\t\t\tputs \"Checkpoint #{self.object_id}: data loaded!\"\n\t\t\treturn YAML.load_file(filepath)\n\t\t\t\n\t\t\t# NOTE: If you use Pathname with YAML loading, the type will protect you.\n\t\t\t# YAML.load() is for strings\n\t\t\t# YAML.load_file() is for files, but the argument can still be a string\n\t\t\t# but, Pathname is a vaild type *only* for load_file()\n\t\t\t\t# thus, even if you forget what the name of the method is, at least you don't get something weird and unexpected?\n\t\t\t\t# (would be even better to have a YAML method that did the expected thing based on the type of the argument, imo)\n\t\t\t\t# \n\t\t\t\t# Also, this still doesn't help you remember the correct name...\n\t\telse\n\t\t\t# If callback needs to be run, then run it...\n\t\t\tdata = block.call()\n\t\t\t# ... save data to file for next time,\n\t\t\tdump_yaml(data => filepath)\n\t\t\t# ... and return the data from memory\n\t\t\treturn data\n\t\tend\n\tend", "def read_from_cache\n result = if cache.is_a?(Proc)\n cache.call(nil)\n elsif File.exist?(cache.to_s)\n File.read(cache)\n end\n result if valid_rates?(result)\n end", "def cache_dir\n '/var/cache'\n end", "def cache_dir\n '/var/cache'\n end", "def initialize_file_based_cache\n Dir.mkdir(\"cache\")\n @document_cache = ActiveSupport::Cache::FileStore.new(\"cache\")\n @file_based_cache = true\n end", "def load_or_run(path)\n result = nil\n if File.exist?(path)\n File.open(path, 'rb') { |f| result = Marshal.load(f) }\n else\n result = yield\n File.open(path, 'wb') { |f| Marshal.dump(result, f) }\n end\n result\nend", "def cached_render_memory\n cache = Cache.actions\n options = cache_options\n store_options = {}\n key = full_path\n\n if options.respond_to?(:values_at)\n block, ttl = options.values_at(:key, :ttl)\n\n key = [full_path, block.call] if block\n store_options[:ttl] = ttl if ttl\n end\n\n cached_memory_process(cache, key, store_options)\n end", "def local_cache(basebox_name)\n cache_dir = Vagrant::Environment.new.home_path.join('cache', 'apt', basebox_name)\n # Vagrant::Environment.new.home_path\n print cache_dir\n cache_dir.mkpath unless cache_dir.exist?\n partial_dir = cache_dir.join('partial')\n partial_dir.mkdir unless partial_dir.exist?\n cache_dir\nend", "def reserve\n FileUtils.touch(self.cache_dir + self.local_filename)\n end", "def load\n sleeper = 0.0\n while File.exist? lock_file\n sleeper += 0.1 if sleeper <= 10.0\n sleep(sleeper.to_i)\n end\n # :symbolize_names does not play nicely with :create_additions\n tmp = JSON.parse(File.read(path),\n {:symbolize_names=>false, :create_additions=>true})\n @data = {}\n tmp.each_pair{ |k,v| self[k] = v }\n end", "def read_cache_mtime key\n return nil unless File.exists?(cache_file(key))\n File.mtime( cache_file(key) )\n end", "def write_cache(cache, path)\n if @use_cache then\n File.open path, \"wb\" do |cache_file|\n Marshal.dump cache, cache_file\n end\n end\n\n cache\n rescue Errno::EISDIR # HACK toplevel, replace with main\n cache\n end", "def load_index_cache(file)\n @indexes = Marshal.load(File.read(file))\n nil\n end", "def select_cache_file\n try_file(system_cache_file) or\n\ttry_file(user_cache_file) or\n\tfail \"Unable to locate a writable cache file.\"\n end", "def source(file)\n @_source_cache ||= {}\n @_source_cache[file] ||= (\n File.readlines(file)\n )\n end", "def snapshot(condition = 'true')\n filecache = CachedFile.filecache\n\n read_filecache_index filecache\n\n @cfile_by_name.each_value do |cfile|\n if cfile.cached > 0\n cfile.init_pages { |idx, len, state, refcnt| eval condition }\n end\n end\n\n self\n end", "def copy_over_cache_files\n FileUtils.cp_r \"#{@cache}/.\", @path\n end", "def cache_get(key)\n cache_file = @config[:cache_directory] / \"#{key}.cache\"\n if File.file?(cache_file)\n _data, _expire = Marshal.load(cache_read(cache_file))\n if _expire.nil? || Time.now < _expire\n Merb.logger.info(\"cache: hit (#{key})\")\n return _data\n end\n FileUtils.rm_f(cache_file)\n end\n Merb.logger.info(\"cache: miss (#{key})\")\n nil\n end", "def find_caches\n Dir.glob(File.join(@root, '**/*.cache')).reduce([]) { |stats, filename|\n stat = safe_stat(filename)\n # stat maybe nil if file was removed between the time we called\n # dir.glob and the next stat\n stats << [filename, stat] if stat\n stats\n }.sort_by { |_, stat| stat.mtime.to_i }\n end", "def snapshot_filesystem\n mtimes = {}\n\n files = @files.map { |file| Dir[file] }.flatten.uniq\n\n files.each do |file|\n if File.exists? file\n mtimes[file] = File.stat(file).mtime\n end\n end\n\n mtimes\n end", "def cache_file_list_path\n File.join config.config_dir, 'file_cache'\n end", "def reload\n load __FILE__\nend", "def reload\n load @filename\n end", "def cache!(new_file)\n super\n @old_tmp_file = new_file\n end", "def cache!(new_file)\n super\n @old_tmp_file = new_file\n end", "def cache(gist, file, data)\n cache_file = get_cache_file_for gist, file\n File.open(cache_file, \"w\") do |io|\n io.write data\n end\n end", "def cache_file_path\n raise IOError.new 'Write permission is required for cache directory' unless File.writable?(@args[:cache_directory])\n \"#{@args[:cache_directory]}/#{Digest::SHA1.hexdigest((@args[:cache_ref] || @path).to_s + size.to_s + last_modified.to_s)}.cache\"\n end", "def load_startup_time(delete_file = false)\n t = nil\n if File.exist?( $PROJECT_DIR + '/' + $TIME_LOG_FILE )\n File.open( $PROJECT_DIR + '/' + $TIME_LOG_FILE, \"r+\" ) do |infile|\n t = Marshal.load( infile )\n end\n if delete_file then File.delete( $PROJECT_DIR + '/' + $TIME_LOG_FILE ) end\n end\n t\nend", "def load_resume\n if ( $cache_time.nil? || File.mtime(\"#{Rails.root}/files/resume.yml\") < $cache_time || [$resume].any?(&:nil?) )\n $cache_time = Time.now\n $resume = YAML.load(File.read('files/resume.yml'))\n end\n @resume = $resume\n end", "def write_to_file_cache(file, payload)\n puts \"direct access, storing in #{file}\"\n File.open( file, 'w' ) do |out|\n Marshal.dump(payload, out)\n end\n payload\n end", "def cache\n store = Moneta.new :File, dir: 'moneta'\n Cachy.cache_store = store\n Cachy\n end", "def get_file(key, use_cache = true)\n if use_cache\n db = (@current_site.get_meta(cache_key) || {})[File.dirname(key)] || {}\n else\n db = objects(File.dirname(key)) unless use_cache\n end\n (db[:files][File.basename(key)] || db[:folders][File.basename(key)]) rescue nil\n end", "def add_file_to_distributed_cache(file)\n add_to_distributed_cache(file, \"mapred.cache.files\")\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def caching\n @caching = \"data_update[#{data_path}]\"\n end", "def reload_regular(file)\n apps = mounted_apps_of(file)\n if apps.empty?\n reloadable_apps.each do |app|\n app.app_obj.reload! if app.app_obj.dependencies.include?(file)\n end\n safe_load(file)\n else\n apps.each { |app| app.app_obj.reload! }\n update_modification_time(file)\n end\n end", "def get key\n if key.is_a? Array\n ret = {}\n key.each do |k|\n ret[k] = Marshal::load(read_cache_file(k)) unless expired?(k)\n end\n\n raise if ret.empty?\n return ret\n end\n\n raise if expired?(key)\n\n return Marshal::load(read_cache_file(key))\n rescue\n raise Diskcached::NotFound\n ensure\n flush_expired if gc_auto\n end", "def source(file)\n @_source_cache[file] ||= (\n File.readlines(file)\n )\n end", "def cache_file_for(klassname)\n File.join cache_file_path, klassname.gsub(/:+/, \"-\")\n end", "def pidfile(path); end", "def load_active_from_disk\n workdir = Pathname.new(@workdir)\n if workdir.exist?\n workdir.find do |path|\n # symlinks indicate an active version of a resource\n next unless File.symlink?(path)\n\n target = File.readlink(path)\n # the version will be the parent directory\n version = target.split('/')[-2]\n @active[path.relative_path_from(workdir).to_s] = version\n end\n end\n end", "def src_for(filename, env={})\n @semaphore.synchronize do\n refresh(env)\n file = @files[filename]\n unless file and file.has_key? :path\n raise \"#{filename.dump} is not available from file server\"\n end\n \"#{file[:path]}?#{file[:mtime].to_i}\"\n end\n end", "def local_cache(box_name, hostname)\n cache_dir = File.join( File.expand_path(\"./vagrant_apt\"),\n 'cache',\n 'apt',\n box_name,\n hostname\n )\n\n partial_dir = File.join(cache_dir, 'partial')\n FileUtils.mkdir_p(partial_dir) unless File.exists? partial_dir\n cache_dir\nend", "def page_cache_file(url)\n ActionController::Base.send :page_cache_file, url.gsub(/^https?:\\/\\//, '')\n end", "def page_cache_test_file(url)\n File.join ActionController::Base.page_cache_directory, page_cache_file(url).reverse.chomp('/').reverse\n end", "def cache_dir; end", "def cache_dir; end", "def cache\n if self.cache_store\n self.cache_store\n else\n self.cache_store = :file_store, root.join(\"tmp\").to_s\n self.cache_store\n end\n end" ]
[ "0.6672944", "0.6169494", "0.59106946", "0.59044886", "0.58924866", "0.58921814", "0.5863391", "0.5819762", "0.57779837", "0.5777568", "0.5749835", "0.57419854", "0.57245976", "0.57231957", "0.5706084", "0.5663693", "0.5620852", "0.55900955", "0.55813706", "0.5561835", "0.5559957", "0.5558025", "0.555741", "0.55423194", "0.55415684", "0.55288434", "0.55173016", "0.55130666", "0.5435186", "0.54327494", "0.5415471", "0.5414229", "0.5401606", "0.53967214", "0.5381507", "0.53370905", "0.53346217", "0.533266", "0.53300893", "0.5310253", "0.53045833", "0.5297312", "0.52815485", "0.5273298", "0.52665776", "0.5258242", "0.52516735", "0.523402", "0.5233073", "0.52326316", "0.52013206", "0.51987624", "0.51701796", "0.5169459", "0.5169459", "0.51645213", "0.5164474", "0.51598644", "0.5155957", "0.5152691", "0.5138703", "0.5135477", "0.51273996", "0.5120962", "0.5112181", "0.51090825", "0.5083864", "0.5075429", "0.50680083", "0.5067782", "0.5059119", "0.5051391", "0.50445956", "0.5043533", "0.5035331", "0.5035331", "0.50291854", "0.5028863", "0.5021116", "0.50201595", "0.50107807", "0.5009723", "0.49995178", "0.4998861", "0.49987832", "0.49987832", "0.49987832", "0.49987832", "0.49980292", "0.49959677", "0.4993684", "0.49933866", "0.498505", "0.49828157", "0.49826536", "0.49749905", "0.49719337", "0.49718368", "0.49715507", "0.49715507", "0.49584314" ]
0.0
-1
Load cached files' info from a presaved file.
def load_file(file) CachedFile.reset_seq cfile = nil File.foreach(file) do |line| next if line.empty? next if line[0] == ?# line.chomp! if line[0] == ?/ cfile = CachedFile.new line next unless File.exist?(line) # sorry for the creat and abandon fuss cfile.init_attrs @cfile_by_name[cfile.file] = cfile if @@fstab[cfile.dev] elsif line =~ /^\d+\s+\d+/ idx, len = line.split cfile.add_page_range idx.to_i, len.to_i end end # File.foreach self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_from_file_cache(file)\n puts \"loading stuff from #{file}\"\n File.open(file, 'r') do |input|\n Marshal.load(input.read)\n end\n end", "def load\n if File.exist?(@file_path)\n\n @_cache = JSON File.open(@file_path, &:read).strip\n else\n $stderr.puts \"#{@file_path} does not exist\"\n end\n end", "def load_cached\n content = File.open(self.cache_file_name, \"rb\") { |f| f.read }\n puts(\"[MODEL_FILE] Loaded #{self.cache_file_name} from cache\")\n return content\n end", "def load\n @cache = JSON.parse(File.read(file))\n rescue\n @cache = {}\n end", "def load_cache\n @list = YAML::load_file Settings[:cache_file]\n end", "def get(file)\n binding.pry\n #return the values from cached first\n @cached[file] || \n @file_metadata[file] || \n read_metadata_from_yaml(file) || \n cache(file, read_metadata_from_disk(file)) \n end", "def load_local_cache\n return nil unless File.exists?(LOCAL_CACHE_PATH)\n yaml = File.read(LOCAL_CACHE_PATH)\n YAML.load(yaml)\n end", "def preload_data\n @file.seek(0)\n @contents = StringIO.new(@file.read)\n @file.close\n end", "def load(file_path); end", "def load(file_path); end", "def load_resume\n if ( $cache_time.nil? || File.mtime(\"#{Rails.root}/files/resume.yml\") < $cache_time || [$resume].any?(&:nil?) )\n $cache_time = Time.now\n $resume = YAML.load(File.read('files/resume.yml'))\n end\n @resume = $resume\n end", "def reload; @data = File.read @path end", "def read_cache_file()\n #\n # Update to Google Domains may be forced by forgetting cached\n # values. This is controlled by the [-u|--force_update] option\n #\n if options[:force_update]\n if File.exists?(options[:cache_file])\n File.delete(options[:cache_file])\n end\n end\n\n #\n # Load the cache file\n #\n return File.exists?(options[:cache_file]) ? YAML.load_file(options[:cache_file]) : {}\n end", "def load_cache\n return false\n\n if File.exists?(cache_filename)\n File.open(cache_filename, \"r\") do |f|\n save_date = f.readline.to_datetime\n if ( save_date + @@cache_expiration > DateTime.now )\n @data = JSON.parse(f.readline)\n end\n end\n end\n end", "def read_cache\n @cache_file = select_cache_file\n begin\n\topen(@cache_file, \"rb\") { |f| load_local_cache(f) } || {}\n rescue StandardError => ex\n\t{}\n end\n end", "def load_file(file)\n klasses = ObjectSpace.classes.dup\n load file\n LOADED_CLASSES[file] = ObjectSpace.classes - klasses\n MTIMES[file] = File.mtime(file)\n end", "def reload\n load @filename\n end", "def read_cache_file\n return nil unless File.file? @cache_file\n\n cache = YAML.load_file(@cache_file)\n\n return nil unless cache.is_a? Hash\n return nil unless cache[:userid] == @userid\n\n @token = cache[:token]\n @prev_account_info = cache[:account_info]\n @remote_folders = cache[:remote_folders]\n @remote_contexts = cache[:remote_contexts]\n @last_sync = cache[:last_sync]\n end", "def read_from_cache\n if config.cache.is_a?(Proc)\n config.cache.call(nil)\n elsif (config.cache.is_a?(String) || config.cache.is_a?(Pathname)) &&\n File.exist?(file_path)\n open(file_path).read\n end\n end", "def load_file(file); end", "def load_file(filename); end", "def load_file(filename); end", "def get_data(key) \n filename = _find_file_key(key)\n return nil if filename.nil?\n file = File.open(@cache_dir + filename, \"rb\")\n contents = file.read\n return Marshal.load(contents)\n end", "def read(path)\n @path = path\n unless File.exist?(info_file)\n debug(\"file #{info_file} missing\")\n write(path, {})\n return\n end\n # data = @info_cacher[info_file]\n info_hash[base_name]\n end", "def load(file); end", "def mark_loaded(name, file)\n name = cleanpath(name).chomp('.rb')\n file = File.expand_path(file)\n $LOADED_FEATURES << file unless $LOADED_FEATURES.include?(file)\n loaded[name] = [file, File.mtime(file)]\n end", "def load_cache\n @load_cache\n end", "def after_safe_load_succeed(file)\n Cache.clear_after_reload\n after_safe_load(file)\n end", "def get(key)\n unless @store[key].present?\n path = path_for_key(key)\n if File.exists?(path)\n begin\n data = File.open(path, 'r') { |f| Marshal.load(f) }\n @store[key] = data\n rescue Exception => e\n Honeybadger.notify(\"Something went wrong reading RSSCache file from disk: #{path} #{e}\")\n end\n end\n end\n @store[key]\n end", "def load filepath\n require 'zip'\n\n ::Zip::File.open filepath do |zip|\n entry = zip.entries.first\n entry_path = path entry.name\n entry.extract entry_path\n\n serializer = serializers.resolve entry.name\n serializer.load entry_path\n end\n end", "def fl(file_name)\n file_name += '.rb' unless file_name =~ /\\.rb/\n @@recent = file_name \n load \"#{file_name}\"\nend", "def load(filename)\n @filename = filename\n @mtime = File::mtime(@filename)\n\n File.open(filename) { |f| parse(f) }\n end", "def cache_file(file)\n FileUtils.cp(file, path)\n end", "def cached_stored_files\n @cached_stored_files ||= storage.files\n end", "def load_storage\n YAML.load_file(file_path) || {}\n end", "def load_cache\n #orig_enc = @encoding\n\n File.open cache_path, 'rb' do |io|\n @cache = Marshal.load io.read\n end\n\n load_enc = @cache[:encoding]\n\n # TODO this feature will be time-consuming to add:\n # a) Encodings may be incompatible but transcodeable\n # b) Need to warn in the appropriate spots, wherever they may be\n # c) Need to handle cross-cache differences in encodings\n # d) Need to warn when generating into a cache with different encodings\n #\n #if orig_enc and load_enc != orig_enc then\n # warn \"Cached encoding #{load_enc} is incompatible with #{orig_enc}\\n\" \\\n # \"from #{path}/cache.ri\" unless\n # Encoding.compatible? orig_enc, load_enc\n #end\n\n @encoding = load_enc unless @encoding\n\n @cache[:pages] ||= []\n @cache[:main] ||= nil\n @cache[:c_class_variables] ||= {}\n @cache[:c_singleton_class_variables] ||= {}\n\n @cache[:c_class_variables].each do |_, map|\n map.each do |variable, name|\n @c_enclosure_names[variable] = name\n end\n end\n\n @cache\n rescue Errno::ENOENT\n end", "def load_file(filename)\n full_file = File.expand_path(filename, @dispatch.save_dir)\n save_dir(full_file)\n begin\n File.new(full_file, 'r').each do |line|\n break unless load(full_file, $., line)\n end\n rescue\n puts \"Error loading file #{full_file}\"\n end\n restore_dir\n end", "def load()\n code = File.open(@filename) {|file| file.read}\n dup = @players.last.dup\n begin\n dup.reset\n dup.instance_eval(code)\n @players.push(dup)\n rescue\n puts \"LOAD ERROR #{$!}\"\n end\n @load_time = Time.now.to_i\n end", "def source(file)\n @_source_cache ||= {}\n @_source_cache[file] ||= (\n File.readlines(file)\n )\n end", "def load_cache_for(klassname)\n path = cache_file_for klassname\n\n cache = nil\n\n if File.exist? path and\n File.mtime(path) >= File.mtime(class_cache_file_path) and\n @use_cache then\n open path, 'rb' do |fp|\n begin\n cache = Marshal.load fp.read\n rescue\n #\n # The cache somehow is bad. Recreate the cache.\n #\n $stderr.puts \"Error reading the cache for #{klassname}; recreating the cache!\"\n cache = create_cache_for klassname, path\n end\n end\n else\n cache = create_cache_for klassname, path\n end\n\n cache\n end", "def load(path); end", "def load_file(path, name)\n data_file = PStore.new(path)\n data = nil\n data_file.transaction do\n data = data_file[name]\n end\n if data == nil\n data = Array.new\n end\n data\nend", "def load(clear=true, filename = @filename)\n @mutex.synchronize{\n @filename = filename\n\n hash = YAML.load_file( filename )\n self.clear if clear\n self.merge!(hash)\n }\n end", "def load\n return unless @file_path && File.exist?(@file_path)\n File.open(@file_path, 'rb') do |file|\n return Marshal.load(file)\n end\n end", "def load( filepath )\n unserialize( IO.read( filepath ) )\n end", "def load(filename)\n end", "def restore()\n @inihash = Ini.read_from_file(@path)\n @comment = Ini.read_comment_from_file(@path)\n end", "def read_data(file)\n if ENV['RACK_ENV'] == 'test'\n local = File.expand_path(\"../test/data/#{file}\", __FILE__)\n else\n local = File.expand_path(\"../data/#{file}\", __FILE__)\n\n if USE_GOOGLE_DRIVE\n remote = google_session.file_by_title(file.to_s)\n remote.download_to_file(local)\n end\n end\n\n YAML.load_file(local)\nend", "def data_cache(fpath)\n (@data_caches ||= []) << fpath\n return fpath\n end", "def restore_from_disk\n log(\"Loading Data in...\")\n\n if File.directory?('buckets') then\n entries = Dir.entries(\"buckets\").collect do |f| f unless f.match(\"bucket\").nil? end.compact\n\n entries.each do |e|\n File.open(\"buckets/\" + e) do |f|\n @contents = Marshal.load(f)\n end\n\n buckets[\"#{e.gsub(\".bucket\", \"\")}\"] = @contents\n\n end\n\n end\n\n end", "def load\r\n return unless File.exist?(STORAGE)\r\n\r\n props = YAML.load(File.read(STORAGE))\r\n props.each{|k, v| instance_variable_set(\"@#{k}\", v) }\r\n end", "def source(file)\n @_source_cache[file] ||= (\n File.readlines(file)\n )\n end", "def rl(file_name = nil)\n if file_name.nil?\n if !@recent.nil?\n rl(@recent) \n else\n puts \"No recent file to reload\"\n end\n else\n file_name += '.rb' unless file_name =~ /\\.rb/\n @recent = file_name \n load \"#{file_name}\"\n end\nend", "def rl(file_name = nil)\n if file_name.nil?\n if !@recent.nil?\n rl(@recent) \n else\n puts \"No recent file to reload\"\n end\n else\n file_name += '.rb' unless file_name =~ /\\.rb/\n @recent = file_name \n load \"#{file_name}\"\n end\nend", "def rl(file_name = nil)\n if file_name.nil?\n if !@recent.nil?\n rl(@recent) \n else\n puts \"No recent file to reload\"\n end\n else\n file_name += '.rb' unless file_name =~ /\\.rb/\n @recent = file_name \n load \"#{file_name}\"\n end\nend", "def read(key)\n File.read(cache_path(key))\n rescue Errno::ENOENT\n nil\n end", "def load_file(filename)\n File.read File.join(\"plugins\",name,filename)\n end", "def load_file(path)\n load(path)\n end", "def load( path )\n @content = File.read( path )\n load_listener.on_load( self, path ) if load_listener\n end", "def file\n #load_file\n @file ||= load_file\n end", "def load_file_contents(filename)\n File.open(filename).readlines\n end", "def load_cache\n q = @client.caches.get(:name=>name)\n @client.logger.debug \"GOT Q: \" + q.inspect\n @data = q.raw\n q\n end", "def try_load_object(name, cache_path); end", "def load_saved_file\n\n begin\n parse_json_file('./data/user_data.json')\n\n puts \"Great to have you back #{@parsed_data[:userdata][:username]}!\"\n attribute_data_from_parsed_file()\n\n @prompt.keypress(Rainbow('Please press space or enter to continue!').orange.to_s, keys: %i[space return])\n\n rescue\n puts \"It appears that no previous file exists. Sorry... it just doesn't....\"\n\n @prompt.keypress(Rainbow('Please press space or enter to return!').orange.to_s,keys: %i[space return])\n\n upload_data_from_file()\n\n end\n\n end", "def get(base, name, opts)\n self.load if @cache.nil?\n path = Jekyll.sanitized_path(base, name)\n key = path[@site.source.length..-1]\n mtime = File.mtime(path)\n\n if @cache.has_key?(key) && mtime == @cache[key]['modified']\n # file is not modified\n ret_hash(@cache[key]['yaml'], @cache[key]['content'], false, false, false)\n else\n puts \"parsed yaml #{key}...\"\n self.set_content(key, path, mtime, opts)\n end\n end", "def load\n file_name = ask_save_file\n save_file = File.open(file_name, 'r')\n save_file.pos = 0\n contents = unserialize(save_file.read)\n @name = contents['name']\n @guess = contents['guess']\n @word = contents['word']\n @bank = contents['bank']\n @lives = contents['lives']\n @letter = contents['letter']\n puts \"Game has been loaded from Save File #{file_name[-5]}!\"\n puts \"\\n\\n\"\n end", "def cache_item(file_parsed, _objects_db = nil, custom_cache_key = nil)\n _cache_key = custom_cache_key || cache_key\n objects_db = _objects_db || @current_site.get_meta(_cache_key, {}) || {}\n prefix = File.dirname(file_parsed['key'])\n\n s = prefix.split('/').clean_empty\n return file_parsed if s.last == 'thumb'\n s.each_with_index{|_s, i| k = \"/#{File.join(s.slice(0, i), _s)}\".cama_fix_slash; cache_item(file_parse(k), objects_db) unless objects_db[k].present? } unless ['/', '', '.'].include?(prefix)\n\n objects_db[prefix] = {files: {}, folders: {}} if objects_db[prefix].nil?\n if file_parsed['format'] == 'folder'\n objects_db[prefix][:folders][file_parsed['name']] = file_parsed\n else\n objects_db[prefix][:files][file_parsed['name']] = file_parsed\n end\n @current_site.set_meta(_cache_key, objects_db) if _objects_db.nil?\n file_parsed\n end", "def load(filename)\n\t\tend", "def load_file_contents(file)\n File.open(file, 'r').read\n end", "def load!\n update(get_json(url))\n rescue\n @exists = false\n else\n @exists = true\n ensure\n @loaded = true\n end", "def record(filename)\n contents = File.read(filename) rescue nil\n files[filename] = contents unless files.has_key? filename\n end", "def load_index_cache(file)\n @indexes = Marshal.load(File.read(file))\n nil\n end", "def load\n sleeper = 0.0\n while File.exist? lock_file\n sleeper += 0.1 if sleeper <= 10.0\n sleep(sleeper.to_i)\n end\n # :symbolize_names does not play nicely with :create_additions\n tmp = JSON.parse(File.read(path),\n {:symbolize_names=>false, :create_additions=>true})\n @data = {}\n tmp.each_pair{ |k,v| self[k] = v }\n end", "def load(file)\n File.open(path(file)).read\n end", "def load_tracker_cache(load_soa_serial = true)\n # Need to store the time that the state change was first noticed.\n # Need to load this from file, store in cache, add to new cache values,\n # and write back to file.\n cache = Cache.new\n filename = get_tracker_filename\n dir = File.dirname(filename)\n begin\n Dir.mkdir(dir) unless File.directory?(dir)\n rescue Errno::ENOENT\n @parent.log(LOG_ERR, \"Can't create working folder : #{dir}\")\n KASPAuditor.exit(\"Can't create working folder : #{dir}\", 1)\n end\n File.open(filename, File::CREAT) { |f|\n # Now load the cache\n # Is there an initial timestamp and a current SOA serial to load?\n count = 0\n while (line = f.gets)\n count += 1\n if (count == 1)\n @initial_timestamp = line.chomp.to_i\n next\n elsif (count == 2)\n if (load_soa_serial)\n @last_soa_serial = line.chomp.to_i\n end\n next\n end\n key_string, status_string, time, first_time = line.split(SEPARATOR)\n if (!first_time)\n first_time = time\n end\n key = RR.create(key_string)\n eval \"cache.add_#{status_string.downcase}_key_with_time(key, time.to_i, first_time.to_i)\".untaint\n end\n }\n return cache\n end", "def reload_metadata()\n api_result = @session.execute!(\n :api_method => @session.drive.files.get,\n :parameters => { \"fileId\" => self.id })\n @api_file = api_result.data\n if @acl\n @acl = Acl.new(@session, self)\n end\n end", "def load_file(filename)\n instance_eval File.read(filename), filename, 1\n self\n end", "def load_file(file)\n return if @loaded.include? file\n\n # We have to specify Kernel.load, because we have a load method.\n begin\n # Store the file path so we don't try to reload it\n @loaded << file\n Kernel.load(file)\n rescue ScriptError => detail\n # Don't store the path if the file can't be loaded\n # in case it's loadable later on.\n @loaded.delete(file)\n Facter.warn \"Error loading fact #{file} #{detail}\"\n end\n end", "def load\n manifest_uri, @manifest = @session.get_manifest(uri)\n @folders = extract_folders\n @resources = extract_resources\n @annotations = extract_annotations\n @loaded = true\n end", "def initialize(file = 'cache.yaml')\n @file = file\n @cache = YAML::Store.new(file)\n end", "def load_cachefile(cache_filename, template)\n s = File.read(cache_filename)\n if s.sub!(/\\A\\#\\@ARGS (.*?)\\r?\\n/, '')\n template.args = $1.split(',')\n end\n template.script = s\n end", "def reload(file=nil)\n @file = file if file\n @h = JSON.parse(IO.read(@file), :symbolize_names => true)\n self\n end", "def from_cache(filename, max_age, options=nil)\r\n\t\toptions ||= {}\r\n\t\tpath = self.get_path filename\r\n\r\n\t\treturn nil if !self.valid_cache(filename, max_age)\r\n\r\n\t\tbegin\r\n\t\t\tdata = self.read(path)\r\n\t\t\treturn data if options[:plain_text] == true\r\n\t\t\tjson_obj = JSON.parse(data, {:symbolize_names => true})\r\n\t\t\treturn json_obj[:data]\r\n\t\trescue StandardError => e\r\n\t\t\t$stderr.puts \"Warning: Could not read cache for #{filename} (#{e})\"\r\n\t\t\treturn nil\r\n\t\tend\r\n\t\r\n\tend", "def load_from_file(file_name)\n # Load data\n saved_data = nil\n File.open(file_name, 'rb') do |file|\n if (file.read(FILE_HEADER.size) == FILE_HEADER)\n saved_data = RubySerial::load(Zlib::Inflate.inflate(file.read))\n else\n notify \"Invalid file: #{file_name}\"\n end\n end\n if (saved_data != nil)\n reset_session\n @data = saved_data[:data]\n @dir_scanner.replace_data(@data)\n # Create all dirlines\n saved_data[:dest_dir_names].each do |dir_name|\n add_new_dest_dirline(dir_name)\n end\n saved_data[:src_dir_names].each do |dir_name|\n add_new_src_dirline(dir_name)\n end\n notify(\"File #{file_name} loaded correctly\")\n @current_file_name = file_name\n invalidate_current_loaded_file\n end\n end", "def load_from_file!(file_path)\n raise IOError, \"File #{file_path} not exist\" unless File.exist?(file_path)\n raw_data = IO.read(file_path)\n load_from_json!(raw_data)\n end", "def fromFile( filename ) \n lines = IO.readlines( filename )\n loadAll( lines )\n end", "def attach_cached\n return file_attacher.file if file_attacher.cached?\n return if file_attacher.stored? || file_data.blank?\n=begin # TODO: remove when :json resolved\n file_attacher.load_data(file_data)\n=end\n file_attacher_load\n file_attacher.set(nil) unless file_attacher.cached?\n file_attacher.file\n end", "def loadfile(filename)\n file = nil\n open(filename, 'r') do |f|\n file = f.read\n end\n file\nend", "def load(filepath)\n @proxies = YAML.load(File.read(filepath))\n end", "def load_plist(file)\n NSMutableDictionary.dictionaryWithContentsOfFile(file)\n end", "def load( value )\n @filename = value\n self\n end", "def cache(filepath, &block)\n\t\t# c3) data was already generated, load it from the disk\n\t\t# c4) data was generated, but is out of date\n\t\tif filepath.exist?\n\t\t\tputs \"Checkpoint #{self.object_id}: data loaded!\"\n\t\t\treturn YAML.load_file(filepath)\n\t\t\t\n\t\t\t# NOTE: If you use Pathname with YAML loading, the type will protect you.\n\t\t\t# YAML.load() is for strings\n\t\t\t# YAML.load_file() is for files, but the argument can still be a string\n\t\t\t# but, Pathname is a vaild type *only* for load_file()\n\t\t\t\t# thus, even if you forget what the name of the method is, at least you don't get something weird and unexpected?\n\t\t\t\t# (would be even better to have a YAML method that did the expected thing based on the type of the argument, imo)\n\t\t\t\t# \n\t\t\t\t# Also, this still doesn't help you remember the correct name...\n\t\telse\n\t\t\t# If callback needs to be run, then run it...\n\t\t\tdata = block.call()\n\t\t\t# ... save data to file for next time,\n\t\t\tdump_yaml(data => filepath)\n\t\t\t# ... and return the data from memory\n\t\t\treturn data\n\t\tend\n\tend", "def get(key)\n path = File.join(@root, \"#{key}.cache\")\n\n value = safe_open(path) do |f|\n begin\n EncodingUtils.unmarshaled_deflated(f.read, Zlib::MAX_WBITS)\n rescue Exception => e\n @logger.error do\n \"#{self.class}[#{path}] could not be unmarshaled: \" +\n \"#{e.class}: #{e.message}\"\n end\n nil\n end\n end\n\n if value\n FileUtils.touch(path)\n value\n end\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 load_hash(file_path) \n file=File.read(file_path)\n JSON.parse(file)\n end", "def load_hash(file_path) \n file=File.read(file_path)\n JSON.parse(file)\n end", "def load_favourite(name)\n @settings = {}\n if File.exists?(File.expand_path(\"~/.wormholes\"))\n sites = Psych.load(File.read(File.expand_path(\"~/.wormholes\")))\n if !sites[name].nil?\n @settings = sites[name]\n end\n end\nend", "def reload\n @a.clear\n if File::exists? @file\n begin\n Zlib::GzipReader.open(@file) do |gz|\n x = JSON.parse(gz.read)\n x.each{|k,v| @a.store(k,v)}\n end\n rescue Zlib::Error\n raise \"We could not reload #{@file} it may be corrupted\"\n rescue JSON::ParserError\n end \n else\n Zlib::GzipWriter.open(a).close \n end\n end", "def read_cache_fixtures!\n files = cache_files\n files.each do |file|\n cache_key = get_cache_key_from_filename(file)\n responses[cache_key] = Marshal.load(File.read(file))\n end\n end", "def get_loaded_model(model_path, file); end" ]
[ "0.68843466", "0.6756553", "0.6442178", "0.6302698", "0.61665505", "0.60234004", "0.59443253", "0.5874848", "0.586737", "0.586737", "0.5859239", "0.5794853", "0.5791543", "0.5747404", "0.57406646", "0.5714166", "0.5706454", "0.56349736", "0.56273985", "0.5618195", "0.5586561", "0.5586561", "0.55674446", "0.5552945", "0.55497247", "0.5545871", "0.55288815", "0.5517417", "0.55146956", "0.5514156", "0.55044466", "0.55029476", "0.54728323", "0.54700077", "0.54674846", "0.54403996", "0.5416507", "0.5397915", "0.5362139", "0.53603214", "0.53399676", "0.53388953", "0.5303838", "0.5291025", "0.5283734", "0.52758473", "0.5265849", "0.52612436", "0.526034", "0.5253608", "0.5234899", "0.5228729", "0.52224386", "0.52224386", "0.52224386", "0.5219259", "0.5207183", "0.5199825", "0.5191918", "0.51852334", "0.5180594", "0.5171835", "0.51676106", "0.5167255", "0.51655644", "0.51613045", "0.5149928", "0.514745", "0.5145092", "0.5139046", "0.51293004", "0.51263964", "0.5126386", "0.51162887", "0.5109059", "0.51069105", "0.5106554", "0.5104796", "0.51042885", "0.5104016", "0.50995916", "0.5090873", "0.5089461", "0.5087572", "0.5082503", "0.50808346", "0.5080192", "0.50790673", "0.5071778", "0.50679964", "0.506707", "0.5059031", "0.5058665", "0.5057689", "0.5056532", "0.5056532", "0.5054796", "0.5052185", "0.50513417", "0.5050279" ]
0.52850926
44
Creates a new App instance.
def initialize(app_bundle_path) @path = File.expand_path(app_bundle_path) if !App.valid?(app_bundle_path) if App.cached_app_on_simulator?(app_bundle_path) raise RuntimeError, %Q{ App is "cached" on the simulator. #{app_bundle_path} This can happen if there was an incomplete install or uninstall. Try manually deleting the application data container and relaunching the simulator. $ rm -r #{File.dirname(app_bundle_path)} $ run-loop simctl manage-processes } else raise ArgumentError, %Q{App does not exist at path or is not an app bundle. #{app_bundle_path} Bundle must: 1. be a directory that exists, 2. have a .app extension, 3. contain an Info.plist, 4. and the app binary (CFBundleExecutable) must exist } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app()\n app = OpenShift::TestApplication.new(self)\n\n $logger.info(\"Created new application #{app.name} for account #{@name}\")\n\n @apps << app\n app\n end", "def new\n puts \"Creating new blank Praxis app under #{app_name}\"\n create_root_files\n create_config\n create_app\n create_design\n create_spec\n create_docs\n end", "def create(optional_params = {})\n response = Network.post(['Applications'], optional_params)\n Application.new(response)\n end", "def app\n app_class.new\n end", "def app\n MyApp.new\nend", "def app\n TestApp.new\n end", "def create_app(opts)\n app = nil\n scope = select_scope(opts[:scope])\n\n assets = Asset.accessible_by_user(user).\n where(\n state: Asset::STATE_CLOSED,\n uid: opts[:ordered_assets],\n )\n\n App.transaction do\n app_series = create_app_series(opts[:name], scope)\n release = opts.fetch(:release, UBUNTU_16)\n revision = app_series.latest_revision_app.try(:revision).to_i + 1\n\n applet_dxid = new_applet(\n opts.slice(\n :input_spec,\n :output_spec,\n :code,\n :instance_type,\n :packages,\n :internet_access,\n ),\n release,\n )\n\n app_dxid = new_app(\n opts.slice(\n :name,\n :title,\n :internet_access,\n :readme,\n ).merge(\n applet_dxid: applet_dxid,\n asset_dxids: assets.map(&:dxid),\n revision: revision,\n scope: scope,\n ),\n )\n\n api.project_remove_objects(project, [applet_dxid])\n\n app = App.create!(\n dxid: app_dxid,\n version: nil,\n revision: revision,\n title: opts[:title],\n readme: opts[:readme],\n entity_type: opts[:entity_type] || App::TYPE_REGULAR,\n user: user,\n scope: scope,\n app_series: app_series,\n input_spec: opts[:input_spec],\n output_spec: opts[:output_spec],\n internet_access: opts[:internet_access],\n instance_type: opts[:instance_type],\n ordered_assets: opts[:ordered_assets],\n packages: opts[:packages],\n code: opts[:code].strip,\n assets: assets,\n release: release,\n )\n\n app_series.update!(latest_revision_app: app)\n app_series.update!(latest_version_app: app) if Space.valid_scope?(scope)\n app_series.update!(deleted: false) if app_series.deleted?\n\n Event::AppCreated.create_for(app, user)\n end\n\n app\n end", "def app\n TicTacToeAiNApp # most examples use App.new - reason why we don't need .new here? ?????\n end", "def app\n defined?(@app) ? @app : build_app\n end", "def create_app(name, redirect_uri, scopes = 'read', website = nil)\n perform_request_with_object(:post, '/api/v1/apps',\n {\n client_name: name,\n redirect_uris: redirect_uri,\n scopes: scopes,\n website: website\n }, Mastodon::App)\n end", "def create(*args)\n if !self.is_?(App)\n self.app_name = HesCentral.application_repository_name\n end\n super(*args)\n end", "def instance(name)\n apps[name] ||= new\n end", "def instance(name)\n apps[name] ||= new\n end", "def application!\n res = get!(APPLICATION_PATH)\n build_application(res)\n end", "def app\n TicTacToeNApp # most examples use App.new - reason why we don't need .new here? ?????\n end", "def create_new_app\n rake 'install --trace'\n FileUtils.rm_rf(rails_app)\n sh \"relevance_rails new #{rails_app} --database=#{database} --relevance-dev\"\n end", "def new\n\t\t@application = Application.new\t\t\n\tend", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to(app_path(@app)) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def find_or_create_app(app_name)\n create_app(app_name)\n rescue\n @heroku.app.info(app_name)\n end", "def create_app app_name, dev_name, dev_email\n data[:app_name] = app_name\n data[:dev_name] = dev_name\n data[:dev_email] = dev_email\n end", "def create\n @app = App.new(app_params)\n\n if @app.save\n render json: @app, status: :created, location: @app\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end", "def app_with_name name\n AX::Application.new name\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render json: @app, status: :created, location: @app }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_application(name)\n store_dir = File.join(@path, name)\n FileUtils.mkdir_p store_dir\n \n ApplicationConfiguration.new name, store_dir\n end", "def create\n authorize! :create, @app\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(name=nil, options={})\n\t\toptions[:name] = name if name\n\t\txml(post('/apps', :app => options)).elements[\"//app/name\"].text\n\tend", "def app_for(name)\n app_name = app?(name) ? name : \"all\"\n\n @apps[name] ||= App.new(app_name, @roots)\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to app_activities_path(@app) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(name=nil, options={})\n\t\tparams = {}\n\t\tparams['app[name]'] = name if name\n\t\txml(post('/apps', params)).elements[\"//app/name\"].text\n\tend", "def create\n @app_instance = AppInstance.new(app_instance_params)\n\n respond_to do |format|\n if @app_instance.save\n format.html { redirect_to @app_instance, notice: 'App instance was successfully created.' }\n format.json { render action: 'show', status: :created, location: @app_instance }\n else\n format.html { render action: 'new' }\n format.json { render json: @app_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(cli = false)\n $logger.info(\"Creating new gear #{@uuid} for application #{@app.name}\")\n\n if cli\n command = %Q(oo-devel-node app-create -c #{uuid} -a #{@app.uuid} --with-namespace #{@app.account.domain} --with-app-name #{@app.name} --with-secret-token=DEADBEEFDEADBEEFDEADBEEFDEADBEEF)\n $logger.info(%Q(Running #{command}))\n results = %x[#{command}]\n assert_equal(0, $?.exitstatus, %Q(#{command}\\n #{results}))\n end\n\n # Create the container object for use in the event listener later\n begin\n @container = OpenShift::Runtime::ApplicationContainer.new(@app.uuid, @uuid, nil, @app.name, @app.name, @app.account.domain, nil, nil)\n rescue Exception => e\n $logger.error(\"#{e.message}\\n#{e.backtrace}\")\n raise\n end\n\n unless cli\n @container.create('DEADBEEFDEADBEEFDEADBEEFDEADBEEF')\n end\n end", "def app_with_pid pid\n AX::Application.new pid\n end", "def app\n App.load(self.app_id)\n end", "def new(app_path, generator: Project.new(cli: self, app_path: app_path))\n app = generator.generate\n say <<~SAY\n\n Success! Created #{app.camelized_name} at #{app.absolute_app_path}\n Inside that directory, you can run several commands:\n\n #{cmd :server}\n Starts the development server\n\n #{cmd :test}\n Starts the test runner\n\n #{cmd :generate}\n Add elements you may have skipped, like RSpec or Webpack\n\n We suggest that you begin by typing:\n\n #{cmd :cd, path: app_path}#{cmd :server}\n\n and visiting localhost:3000 in your browser.\n For more information, check out the generated readme file.\n\n SAY\n end", "def new(*args, &bk)\n setup_application!\n super(*args, &bk)\n end", "def app\n @app || make_app\nend", "def new_app(opts)\n api.app_new(\n applet: opts[:applet_dxid],\n name: AppSeries.construct_dxname(user.username, opts[:name], opts[:scope]),\n title: \"#{opts[:title]} \",\n summary: \" \",\n description: \"#{opts[:readme]} \",\n version: \"r#{opts[:revision]}-#{SecureRandom.hex(3)}\",\n resources: opts[:asset_dxids],\n details: { ordered_assets: opts[:asset_dxids] },\n openSource: false,\n billTo: bill_to,\n access: opts[:internet_access] ? { network: [\"*\"] } : {},\n )[\"id\"]\n end", "def create_app(name, url)\n JSON.parse((@cloudvox_api[\"/applications/create.json\"].post :call_flow => {:name => name}, :agi => {:url => url}).body)\n end", "def new_sixjo_rack_app (next_app, options={})\n\n App.new(next_app, @routes, @helpers, @configures, options)\n end", "def create\n @app = current_user.apps.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, :notice => \"The application app was successfully created\" }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => :new }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def create\n params[:app][:user_id] = current_user.id\n @app = App.create(params[:app])\n if @app.save\n redirect_to source_app_path(@app), notice: 'app was successfully created.'\n else\n render :new\n end\n end", "def create\n @app = App.new(app_params)\n @app.count = 0\n @app.uid = SecureRandom.uuid\n respond_to do |format|\n if @app.save\n format.html { redirect_to app_path(uid: @app.uid), notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def app(*args)\n\t\tif args == []\n\t\t\treturn MRA_App\n\t\telse\n\t\t\treturn MRA_App.by_name(*args)\n\t\tend\n\tend", "def build_app(app)\n options[:environment] = ENV['SHELF_ENV'] || options[:environment]\n\n middleware[options[:environment]].reverse.each do |middleware|\n middleware = middleware.call(self) if middleware.respond_to?(:call)\n\n next unless middleware\n\n klass, *args = middleware\n app = klass.new(app, *args)\n end\n\n app\n end", "def create\n @newapp = Newapp.new(params[:newapp])\n\n respond_to do |format|\n if @newapp.save\n format.html { redirect_to @newapp, notice: 'Newapp was successfully created.' }\n format.json { render json: @newapp, status: :created, location: @newapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_application!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil)\n # First, we need to fetch the data from Apple, which we then modify with the user's values\n r = request(:get, 'ra/apps/create/?appType=ios')\n data = parse_response(r, 'data')\n\n # Now fill in the values we have\n data['versionString']['value'] = version\n data['newApp']['name']['value'] = name\n data['newApp']['bundleId']['value'] = bundle_id\n data['newApp']['primaryLanguage']['value'] = primary_language || 'English'\n data['newApp']['vendorId']['value'] = sku\n data['newApp']['bundleIdSuffix']['value'] = bundle_id_suffix\n data['companyName']['value'] = company_name if company_name\n\n # Now send back the modified hash\n r = request(:post) do |req|\n req.url 'ra/apps/create/?appType=ios'\n req.body = data.to_json\n req.headers['Content-Type'] = 'application/json'\n end\n\n data = parse_response(r, 'data')\n handle_itc_response(data)\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def app instance=nil, *args\n raise \"Forbidden singelton action\" unless instance || @app\n return @app unless instance\n @app ||= instance.tap{|a| a.args=*args }\n @app\n end", "def application\n Application.new self[:application]\n end", "def set_app_instance\n @app_instance = AppInstance.find(params[:id])\n end", "def get_instance(payload)\n AppManifestInstance.new(@version, payload, app_sid: @solution[:app_sid])\n end", "def build_app(options = {})\n @prev_rails_env = ENV[\"RAILS_ENV\"]\n ENV[\"RAILS_ENV\"] = \"development\"\n ENV[\"SECRET_KEY_BASE\"] ||= SecureRandom.hex(16)\n\n FileUtils.rm_rf(app_path)\n FileUtils.cp_r(app_template_path, app_path)\n\n # Delete the initializers unless requested\n unless options[:initializers]\n Dir[\"#{app_path}/config/initializers/**/*.rb\"].each do |initializer|\n File.delete(initializer)\n end\n end\n\n add_to_config <<-RUBY\n config.eager_load = false\n config.session_store :cookie_store, key: \"_myapp_session\"\n config.active_support.deprecation = :log\n config.active_support.test_order = :random\n config.action_controller.allow_forgery_protection = false\n config.log_level = :info\n RUBY\n end", "def generate\n @app = Class.new(Rails::Application) {\n config.eager_load = false\n config.session_store :cookie_store, key: \"_myapp_session\"\n config.active_support.deprecation = :log\n config.root = File.dirname(__FILE__)\n config.log_level = :info\n # Set a fake logger to avoid creating the log directory automatically\n fake_logger = Logger.new(nil)\n config.logger = fake_logger\n Rails.application.routes.default_url_options = {host: \"example.com\"}\n }\n @app.respond_to?(:secrets) && @app.secrets.secret_key_base = \"3b7cd727ee24e8444053437c36cc66c4\"\n\n yield @app if block_given?\n @app.initialize!\n end", "def build_application(config_hash)\n config = build_config(config_hash)\n\n Application.new(plugins, config)\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n flash[:success] = 'App was successfully saved.'\n format.html { redirect_to @app }\n format.json { render :show, status: :created, location: @app }\n else\n flash[:danger] = 'There was a problem creating the App Catalog Page.'\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # check if we are missing the required force\n required_force_is_missing?\n\n # apply some force, when we are boosted with one\n apply_force\n\n # download or update local cache\n download_or_update_local_cache\n\n # copy the framework files from the cache\n copy_over_cache_files\n\n # make necessary changes for the new app, if we were successful in\n # download otherwise, remove the downloaded source\n if has_laravel?\n say_success \"Cloned Laravel repository.\"\n\n # update permissions on storage/ directory (this is the default)\n update_permissions_on_storage if @options[:perms]\n\n # configure this new application, as required\n configure_from_options\n\n say_success \"Hurray! Your Laravel application has been created!\"\n else\n say_failed \"Downloaded source is not Laravel framework or its fork.\"\n show_info \"Cleaning up..\"\n # remove all directories that we created, as well as the cache.\n clean_up\n # raise an error since we failed.. :(\n raise LaravelError, \"Source for downloading repository is corrupt!\"\n end\n end", "def app; @app; end", "def initialize(app); end", "def create_application\n unless self.has_current_application?\n Application.create_for_student self\n end\n end", "def get_instance(payload)\n ApplicationInstance.new(@version, payload, account_sid: @solution[:account_sid])\n end", "def create_app_root\n puts \"Create app root named #{name}\"\n end", "def app\n App\nend", "def create\n @admin_app = App.new(admin_app_params)\n\n respond_to do |format|\n if @admin_app.save\n format.html { redirect_to [:admin, @admin_app], notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @admin_app] }\n else\n format.html { render :new }\n format.json { render json: [:admin, @admin_app].errors, status: :unprocessable_entity }\n end\n end\n end", "def app\n @app ||= begin\n lock!\n to_app\n end\n end", "def create!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil, platform: nil, platforms: nil, itunes_connect_users: nil)\n puts(\"The `version` parameter is deprecated. Use `ensure_version!` method instead\") if version\n client.create_application!(name: name,\n primary_language: primary_language,\n sku: sku,\n bundle_id: bundle_id,\n bundle_id_suffix: bundle_id_suffix,\n company_name: company_name,\n platform: platform,\n platforms: platforms,\n itunes_connect_users: itunes_connect_users)\n end", "def generate\n @app = Class.new(Rails::Application) {\n config.eager_load = false\n config.session_store :cookie_store, key: \"_myapp_session\"\n config.active_support.deprecation = :log\n config.root = File.dirname(__FILE__)\n config.log_level = :info\n # Set a logger to avoid creating the log directory automatically\n config.logger = Logger.new(ENV[\"DEBUG\"] ? $stdout : nil)\n config.logger.level = Logger::DEBUG\n Rails.application.routes.default_url_options = {host: \"example.com\"}\n\n if Rails::VERSION::MAJOR >= 6\n Rails.application.config.hosts << \"www.example.com\"\n end\n\n # fix railties 5.2.0 issue with secret_key_base\n # https://github.com/rails/rails/commit/7419a4f9 should take care of it\n # in the future.\n if Rails::VERSION::MAJOR == 5\n if Rails::VERSION::MINOR >= 2\n def secret_key_base\n \"3b7cd727ee24e8444053437c36cc66c4\"\n end\n end\n end\n }\n @app.respond_to?(:secrets) && @app.secrets.secret_key_base = \"3b7cd727ee24e8444053437c36cc66c4\"\n\n yield @app if block_given?\n @app.initialize!\n end", "def gen_app\n unless File.exists?(app_dir)\n original_dir = FileUtils.pwd\n Dir.mkdir(root_dir) unless (!root_dir or File.exists?(root_dir))\n FileUtils.cd(root_dir) if root_dir\n `#{rails_str}`\n FileUtils.cd(original_dir)\n true\n end\n end", "def create\n authorize @application, policy_class: Oauth::ApplicationPolicy\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if T.unsafe(Doorkeeper).configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def create_app_object(appname)\n app = OpenStruct.new\n appsettings = JSON.parse(File.read(appname))\n appsettings[\"appvariables\"].each { |k,v| app.public_send(\"#{k}=\", v) }\n injectfunctions($defaultshortcuts[\"tabshash\"],appsettings[\"tabshash\"]).each { |k,v| app.public_send(\"#{k}=\", v) }\n injectfunctions($defaultshortcuts[\"fileshash\"],appsettings[\"fileshash\"]).each { |k,v| app.public_send(\"#{k}=\", v) }\n injectfunctions($defaultshortcuts[\"viewshash\"],appsettings[\"viewshash\"]).each { |k,v| app.public_send(\"#{k}=\", v) }\n return app\nend", "def create\n @app = App.new(params[:app])\n \n # This is not right. I should write a dashboard view that talks to the controllers restfully\n if @app.auto_generate_database || !@app.snapshot_id.empty?\n # when valid? is call, self-generated app attibues are populated\n if @app.valid?\n if generate_database\n @app.save\n redirect_to @app, notice: 'App was successfully created.' \n end\n else\n render action: \"new\" \n end\n else\n if @app.save\n redirect_to @app, notice: 'App was successfully created.' \n else\n render action: \"new\" \n end\n end\n end", "def setup_appengine_application(app, is_new_app)\n initialize_scaling_info_for_app(app)\n uac = UserAppClient.new(@userappserver_private_ip, @@secret)\n app_data = uac.get_app_data(app)\n loop {\n Djinn.log_info(\"Waiting for app data to have instance info for app named #{app}: #{app_data}\")\n\n app_data = uac.get_app_data(app)\n if app_data[0..4] != \"Error\"\n break\n end\n Kernel.sleep(5)\n }\n\n my_public = my_node.public_ip\n my_private = my_node.private_ip\n app_language = app_data.scan(/language:(\\w+)/).flatten.to_s\n \n if is_new_app and @app_info_map[app].nil?\n @app_info_map[app] = {}\n @app_info_map[app]['language'] = app_language\n end\n\n shadow = get_shadow\n shadow_ip = shadow.private_ip\n ssh_key = shadow.ssh_key\n app_dir = \"/var/apps/#{app}/app\"\n app_path = \"/opt/appscale/apps/#{app}.tar.gz\"\n FileUtils.mkdir_p(app_dir)\n \n # First, make sure we can download the app, and if we can't, throw up a\n # dummy app letting the user know there was a problem.\n if !copy_app_to_local(app)\n place_error_app(app, \"ERROR: Failed to copy app: #{app}\")\n app_language = \"python27\"\n end\n\n # Next, make sure their app has an app.yaml or appengine-web.xml in it,\n # since the following code assumes it is present. If it is not there\n # (which can happen if the scp fails on a large app), throw up a dummy\n # app.\n if !HelperFunctions.app_has_config_file?(app_path)\n place_error_app(app, \"ERROR: No app.yaml or appengine-web.xml for app \" +\n app)\n app_language = \"python27\"\n end\n\n HelperFunctions.setup_app(app)\n\n if is_new_app\n maybe_start_taskqueue_worker(app)\n end\n\n if is_new_app\n if @app_info_map[app]['nginx'].nil?\n @app_info_map[app]['nginx'] = find_lowest_free_port(Nginx::START_PORT)\n @app_info_map[app]['haproxy'] = find_lowest_free_port(\n HAProxy::START_PORT)\n @app_info_map[app]['nginx_https'] = Nginx.get_ssl_port_for_app(\n @app_info_map[app]['nginx'])\n end\n\n @app_info_map[app]['appengine'] = []\n end\n\n # Only take a new port for this application if there's no data about\n # this app. Use the existing port if there is info about it.\n nginx_port = @app_info_map[app]['nginx']\n https_port = @app_info_map[app]['nginx_https']\n proxy_port = @app_info_map[app]['haproxy']\n\n port_file = \"/etc/appscale/port-#{app}.txt\"\n if my_node.is_login?\n HelperFunctions.write_file(port_file, \"#{@app_info_map[app]['nginx']}\")\n Djinn.log_debug(\"App #{app} will be using nginx port #{nginx_port}, \" +\n \"https port #{https_port}, and haproxy port #{proxy_port}\")\n\n @nodes.each { |node|\n if node.private_ip != my_node.private_ip\n HelperFunctions.scp_file(port_file, port_file, node.private_ip,\n node.ssh_key)\n end\n }\n else\n loop {\n if File.exists?(port_file)\n Djinn.log_debug(\"Got port file for app #{app}\")\n break\n else\n Djinn.log_debug(\"Waiting for port file for app #{app}\")\n Kernel.sleep(5)\n end\n }\n end\n\n # TODO(cgb): Make sure we don't add the same cron lines in twice for the same\n # app, and only start xmpp if it isn't already started\n if my_node.is_shadow?\n CronHelper.update_cron(my_public, nginx_port, app_language, app)\n start_xmpp_for_app(app, nginx_port, app_language)\n end\n\n # We only need a new full proxy config file for new apps, on the machine\n # that runs the login service (but not in a one node deploy, where we don't\n # do a full proxy config).\n login_ip = get_login.private_ip\n if my_node.is_login?\n begin\n static_handlers = HelperFunctions.parse_static_data(app)\n Djinn.log_run(\"chmod -R +r #{HelperFunctions.get_cache_path(app)}\")\n rescue Exception => e\n # This specific exception may be a json parse error\n error_msg = \"ERROR: Unable to parse app.yaml file for #{app}.\" + \\\n \" Exception of #{e.class} with message #{e.message}\" \n place_error_app(app, error_msg)\n static_handlers = []\n end\n\n Nginx.write_fullproxy_app_config(app, nginx_port, https_port, my_public,\n my_private, proxy_port, static_handlers, login_ip)\n\n loop {\n Kernel.sleep(5)\n success = uac.add_instance(app, my_public, nginx_port)\n Djinn.log_debug(\"Add instance returned #{success}\")\n if success\n # tell ZK that we are hosting the app in case we die, so that\n # other nodes can update the UserAppServer on its behalf\n ZKInterface.add_app_instance(app, my_public, nginx_port)\n break\n end\n }\n end\n\n if my_node.is_appengine?\n # send a warmup request to the app to get it loaded - can shave a\n # number of seconds off the initial request if it's java or go\n # go provides a default warmup route\n # TODO: if the user specifies a warmup route, call it instead of /\n warmup_url = \"/\"\n\n app_manager = AppManagerClient.new(my_node.private_ip)\n # TODO(cgb): What happens if the user updates their env vars between app\n # deploys?\n if is_new_app\n @num_appengines.times { |index|\n appengine_port = find_lowest_free_port(STARTING_APPENGINE_PORT)\n Djinn.log_info(\"Starting #{app_language} app #{app} on \" +\n \"#{HelperFunctions.local_ip}:#{appengine_port}\")\n\n xmpp_ip = get_login.public_ip\n\n pid = app_manager.start_app(app, appengine_port,\n get_load_balancer_ip(), app_language, xmpp_ip,\n [Djinn.get_nearest_db_ip()], HelperFunctions.get_app_env_vars(app))\n\n if pid == -1\n place_error_app(app, \"ERROR: Unable to start application \" + \\\n \"#{app}. Please check the application logs.\")\n end\n\n # Tell the AppController at the login node (which runs HAProxy) that a\n # new AppServer is running.\n acc = AppControllerClient.new(get_login.private_ip, @@secret)\n loop {\n result = acc.add_appserver_to_haproxy(app, my_node.private_ip,\n appengine_port)\n if result == NOT_READY\n Djinn.log_info(\"Login node is not yet ready for AppServers to \" +\n \"be added - trying again momentarily.\")\n Kernel.sleep(5)\n else\n Djinn.log_info(\"Successfully informed login node about new \" +\n \"AppServer for #{app} on port #{appengine_port}.\")\n break\n end\n }\n }\n else\n Djinn.log_info(\"Restarting AppServers hosting old version of #{app}\")\n result = app_manager.restart_app_instances_for_app(app)\n end\n\n if is_new_app\n # now doing this at the real end so that the tools will\n # wait for the app to actually be running before returning\n done_uploading(app, app_path, @@secret)\n end\n end\n\n APPS_LOCK.synchronize {\n if @app_names.include?(\"none\")\n @apps_loaded = @apps_loaded - [\"none\"]\n @app_names = @app_names - [\"none\"]\n end\n\n if is_new_app\n @apps_loaded << app\n else\n @apps_to_restart.delete(app)\n end\n }\n end", "def app\n Application.new\nend", "def new\n @recommendation = App.new\n end", "def create_app_project\n app_project = open_app_project(recreate: !configuration.incremental_installation?)\n\n spec_platforms = spec.available_platforms.flatten.reject do |platform|\n !configuration.platforms.nil? && !configuration.platforms.include?(platform.string_name.downcase)\n end\n\n if spec_platforms.empty?\n Pod::Command::Gen.help! Pod::StandardError.new \"No available platforms in #{spec.name}.podspec match requested platforms: #{configuration.platforms}\"\n end\n\n spec_platforms\n .map do |platform|\n consumer = spec.consumer(platform)\n target_name = \"App-#{Platform.string_name(consumer.platform_name)}\"\n next if app_project.targets.map(&:name).include? target_name\n native_app_target = Pod::Generator::AppTargetHelper.add_app_target(app_project, consumer.platform_name,\n deployment_target(consumer), target_name)\n # Temporarily set Swift version to pass validator checks for pods which do not specify Swift version.\n # It will then be re-set again within #perform_post_install_steps.\n Pod::Generator::AppTargetHelper.add_swift_version(native_app_target, Pod::Validator::DEFAULT_SWIFT_VERSION)\n native_app_target\n end\n .compact.tap do\n app_project.recreate_user_schemes do |scheme, target|\n installation_result = installation_result_from_target(target)\n next unless installation_result\n installation_result.test_native_targets.each do |test_native_target|\n scheme.add_test_target(test_native_target)\n end\n end\n end\n .each do |target|\n Xcodeproj::XCScheme.share_scheme(app_project.path, target.name) if target\n end\n app_project.save\n end", "def create_rails3_app rails_version, arel_version = nil\n app = app_path rails_version\n clone AREL_REPO, AREL_CLONE_PATH\n FileUtils.cd AREL_CLONE_PATH do\n if arel_version\n run 'git', 'reset', '--hard', \"v#{arel_version}\"\n else # \"Edge\"\n run 'git', 'reset', '--hard', 'origin/master'\n end\n run 'git', 'clean', '-f'\n end\n\n clone RAILS_REPO, RAILS_CLONE_PATH\n FileUtils.cd RAILS_CLONE_PATH do\n if rails_version\n run 'git', 'reset', '--hard', \"v#{rails_version}\"\n else # \"Edge\"\n run 'git', 'reset', '--hard', 'origin/master'\n end\n run 'git', 'clean', '-f'\n\n begin\n clean_bundler_environment\n run 'env', \"AREL=#{AREL_CLONE_PATH}\",\n 'bundle', 'install', '--path', '../bundle', '--without', 'db'\n FileUtils.rm_r(app) if File.exist?(app)\n run 'env', \"AREL=#{AREL_CLONE_PATH}\",\n 'bundle', 'exec', 'bin/rails', 'new', app, '--skip-activerecord', '--dev'\n ensure\n restore_bundler_environment\n end\n end\n\n create_gemfile app\n bundlerize app\n end", "def initialize(app = nil)\n @app = app\n end", "def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: 'Test app was successfully created.' }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def app\n BranchApp.new\nend", "def application(name, options = {}, &blk)\n add_child(:applications, Hubcap::Application.new(self, name, options, &blk))\n end", "def app\n @app\n end", "def create(options)\n API::request(:post, 'escrow_service_applications', options)\n end", "def create_google_apps\n GoogleApps.new(self).generate\n end", "def app(name, url)\n url = URI.parse(url)\n apps[name] = { base: \"#{url.scheme || \"http\"}://#{url.host}:#{url.port}\", uri: url.path }\n end", "def initialize(app)\n @app = app\n end", "def initialize(app)\n @app = app\n end", "def initialize(app)\n @app = app\n end", "def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end", "def new_deployment(attrs)\n Deployment.from_hash(api, attrs.merge(:app_environment => self))\n end", "def create_application(application_entity)\n # handle runtimes / cartridges\n fail_with(:only_one_runtime) if application_entity[:runtimes].length > 1\n fail_with(:must_have_runtime) if application_entity[:runtimes].empty?\n application_entity[:cartridge] = cartridge(application_entity.delete(:runtimes)[0])\n\n # updates the application with a valid region identity\n retrieve_region(application_entity) if application_entity.key?(:region)\n\n # enable application scaling by default\n application_entity[:scale] = true unless application_entity.key?(:scale)\n created_application = post(\"/domains/#{app_domain}/applications\", body: application_entity).body\n # now make sure we keep at least 2 deployments, allows proper identification of application state\n updated_application = put(\"/application/#{created_application[:data][:id]}\",\n body: { keep_deployments: 2, auto_deploy: false }).body\n to_nucleus_app(updated_application[:data])\n end", "def new(name)\n ARGV.shift\n #@log.debug \"command 'new' with arguments: #{ARGV.join(', ')}\"\n Generator::Application.start ARGV\n end", "def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: \"Test app was successfully created.\" }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def setup_example_app(options={})\n $example_app_counter ||= 0\n $example_app_counter += 1\n\n FileUtils.mkdir_p(tmp_dir)\n write_app_file(options)\n $LOADED_FEATURES.delete app_file_path\n require app_file_path\n self.app = app_const\n app_const.enable :reloader\n end", "def add_application(appname)\n app = self[appname]\n if !app\n app = Application.new(appname)\n @applications << app\n end\n yield app if block_given?\n return app\n end", "def app\n @app ||= Origen::Application.from_namespace(self.class.to_s)\n end", "def construct_app_stack\n @framework_instance ||= framework.new\n top_app = @framework_instance\n\n middleware.each do |mw_class|\n top_app = mw_class.new(top_app)\n end\n\n top_app\n end", "def create\n\t\t@application = Application.new(params[:application])\n\n\t\tif @application.save\n\t\t\tflash[:developer] = \"Yay! Your application has been registered!\"\n\t\t\tcurrent_developer.applications << @application\n\t\t\t# Randomizer as in http://goo.gl/qpI5Rv\n\t\t\taccess_token = Array.new(32){rand(36).to_s(36)}.join\n\t\t\tkey = ApiKey.create(:access_token => access_token)\n\t\t\tkey.application = @application\n\t\t\tkey.save\n\t\t\tredirect_to developer_home_path\n\t\telse\n\t\t\trender :action => 'register'\n\t\tend\n\tend" ]
[ "0.7870538", "0.7640673", "0.72283405", "0.71094316", "0.7086358", "0.7038164", "0.7009703", "0.69701815", "0.6915618", "0.6841742", "0.6841453", "0.68192816", "0.68180037", "0.6802538", "0.6790683", "0.6786979", "0.678153", "0.6702812", "0.6678305", "0.6678035", "0.66758007", "0.6648282", "0.66451746", "0.66451746", "0.66375375", "0.6601289", "0.6601289", "0.65512455", "0.6506284", "0.65030307", "0.6484914", "0.64721537", "0.64717793", "0.64711577", "0.6470646", "0.6452955", "0.6440337", "0.64228135", "0.6392162", "0.63749665", "0.63558406", "0.63462776", "0.6341968", "0.6314399", "0.6310758", "0.6310022", "0.63095737", "0.62754107", "0.6242961", "0.6236632", "0.6229385", "0.6207634", "0.6204072", "0.61985976", "0.6176053", "0.6159434", "0.6137204", "0.6128227", "0.6096076", "0.6088885", "0.60846657", "0.60722333", "0.60684854", "0.6067144", "0.6048927", "0.6046377", "0.6034622", "0.6033598", "0.6027338", "0.6014397", "0.6007704", "0.6004612", "0.6001755", "0.60011214", "0.5991934", "0.5968846", "0.5965693", "0.5945028", "0.59407854", "0.5940002", "0.593594", "0.5910726", "0.5902727", "0.5901291", "0.590121", "0.5883548", "0.58821094", "0.5876365", "0.58755565", "0.58755565", "0.58755565", "0.586971", "0.58579206", "0.5843488", "0.5842404", "0.5839839", "0.5827315", "0.58234113", "0.58157796", "0.5812011", "0.5811976" ]
0.0
-1
Is this a valid app?
def valid? App.valid?(path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_app?(app)\n !!(app =~ APP_REGEX)\n end", "def valid_apps\n apps.select { |app| app.valid? }\n end", "def app?\n app_host = Radiant.config['app.host']\n match = unless app_host.blank?\n request.host == app_host\n else\n request.host =~ /^app\\./\n end\n !!match\n end", "def standalone?\n not $SLICED_APP\n end", "def standalone?\n not $SLICED_APP\n end", "def unsuccessful_app?\n !awarded? && !withdrawn?\n end", "def ensure_app_exists!\n return if app\n UI.user_error!(\"Could not find app with App Identifier '#{Precheck.config[:app_identifier]}'\")\n end", "def check_application_id\n return if application_id\n @logger.display('application_id_missing')\n exit 1\n end", "def validate_app_from_app_id(app_id)\n Rails.logger.info(\"Enter Validate App from App Id\")\n \n # there should be no request for account in this context (access_origin)\n if params[:controller] == \"accounts\" \n return false\n elsif params[:controller] == \"apps\"\n return params[:id] == app_id\n else\n return params[:app_id] == app_id # this case handles any other controller..\n # app_id must be there for anyother request other than account \n end\n rescue => e \n Rails.logger.error(\"**** ERROR **** #{e.message}\")\n false\n end", "def is_app_instance?\n if @service_type == 'http' && @path_name == '/' && @balancer_configuration == 'app'\n return true\n end\n\n false\n end", "def valid_model_for?(app)\n self.destination_root = options[:root]\n return false unless correct_path?\n\n check_app_existence(app)\n\n if options[:destroy]\n self.behavior = :revoke\n else\n unless options[:force]\n say \"#{@camel_name} already exists.\"\n say \"Please, change the name.\"\n return false\n end\n end if model_name_already_exists?\n\n return false if has_invalid_fields?\n\n check_orm\n end", "def validate_app_name!\n raise ResponseError::ArgumentError.new(\"Application ID is missing\") if self.app_name.nil?\n raise ResponseError::ArgumentError.new(\"Application ID is blank\") if self.app_name.empty?\n end", "def has_appstore?\n !appstore_url.blank?\n end", "def verify_rails!\n unless rails?\n abort unless agree \"`#{dest}' does not appear to be a rails app; continue? \"\n end\n end", "def is_app_token?\n case\n when params['token_type'] == 'app' || token.to_s[/^xoxa/]\n true\n when token.to_s[/^xoxp/]\n false\n else\n nil\n end\n end", "def app_user?\n member_type == MEMBER_TYPE[:app]\n end", "def is_app_token?\n auth['token_type'].to_s == 'app'\n end", "def security_require_verify_apps\n return @security_require_verify_apps\n end", "def security_require_verify_apps\n return @security_require_verify_apps\n end", "def security_require_verify_apps\n return @security_require_verify_apps\n end", "def allowed_to_create_apps\n return @allowed_to_create_apps\n end", "def has_app_action\n validate :uuid, /^[a-zA-Z0-9]+$/\n validate :application, /^[a-zA-Z0-9]+$/\n uuid = request[:uuid]\n app_name = request[:application]\n if File.exist?(\"/var/lib/openshift/#{uuid}/#{app_name}\")\n reply[:output] = true\n else\n reply[:output] = false\n end\n reply[:exitcode] = 0\n end", "def check_permissions\n unless can?(:manage_app_instances, app_instance.owner)\n redirect_to mnoe_home_path, alert: \"You are not authorized to perform this action\"\n return false\n end\n true\n end", "def looks_valid?\n # The application name is present\n tiddlywiki_title == 'TiddlyWiki' &&\n # Has one or other store divs but not both\n (store.present? ^ encrypted_store.present?) &&\n # We're able to extract a tiddlywiki version\n tiddlywiki_version.present?\n end", "def not_acceptable\n return app_not_acceptable unless core.request?\n render_core_exception :not_acceptable\n end", "def valid_app_access_token?\n app_access_token = request.headers['X-App-Access-Token']\n\n app_access_token.present? &&\n app_access_token == Rails.application.secrets.app_access_token\n end", "def valid?\n !Kontagent.configuration.base_url.nil? && !Kontagent.configuration.api_key.nil? && !Kontagent.configuration.secret_key.nil? \n end", "def valid_for_platform?; true; end", "def access?(application)\n applications.include?(application)\n end", "def valid?\n gemfile? && gemfile_lock? && gem?(\"rake\") &&\n (gem?(\"thin\") || gem?(\"puma\")) && config_ru? &&\n rakefile? && task?(\"db:migrate\") && task?(\"db:setup\")\n end", "def app_configured?; end", "def valid?\n gemfile? && gemfile_lock? && gem?(\"thin\") &&\n gem?(\"rake\") && config_ru?\n end", "def find_application\n unless self.app_name.blank?\n self.app = App.active.by_short_or_long_name(self.app_name).try(:first)\n self.application_lookup_failed = self.app.blank?\n end\n # be sure the call back returns true or else the call will fail with no error message\n return true\n end", "def valid?\n return false unless name\n return false unless version\n return false unless summary\n #return false unless maintainer\n #return false unless homepage\n true\n end", "def app_starting?\n @launching\n end", "def valid?(env)\n request = Rack::Request.new(env)\n unless (access_id = request.params['AccessKeyID'])\n #puts \"AccessKeyID not found in Params\"\n return false\n end\n unless (secret_key = @accounts[access_id])\n #puts \"No SecretKey found for AccessKeyID #{access_id.inspect}\"\n return false\n end\n AuthenticatedApi::Server.valid_signature?(request, secret_key)\n end", "def cross_app_enabled?\n valid_cross_process_id? &&\n valid_encoding_key? &&\n cross_application_tracer_enabled?\n end", "def has_current_application?\n not self.current_application.nil?\n end", "def validate_application_available_to_user\n return unless membership\n\n unless membership.has_access_to_application?(application)\n errors.add :application, :application_not_available, app_name: application_name, organisation_name: membership.organisation.name\n end\n end", "def app_available?(app)\n `which #{app}`.strip == \"\" ? false : true\n end", "def run?\n @run ||= true\n @run and !@running and app_file? and $0.expand_path == app_file.expand_path\n end", "def valid_app_access_token?\n token = request.headers['X-App-Access-Token']\n\n token.present? && token == Rails.application.secrets.app_access_token\n end", "def app_name_configured?\n names = Agent.config[:app_name]\n return names.respond_to?(:any?) && names.any?\n end", "def valid_without_global?\n valid?\n end", "def same_sha1_as_installed?\n app.sha1 == installed_app_sha1\n end", "def check_app_auth(client_id, client_secret, response_type, state)\n error = false\n\n if Settings.multi_application == 'true'\n app = App.where(id: client_id).first\n if app.nil?\n flash[:error] = 'App not found'\n error = true\n redirect_to root_path\n else\n if response_type == 'code'\n if !app.enable_code\n error = true\n url = generate_url(app.redirect_uri, error: 'unsupported_response_type', error_description: 'Code response type not allowed', state:state)\n redirect_to url\n elsif !app.password_correct?(client_secret)\n error = true\n url = generate_url(app.redirect_uri, error: 'access_denied', error_description: \"App secret #{client_secret} for app #{client_id} incorrect\", state:state)\n redirect_to url\n end\n elsif !app.enable_implicit and response_type == 'token'\n error = true\n url = generate_url(app.redirect_uri, error: 'unsupported_response_type', error_description: 'Token (implicit) response type not allowed', state:state)\n redirect_to url\n elsif response_type != 'code' and response_type != 'token'\n error = true\n url = generate_url(app.redirect_uri, error: 'unsupported_response_type', error_description: 'Response type not supported', state:state)\n redirect_to url\n end\n end\n else\n if Settings.single_application_mode_id != client_id\n error = true\n url = generate_url(Settings.single_application_mode_url + Settings.single_application_mode_path, error: 'access_denied', error_description: 'App id and/or secret incorrect', state:state)\n redirect_to url\n elsif response_type == 'code'\n if Settings.single_application_mode_enable_code == 'false'\n error = true\n url = generate_url(Settings.single_application_mode_url + Settings.single_application_mode_path, error: 'unsupported_response_type', error_description: 'Code response type not allowed', state:state)\n redirect_to url\n elsif Settings.single_application_mode_secret != client_secret\n error = true\n url = generate_url(Settings.single_application_mode_url + Settings.single_application_mode_path, error: 'access_denied', error_description: 'App id and/or secret incorrect', state:state)\n redirect_to url\n end\n elsif Settings.single_application_mode_enable_implicit == 'false' and response_type == 'token'\n error = true\n url = generate_url(Settings.single_application_mode_url + Settings.single_application_mode_path, error: 'unsupported_response_type', error_description: 'Token (implicit) response type not allowed', state:state)\n redirect_to url\n elsif response_type != 'code' and response_type != 'token'\n error = true\n url = generate_url(Settings.single_application_mode_url + Settings.single_application_mode_path, error: 'unsupported_response_type', error_description: 'Response type not supported', state:state)\n redirect_to url\n end\n end\n destroy_session if error\n\n error\n end", "def app_not_exist?(host_path)\n\t\t\thost_path.downcase\n\t\t\tif Dir.exists?(host_path)\n\t\t\t\tDeployLog.stderr_log.fatal {\"The app #{host_path} already exists\"}\n\t\t\t\tSTDERR.puts Rainbow(\"ERROR: The app #{host_path} already exists\").red\n\t\t\t\treturn false\n\t\t\telse\n\t\t\t\ttrue \n\t\t\tend\n\t\tend", "def private_app_no?\r\n make_sure_apps_page unless @driver.current_url =~ /.*apps.*/\r\n disabled_or_not_upload = new_app_locator(:upload_a_zip_btn).attribute('disabled') \r\n disabled_or_not_paste = new_app_locator(:paste_git_repo_input).attribute('disabled') \r\n if disabled_or_not_paste && disabled_or_not_upload\r\n puts \"+ <action> private_app_no? NO\"\r\n return true\r\n end\r\n puts \"+ <action> private_app_no? YES\"\r\n return false\r\n end", "def check_apps\n flag = false\n ps_out = []\n\tif !Has_Sys_ProcTable\n\t\tIO.popen(PS_command).each do |line|\n\t\t\tps_out.push line\n\t\tend\n\telse\n\t\tProcTable.ps do |ps|\n\t\t\tps_out.push ps\n\t\tend\n\tend\n\n begin\n\t\tFile.open(Conf,'r').each do |filename|\n\t\t filename.chomp!\n\t\n\t\t\t# Skip this app if we were provided with a filepath argument, and this\n\t\t\t# app doesn't match it.\n\t\n\t next if (ARGV[1].to_s != '' and ARGV[1].to_s != filename)\n\t\t\tif Has_Sys_ProcTable\n\t\t\t\tps_out.each do |ps|\n\t\t\t\t\tflag = true if (ps.cmdline =~ /ruby\\s+#{filename}/)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tps_out.each do |line|\n\t\t\t\t\tflag = true if (line =~ /ruby\\s+#{filename}/)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n rescue Exception\n raise $!\n end\n\n if (flag)\n raise \"Iowa application(s) are already running; can not start application(s).\"\n end\nend", "def has_app_info? itemdata\n itemdata.is_a?(Hash) && itemdata['docid']\n end", "def run_app_not_exist?(host_path)\n\t\t\tif v.app_not_exist?(host_path)\n\t\t\t\t$stdout.puts Rainbow(\"Success: No pre-existig app at '#{host_path}'\").green\n\t\t\telse\n\t\t\t\texit 1\n\t\t\tend\n\t\tend", "def response_is_cross_app?( response )\n return false unless response\n return false unless cross_app_enabled?\n return false if get_ty_data_header(response).empty?\n\n return true\n end", "def valid?\n core_client.api_valid?\n end", "def ensure_new_app\n if File.exists?(File.join(Rails.root, 'config/innsights.yml')) && !Innsights.test_mode\n puts warning && exit\n end\n end", "def check_running_state\n if running?\n if prompt.yes?(\"Your app is running based on PID files (#{pids_files.join(', ')}). Do you want continue?\", default: false)\n logger.warn(\"App is running (pids: #{pids_files.join(', ')}). Ignore it and continue.\")\n else\n error('App is running')\n end\n end\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def has_app_for_company?(company)\n has_app_for_company_number?(company.company_number)\n end", "def app_installed?(app_id)\n @bridge.app_installed?(app_id)\n end", "def app_installed?(app_id)\n @bridge.app_installed?(app_id)\n end", "def application?\n (filtered_file =~ /^\\[PROJECT_ROOT\\]/i) && !(filtered_file =~ /^\\[PROJECT_ROOT\\]\\/vendor/i)\n end", "def sexy_app_name\n # puts \"gml_application=#{gml_application.inspect} application=#{application.inspect}\"\n (!application.blank? && application) || (!gml_application.blank? && gml_application) || ''\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def ensure_app_same\n installed_app_bundle = installed_app_bundle_dir\n\n if !installed_app_bundle\n RunLoop.log_debug(\"App: #{app} is not installed\")\n return true\n end\n\n installed_sha = installed_app_sha1\n app_sha = app.sha1\n\n if installed_sha == app_sha\n RunLoop.log_debug(\"Installed app is the same as #{app}\")\n return true\n end\n\n RunLoop.log_debug(\"The app you are testing is not the same as the app that is installed.\")\n RunLoop.log_debug(\" Installed app SHA: #{installed_sha}\")\n RunLoop.log_debug(\" App to launch SHA: #{app_sha}\")\n RunLoop.log_debug(\"Will install #{app}\")\n\n uninstall_app_with_simctl\n install_app_with_simctl\n true\n end", "def valid?\n owner_validator = EnumAttributeValidator.new('String', [\"user\", \"application\"])\n return false unless owner_validator.valid?(@owner)\n return true\n end", "def is_zz?\n zz[:app_config] != nil\n end", "def check_app!(user)\n if !user['app_ids'].include?(@app['_id']) && @app['app_type'] == Apps::OPEN_APP\n UsersManager.update(user, {\n 'app_ids' => user['app_ids'] + [ @app['_id'] ]\n })\n end\n\n unless user['app_ids'].include?(@app['_id'])\n raise Uasthree::UserAppNoMatchError.new(params[:username], params[:app_uname])\n end\n end", "def development? ; @app.options[:env] == :development ; end", "def app_is_installed?\n if installed_app_bundle_dir ||\n simctl.app_container(device, app.bundle_identifier)\n true\n else\n false\n end\n end" ]
[ "0.79393876", "0.6913875", "0.68905956", "0.68200004", "0.68200004", "0.68141043", "0.67631054", "0.6584829", "0.65410805", "0.6536357", "0.65136474", "0.6476398", "0.6451508", "0.6375936", "0.6370027", "0.6357075", "0.6356346", "0.634567", "0.634567", "0.634567", "0.63446105", "0.62922835", "0.62833863", "0.6247305", "0.62470347", "0.62297726", "0.6221018", "0.6217899", "0.6201718", "0.61947817", "0.617625", "0.61727685", "0.6172256", "0.6168882", "0.6165455", "0.6137205", "0.6134311", "0.6126903", "0.61221987", "0.6111338", "0.6101757", "0.6094458", "0.60891616", "0.6081904", "0.6072844", "0.6068975", "0.6050386", "0.60465115", "0.6036983", "0.6018527", "0.60155576", "0.6006701", "0.6006521", "0.59894204", "0.59678835", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5964934", "0.5959537", "0.59594387", "0.59594387", "0.5959127", "0.59416837", "0.59341717", "0.59341717", "0.59341717", "0.59341717", "0.59341717", "0.59316224", "0.5923436", "0.5917006", "0.59168035", "0.5911226", "0.58981967" ]
0.7342881
1
Returns the arches for the binary.
def arches @arches ||= lipo.info end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nics\n if !@nics[:macs].empty?\n return @nics.reject {|k| k == :macs }\n end\n\n info_nics\n end", "def system_bins\n %w[\n cal col colcrt colrm\n getopt\n hexdump\n logger look\n mesg more\n nologin\n renice rev\n ul\n whereis\n ]\n end", "def get_brewery(noko)\n brewery = ''\n if (node = noko.css('span a').first)\n brewery = node.children.to_s.gsub(/\\n/, '')\n brewery.gsub! /RBBA/, ''\n brewery.strip!\n end\n brewery\n end", "def get_brewery(noko)\n brewery = ''\n if (node = noko.css('span a').first)\n brewery = node.children.to_s.gsub(/\\n/, '')\n brewery.gsub! /RBBA/, ''\n brewery.strip!\n end\n brewery\n end", "def bands\n self.concerts.map do |concert|\n concert.band\n end\n end", "def get_rules\n rules = Array.new\n\n RULE_TYPES.each do |reg|\n ebtables_exit = `#{CONF[:ebtables]} -L FORWARD`\n\n rules << ebtables_exit.split(\"\\n\")[3..-1].collect do |l|\n line = l.strip\n m = line.match(reg)\n\n if m\n interface=m[1]\n {\n :interface => interface, \n :rule => line\n }\n else\n nil\n end\n end.compact\n end\n\n rules.flatten\nend", "def ats\n abtAts.unpack 'C*'\n end", "def bottles\n Stash.all_hash_cellar_key[self].map{|stash|\n stash.bottle\n }\n end", "def h_surrounding_hexes( h )\n h.surrounding_hexes.map{ |sh| hget( sh ) }\n end", "def gear_inches\n gear.gear_inches(diameter)\n end", "def branches\n edges\n end", "def taps\n shell!(\"brew tap\").strip.lines.map(&:strip)\n end", "def bin\n\t\t# Note that the CHR-ROM binary format is arranged as two bit planes of 8 bytes each,\n\t\t# where the first plane is the LSBs of each pixel, and the 2nd plane is the MSBs.\n\t\t# In other words, the data stream is as follows:\n\t\t# * 8 bytes; each byte, with each bit (in order of MSB to LSB) representing the LSB\n\t\t# of each pixel, from left-to-right, starting with the 1st byte for the top row,\n\t\t# and the 8th byte for the bottom row.\n\t\t# * 8 bytes again, this time with each bit representing the MSB (2nd bit) of each pixel.\n\t\t#NOTE: This is possibly NOT the most efficient way to do this:\n\t\tlsb_plane = @pixels.map{ |b| b & 1} # Get the LSBs of each pixel.\n\t\tmsb_plane = @pixels.map{ |b| (b>>1) & 1 } # Get the MSBs.\n\t\t# Convert the planes into one long joined binary string:\n\t\t[(lsb_plane + msb_plane).join].pack('B*')\n\tend", "def get_cast\n get_characters.map {|char| char.actor}\n end", "def codes\n array = []\n self.each_byte do |x|\n array.push(Bio::AminoAcid.names[x.chr])\n end\n return array\n end", "def surrounding_hexes\n # puts self.inspect, self.q.inspect, self.r.inspect\n DIRECTIONS.map{ |e| AxialHex.new( @q+e[0], @r+e[1] ) }\n end", "def surrounding_hexes\n # puts self.inspect, self.q.inspect, self.r.inspect\n DIRECTIONS.map{ |e| AxialHex.new( @q+e[0], @r+e[1] ) }\n end", "def colors\n @wmiiconfig.read(\"/bar/#{@name}/colors\").split(/\\s+/).map do |txt|\n txt.scan(/[a-fA-F0-9]{2}/).map{|hex| hex.to_i(16)}\n end\n end", "def get_bargraph()\n return(get_cmd('BG;',0.1,0.5,3).gsub(/^BG/,'').gsub(/;$/,'').to_i)\nend", "def [] file\n code = `xattr -p com.apple.FinderInfo #{file.shellescape} 2>&1`.split(/\\s+/m)\n if code.size == 32\n code\n else\n ['00']*32\n end\n end", "def get_cartridge_array\n cs = Array.new\n\n cartridges.each do |c|\n cs << c.name\n end\n\n cs\n end", "def get_habitats()\n\n all_habitats = []\n\n @raw.raw_habitats.each do |habitat|\n all_habitats.push(habitat.keys)\n end\n\n @habitats = all_habitats.flatten.uniq.sort_by(&:downcase)\n\n end", "def hunks\n each_hunk.to_a\n end", "def oct(a)\n\tb = []\n\ta.each do |x|\n\t\tif x % 8 == 0\n\t b << x\n\t\tend\n\tend\nreturn b.inspect\t\nend", "def corners\n [0, 2, 6, 8].find do |corner|\n @board.cells[corner] == \" \"\n end\n end", "def atoms\n each_atom.map.to_a\n end", "def atoms\n each_atom.map.to_a\n end", "def report_breakpoints\n bps = Array.new\n @abnormal_chr.each_pair do |c, chr_list|\n chr_list.each do |chr|\n bps << chr.breakpoints\n end\n end\n bps.delete_if { |c| c.empty? }\n bps.flatten!\n bps = bps.uniq { |bp| bp.to_s }\n return bps\n end", "def gethyperlist\n # /hsltv3prod-iaas/rack1/jids \n # racks = zoo_connection.get_children(:path => \"/hsltv3prod-iaas\")\n racks = `ssh zookeeper-1 \"/opt/ibm-zookeeper-3.2.2/bin/zkCli.sh ls /#{@channel}\" |tail -1`\n puts \"racks are #{racks}\" unless @verbose == false\n end", "def all_weapons_codes\n weapon_codes = []\n all_weapons.each do |hex_code, values|\n weapon_codes << hex_code\n end\n weapon_codes\n end", "def asteroids\n @asteroids ||= STDIN.read.\n each_line.\n with_index.\n flat_map do |line, linenum|\n line.each_char.\n with_index.\n flat_map do |char, charnum|\n char == '#' ? [[charnum, linenum]] : []\n end\n end\nend", "def entry_edges\n segment_config_network.network.entry_edges rescue []\n end", "def edges\n i = 0\n @hypernyms.each do |key, values|\n i += values.length\n end\n i\n end", "def archs_for_command cmd\n cmd = cmd.to_s # If we were passed a Pathname, turn it into a string.\n cmd = `/usr/bin/which #{cmd}` unless Pathname.new(cmd).absolute?\n cmd.gsub! ' ', '\\\\ ' # Escape spaces in the filename.\n\n archs = IO.popen(\"/usr/bin/file #{cmd}\").readlines.inject([]) do |archs, line|\n case line\n when /Mach-O (executable|dynamically linked shared library) ppc/\n archs << :ppc7400\n when /Mach-O 64-bit (executable|dynamically linked shared library) ppc64/\n archs << :ppc64\n when /Mach-O (executable|dynamically linked shared library) i386/\n archs << :i386\n when /Mach-O 64-bit (executable|dynamically linked shared library) x86_64/\n archs << :x86_64\n else\n archs\n end\n end\n archs.extend(ArchitectureListExtension)\nend", "def get_archs(lib_path)\n cmd('lipo', '-info', lib_path).split(':').last.strip.split(/\\s/)\nend", "def list_all_character\n puts \"--------------------------------------------------------------------------------\\n\\n\"\n puts Amiiboproject::Amiibo.all.map {|x| x.character}.uniq\n puts \"--------------------------------------------------------------------------------\\n\\n\"\n end", "def armor\n return @@playable_char_armor\n end", "def brew_cask_list\n \"ls -1 /opt/homebrew-cask/Caskroom/\"\n end", "def km_get_reacid(data)\n return data.map{|d| d.scan(/(?<r>R\\d{5})/)}.flatten.sort\nend", "def get_interfaces\n brctl_exit =`#{CONF[:brctl]} show`\n brctl_exit.split(\"\\n\")[1..-1].collect{|l| l.split.last }\nend", "def armor\n return @@armor\n end", "def armor\n return @@armor\n end", "def armor\n return @@armor\n end", "def armor\n return @@armor\n end", "def armor\n return @@armor\n end", "def bars(bitmap, depth)\n s = bitmap.set?(0) ? \"|\" : \" \" \n\n (1...depth).each do |i|\n if bitmap.set?(i)\n s += bar(depth) \n else\n s += @spacenobar\n end\n end\n return s\n end", "def all_branches\n %x( git branch ).gsub!('*', '').gsub!(' ', '').split(\"\\n\")\nend", "def buff_icons\r\n icons = []\r\n @buffs.each_with_index {|lv, i| icons.push(buff_icon_index(lv, i)) }\r\n icons.delete(0)\r\n icons\r\n end", "def used_bins\n [self.class.bin_sym]\n end", "def cells\n Enumerator.new do |yielder|\n buffer.each do |row|\n row.each do |cell|\n yielder << cell\n end\n end\n end\n end", "def borders\n return @borders\n end", "def all_chips\n chips.values.flatten\n end", "def gather_command\n @command = []\n @lines.each do |x|\n if x[0,1].is_i?\n @command.push(x.split(/ /).s_to_i)\n else\n @command.push(x.split(//))\n end\n end\n end", "def get_num_bingos\n check_and_mark_left_x\n check_and_mark_right_x\n check_horizontal_bingos\n check_vertical_bingos\n @num_bingos\n end", "def edges\n temp = []\n @strokes.each do |stroke|\n position = stroke.position\n colour = stroke.colour\n case stroke\n when CircleStroke\n radius = stroke.radius\n part = CirclePart.new(position, radius, colour)\n when LineStroke\n points = stroke.points.map { |p| p + position }\n part = PointsPart.new(points, colour)\n end\n temp << part\n end\n temp\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_array_of_solid_blocks\n @solid_blocks = []\n\n @map_image_key.each_key do |key|\n if (key.upcase == key) and (key != ',')\n @solid_blocks.push(key)\n end\n end\n end", "def ascii_brands\n\" _ _ \n| | | | \n| |__ _ __ __ _ _ __ __| |___ \n| '_ \\\\| '__/ _` | '_ \\\\ / _` / __|\n| |_) | | | (_| | | | | (_| \\\\__ \\\\\n|_.__/|_| \\\\__,_|_| |_|\\\\__,_|___/\"\n\tend", "def bedroom_bulbs\n\t\tbedroom_bulbs = [\n\t\t\tHuebulb.new(1)\n\t\t]\n\tend", "def hidratos_carbono\r\n hc = 0\r\n @lista_alimentos.each do |i|\r\n hc += i.carbohidratos\r\n end\r\n return hc\r\n end", "def bsd str\n str = str.dup.force_encoding 'US-ASCII' if str.respond_to? :force_encoding\n str.scan(/../).map do |colors|\n # Enumerator#with_index unavailable in 1.8.6\n acc = []\n colors.unpack('C*').each_with_index do |n, i|\n acc << case n\n when 65..72 then (n - 35 + (i*10)).to_s + ';1'\n when 97..104 then (n - 67 + (i*10)).to_s\n else (39 + (i*10)).to_s\n end\n end\n acc.join ';'\n end\n rescue\n []\n end", "def get_children_area(scommand_name)\n area = 0.0\n @children.each do |child|\n\n if child.commandName == scommand_name\n area = child.get_area() + area\n end\n end\n return area\n end", "def tagged_ports(switch)\n out = %x(snmpwalk -v 2c -c public #{switch} dot1qVlanStaticUntaggedPorts)\n lines = out.split(\"\\n\").select { |line| line.match(\"Hex-STRING\") }\n # Example line of data:\n # Q-BRIDGE-MIB::dot1qVlanStaticUntaggedPorts.1 = Hex-STRING: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF\n binlines = lines.map do |line|\n line.split(\":\")[3]\n end.map do |line|\n line.delete(' ')\n end.map do |line|\n line.hex.to_s(2).rjust(line.size*4, '0')\n end\n \n taggedports = []\n binlines.each do |line|\n binline = line.split(\"\")\n binline.each_index do |index|\n taggedports.push(index + 1) if binline[index] == \"0\"\n end\n end\n taggedports.sort.uniq\nend", "def get_braille_arrays\n string = braille_to_string\n lines = string.scan(/.{1,80}/)\n pairs = lines.map do |string|\n string.scan(/../)\n end\n end", "def available_go_cabs\n arr = []\n @go_cabs.select { |cab| arr << cab if (cab.available == true) }\n return arr\n end", "def get_children_area(scommand_name)\n area = 0.0\n @children.each do |child|\n\n if child.commandName == scommand_name\n area = child.get_area() + area\n end\n end\n return area\n end", "def index\n @bitches = Bitch.all\n end", "def print_brands_ASCII\n $report_file.puts \"\n\n ╔╗ ┬─┐┌─┐┌┐┌┌┬┐┌─┐\n ╠╩╗├┬┘├─┤│││ ││└─┐\n ╚═╝┴└─┴ ┴┘└┘─┴┘└─┘\n\"\nend", "def allswitches\n result = @switches.allswitches\n result[1]\n end", "def all_occupied_spaces\n occupied_spaces('black') + occupied_spaces('white')\n end", "def rows\n @cr[3] >> 1 & 0x3f\n end", "def fen_board_as_array\n map = get_board_to_fen_map\n board=[0]*64\n fen_board = self.board.split(\",\").map{|s| s.to_i}\n map.each { |k, v|\n board[k] = fen_board[v-1]\n }\n board.each_slice(8).to_a\n end", "def all_characters\n @shows.map do |show|\n show.characters\n end.flatten\n end", "def binaries\n sizes = self.binary_sizes\n bin_array = MemoryPointer::new( :pointer, sizes.length )\n total_size = 0\n pointers = []\n sizes.each_with_index { |s, i|\n total_size += s\n pointers[i] = MemoryPointer::new(s)\n bin_array[i].write_pointer(pointers[i])\n }\n error = OpenCL.clGetProgramInfo(self, BINARIES, total_size, bin_array, nil)\n error_check(error)\n bins = []\n devs = self.devices\n sizes.each_with_index { |s, i|\n bins.push [devs[i], pointers[i].read_bytes(s)]\n }\n return bins\n end", "def sides\n [@length, @breadth, @length, @breadth]\n end", "def pattern\n @nz.map { |nz_cell| nz_cell[0..1] }\n end", "def corners\n unless @corners\n @corners = [first_corner]\n\n ((cell_collection.width+1) * (cell_collection.height+1)).times do |i|\n next_corner = next_clockwise_vertex(@corners.last)\n\n if @corners.include?(next_corner)\n break\n else\n @corners << next_corner\n end\n end\n end\n\n @corners\n end", "def rcon\n [0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a][self]\n end", "def num_bases\n self.map { |chr,n| n }.sum\n end", "def areas\n self.areacodes.map{|areacode| Area.find areacode}\n end", "def gear_inches\n\tratio * (rim + (tire * 2))\nend", "def candyList\n\t\t['sweet1.png','sweet2.png','sweet3.png','sweet4.png','sweet5.png','sweet6.png','sweet7.png','sweet8.png']\n\tend", "def from_ansicon\n return unless @env['ANSICON'] =~ /\\((.*)x(.*)\\)/\n size = [$2, $1].map(&:to_i)\n size if nonzero_column?(size[1])\n end", "def bonds\n each_bond.map.to_a\n end", "def bonds\n each_bond.map.to_a\n end", "def all_readings\n @readings.map do |reading|\n [reading] + reading.role_refs.map{|rr| rr.objectification_join}\n end.flatten.compact\n end", "def rules\n return @rules unless @rules.nil?\n\n # this initialization code runs only once\n @rules = {}\n 7.downto(0).each do |rule_key|\n key = rule_key.to_s(2).rjust(3, '0') # convert to binary, pad left with 0\n @rules[key.to_sym] = RULE_NAME >> rule_key & 1 # just the one bit\n end\n\n @rules\n end", "def get_row_cells row\n\t\treturn (row * 9...row * 9 + 9).to_a\n\tend", "def get_col_cells col\n\t\treturn (col...9 ** 2).step(9).to_a\n\tend", "def get_ones\r\n ones = []\r\n @icon.each_with_index do |row, row_index|\r\n row.each_with_index do |item, col_index|\r\n if item == 1\r\n ones << [row_index, col_index]\r\n end\r\n end\r\n end\r\n ones\r\n end", "def all_branches\n @branches ||= git_call('branch -a').split(\"\\n\").collect { |s| s.strip }\n end", "def room_info\n ret = []\n ret << id.force_encoding('UTF-8')\n ret << name.force_encoding('UTF-8')\n ret << stage\n ret << rule\n @avatar_ids = []\n i = 0\n while i < ROOM_CAP\n temp_player_avatar = nil\n temp_player = player_array[i]\n temp_player_avatar = temp_player.current_avatar if temp_player\n if temp_player_avatar\n @avatar_ids << temp_player_avatar.id\n ret << temp_player_avatar.id\n ret << temp_player_avatar.name.force_encoding('UTF-8')\n ret << temp_player_avatar.level\n ret << temp_player_avatar.point\n ret << temp_player_avatar.win\n ret << temp_player_avatar.lose\n ret << temp_player_avatar.draw\n else\n @avatar_ids << -1\n ret << -1\n ret << -1\n ret << -1\n ret << -1\n ret << -1\n ret << -1\n ret << -1\n end\n if i < player_array.size && player_array.size == ROOM_CAP && temp_player\n if temp_player.id == AI_PLAYER_ID\n ret << CpuCardData[cpu_card_data_id].current_cards_ids\n else\n ret << temp_player_avatar.current_cards_ids\n end\n else\n ret << [-1, -1, -1]\n end\n i += 1\n end\n ret\n end", "def arp_src_mac= i; typecast \"arp_src_mac\", i; end", "def combos floor\n indices = []\n floor.each_char.with_index do |x, i|\n indices << i if x == '1'\n end\n\n indices.combination(1).to_a + indices.combination(2).to_a\n end", "def bits\n flavor_info[:bits]\n end", "def all\n @rules ||= raw.values.flatten.map { |rule| Accessibility::Rule.new(rule) }\n end", "def corners\n [lower_left, lower_right, upper_right, upper_left]\n 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 exits\n extractNums= []\n for eIndex in 0...roomAdj.length\n extractNums.append(roomAdj.to_a[eIndex].number)\n end\n return extractNums\n end", "def pieces\n self.cells.values.map {|c| c.piece }.compact.uniq\n end" ]
[ "0.5222067", "0.5077296", "0.5006084", "0.5006084", "0.49460915", "0.49194238", "0.4915931", "0.4906189", "0.4901691", "0.4856426", "0.4829221", "0.48280406", "0.4822663", "0.4803449", "0.4722294", "0.46761513", "0.46761513", "0.46694702", "0.46603346", "0.46172515", "0.4610432", "0.45959485", "0.45757282", "0.45644185", "0.45368728", "0.45343775", "0.45343775", "0.45291895", "0.452406", "0.45227444", "0.45008457", "0.44993374", "0.449823", "0.4495362", "0.44845676", "0.44739658", "0.44684798", "0.44678465", "0.44663692", "0.44577765", "0.4452171", "0.4452171", "0.4452171", "0.4452171", "0.4452171", "0.44507664", "0.44495827", "0.4447936", "0.44440243", "0.44402242", "0.44372174", "0.4436147", "0.4430704", "0.4428207", "0.44235432", "0.4422451", "0.4418493", "0.44166043", "0.44155684", "0.4414972", "0.4414158", "0.44117388", "0.4410664", "0.44084135", "0.44066226", "0.44054192", "0.43938085", "0.43928367", "0.4392377", "0.43920246", "0.4388073", "0.43768862", "0.43762746", "0.43690026", "0.43576238", "0.43568048", "0.4353595", "0.43453053", "0.43452737", "0.4344653", "0.43352416", "0.4333912", "0.43245268", "0.4319139", "0.4319139", "0.4318627", "0.43087453", "0.4308356", "0.43068182", "0.4305911", "0.4305341", "0.43013445", "0.4298492", "0.42984033", "0.42968962", "0.42967594", "0.42932642", "0.42908794", "0.42848918", "0.4280919" ]
0.5481402
0