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 |
|---|---|---|---|---|---|---|
Exercise 2 1) 2 2) nil 3) "Joe" 4) "four" 5) nil Exercise 3
|
def multiply(x,y)
x*y
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def questionOne(frustration)\n if frustration == \"Yes\"\n return 3\n end \n \n if frustration == \"Not at all\"\n return 1\n end \n \n if frustration == \"I can't tell\"\n return 2\n end\nend",
"def first_not_done_exercise\n i = 0\n while(i < self.user_sequence.size() && self.user_sequence[i][2]) do\n i = i + STEP_SIZE\n end\n if i < self.user_sequence.size()\n i = i - STEP_SIZE + 1\n while(self.user_sequence[i][2]) do\n i = i + 1\n end\n return self.user_sequence[i][0]\n elsif self.user_sequence.last[2] # last exercise is done\n return nil\n else\n i = i - STEP_SIZE + 1\n while(self.user_sequence[i][2]) do\n i = i + 1\n end\n return self.user_sequence[i][0]\n end\n end",
"def next_exercise_minimal_path_not_done\n i = 0\n while(i < self.user_sequence.size() && self.user_sequence[i][2]) do\n i = i + STEP_SIZE\n end\n if i < self.user_sequence.size()\n return self.user_sequence[i][0]\n elsif self.user_sequence.last[2] # last exercise is done\n return nil\n else\n return self.user_sequence.last[0]\n end \n end",
"def printtree(n, t)\n if t.question==nil\n n.times {print \" \"}\n puts t.name\n else\n puts t.question\n printtree n+1, t.yes\n printtree n+1, t.no\n end\n end",
"def question\n instructions.size == 3 ? instructions.last : nil\n end",
"def skipped_questions_explanation\n puts \"\"\n puts \"Now you can answer the questions that you skipped.\"\n puts \"If you can't think of an answer, just hit enter/return to pass.\"\n puts \"Once you've answered or passed these questions we'll go over the answers.\"\n puts \"\"\n end",
"def greet(name)\n\n if name == \"\" || name == nil\n p nil\n else\n return \"hello #{name}!\"\n end\n\nend",
"def question_and_answer(with_error, zero_or_one, mistery_num)\n message = \"Do you see your number here: (y)(n). To exit the game enter the letter e.\".colorize(:blue)\n if with_error == true\n puts \"\\nIncorrect Answer. \" + message\n else \n puts \"\\n#{message}\"\n end \n answer = gets.chomp.upcase\n case answer\n when \"Y\", \"YES\"\n if zero_or_one % 2 == 0\n mistery_num +=\"0\"\n else\n mistery_num +=\"1\"\n end\n return mistery_num\n when \"N\", \"NO\"\n if zero_or_one % 2 == 0\n mistery_num +=\"1\"\n else\n mistery_num +=\"0\"\n end\n return mistery_num\n when \"E\"\n return \"break\"\n else\n question_and_answer(true, zero_or_one, mistery_num)\n end \nend",
"def exercise_119 (number)\n end",
"def divisible(n)\n if n != nil\n # divisibles\n bythree = (n % 3)\n byfive = (n % 5)\n byboth = bythree + byfive\n #\n\n if byboth == 0\n# puts \"Foobar\"\n text = \"Foobar\"\n \n elsif byfive == 0\n# puts \"Bar\"\n text = \"Bar\"\n\n elsif bythree == 0\n# puts \"Foo\"\n text = \"Foo\"\n \n return text\n end\n\n end\n\nend",
"def non_empty(answer)\n answer = nil unless answer != \"\"\n [answer, \"I need an answer. Please?\"]\nend",
"def pluralizer(num,noun)\n p noun == \"sheep\" ? \"#{num} #{noun}\" : noun == \"geese\" ? \"#{num} #{noun}\" :\n num == 1 && noun == \"child\" ? \"#{num} #{noun}\" : noun == \"child\" ? \"#{num} #{noun}ren\" :\n noun == \"children\" ? \"#{num} child\" : num == 1 && noun == \"people\" ? \"#{num} person\" :\n num > 1 ? \"#{num} #{noun}s\" : nil\nend",
"def division(first_number, second_number, third_number)\n# Conditional that removes divide by zero error\n\t\tif second_number == 0\n\tresult = \"You can't divide by zero\"\nelsif third_number == 0\n\tresult = \"You can't divide by zero\"\nelse\n\t\t\t\tif (first_number == \"\") || (second_number == \"\") || (third_number == \"\")\n\tnil\nelsif (first_number == []) || (second_number == []) || (third_number == [])\n\tnil\nelse\n\tresult = first_number / second_number / third_number\nend\nend\n\tresult\n\nend",
"def sentences(number: T.unsafe(nil)); end",
"def solution4(input)\n end",
"def pluralizerPlus(noun, num)\n if noun.match?(/goose|child|person/i) && num != 1\n noun.downcase === \"goose\" ? noun = \"geese\" : nil\n noun.downcase === \"child\" ? noun = \"children\" : nil\n noun.downcase === \"person\" ? noun = \"people\" : nil\n end\n if num > 1 && noun.match?(/geese|children|people/i)\n \"#{num} #{noun}\"\n elsif num > 1\n \"#{num} #{noun}s\"\n elsif num === 1\n \"#{num} #{noun}\"\n elsif num === 0 && noun.match?(/geese|children|people/i)\n \"zero #{noun}\"\n elsif num === 0\n \"zero #{noun}s\"\n else\n \"Please enter a whole number\"\n end\nend",
"def solve_zero_vs_six_vs_nine\n return if @arr[1].nil? || @arr[4].nil?\n\n #p \"1,4: #{@arr[1]},#{@arr[4]}\"\n\n @words.filter{|x| x.length == 6 && @hash[x].nil?}.each{|w|\n if @arr[4].chars.all?{|c| w.chars.include?(c)}\n solved(9, w)\n elsif @arr[1].chars.all?{|c2| w.chars.include?(c2)}\n solved(0, w)\n else\n solved(6, w)\n end\n }\n end",
"def questions(number: T.unsafe(nil), supplemental: T.unsafe(nil), exclude_words: T.unsafe(nil)); end",
"def fizzbuzz(n)\n return \"FizzBuzz\" if n%15==0\n return \"Fizz\" if n%3==0\n return \"Buzz\" if n%5==0\n nil\nend",
"def nextExercise() \n last_done_question = last_question(auto_sequence.user)\n unless last_done_question.nil? \t \n last_exerc = Question.find(last_done_question.from_question_id).exercise.id\n ind_last_exerc = index_of(last_exerc)\n user_sequence[ind_last_exerc][2] = true\n if last_done_question.correct?\n # save as correct answer \n user_sequence[ind_last_exerc][3] = true\n save\n nxt_exerc = next_exercise_minimal_path_not_done\n if nxt_exerc.nil? # no more exercises\n return last_exerc\n # verify if the last exercise index + step size is before of the next exercise of the minimal path\n elsif ind_last_exerc + STEP_SIZE < index_of(Moped::BSON::ObjectId.from_string(nxt_exerc))\n # goes to first exercise not done after the last solved in minimal path\n return first_not_done_exercise\n else \n return nxt_exerc\n end\n else \n save \n nro_tentativas = last_attempt_number(auto_sequence.user)\n mediana = question_median(last_done_question.from_question_id) \n \tif nro_tentativas >= mediana\n min_ind_exerc = last_exercise_minimal_path_correctly_done\n min_index = 0\n if min_ind_exerc.nil? # student failed on every exercises of the minimal path\n # find the last correct exercise before the actual\n min_ind_exerc = last_exercise_correctly_done_before(ind_last_exerc)\n if min_ind_exerc.nil? # no exercise found, then find the last done before the actual\n min_ind_exerc = last_exercise_done_before(ind_last_exerc) \n end\n end\n min_index = index_of(Moped::BSON::ObjectId.from_string(min_ind_exerc)) \n medium_index = (min_index + ind_last_exerc)/2\n return first_not_done_exercise_after_index(medium_index)\n \telse # continues at the same exercise \n \t\treturn last_exerc\n \tend \n end \n else # returns the first exercise\n return self.user_sequence[0][0]\n end\n end",
"def last_exercise_correctly_done_before(index)\n index -= 1\n while index >= 0 && !self.user_sequence[index][3] do\n index -= 1\n end\n if index >= 0\n return self.user_sequence[index][0]\n else\n return nil\n end\n end",
"def fizzbuzz(number)\n return \"FizzBuzz\" if number % 15 == 0\n return \"Fizz\" if number % 3 == 0\n return \"Buzz\" if number % 5 == 0 \n return nil if number % 4 == 0 \n \n number \nend",
"def fizz_buzz_fancy (n)\n (1..n).each do |i|\n x = ''\n x += 'Fizz' if i % 3 == 0\n x += 'Buzz' if i % 5 == 0\n puts(x.empty? ? i : x)\n end\nend",
"def test_dsl_9\n #---------------------------------------------\n show Paper + ((Spock + Paper) - Lizard + Rock)\n #---------------------------------------------\n assert_equal \\\n \"Paper disproves Spock (winner Paper)\\n\" \\\n \"Lizard eats Paper (loser Paper)\\n\" \\\n \"Paper covers Rock (winner Paper)\\n\" \\\n \"Paper tie (winner Paper)\\n\" \\\n \"Result = Paper\\n\", \\\n @out.string\n end",
"def greet(name)\n\nif name == \"\"\n p nil\nelsif name == nil\n p nil\nelse\n \"hello #{name}!\"\nend\n\nend",
"def roll_three\n puts %Q{...........}\n puts %Q{: * :}\n puts %Q{: * :}\n puts %Q{: * :}\n puts %Q{'''''''''''}\nend",
"def solve_two_vs_three_vs_five\n return if @arr[1].nil? || @arr[6].nil?\n\n #p \"1,6: #{@arr[1]},#{@arr[6]}\"\n\n @words.filter{|x| x.length == 5 && @hash[x].nil?}.each{|w|\n if @arr[1].chars.all?{|c| w.chars.include?(c)}\n solved(3, w)\n elsif w.chars.all?{|c2| @arr[6].chars.include?(c2)}\n solved(5, w)\n else\n solved(2, w)\n end\n }\n end",
"def first_second_and_third_students\n puts STUDENT_NAMES[0.. 2]\n # Write a solution that returns the first, second and third students\nend",
"def fizzbuzz(num)\n result = \"\"\n \n if num % 3 == 0 \n result = \"Fizz\"\n end\n \n if num % 5 == 0 \n result += \"Buzz\"\n end\n \n if result.length < 4\n return nil \n end\n result\n\nend",
"def printOdd(number)\n (1...number).each do |num|\n num % 2 == 0 ? (nil) : (puts num)\n end\nend",
"def problem3 n\n 2.step(n,1).each do |x|\n return x-1 if n == 1\n n /= x if x.prime? && (n % x == 0)\n end\nend",
"def q3_page\n\"\n\n\n\n\n\n\n\n\n\n What is your Food Mood?\n\n *-------------------* *-------------------* *-------------------*\n | | | | | |\n | | | | | |\n | | | | | |\n | Old Faves | | Surprise Me! | | Craving |\n | | | | | |\n | | | | | |\n | | | | | |\n *-------------------* *-------------------* *-------------------*\n\n 1: 2: Input your Craving:\n\nAnswer: \"\nend",
"def fizzbuzz(num)\n if num % 3 == 0\n if num % 5 == 0\n \"FizzBuzz\"\n else\n \"Fizz\"\n end\nelsif num % 5 == 0\n \"Buzz\"\nelse\n nil\n end\nend",
"def process_nil(exp)\n return \"Qnil\"\n end",
"def best(first, second, third, *others)\r\n puts \"Winners are #{first}, #{second}, and #{third}.\"\r\n puts \"There were #{others.count} other participants.\"\r\nend",
"def one_two_or_three(n)\n if n == 1\n return 'one'\n elsif n == 2\n return 'two'\n else\n return 'three'\n end\nend",
"def how_many_steps?\n puts \"Left\"\n puts \"Right\"\n puts \"/1\\nRight\\n2\\nLeft/\"\n puts \"/3/\"\n puts \"/4/\"\n puts \"/5/\"\n puts \"/6/\"\nend",
"def last_exercise_minimal_path_correctly_done \n pos = ((self.user_sequence.size() - 1)/STEP_SIZE)*STEP_SIZE #ultimo multiplo de STEP_SIZE\n if self.user_sequence[self.user_sequence.size() - 1][3]\n return self.user_sequence[self.user_sequence.size() - 1][0] # the last one\n else\n pos = ((self.user_sequence.size() - 1)/STEP_SIZE)*STEP_SIZE\n while pos >= 0 && !self.user_sequence[pos][3] do\n pos = pos - STEP_SIZE\n end\n if pos >= 0\n return self.user_sequence[pos][0]\n else\n return nil\n end\n end\n end",
"def fizzbuzz(num)\n if num % 3 == 0 && num % 5 == 0 # return 'FizzBuzz' when number is divisible by 3 and 5\n return \"FizzBuzz\"\n elsif num % 5 == 0 # return 'Buzz' when number is divisible by 5\n return \"Buzz\"\n elsif num % 3 == 0 # return 'Fizz' when number is divisible by 3\n return \"Fizz\"\n else # return nil when number is not divisible by 3 or 5\n return nil\n end\nend",
"def fizzbuzz(number)\n #binding.pry\n if (number % 3 == 0 && number % 5 == 0)\n then \"FizzBuzz\"\n elsif number % 3 == 0\n then \"Fizz\"\n elsif number % 5 == 0\n then \"Buzz\"\n else\n nil\n end\nend",
"def steps (n, row = 0, stair = '')\n return if n == row\n\n if n == stair.length\n puts stair\n return steps(n, row + 1)\n end\n\n stair.length <= row ? stair += '#' : stair += ' '\n\n steps(n, row, stair)\nend",
"def dluralizer(noun,num)\n if num == 1\n p '#{num} #{noun}'\n elsif num > 1 && noun == \"sheep\"\n p '#{num} #{noun}'\n elsif num > 1 && noun == 'goose'\n p '#{num} geese'\n elsif num > 1 && noun == 'child'\n p '#{num} children'\n elsif num > 1 && noun == 'person'\n p '#{num} people'\n elsif num > 1\n p \"#{num} #{noun}s\"\nend",
"def fizzbuzz(n)\n if n % 15 == 0 \n \"FizzBuzz\"\n elsif n % 5 == 0 \n \"Buzz\"\n elsif n % 3 == 0 \n \"Fizz\"\n else\n return nil \n end\nend",
"def pluarlizer(num, noun)\n if noun == \"sheep\"\n p \"#{num} Sheep\"\n elsif noun == \"species\"\n p \"#{num} Species\"\n elsif num == 1 && noun == \"children\"\n p \"#{num} Child\"\n elsif num >= 2 && noun == \"children\"\n p \"#{num} Children\"\n elsif num > 1 && noun == \"geese\"\n p \"#{num} Geese\"\n elsif num == 1 && noun == \"geese\"\n p \"#{num} Goose\"\n elsif num >= 2 && noun == \"geese\"\n p \"#{num} Geese\"\n elsif num == 1 && noun == \"people\"\n p \"#{num} Person\"\n elsif num >= 2 && noun == \"people\"\n p \"#{num} People\"\n elsif num > 1\n p \"#{num} #{noun}s\"\n else\n p \"Something is wrong\"\n end\nend",
"def fizzbuzz(num)\n output = \"\"\n \n output += \"Fizz\" if num % 3 === 0\n output += \"Buzz\" if num % 5 === 0\n \n if output === \"\"\n nil\n else\n output\n end\nend",
"def fizzbuzz( n )\n results = ''\n results << \"Fizz\" if n % 3 == 0\n results << \"Buzz\" if n % 5 == 0\n results.empty? ? n : results\nend",
"def input_students\n # Exercise 7 - Ask for both name and cohort and check conditions\n def enter_info(instruction)\n # Do a loop until user inputs correct value\n while true do\n puts instruction\n # Exercise 10 - Use another method to get rid of last character\n input = gets.gsub(\"\\n\", \"\")\n # If input contains numbers (strings default to 0)\n if input.to_i != 0\n puts \"Letters only\"\n next\n end\n # Break loop if user has entered a valid value\n break unless input.empty?\n puts \"No value entered\"\n end\n input\n end\n # Create method for enter_age\n def enter_age(age)\n # Do a loop until user inputs correct value\n while true do\n puts \"Please enter age\"\n age = gets.chomp.to_i\n age < 18 || age > 99 ? \"Not valid\" : break\n end\n age\n end\n\n puts \"Enter student information as prompted\"\n # Create and empty array\n students = []\n # Loop through adding students\n while true do\n # Get the first name\n name = enter_info(\"Please enter name\")\n # Exercise 5 - Add more information\n # Get cohort\n cohort = enter_info(\"Please enter month of cohort you are attending\")\n # Get the age\n age = enter_age(\"Please enter age\")\n # Get the country of birth\n country = enter_info(\"Please enter country of birth\")\n # Add the student hash to the array\n students << {name: name, cohort: cohort, age: age, country: country}\n # Exercise 9 - Use singular or plural when appropiate\n puts \"Now we have #{students.count} #{one_or_more?(students)}\"\n # Prompt user if they want to add more students, otherwise break\n puts \"Continue adding students? y/n (anything other than y will default to n)\"\n break if gets.chomp.downcase != \"y\"\n\n end\n students\nend",
"def question_length_method1(num)\n questions = []\n questions << \"What is your name?\"\n questions << \"How are you?\"\n questions << \"Is that right?\"\n questions << \"Are you John?\"\n questions << \"How is everything?\"\n\n print questions.select {|n| n.length > num}\nend",
"def roll_four\n puts %Q{...........}\n puts %Q{: * * :}\n puts %Q{: :}\n puts %Q{: * * :}\n puts %Q{'''''''''''}\nend",
"def literacy_chance(odds,math)\n # odds out of 100 char is literate; IF literate, second value is odds in 100 char also numerate\n literacy_chance_roll = d(100)\n case literacy_chance_roll\n when 1..odds\n @@literacy = \"Literate\"\n @@do_math_chance = d(100)\n case do_math_chance\n when 1..math\n @@do_math = \"Yes\"\n else\n @@do_math = \"No\"\n end\n @@do_math = do_math_chance(math)\n else\n @@literacy = \"Illiterate\"\n end\nend",
"def main\n if 0\n p 0\n end\n\n if \"\" then\n p 1\n end\n\n if false\n p 2\n end\n\n if nil\n p 3\n end\n\n scope\nend",
"def stylish_chef\n best_hairstyle = \"Guy Fieri\"\n return \"Martha Stewart\"\n \"Guy Fieri\"\nend",
"def eat(how_many=nil)\n (how_many || gets.to_i).array { gets.strip }\n end",
"def fizzbuzz(i)\n\n output = \"\"\n\n if(i % 3 == 0)\n output = output + \"Fizz\"\n end\n\n if(i % 5 == 0)\n output = output + \"Buzz\"\n end\n\n return output == \"\" ? nil : output\nend",
"def pluralizer(num,noun)\n p num > 1 ? \"#{num} #{noun}s\" : nil\nend",
"def fizzbuzz(num)\nif (num % 3 == 0)\n return \"Fizz\"\n elsif ((num % 3 == \"Fizz\") && (num % 5 == \"Buzz\"))\n return \"FizzBuzz\"\n elsif (num % 5 == 0)\n return \"Buzz\"\n else (num /15 == 0)\n \"FizzBuzz\"\n \nend\n return nil\nend",
"def wondrous_sequence(quiz)\n a = [n = quiz]; while n != 1; n = (n % 2 > 0 ? n * 3 + 1 : n / 2); a << n; end; a\n end",
"def bottles(n)\n if n.zero?\n return puts \"No more bottles of beer on the wall\"\n elsif n == 1\n puts \"1 bottle of beer on the wall\"\n else\n puts \"#{n} bottles of beer on the wall\"\n end\n bottles(n-1)\nend",
"def pluralizer string, number\n if n == 1 \n puts \"#{number} #{string}\"\n elsif string == \"person\"\n puts \"#{number} people\"\n elsif string == \"child\"\n puts \"#{number} children\"\n elsif string == \"goose\"\n puts \"#{number} geese\"\n elsif n > 1 \n puts \"#{number} #{string}s\"\n end\nend",
"def say_hello_4 name1, name2\n if name1.empty? or name2.empty?\n return \"Who are you?!\"\n end\n # Doesn't reach the last line because we used return\n \"hello, #{name1} and #{name2}\"\nend",
"def monkey(n)\n i = n\n loop do\n if i > 1\n p \"#{i} little monkeys jumping on the bed,\"\n p \"One fell off and bumped his head,\"\n p \"Mama called the doctor and the doctor said,\"\n p \"No more monkeys jumping on the bed\"\n else\n p \"#{i} little monkey jumping on the bed,\"\n p \"One fell off and bumped his head,\"\n p \"Mama called the doctor and the doctor said,\"\n p \"Get those monkeys right to bed!\"\n return 0 \n end\n i -= 1\n end\nend",
"def test_dsl_8\n #-------------------------------------------------\n show((Rock + Paper) - (Scissors + Lizard) + Spock)\n #-------------------------------------------------\n assert_equal \\\n \"Paper covers Rock (winner Paper)\\n\" \\\n \"Scissors decapitate Lizard (winner Scissors)\\n\" \\\n \"Scissors cut Paper (loser Paper)\\n\" \\\n \"Paper disproves Spock (winner Paper)\\n\" \\\n \"Result = Paper\\n\", \\\n @out.string\n end",
"def fizzbuzz(number) \n output = (number % 3 == 0 ? \"Fizz\" : '') + (number % 5 == 0 ? \"Buzz\" : '') \n if output.length > 0 \n return output \n else \n return nil \n end\nend",
"def last_exercise_done_before(index)\n if self.user_sequence[index][2] \n return self.user_sequence[index][0]\n else\n index -= 1\n while index >= 0 && !self.user_sequence[index][2] do\n index -= 1\n end\n if index >= 0\n return self.user_sequence[index][0]\n else\n return nil\n end\n end \n end",
"def yummie(n)\r\n\r\n print \"(\"\r\n (1..n).each{\r\n print \" \"\r\n }\r\n print \".\"\r\n (1..n).each{\r\n print \" \"\r\n }\r\n print \"v\"\r\n (1..n).each{\r\n print \" \"\r\n }\r\n print \".\"\r\n (1..n).each{\r\n print \" \"\r\n }\r\n print \")\"\r\n\r\nend",
"def print_question(num)\n puts \"=> Please enter the #{num} number:\"\nend",
"def fizz_buzz n\n n%15==0 && \"FizzBuzz\" or n%5==0 && \"Buzz\" or n%3==0 && \"Fizz\" or n\n # (\"FizzBuzz\" if n%15==0) || (\"Buzz\" if n%5==0) || (\"Fizz\" if n%3==0) || n\nend",
"def test_permute_isnil\n word = nil\n assert_nil @grapher.permute(word)\n end",
"def homework(title, topic, date, thesis_statement, pronoun)\n\tparagraph = \"#{title}/n The #{topic} was an interesting topic. It happened in #{date}. \n\tI feel that #{topic} was a very important part of #{date} because \n\t#{pronoun}. #{thesis_statement}. This is what made #{topic} really \n\tinteresting part of #{date} and an important part of history.\"\n\treturn paragraph\nend",
"def print(names)\n# exercise 6 - added in center to print option 1 to align all fields into the center\n# exercise 8 - added in option to print by cohort, can print out each cohort in one go, or specific cohort.\n# exercise 9 - fixed printing statments for singular/plural of student/students\n\n puts \"Do you want: \nThe full list of names (enter 1) \nNames beginning with a specific letter (enter 2)\nNames with less than 12 characters (enter 3)\nPrint by cohort (enter 4)\"\nchoice_possibilities = [1, 2, 3, 4]\n choice = gets.chomp.to_i\n while !choice_possibilities.include?(choice) \n puts \"Please select #{choice_possibilities}.\"\n choice = gets.chomp.to_i\n end\n\n print_header\n\n if choice == 1\n counter = 0\n while counter < names.length\n print_array = \"\"\n\tnames[counter].map{ |y, z| print_array << \"#{y}: #{z}, \"} \n\tputs \"#{counter + 1}. #{print_array.to_s}\".center(100) \n\tcounter += 1\n end\n\n elsif choice == 2\n puts \"what letter would you like?\"\n letter = gets.chomp.downcase\n while letter.length != 1\n puts \"Please enter a single letter\"\n letter = gets.chomp.downcase\n end\n counter = 0\n names.each_with_index do |name, index|\n if name[:name][0].downcase == letter\n\tputs \"#{index + 1}. #{name[:name]} (#{name[:cohort]} cohort)\"\n counter += 1\n end\n end\n puts \"We have #{counter} #{counter == 1 ? \"student\" : \"students\"} with a name starting with #{letter.upcase}.\"\n\n elsif choice == 3\n counter = 0\n names.each_with_index do |name, index|\n if name[:name].length < 12\n puts \"#{index + 1}. #{name[:name]} (#{name[:cohort]} cohort)\"\n counter += 1\n end\n end\n puts \"We have #{counter} #{counter == 1 ? \"student\" : \"students\"}} with a name of less than 12 character.\"\n \n elsif choice == 4\n puts \"Do you want to print all cohorts or a specific cohort? Type all or specific\"\n choice_poss = ['all', 'specific']\n choice = gets.chomp.downcase\n while !choice_poss.include?(choice)\n\tputs \"please enter all or specific\"\n choice = gets.chomp.downcase\n end\n cohorts = []\n names.each do |name|\n cohorts << name[:cohort]\n end\n cohorts.uniq!\n if choice == 'all'\n cohorts.each do |cohort|\n puts \"Cohort: #{cohort}\"\n names.each_with_index { |name, index| puts \"#{index + 1}. Name: #{name[:name]}, Age: #{name[:age]}, Hobby: #{name[:hobby]}\" if name[:cohort] == cohort}\n end \n elsif choice == 'specific'\n puts \"Please choose a cohort\"\n cohorts.each {|x| puts x }\n choice = gets.chomp.to_sym\n while !cohorts.include?(choice)\n\tputs \"Please type an available cohort\"\n\tcohorts.each {|x| puts x}\n\tchoice = gets.chomp.to_sym\n end\n puts \"Cohort: #{choice}\"\n names.each_with_index { |name, index| puts \"#{index + 1}. Name: #{name[:name]}, Age: #{name[:age]}, Hobby: #{name[:hobby]}\" if name[:cohort] == choice}\n end\n end\nend",
"def nonsense name\n yield 1\n puts \"#{name} is a non sense person\"\n yield 2\n puts \"but #{name} is very nice\"\n yield 3\n puts \"he makes people happy\"\nend",
"def problem1(num)\n (1..num-1).select{|a| a%3 ==0 or a%5==0}.reduce(:+)\nend",
"def pluralizer_2 (noun, number)\n if noun == \"foot\" && number > 1\n puts \"#{number} feet\"\n elsif noun == \"family\" && number > 1\n puts \"#{number} families\"\n elsif noun == \"person\" && number > 1\n puts \"#{number} people\"\n elsif number == 0 || number == 1\n puts \"#{number} #{noun}\"\n elsif number > 1\n puts \"#{number} #{noun}s\"\n else \n puts \"Please enter a valid positive number and noun\"\n end\nend",
"def fizzbuzz(number)\n \n if\n \n number % 3 == 0 && number % 5 == 0\n \n \"FizzBuzz\"\n \n elsif \n \n number % 3 == 0\n \n \"Fizz\"\n \n elsif\n\n number % 5 == 0 \n \n \"Buzz\"\n \n \n else\n \n number % 15 != 0\n \n puts \"nil\"\n \n end\nend",
"def reduce!(n)\n loop do\n # pp n\n next if explode!(n)\n next if split!(n)\n # pp n\n return\n end\nend",
"def student_talks\n return \"Could you explain that?\"\n end",
"def hey(string)\n if string.count(\"/A-Z/\") == 10 # Test 3\n p \"Whoa, chill out!\"\n elsif string[0] == \"T\" # Test one passes\n p \"Whatever.\"\n elsif string[0] == \"W\" && string[9] == \"!\" # Test 2\n p \"Whoa, chill out!\"\n elsif string[0] == \"D\" # Test 4\n p \"Sure.\"\n elsif string[0] == \"Y\" # Test 5\n p \"Sure.\"\n elsif string.count(\"/a-z/\") == 10 # Test 6\n p \"Sure.\"\n elsif string[0] == \"L\" # Test 7\n p \"Whatever.\"\n elsif string[0] == \"I\" && string[1] == \"t\" # Test 8\n p \"Whatever.\"\n elsif string[0] == \"W\" && string[31] == \"?\" # Test 9\n p \"Whoa, chill out!\"\n elsif string[0] == \"1\" && string[10] == \"!\" # Test 10\n p \"Whoa, chill out!\"\n elsif string[0] == \"1\" # Test 11\n p \"Whatever.\"\n elsif string[0] == \"4\" # Test 12\n p \"Sure.\"\n elsif string[0] == \"Z\" # Test 13\n p \"Whoa, chill out!\"\n elsif string[2] == \"H\" # Test 14\n p \"Whoa, chill out!\"\n elsif string[0] == \"E\" # Test 15\n p \"Whatever.\"\n elsif string[4] == \"!\" # Test 16\n p \"Sure.\"\n elsif string == \"\" # Test 17\n p \"Fine. Be that way!\"\n elsif string[0] == \" \" # Test 18\n p \"Fine. Be that way!\"\n elsif string[0] == \"\\t\" # Test 19\n p \"Fine. Be that way!\"\n elsif string[1] == \"D\" # Test 20\n p \"Whatever.\"\n end\n end",
"def fizzbuzz(fiz_3)\n if fiz_3 % 3 == 0 && fiz_3 % 5 == 0 \n return \"FizzBuzz\"\n end \n \n if fiz_3 % 3 == 0 \n return \"Fizz\"\n end\n \n if fiz_3 % 5 == 0 \n return \"Buzz\"\n end\nend",
"def test_dsl_6\n #--------------------------------------------\n show Rock + Paper + Scissors + Lizard + Spock\n #--------------------------------------------\n assert_equal \\\n \"Paper covers Rock (winner Paper)\\n\" \\\n \"Scissors cut Paper (winner Scissors)\\n\" \\\n \"Scissors decapitate Lizard (winner Scissors)\\n\" \\\n \"Spock smashes Scissors (winner Spock)\\n\" \\\n \"Result = Spock\\n\", \\\n @out.string\n end",
"def query_user\n puts 'First, pick one:'\n puts '1. Get a user\\'s followers'\n puts '2. Get a user\\'s friends'\n step2 = gets\n case step2.strip\n when \"1\"\n find_followers\n @unique_user_ids = @followers - @my_friends\n puts \"There are #{@unique_user_ids.size} unique users that you don't follow\"\n follow_or_favorite\n when \"2\"\n find_friends\n @unique_user_ids = @friends - @my_friends\n puts \"There are #{@unique_user_ids.size} unique users that you don't follow\"\n follow_or_favorite\n else\n puts \"Sorry, that is not acceptable input, try again.\"\n $stdout.flush\n step1 = gets\n query_user\n end\nend",
"def say_hello4(name1, name2)\n if name1.empty? or name2.empty?\n return \"Who are you?!\"\n end\n # Doesn't reach the last line because we used return\n \"hello, #{name1} and #{name2}\"\nend",
"def fizzbuzz(number)\n result=\"\"\n if number%3 == 0\n result=\"Fizz\"\n end\n if number%5 == 0 \n result+=\"Buzz\"\n end\n if result==\"\"\n result=NIL\n end\n return result\nend",
"def my_solution\n res = \"\"\n choices.each do |k, v|\n res << \" * #{k}\\n\" if v\n end\n return \"(no correct answer)\" if res.blank?\n res\n end",
"def fizzbuzz(num)\nif num % 3 == 0 && num % 5 == 0\n \"FizzBuzz\"\n\nelsif num % 3 == 0\n \"Fizz\"\n\nelsif num % 5 == 0\n \"Buzz\"\n\n else\n nil\n end\nend",
"def praise_person(name, age)\n puts \"#{name} is amazing\"\n puts \"#{name} is charming\"\n puts \"#{name} is talented\"\n puts \"#{name} is #{age} years old\"\n puts \"In 5 years he is going to be #{age + 5}\"\nend",
"def pluralizer (noun, num)\n if num > 1 && noun.include?('goose')\n puts \"#{num}, geese\"\n elsif num > 1\n puts \"#{num}, #{noun}s\"\n else\n puts \"#{num}, #{noun}\"\n end\nend",
"def oh_crap_i_forgot(title, person, location, date, thesis, major_accomplishment, pronoun)\n pronoun = 'male' ? p_use = 'he' : p_use = 'she'\n date < 1000 ? e_or_l = 'early era' : e_or_l = 'late era'\n\n puts \"#{title} : The Story of #{person}\"\n puts \" \"\n puts \"In #{e_or_l} #{location}, #{person} was a pretty big deal. #{thesis}. #{pronoun.capitalize} changed the very fabric of #{location} when #{pronoun} #{major_accomplishment}.\"\n puts \" \"\n puts \"All in all, #{e_or_l} #{location} would not have been so successful without #{person}, nor would #{location} be the way it is today without those contributions.\"\n puts \"By Mikee.\"\nend",
"def fizzbuzz(number)\n #if the number is divisible by both 3 and 5\n if number % 3 == 0 && number % 5 == 0\n \"FizzBuzz\"\n #else div by only 3\n elsif number % 3 == 0\n \"Fizz\"\n #else div by only 5\n elsif number % 5 == 0\n \"Buzz\"\n #else nil\n end\nend",
"def first_not_done_exercise_after_index(index)\n i = index\n while(i < self.user_sequence.size() && self.user_sequence[i][2]) do\n i = i + 1\n end\n if(i < self.user_sequence.size())\n return self.user_sequence[i][0]\n else \n return nil\n end \n end",
"def test_example\n print_label(\"./data/aart_ruby_recursion.txt\")\n this_type = nil\n assert_equal(-1, KarateChop.chop(3, [], this_type))\n assert_equal(-1, KarateChop.chop(3, [1], this_type))\n assert_equal(0, KarateChop.chop(1, [1], this_type))\n #\n assert_equal(0, KarateChop.chop(1, [1, 3, 5], this_type))\n assert_equal(1, KarateChop.chop(3, [1, 3, 5], this_type))\n assert_equal(2, KarateChop.chop(5, [1, 3, 5], this_type))\n assert_equal(-1, KarateChop.chop(0, [1, 3, 5], this_type))\n assert_equal(-1, KarateChop.chop(2, [1, 3, 5], this_type))\n assert_equal(-1, KarateChop.chop(4, [1, 3, 5], this_type))\n assert_equal(-1, KarateChop.chop(6, [1, 3, 5], this_type))\n #\n assert_equal(0, KarateChop.chop(1, [1, 3, 5, 7], this_type))\n assert_equal(1, KarateChop.chop(3, [1, 3, 5, 7], this_type))\n assert_equal(2, KarateChop.chop(5, [1, 3, 5, 7], this_type))\n assert_equal(3, KarateChop.chop(7, [1, 3, 5, 7], this_type))\n assert_equal(-1, KarateChop.chop(0, [1, 3, 5, 7], this_type))\n assert_equal(-1, KarateChop.chop(2, [1, 3, 5, 7], this_type))\n assert_equal(-1, KarateChop.chop(4, [1, 3, 5, 7], this_type))\n assert_equal(-1, KarateChop.chop(6, [1, 3, 5, 7], this_type))\n assert_equal(-1, KarateChop.chop(8, [1, 3, 5, 7], this_type))\n end",
"def odds_and_evens(string, return_odds)\n# Creates new method with two arguments, 'string' and 'return_odds' boolean.\n\n to_return = \"\"\n# Creates new variable and assigns it an empty string.\n\n string.size.times do |index|\n# First applies the .size method to the string to calculate the size of the string and return the resulting number. E.g. if the string is \"Rare\", .size will applied to the string returns 4 because \"Rare\" has 4 letters.\n\n# Second applies the .times to the number returned after calculating the string size. E.g. if the string is \"Rare\", .times will execute the following loop x4 times.\n\n# Third the \"| index |\" means do for each indexed character the following steps. A string has an index, e.g. [[0, r], [1, a], [2, r], [3, e]], where the first character is the index number and the second is the corresponding character. Note '0' is considered an even number for coding purposes.\n\n next if return_odds && index.even?\n # First iteration iterates over index[0], i.e. \"r'.\n # => next if false && r.even?\n # => next if false && true\n # => next if false\n # => therefore tells ruby don't skip \"r\" and instead move on to complete next step using the return value of index[0].\n\n # Second iteration iterates over index[1], i.e. 'a'.\n # => next if false && a.even?\n # => next if false && false\n # => next if false\n # => therefore tells ruby don't skip \"a\" and instead move on to complete next step using the return value of index[1].\n\n # Third iteration iterates over index[2], i.e. the second letter \"r\".\n # => next if false && r.even?\n # => next if false && true\n # => next if false\n # => therefore tells ruby don't skip \"r\" and instead move on to complete next step using the return value of index[2].\n\n # Fourth iteration iterates over index[3], i.e. \"e\".\n # => next if false && e.even?\n # => next if false && false\n # => next if false\n # => therefore tells ruby don't skip \"e\" and instead move on to complete next step using the return value of index[2].\n\n puts index\n\n # First iteration puts value of index[0] to screen.\n\n # Second iteration puts value of index[1] to screen.\n\n # Third iteration puts value of index[2] to screen.\n\n # Fourth iteration puts value of index[3] to screen.\n\n next if !return_odds && index.odd?\n # First iteration continues to iterate this step over index[0], i.e. \"r\".\n # => next if true && r.odd?\n # => next if true && false\n # => next if false\n # => therefore tells ruby don't skip \"r\" and instead move on to complete the next steps using index[0] as return value.\n\n # Second iteration continues to iterate this step over index[1], i.e. \"a\".\n # => next if true && a.odd?\n # => next if true && true\n # => next if true\n # => therefore tells ruby to skip \"a\" and ignore the next steps.\n\n # Third iteration continues to iterate this step over index[2], i.e. \"r\".\n # => next if true && r.odd?\n # => next if true && false\n # => next if false\n # => therefore tells ruby don't skip \"r\" and instead move on to complete the next steps using index[2] as return value.\n\n # Second iteration continues to iterate this step over index[3], i.e. \"e\".\n # => next if true && e.odd?\n # => next if true && true\n # => next if true\n # => therefore tells ruby to skip \"e\" and ignore the next steps.\n\n puts \"#{index}+x\"\n\n # First iteration puts value of \"index[0]+x\" to screen, i.e. \"0+x\".\n\n # Third iteration puts value of \"index[2]+x\" to screen, i.e. \"2+x\".\n\n to_return << string[index]\n # First iteration continues to iterate this step over index[0], i.e. \"r\".\n # => \"\" << string[0]\n # => \"\" << \"r\"\n # => to_return = \"r\"\n # In other words, ruby adds the current return value, index[0] (i.e. \"r\"), to the variable \"to_return\".\n\n # Second iteration continues to iterate this step over index[2], i.e. \"r\".\n # => \"r\" << string[2]\n # => \"r\" << \"r\"\n # => to_return = \"rr\"\n # In other words, ruby adds the current return value, index[2] (i.e. \"r\"), to the variable \"to_return\".\n\n end\n\n to_return\n# Return the final value of to_return after iterating each character in the chosen string. This does not get returned until the above loop has completed.\n\nend",
"def test_dsl_7\n #--------------------------------------------\n show Rock - Paper - Scissors - Lizard - Spock\n #--------------------------------------------\n assert_equal \\\n \"Paper covers Rock (loser Rock)\\n\" \\\n \"Rock crushes Scissors (loser Scissors)\\n\" \\\n \"Scissors decapitate Lizard (loser Lizard)\\n\" \\\n \"Lizard poisons Spock (loser Spock)\\n\" \\\n \"Result = Spock\\n\", \\\n @out.string\n end",
"def mystery(n)\n 0\nend",
"def faculty(n)\n return (1..n).inject(1, :*)\nend",
"def add_nums(x)\n \t# nil + nil\nend",
"def raindrops( number )\n\n output = ''\n\n # Does the number have 3 as a factor?\n # if number % 3 == 0\n # output += 'Pling'\n # end\n\n output += 'Pling' if (number % 3 == 0)\n output += 'Plang' if (number % 5 == 0)\n output += 'Plong' if (number % 7 == 0)\n\n # Check if any of the above were factors, i.e. is output still empty?\n # if output.empty?\n # return number # return early with the original number\n # end\n return number if output.empty?\n\n output # return output string from function\nend",
"def pluralizer string, n\n if n == 1 \n puts \"#{n} #{string}\"\n elsif n > 1 || n==0\n puts \"#{n} #{string}s\"\n end\nend",
"def test(num)\n return \"cowboy bebop\", 1990, num * num * num\nend",
"def always_three\n # ask the user for a number\n puts \"Give me a number\"\n # get the user's number with gets & use to_i to convert to an integer\n # set to a variable\n first_number = gets.to_i\n # math and puts on one line!\n puts 'Always ' + (((first_number + 5) * 2 - 4) / 2 - first_number).to_s\n end",
"def pens_and_notebooks(pens, notebooks)\n puts \"You have #{pens} pens!\"\n puts \"You have #{notebooks} notebooks!\"\n puts \"You have #{pens} pens and #{notebooks} notebooks, you're ready for school!\"\nend",
"def bottles(n)\n if n.zero?\n puts \"no more bottles of beer on the wall\"\n return\n end\n\n puts \"#{n} bottles of beer on the wall\"\n\n bottles(n - 1)\nend"
] |
[
"0.5799408",
"0.56122524",
"0.5544336",
"0.52911764",
"0.5258592",
"0.5179598",
"0.5178137",
"0.51656234",
"0.5159137",
"0.51502025",
"0.51098025",
"0.5089975",
"0.5089311",
"0.50884056",
"0.5066574",
"0.50569147",
"0.5051238",
"0.5050033",
"0.5040818",
"0.50160843",
"0.4998635",
"0.49852085",
"0.49733767",
"0.49597135",
"0.49572882",
"0.4949813",
"0.49496365",
"0.49455088",
"0.49345964",
"0.49310273",
"0.49306816",
"0.4917683",
"0.49148357",
"0.49038422",
"0.4901738",
"0.4900641",
"0.48925528",
"0.48825437",
"0.48796144",
"0.4877824",
"0.48774418",
"0.487206",
"0.48711118",
"0.4864594",
"0.48616868",
"0.48582762",
"0.48528442",
"0.48504952",
"0.48472384",
"0.48461115",
"0.48449165",
"0.4842706",
"0.4840097",
"0.48322916",
"0.48300144",
"0.48261124",
"0.48254353",
"0.48232853",
"0.4814743",
"0.48116368",
"0.4809807",
"0.48088834",
"0.47961375",
"0.47949722",
"0.47945732",
"0.47919786",
"0.47880316",
"0.47854733",
"0.4784955",
"0.4784932",
"0.4781124",
"0.47765177",
"0.47590616",
"0.4754471",
"0.4746987",
"0.47455394",
"0.4741871",
"0.4741012",
"0.47362536",
"0.47355783",
"0.4730598",
"0.47283792",
"0.47271124",
"0.47245207",
"0.47190428",
"0.4716886",
"0.47168446",
"0.47147778",
"0.4714112",
"0.47133285",
"0.47129357",
"0.47058344",
"0.47035256",
"0.47021955",
"0.4701107",
"0.47001368",
"0.46977627",
"0.4697499",
"0.46964854",
"0.46934325",
"0.46865243"
] |
0.0
|
-1
|
Exercise 4 nothing (return statement happens before puts) Exercise 5
|
def scream(words)
words = words + "!!!!"
puts words
return
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def what_was_that?\n puts \"-\" * 70\n puts \"***** I didn't catch that *****\"\n puts \"\"\n puts \"Would you please try a different answer?\"\n puts \"-\" * 70\n end",
"def return_statement(num)\n puts \"this is before the explicit return...\"\n if num != 1\n return \"yeah you entered something other than 1 !\"\n end\n puts \"this is after explicit return so you must have entered 1!\"\nend",
"def demonstrate_early_return\n return\n puts \"You will never see this, because we never get here.\"\nend",
"def scream(words)\nwords = words + \"!!!!\"\nreturn #this makes the program return nothing.. because it has nothing next to the return method\nputs words\nend",
"def exiter\n puts \"\"\n puts \"*****************************************************************************\"\n puts \"I can't believe you're leaving, I GUESS MY JUKES WEREN'T GOOD ENOUGH FOR YOU!\"\n puts \"*****************************************************************************\"\n puts \"\"\nend",
"def fact\n puts ''\n puts '---Did you know?---'\n puts 'A pregnant goldfish is called a twit.'\n end",
"def return_guess\r\n puts \"What will be the return value here?\" # puts nao retorna valor nenhum\r\n print \"Will print be any different?\"\r\nend",
"def cube(num)\n return num * num * num #this is an official return statement\n # after return, it will break and jump out from the method\n # nothing after it wiil be executed\n 8\n puts \"print this line\"\nend",
"def tie_my_shoes\n puts \"grab shoe laces\"\n puts \"twist and tie around\"\n puts \"end\"\nend",
"def printResult(result)\r\n puts\r\n puts \" Least number of times you can copy paste a \"\r\n puts \" print statement: #{result}\"\r\n puts \"======================== END ========================\\n\\n\"\r\nend",
"def say_hi\n # output \"hi\" to console\n puts \"hi\"\n # return 10 (implicit return)\n 10\nend",
"def weird_stuff\n puts \"Mussolini apparently liked to eat raw garlic, although he suffered\n from severe stomach ulcers. He also had many Jewish friends, and didn't like\n Hitler very much. Yeah right!\"\n #sleep(20)\n puts \"Idi Amin gave himself the title His Excellency, President for Life Field\n Marshall Al Hadj Doctor Idi Amin Dada, VC, DSO, MC, Lord of all the Beasts\n of the Earth and Fishes of the Sea and Conqueror of the British Empire in\n Africa in General and Uganda in particular.\"\n #sleep(20)\n puts \"Adolf Hitler thought of himself as a pacifist. He was a vegetarian.\n It is said that he injured his groin during World War I, and his left\n testicle was removed. Hitler enjoyed watching Charley Chaplin, who made fun\n of Hitler.\"\n #sleep(20)\n puts \"Stalin was also the man behind the most wicked practical joke ever\n played. Being a very private man he gave the order that no person should\n enter his bed chambers on pain of death. Later, while in his chambers he\n decided to test whether his guards had listened to this instruction.\n Pretending to scream in pain, he called for the guards stationed outside\n the door. Fearing that their leader was in trouble the guards burst into\n the room. Stalin had them executed for failing to follow his standing orders.\n This little prank soon backfired, however, when Stalin suffered a seizure\n while alone in his bedroom. The guards were too afraid to enter, finding\n him hours later laid in a puddle of stale urine. He died three days later.\"\n #sleep(30)\n puts \"Niyazov loved to rename things. For example, he renamed the month of\n January Turkmenbashi, which means Father of the Turkmen, a name he gave\n himself. He also 'legislated' the renaming of the days of the week to ones\n that translate to 'Young Day', 'Spirituality Day', etc. He even renamed the\n word 'bread', Gurbansoltan, after his own mother. Niyazov outlawed beards on\n men and cosmetics on TV anchors, and prohibited both chewing tobacco and lip-\n syncing on Turkmenistan soil. In a society of smokers, Niyazov recommended\n that people chew on bones, which he argued would strengthen their teeth. He\n authored a book, the Book of the Soul, and ordered students in schools and\n mosques to read and study it, and in the case of mosques, to give it equal\n respect to the Quran (and if not, the mosque would be demolished). To get a\n driver's license, people had to memorize the contents of the book. Finally,\n Niyazov told everyone that he had made a pact with G-d that anyone who read\n his book three times would go to heaven. In 2005, he ordered a copy of his\n book to be sent to outer space.\"\n #sleep(60)\n puts \"Mussolini apparently liked to eat raw garlic, although he suffered\n from severe stomach ulcers. He also had many Jewish friends, and didn't like\n Hitler very much. Yeah right!\"\n #sleep(10)\n puts \"He gave himself the title His Excellency, President for Life Field\n Marshall Al Hadj Doctor Idi Amin Dada, VC, DSO, MC, Lord of all the Beasts\n of the Earth and Fishes of the Sea and Conqueror of the British Empire in\n Africa in General and Uganda in particular.\"\n end",
"def does\n puts \"ALL THE THINGESSSS!!!eleventy\"\nend",
"def equal_to_four(x)\n if x == 4\n puts \"yup\"\n else\n puts \"nope\"\n end # <-- this end was missing\nend",
"def say_hello\n return\n puts \"Hello!\" #this code will never be reached\nend",
"def asterSick\r\n puts(\"\\n****************************\\n\")\r\n return \"\\n****************************\\n\"\r\nend",
"def scream(word)\n word = word + \"!!!\"\n return puts \"#{word}\" #<--------\nend",
"def equal_to_four(x)\n if x == 4\n puts \"yup\"\n else\n puts \"nope\"\n end # => This is the \"end\" that was missing in th original code \nend",
"def meal \n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend",
"def C\r\n puts \"\\nYOU HAVE #{$food} UNITS OF FOOD\"\r\n puts \"HOW MANY DO YOU WANT TO EAT?\"\r\n wanna_eat = gets.strip.to_i\r\n if wanna_eat> $food\r\n puts \"THATS MORE FOOD THAN YOU HAVE\\n\"\r\n else\r\n $food = $food-wanna_eat\r\n $strength = $strength+(5*wanna_eat)\r\n end\r\n return \"F\" \r\nend",
"def test\n b = bulls()\n c = cows()- b\n if b == 4\n puts 'Congrats!'\n return :win\n end\n puts \"\\t#{b} - bulls\\n\\t#{c} - cows\"\n end",
"def hail_the_king\n\tputs \"hail king mark\"\nend",
"def hail_the_king\n\tputs \"hail king mark\"\nend",
"def equal_to_four(x)\n if x == 4\n puts \"yup\"\n else\n puts \"nope\"\n end # this end was missing\nend",
"def code_like_crazy\r\n puts \"I'm crushing some code!\"\r\n end",
"def question_and_answer(with_error, zero_or_one, mistery_num)\n message = \"Do you see your number here: (y)(n). To exit the game enter the letter e.\".colorize(:blue)\n if with_error == true\n puts \"\\nIncorrect Answer. \" + message\n else \n puts \"\\n#{message}\"\n end \n answer = gets.chomp.upcase\n case answer\n when \"Y\", \"YES\"\n if zero_or_one % 2 == 0\n mistery_num +=\"0\"\n else\n mistery_num +=\"1\"\n end\n return mistery_num\n when \"N\", \"NO\"\n if zero_or_one % 2 == 0\n mistery_num +=\"1\"\n else\n mistery_num +=\"0\"\n end\n return mistery_num\n when \"E\"\n return \"break\"\n else\n question_and_answer(true, zero_or_one, mistery_num)\n end \nend",
"def success_case\n\tputs \" - Ok #{@name}, c'est ton choix #{@answer_play}\" \n\tputs \" \"\n end",
"def meow #teaching the cat how to meow\n puts \"meow!\" \n end",
"def greet(name)\n return puts \"Hello, #{name} how are you doing today?\"\nend",
"def to_print_or_not\n print \"Do you want to print something? \"\n answer = gets.chomp\n if answer == 'y'\n print \"print something here > \"\n result = gets.chomp\n puts result\n elsif answer == 'n'\n puts \"Ok. Sorry for asking.\"\n \n else\n puts \"You didnt hear me I guess.\"\n end\nend",
"def parrot(phrase = \"parrot\")\n puts \"Pretty bird!\"\n return \"Pretty bird!\"\nend",
"def say_moo number_of_moos\r\n\tputs \"mooooooo...\" * number_of_moos\r\n\t\"yellow submarine\" #return value!\r\nend",
"def stage_right\n\tputs\n\tputs \"#{HC}#{FGRN}Should be all clean of your evil deads now#{FWHT}!#{RS}\"\n\tputs\n\tputs\n\texit; #Clean Exit :)\nend",
"def exercise1_gets_puts\n puts \"Hey, What is your name?\"\n name = gets.chomp\n puts \"Cool, #{name}\"\n puts \"How old are you?\"\n age = gets.chomp\n puts \"Your name is #{name} and you are #{age} years old.\"\n time = Time.now\n\n puts \"What is your current address?\"\n address = gets.chomp\n\n puts \"Please enter your city\"\n city = gets.chomp\n\n puts \"Please enter your state abbreviation\"\n state = gets.chomp\n\n if state.length != 2 \n\n puts \"Please enter a code that is only two characters long. /n\"\n puts \"Please enter your state abbreviation\"\n state = gets.chomp\n end\n puts \"Please enter your zip code\"\n zip_code = gets.chomp\n if zip_code.length != 5\n puts \"Please enter a zip code that is only five characters long. /n\"\n end\n\n mailing_adrs = address + \"/n\" + city + \", \" + state + \" \" + \"zipcode\" \n puts \"Your address is /n\" + mailing_adrs\n\n current_year = time.year\n puts \"The current year is #{current_year}\"\n\n puts \"What year were you born?\"\n birth_year = gets.chomp.to_i\n puts \"You are #{current_year - birth_year} years old.\"\nend",
"def math_problem(num1, num2)\n p \"I am solving this hard math problem\"\n return num1 + num2\n p num1 - num2 #this won't get executed\nend",
"def joke1\n puts \"A peanut was walking down the street. He was a-salt-ed.\"\nend",
"def add (a, b)\n puts 1\n puts 2 \n (a+b)\n return result\n \nend",
"def scream_c(words)\n #words = words + \"!!!!!\"\n return\n #puts words\nend",
"def scream_a(words)\n words = words + \"!!!!!\"\n return\n puts words\nend",
"def puts\n end",
"def stylish_chef\n best_hairstyle = \"Guy Fieri\"\n return \"Martha Stewart\"\n \"Guy Fieri\"\nend",
"def puts_done()\n puts \"I got nothin.\"\nend",
"def praise_person(name, age)\n puts \"#{name} is amazing\"\n puts \"#{name} is charming\"\n puts \"#{name} is talented\"\n puts \"#{name} is #{age} years old\"\n puts \"In 5 years he is going to be #{age + 5}\"\nend",
"def prescription_1\n\tputs \"*** Prescription 1 ***\"\n\tputs \"Use the TDD process to create and adjust your code's design in small, incremental steps.\\n\\n\"\nend",
"def this_has_error\n puts ''\n end",
"def return_guess\n puts \"What will be the return value here?\"\n return \"What will be the return value here?\"\nend",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def sum(a, b)\n points = 100\n return points # => Never give bottom of 'return'\n a + b + points\n puts \"This is after the expicit return statement\"\nend",
"def scream(words)\r\n words = words + \"!!!!\"\r\n return\r\n puts words\r\nend",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def scream(words)\n words = words + \"!!!!\"\n return\n puts words\nend",
"def skipped_questions_explanation\n puts \"\"\n puts \"Now you can answer the questions that you skipped.\"\n puts \"If you can't think of an answer, just hit enter/return to pass.\"\n puts \"Once you've answered or passed these questions we'll go over the answers.\"\n puts \"\"\n end",
"def print_none()\n\tputs \"\\t>> print_none\"\n\tputs \"i got nothin'.\"\n\tputs \"\\t<< print_none\"\nend",
"def add_it\n puts \"Ok, we're adding. What is the first number?\"\n first = gets.chomp\n first = verify(first)\n puts \"What number do you want to add to #{look_pretty(first)}?\"\n second = gets.chomp\n second = verify(second)\n puts \"The sum of #{look_pretty(first)} and #{look_pretty(second)} is #{look_pretty(addition(first,second))}\"\nend",
"def count_sheep \n 5.times do |sheep| \n puts sheep\n if sheep >= 2\n return\n end \n end \nend",
"def tell_joke(joke, answer)\n\n puts joke\n puts answer\n puts \"Joke told.\"\n puts\n\n puts \"What did you think of my joke?\"\n print \">\"\n variable = gets.chomp\n if variable.downcase == \"i don't know\"\n puts \"Maybe you're not smart enough.\"\n return false\n else\n puts \"You got my joke!\"\n return true\n end\nend",
"def FizzBuzz\n\t\n1.upto(100) {|i| \n\tputs \"Fizz\" if i%3 == 0 && i%5 != 0\n\tputs \"Buzz\" if i%3 != 0 && i%5 == 0\n\tputs \"FizzBuzz\" if i%3 == 0 && i%5 == 0\n\tputs i if i%3 != 0 && i%5 != 0\n}\t\n\nend",
"def add_two_numbers(num1, num2)\r\n puts \"OK, I'm solving your math problem!\"\r\n return num1 + num2\r\n #anything after the return keyword will not be evaluated\r\nend",
"def introduceMyself\n puts \"I am handsome\"\n puts \"I am talented\"\n puts \"I am brilliant\"\nend",
"def print_one()\n puts \"I got nothing'.\"\nend",
"def puts_non()\n\tputs \"I got nothin'.\"\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def count_sheep\n 5.times do |sheep|\n puts sheep\n if sheep >= 2\n return\n end\n end\nend",
"def hailstone2(num)\n count = 0\n\n if num == 1\n puts '1'\n puts 'HAILSTONE 2 - Number of steps: 0'\n return\n end\n\n print \"#{num} \"\n\n hailoop(num, count)\n\n puts\n puts \"HAILSTONE 2 - Number of steps: #{count}\"\nend",
"def puts_none\n\tputs \"I have nothing\"\nend",
"def little_monkeys(num)\n if num > 1\n puts \"#{num.humanize.capitalize} little monkeys jumping on the bed,\"\n puts \"One fell off and bumped his head,\"\n puts \"Mama called the doctor and the doctor said,\"\n puts '\"No more monkeys jumping on the bed!\"'\n elsif num == 1\n puts \"#{num.humanize.capitalize} little monkey jumping on the bed,\"\n puts \"He fell off and bumped his head,\"\n puts \"Mama called the doctor and the doctor said,\"\n puts '\"Get those monkeys right to bed!\"'\n end\nend",
"def greeting\n puts\n puts \"Welcome to Tic Tac Toe\"\n puts \"Lets Play\"\n #puts \"Player X your up first\"\n puts\nend",
"def divide(a, b)\n puts \"DIVIDING #{a} / #{b}\"\n return a / b\n a + b # This is ignored as the output due to the return\nend",
"def introduce_myself\n puts 'am handsome'\n puts 'i am talented'\n puts 'i am brilliant'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend"
] |
[
"0.6463618",
"0.6425313",
"0.6232855",
"0.6178439",
"0.6160612",
"0.6145456",
"0.6124249",
"0.6078611",
"0.60678726",
"0.60610366",
"0.6058667",
"0.6042817",
"0.5999282",
"0.5969615",
"0.5960293",
"0.5959496",
"0.59490895",
"0.5936979",
"0.59221035",
"0.591469",
"0.591469",
"0.591469",
"0.591469",
"0.591469",
"0.591469",
"0.591469",
"0.591469",
"0.591469",
"0.5911387",
"0.5907989",
"0.58876467",
"0.58876467",
"0.58842504",
"0.5872172",
"0.5871716",
"0.58669204",
"0.5832914",
"0.5824026",
"0.5823528",
"0.5821939",
"0.5808529",
"0.579469",
"0.57825685",
"0.5781525",
"0.57810634",
"0.5779655",
"0.5774838",
"0.57703763",
"0.5759428",
"0.5756699",
"0.57539624",
"0.5750936",
"0.57447374",
"0.5735116",
"0.5732299",
"0.57183385",
"0.57132864",
"0.5709162",
"0.57006454",
"0.57006454",
"0.57006454",
"0.57006454",
"0.57006454",
"0.57006454",
"0.57006454",
"0.57006454",
"0.56982994",
"0.5681617",
"0.5678034",
"0.567253",
"0.566938",
"0.566801",
"0.5666316",
"0.5663538",
"0.5662082",
"0.56566674",
"0.56511617",
"0.56511617",
"0.56511617",
"0.56511617",
"0.56511617",
"0.56511617",
"0.56511617",
"0.56511617",
"0.56511617",
"0.56511617",
"0.56511617",
"0.5642722",
"0.56381583",
"0.56375754",
"0.5634984",
"0.5633625",
"0.5632033",
"0.56255585",
"0.56255585",
"0.56255585",
"0.56255585",
"0.56255585",
"0.56255585",
"0.56255585",
"0.56255585"
] |
0.0
|
-1
|
call to send an actor a job
|
def delegate(job)
job = job.stringify_keys
job['id'] = generate_job_id(job) unless job_failed?(job)
@jobs[job['id']] = job
job['env_options'][CapistranoMulticonfigParallel::ENV_KEY_JOB_ID] = job['id']
# debug(@jobs)
# start work and send it to the background
@workers.async.work(job, Actor.current)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def send_message!\n msg = Message::Request.from_job(self)\n msg.send!\n end",
"def send_job\n new_job.tap do |job|\n yield job\n log_message :C, :job, job\n sendmsg(job.chunked_packed_stream)\n end\n end",
"def queue_job; end",
"def invoke_job\n payload_object.perform\n end",
"def send_job(job)\n logger.debug \"C: JOB: #{job}\"\n sendmsg(job.chunked_packed_stream)\n\n flush_messages\n end",
"def invoke_job\n payload_object.perform\n end",
"def sendTask _obj, _args\n \"_obj sendTask _args;\" \n end",
"def publish(queue_name,job)\n queue = queue(queue_name)\n queue.send_message(message_body: encode_job(job))\n end",
"def run_job\n end",
"def dispatch\n body = {\n 'command' => @command,\n 'nodes' => @nodes,\n 'run_timeout' => @timeout\n }\n\n ::Chef_Delivery::ClientHelper.enter_client_mode_as_delivery\n resp = @rest.post_rest('/pushy/jobs', body)\n ::Chef_Delivery::ClientHelper.leave_client_mode_as_delivery\n\n @job_uri = resp['uri']\n refresh\n end",
"def perform(progress_payload_object, channel)\n # parameters passed from send_progress_percentage\n\n # Calls action cable broadcast for user's channel.\n # KEY!! Sender has its own channel which is craeted when user uses refreshes to navigates to booking confirmation in the frontend\n # progress_payload_object is sent to the\n # recipient via actioncable websocket connnection addressed to the recipient's\n # own chat room. When message is received redux action updates state on the frontend.\n # p '****** in Job each channel, progress_payload_object: ' + channel.to_s + ' ' + progress_payload_object.to_s\n ActionCable.server.broadcast(channel, progress_payload_object)\n end",
"def work_thread(opts)\n\n args = opts[:args]\n case \n when args.is_a?(Symbol)\n case opts[:args].id2name\n when /\\A@/\n send_args = self.instance_variable_get(opts[:args].id2name)\n else\n # TODO: not sure what this would be used for\n send_args = args\n end\n send = lambda do\n self.send(opts[:method], send_args)\n end\n when args.nil?\n send = lambda do\n self.send(opts[:method])\n end\n else\n send = lambda do\n self.send(opts[:method], args)\n end\n end\n\n Thread.new do\n begin\n send.call\n rescue StandardError => e\n logger.error(@jobkey) { \"#{ e.message } - (#{ e.class })\" } \n (e.backtrace or []).each do |line|\n logger.error(@jobkey) { \"#{line}\" }\n end\n self.delete\n end\n end\n\n end",
"def request(name,job)\n rz_send(service_socket(name),[JSON.dump(job)])\n self\n end",
"def perform(*args)\n # *args means you can take an array of arguments.\n puts \"1.I'm starting the fake job\"\n sleep 5\n puts \"2.OK I'm done now\"\n puts \"3. BYEEEE\"\n end",
"def job \n @job\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 fire(worker, vars)\r\n action.execute(worker, vars)\r\n end",
"def job_send(options)\n @options = {\n :id => nil,\n :include => [],\n :exclude => [],\n :from_name => nil,\n :from_email => nil,\n :additional => nil,\n :when => nil,\n :multipart => false,\n :track => true,\n :test => false\n }.merge(options)\n \n # Sanity check:\n if @options[:id].nil? ||\n @options[:include].empty?\n raise \"#{ERROR} id and include array/string required!\"\n end\n \n @date =\n (@options[:when].strftime('%-m/%-d/%Y') if\n @options[:when].instance_of?(Date) ||\n @options[:when].instance_of?(DateTime)) || 'immediate'\n \n @time =\n (@options[:when].strftime('%H:%M') if\n @options[:when].instance_of?(DateTime)) || ''\n \n result = Nokogiri::XML(send(render(:job)))\n info = result.xpath('//job_info').text\n desc = result.xpath('//job_description').text\n \n raise \"#{ERROR} job send failed !\" if !info.include? 'success'\n desc\n end",
"def ask_worker(worker, job)\n worker.ask(@method, job)\n end",
"def enqueue(job)\n sqs.send_message(\n queue_url: get_queue_url(job),\n message_body: MultiJson.dump(job.serialize)\n )\n end",
"def send_message_to_rooms(company, params = {})\n $LOG.i \"running \" + __method__.to_s\n @client.post '/messages/v3/' + company + '/stories/batch', params\n end",
"def do_submit\n @job = Job.find(params[:id])\n @queue = JobsQueue.find_by_id(params[:job][:jobs_queue_id]) || JobsQueue.default_queue\n respond_to do |format|\n if @job.submit(@queue)\n flash[:notice] = 'Job was successfully submitted.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"show\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def call(job)\n args = job[:args]\n klass = eval(job[:method].split(\".\").first)\n message = job[:method].split(\".\").last\n klass.send(message, *args)\n end",
"def send_message(queue, msg)\n queue.send_message(msg.to_json)\n end",
"def call(worker, msg, queue)\n begin\n job_in_progress(worker, msg, queue)\n start_time = Time.now\n yield\n job_completed(worker, msg, queue, Time.now-start_time)\n rescue Exception => error\n job_failed(worker, msg, queue, error)\n end\n end",
"def process!\n Sync::Jenkins.job_by_name(payload[\"name\"])\n end",
"def job\n OSC::Machete::Job.new(\n script: script,\n pbsid: pbsid,\n host: host || workflow.batch_host,\n torque_helper: ResourceMgrAdapter.new(workflow)\n )\n end",
"def create\n arg = params[:email]\n counter = Job.enqueue(arg)\n render :status => :accepted, :json => { jobId: counter }\n end",
"def sendJob(course, assessment, submissions, cud)\n extend_config_module(assessment, submissions[0], cud)\n\n # Get the autograding properties for this assessment.\n @autograde_prop = assessment.autograder\n return -2 unless @autograde_prop\n\n # send the tango open request\n begin\n existing_files = TangoClient.open(\"#{course.name}-#{assessment.name}\")\n rescue TangoClient::TangoException => e\n flash[:error] = \"Error with open request on Tango: #{e.message}\"\n COURSE_LOGGER.log(\"#{e.message}\")\n return -1\n end\n\n # send the tango upload requests\n status, upload_file_list = tango_upload(course, assessment, submissions[0], existing_files)\n return status if status < 0\n\n status, dave = save_daves(submissions)\n return status if status < 0\n\n output_file = get_output_file(assessment, submissions[0])\n callback_url = get_callback_url(course, assessment, submissions[0], dave)\n job_name = get_job_name(course, assessment, submissions[0])\n\n status, response_json = tango_add_job(course, assessment, upload_file_list,\n callback_url, job_name, output_file)\n return status if status < 0\n\n # If autolab user opts not to use a callback URL, we poll the job for 80 seconds\n if callback_url.blank?\n status = tango_poll(course, assessment, submissions, output_file)\n return status if status < 0\n end\n\n response_json[\"jobId\"].to_i\n end",
"def send_message(msg)\n self.class.send_message queue_url, msg\n end",
"def send_action action_name, service_name\n self.class.actions[action_name][service_name].run(self)\n end",
"def perform(params)\n Crons::Webhooks::TestSend.new(lock_id: params[:lock_id],\n client_webhook_setting_id: params[:client_webhook_setting_id],\n admin_id: params[:admin_id]).perform\n\n end",
"def sendChatAction to, act\n self.query(\"sendChatAction\", {:chat_id=>to, :action=>act})\n end",
"def enqueue_job\n BackgroundJob.enqueue(\n InviteJob,\n {\n manager_id: @invitee_manager[:id],\n invite_token: @invite_token\n }\n )\n\n success\n end",
"def create\n @job = @user.jobs.new(params[:job])\n\n respond_to do |format|\n if @job.save\n\t\t# send mail now or later...\n\t\tBackground.instance.delay.sendLater(@job)\n\t \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 perform(job)\n load_actions\n Cyclop::Action.find_by_queue(job.queue).perform(*job.job_params)\n 0\n rescue Exception => e\n log e.to_s\n job.release! e\n 1\n end",
"def perform(*args)\n puts \"\"\n puts \"* Sending in 5s...\"\n sleep(5)\n puts \"* Inside SendSlackMessageAllJob *\"\n\n puts \"> Finding Survey with id #{args[0][:survey_id]}\"\n survey = Survey.find(args[0][:survey_id])\n puts \"> Finding Question with id #{args[0][:question_id]}\"\n question = Question.find(args[0][:question_id])\n team = User.find(survey.user_id).team\n\n puts \"> Fetching member list from SLACK API (not async)\"\n member_list = HTTParty.get(\"https://slack.com/api/channels.info\",\n query: {\n token: team.bot_access_token,\n channel: survey.channel_id })\n\n # Now handled in Controller\n # member_list[\"channel\"][\"members\"].reject { |x| x == User.find(survey.user_id).uid }.each do |uid|\n # GetSlackUserInfoJob.perform_later(uid: uid, surv_id: args[0][:survey_id], team_id: xxx)\n # end\n\n\n\n sender_fn = \"#{User.find(survey.user_id).first_name.capitalize}\"\n sender_ln = \"#{User.find(survey.user_id).last_name.capitalize}\"\n others = member_list[\"channel\"][\"members\"].count - 1\n\n message_text = \"Hi! #{sender_fn} #{sender_ln} wants a Critiq. #{others.to_words.capitalize} other people have been messaged and everyone's responses will be anonymized. #{sender_fn} asks:\\n\"\n\n puts \"> Beginning to iterate over member list...\"\n member_list[\"channel\"][\"members\"].each do |member_uid|\n # Put this in the above line before '.each' to prevent critiq's from being sent to their creator\n # .reject { |x| x == User.find(survey.user_id).uid }\n\n send_message(member_uid, message_text, team)\n\n if question.question_type == 'radio'\n puts \"> Question is MC\"\n send_message_multiple_choice(member_uid, question, team)\n else\n puts \"> Question is NOT MC\"\n send_message(member_uid, question.name, team)\n end\n\n puts \">> Creating SentQuestion entry for Question: #{args[0][:question_id]}, User: #{member_uid}\"\n SentQuestion.create(question_id: args[0][:question_id], recipent_slack_uid: member_uid)\n\n end\n puts \"> Finished sending all messages <\"\n\n 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 invoke_job\n self.attempts += 1\n payload_object.perform\n end",
"def send_message(msg); end",
"def job\n @job\n end",
"def job\n @job\n end",
"def submit\n configure_concern\n submit_job\n end",
"def submit(job)\n if @queue.length >= QUEUE_SIZE\n job[:callback].call(:error, 'System busy; ask again later.')\n return\n end\n\n @queue.push(job)\n end",
"def send_job_reminder(job)\n UserMailer.job_reminder(self, job).deliver_now\n end",
"def perform(message)\n # If this job has been chained from another, the log will already exist and\n # should not be created\n if @logger.nil?\n @logger = create_logger(@status.id)\n end\n\n # Flag job started running\n if @params_logged\n @logger.info \"Start #{self.class.name}\"\n else\n @logger.info \"Start #{self.class.name} with params: #{message.to_json}\"\n end\n @status.started\n\n begin\n # all subclasses extend this method to define their job\n do_workflow(message)\n rescue Exception => e\n handle_wokflow_exception(e)\n end\n end",
"def sendTaskResult _obj, _args\n \"_obj sendTaskResult _args;\" \n end",
"def sendTaskResult _obj, _args\n \"_obj sendTaskResult _args;\" \n end",
"def jobs\n\t\t# ...\n\tend",
"def job\n @job\n end",
"def call(worker, msg, queue)\n if worker.class.ancestors.include? Sidekiq::Status::Worker\n worker.id = msg['args'].shift\n unless worker.id.is_a?(String) && UUID_REGEXP.match(worker.id)\n raise ArgumentError, \"First job argument for a #{worker.class.name} should have uuid format\"\n end\n worker.update_status! 'working'\n yield\n worker.update_status! 'complete'\n else\n yield\n end\n rescue Worker::Stopped\n worker.update_status! 'stopped'\n rescue => e\n if worker.class.ancestors.include? Sidekiq::Status::Worker\n worker.update_status! 'failed'\n worker.update_message!({\n exception: e.message,\n backtrace: e.backtrace\n })\n msg['args'].unshift worker.id\n end\n raise\n ensure\n if worker.class.ancestors.include? Sidekiq::Status::Worker\n Sidekiq.redis { |conn| conn.expire worker.id, @expiration }\n end\n end",
"def enqueue(active_job)\n enqueue_at(active_job, nil)\n end",
"def start_job\n associate(Wesabe::Job.from_xml(Hpricot::XML(post(:url => \"/credentials/#{id}/jobs.xml\")) / :job))\n end",
"def enqueue_at(job, timestamp)\n delay = timestamp.to_i - Time.current.to_i\n sqs.send_message(\n queue_url: get_queue_url(job),\n message_body: MultiJson.dump(job.serialize),\n delay_seconds: delay,\n )\n end",
"def request(job)\n if @queue.size > @queue_max_size\n # server is busy\n update_status(job.id, name: \"BUSY\")\n else\n # cancel if there exists the session's old request already\n cancel(job) if active?(job.id)\n\n # register the request\n @jobs.add(job.id)\n @queue.push(job)\n\n # send an \"ACCEPTED\" message\n update_status(job.id, name: \"ACCEPTED\")\n end\n end",
"def run\n case self[:job]\n when Proc\n self[:job].call\n else\n self[:job]\n end\n end",
"def work\n possible_job = pluck_queue_message(:job_requests) # FIX: pluck doesn't delete\n job = Job.build(@instance_id, possible_job)\n job.valid? ? process(job) : process_invalid(job)\n end",
"def queue_msg(msg)\n dispatch_msg(msg)\n end",
"def execute_send\n record_start_time\n queue_attempt\n end",
"def dispatch(obj)\n msg = @source.receive(TIMEOUT)\n ::Celluloid.mailbox << msg if msg\n end",
"def perform(*args)\n conference_id = UUID.generate\n send_request conference_id, args[0], args[2]\n send_request conference_id, args[1], args[2]\n end",
"def send_invitation\n DelayedJob.enqueue('UserInviter',\n Time.now+10.second,\n self.id.to_s,\n I18n.translate(:you_are_invited_by, :name => self.user.name),\n self.message\n )\n end",
"def send_action(*_arg0); end",
"def enqueue(job)\n build_worker(job).schedule\n end",
"def Job(active_job)\n lambda do |object|\n active_job.perform_later(object.id)\n end\n end",
"def enqueue(job)\n enqueue_at(job, nil)\n end",
"def work(raw_post)\n email_params = JSON.parse(raw_post).with_indifferent_access\n send_simple_message(params)\n ack! # we need to let queue know that message was received\n end",
"def send_message(message); end",
"def send_message(message); end",
"def job # this is a getter\n @job\n end",
"def perform(*args)\n Rails.logger.info(\"#\" * 50)\n Rails.logger.info(\"ping: #{job_id}\")\n Rails.logger.info(\"#\" * 50)\n end",
"def perform(*args)\n puts \"--------------------\"\n puts \"Running a super awesome job\"\n puts \"--------------------\"\n puts \"this one right here.\"\n end",
"def make_call(action, endpoint, job)\n response = HTTParty.post(\n \"http://localhost:3000/#{endpoint}\",\n :body => {\n \"#{action}\" => \"#{job}\",\n \"client\" => \"client_cert.pem\",\n }\n )\n puts response\n menu\n end",
"def perform(params)\n\n init_params(params)\n\n send_self_invite_link\n\n notify_devs\n\n end",
"def invoke_job\r\n\r\n # BgWorker.log(\"Worker: invoke job\")\r\n\r\n fork {\r\n\r\n # BgWorker.log(\"Worker: fork: system 'cd #{Rails.root}; rake #{self.name}'\")\r\n\r\n `cd #{Rails.root}; rake #{self.name}`\r\n\r\n # BgWorker.log(\"Worker: fork: closing job #{res ? 'OK' : 'KO'}, return code: #{$?}\")\r\n\r\n self.close_job($?)\r\n }\r\nend",
"def create\n job_type = params[:type]\n email = params[:email]\n subject = params[:subject]\n job = Job.find(params[:id]) unless params[:id].nil?\n\n if job_type == 'assign'\n AutoMailer.job_assign(email, subject, job).deliver_later\n elsif job_type == 'reject'\n AutoMailer.job_reject(email, subject, job).deliver_later\n elsif job_type == 'members'\n AutoMailer.mail_members(email, subject, params[:body]).deliver_later\n elsif job_type == 'job'\n AutoMailer.mail_job(\"npfosi@gmail.com\", job).deliver_later\n AutoMailer.mail_job(email, job).deliver_later\n elsif job_type == 'update_job'\n AutoMailer.mail_job(\"npfosi@gmail.com\", job).deliver_later\n end\n\n render json: \"ok\", status: 204\n end",
"def send_request(ref, msg_id, arg, b)\n @msg.send_request(stream, ref, msg_id, arg, b)\n end",
"def perform(*args)\n puts \"--------------------------\"\n puts \"---- Running Job ----\"\n puts \"--------------------------\"\n end",
"def do_dispatch(participant, msg)\n\n workitem = Ruote::Workitem.new(msg['workitem'])\n\n workitem.fields['dispatched_at'] = Ruote.now_to_utc_s\n\n participant.consume(workitem)\n\n @context.storage.put_msg(\n 'dispatched',\n 'fei' => msg['fei'],\n 'participant_name' => workitem.participant_name)\n # once the consume is done, asynchronously flag the\n # participant expression as 'dispatched'\n end",
"def do_job(job)\n job['run_at'] = Time.now\n job['status'] = 'in progress'\n job['attempt'] += 1\n storage.save(job) do |job|\n begin\n args = job['args'].merge(JR.config[:merge_job_itself_to_args] ? {:job_itself => job.dup} : {})\n job.succeed(args)\n job['args'] = args\n job_completed(job)\n rescue CancelJob\n cancel_job(job)\n rescue Exception => e\n rescue_job(e, job)\n end\n end\n end",
"def receive_data(data)\n hash = Marshal.load(data)\n JR::JobLogger.log(\"#{@node.name} received job: #{hash}\")\n hash.merge!('node' => @node.name)\n @storage.save(hash) do |hash|\n @node.schedule(hash)\n end\n send_data('ok')\n end",
"def add_job(job)\n @stream.add_message(job.to_message)\n job\n end",
"def perform(_sqs_msg, user_id)\n user = User.find_by(id: user_id)\n if user\n puts 'Sending email'\n SendEmail.send_mail(user)\n else\n puts 'Job failed'\n end\n end",
"def perform(email, job_id)\n if email.blank? or job_id.blank?\n puts(\"Either of job or email is blank. Email: #{email}, Job: #{job_id}\")\n return\n end\n\n email_invitations = EmailInvitation.where(:email => email)\n email_invitation = nil\n email_invitations.each do |invitation|\n unless invitation[:invitor_handle].blank?\n email_invitation = invitation\n end\n end\n\n if !email_invitations.blank? and email_invitation.blank?\n email_invitation = email_invitations[0]\n end\n\n if email_invitation.blank?\n email_invitation = create_email_invitation_for_email(email, nil)\n end\n\n if email_invitation.reminder_count >= 3\n puts(\"Reminder count exceeded for user: #{email}\")\n return\n end\n\n job = get_job_by_id(job_id)\n if job.blank? or !job.live\n puts(\"Either Job is blank or not live. live? #{job.live}\")\n return\n end\n\n email_variation_id = get_job_email_variation\n user = get_user_by_email(email)\n if user.blank?\n user = create_passive_user(email)\n elsif user[:active]\n puts(\"USER (#{user})is active returning from not sending invitation\")\n return\n end\n begin\n Notifier.email_job_invitation(user, '', job, email_variation_id).deliver\n rescue Exception => ex\n puts \"Exception: #{ex}\"\n end\n\n email_invitation.last_variation_used = email_variation_id\n email_invitation.time = Time.now\n email_invitation.reminder_count = email_invitation.reminder_count + 1\n email_invitation.save\n track_email_send(\"track_job_email_#{job_id}_#{email_variation_id}\")\n end",
"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 post; FacebookPostJob.new.async.perform(self.id); end",
"def enqueue(*args)\n enqueue_job(new_job(*args))\n end",
"def remote_send(req, marshalled = false)\n send_initial_metadata\n GRPC.logger.debug(\"sending #{req}, marshalled? #{marshalled}\")\n payload = marshalled ? req : @marshal.call(req)\n @call.run_batch(SEND_MESSAGE => payload)\n end",
"def dispatch(*args)\n log(:debug) { 'Dispatch message to worker.' }\n\n fetch_idle_worker.future :dispatch, args\n end",
"def perform_work\n object_client.notify_goobi\n end",
"def process(context)\n @action = context.action if context && context.respond_to?(:action) && context.action\n logger.info(\"Starting job #{self.class.name.underscore} with action #{@action}\")\n begin\n self.__send__(@action, context)\n logger.info(\"Finished job #{self.class.name.underscore} with action #{@action}\")\n rescue\n logger.info(\"Failed job #{self.class.name.underscore} with action #{@action}\")\n raise\n end\n end",
"def perform(time)\n puts \"This job was published at #{}\"\n end",
"def job(body)\n @queue.push(@config.get('DISQUE_QUEUE'), body, 1000)\n end",
"def perform(mailer, method, *args)\n mailer.send(method, *args).deliver\n #ex: LadybooMailer.atm_checkout_completed_successfully(order).deliver\n end",
"def send_data_to_node(hash)\n connection = get_connection(hash)\n if connection\n data = Marshal.dump(hash)\n connection.send_data(data)\n connection.lock\n JR::JobLogger.log \"Distributor sent job '#{hash['name']}' to '#{connection.name}'\"\n else\n EM.next_tick do\n send_data_to_node(hash)\n end\n end\n end",
"def notify\n MemberMailerWorker.perform_async(member_id: self.employer.id.to_s, job_order_id: self.id.to_s, perform: :send_invoice_to_employer)\n TeamMailerWorker.perform_async(job_order_id: self.id.to_s, perform: :send_new_job_order)\n\n end",
"def enqueue(queueKey, work_unit)\n queues[queueKey].send_message(work_unit)\n end",
"def send(message)\n message\n end",
"def jobs\r\n end",
"def perform!\n Quebert.config.before_job(self)\n Quebert.config.around_job(self)\n\n # Honor the timeout and kill the job in ruby-space. Beanstalk\n # should be cleaning up this job and returning it to the queue\n # as well.\n val = ::Timeout.timeout(ttr, Job::Timeout){ perform(*args) }\n\n Quebert.config.around_job(self)\n Quebert.config.after_job(self)\n\n val\n end"
] |
[
"0.7162265",
"0.6443967",
"0.6383821",
"0.62812716",
"0.6253659",
"0.62121975",
"0.62050664",
"0.61537516",
"0.6130183",
"0.61153984",
"0.6083708",
"0.6051514",
"0.6035013",
"0.6022449",
"0.60025114",
"0.59743583",
"0.59059817",
"0.589867",
"0.58950186",
"0.5892449",
"0.5864484",
"0.5839393",
"0.57797295",
"0.57692283",
"0.5728951",
"0.5723101",
"0.5718046",
"0.5711964",
"0.57059306",
"0.5705005",
"0.56881744",
"0.56727946",
"0.5671814",
"0.5662924",
"0.56586003",
"0.5645906",
"0.5633351",
"0.5632326",
"0.56318414",
"0.5630978",
"0.5630337",
"0.5630337",
"0.562142",
"0.56201434",
"0.561524",
"0.56138057",
"0.56103003",
"0.56103003",
"0.5603015",
"0.5589459",
"0.55846405",
"0.55796075",
"0.55785066",
"0.55698943",
"0.5557919",
"0.55539703",
"0.55452037",
"0.5542552",
"0.55423206",
"0.5524921",
"0.5520549",
"0.551863",
"0.55121964",
"0.5511279",
"0.5506665",
"0.5503267",
"0.55030894",
"0.5501098",
"0.5501098",
"0.54973847",
"0.54973584",
"0.54972416",
"0.5496138",
"0.5491979",
"0.5491238",
"0.5482836",
"0.5478133",
"0.5473659",
"0.54705757",
"0.5464041",
"0.54534703",
"0.54527634",
"0.54481804",
"0.54451174",
"0.54417217",
"0.54329103",
"0.5428009",
"0.5427254",
"0.5415961",
"0.54119366",
"0.5411731",
"0.54030365",
"0.540186",
"0.5401833",
"0.5399242",
"0.5398007",
"0.5391067",
"0.53885424",
"0.5383837",
"0.5371958"
] |
0.5719328
|
26
|
call back from actor once it has received it's job actor should do this asap
|
def register_worker_for_job(job, worker)
job = job.stringify_keys
if job['id'].blank?
debug("job id not found. delegating again the job #{job.inspect}") if self.class.debug_enabled?
delegate(job)
else
start_worker(job, worker)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def queue_job; end",
"def on_completion(actor); end",
"def run_job\n end",
"def work( payload, metadata )\n\t\tself.job_counter.mark\n\t\tself.job_timer.time do\n\t\t\tsuper\n\t\tend\n\tend",
"def invoke_job\n payload_object.perform\n end",
"def job \n @job\n end",
"def perform\n \n end",
"def invoke_job\n payload_object.perform\n end",
"def success(job)\n complete()\n end",
"def process\n puts 'Bacground processor - %s' % self\n\n read do |func, data|\n Lux::DelayedJob.call func, data\n end\n end",
"def done_working\n super\n self.job = nil\n end",
"def do_work\n end",
"def process_command\n @fiber.resume get_result\n end",
"def call(worker, msg, queue)\n begin\n job_in_progress(worker, msg, queue)\n start_time = Time.now\n yield\n job_completed(worker, msg, queue, Time.now-start_time)\n rescue Exception => error\n job_failed(worker, msg, queue, error)\n end\n end",
"def before job=nil\n processing!\n end",
"def perform; end",
"def perform; end",
"def invoke_job\n self.attempts += 1\n payload_object.perform\n end",
"def jobs\r\n end",
"def perform_work\n object_client.notify_goobi\n end",
"def do_dispatch(participant, msg)\n\n workitem = Ruote::Workitem.new(msg['workitem'])\n\n workitem.fields['dispatched_at'] = Ruote.now_to_utc_s\n\n participant.consume(workitem)\n\n @context.storage.put_msg(\n 'dispatched',\n 'fei' => msg['fei'],\n 'participant_name' => workitem.participant_name)\n # once the consume is done, asynchronously flag the\n # participant expression as 'dispatched'\n end",
"def job\n @job\n end",
"def process(context)\n @action = context.action if context && context.respond_to?(:action) && context.action\n logger.info(\"Starting job #{self.class.name.underscore} with action #{@action}\")\n begin\n self.__send__(@action, context)\n logger.info(\"Finished job #{self.class.name.underscore} with action #{@action}\")\n rescue\n logger.info(\"Failed job #{self.class.name.underscore} with action #{@action}\")\n raise\n end\n end",
"def job\n @job\n end",
"def job\n @job\n end",
"def reserve_and_run_one_job; end",
"def run_completed\n end",
"def process_job_msg(job_msg)\n msg = job_msg[\"msg\"]\n data = job_msg[\"data\"]\n\n if status == 'pending' && msg == 'begin'\n @status = 'running'\n @start_time = Time.now\n elsif (status == 'running' || status == 'unknown') && (msg == 'success' || msg == 'failure')\n @status = msg\n @result = data\n @duration = Time.now - @start_time\n elsif (status == 'running' || status == 'unknown') && msg == 'exception'\n @status = 'exception'\n @exception = data\n @duration = Time.now - @start_time\n elsif msg == \"info\"\n # Ignore client defined messages\n true\n elsif msg == \"arrhythmia\"\n @status = 'unknown'\n @duration = Time.now - @start_time\n else\n raise \"State machine Error #{job_msg}\"\n end\n end",
"def jobs\n\t\t# ...\n\tend",
"def eventJobFinished\n\t\tsuper\n\t\tif getEnergy==0 or @dead then\n\t\t\tsimDeath\n\t\t\treturn\n\t\tend\n\t\t\n\t\tsetFighting(false)\n\t\t\n\t\tif @bossName==\"\" then\n\t\t\n\t\t\thouse=getMap.getNext(self,\"house\")\n\t\t\tif house\n\t\t\t\thouseName=house.getName\n\t\t\t\tif houseName==\"\" then\n\t\t\t\t\tputs \"ERROR House has no name!\"\n\t\t\t\t\texit\n\t\t\t\tend\n\t\t\t\t@bossName=houseName\n\t\t\t\tnewRestJob(rand()*2)\n\t\t\t\thouse=getMap.getRuby(house)\n\t\t\t\thouse.signUp(self)\n\t\t\t\t@signed=true\n\t\t\tend\n\t\telse\n\t\t\tboss=getMap.getByName(@bossName)\n\t\t\t@boss=boss\n\t\t\tif not @signed then\n\t\t\t\tputs @bossName\n\t\t\t\tputs boss\n\t\t\t\tboss.signUp(self)\n\t\t\t\t@signed=true\n\t\t\tend\n\t\t\tboss.assignJob(self)\n\t\tend\n\tend",
"def call(job)\n @last_job_id = job.job_id\n block.call(job)\n end",
"def run\n case self[:job]\n when Proc\n self[:job].call\n else\n self[:job]\n end\n end",
"def thread()\n #This is a stub, used for indexing\n end",
"def perform!\n end",
"def process(_block = nil)\n EXEL::Job.run(@context[:job], @context)\n end",
"def running; end",
"def running; end",
"def waiting; end",
"def waiting; end",
"def on_worker_processed(event)\n job = event[:job]\n time = event[:time]\n job_type = job.class.to_s.split('::').last\n consumer = job.executor.topic.consumer\n topic = job.executor.topic.name\n info \"[#{job.id}] #{job_type} job for #{consumer} on #{topic} finished in #{time}ms\"\n end",
"def Job(active_job)\n lambda do |object|\n active_job.perform_later(object.id)\n end\n end",
"def job # this is a getter\n @job\n end",
"def enqueue_pending_output; end",
"def process!\n end",
"def receive_data(data)\n hash = Marshal.load(data)\n JR::JobLogger.log(\"#{@node.name} received job: #{hash}\")\n hash.merge!('node' => @node.name)\n @storage.save(hash) do |hash|\n @node.schedule(hash)\n end\n send_data('ok')\n end",
"def perform(*args)\n # *args means you can take an array of arguments.\n puts \"1.I'm starting the fake job\"\n sleep 5\n puts \"2.OK I'm done now\"\n puts \"3. BYEEEE\"\n end",
"def do_raw_dispatch(participant, msg)\n\n workitem = Ruote::Workitem.new(msg['workitem'])\n\n workitem.fields['dispatched_at'] = Ruote.now_to_utc_s\n\n Ruote.participant_send(\n participant, [ :on_workitem, :consume ], 'workitem' => workitem)\n\n @context.storage.put_msg(\n 'dispatched',\n 'fei' => msg['fei'],\n 'participant_name' => workitem.participant_name,\n 'workitem' => msg['workitem'])\n # once the consume is done, asynchronously flag the\n # participant expression as 'dispatched'\n end",
"def after_processing\n end",
"def on_finish_batch; end",
"def worker_begin(worker)\n end",
"def process_job job\n begin\n log.info \"Performing job #{job.id}\"\n jo = job.job_object\n jo.log = log\n jo.perform\n log.info \"Job #{job.id} completed\"\n job.complete\n Model::Worker.increment(id, {:'stats.done' => 1})\n rescue Exception => e\n log.error \"Job #{job.id} failed\"\n log.error e\n job.fail e\n Model::Worker.increment(id, {:'stats.failed' => 1})\n p e\n end\n end",
"def do_run\n ready\n aim\n fire!\n end",
"def process_response\n job = message.job\n job.data = message.data\n job.message = message.message\n\n if message.ok?\n job.proceed!\n else\n job.error!\n end\n end",
"def dispatch\n body = {\n 'command' => @command,\n 'nodes' => @nodes,\n 'run_timeout' => @timeout\n }\n\n ::Chef_Delivery::ClientHelper.enter_client_mode_as_delivery\n resp = @rest.post_rest('/pushy/jobs', body)\n ::Chef_Delivery::ClientHelper.leave_client_mode_as_delivery\n\n @job_uri = resp['uri']\n refresh\n end",
"def perform\n# Rails.logger.info(\"------------------------\")\n# Rails.logger.info(\"DepositJob: in perform\")\n# Rails.logger.info(\"------------------------\")\n setup_sword\n# Rails.logger.info(\"------------------------\")\n# Rails.logger.info(\"DepositJob: set_sword complete\")\n# Rails.logger.info(\"------------------------\")\n @response = sword_api.request\n# Rails.logger.info(\"------------------------\")\n# Rails.logger.info(\"DepositJob: sword_api request complete\")\n# Rails.logger.info(\"------------------------\")\n act_on_status\n end",
"def before_processing_hook(msg, connection)\n original_action = request.action\n task = request[:task]\n\n begin\n if [\"run_and_wait\", \"run_no_wait\"].include?(original_action) && task\n request.action = task\n\n begin\n authorization_hook(request) if respond_to?(\"authorization_hook\")\n rescue\n raise(RPCAborted, \"You are not authorized to run Bolt Task %s\" % task)\n end\n\n audit_request(request, connection)\n end\n ensure\n request.action = original_action\n end\n end",
"def perform(job)\n load_actions\n Cyclop::Action.find_by_queue(job.queue).perform(*job.job_params)\n 0\n rescue Exception => e\n log e.to_s\n job.release! e\n 1\n end",
"def completed()\n end",
"def work\n if @busy && @remaining_job_time > 0\n @remaining_job_time -= 1\n end\n end",
"def perform(&block); end",
"def enter_pending; end",
"def perform(*args)\n puts \"--------------------------\"\n puts \"---- Running Job ----\"\n puts \"--------------------------\"\n end",
"def on_before_enqueue\n return unless topic.long_running_job?\n\n # This ensures, that when running LRJ with VP, things operate as expected\n coordinator.on_enqueued do |first_group_message|\n # Pause at the first message in a batch. That way in case of a crash, we will not loose\n # any messages\n pause(first_group_message.offset, MAX_PAUSE_TIME)\n end\n end",
"def work(raw_post)\n puts \"Msg received: \" + raw_post\n ack! # we need to let queue know that message was received\n end",
"def running_phase\n loop do\n maybe_log(\"Waiting for message\")\n request = ::Ractor.receive\n next unless request.is_a?(Message)\n case request.type\n when :call\n @queue.enq(request)\n register_call(request)\n maybe_log(\"Queued method #{request.data.first} (transaction=#{request.transaction})\")\n when :thread_stopped\n maybe_log(\"Thread unexpectedly stopped: #{request.data}\")\n @thread_count -= 1\n break\n when :stop\n maybe_log(\"Received stop\")\n break\n end\n end\n end",
"def processing\n result = RegisterCheckerApi.job_status(job_name, job_correlation_id)\n return if result == 'RUNNING'\n\n if result == 'SUCCESS'\n session[:job] = nil\n flash[:success] = I18n.t('database_updated')\n redirect_to authenticated_root_path\n else\n redirect_to authenticated_root_path, alert: 'Uploaded file is not valid'\n end\n end",
"def call\n executor.consume\n end",
"def consume(job)\n # logger.info \"Node.consume start: #{job.id}\"\n # puts \"Node.consume start: #{job.id}\"\n job.node = self\n job.state = \"starting\"\n job.save\n\n # do this early so we don't give this node too many jobs ...\n self.last_job_id = job.id\n self.save!\n\n \n\tnode_addr = self.get_prefered_network_address\n\tif node_addr == nil?\n\t # puts \"Inproperly configured node (#{self.id}, #{self.network_addr_ext}, #{self.network_addr_int}) - no prefered network address\"\n\tend\n\n raise \"Inproperly configured node (#{self.id}, #{self.network_addr_ext}, #{self.network_addr_int}) - no prefered network address\" if node_addr.nil?\n\t\t\n\n # command = \"ssh -i #{pipeline_server_key_file_for_node} puser@#{node_addr} #{job.id} &\"\n # logger.info \"Node.consume: #{command}\"\n # result = Kernel.system(command)\n # puts \"Node #{self.inspect} COnsume: #{job.inspect}\"\n result = node_ssh_run_job(self, job)\n #logger.info \n # puts \"Node.consume RESULT: #{result.inspect}\"\n\n if (result[:exit_code] != 0)\n logger.info \"Node.consume re-setting job.state to new ...\"\n # failed command, so try again later\n job.state = \"new\"\n job.node_id = 0\n job.save\n\t return \n end\n\n self.num_jobs += 1\n self.save!\n \n end",
"def proceed!; end",
"def proceed!; end",
"def work_complete(job_handle, data)\n send_client :work_complete, job_handle, data\n \n job = worker_queue.dequeue job_handle\n job.status = \"Success\"\n job.result = data\n logger.debug \"JOB RESULT: #{data}\"\n job.save\n \n \n end",
"def perform\n # Do some work\n end",
"def dispatch(obj)\n msg = @source.receive(TIMEOUT)\n ::Celluloid.mailbox << msg if msg\n end",
"def action_complete() self.finished = true; end",
"def after job=dj\n end",
"def call(job)\n @processed_job_ids << job.job_id\n block.call(job)\n end",
"def after_worker_fork(&block); end",
"def on_envelope(envelope)\n log(DEBUG) { \"is #{envelope.future ? 'asked' : 'told'} #{envelope.message.inspect} by #{envelope.sender}\" }\n schedule_execution do\n log(DEBUG) { \"was #{envelope.future ? 'asked' : 'told'} #{envelope.message.inspect} by #{envelope.sender} - processing\" }\n process_envelope envelope\n end\n nil\n end",
"def wait; end",
"def wait; end",
"def wait; end",
"def running?; end",
"def process(payload)\n @working = true\n begin\n @queues.outgoing.push(discover_artifact_from(payload))\n rescue => ex\n STDERR.puts \"[Error] Exception in thread: #{ex.full_message}\"\n @queues.outgoing.push(ex)\n ensure\n @working = false\n end\n end",
"def process_mailbox\n handler.process\n end",
"def executor; end",
"def executor; end",
"def executor; end",
"def check_for_job_completion\n self.job.check_for_completion if complete?\n end",
"def perform!\n transfer!\n cycle!\n end",
"def perform!\n transfer!\n cycle!\n end",
"def handle_result! json, peer\n Logger.info 'Processing data received from peer: ' + peer.to_s\n service = Executor::Service.get json[:service_id]\n service.trigger.send :perform, Result.new(json, peer) \n end",
"def received\n end",
"def run() end",
"def thread; end",
"def thread; end",
"def thread; end",
"def process\n # self.update_attributes(state: 'processing')\n interactor = \"::#{self.handler.class.name}::#{self.action_name.camelcase}\".constantize\n context = interactor.call({\n product_instance: self.product_instance,\n handler: self.handler,\n job: self,\n })\n if context.failure?\n self.error_messages ||= []\n self.error_messages << context.errors if context.errors.present?\n self.save\n end\n context\n end",
"def process_new\n # each time a job is run then then a note is made that the owning user\n # has run a job. This is so we can get a count of jobs even if the user\n # deletes them\n user = User.find_by_email(self.email)\n if user.runs[\"#{self.type}\"].blank?\n user.runs[\"#{self.type}\"] = 1\n else\n user.runs[\"#{self.type}\"] += 1\n end\n user.save\n\n # get the input file, if it has not already been loaded\n begin\n if self.infile.nil? and !self.inputurl.nil?\n self.get_infile unless (self.type == 'durden' or self.type == 'identkey')\n end\n rescue\n self.jobfail(\"Could not get input file\",\"could not get input file\")\n return\n end\n\n # before processing the job, write a brief summary to the log of this job. It\n # should be csv: type,user,id,date\n logfile = \"#{Vibrant::Application.config.dropbox}/oboe_log_#{Rails.env}.txt\"\n begin\n open(logfile, 'a') do |f|\n f.puts \"#{self.type},#{self.email},#{self.id},#{self.created_at}\"\n end\n rescue\n Rails.logger.error(\"Could not write to logfile!\")\n end\n \n # having got the file, we can now commence the processing\n begin\n self.send(\"process_new_#{self.type}\")\n rescue\n self.update_attributes(:status =>'not yet available')\n end\n end",
"def perform(*args)\n puts \"--------------------\"\n puts \"Running a super awesome job\"\n puts \"--------------------\"\n puts \"this one right here.\"\n end",
"def after_perform_job_stats_performed(*args)\n Resque.redis.incr(jobs_performed_key)\n end",
"def on_begin_process()\n # subclasses may override this method \n end"
] |
[
"0.70943093",
"0.68737835",
"0.6841245",
"0.65333956",
"0.6503637",
"0.64320946",
"0.63727665",
"0.63585836",
"0.62972295",
"0.6294431",
"0.6288443",
"0.6279065",
"0.62272793",
"0.61961114",
"0.6164381",
"0.6139982",
"0.6139982",
"0.6126474",
"0.6110017",
"0.6088696",
"0.6087719",
"0.60705554",
"0.6045194",
"0.6044139",
"0.6044139",
"0.6037632",
"0.6032833",
"0.60290855",
"0.6018921",
"0.60100704",
"0.5996384",
"0.59945637",
"0.5989172",
"0.5986671",
"0.59860516",
"0.5958358",
"0.5958358",
"0.59532595",
"0.59532595",
"0.5933775",
"0.592934",
"0.59284514",
"0.5922764",
"0.5920454",
"0.591826",
"0.59090906",
"0.5908501",
"0.58991635",
"0.5890298",
"0.58898634",
"0.5888255",
"0.5887974",
"0.5884711",
"0.58807856",
"0.586873",
"0.5867293",
"0.58574843",
"0.58375686",
"0.5834787",
"0.58289325",
"0.5825016",
"0.58195406",
"0.58066314",
"0.580178",
"0.5798601",
"0.57973623",
"0.5790115",
"0.5787779",
"0.57815886",
"0.57815886",
"0.57775116",
"0.5776153",
"0.5772267",
"0.5760977",
"0.5756794",
"0.57540715",
"0.5752776",
"0.57437193",
"0.5742039",
"0.5742039",
"0.5742039",
"0.5730704",
"0.5730464",
"0.572498",
"0.57152563",
"0.57152563",
"0.57152563",
"0.57144344",
"0.5706621",
"0.5706621",
"0.57048154",
"0.5699567",
"0.56952494",
"0.5695038",
"0.5695038",
"0.5695038",
"0.56946117",
"0.5691914",
"0.56894636",
"0.56886107",
"0.5683143"
] |
0.0
|
-1
|
lookup status of job by asking actor running it
|
def get_job_status(job)
status = nil
if job.present?
if job.is_a?(Hash)
job = job.stringify_keys
actor = @registered_jobs[job['id']]
status = actor.status
else
actor = @registered_jobs[job.to_i]
status = actor.status
end
end
status
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_status(job)\n (job.status == 'done' and !job.successful) ? 'Failed' : job.status.capitalize\n end",
"def get_status_job(gear, component)\n args = build_base_gear_args(gear)\n job = RemoteJob.new(component.cartridge_name, 'status', args)\n job\n end",
"def get_job_status(job_id)\n @dbh[:progress_bars].filter(:id => job_id).first\n end",
"def status\n check_exists\n SideJob.redis.get \"#{redis_key}:status\"\n end",
"def status\n job = delayed_job\n return 'queued' if job_queued?(job)\n return 'working' if job_working?(job)\n return 'completed' if job_completed?(job)\n return 'failed' if job_failed?(job)\n return 'unknown'\n end",
"def get_status(do_poll = false)\n if do_poll\n stat = issue_erequest({ :command => 'status' })\n else\n stat = self.persisted_status\n end\n jobid = stat.to_i\n stat = jobid unless jobid == 0\n return stat\n end",
"def status\n (@remote_job || fetch_job).merge(attributes)\n end",
"def wait_on_status(jobid)\r\n uri = URI(\"http://api.idolondemand.com/1/job/status/\" + jobid)\r\n uri.query = URI.encode_www_form(:apikey => $api_key)\r\n res = Net::HTTP.get_response(uri, p_addr = $proxy_host, p_port = $proxy_port)\r\n obj = JSON.parse(res.body)\r\n\r\n if obj['status'] == 'queued'\r\n puts \"job [#{jobid}] #{obj['status']}, waiting #{$status_wait} seconds\"\r\n sleep($status_wait)\r\n wait_on_status(jobid)\r\n end\r\nend",
"def get_job(jobid, cluster)\n begin\n data = cluster.job_adapter.info(jobid)\n\n raise OodCore::JobAdapterError if data.native.nil?\n ActiveJobs::Jobstatusdata.new(data, cluster, true)\n\n rescue OodCore::JobAdapterError\n OpenStruct.new(name: jobid, error: \"No job details because job has already left the queue.\" , status: status_label(\"completed\") )\n rescue => e\n Rails.logger.info(\"#{e}:#{e.message}\")\n Rails.logger.info(e.backtrace.join(\"\\n\"))\n OpenStruct.new(name: jobid, error: \"No job details available.\\n\" + e.backtrace.to_s, status: status_label(\"\") )\n end\n end",
"def job_exists? name\n\t\t\tjob = get_job name\n\t\t\treturn job[:success]\n\t\tend",
"def job?(cmd)\n @job = api.query_job(cmd)\n job.wait_until_done!\n fld = job.failed?\n puts(job.error['message']) if fld\n fld\n end",
"def get_status\n fetch_status unless status == :completed\n status\n end",
"def get_status\n fetch_status unless status == :completed\n status\n end",
"def status(job_id:)\n login_result = login\n return login_result unless login_result.success?\n\n result = SdrClient::BackgroundJobResults.show(url: Settings.sdr_api.url, job_id: job_id)\n if result[:status] != 'complete'\n nil\n elsif result[:output][:errors].present?\n error = result[:output][:errors].first\n error_msg = error[:title]\n error_msg += \": #{error[:message]}\" if error[:message]\n Dry::Monads::Failure(error_msg)\n else\n Dry::Monads::Success(result[:output][:druid])\n end\n end",
"def search_job_get_status(searchString)\n search_and_get_value_table('requisition-view-table-body',4, searchString, 10)\n end",
"def job\n fetch('games.final_fantasy_xiv.jobs')\n end",
"def job(name)\n @manifest[\"jobs\"].find { |job| job[\"name\"] == name }\n end",
"def wait(jobid)\n resp = command %{wait jobid=\"#{jobid}\"}\n expr = /^JobStatus=.*\\((.)\\)$/\n if resp =~ expr\n $1\n else\n raise \"Command error:\" + \\\n \" expected #{expr.inspect},\" + \\\n \" got #{resp.inspect}\"\n end\n end",
"def extract_status(mr_job)\n crashed = timed_out = false\n 1.upto mr_job.item_count do |i|\n mapper = mr_job.mapper_runner i\n timed_out = true if mapper.timed_out\n crashed = true if !mapper.timed_out && mapper.status_code != 0\n end\n\n if crashed\n :crashed\n elsif timed_out\n :limit_exceeded\n else\n :ok\n end\n end",
"def poll\n\t\tactive_node = Node.find_by_mac_address(params[:nodeid]) || create_node\n\n\t\tif params[:jobid]\n\t\t\t# check status of current job\n\t\t\tjob = Job.find(params[:jobid])\n\n\t\t\tif job.status == \"active\"\n\t\t\t\trender :json => '{ \"status\": \"active\"}'\n\t\t\telse\n\t\t\t\trender\t:json => '{ \"status\": \"halt\"}'\n\t\t\tend\n\t\telse\n\t\t\t# check if there are any ongoing jobs\n\t\t\tjobs = Job.active\n\n\t\t\t# If there are any, choose one randomly\n\t\t\tif jobs.count > 0\n\t\t\t\tjob_idx = rand(jobs.count - 1)\n\n\t\t\t\tjob = jobs[job_idx]\n\n\t\t\t\t# If it's a dictionary job let's find the work\n\t\t\t\tif job[:attack_type] == \"dictionary\"\n\t\t\t\t\t# Not elegant, but can't directly assign job[:work] = ...\n\t\t\t\t\tjob.work = dictionary_content_for_job(job.id, active_node.id)\n\n\t\t\t\t\tif job.work == \"\"\n\t\t\t\t\t\tjob.status = \"completed\"\n\t\t\t\t\t\tjob.save\n\t\t\t\t\t\treturn :json => '{ \"status\": \"halt\"}'\n\t\t\t\t\tend\n\t\t\t\telsif job[:attack_type] == \"bruteforce\"\n\t\t\t\t\tjob.next_index = job.next_index.nil? ? 0 : job.next_index\n\n\t\t\t\t\tbruteforce_status = BruteforceStatus.create({\n\t\t\t\t\t\t:node_id => active_node.id,\n\t\t\t\t\t\t:job_id => job.id,\n\t\t\t\t\t\t:index => job.next_index\n\t\t\t\t\t})\n\t\t\t\t\t## Calculate next index. We're just going to increase by 50 for now\n\t\t\t\t\tjob.next_index = job.next_index + 50\n\t\t\t\t\tjob.save\n\n\t\t\t\t\t# TODO: Mark job complete if next_index > length\n\t\t\t\t\tkeyspace_size = Bruteforce::totalSize(job.charset)\n\t\t\t\t\tif job.next_index > keyspace_size\n\t\t\t\t\t\tjob.status = \"completed\"\n\t\t\t\t\t\tjob.save\n\t\t\t\t\tend\n\n\t\t\t\tend\n\n\t\t\t\trender :json => job, methods: [:work, :response_flag_meta]\n\t\t\telse\n\t\t\t\trender :json => '{ \"job\": \"none\"}'\n\t\t\tend\n\t\tend\n\n\t\t# mark the client as active\n\t\tactive_node.mark_active\n\tend",
"def find_job(job_id)\n response = HTTParty.get(\"#{@host}/api/jobs/#{job_id}\")\n\n return response['job']\n end",
"def get_job(job, ds = nil)\n (jobs_to_run + jobs_running).find do |j|\n if ds.nil?\n j[:ds].nil? and j[:job] == job\n else\n (! j[:ds].nil?) and j[:ds].name == ds.name and j[:job] == job\n end\n end\n end",
"def status()\n JobRunStatus.label_from_id(self.job_run_status_id)\n end",
"def find_by_status(status, initial_start_time)\n initial_start_time = Time.now - 1 * 60 * 60 if initial_start_time.nil?\n sql = \"Select * from #{@schema_name}.job_runs where status = '#{status}' and started_at > '#{initial_start_time}';\"\n job_run_query(sql)\n end",
"def status\n job_id = shift_argument\n unless job_id\n error(\"Usage: mortar jobs:status JOB_ID\\nMust specify JOB_ID.\")\n end\n \n # Inner function to display the hash table when the job is complte\n def display_job_status(job_status)\n job_display_entries = {\n \"status\" => job_status[\"status_description\"],\n \"progress\" => \"#{job_status[\"progress\"]}%\",\n \"cluster_id\" => job_status[\"cluster_id\"],\n \"job submitted at\" => job_status[\"start_timestamp\"],\n \"job began running at\" => job_status[\"running_timestamp\"],\n \"job finished at\" => job_status[\"stop_timestamp\"],\n \"job running for\" => job_status[\"duration\"],\n \"job run with parameters\" => job_status[\"parameters\"],\n }\n\n \n unless job_status[\"error\"].nil? || job_status[\"error\"][\"message\"].nil?\n error_context = get_error_message_context(job_status[\"error\"][\"message\"])\n unless error_context == \"\"\n job_status[\"error\"][\"help\"] = error_context\n end\n job_status[\"error\"].each_pair do |key, value|\n job_display_entries[\"error - #{key}\"] = value\n end\n end\n \n if job_status[\"num_hadoop_jobs\"] && job_status[\"num_hadoop_jobs_succeeded\"]\n job_display_entries[\"hadoop jobs complete\"] = \n '%0.2f / %0.2f' % [job_status[\"num_hadoop_jobs_succeeded\"], job_status[\"num_hadoop_jobs\"]]\n end\n \n if job_status[\"outputs\"] && job_status[\"outputs\"].length > 0\n job_display_entries[\"outputs\"] = Hash[job_status[\"outputs\"].select{|o| o[\"alias\"]}.collect do |output|\n output_hash = {}\n output_hash[\"location\"] = output[\"location\"] if output[\"location\"]\n output_hash[\"records\"] = output[\"records\"] if output[\"records\"]\n [output['alias'], output_hash]\n end]\n end\n \n styled_header(\"#{job_status[\"project_name\"]}: #{job_status[\"pigscript_name\"]} (job_id: #{job_status[\"job_id\"]})\")\n styled_hash(job_display_entries)\n end\n \n # If polling the status\n if options[:poll]\n ticking(polling_interval) do |ticks|\n job_status = api.get_job(job_id).body\n # If the job is complete exit and display the table normally \n if Mortar::API::Jobs::STATUSES_COMPLETE.include?(job_status[\"status_code\"] )\n redisplay(\"\")\n display_job_status(job_status)\n break\n end\n\n # If the job is running show the progress bar\n if job_status[\"status_code\"] == Mortar::API::Jobs::STATUS_RUNNING\n progressbar = \"=\" + (\"=\" * (job_status[\"progress\"].to_i / 5)) + \">\"\n\n if job_status[\"num_hadoop_jobs\"] && job_status[\"num_hadoop_jobs_succeeded\"]\n hadoop_jobs_ratio_complete = \n '%0.2f / %0.2f' % [job_status[\"num_hadoop_jobs_succeeded\"], job_status[\"num_hadoop_jobs\"]]\n end\n\n printf(\"\\r[#{spinner(ticks)}] Status: [%-22s] %s%% Complete (%s MapReduce jobs finished)\", progressbar, job_status[\"progress\"], hadoop_jobs_ratio_complete)\n\n # If the job is not complete, but not in the running state, just display its status\n else\n redisplay(\"[#{spinner(ticks)}] Status: #{job_status['status_description']}\")\n end\n end\n # If not polling, get the job status and display the results\n else\n job_status = api.get_job(job_id).body\n display_job_status(job_status)\n end\n end",
"def send_job_status(jobname)\n\t\tputs \"* Checking status of: #{@jenkins_url}\"\n\t\tresponse = http_req(@jenkins_url)\n\t\t\n\t\tjobs = JSON.parse(response.body)[\"jobs\"]\n\t\t\n\t\tjobs.each { |j|\n\t\t\tname = j[\"name\"]\n\n\t\t\tif name.casecmp(jobname) == 0\n\t\t \twrite_serial_status(j)\n \t\t\tend\n\t\t}\n\tend",
"def query_status(job_id)\n job = get_job_status(job_id)\n if job && (job[:job_finish] || job[:last_updated] > @last_queried[job_id])\n @last_queried[job_id] = Time.now\n job\n else\n nil\n end\n end",
"def job\n @job\n end",
"def running_status\n return @running\n ahn_log.hammer.debug \"Status requested...sent as #{@running.to_s}...\"\n end",
"def job\n @job\n end",
"def job\n @job\n end",
"def job_key; Thread.current[:job_key]; end",
"def check_job_status(report)\n job = load_job(report[:job_id])\n if (job && ((job.processed?) && !(job.complete?)))\n job.send_pack_request # Send a job complete message to the workers, and have one of them download and zip up the results files\n end\n end",
"def status(*job_id)\n #take default job_id if not specified\n if job_id.empty?\n job_id = @job_id\n else\n job_id = job_id[0]\n end\n\n \n url=\"#{@base_url}/#{@tool}/status/#{URI.encode(job_id)}\"\n uri = URI.parse(url)\n\n resp = Net::HTTP.get_response(uri)\n #puts resp.body\n\n #params = XmlSimple.xml_in(resp.body)\n\n return resp.body\n\n\n end",
"def background_job\n values.find { | job | job.is_background? } \n end",
"def pending_status\n 'pending' if archive_retrieval_job_id\n end",
"def request_job_to_process\n \n response = HTTParty.get(\"#{@host}/api/process/request_job/#{@process_code}.json\", query: {\n api_key: @api_key\n })\n\n job = response[\"job\"]\n #If there is no job waiting, end script\n if job.nil? || job[\"id\"].to_i == 0 \n @helper.terminate(\"No job to process at this time\")\n else\n @helper.log(\"Starting process #{@process_code} for job: #{job[\"id\"]} - #{job[\"author\"]} - #{job[\"title\"]} - #{job[\"created_at\"]}\")\n end\n return job\n end",
"def current_job\n return @job_current\n end",
"def search_find_job_and_get_status(job)\n\t click_on('Filter Jobs')\n\t wait_for_ajax\n\t fill_in('users-id-search', :with => \"\") #clear Recruiter field\n\t fill_in('requisition.title_id', :with => \"#{job}\")\n\t click_on('search-btn-id')\n\t wait_for_ajax\n\t search_job_get_status(job)\n\tend",
"def do_ping\n\t\t\tstatus=`initctl status #{@job_name}`\n\t\t\tstatus.include?(\"running\") ? :up : :down\n\t end",
"def method_missing sym, *args, &block\n if job = @hud.jobs.find_by_name( sym )\n job\n else\n super sym, *args, &block\n end\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 find_status\n health = get_es_resource('/_cluster/health')\n health['status'].downcase\n end",
"def find_pending(job, batch)\n sql = \"Select * from #{@schema_name}.job_runs where job_id = '#{job.id}' and batch = '#{batch.to_json}' and (status = 'queued' or status = 'running' );\"\n job_run_query(sql)\n end",
"def job_status(organization, jobid)\n uri = server_uri(\"/organizations/#{organization}/jobs/#{jobid}/status\")\n res_data = api_get(uri)\n @logger.debug res_data\n\n return res_data\n end",
"def status\n id ? Resque::Plugins::Status::Hash.get(id) : nil\n end",
"def status\n if waiting?\n :waiting\n elsif running?\n :running\n elsif done?\n :done\n end\n end",
"def job \n @job\n end",
"def wait_for_job\n\t\tloop {\n\t\t\tputs \":: #{self.feedback['job_desc']}: #{self.job_state}\" if ENV['LKP_VERBOSE']\n\n\t\t\tbreak if self.job_successfull_finished? or\n\t\t\t\t self.job_failed? or\n\t\t\t\t self.job_cancelled?\n\n\t\t\t# otherwise, the job is still in the queue or running; let's wait\n\t\t\tsleep 60\n\t\t}\n\n\t\treturn self.feedback['scheduled_time'] || self.feedback[\"#{self.job_state}_time\"]\n\tend",
"def job\n\t\tjid = @db.hget('sgt-unit:'+@id, 'job')\n\t\treturn nil if jid == nil\n\t\tgetJob(@db, jid)\n\tend",
"def job\n job_uuid && Jobber::Job::Base.find_job(job_uuid)\n end",
"def get( name )\n @jobs.each { |job| return job if job[:name] == name }\n nil\n end",
"def get_job_status(job_id)\n raise ArgumentError, \"job_id is required\" unless job_id.present?\n\n request_body = ''\n xml = Builder::XmlMarkup.new(:target => request_body, :indent => 1)\n\n xml.instruct!\n xml.Envelope do\n xml.Body do\n xml.GetJobStatus do\n xml.JOB_ID job_id\n end\n end\n end\n\n doc = send_xml_api_request(request_body)\n status = result_dom(doc)['JOB_STATUS'] rescue nil\n desc = result_dom(doc)['JOB_DESCRIPTION'] rescue nil\n [status, desc]\n end",
"def run(job)\n resp = command %{run job=\"#{job}\" yes}\n expr = /^Job queued. JobId=(\\d+)$/\n if resp =~ expr\n $1.to_i\n else\n raise \"Command error:\" + \\\n \" expected #{expr.inspect},\" + \\\n \" got #{resp.inspect}\"\n end\n end",
"def get_status\n @reply['status']\n end",
"def process!\n Sync::Jenkins.job_by_name(payload[\"name\"])\n end",
"def status\n if not(exist?)\n return :init\n end\n\n if @ppg_filename.nil?\n return :unset\n end\n\n if Global.job_queue.active?(@id)\n return :processing\n end\n\n return :processable\n end",
"def status\n STATUSES[self.status_id]\n end",
"def process_job_msg(job_msg)\n msg = job_msg[\"msg\"]\n data = job_msg[\"data\"]\n\n if status == 'pending' && msg == 'begin'\n @status = 'running'\n @start_time = Time.now\n elsif (status == 'running' || status == 'unknown') && (msg == 'success' || msg == 'failure')\n @status = msg\n @result = data\n @duration = Time.now - @start_time\n elsif (status == 'running' || status == 'unknown') && msg == 'exception'\n @status = 'exception'\n @exception = data\n @duration = Time.now - @start_time\n elsif msg == \"info\"\n # Ignore client defined messages\n true\n elsif msg == \"arrhythmia\"\n @status = 'unknown'\n @duration = Time.now - @start_time\n else\n raise \"State machine Error #{job_msg}\"\n end\n end",
"def status\n if @pbsid.nil?\n OSC::Machete::Status.not_submitted\n else\n @torque.qstat @pbsid, host: @host\n end\n end",
"def get_log_job_status(xml_data:)\n raise \"xml_data must be a valid Nokogiri::XML::Document type\" unless xml_data.is_a?(Nokogiri::XML::Document)\n xml_data.xpath('//response/result/job/status')[0].content.to_s\n end",
"def job\n operation_ids = operations.map(&:id)\n ja_ids = JobAssociation.where(operation_id: operation_ids).map(&:job_id).uniq\n jobs = Job.find(ja_ids).select(&:active?)\n raise ProtocolError, 'Cannot resolve the current Job' if jobs.length > 1\n\n jobs.last\n end",
"def status(runner)\n @pipeline[-1].status(runner)\n end",
"def status\n @status ||= STATUS[mapping_for(:status)]\n end",
"def status\n @status ||= STATUS[mapping_for(:status)]\n end",
"def status\n return @task_status if job_ended?\n\n current_task_status = puppet_to_task_status(puppet_status)\n\n self.task_status = case current_task_status\n when 'successful'\n processing_succeed_task\n when 'running'\n processing_running_task\n when 'failed'\n processing_error_task\n when 'undefined'\n processing_undefined_task\n end\n\n time_is_up! if should_stop?\n @task_status\n end",
"def status\n STATUSES[self.status_id || 0]\n end",
"def result_type_wait(job_id,result_type)\n \n #wait for the result\n nr = 0\n stat = status(job_id)\n until stat == 'FINISHED'\n nr += 1\n puts \"status: #{stat}, nr: #{nr}\"\n sleep 30\n stat = status(job_id)\n end\n #return requested result_type\n\n puts resulttypes(job_id).inspect\n \n return result(job_id,result_type)\n\n\n\n end",
"def check_status\n response = do_request(build_status_xml())\n status_elem = REXML::XPath.first(response,'/webthumb/jobStatus/status')\n @status = (status_elem.text || '').downcase == 'complete' ? STATUS_PICKUP : STATUS_PROCESSING\n \n if pickup?\n \n if status_elem\n @completion_time = status_elem.attributes['completionTime']\n @pickup_url = status_elem.attributes['pickup']\n @browser_width = (status_elem.attributes['browserWidth'] || \"0\").to_i\n @browser_height = (status_elem.attributes['browserHeight'] || \"0\").to_i \n end\n end\n @status\n end",
"def job # this is a getter\n @job\n end",
"def checkJobStatus (msg)\n\n @sqs = Aws::Sqs.new(AMAZON_ACCESS_KEY_ID, AMAZON_SECRET_ACCESS_KEY)\n\n @queue_name = PRESCHEDULING_QUEUE\n\n @queue = @sqs.queue(@queue_name, false)\n @msg = msg\n\n puts 'I just received the message:'\n puts @msg\n\n @parts = @msg.to_s.split(';')\n # toca también por punto y coma porque las urls van separadas por :\n @parts2 = @msg.to_s.split(';')\n\n if(@parts[0] == INSTALLING_APP_MSG)\n\n # ahora encuentro el job que me dicen que esta en estado instalando\n @job = Job.find(@parts[1])\n @job.status = JOBS_STATUS[:INSTALLING]\n @job.save\n @msg.delete\n\n @event = Event.new(:code => 4, :description => @msg, :event_date => DateTime.now )\n @event.execution = @job.execution\n @event.save\n\n end\n\n if(@parts[0] == RUNNING_APP_MSG)\n\n # ahora encuentro el job que me dicen que esta en estado instalando\n @job = Job.find(@parts[1])\n @job.status = JOBS_STATUS[:RUNNING]\n @job.save\n\n @hostname = @parts[2]\n @execution = @job.execution\n @execution.running_jobs = @execution.running_jobs+1\n @execution.save\n @virtual_machines = @execution.cluster.virtual_machines\n puts @hostname\n puts 'is busy'\n\n @busy_vm\n\n @virtual_machines.each do |vm|\n\n if(vm.hostname.split('.').first == @hostname)\n @busy_vm = vm\n end\n\n end\n\n if(@busy_vm != nil)\n @busy_vm.is_busy = true\n @busy_vm.save\n end\n puts 'vm saved'\n\n @msg.delete\n\n @event = Event.new(:code => 5, :description => @msg, :event_date => DateTime.now)\n @event.execution = @execution\n @event.save\n end\n\n if(@parts[0] == UPLOADING_OUTPUTS_MSG)\n\n # ahora encuentro el job que me dicen que esta en estado instalando\n @job = Job.find(@parts[1])\n @job.status = JOBS_STATUS[:UPLOADING_OUTPUTS]\n @job.save\n @msg.delete\n\n @event = Event.new(:code => 6, :description => UPLOADING_OUTPUTS+@job.id.to_s, :event_date => DateTime.now)\n @event.execution = @job.execution\n @event.save\n end\n\n if(@parts2[0] == REGISTER_FILE_MSG)\n\n puts 'registering file'\n\n # ahora encuentro el job que me dicen que toca registrarle el output\n @job = Job.find(@parts2[1])\n # creo un nuevo cloud file para representar el archivo\n @cloud_file = CloudFile.new\n @file_url =@parts2[2]\n puts @file_url\n\n @directories = Directory.where('name=?',@job.id.to_s)\n\n # es que ya existe\n if(@directories.size == 1)\n @directory = @directories[0]\n else\n @parent_directory = @job.directory\n #primero creo un directorio donde guardar la salida, el id es el nombre del job\n @directory = Directory.new\n @directory.user = @job.user\n @directory.name = @job.id.to_s\n @directory.parent_id = @parent_directory.id\n @directory.save\n end\n\n\n\n\n\n @file_url_parts = @file_url.split('/')\n @file_name = @file_url_parts.last\n\n @cloud_file.name = @file_name\n @cloud_file.directory = @directory\n @cloud_file.user = @job.user\n\n @url = @file_url_parts[4] + '/'+ @file_url_parts[5]+ '/' + @file_url_parts[6]\n @cloud_file.url = @url\n @cloud_file.avatar = @file_name\n\n #TODO Esto se debe cambiar OJO.\n @cloud_file.size = get_object_size_s3 (@file_url_parts[3]+\"/\"+@cloud_file.url)\n @cloud_file.save\n\n @msg.delete\n\n @event = Event.new(:code => 7, :description => REGISTER_FILE+@cloud_file.name, :event_date => DateTime.now)\n @event.execution = @job.execution\n @event.save\n end\n\n if ( @parts[0]== FINISHED_JOB_MSG)\n\n # ahora encuentro el job que me dicen que esta en estado Finalizado\n @job = Job.find(@parts[1])\n @job.status = JOBS_STATUS[:FINISHED]\n @job.save\n\n puts @job.to_s\n\n @hostname = @parts[2]\n @execution = @job.execution\n @execution.running_jobs = @execution.running_jobs-1\n @execution.finished_jobs = @execution.finished_jobs+1\n # si el número de jobs es 0 quiere decir que no hay jobs corriendo en este momento\n # esto quiere decir que la ejecución se ha terminado\n if @execution.running_jobs == 0\n @execution.ended = true\n puts \"Finished\" + @job.to_s\n end\n\n @execution.save\n @virtual_machines = @execution.cluster.virtual_machines\n puts @hostname\n puts 'is busy'\n\n @busy_vm\n\n @virtual_machines.each do |vm|\n\n if(vm.hostname.split('.').first == @hostname)\n @busy_vm = vm\n end\n\n end\n\n if(@busy_vm != nil)\n @busy_vm.is_busy = false\n @busy_vm.save\n end\n puts 'vm saved'\n\n @msg.delete\n\n #si la ejecución terminó\n if @execution.ended?\n\n @execution_total_cost = 0\n\n #si la ejecución terminó, apago todas las máquinas virtuales\n @virtual_machines.each do |vm|\n\n stop_one_vm(vm, @execution.cluster.user)\n\n #@execution_total_cost += vm.execution_hours* VM_PRICING[vm.execution.vm_type]\n @execution_total_cost += (vm.execution_hours * VM_PRICING[@execution.vm_type])\n\n end\n\n #le pongo que la fecha de finalización es ahora\n @end_date = DateTime.now\n @execution.end_date = @end_date\n\n #OJO!!!! TODO\n @execution.total_cost = @execution_total_cost\n @execution.save\n\n\n @event = Event.new(:code => 10, :description => EXECUTION_FINISHED+@execution.id.to_s, :event_date => @end_date)\n @event.execution = @execution\n @event.save\n\n end\n\n\n end\n\n if ( @parts[0]== SWITCHED_TO_QUEUE)\n\n @event = Event.new(:code => 3, :description => @msg, :event_date => DateTime.now )\n @queue = @parts[1].to_s.split('-')\n @exec = Execution.find(@queue[1])\n @event.execution = @exec\n @event.save\n\n end\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nend",
"def track_status(jlh)\n jmd = jlh[:jmd]\n jle = jlh[:jle]\n result = jle.job_result\n red = $application_properties['red']\n green = $application_properties['green']\n red_expression = Regexp.new(red,Regexp::MULTILINE)\n green_expression = Regexp.new(green,Regexp::MULTILINE)\n run_data_expression = Regexp.new($application_properties['run_data'],Regexp::MULTILINE)\n introscope_data_expression = Regexp.new($application_properties['introscope_data'],Regexp::MULTILINE)\n result_no_carriage = result.gsub(\"\\n\",'')\n result_no_carriage = result.gsub(\"\\r\\n\",'')\n match = green_expression.match(result)\n run_data_match = run_data_expression.match(result_no_carriage)\n if (run_data_match)\n state = run_data_match[1]\n jle.run_data = state\n $logger.debug(\"The current run of #{jmd.job_code} is storing the following run data state: #{state}\")\n end\n introscope_data_match = introscope_data_expression.match(result_no_carriage)\n if (introscope_data_match)\n state = introscope_data_match[1]\n jle.introscope_data = state\n $logger.debug(\"The current run of #{jmd.job_code} is storing the following introscope state: #{state}\")\n end\n\n if match\n cur_status = \"GREEN\"\n else\n match = red_expression.match(result)\n\n if match\n cur_status = \"RED\"\n else\n cur_status = \"UNKNOWN\"\n $logger.debug(\"The output for job_code #{jmd.job_code} does not have valid status output!\")\n end\n end\n\n #look up the last successfully completed job log entry to see what the previous status was\n #last_log = JobLogEntry.job_log_by_jc_desc(jmd.job_code).finished(true).status_completed(true).limit(1)\n last_log = JobLogEntry.get_last_tracked_status(jmd.job_code,true)\n #if we have a last log entry to compare against then increment the status_cnt if it is the same\n #as the current run. Otherwise, the count will default to 1 as the status just changed\n #if we kill the job engine during a save or the job was never run assume green.\n last_status = last_log.nil? ? \"GREEN\" : last_log.status\n\n status_cnt = 1\n unless last_log.nil?\n if (cur_status.eql?(last_status))\n #if the last job was abandoned (reboot mongrel during execution) we might still have a null\n if (last_log.status_cnt.nil?)\n last_log.status_cnt = 0\n end\n status_cnt = last_log.status_cnt + 1\n end\n end\n #return the current status and the last log status\n {:current_status => cur_status, :last_status => last_status, :status_cnt => status_cnt}\n end",
"def working!\n disque.with {|cn| cn.call :working, job_id } if disque && job_id\n end",
"def current_status\n if done?\n failed? ? 'Error' : 'Completed'\n else\n 'Running'\n end\n end",
"def for_job(id)\n job = HydroponicBean.find_job(id)\n if !job || !yield(job)\n output(Protocol::NOT_FOUND)\n return false\n end\n end",
"def get_running_time(job)\n case job.status \n when 'running' then ChronicDuration.output((Time.now - job.started_at+1).to_i, :format => :short) \n when 'done' then ChronicDuration.output((job.completed_at - job.started_at+1).to_i, :format => :short)\n else ''\n end\n end",
"def wait_for_job(job_id, timeout_seconds)\n states = ['FINISHED', 'CANCELED', 'FAILED']\n wait_interval = 2 # seconds\n total_taken = 0\n while total_taken < timeout_seconds\n sleep wait_interval\n total_taken += wait_interval\n status = @cp.get_job(job_id)\n if states.include? status['state']\n return\n end\n end\n end",
"def status()\n return [true, [], [], []] if not self.jobids.any?\n \n statuses = GridVid.query(@_keys.merge({:jobids => self.jobids}))\n passed = []\n running = [] \n failed = [] \n \n statuses.each_pair {|jobid, val|\n case val['status']\n when \"PASS\"\n passed << val['jobid'] \n when \"FAILED\" \n failed << val['jobid'] \n else\n running << val['jobid'] \n end \n }\n \n return [running.length == 0, passed, failed, running] \n end",
"def job_results(jobid)\r\n wait_on_status(jobid)\r\n puts \"Retrieving results for job [#{jobid}]\"\r\n uri = URI(\"http://api.idolondemand.com/1/job/result/\" + jobid)\r\n uri.query = URI.encode_www_form(:apikey => $api_key)\r\n res = Net::HTTP.get_response(uri, p_addr = $proxy_host, p_port = $proxy_port)\r\n return JSON.parse(res.body)['actions']\r\nend",
"def running?; state == 'running'; end",
"def running?; state == 'running'; end",
"def check_for_job_completion\n self.job.check_for_completion if complete?\n end",
"def set_job_status\n @job_status = JobStatus.find(params[:id])\n end",
"def set_job_status\n @job_status = JobStatus.find(params[:id])\n end",
"def call_status\n job = Job.find(params[:job_id])\n if !job.expert_id.blank? or !job.expert_id.nil?\n render :json=> {:success => false }\n else\n if params[:accept]\n job.update_attributes(:status => \"completed\", :expert_id => params[:expert_id])\n elsif params[:end]\n job.update_attributes(:status => \"active\")\n end\n end\n end",
"def get_job (job_id)\n\n @cron_jobs[job_id] || @non_cron_jobs[job_id]\n end",
"def rocket_job_singleton_active?\n self.class.where(:state.in => [:running, :queued], :id.ne => id).exists?\n end",
"def status(user)\n if rest_day # Rest day if flag is set\n :rest\n else \n cw = CompletedWorkout.get(user, self)\n if cw\n if cw.mgr_override # Excused if there is a manager override\n :excused \n else\n :completed # Completed normally without mgr override\n end\n else\n if active?(user)\n :open\n else\n :expired\n end\n end\n end\n \n end",
"def has_job?(job_name)\n jobs.exists?(job_name)\n end",
"def getStatus\n @@statuses[@status]\n end",
"def status\n instance_get(:status)\n end",
"def get_job\n begin\n s, sproc, clazz = selector\n # Take the job from TS using the job selector\n job = take s, 0, false\n\n # Remove job from envelope\n sproc_meth = sproc.respond_to?(:process) ? :process : :call\n job = sproc.send sproc_meth, job\n\n yield job['job']\n rescue Rinda::RequestExpiredError => e\n # This happens when the lookup expires, it's an OK exception\n # TODO use wait time in take?\n sleep @job_search_timeout\n end\n end",
"def outcome\n status.first\n end",
"def find_job\n @job = Job.find(params[:job_id])\n end",
"def Status(name)\n return -1 if !checkExists(name)\n Convert.to_integer(\n SCR.Execute(\n path(\".target.bash\"),\n Builtins.sformat(\"%1 status %2.service\", @invoker, name),\n { \"TERM\" => \"raw\" }\n )\n )\n end",
"def [](key)\n @jobs[key]\n end",
"def status\n if @resource[:status] or statuscmd\n # Don't fail when the exit status is not 0.\n ucommand(:status, false)\n\n # Expicitly calling exitstatus to facilitate testing\n if $CHILD_STATUS.exitstatus == 0\n return :running\n else\n return :stopped\n end\n elsif pid = self.getpid\n self.debug \"PID is #{pid}\"\n return :running\n else\n return :stopped\n end\n end",
"def job_exists?(job_uuid)\n res = false\n EtcdUtils.pool.with do |conn|\n key = \"#{@workflow_base}/jobs/#{job_uuid}/\"\n res = conn.exists?(key)\n end\n res\n end",
"def job(job_name)\n jobs job_name\n end",
"def job_report(job)\n state = job['state']\n owner = job['user']\n uid = job['uid']\n if ((state.to_s==\"running\") || (state.to_s==\"waiting\"))\n @logger.info \"monitor{#@id} - #{owner} job #{uid} #{state}\"\n else \n @logger.warn \"monitor{#@id} - #{owner} job #{uid} #{state}\"\n end\n end"
] |
[
"0.6813565",
"0.66068596",
"0.6595624",
"0.6533999",
"0.65229654",
"0.6501861",
"0.64503247",
"0.64343446",
"0.63047224",
"0.62552464",
"0.6204144",
"0.61560255",
"0.61560255",
"0.6151745",
"0.61328465",
"0.6110702",
"0.61010116",
"0.60858196",
"0.6080406",
"0.6053864",
"0.6053853",
"0.60395706",
"0.60362476",
"0.6016853",
"0.6011237",
"0.5994135",
"0.5993269",
"0.5985461",
"0.59809023",
"0.5970153",
"0.5970153",
"0.5953683",
"0.5949025",
"0.5934201",
"0.59332967",
"0.5924028",
"0.59224015",
"0.59067595",
"0.5863147",
"0.5839187",
"0.5836282",
"0.5834365",
"0.58228284",
"0.58213866",
"0.5810686",
"0.5806358",
"0.5803411",
"0.579742",
"0.57948935",
"0.5793346",
"0.57900953",
"0.57855934",
"0.57834184",
"0.5780168",
"0.5776238",
"0.5773277",
"0.5758167",
"0.57503533",
"0.572527",
"0.5716362",
"0.570693",
"0.5703084",
"0.5670636",
"0.56703484",
"0.56703484",
"0.56671405",
"0.56638867",
"0.5644432",
"0.5643221",
"0.5637909",
"0.5636094",
"0.5635181",
"0.5635019",
"0.56326336",
"0.5627872",
"0.5625068",
"0.5623272",
"0.5621856",
"0.5612512",
"0.5608452",
"0.5608452",
"0.5608367",
"0.5607349",
"0.5607349",
"0.5605055",
"0.5599662",
"0.5598574",
"0.5597727",
"0.55977166",
"0.5591096",
"0.55667025",
"0.55610406",
"0.55588454",
"0.5539659",
"0.55285776",
"0.5524536",
"0.55207187",
"0.55167025",
"0.55107063",
"0.5499716"
] |
0.6946824
|
0
|
Ininitialize the client You must pass in an api_url and api_key These are available from your ActiveCampaign account For the sandbox accounts these are sent to your Email address by ActiveCampaign
|
def initialize(api_url:, api_key:, verbose: false)
self.api_url = api_url.is_a?(Addressable::URI) ? api_url : Addressable::URI.parse(api_url)
self.api_key = api_key
self.verbose = verbose
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(api_key, api_secret)\n @api_key = api_key\n @api_secret = api_secret\n @api_base_url = 'https://pepocampaigns.com'\n end",
"def initialize email, api_key\n @email = email\n @api_key = api_key\n end",
"def api_credentials(api_client)\n @api_client = api_client\n return if @api_client.contact_email.blank?\n\n @api_docs = Rails.configuration.x.application.api_documentation_overview_url\n\n @name = (@api_client.contact_name.presence || @api_client.contact_email)\n\n @helpdesk_email = helpdesk_email(org: @api_client.org)\n\n I18n.with_locale I18n.default_locale do\n mail(to: @api_client.contact_email,\n subject: format(_('%{tool_name} API changes'), tool_name: tool_name))\n end\n end",
"def initialize(api_key)\n @client = Juicer::Client.new(api_key)\n end",
"def initialize\n @api_user = \"\"\n @api_key = \"\"\n end",
"def initialize(client_secret = nil, client_id = nil, base_url = 'api-qa.aspose.cloud', api_version = 'v3.0', debug = false)\n @api_client = ApiClient.new(client_secret, client_id, base_url, api_version, debug)\n end",
"def setup_api_client\n # see http://rubydoc.info/github/heroku/databasedotcom/master/Databasedotcom/Client:initialize\n # add :debugging => true to constructor hash to log API request/responses\n #u = current_user\n #debugger\n @client = Databasedotcom::Client.new({})\n @client.version = API_VERSION\n @client.authenticate :token => @current_user.access_token,\n :refresh_token => @current_user.refresh_token,\n :instance_url => @current_user.instance_url\n @client.materialize(\"Account\")\n end",
"def initialize(api_key)\n @api_key = api_key \n end",
"def initialize(client_api_key, user_api_key, host)\n endpoint_uri = \"https://#{host}/api/v1\"\n self.class.base_uri(endpoint_uri)\n\n auth_string = \"Rev #{client_api_key}:#{user_api_key}\"\n @default_headers = {\n 'Authorization' => auth_string,\n 'User-Agent' => USER_AGENT # to track usage of SDK\n }\n end",
"def initialize(api_key)\n @sg = SendGrid::API.new(api_key: api_key)\n end",
"def initialize base_url, api_key\n\t\t\t\t\t@connection = Freshdesk::Api::Client::Request.new base_url, api_key\n\t\t\t\tend",
"def initialize (api_key)\n\t\t@params = {\n\t\t\t\"key\" => api_key,\n\t\t\t\"wrapper\" => \"cleverbotrb\"\n\t\t}\n\t\t@endpoint = ENDPOINT\n\tend",
"def initialize( api_key )\n @api_key = api_key\n end",
"def initialize(api_key)\n @api_key = api_key\n end",
"def akamai_client\n\n unless File.exist?(@edgerc)\n @log.warn(\"\\t The configuration file '#{@edgerc}' does not exist or cannot be read.\")\n return nil\n end\n\n config = IniFile.load(@edgerc)\n\n if(config[@akamai_profile].empty?)\n @log.warn(\"\\t The configuration file '#{@edgerc}' does not contain a '[#{@akamai_profile}]' profile.\")\n return nil\n end\n\n api_config = config[@akamai_profile]\n api_endpoint = URI(\"https://#{api_config['host']}\")\n\n #\n # Currently we only support clearing the 'production' cache as we do not have a staging cache.\n #\n @fast_purge_api_endpoint = \"#{api_endpoint.to_s}/ccu/v3/invalidate/url/production\"\n\n api_client = Akamai::Edgegrid::HTTP.new(\n address = api_endpoint.host,\n port = api_endpoint.port\n )\n api_client.setup_edgegrid(\n client_token: api_config['client_token'],\n client_secret: api_config['client_secret'],\n access_token: api_config['access_token']\n )\n api_client.open_timeout = 20\n api_client.read_timeout = 20\n api_client\n\n end",
"def initialize\n get_enterprise_token\n initialize_client\n end",
"def initialize(apikey)\n @apikey = apikey\n end",
"def initialize(api_key)\n @api_key = api_key\n end",
"def initialize(api_key)\n @api_key = api_key\n end",
"def initialize(api_key)\n @api_key = api_key\n end",
"def initialize(api_key: nil)\r\n Configuration.api_key = api_key\r\n end",
"def initialize(api_key:)\n @api_key = api_key\n end",
"def initialize(key, client=nil)\n @api_key = key\n @client = client\n end",
"def initialize(api_key, username, password)\n @api_key, @username, @password = api_key, username, password\n setup_client\n end",
"def setup_client\n @client = Viddler::Client.new(@api_key)\n @client.authenticate!(@username, @password)\n end",
"def init\n if GoGoGibbon::Config.api_key.blank?\n @error = \"MailChimp not installed on this server.\"\n elsif params[:key].blank?\n @error = \"Please supply your MailChimp API key for verification.\"\n elsif params[:key] != GoGoGibbon::Config.api_key\n @error = \"Supplied MailChimp API key does not match server key.\"\n else\n @result = GoGoGibbon::Commands.subscribe_set User.Mailable\n end\n end",
"def initialize(api_key)\n @api_key = api_key\n @data_api_url = 'https://www.altadata.io/data/api/'\n @subscription_api_url = \"https://www.altadata.io/subscription/api/subscriptions?api_key=#{@api_key}\"\n end",
"def initialize(api_key, account_id, application_id)\n @api_key = api_key\n @account_id = account_id\n @application_id = application_id\n end",
"def initialize(client)\n @client = client\n\n @id = \"\"\n @project = nil\n @customer = nil\n @token = nil\n @url = \"\"\n @authorized = false\n @name = \"\"\n @currency = \"\"\n @return_url = \"\"\n @cancel_url = \"\"\n @custom = \"\"\n @sandbox = false\n @created_at = \"\"\n \n end",
"def initialize()\n RMeetup::Client.api_key = \"7d6585e3e2a111983b3177711467\"\n end",
"def initialize(**options)\n @api_client = PayPoint::Blue::API.new(**options)\n super\n end",
"def initialize(api_key, options = {})\n @api_key = api_key\n @api_endpoint = DEFAULT_API_ENDPOINT\n end",
"def initialize(x_api_token: nil, x_api_email: nil)\r\n Configuration.x_api_token = x_api_token\r\n Configuration.x_api_email = x_api_email\r\n end",
"def initialize(apikey='f47a72ab00afe64aab78b9919ee3d427')\n\t\t@api_key = apikey\n\t\t@headers = {\"Accept\" => \"application/JSON\", \"user-key\" => @api_key}\n\t\t@base_uri = \"https://developers.zomato.com/api/v2.1/\"\n\tend",
"def initialize()\n self.apikey = Rails.application.credentials.alpha_api_key\n end",
"def initialize(client)\n @client = client\n\n @id = \"\"\n @project = nil\n @url = \"\"\n @name = \"\"\n @amount = \"\"\n @currency = \"\"\n @metadata = Hash.new\n @request_email = false\n @request_shipping = false\n @return_url = \"\"\n @cancel_url = \"\"\n @sandbox = false\n @created_at = \"\"\n \n end",
"def initialize(username, password, api_key) \n @username = username\n @password = password\n @api_key = api_key\n @client = Savon.client(wsdl: BULLHORN_WSDL, log_level: :debug, pretty_print_xml: true)\n #@client = Savon.client(wsdl: BULLHORN_WSDL, log_level: :warn, pretty_print_xml: true)\n end",
"def initialize(api_key)\n @api_key = api_key\n check_api_key!\n end",
"def initialize(api_key)\n @client = HTTPClient.new(\n default_header: {\n 'X-Auth-Token' => api_key,\n 'Content-Type' => 'application/json'\n }\n )\n end",
"def initialize(api_key)\n raise ArgumentError, 'api_key is required' if api_key == nil || api_key.empty?\n @api_key = api_key\n\t\tend",
"def initialize(client_key_path, client_cert_path, api_key, api_endpoint, options = {})\n @obh_client = OBH::Client.new do |conf|\n conf.credentials(client_key_path: client_key_path, client_cert_path: client_cert_path, api_key: api_key)\n conf.api_endpoint = api_endpoint\n conf.proxy_host = options[:proxy_host]\n conf.proxy_port = options[:proxy_port]\n conf.locale = options[:locale]\n conf.logger = options[:logger]\n end\n @message_from = options[:message_from] || false\n end",
"def init_client; end",
"def initialize api_key, api_secret\n @api_key = api_key\n @api_secret = api_secret\n end",
"def intercom\n intercom = Intercom::Client.new(app_id: 'ahd0euu5', api_key: 'b505f64477d12b3375524315399786d54e28f9b7')\n end",
"def initialize(api_key, email = nil)\n @params = Hash.new\n\n if email.nil?\n @params[:api_key] = api_key\n else\n @params[:api_key] = api_key\n @params[:email] = email\n end\n\n end",
"def initialize(api_key, secret_key, base_url='https://api.att.com')\n\t\t@api_key \t\t = api_key\n\t\t@secret_key = secret_key\n\t\t@base_url = base_url\n\t\t@grant_type = 'client_credentials'\n\t\t@scope = 'SPEECH'\n\t\t@access_token = ''\n\t\t@refresh_token = ''\n\t\t\n\t\tcreate_connection\n\t\tget_tokens\n\t\t\n\t\tself\n\tend",
"def initialize(api_key, delivery_token, environment, options={})\n @region = options[:region].nil? ? Contentstack::Region::US : options[:region]\n @host = options[:host].nil? ? get_default_region_hosts(@region) : options[:host]\n API.init_api(api_key, delivery_token, environment, @host)\n end",
"def initialize(user_id, api_key)\n @user_id = user_id\n @api_key = api_key\n end",
"def api\n # Instantiate an instance of Gibbon with the API key provided to this adapter.\n # We only work with the lists api here, so namespace into that.\n Gibbon::Request.new(api_key: @campaignable_api_key)\n end",
"def initialize(api_key)\n raise Dealmap::ApiKeyMissingError, \"You must supply an API key\" if api_key.nil?\n @api_key = api_key\n @conn = Faraday.new(:url => 'http://api.thedealmap.com') do |builder|\n builder.adapter :typhoeus\n builder.adapter :logger\n end\n end",
"def initialize(*args)\n raise ArgumentError, \"Requires at least the api_key and secret_key when instatiating\" if args.size == 0\n\n base_url = 'https://api.att.com'\n\n if args.size == 1 && args[0].instance_of?(Hash)\n args = args.shift\n @api_key = args[:api_key]\n @secret_key = args[:secret_key]\n @base_url = args[:base_url] || base_url\n set_ssl_verify args[:ssl_verify]\n else\n @api_key = args.shift\n @secret_key = args.shift\n @base_url = args.shift || base_url\n set_ssl_verify args.shift\n end\n\n @grant_type = 'client_credentials'\n @access_token = ''\n @refresh_token = ''\n\n create_connection 'application/json'\n\n get_tokens\n\n Actor.current\n end",
"def initialize(endpoint: \"https://portal.xmedius.com\", locale: \"en\", **options)\n raise SendSecureException.new(\"API Token must be provided\") if options[:api_token] == nil\n @locale = locale\n @enterprise_account = options[:enterprise_account]\n @endpoint = endpoint\n @api_token = options[:api_token]\n @sendsecure_endpoint = get_sendsecure_endpoint\n @user_id = options[:user_id]\n end",
"def start_client\n @client = Client.new(@configure.apis)\n @client.run\n end",
"def initialize(email, password, apikey)\n @config, @config[:email], @config[:password],@config[:apikey] = {}, email, password,\"?app_key=#{apikey}\"\n end",
"def initialize(api_key = Sift.api_key, id = Sift.account_id)\n @api_key = api_key\n @id = id\n end",
"def initialize\n options ||= QuadrigaCX.configuration\n unless options.client_id && options.api_key && options.api_secret\n raise ArgumentError, \"Options required\"\n end\n\n @client_id = options.client_id\n @api_key = options.api_key\n @api_secret = options.api_secret\n end",
"def set_api_key(api_key)\n @api_key = api_key\n end",
"def initialize(config)\n @config = config\n @api_client = ApiClient.new(config)\n @access_token = nil\n end",
"def initialize(config)\n @config = config\n @api_client = ApiClient.new(config)\n @access_token = nil\n end",
"def initialize(api_key)\n @api_key = api_key\n @last_error = \"\"\n @last_error_code = \"\" \n end",
"def set_api_key\n\t\tself.api_key = ApiKey.create()\n\tend",
"def configure_envelopes_api\n access_token = ENV['DOCUSIGN_ACCESS_TOKEN_TEMP']\n #Client API Config\n base_path = 'http://demo.docusign.net/restapi'\n configuration = DocuSign_eSign::Configuration.new\n configuration.host = base_path\n api_client = DocuSign_eSign::ApiClient.new(configuration)\n api_client.default_headers[\"Authorization\"] = \"Bearer \" + access_token\n envelopes_api = DocuSign_eSign::EnvelopesApi.new(api_client)\n end",
"def initialize(mailbox, apiKey)\n @MAILBOX = ENV['MAILOSAUR_MAILBOX'] || mailbox\n @API_KEY = ENV['MAILOSAUR_APIKEY'] || apiKey\n @BASE_URI = 'https://mailosaur.com/v2'\n end",
"def initialize(api_key, api_url = 'https://api.telerivet.com/v1')\n @api_key = api_key\n @api_url = api_url\n @num_requests = 0\n @session = nil\n end",
"def create_email_service_api_call_hook\n\n custom_attributes = {\n GlobalConstant::PepoCampaigns.first_name_attribute => @first_name,\n GlobalConstant::PepoCampaigns.last_name_attribute => @last_name,\n GlobalConstant::PepoCampaigns.company_name_attribute => @company_name\n }\n\n custom_attributes[GlobalConstant::PepoCampaigns.project_description_attribute] = @project_description\n custom_attributes[GlobalConstant::PepoCampaigns.kit_marketing_attribute] = @kit_marketing\n\n Email::HookCreator::AddContact.new(\n client_id: Client::OST_KYC_CLIENT_IDENTIFIER,\n email: @email,\n custom_attributes: custom_attributes,\n list_id: GlobalConstant::PepoCampaigns.alpha_4_list_id\n ).perform\n\n end",
"def api_key\n '' \nend",
"def initialize(api_key)\n @api_key = api_key\n @conn = Faraday.new\n end",
"def initialize api_key=ENV['b2w_api_key'], api_url=\"http://api.born2win.local/v2/events\"\n @api_url = api_url\n @api_key = api_key\n end",
"def initialize(api_key=nil)\n @api_key = api_key || ENV['MESSAGEPUB_API_KEY']\n self.class.basic_auth @api_key, 'password'\n end",
"def api_key; end",
"def api_key; end",
"def initialize(config)\n $LOG.i('initializing client')\n @config = config\n @epoint = Upwork::Api::DEFAULT_EPOINT\n\t@url_auth, @url_rtoken, @url_atoken = URI_AUTH, URI_RTOKEN, URI_ATOKEN\n @tenant_id = nil\n\n\t@oauth2_client = OAuth2::Client.new(\n @config.client_id,\n @config.client_secret,\n\t :site => Upwork::Api::BASE_HOST,\n\t :authorize_url => @url_auth,\n\t :token_url => @url_atoken,\n\t :connection_opts => { :headers => {'User-Agent' => 'Github Upwork API Ruby Client' }}\n\t)\n end",
"def endpoint\n @endpoint ||= 'https://api.emailcampaigns.net/2/REST/'\n end",
"def setup_client(user_id)\n @client = Google::Apis::CalendarV3::CalendarService.new\n @client.client_options.application_name = APPLICATION_NAME\n @client.authorization = OauthClient.new(user_id).authorize\n end",
"def api_client\n @client ||= (begin\n client = Google::APIClient.new\n\n client.authorization.client_id = settings.credentials.client_id\n client.authorization.client_secret = settings.credentials.client_secret\n client.authorization.redirect_uri = settings.credentials.redirect_uris.first\n client.authorization.scope = SCOPES\n client\n end)\n end",
"def initialize(key=nil)\n CloudMade.api_key = key if key\n raise \"\\n\\nYou must provide your API key to use the CloudMade service.\\n\\nIn init.rb (or whatever):\\nCloudMade.api_key = 'YOUR_API_KEY_HERE'\\n - or - \\nCloudMade.new('YOUR_API_KEY_HERE')\\n\\n\" unless CloudMade.api_key\n end",
"def call_api\n @client.build_url\n @client.get\n assign_data\n end",
"def initialize(client)\n @client = client\n\n @id = \"\"\n @project = nil\n @gateway = nil\n @enabled = false\n @public_keys = Hash.new\n \n end",
"def setApiClient(client)\n\t\t\t@api_client = client\n\t\tend",
"def initialize(api_key)\n @api_key = api_key\n @url = URI.parse \"http://clients.multimap.com/API/geocode/1.2/#{@api_key}\"\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/ads/googleads/v8/services/campaign_experiment_service_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = Operations.new do |config|\n config.credentials = credentials\n config.endpoint = @config.endpoint\n end\n\n @campaign_experiment_service_stub = ::Gapic::ServiceStub.new(\n ::Google::Ads::GoogleAds::V8::Services::CampaignExperimentService::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def api_key\n 'your_api_key'\nend",
"def initialize (user_id, api_key, secret)\n @secret = secret\n @api_key = api_key\n @user = user_id\n @batch = nil\n\n self.protocol = 'https'\n self.host = 'sandbox.bunchball.net'\n self.accepts = 'json'\n end",
"def initialize\n @client_sdk_id = ''\n @key_file_path = ''\n @key = ''\n @sdk_identifier = 'Ruby'\n @api_url = 'https://api.yoti.com'\n @api_port = 443\n @api_version = 'v1'\n end",
"def initialize(client)\n @client = client\n @client.epoint = ENTRY_POINT \n end",
"def initialize(client)\n @client = client\n @client.epoint = ENTRY_POINT \n end",
"def ap_client(*adhoc_api_version)\n version = adhoc_api_version.empty? ? 'latest' : adhoc_api_version[0]\n @ap_client ||= AnypresenceExtension::Client.new(@account.api_host, @account.api_token, @account.application_id, version)\n end",
"def initialize(api_key)\n @api_key = api_key\n @client = Hurley::Client.new 'http://api.rottentomatoes.com/api/public/v1.0'\n self\n end",
"def initialize(api_key, api_secet, options={})\n @api_key, @api_secret = api_key, api_secet\n @consumer_options = options.merge(ApiOptions)\n end",
"def initialize(client_key, client_secret)\n @client_key = client_key\n @client_secret = client_secret\n end",
"def initialize(url=nil)\n\t\t\n\t\t#if config_file.nil?\n\t\t#\tconfig = '../../config/config_private.yaml'\n\t\t#else\n\t\t#\tconfig = config_file\n\t\t#end\n\n\t\t#These are loaded from ENV by ApiOAuthRequest object.\n\t\t#@keys['consumer_key'] = ENV['CONSUMER_KEY']\n\t\t#@keys['consumer_secret'] = ENV['CONSUMER_SECRET']\n\t\t#@keys['access_token'] = ENV['ACCESS_TOKEN']\n\t\t#@keys['access_token_secret'] = ENV['ACCESS_TOKEN_SECRET']\n\n\t\t@twitter_api = ApiOauthRequest.new()\n\t\t@twitter_api.uri_path = '/1.1/account_activity'\n\t\t@twitter_api.get_api_access\n\t\t\n\t\t@webhook_configs = []\n\t\t\n\tend",
"def initialize(crowd_url, app_name, app_password, options = {})\n @crowd_url = crowd_url\n @crowd = Savon::Client.new(@crowd_url + (Client.debug? ? '?wsdl' : ''))\n if options[:verify_cert] == false\n @crowd.request.http.ssl_client_auth(:verify_mode => OpenSSL::SSL::VERIFY_NONE)\n end\n @app_name = app_name\n @app_password = app_password\n @app_token = nil\n end",
"def initialize username, apikey\n\t\t@username = username\n\t\t@apikey = apikey\n\tend",
"def initialize(api_key)\n @options = { headers: { 'Authorization' => \"token #{api_key}\" } }\n end",
"def initialize(app, name, client_id=nil, client_secret=nil, client_options={}, options={}, &block)\n self.client_id = client_id\n self.client_secret = client_secret\n self.client_options = client_options\n super\n end",
"def initialize(client, params = {}, api_ver = nil)\n super\n end",
"def initialize(client, params = {}, api_ver = nil)\n super\n end",
"def initialize(app_id, app_secret, api_key, email, password)\n\n merge!(\n {\n applicationCredentials: {\n applicationId: app_id,\n applicationSecret: app_secret\n },\n userCredentials: {\n apiKey: api_key,\n email: email,\n password: password \n }\n }\n )\n end",
"def initialize(**params)\n\t\t\tp12file = params[:pkcs12_file]\n\t\t\tdomain = params[:domain]\n\t\t\tservice_account_email = params[:service_account_email]\n\t\t\tact_on_behalf_email = params[:admin_email]\n\t\t\tapplication_name = params[:application_name] || @@default_application_name\n\t\t\tversion = params[:version] || @@default_application_version\n\n\t\t\tkey = Google::APIClient::KeyUtils.load_from_pkcs12(p12file, 'notasecret')\n\t\t\t@client = Google::APIClient.new(:application_name => application_name, :version => version)\n\n\t\t\t@client.authorization = Signet::OAuth2::Client.new(\n \t\t\t\t:token_credential_uri => @@token_credentialuri,\n \t\t\t\t:audience => @@audience,\n \t\t\t\t:scope => @@scope,\n \t\t\t\t:issuer => service_account_email,\n \t\t\t\t:person => act_on_behalf_email,\n \t\t\t\t:sub => act_on_behalf_email,\n \t\t\t\t:signing_key => key)\n\n\t\t\t@client.authorization.fetch_access_token!\n\n\t\t\t@api = @client.discovered_api(\"admin\", \"directory_v1\")\n\t\tend",
"def initialize(api: :office365, base_url: nil, version: nil, return_format: nil, debug: false)\n @user_agent = \"RubyOutlookGem/\" << RubyOutlook::VERSION\n\n @api_host = base_url || BASE_URLS[api]\n @version = version || API_VERSIONS[api].first\n # MS Graph API uses cameCase, Outlook REST API used PascalCase\n # ActiveSupport calls these .camelcase(:lower) and .camelcase(:upper) respectively (defaults to :upper ¯\\_(ツ)_/¯)\n @resource_format = (api == :graph) ? :camel_case : :pascal_case\n @return_format = return_format || @resource_format\n\n @enable_fiddler = false\n @debug = debug\n end",
"def initialize(api_key)\n ENTITIES.each do |entity|\n eval(\"Easybill::Api::#{entity}\").authenticate api_key\n end\n self\n end"
] |
[
"0.6970165",
"0.6919673",
"0.6554132",
"0.65373087",
"0.64869994",
"0.64052314",
"0.6379505",
"0.63730615",
"0.631254",
"0.63085175",
"0.6284486",
"0.6282913",
"0.6267183",
"0.6243744",
"0.62306887",
"0.6214497",
"0.62131584",
"0.6189095",
"0.6189095",
"0.6189095",
"0.6188617",
"0.61671185",
"0.6160207",
"0.6150117",
"0.6141289",
"0.6137467",
"0.6114782",
"0.6103418",
"0.6094111",
"0.6070372",
"0.60702753",
"0.6068864",
"0.60512996",
"0.603694",
"0.60258627",
"0.5983549",
"0.5970099",
"0.59438735",
"0.59392947",
"0.5938336",
"0.5935949",
"0.59275824",
"0.5906516",
"0.59063464",
"0.58920366",
"0.58869225",
"0.5886724",
"0.5875453",
"0.58471906",
"0.5841074",
"0.5841041",
"0.58389145",
"0.582649",
"0.5825951",
"0.58206385",
"0.5820598",
"0.5820004",
"0.58185625",
"0.58185625",
"0.5816039",
"0.5809382",
"0.58069295",
"0.5806321",
"0.57789993",
"0.57750857",
"0.5770871",
"0.5768762",
"0.57678765",
"0.57654047",
"0.5747328",
"0.5747328",
"0.5746343",
"0.5745816",
"0.5711508",
"0.57000846",
"0.5697813",
"0.5684182",
"0.5676849",
"0.56734186",
"0.5659959",
"0.56586504",
"0.5657347",
"0.5655436",
"0.56540513",
"0.5648266",
"0.5648266",
"0.5647792",
"0.5644573",
"0.5630466",
"0.5623342",
"0.562137",
"0.5618851",
"0.56119156",
"0.5604592",
"0.5604374",
"0.5591951",
"0.5591951",
"0.5587958",
"0.55862224",
"0.5556995",
"0.55527616"
] |
0.0
|
-1
|
Default headers we send to active campaign Accept/content type json ApiToken for authentication
|
def default_headers
@default_headers ||= {
'accept': 'json',
'content-type': 'application/json',
'Api-Token': api_key
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def defaultHeaders(token)\n { 'Accept' => '*/*',\n 'Content-Type' => 'application/json',\n 'Authorization' => 'Bearer ' + token }\nend",
"def default_header\n if @access_token.present?\n {\n \"Authorization\" => \"Bearer #{@access_token.token}\",\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json\"\n }\n else\n {\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json\"\n }\n end\n end",
"def headers\n { 'X-Auth-Token' => self.api_key }\n end",
"def headers\n @headers ||= {\n \"Content-Type\" => \"application/json\",\n \"Authorization\" => \"Bearer #{@token}\",\n }\n end",
"def headers\n if @key_type == \"bearer\"\n {\n 'Authorization': \"Bearer #{@key}\",\n \"Content-Type\": \"application/json\"\n }\n else\n {\n 'Authorization': \"API-Key #{@key}\",\n \"Content-Type\": \"application/json\"\n }\n end\n end",
"def default_headers\n {:accept => \"application/json\", :content_type => \"application/json\"}\n end",
"def headers\n {:content_type => :json, :accept => :json, :authorization => \"TAuth realm=\\\"https://odg.t-online.de\\\",tauth_token=\\\"#{token}\\\"\"}\n end",
"def api_token_rest_headers\n {\n Authorization: \"basic #{api_token_authorization}\",\n 'Content-Type'.to_sym => 'application/x-www-form-urlencoded'\n }\n end",
"def default_headers(options)\n {\n 'Accept' => 'application/json',\n 'Ocp-Apim-Subscription-Key' => @consumer_primary_token\n }.merge(options)\n end",
"def default_headers\n {\n :content_type => :json,\n :accept => :json\n }\n end",
"def headers\n h = {\n 'X-Api-Version' => @api_version,\n :accept => :json,\n }\n\n if @account_id\n h['X-Account'] = @account_id\n end\n\n if @access_token\n h['Authorization'] = \"Bearer #{@access_token}\"\n elsif @cookies\n h[:cookies] = @cookies\n end\n\n if @local_token\n h['X-RLL-Secret'] = @local_token\n end\n\n h\n end",
"def headers\n {\n \"Authorization\" => basic_auth,\n \"Content-Type\" => \"application/json\",\n \"Accept\" => \"application/json\"\n }\n end",
"def rest_headers\n { 'Accept' => 'application/json', 'Content-Type' => 'application/json', 'Authorization' => \"Token token=#{@user[:authentication_token]}\" }\n end",
"def default_headers\n salt = Time.now.strftime(\"%Y%m%d%H%M%S\")\n digest = Digest::SHA1.hexdigest(salt + @secret)\n app_secret = salt + \":\" + digest\n\n {\n \"User-Agent\" => \"SampleAPI Client; en\",\n \"X-Ubiregi-Auth-Token\" => @token,\n \"X-Ubiregi-App-Secret\" => app_secret,\n }\n end",
"def headers\n {\n 'Accept' => 'application/json',\n 'Content-type' => 'application/json',\n 'Authorization' => \"Basic #{Base64.strict_encode64(@options[:api_key].to_s).strip}\",\n 'User-Agent' => \"Netbanx-Paysafe v1.0/ActiveMerchant #{ActiveMerchant::VERSION}\"\n }\n end",
"def default_headers\n headers = { 'Content-Type': 'application/json; charset=utf-8' }\n\n headers['Cookie'] = \"ap_session=#{@session.session_id}\" if @session\n\n headers\n end",
"def dynamic_headers\n {\n 'Authorization' => token,\n 'RequestID' => request_id,\n }\n end",
"def headers\n\t\t\tuser = \"#{config[:oauth_key]}|#{config[:fingerprint]}\"\n\t\t\tgateway = \"#{config[:client_id]}|#{config[:client_secret]}\"\n\t\t\theaders = {\n\t\t\t\tcontent_type: :json,\n\t\t\t\taccept: :json,\n\t\t\t\t'X-SP-GATEWAY' => gateway,\n\t\t\t 'X-SP-USER' => user,\n\t\t\t 'X-SP-USER-IP' => config[:ip_address],\n\t\t\t}\n if config[:idemopotency_key]\n headers['X-SP-IDEMPOTENCY-KEY'] = config[:idemopotency_key]\n end\n headers\n\t\tend",
"def getHeader\n #updateToken\n {'Content-Type' => 'application/json', 'Authorization' => 'Bearer ' + @token}\n end",
"def include_default_headers\n\t\t\tapi_header\n\t\t\tapi_response_format\n\t\tend",
"def headers\n {\n 'Host' => host,\n 'Content-Type' => 'application/json',\n api_key => settings.api_key\n }\n end",
"def default_resource_options\n {\n headers: {\n \"Authorization\" => \"Bearer #{@auth}\",\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"json\"\n }\n }\n end",
"def headers\n headerRet = {\n 'x-myobapi-version' => 'v2',\n 'Content-Type' => 'application/json'\n }\n token = (@current_company_file || {})[:token]\n unless token.nil? || token.empty?\n headerRet['x-myobapi-cftoken'] = token\n end\n key = (@consumer || {})[:key]\n unless key.nil? || key.empty?\n headerRet['x-myobapi-key'] = key\n end\n headerRet\n end",
"def headers\n {\n \"Authorization\" => \"Bearer #{ENV.fetch(\"SALESLOFT_ACCESS_TOKEN\")}\"\n }\n end",
"def headers\n hash = {}\n hash['Content-Type'] = 'application/json'\n hash['Authorization'] = \"ShacipKey #{api_key}\" unless api_key.nil?\n hash\n end",
"def headers\n {\n 'Authorization' => \"key=#{@server_key}\",\n 'Content-Type' => 'application/json'\n }\n end",
"def default_headers(current_time)\n {}.tap do |def_headers|\n def_headers['User-Agent'] = Azure::Core::Default::USER_AGENT\n def_headers['x-ms-date'] = current_time\n def_headers['x-ms-version'] = '2014-02-14'\n def_headers['DataServiceVersion'] = '1.0;NetFx'\n def_headers['MaxDataServiceVersion'] = '3.0;NetFx'\n def_headers['Content-Type'] = 'application/atom+xml; charset=utf-8'\n end\n end",
"def headers\n {'Authorization' => options[:header_format] % token}\n end",
"def headers\n headers = {}\n headers[:accept] = '*/*'\n headers[:content_type] = 'Application/json;charset=UTF-8'\n headers[:Authorization] = encode_credentials\n headers\n end",
"def procore_headers(company_id: nil, token: '')\n if company_id.nil?\n {\n \"Authorization\": \"Bearer #{token}\",\n \"Content-Type\": \"application/json\",\n }\n else\n {\n \"Authorization\": \"Bearer #{token}\",\n \"Content-Type\": \"application/json\",\n \"Procore-Company-Id\": \"#{company_id}\"\n }\n end\nend",
"def sharepoint_headers\n {\n 'Authorization' => \"Bearer #{access_token}\",\n 'Accept' => 'application/json;odata=verbose'\n }\n end",
"def build_headers(token)\n headers = {'Content-Type' =>'application/json'}\n unless token.nil? \n headers['X-Auth-Token'] = token\n end\n return headers\n end",
"def formulate_headers(auth_header)\n {\n 'Content-Type' => 'application/json',\n 'Authorization' => auth_header,\n 'Content-Encoding' => 'gzip',\n 'Accept' => 'application/json'\n }\n end",
"def headers\n [\n { :key => \"User-Agent\", :value => user_agent},\n { :key => \"Content-Type\", :value => \"application/json; charset=utf-8\" },\n { :key => \"Accept\", :value => \"application/json\"}\n ]\n end",
"def headers\n {\"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/x-www-form-urlencoded\" }\n end",
"def api_user_headers\n user = create(:user)\n headers = api_user_login(user.email, user.password)\n request.headers['access-token'] = headers['access-token']\n request.headers['client'] = headers['client']\n request.headers['uid'] = headers['uid']\n end",
"def headers\n {\n \"X-Ridepilot-Token\" => @token,\n \"Content-Type\" => \"application/json\"\n }\n end",
"def alm_headers\n {\n \"Authorization\" => \"Bearer #{ENV[\"ALM_BEARER_TOKEN\"]}\"\n }\n end",
"def headers\n if @values.key? :auth_token\n { Authorization: 'Bearer ' + @values[:auth_token] }\n else\n {}\n end\n end",
"def set_headers # :nodoc:\n {\n 'User-Agent' => \"twm-ruby-#{VERSION}\",\n 'Content-Type' => 'application/json; charset=utf-8',\n 'Accept' => 'application/json'\n }\n end",
"def header_content_json\n { \"Content-Type\" => \"application/json\" }\n end",
"def generate_headers\n nonce = Time.now.to_i.to_s\n {\n 'X-Auth-Apikey' => @api_key,\n 'X-Auth-Nonce' => nonce,\n 'X-Auth-Signature' => OpenSSL::HMAC.hexdigest('SHA256', @secret, nonce + @api_key),\n 'Content-Type' => 'application/json'\n }\n end",
"def apply_headers(req)\n req.add_field('API-Version', self.api_version)\n req.add_field('accept','application/json')\n req.add_field('Content-Type','application/json')\n req.add_field('API-Appid', self.app_id)\n req.add_field('API-Username', self.username)\n req.add_field('API-Password', self.password)\n return req\n end",
"def papinotas_headers_basic\n {\n 'access-token': 'basic_token',\n client: 'basic_client',\n uid: 'basic_test@papinotas.com'\n }\n end",
"def build_headers(token)\n headers = {'Content-Type' =>'application/json'}\n unless token.nil? \n headers['X-Auth-Token'] = token\n end\n return headers\n end",
"def add_authentication(_, request)\n request.headers['X-User-Email'] = self.class.api_user_email\n request.headers['X-User-Token'] = self.class.api_token\n end",
"def authentication_headers\n {\n \"authenticate\" => {\n \"username\" => @username,\n \"apiKey\" => @api_key\n }\n }\n end",
"def default_http_headers\n { \"Agent-Hostname\" => context.environment.hostname,\n \"Content-Type\" => \"application/octet-stream\",\n \"Agent-Version\" => ScoutApm::VERSION,\n }\n end",
"def auth_headers\n {\n 'Content-Type' => 'application/x-www-form-urlencoded'\n }\n end",
"def authentication_headers\n if token_based?\n {\n 'authenticate' => {\n 'complexType' => 'PortalLoginToken',\n 'userId' => @userId,\n 'authToken' => @authToken\n }\n }\n elsif key_based?\n {\n 'authenticate' => {\n 'username' => @username,\n 'apiKey' => @api_key\n }\n }\n else\n {}\n end\n end",
"def set_extra_headers_for(params)\n maor_headers = {\n 'x-tmrk-version' => @version,\n 'Date' => Time.now.utc.strftime(\"%a, %d %b %Y %H:%M:%S GMT\"),\n }\n params[:headers].merge!(maor_headers)\n if params[:method]==\"POST\" || params[:method]==\"PUT\"\n params[:headers].merge!({\"Content-Type\" => 'application/xml'})\n params[:headers].merge!({\"Accept\" => 'application/xml'})\n end\n unless params[:body].empty?\n params[:headers].merge!({\"x-tmrk-contenthash\" => \"Sha256 #{Base64.encode64(Digest::SHA2.digest(params[:body].to_s)).chomp}\"})\n end\n if @authentication_method == :basic_auth\n params[:headers].merge!({'Authorization' => \"Basic #{Base64.encode64(@username+\":\"+@password).delete(\"\\r\\n\")}\"})\n elsif @authentication_method == :cloud_api_auth\n signature = cloud_api_signature(params)\n params[:headers].merge!({\n \"x-tmrk-authorization\" => %{CloudApi AccessKey=\"#{@access_key}\" SignatureType=\"HmacSha256\" Signature=\"#{signature}\"}\n })\n end\n params[:headers]\n end",
"def request_headers\n headers = {'Content-Type' => 'application/json'}\n headers[:user_agent] = @client.user_agent\n headers[:authorization] = auth_header\n headers\n end",
"def headerprep(headers = {}) # :nodoc:\n default_headers = {}\n default_headers[\"X-Auth-Token\"] = @authtoken if (authok? && @account.nil?)\n default_headers[\"X-Storage-Token\"] = @authtoken if (authok? && !@account.nil?)\n default_headers[\"Connection\"] = \"Keep-Alive\"\n default_headers[\"Accept\"] = \"application/json\"\n default_headers[\"Content-Type\"] = \"application/json\"\n default_headers.merge(headers)\n end",
"def auth_headers\n {\n username: request.headers[\"X-USER-USERNAME\"], \n authentication_token: request.headers[\"X-USER-TOKEN\"]\n }\n end",
"def auth_header\n if token\n { \"Authorization\" => \"Bearer #{token}\" }\n else\n {}\n end\n end",
"def lbaas_headers\n ret = {\n :content_type => :json,\n :accept => :json,\n }\n\n ret[:'X-Auth-Token'] = @keystone_token if @keystone_token\n\n ret\n end",
"def add_auth_headers\n @client.headers['Auth-Email'] = '...'\n @client.headers['Auth-Token'] = '...'\n end",
"def header\n { \"Authorization\" => 'Bearer ' + request_access_token.token }\n end",
"def connection_headers\n {\n \"User-Agent\" => \"Montage Ruby v#{Montage::VERSION}\",\n \"Content-Type\" => \"application/json\",\n \"Accept\" => \"*/*\",\n \"Authorization\" => \"Token #{token}\",\n \"Referer\" => \"#{default_url_prefix}/\"\n }\n end",
"def headers_with_auth(token)\n return @headers unless token\n\n headers = @headers\n headers[\"Authorization\"] = \"Bearer #{token}\"\n headers\n end",
"def auth_headers(headers = {})\n h = headers.dup\n h['X-Tableau-Auth'] = @client.auth.token\n h\n end",
"def header_accepts_json\n { \"Accepts\" => \"application/json\" }\n end",
"def headers\n { 'x-apigw-api-id' => tmp_api_id }\n end",
"def default_http_header; end",
"def headerprep(headers = {}) # :nodoc:\n default_headers = {}\n default_headers[\"X-Auth-Token\"] = @authtoken if (authok? && @account.nil?)\n default_headers[\"X-Storage-Token\"] = @authtoken if (authok? && !@account.nil?)\n default_headers[\"Connection\"] = \"Keep-Alive\"\n default_headers[\"User-Agent\"] = \"CloudServers Ruby API #{VERSION}\"\n default_headers[\"Accept\"] = \"application/json\"\n default_headers.merge(headers)\n end",
"def headerprep(headers = {}) # :nodoc:\n default_headers = {}\n default_headers[\"X-Auth-Token\"] = @authtoken if (authok? && @account.nil?)\n default_headers[\"X-Storage-Token\"] = @authtoken if (authok? && !@account.nil?)\n default_headers[\"Connection\"] = \"Keep-Alive\"\n default_headers[\"User-Agent\"] = \"OpenStack::Compute Ruby API #{VERSION}\"\n default_headers[\"Accept\"] = \"application/json\"\n default_headers.merge(headers)\n end",
"def headers\n base_headers = {\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json',\n 'Sovren-AccountId' => @account_id,\n 'Sovren-ServiceKey' => @service_key\n }\n\n @additional_parse_request_headers.merge(base_headers)\n end",
"def auth_headers\n {\n email: request.headers[\"X-User-Email\"], \n authentication_token: request.headers[\"X-User-Token\"]\n }\n end",
"def standard_headers\n {\n 'Accept' => 'application/json',\n 'Content-Type' => 'application/json',\n 'User-Agent' => 'chef-pedant rspec tests',\n 'X-Chef-Version' => KNIFE_VERSION\n }\n end",
"def default_headers\n {\n user_agent: \"Unloq ruby gem #{Unloq::VERSION}\"\n }\n end",
"def default_octokit_headers\n {\n :accept => ::Octokit::Default.default_media_type,\n :content_type => \"application/json\",\n :user_agent => ::Octokit::Default.user_agent\n # :accept_encoding => \"gzip;q=1.0,deflate;q=0.6,identity;q=0.3\"\n }\n end",
"def set_json_api_header\n response.set_header(\"Content-Type\", \"application/vnd.api+json\")\n end",
"def set_auth_header(token)\n\t\t\tActiveResource::Base.headers['Authorization'] = \"Bearer #{token}\"\n\t\t\tnil\n\t\tend",
"def api_key_header\n {'X-API-KEY' => 'some_api_key'}\n end",
"def default_headers\n {\n \"User-Agent\" => \"MediaControl/1.0\",\n \"X-Apple-Session-ID\" => persistent.session,\n \"X-Apple-Device-ID\" => persistent.mac_address\n }\n end",
"def configure_api_auth_header(connection_headers)\n if api_keys?\n connection_headers['Authorization'] = generate_auth_key\n end\n end",
"def headerprep(headers = {}) # :nodoc:\n default_headers = {}\n default_headers[\"X-Auth-Token\"] = @authtoken if (authok? && @account.nil?)\n default_headers[\"X-Storage-Token\"] = @authtoken if (authok? && !@account.nil?)\n default_headers[\"Connection\"] = \"Keep-Alive\"\n default_headers[\"Accept\"] = \"application/json\"\n default_headers[\"Content-Type\"] = \"application/json\"\n default_headers[\"User-Agent\"] = \"Cloud Databases Ruby API #{CloudDB::VERSION}\"\n default_headers.merge(headers)\n end",
"def bearer_authorization_header\n if token && token['access_token']\n {AUTHORIZATION => \"Bearer #{token['access_token']}\"}\n else\n {}\n end\n end",
"def http_headers\n {\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json',\n 'User-Agent' => \"resque-exceptional/#{Version}\"\n }\n end",
"def get_authentication_header\n \"#{token_type} #{token}\"\n end",
"def jwt_headers_for(user)\n json_headers = { \n 'Content-Type': 'application/json', \n 'Accept': 'application/json' \n }\n Devise::JWT::TestHelpers.auth_headers(json_headers, user) \n end",
"def headers\n @headers ||= {\n \"Content-Type\" => \"application/vnd.org.jfrog.artifactory.security.PermissionTarget+json\",\n }\n end",
"def set_header(auth_headers)\n header 'access-token', auth_headers['access-token']\n header 'token-type', auth_headers['token-type']\n header 'client', auth_headers['client']\n header 'expiry', auth_headers['expiry']\n header 'uid', auth_headers['uid']\nend",
"def headers\n {\n 'X-EBAY-API-COMPATIBILITY-LEVEL' => @compatability_level.to_s,\n 'X-EBAY-API-DEV-NAME' => dev_id.to_s,\n 'X-EBAY-API-APP-NAME' => app_id.to_s,\n 'X-EBAY-API-CERT-NAME' => cert_id.to_s,\n 'X-EBAY-API-CALL-NAME' => @command.to_s,\n 'X-EBAY-API-SITEID' => @site_id.to_s,\n 'Content-Type' => 'text/xml'\n }\n end",
"def authorization_header\n { 'Authorization' => \"Zoho-oauthtoken #{@access_token}\" }\n end",
"def auth_settings\n {\n 'api-key' =>\n {\n type: 'api_key',\n in: 'header',\n key: 'api-key',\n value: api_key_with_prefix('api-key')\n },\n }\n end",
"def request_headers; end",
"def request_headers; end",
"def initialize api_token, timeout:30\n self.class.headers 'Authorization' => \"Bearer #{api_token.strip}\"\n end",
"def client_headers\n { \"X-PushBox-Api-Key\": client_api_key }.as_json\n end",
"def auth_headers(account)\n if config.pre_shared_key.present? && account.present?\n {\n 'x-rh-receptor-controller-psk' => config.pre_shared_key,\n 'x-rh-receptor-controller-client-id' => \"topological-inventory\",\n 'x-rh-receptor-controller-account' => account\n }\n else\n identity_header || {}\n end\n end",
"def default_headers\n {\n 'User-Agent' => ProxyFetcher.config.user_agent\n }\n end",
"def headers\n ChattyCrow.default_headers(@channel, @token)\n end",
"def headers\n @headers ||= {\n \"Content-Type\" => \"application/vnd.org.jfrog.artifactory.security.Group+json\",\n }\n end",
"def auth_settings\n {\n 'api_key' =>\n {\n type: 'api_key',\n in: 'header',\n key: 'API-Key',\n value: api_key_with_prefix('API-Key')\n },\n }\n end",
"def auth_settings\n {\n 'Bearer' =>\n {\n type: 'api_key',\n in: 'header',\n key: 'Authorization',\n value: api_key_with_prefix('Authorization')\n },\n 'Client Credentials' =>\n {\n type: 'oauth2',\n in: 'header',\n key: 'Authorization',\n value: \"Bearer #{access_token}\"\n },\n 'OAuth' =>\n {\n type: 'oauth2',\n in: 'header',\n key: 'Authorization',\n value: \"Bearer #{access_token}\"\n },\n }\n end",
"def set_header(token)\n response.headers['Authorization'] = \"Bearer #{token.to_jwt}\"\n end",
"def default_headers\n {\n \"User-Agent\" => ProxyFetcher.config.user_agent\n }\n end",
"def handle_headers_for_json\n response[HDR_A_C_ALLOW_ORIGIN] = request.env[HDR_ORIGIN] if request.env.has_key? HDR_ORIGIN\n content_type :json\n end",
"def generate_request_header()\n request_header = super()\n #puts \"--------------- generate_request_header >> request_header >>\\n#{request_header}\"\n credentials = @credential_handler.credentials\n #puts \"--------------- generate_request_header >> credentials >>\\n#{credentials}\"\n #request_header['authToken'] = @auth_handler.get_token(credentials)\n credentials.each {|k,v| request_header[prepend_namespace(k.to_s.camelize)] = v}\n request_header.select!{|k,_| ['ApplicationToken', 'CustomerAccountId', 'CustomerId', 'DeveloperToken', 'UserName', 'Password'].map{|h| prepend_namespace(h)}.include?(k.to_s)}\n #puts \"--------------- generate_request_header >> request_header final >>\\n#{request_header}\"\n return request_header\n end"
] |
[
"0.8127259",
"0.7933958",
"0.7718157",
"0.7653109",
"0.7621688",
"0.7616676",
"0.75977206",
"0.75798637",
"0.75456357",
"0.7534027",
"0.75322646",
"0.7492884",
"0.74446607",
"0.7403343",
"0.733573",
"0.7327715",
"0.73112047",
"0.7275964",
"0.7250323",
"0.72470623",
"0.72078997",
"0.719647",
"0.71654814",
"0.7164458",
"0.7137097",
"0.7116169",
"0.71117353",
"0.70923316",
"0.70733213",
"0.7039226",
"0.7035704",
"0.7028433",
"0.70276123",
"0.70267826",
"0.70159894",
"0.7005332",
"0.70017254",
"0.6984841",
"0.69807655",
"0.6975709",
"0.6954997",
"0.69523674",
"0.6947602",
"0.69356215",
"0.69346386",
"0.69331974",
"0.69271886",
"0.6910672",
"0.68866694",
"0.6885191",
"0.68561304",
"0.6847015",
"0.68376213",
"0.68183786",
"0.68128663",
"0.68093777",
"0.68070626",
"0.67860305",
"0.6785734",
"0.67835015",
"0.67814577",
"0.6734753",
"0.6733977",
"0.66974735",
"0.66902494",
"0.6684142",
"0.66623527",
"0.6645183",
"0.66405916",
"0.66296494",
"0.65847903",
"0.65650463",
"0.653442",
"0.65262026",
"0.6507446",
"0.6482482",
"0.6480262",
"0.6478797",
"0.6458327",
"0.6450629",
"0.6444623",
"0.643291",
"0.64229685",
"0.642218",
"0.6409158",
"0.6406227",
"0.64049625",
"0.64049625",
"0.63873464",
"0.6386584",
"0.6381882",
"0.6372005",
"0.6364621",
"0.63533866",
"0.63396764",
"0.63389075",
"0.63253736",
"0.63169587",
"0.631628",
"0.6311977"
] |
0.796943
|
1
|
Send a GET request
|
def get(resource_path, headers: {}, prefix: API_PREFIX)
request(method: :get, resource_path: resource_path, headers: headers, prefix: prefix)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def send_get(uri)\n _send_request('GET', uri, nil)\n end",
"def get\n start { |connection| connection.request http :Get }\n end",
"def get\n execute_request('GET') do |uri, headers|\n HTTP.http_client.get(\n uri,\n follow_redirect: true,\n header: headers\n )\n end\n end",
"def get(url='/', vars={})\n send_request url, vars, 'GET'\n end",
"def get(url, headers = {})\n do_request Net::HTTP::Get, url, headers\n end",
"def get\n url = prefix + \"get\"\n return response(url)\n end",
"def get\n url = prefix + \"get\"\n return response(url)\n end",
"def do_get\n Net::HTTP.get(URI.parse(api_url))\n end",
"def get(path, options={})\n send_request 'get', path, options\n end",
"def http( *args )\n p http_get( *args )\n end",
"def get\n check_response( @httpcli.get(@endpoint) )\n end",
"def get(url, headers={})\n do_request(\"get\", url, nil, headers)\n end",
"def get endpoint\n do_request :get, endpoint\n end",
"def get\n url = prefix + \"get\"\n return response(url)\n end",
"def get\n url = prefix + \"get\"\n return response(url)\n end",
"def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend",
"def get(url, args = {})\r\n make_request(:get, url, args)\r\n end",
"def get(path)\n request 'GET', path\n end",
"def get(uri, params = {})\n send_request(uri, :get, params)\n end",
"def get(url, headers = {})\n request(:get, url, headers)\n end",
"def get(url, headers = {})\n request(:get, url, headers)\n end",
"def get\n\t\t\tself.make_request!({uri: self.to_uri, method: :get})\n\t\tend",
"def make_get_request url, headers = []\n make_request url, headers: headers\n end",
"def get(url)\n request(:get, url, {}, nil)\n end",
"def send_get(resource)\n\n url = URI.parse(primavera_path(resource))\n req = Net::HTTP::Get.new(url.to_s)\n\n puts 'Sending GET request to ' + url.to_s\n\n send_request(url, req)\n end",
"def get(request)\n do_request(request) { |client| client.http_get }\n end",
"def perform_get(path, options = {})\n perform_request(:get, path, options)\n end",
"def get(*args)\n prepare_request(:get, args)\n @@client.add(:get, @path, *args)\n end",
"def get_request(path, params={}, options={})\n request(:get, path, params, options)\n end",
"def get\n execute_request { faraday_connection.get(href || '') }\n end",
"def get(uri)\r\n request(Net::HTTP::Get.new(uri)) \r\n end",
"def get(path, data = {})\n # Allow format override\n format = data.delete(:format) || @format\n # Add parameters to URL query string\n get_params = {\n :method => \"get\", \n :verbose => DEBUG\n }\n get_params[:params] = data unless data.empty?\n # Create GET request\n get = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", get_params)\n # Send request\n do_request(get, format, :cache => true)\n end",
"def get\n @response = Net::HTTP.get_response(URI(@url))\n end",
"def get(options = {}, all = true)\n uri = URI.parse(request_path(options, all))\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n puts \"Request URL (GET) is #{uri.request_uri}\" \n\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n response.body\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get url\n url = URI url\n request = HTTP::Get.new url.path\n\n dispatch request, to: url\n end",
"def get path = \"\", payload = {}\n make_request(path, \"get\", payload)\n end",
"def get(path, options = {})\n request = Net::HTTP::Get.new(request_uri(path))\n make_request(request, options.merge(no_callbacks: true))\n end",
"def get(params = {})\n http_helper.send_get_request(\"#{@url_prefix}\", params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params = {}, request_options = {})\n request(:get, path, params)\n end",
"def get(path, data=nil)\n request(:get, path, data)\n end",
"def get(path)\n request(:get, path, {})\n end",
"def get(path, data={})\n request(:get, path, data)\n end",
"def get(params)\n request.method = :get\n execute(params)\n end",
"def _get\n http_method(:get)\n end",
"def get()\n return @http.request(@req)\n end",
"def get(url, headers: {}, params: {}, options: {}, &block)\n url = encode_query(url, params)\n\n request = Net::HTTP::Get.new(url, @default_headers.merge(headers))\n\n execute_streaming(request, options: options, &block)\n end",
"def get(path, params = {})\n\t\trequest(path, :get, params)\n\tend",
"def get(path, params = {})\n request(:get, path, params)\n end",
"def get(path, params = {})\n request(:get, path, params)\n end",
"def get_request\n # Use our @http_object object's request method to call the\n # Net::HTTP::Get class and return the resulting response object\n @http_object.request(Net::HTTP::Get.new(@url.request_uri))\n end",
"def get(path, params, connection = CONNECTION)\n request = Net::HTTP::Get.new(to_url(path, params))\n process_request(request, connection)\nend",
"def get(path, options = {})\n request(:get, path, options)\n end",
"def get(path, options = {})\n request(:get, path, options)\n end",
"def get(url, headers={})\n RestClient.get url, headers\n end",
"def get(path, params = {})\n request(:get, path, params)\n end",
"def get(path, params = {})\n request(:get, path, params)\n end",
"def get(resource, **params)\n\n execute(Net::HTTP::Get, 'GET', resource, **params)\n\n end",
"def get(url, params={})\n @agent.get(url,params)\n end",
"def get(path, options = {})\n request(:get, path, options)\n end",
"def get(path, options = {})\n request(:get, path, options)\n end",
"def get(uri, request_headers)\n request('get', uri, request_headers)\n end",
"def get(path)\n req = Net::HTTP::Get.new(@base_url + path)\n response = handle_request(req)\n response.each {|k,v| puts \"#{k}: #{v}\"}\n response\n end",
"def get url\n RestClient::Request.execute(:method => :get, :url => url, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end",
"def get path, header={}, body_string_or_hash=\"\"\n env.http 'GET', path, header, body_string_or_hash\n end",
"def get!\n self.https.request self.http_request # Net::HTTPResponse object\n end",
"def request_get(path)\n\ttimestamp = Time.now.utc.iso8601\n\tauth = create_hmac_auth(\"GET\", path, timestamp)\n\t\n\turi = URI($baseUrl + path)\n\n\trequest = Net::HTTP::Get.new(uri)\n\trequest.add_field(\"x-hp-hmac-authentication\", auth)\n\trequest.add_field(\"x-hp-hmac-date\", timestamp)\n\n\tresponse = Net::HTTP.start(uri.host, uri.port,\n\t\t:use_ssl => uri.scheme == 'https',\n\t\t:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n\t\thttp.request(request)\n\tend\n\n\treturn response\nend",
"def do_get(uri = \"\", query = {})\n url_query = query.size > 0 ? \"?\" + query.map {|k, v| \"#{k}=#{v}\"}.join(\"&\") : \"\"\n @connection.get(uri + url_query)\n rescue Faraday::Error::ConnectionFailed => e\n $lxca_log.error \"XClarityClient::XclarityBase connection\", \"Error trying to send a GET to #{uri + url_query}\"\n Faraday::Response.new\n end",
"def get(path, options = {}, raw = false)\n request(:get, path, options, raw)\n end",
"def get(params={})\n rpc_call :get, params\n end",
"def get(path, options={}, &block)\n uri = URI.join(@endpoint, path)\n headers = options.delete(:headers)\n query = options.delete(:query)\n\n if query\n uri.query = URI.encode_www_form(query)\n end\n\n request = Net::HTTP::Get.new uri.request_uri, headers\n @http.request request, &block\n end",
"def get_request\n# Use our @http_object object's request method to call the\n# Net::HTTP::Get class and return the resulting response object\n @http_object.request(Net::HTTP::Get.new(@url.request_uri))\n end",
"def get(path, query_params={}, opts={})\n request(:get, path, query_params, opts)\n end",
"def get(uri, query = {}, &block) \n request(:get, uri, query, &block)\n end",
"def get(path:, params: {})\n request(method: :get, path: path, params: params)\n end",
"def get(url, options = {}, &block)\n options = treat_params_as_query(options)\n request HttpGetWithEntity, url, options, &block\n end",
"def send_get(url)\r\n result = @client.get(self.target_uri(url))\r\n raise \"Invalid status #{result.http_status} from server #{@host}:#{@port}\" if(result.http_status != '200')\r\n if block_given?\r\n yield(result.http_body)\r\n else\r\n result.http_body\r\n end\r\n end",
"def get(path, options = {}, &block)\n execute('GET', path, options, nil, &block)\n end",
"def http_method\n :get\n end",
"def get(url, options)\n headers = options[:headers] || {}\n params = options[:params] || {}\n url = url_with_params(url, params)\n req = Net::HTTP::Get.new(url)\n request_with_headers(req, headers)\n end",
"def get(path, query={})\n request.get(path, query_options(query))\n end",
"def get(path, arguments = {})\n perform_request { connection.get(path, arguments).body }\n end",
"def get query = nil\n\t\tif (query = make_query query)\n\t\t\t@uri.query = @uri.query ? @uri.query+\"&\"+query : query\n\t\tend\n\t\tfull_path = @uri.path + (@uri.query ? \"?#{@uri.query}\" : \"\")\n\t\t\t\n\t\treq = Net::HTTP::Get.new(full_path)\n\t\t# puts Net::HTTP::Proxy(@proxy_host, @proxy_port, @proxy_user, @proxy_pwd).get(@uri)\n\t\tdo_http req\n\tend",
"def get(url)\n call(url: url)\n end",
"def get(url); end",
"def get!\n request! :get\n end",
"def get(options={}, &block)\n response = http.get_uri(options, &block)\n handle_response(response)\n end",
"def get(path, params={})\n RestClient.get request_base+path, {params: params}\n end",
"def make_get_request\n options = {\n use_ssl: true,\n cert: OpenSSL::X509::Certificate.new(@certificate),\n key: OpenSSL::PKey::RSA.new(@key),\n ca_file: @uw_ca_file,\n verify_mode: OpenSSL::SSL::VERIFY_PEER\n }\n Net::HTTP.start(@uri.host, @uri.port, options) do |http|\n request = Net::HTTP::Get.new(@uri.request_uri)\n @response = http.request(request)\n end\n @response.body\n end",
"def get(url, headers = {})\n http :get, \"#{url}.json\", headers\n end",
"def get(path, parameters = {})\n request(:get, path, parameters)\n end"
] |
[
"0.8090074",
"0.8086617",
"0.7919836",
"0.78314894",
"0.7725113",
"0.77156067",
"0.77156067",
"0.769808",
"0.76646674",
"0.7653004",
"0.7625794",
"0.75984657",
"0.7544908",
"0.7541812",
"0.7541812",
"0.7541083",
"0.7458797",
"0.74430203",
"0.7413238",
"0.73793817",
"0.73793817",
"0.7370663",
"0.7365876",
"0.734294",
"0.73329985",
"0.7331418",
"0.732886",
"0.7318582",
"0.731419",
"0.7301373",
"0.72839946",
"0.7266109",
"0.726181",
"0.7251534",
"0.72467685",
"0.72467685",
"0.72467685",
"0.72467685",
"0.72467685",
"0.72467685",
"0.72467685",
"0.72467685",
"0.72467685",
"0.72467685",
"0.7239983",
"0.72374094",
"0.723524",
"0.72246724",
"0.7204625",
"0.72025585",
"0.72007996",
"0.71975297",
"0.71791524",
"0.71741426",
"0.7168727",
"0.716627",
"0.7160548",
"0.71520865",
"0.71300155",
"0.71300155",
"0.7105253",
"0.71032476",
"0.7101607",
"0.7101607",
"0.7092935",
"0.7078771",
"0.7078771",
"0.7076442",
"0.70741606",
"0.7066861",
"0.7066861",
"0.7059592",
"0.705918",
"0.7053518",
"0.7050931",
"0.7047861",
"0.70439565",
"0.70365167",
"0.7035174",
"0.7006297",
"0.70015895",
"0.70013905",
"0.6995872",
"0.69917035",
"0.69757956",
"0.6971574",
"0.69714004",
"0.6950282",
"0.69428545",
"0.69335943",
"0.69272",
"0.6915997",
"0.69017714",
"0.6893104",
"0.6890818",
"0.6890445",
"0.68835276",
"0.6882308",
"0.6882079",
"0.6879997",
"0.68660116"
] |
0.0
|
-1
|
Send a POST request
|
def post(resource_path, body:, headers: {}, prefix: API_PREFIX)
request(method: :post, resource_path: resource_path, headers: headers, body: body, prefix: prefix)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def make_post_request url, body, headers = []\n make_request url, method: ::Rack::POST, body: body, headers: headers\n end",
"def post(url, post_vars={})\n send_request url, post_vars, 'POST'\n end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def post_request(path, params={}, options={})\n request(:post, path, params, options)\n end",
"def post url, body, headers = {}\n http_request(url, Net::HTTP::Post, body, headers)\n end",
"def post(url, headers, body)\n request(:post, url, headers, body)\n end",
"def post(url, body, headers = {})\n do_request Net::HTTP::Post, url, headers, body\n end",
"def post()\n return @http.request(@req)\n end",
"def post(request)\n do_request(request) { |client| client.http_post request.body }\n end",
"def post(*args)\n request(:post, *args)\n end",
"def post\n resource.post(request, response)\n end",
"def post(*args)\n request :post, *args\n end",
"def post url, object = nil\n request url, HTTP::Post, object\n end",
"def post(*args)\n Request.post(*args)\n end",
"def post\n uri = URI.parse(self.url)\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.open_timeout = 10\n http.read_timeout = 10\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n data = self.params.collect { |k, v| \"#{k}=#{CGI.escape(v.to_s)}\" }.join(\"&\")\n Freemium.log_test_msg(\"POST\\n url: #{self.url}\\n query: #{data}\")\n http.post(uri.request_uri, data).body\n end",
"def post(params = nil)\n request.method = :post\n execute(params)\n end",
"def post(data = {})\n call data, method: :post\n end",
"def post(url, args = {})\r\n make_request(:post, url, args)\r\n end",
"def post(path, options={})\n send_request 'post', path, options\n end",
"def post(uri, request_headers, body)\n request('post', uri, request_headers, body)\n end",
"def post(url, data, headers = {})\n request(:post, url, headers, :data => data)\n end",
"def send_post(uri, data)\n _send_request('POST', uri, data)\n end",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end",
"def post(request)\n _request(request) { |client, options| client.post options }\n end",
"def post(path, options={})\n request :post, path, options\n end",
"def post(uri, params = {})\n send_request(uri, :post, params)\n end",
"def post!\n self.https.request self.http_request # Net::HTTPResponse object\n end",
"def post(path, data={})\n request(:post, path, data)\n end",
"def post\n RestClient.post(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def post_request(url,args)\n uri = URI.parse(url)\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data(args)\n request(uri,req)\n end",
"def post(request)\n request.method = :post\n request.call\n end",
"def post(path, data, params = {}, request_options = {})\n request(:post, path, data, params)\n end",
"def post query=nil, content_type='application/x-www-form-urlencoded'\n\t\treq = Net::HTTP::Post.new(@uri.path)\n\n\t\treq.body= make_query query if query\n\t\treq.content_type=content_type if query\n\t\treq.content_length=query ? req.body.length : 0\n\n\t\tdo_http req\n\tend",
"def post(path, params = {})\n\t\trequest(path, :post, params)\n\tend",
"def post(url, body = {})\n call(url: url, action: :post, body: body)\n end",
"def post(path, query_params={}, opts={})\n request(:post, path, query_params, opts)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(url, options = {}, &block)\n request HttpPost, url, options, &block\n end",
"def post(path, params)\n request(:post, path, params)\n end",
"def send!\n request = Net::HTTP::Post.new(uri.path, headers)\n request.body = @body\n request.content_type = @@content_type\n response = Net::HTTP.start(uri.host, uri.port) do |http|\n http.request(request)\n end\n ok?(response)\n end",
"def post(options = {})\n url = build_url(options)\n ret = post_response(url, options)\n ret\n end",
"def http_post(uri, data)\n RestClient.post uri, data\n end",
"def post(path:, params: {})\n request(method: :post, path: path, params: params)\n end",
"def do_request\n\t\t\tself.response = post_request(options)\n\t\tend",
"def do_post(uri = \"\", body = \"\")\n @connection.post do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n req.body = body\n end\n rescue Faraday::Error::ConnectionFailed => e\n $lxca_log.error \"XClarityClient::XclarityBase do_post\", \"Error trying to send a POST to #{uri}\"\n $lxca_log.error \"XClarityClient::XclarityBase do_post\", \"Request sent: #{body}\"\n Faraday::Response.new\n end",
"def send_post_request(url, payload, content_type = 'application/json')\n # set the uri\n url = URI(url)\n\n # set http settings\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n # set request\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = content_type\n request[\"cache-control\"] = 'no-cache'\n\n # set the payload\n request.body = payload\n\n # send the request and get whatever is the response\n response = http.request(request)\n\n # return the response by reading the body\n return response.read_body\n end",
"def post method, params={}\n Request.new(self, :post, method, params)\n end",
"def post(url, post_data, custom_headers = {})\n headers = @default_headers.merge(custom_headers)\n # slow down the request rate! otherwise you will get blocked\n sleep 1\n return @agent.post(url, post_data, headers)\n end",
"def post!\n request! :post\n end",
"def post(path, query_string, data)\n # ...and delegate to the Faraday connection we created on initilization\n @conn.post \"#{path}?#{query_string}\", data\n end",
"def post payload, path = \"\" \n make_request(path, \"post\", payload)\n end",
"def post(path, options = {})\n request(:post, path, options)\n end",
"def post(path, options = {})\n request(:post, path, options)\n end",
"def post(path, options = {})\n request(:post, path, options)\n end",
"def post(path, options = {})\n request(:post, path, options)\n end",
"def post(path, options = {})\n request(:post, path, options)\n end",
"def post(path, options = {})\n request(:post, path, options)\n end",
"def post(body = nil, headers = {}, path = '')\n uri = URI.parse(\"#{@url}#{path}\")\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = body\n send_request(uri, request, headers)\n end",
"def http_post(path, data, content_type = 'application/json')\n http_methods(path, :post, data, content_type)\n end",
"def post(data = \"\")\n submit :Post, data\n end",
"def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def post(url, params = {})\n client.post(url, params).body\n end",
"def post(path, data=nil)\n request(:post, path, data)\n end",
"def post(path, params={})\n RestClient.post request_base+path, params\n end",
"def post(payload)\n post_like payload, Net::HTTP::Post.new(@uri.path)\n end",
"def http_post\n req = Net::HTTP::Post.new @uri.request_uri, request_headers\n req.set_form_data params\n req.basic_auth @proxy_user, @proxy_pass if @proxy_pass && @proxy_user\n req\n end",
"def post(path, **options)\n execute :post, path, options\n end",
"def send\n post_params = {}\n self.parameters.each { |key, value|\n if value.is_a? Array\n i = 0\n value.each { |value_value|\n post_params[key.to_s + '[' + i.to_s + ']'] = value_value.to_s\n i += 1\n }\n elsif value.is_a? Hash\n value.each { |value_key, value_value|\n post_params[key.to_s + '[' + value_key.to_s + ']'] = value_value.to_s\n }\n else\n post_params[key.to_s] = value.to_s\n end\n }\n\n url = URI.parse(@@API_URL)\n http_request = Net::HTTP::Post.new(url.path)\n http_request.form_data = post_params\n http_request.basic_auth url.user, url.password if url.user\n\n response = Spree::PAYONE::Proxy::Response.new\n connection = Net::HTTP.new(url.host, url.port)\n load_ca_file connection\n connection.use_ssl = true\n connection.start { |http|\n http_response = http.request(http_request)\n response.response_body= http_response.body\n }\n\n response\n end",
"def post_http(args)\n\t\t return(Net::HTTP.post_form @uri, args)\t\t\t\n \tend",
"def perform_post(path, options = {})\n perform_request(:post, path, options)\n end",
"def post\n Rentlinx.client.post(self)\n end",
"def post\n @response_body = make_request(\"#{api_url}#{endpoint}\", request_body.to_json)\n puts \"GLIMR POST: #{endpoint} - #{request_body.to_json}\" if ENV.key?('GLIMR_API_DEBUG')\n end",
"def post(action, params={}, options={})\n request(:post, action, params, options)\n end",
"def send_request\n\n uri = URI(\"https://delivery-center-recruitment-ap.herokuapp.com/\")\n time = Time.now\n time = format_date(time)\n header = {\"Content-Type\": \"X-Sent #{time}\"}\n \n # Cria os parâmetros http\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n request = Net::HTTP::Post.new(\"https://delivery-center-recruitment-ap.herokuapp.com/\", header)\n request.body = @request_body.to_json\n response = http.request(request)\n\n #salva resposta para mostrar na tela\n self.resposta = response.body\n self.save\n end",
"def post(object, url, headers={})\n do_request(\"post\", url, object, headers)\n end",
"def POST(data=nil)\n\n if not data.nil? #if request data passed in, use it.\n @data = data\n end\n\n uri = URI(@url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n if @set_cert_file\n http = set_cert_file(http)\n end\n request = Net::HTTP::Post.new(uri.path)\n request.body = @data\n request.basic_auth(@user_name, @password)\n\n response = http.request(request)\n return response\n end",
"def post(path, options={}, raw=false)\n request(:post, path, options, raw)\n end",
"def post(data)\n uri = URI(@host)\n res = Net::HTTP.post_form(uri, {shell: data})\n # puts res.body\nend",
"def post(query_url,\r\n headers: {},\r\n parameters: {})\r\n HttpRequest.new(HttpMethodEnum::POST,\r\n query_url,\r\n headers: headers,\r\n parameters: parameters)\r\n end",
"def POST; end",
"def http_post(url, data)\n\turi = URI(url)\n\treq = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})\n req.body = data.to_json\n response = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(req) }\n return response\nend",
"def api_post(action, data)\n api_request(action, data, 'POST')\n end",
"def post(path, options={}, format=format)\n request(:post, path, options, format)\n end",
"def post(path, options = {}, raw = false)\n request(:post, path, options, raw)\n end",
"def post(path, options = {}, raw = false)\n request(:post, path, options, raw)\n end",
"def post(path, headers, body, &callback)\n request('POST', path, headers, body, &callback)\n end",
"def post(params)\n self.class.post(url, body: params)\n end",
"def post(path, parameters = {})\n request(:post, path, parameters)\n end",
"def post(url, req_hash={})\n res = nil\n res = perform_op(:post, req_hash) do\n res = @wrapper.post(url, req_hash)\n end\n return res\n end",
"def post(path, **args); end",
"def post(path, data, headers = {})\n request(:post, path, data, headers).body\n end",
"def http_post_request\n begin\n return http_client.post(http_path_query, compressed_request, http_headers)\n rescue APIKeyError\n log 'error - you must set your api_key.'\n rescue TimeoutError\n log 'fail - timeout while contacting the api server.'\n rescue Exception => e\n log \"fail - exception raised during http post. (#{e.class.name}: #{e.message})\"\n end\n nil\n end",
"def make_post_request(route:, headers: nil, body: nil)\n post route, params: body, headers: headers\nend"
] |
[
"0.7967368",
"0.7810881",
"0.7785792",
"0.7714987",
"0.76692915",
"0.7499816",
"0.74733335",
"0.74269605",
"0.74232644",
"0.74210614",
"0.7376196",
"0.7342225",
"0.7288564",
"0.72772527",
"0.7276704",
"0.7257215",
"0.72516686",
"0.7242193",
"0.72285616",
"0.7206875",
"0.72015435",
"0.7199265",
"0.7175719",
"0.7175719",
"0.7175719",
"0.7175631",
"0.715553",
"0.7139756",
"0.7134554",
"0.7120505",
"0.7103009",
"0.7092197",
"0.70918316",
"0.7088084",
"0.708484",
"0.7083339",
"0.70679295",
"0.7051143",
"0.7025053",
"0.7018412",
"0.70092875",
"0.70092875",
"0.70092875",
"0.70092875",
"0.70092875",
"0.7005202",
"0.700172",
"0.6990753",
"0.69849294",
"0.69848734",
"0.6982339",
"0.6980333",
"0.69772977",
"0.6962494",
"0.69525456",
"0.6949951",
"0.69448334",
"0.6937305",
"0.69308215",
"0.6926558",
"0.6926558",
"0.6926558",
"0.69238347",
"0.69238347",
"0.69238347",
"0.6906062",
"0.68887746",
"0.6886124",
"0.68850625",
"0.68708795",
"0.68576324",
"0.6855144",
"0.6849739",
"0.6838225",
"0.6836533",
"0.68358135",
"0.68328667",
"0.683176",
"0.6828736",
"0.68210894",
"0.681136",
"0.6801688",
"0.68002456",
"0.6797226",
"0.6792893",
"0.67909354",
"0.67868775",
"0.6784315",
"0.6782494",
"0.6781422",
"0.6777064",
"0.6776311",
"0.6776081",
"0.6771824",
"0.6770861",
"0.6770335",
"0.676477",
"0.6762537",
"0.67581725",
"0.6743526",
"0.67352635"
] |
0.0
|
-1
|
Send a PUT request
|
def put(resource_path, body:, headers: {}, prefix: API_PREFIX)
request(method: :put, resource_path: resource_path, headers: headers, body: body, prefix: prefix)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def put(*args)\n request :put, *args\n end",
"def put!\n request! :put\n end",
"def put(*args)\n request(:put, *args)\n end",
"def put_request(path, params={}, options={})\n request(:put, path, params, options)\n end",
"def put endpoint, data\n do_request :put, endpoint, data\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def put url, object = nil\n request url, HTTP::Put, object\n end",
"def put(url, vars={})\n send_request url, vars, 'PUT'\n end",
"def put(path, options={})\n request :put, path, options\n end",
"def perform_put(path, options = {})\n perform_request(:put, path, options)\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def put(path, options={})\n send_request 'put', path, options\n end",
"def put(request)\n request.method = :put\n request.call\n end",
"def put url, body, headers = {}\n http_request(url, Net::HTTP::Put, body, headers)\n end",
"def put(path, data, params = {}, request_options = {})\n request(:put, path, data, params)\n end",
"def put(url, body = {})\n call(url: url, action: :put, body: body)\n end",
"def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end",
"def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end",
"def put(object, url, headers={})\n do_request(\"put\", url, object, headers)\n end",
"def put(path, data={})\n request(:put, path, data)\n end",
"def do_put(uri = '', body = '')\n build_request(:put, uri, body)\n end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def put(path, data=nil)\n request(:put, path, data)\n end",
"def put(path, options = {}, raw = false)\n request(:put, path, options, raw)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(request)\n _request(request) { |client, options| client.put options }\n end",
"def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(uri, params = {})\n send_request(uri, :put, params)\n end",
"def put(url, data, headers = {})\n request(:put, url, headers, :data => data)\n end",
"def put(url, data, headers = {})\n request(:put, url, headers, :data => data)\n end",
"def put(path, options={}, raw=false)\n request(:put, path, options, raw)\n end",
"def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end",
"def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend",
"def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend",
"def put(path, options={}, format=format)\n request(:put, path, options, format)\n end",
"def raw_put(path, body, options = {})\n # Allow format override\n format = options.delete(:format) || @format\n # Clear cache\n expire_matching \"#{parent_path(path)}.*\"\n # Create PUT request\n put = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", \n :verbose => DEBUG,\n :method => \"put\",\n :body => body,\n :headers => { :'Content-type' => options[:content_type] || content_type(format) }\n )\n # Send request\n do_request(put, format)\n end",
"def put(request)\n do_request(request) { |client| client.http_put request.body }\n end",
"def put(path, params={})\n RestClient.put request_base+path, params\n end",
"def put(path, params)\n request(:put, path, params)\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def do_put(uri = \"\", body = \"\")\n @connection.put do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n req.body = body\n end\n rescue Faraday::Error::ConnectionFailed => e\n $lxca_log.error \"XClarityClient::XclarityBase do_put\", \"Error trying to send a PUT to #{uri}\"\n $lxca_log.error \"XClarityClient::XclarityBase do_put\", \"Request sent: #{body}\"\n Faraday::Response.new\n end",
"def put(path, opts = {})\n request(:put, path, opts).body\n end",
"def put(uri, request_headers, body)\n request('put', uri, request_headers, body)\n end",
"def put(path, params={}, options={})\n request(:put, api_path(path), params, options)\n end",
"def put(resource, body = \"\", headers = {})\n prepare_request(:put, resource, body, headers)\n end",
"def put(path, options = {})\n request(:put, parse_query_and_convenience_headers(path, options))\n end",
"def put(path, body = '', headers = {})\n with_auth { request(:put, path, body.to_s, build_request_headers(headers, :put, build_uri(path))) }\n end",
"def put method, params={}\n Request.new(self, :put, method, params)\n end",
"def put(resource, **params)\n\n execute(Net::HTTP::Put, 'PUT', resource, **params)\n\n end",
"def send_put_request endpoint, params={}, api_key=nil, ssl=false\n uri = URI.parse(endpoint)\n\n Net::HTTP.start(uri.host, uri.port) do |http|\n http.use_ssl = true if ssl\n request = Net::HTTP::Put.new(uri.request_uri)\n request['authorization'] = \"Token token=#{api_key}\" if api_key\n request.set_form_data(params)\n http.request request\n end\n end",
"def put(path, parameters = {})\n request(:put, path, parameters)\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def request_put(path)\n\ttimestamp = Time.now.utc.iso8601\n\tauth = create_hmac_auth(\"PUT\", path, timestamp)\n\t\n\turi = URI($baseUrl + path)\n\n\trequest = Net::HTTP::Put.new(uri)\n\trequest.add_field(\"x-hp-hmac-authentication\", auth)\n\trequest.add_field(\"x-hp-hmac-date\", timestamp)\n\n\tresponse = Net::HTTP.start(uri.host, uri.port,\n\t\t:use_ssl => uri.scheme == 'https',\n\t\t:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n\t\thttp.request(request)\n\tend\n\n\treturn response\nend",
"def put(body = nil, headers = {}, path = '')\n uri = URI.parse(\"#{@url}#{path}\")\n request = Net::HTTP::Put.new(uri.request_uri)\n request.body = body\n send_request(uri, request, headers)\n end",
"def put(path, body: {}, headers: nil)\n response = conn.put do |req|\n build_request(req, path: path, body: body, headers: headers)\n end\n puts response.body\n response.body unless response.blank?\n end",
"def put(path, options = {}, signature = false, raw = false, unformatted = false, no_response_wrapper = self.no_response_wrapper, signed = sign_requests)\n request(:put, path, options, signature, raw, unformatted, no_response_wrapper, signed)\n end",
"def put(url, options = {}, &block)\n run! Request.new(url, :put, options.slice(:headers, :params, :payload), &block)\n end",
"def put(url, options = {}, &block)\n request HttpPut, url, options, &block\n end",
"def send_put(resource, data)\n\n url = URI.parse(primavera_path(resource))\n req = Net::HTTP::Put.new(url.to_s, initheader = {'Content-Type' => 'application/json'})\n req.body = data\n\n puts 'Sending PUT request to ' + url.to_s\n\n send_request(url, req)\n end",
"def make_put_request(url, data)\n headers = {\n \"Content-Type\" => \"application/json\",\n }\n\n response = HTTParty.put(url, body: data.to_json, headers: headers)\n\n if response.success?\n response\n else\n puts \"Request failed with response code: #{response.code}\"\n puts \"Response message: #{response.message}\"\n nil\n end\nend",
"def put(path, params)\n parse_response @client[path].put(params)\n end",
"def put(path, opts = {}, &block)\n request(:put, path, opts, &block)\n end",
"def put(path, opts = {}, &block)\n request(:put, path, opts, &block)\n end",
"def make_put_request\n options = {\n use_ssl: true,\n cert: OpenSSL::X509::Certificate.new(@certificate),\n key: OpenSSL::PKey::RSA.new(@key),\n ca_file: @uw_ca_file,\n verify_mode: OpenSSL::SSL::VERIFY_PEER\n }\n Net::HTTP.start(@uri.host, @uri.port, options) do |http|\n request = Net::HTTP::Put.new(@uri.request_uri)\n request.body = @request_text\n @response = http.request(request)\n end\n puts \"Response is: #{get_response_code}\"\n puts \"Body is: #{@response.body}\"\n @response.body\n end",
"def api_put_request(url_prefix, data, raw_response = false)\n to_put = URI.escape(url_prefix)\n request = Net::HTTP::Put.new(to_put)\n request.body = data\n @logger.info \"PUT #{to_put}\"\n exec_request(request, raw_response, data)\n end",
"def put(*args, &block)\n self.client.put *args\n end",
"def put(path, request_options = {}, resource_options = {})\n response(:put, resource(resource_options)[path], request_options)\n end",
"def put(path, params = {}, env = {}, &block)\n env[:request_method] = \"PUT\"\n mock_request(path, params, env, &block)\n end",
"def put(path, headers = {})\n process :put, path, headers\n end",
"def do_PUT(req, res)\n perform_proxy_request(req, res) do |http, path, header|\n http.put(path, req.body || '', header)\n end\n end",
"def put(*args)\n execute(:put, *args)\n end",
"def put(url, payload = {}, headers = {})\n http :put, \"#{url}.json\", payload.to_json, headers\n end",
"def put url, payload\n RestClient::Request.execute(:method => :put, :url => url, :payload => payload, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end",
"def put(path, **options)\n execute :put, path, options\n end",
"def put(params)\n bucket = params[:bucket]\n object = params[:object]\n value = params[:value]\n content_type = params[:content_type]\n cb = params[:cb]\n date = generate_date\n sign_string = generate_signed_string('PUT', 'private', bucket, object, content_type)\n signature = generate_signature(sign_string)\n auth = generate_auth(signature)\n headers = generate_put_headers(date, auth, 'private', content_type, value.size)\n path = \"/\" << object\n\n @req_options = {:method => :put, :head => headers, :path => path, :body => value}\n @cb = cb if cb\n @bucket = bucket\n try_request\n self\n end",
"def put(action, params={}, options={})\n request(:put, action, params, options)\n end",
"def put(options={}, &block)\n response = http.put_uri(options.merge(:body => serialize), &block)\n handle_response(response)\n self\n end",
"def put(path, data = {})\n self.class.put path, :body => data.merge(:u => access_token)\n end",
"def put(path, options={})\n response = request(path, :put, options)\n validate response\n responsed_response = parse response\n data = { headers: response.headers, body: parsed_response }\n end",
"def http_put(url, params, &request_modifier)\n uri = URI.parse url\n req = Net::HTTP::Put.new uri.path\n req.set_form_data(params)\n request_modifier && (request_modifier.call req)\n\n session = (Net::HTTP.new uri.host, uri.port)\n case res = session.start { |http| http.request req }\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n else\n res.error!\n end\n end",
"def put(path: nil, payload:, headers: {}, query: {}, auth_method: nil)\n execute(\n method: :put,\n path: path,\n headers: headers,\n query: query,\n payload: payload,\n auth_method: auth_method\n )\n end",
"def put(url, payload, headers={})\n RestClient.put url, payload, headers\n end"
] |
[
"0.81779695",
"0.8132293",
"0.80464405",
"0.7928155",
"0.77801764",
"0.7735355",
"0.77251774",
"0.76552063",
"0.76366216",
"0.7628022",
"0.76213336",
"0.75720435",
"0.75720435",
"0.7570474",
"0.7567829",
"0.75325865",
"0.7485932",
"0.7470569",
"0.74696434",
"0.74568576",
"0.7452334",
"0.7441498",
"0.74414396",
"0.7438404",
"0.7438404",
"0.74350446",
"0.74350446",
"0.7433645",
"0.7432789",
"0.74322784",
"0.74322784",
"0.74322784",
"0.74305665",
"0.74305665",
"0.74305665",
"0.74305665",
"0.74305665",
"0.74305665",
"0.74305665",
"0.74305665",
"0.7430289",
"0.7428981",
"0.7422221",
"0.7417213",
"0.7417213",
"0.7409367",
"0.7397631",
"0.7397631",
"0.7386973",
"0.7386378",
"0.73831147",
"0.73682356",
"0.7367905",
"0.73432887",
"0.73403126",
"0.7318795",
"0.7298381",
"0.7284428",
"0.7272519",
"0.72706616",
"0.725753",
"0.7224086",
"0.72119945",
"0.72116196",
"0.72100115",
"0.7203387",
"0.71724606",
"0.7157014",
"0.7151634",
"0.7126306",
"0.71136796",
"0.70987093",
"0.7089645",
"0.7087418",
"0.7068325",
"0.70619637",
"0.7060877",
"0.7046444",
"0.70462924",
"0.7041679",
"0.70414263",
"0.70414263",
"0.70280766",
"0.6986694",
"0.69586885",
"0.6957833",
"0.69536877",
"0.69225943",
"0.6919459",
"0.6914991",
"0.6914758",
"0.6907137",
"0.69003105",
"0.69002295",
"0.689971",
"0.6898652",
"0.6865326",
"0.686389",
"0.6860546",
"0.6859998",
"0.68523717"
] |
0.0
|
-1
|
Send a DELETE request
|
def delete(resource_path, headers: {}, prefix: API_PREFIX)
request(method: :delete, resource_path: resource_path, headers: headers, prefix: prefix)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n request(:delete)\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def do_delete(uri = '')\n build_request(:delete, uri)\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete!\n request! :delete\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def delete(url, vars={})\n send_request url, vars, 'DELETE'\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete(url)\n do_request(\"delete\", url)\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def delete(uri, params = {})\n send_request(uri, :delete, params)\n end",
"def delete(request)\n do_request(request) { |client| client.http_delete }\n end",
"def delete(path, params = {}, request_options = {})\n request(:delete, path, params)\n end",
"def delete(uri)\r\n request(Net::HTTP::Delete.new(uri)) \r\n end",
"def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(*args)\n Request.delete(*args)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete\n request('delete').auth_required!\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(url, headers = {})\n request(:delete, url, headers)\n end",
"def delete(url, headers = {})\n request(:delete, url, headers)\n end",
"def delete(request)\n _request(request) { |client, options| client.delete options }\n end",
"def delete(uri, request_headers)\n request('delete', uri, request_headers)\n end",
"def delete(request)\n request.method = :delete\n request.call\n end",
"def delete\n api(\"Delete\")\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete(path, params)\n request(:delete, path, {})\n end",
"def delete(uri = nil)\n requestor(Net::HTTP::Delete.new(build_uri(uri)))\n end",
"def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end",
"def delete(name)\n request(uri = uri(name), Net::HTTP::Delete.new(uri.request_uri))\n end",
"def delete options\n rest_request({ method: :delete }.merge(options))\n end",
"def delete options\n rest_request({ method: :delete }.merge(options))\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end",
"def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def delete(path, data={})\n request(:delete, path, data)\n end",
"def delete\n client.delete(url)\n @deleted = true\n end",
"def delete(uri, options = {})\n build_response(request.delete(uri, build_request_options({:input => options.to_params})))\n end",
"def delete(path)\n request(:delete, path)\n end",
"def delete(url, headers={})\n RestClient.delete url, headers\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete(params = {})\n Client.current.delete(resource_url, params)\n end",
"def deleteRequest\n\n end",
"def delete(path, options={})\n send_request 'delete', path, options\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend",
"def delete(payload)\n post_like payload, Net::HTTP::Delete.new(@uri.path)\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete(url, headers: {}, options: {})\n request_without_payload(:delete, url, headers, options)\n end",
"def delete(url, headers: {}, params: {}, options: {})\n url = encode_query(url, params)\n\n request = Net::HTTP::Delete.new(url, @default_headers.merge(headers))\n\n execute_streaming(request, options: options)\n end",
"def delete(path, params={}, options={})\n request(:delete, api_path(path), params, options)\n end",
"def delete(path, options = {})\n request = Net::HTTP::Delete.new(request_uri(path))\n make_request(request, options.merge(no_callbacks: true))\n end",
"def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end",
"def delete(path)\n request(:delete, path)\n end",
"def send_delete_request(path)\n response = self.class.delete(path)\n # need auth\n case (response.code)\n when 200\n # just continue\n when 401\n authenticate(response)\n response = self.class.delete(path)\n else\n end\n if response.code != 200 && response.code != 202\n throw \"Could not finish request, status #{response.code}\"\n end\n response\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def api_delete(action, data)\n api_request(action, data, 'DELETE')\n end",
"def delete(query_url,\r\n headers: {},\r\n parameters: {})\r\n HttpRequest.new(HttpMethodEnum::DELETE,\r\n query_url,\r\n headers: headers,\r\n parameters: parameters)\r\n end",
"def delete(url, options = {}, &block)\n options = treat_params_as_query(options)\n request HttpDeleteWithEntity, url, options, &block\n end",
"def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def delete(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('delete')\n end\n end",
"def delete(headers = {}, path = '', parameters = {})\n full_path = [path, URI.encode_www_form(parameters)].join(PARAM_STARTER)\n uri = URI.parse(\"#{@url}#{full_path}\")\n request = Net::HTTP::Delete.new(uri.request_uri)\n request.body = nil\n send_request(uri, request, headers)\n end",
"def delete(uri, options = {})\n execute(uri, :delete, options)\n end",
"def delete_request(uri)\n http = build_http(uri)\n request = Net::HTTP::Delete.new(uri.request_uri, initheader = build_headers())\n return http.request(request)\n end",
"def delete(uri, parameters)\n response = Unirest.delete uri, parameters: parameters\n response.body\n end",
"def delete\n execute_request { faraday_connection.delete }\n end",
"def delete(path, options = {})\n request(:delete, path, options)\n end",
"def delete(url, options = {}, &block)\n run! Request.new(url, :delete, options.slice(:headers, :params, :payload), &block)\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 delete(path, options={}, format=format)\n request(:delete, path, options, format)\n end",
"def delete(path)\n uri = build_uri(path)\n\n request = Net::HTTP::Delete.new(uri.request_uri)\n set_authorisation_header(request)\n\n response = https_client(uri).request(request)\n end",
"def delete(path, opts = {})\n request(:delete, path, opts).body\n end",
"def delete(path, options = {})\n request(:delete, path, options)\n end",
"def delete(path, options = {})\n request(:delete, path, options)\n end"
] |
[
"0.84990364",
"0.8396772",
"0.83461964",
"0.83461964",
"0.82677025",
"0.82677025",
"0.8261009",
"0.82433265",
"0.81963205",
"0.8109251",
"0.80908537",
"0.8061717",
"0.8061717",
"0.8061717",
"0.8061717",
"0.8059549",
"0.79111004",
"0.7906911",
"0.7902865",
"0.78820944",
"0.7863514",
"0.782822",
"0.78261435",
"0.78049374",
"0.7784233",
"0.77405727",
"0.7719278",
"0.7704039",
"0.7699592",
"0.7699592",
"0.7699592",
"0.7699592",
"0.7699592",
"0.7699592",
"0.7699592",
"0.76964605",
"0.76871794",
"0.76762474",
"0.76762474",
"0.76762474",
"0.7669615",
"0.7669615",
"0.7666912",
"0.7666912",
"0.7656727",
"0.76457477",
"0.7639029",
"0.7608382",
"0.7604716",
"0.75981736",
"0.7580004",
"0.7577738",
"0.75558174",
"0.755372",
"0.755372",
"0.7547823",
"0.75320905",
"0.75314254",
"0.7522743",
"0.7505797",
"0.74994123",
"0.7496106",
"0.7488692",
"0.7485207",
"0.7472292",
"0.74601835",
"0.7459233",
"0.7456344",
"0.74499947",
"0.74414396",
"0.7433904",
"0.743275",
"0.7419502",
"0.74158216",
"0.7398629",
"0.736857",
"0.7365146",
"0.7363645",
"0.7363299",
"0.7333176",
"0.7310818",
"0.7309775",
"0.7307032",
"0.72987145",
"0.7298655",
"0.72876406",
"0.7282807",
"0.7270102",
"0.72681254",
"0.7265447",
"0.72604156",
"0.7259788",
"0.72554237",
"0.72482175",
"0.72463727",
"0.7245948",
"0.72450626",
"0.72428805",
"0.72388315",
"0.72378236",
"0.72378236"
] |
0.0
|
-1
|
Send any type of HTTP request
|
def request(method:, resource_path:, headers: {}, body: nil, prefix: API_PREFIX)
body_json = body.is_a?(String) || body.nil? ? body : body.to_json
url = ((api_url + prefix) + resource_path).to_s
request_headers = default_headers.merge(headers)
if verbose
puts("Executing #{method} request to #{url}")
request_headers.each_pair do |k, v|
puts("- Header: #{k}: #{v}")
end
puts("- body: #{body_json.class}: #{body_json}")
end
response = RestClient::Request.execute(
method: method,
url: url,
headers: request_headers,
payload: body_json
)
JSON.parse(response.body)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def send_request(req); end",
"def send_request; end",
"def send_request\n if payload\n payload_type = payload.is_a?(String) ? :body : :form\n\n @http.public_send(method, url, payload_type => payload, ssl_context: ssl_options)\n else\n @http.public_send(method, url, ssl_context: ssl_options)\n end\n end",
"def send_request(method, params, &block); end",
"def http_send_action\n http = http_inst\n req = http_post\n Response.new http.request req\n end",
"def send_request(http_method, path: \"\", body: nil)\n body = ActiveSupport::JSON.encode(body) if body.is_a? Hash\n @connection.run_request(http_method.downcase.to_sym,\n path.to_s,\n body,\n default_headers)\n end",
"def send_request\n \t\taz = @args[:authorization] and az = \"Authorization: #{az}\\r\\n\"\n body = @args.delete(:body)\n headers = @args.delete(:headers)\n body.strip! if body\n content_type = @args[:content_type]\n \t\tr = [\n \t\t \t\"#{@args[:verb]} #{@args[:uri]} HTTP/#{@args[:version] || \"1.1\"}\\r\\n\",\n \t\t\t\"Host: #{@args[:host_header] || \"_\"}\\r\\n\",\n \t\t\taz || \"\",\n \t\t\t\"Content-Length: #{body.nil? ? 0 : body.size}\\r\\n\",\n \t\t\t\"Date: #{Time.now.httpdate}\\r\\n\",\n \t\t\tcontent_type.nil? ? \"\" : \"Content-Type: #{content_type}\\r\\n\"\n \t] + \n (headers.nil? ? [] : headers.keys.map{|key| \"#{key}: #{headers[key]}\\r\\n\"}) +\n [\"\\r\\n\", body]\n \n \t\t@conn.send_data(r.join)\n \tend",
"def send!\n request = Net::HTTP::Post.new(uri.path, headers)\n request.body = @body\n request.content_type = @@content_type\n response = Net::HTTP.start(uri.host, uri.port) do |http|\n http.request(request)\n end\n ok?(response)\n end",
"def send_request path, opts = {}\n connection.send_request path, opts\n end",
"def do_request(request, want_reply, data); end",
"def request(url, type)\n url = URI(URI.encode(url))\n type ||= :GET\n req_path = \"#{url.path}?#{url.query}\"\n\n if type == :GET\n req = Net::HTTP::Get.new(req_path)\n elsif type == :POST\n req = Net::HTTP::Post.new(req_path)\n end\n\n res = Net::HTTP.new(url.host, url.port).start do |http|\n http.request(req)\n end\n\n res\n end",
"def run_request(method, url, body, headers); end",
"def do_http_request(path, http_method, content_type, accept, content = {})\n uri = open_connection path\n request = extract_request(uri, http_method)\n request.content_type = content_type unless content_type.to_s.empty?\n request['Accept'] = accept\n apply_headers request\n if (%w[POST PUT].include? http_method) && !content.empty?\n handle_content request, content_type, content\n end\n fire_request(uri, request)\n end",
"def http_send url, form_data, headers, &block\n if form_data['action'] == 'query'\n log.debug(\"GET: #{form_data.inspect}, #{@cookies.inspect}\")\n headers[:params] = form_data\n RestClient.get url, headers, &block\n else\n log.debug(\"POST: #{form_data.inspect}, #{@cookies.inspect}\")\n RestClient.post url, form_data, headers, &block\n end\n end",
"def make_request(type, headers = nil, body = nil)\n request = \"#{type.to_s.upcase} #{@path} HTTP/1.0\\r\\n\"\n request << add_headers(headers) if headers\n request << \"\\r\\n\"\n request << body if body\n request\n end",
"def send_request(opts)\n request = prep_request(opts)\n response = relay_request(request, opts)\n return response if response.is_a?(Net::HTTPSuccess) || response.is_a?(Net::HTTPAccepted)\n\n handle_error_response(response, opts[:endpoint])\n end",
"def request(*args); end",
"def send_request(type,params)\n request_url = prepare_url(type,params)\n log \"Request URL: #{request_url}\"\n res = nil\n RemoteUtil.do_with_retry(exceptions: [TimeoutError, InternalServerError]) do |except|\n begin\n if not except.nil?\n puts \"Error calling BestBuy API, will retry: \" + except.to_s\n end\n res = Net::HTTP.get_response(URI::parse(request_url))\n rescue Timeout::Error\n raise BestBuyApi::TimeoutError, \"Timeout calling #{request_url}\"\n end\n if res.kind_of? Net::HTTPSuccess\n # Successful HTTP result.\n elsif res.kind_of? Net::HTTPInternalServerError\n raise BestBuyApi::InternalServerError, \"HTTP Response: #{res.code} #{res.message} for #{request_url}\"\n else\n raise BestBuyApi::RequestError, \"HTTP Response: #{res.code} #{res.message} for #{request_url}\"\n end\n end\n begin\n JSON.parse(res.body)\n rescue JSON::ParserError\n raise BestBuyApi::RequestError, \"Bad Response: JSON Parser Error for #{request_url}\"\n end\n \n end",
"def send_request_for(testcase)\n @http_client.send_request(testcase.request['method'], testcase.request['path'], testcase.request['headers'], testcase.request['body'], testcase.request['parameters'])\n end",
"def perform_request(method, path, params, body)\n CONNECTION.run_request \\\n method.downcase.to_sym,\n path,\n ( body ? MultiJson.dump(body): nil ),\n {'Content-Type' => 'application/json'}\n end",
"def send_request_as(opts = {})\n connect(opts)\n req = build_as_request(opts)\n res = client.send_recv(req)\n disconnect\n res\n end",
"def run_request(hash)\n connection.run_request(hash[:verb], hash[:path], hash[:body],\n hash[:header])\n end",
"def send_request path, opts\n request_context = build_request path, opts\n raw_response = execute request_context\n adapt_response request_context, raw_response\n end",
"def send_request(options)\n\n # construct our RESTful request URI\n uri = \"#{Base.base_uri}/api/#{options[:target]}\"\n uri += \"/#{options[:id]}\" if options.has_key?(:id)\n uri += \"/#{options[:what]}\" if options.has_key?(:what)\n uri += \".#{options[:how]}\" if options[:method] == \"get\"\n puts \"|--------------------- SEND_REQUEST ---------------------|\"\n puts \"| URI\"\n puts \"| #{uri}\"\n puts \"| Params\"\n puts \"| id => #{options[:id]}\"\n puts \"| what => #{options[:what]}\"\n puts \"| how => #{options[:how]}\"\n puts \"|--------------------- ------------ ---------------------|\"\n \n if @access_token.nil? \n return self.class.send(options[:method] || \"get\", uri, options)\n else\n return @access_token.send(options[:method] || \"get\", uri, options).body\n end\n \n end",
"def do_request(request, response)\n if request.request_method != 'GET'\n response.status = 405\n LOG.error \"Unsupported request method #{request.request_method}\"\n return\n end\n\n do_get(request, response)\n end",
"def raw_request(type, attributes)\n RestClient.send(type, *attributes)\n rescue RestClient::Forbidden\n raise Discordrb::Errors::NoPermission, \"The bot doesn't have the required permission to do this!\"\n rescue RestClient::BadGateway\n Discordrb::LOGGER.warn('Got a 502 while sending a request! Not a big deal, retrying the request')\n retry\n end",
"def raw_request(type, attributes)\n RestClient.send(type, *attributes)\n rescue RestClient::Forbidden\n raise Discordrb::Errors::NoPermission, \"The bot doesn't have the required permission to do this!\"\n rescue RestClient::BadGateway\n Discordrb::LOGGER.warn('Got a 502 while sending a request! Not a big deal, retrying the request')\n retry\n end",
"def request(verb, uri, opts = T.unsafe(nil)); end",
"def request(type, path)\n response = connection.send(type) do |req|\n req.url path\n req.params[\"maxResult\"] = 1_000\n req.headers.merge! headers\n yield req if block_given?\n end\n\n raise KontaktIo::Error.classify(response.status) unless response.success?\n\n response\n end",
"def send\n http = EM::HttpRequest.new(@uri).post(@request_options)\n\n http.callback do\n process(http.response)\n end\n\n http.errback do\n fail(http.error)\n end\n end",
"def request(klass, path, data={})\n url = url(path)\n http = http(url)\n req = build_request(klass, url, data)\n resp = http.request(req) # send request\n load_json(resp)\n end",
"def request(*args)\n end",
"def submit\n http = Net::HTTP.new(URL.host, URL.port)\n http.use_ssl = true\n http.start { |send| send.request(self) }.body\n end",
"def run\n\n action Colors.grey(\"REQUEST \") + Colors.light_blue(\"#{options[:method].upcase} #{url}\")\n Console.instance.indent\n # run the request\n options[:ssl_verifypeer] = false\n options[:followlocation] = true\n\n Injector.decorate(options)\n\n # convert all headers keys to strings to avoid having symbols like :\"header\" when\n # declaring headers with colons instead of arrows\n if options.key?(:headers)\n new_opts = {}\n options[:headers].map do |k, v|\n new_opts[k.to_s] = v\n end\n options[:headers] = new_opts\n end\n\n if options.key?(:headers) and options[:headers].key?('Content-Type')\n ctype = options[:headers]['Content-Type']\n if ctype.include?('application/json')\n # automatically encode json content\n options[:body] = JSON.generate(options[:body], quirks_mode: true)\n end\n end\n\n\n\n self.response = Typhoeus::Request.new(url, options).run\n\n self.req_response = RequestResponse.new.tap { |r|\n r.raw_body = response.body\n r.headers = response.headers\n r.code = response.code\n r.total_time = response.total_time\n\n if !r.headers.nil? && r.headers.key?('Content-Type') && r.headers['Content-Type'].include?('application/json')\n r.body = JSON.parse(response.body)\n else\n r.body = response.body\n end\n }\n\n # reset assertion counter\n self.assert_no = 1\n\n # evaluate response against expectations\n begin\n instance_eval(&expectations)\n rescue AssertionException\n error error_msg + \" at #{expectations.source_location}\"\n raise RequestException\n rescue StandardError => e\n error 'Exception ' + e.message\n info e.backtrace.inspect\n _debug_info\n error error_msg\n raise RequestException\n ensure\n Console.instance.unindent\n end\n\n req_response\n\n end",
"def send_request(method, url)\n @response = client.run_request(method, url, @body, headers) do |req|\n req.params = params\n end\n end",
"def request(kind, url, data, options)\n # options passed as optional parameter show up as an array\n options = options.first if options.kind_of? Array\n query_options = self.class.package_query_params(options)\n full_url = URI.parse(\"#{self.url}#{url}#{query_options}\")\n \n # create an object of the class required to process this method\n klass = Object.module_eval(\"::Net::HTTP::#{kind.to_s.capitalize}\", __FILE__, __LINE__)\n request = klass.new([full_url.path, full_url.query].compact.join('?'))\n request = apply_headers(request)\n # take passed data and encode it\n request.body = self.class.body_encoder(data) if data\n \n http = Net::HTTP.new(full_url.host, full_url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.read_timeout = 500\n response = http.start do |web|\n web.request(request)\n end\n return self.class.parse_response(response.code, response.body)\n end",
"def send_request_of_type(request_type, path)\n begin\n\n request_path = GlobalConstant::ExplorerApi.base_url + path\n\n # It overrides verification of SSL certificates\n ssl_context = OpenSSL::SSL::SSLContext.new\n ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n parameterized_token = {token: get_jwt_token({url: \"/#{path}\",\n request_time: Time.now.to_i})}\n\n case request_type\n when 'get'\n response = HTTP.timeout(@timeouts)\n .get(request_path, params: parameterized_token, ssl_context: ssl_context)\n when 'post'\n response = HTTP.timeout(@timeouts)\n .post(request_path, json: parameterized_token, ssl_context: ssl_context)\n else\n return error_with_data(\n 'l_ea_b_1',\n 'something_went_wrong',\n GlobalConstant::ErrorAction.default,\n {request_type: request_type}\n )\n end\n\n case response.status\n when 200\n parsed_response = Oj.load(response.body.to_s)\n if parsed_response['success']\n return success_with_data(HashWithIndifferentAccess.new(parsed_response['data']))\n else\n # web3_js_error = true is required because when API is down or any exception is raised or response is not 200\n # front end doesn't need to see invalid ethereum address\n return error_with_data(\n parsed_response['err']['code']+':st(l_ea_b_2)',\n 'something_went_wrong',\n GlobalConstant::ErrorAction.default,\n {web3_js_error: true, status: response.status, msg: parsed_response['err']['msg']}\n )\n end\n else\n return error_with_data(\n 'l_ea_b_3',\n 'something_went_wrong',\n GlobalConstant::ErrorAction.default\n )\n end\n rescue => e\n return error_with_data(\n 'l_ea_b_4',\n 'something_went_wrong',\n GlobalConstant::ErrorAction.default,\n {message: e.message}\n )\n end\n end",
"def request(*args, &block); end",
"def send_request(http_client, usecase, meth, uri, req, params, headers, container, counter)\n container.response = http_client.send(meth, uri, params, headers) # booya!\n end",
"def run_request(method, path, body, headers)\n klass = Net::HTTP.const_get(method.to_s.capitalize)\n req.klass.new(path, headers)\n req.body = body if body\n request(req)\n end",
"def send\n sleep(delay_seconds) # Delay request if needed\n http = Net::HTTP.new(@uri.host, @uri.port)\n http.use_ssl = @config_use_ssl\n begin\n res = http.start { |http| @response = http.request(@request) }\n rescue Exception => e\n @failures << \"Exception raised while making request: #{e.message}\"\n end\n if @failures.size == 0\n @send_count += 1\n if @oks.include?(res.code)\n Log.response(@response)\n else\n Log.response(@response, false)\n @failures << \"Request returned #{res.code}\"\n end\n end\n end",
"def send(*rest) end",
"def send(*rest) end",
"def send(*rest) end",
"def process_http_request\n # the http request details are available via the following instance variables:\n # @http_protocol\n # @http_request_method\n # @http_cookie\n # @http_if_none_match\n # @http_content_type\n # @http_path_info\n # @http_request_uri\n # @http_query_string\n # @http_post_content\n # @http_headers\n handle(@http_request_method, @http_post_content)\n\n send_ok()\n end",
"def _request(url, type, key)\n url = URI(url)\n type ||= :GET\n req_path = \"#{url.path}?#{url.query}\"\n\n if type == :GET\n req = Net::HTTP::Get.new(req_path)\n elsif type == :POST\n req = Net::HTTP::Post.new(req_path)\n end\n\n req.add_field('X-Vermillion-Key', key)\n req.add_field('Accept', 'application/json')\n req.add_field('Cache-Control', 'no-cache')\n req.add_field('From', @config.get(:user))\n req.add_field('User-Agent', 'Vermillion Client 1.0')\n\n res = Net::HTTP.new(url.host, url.port).start do |http|\n http.request(req)\n end\n\n res\n end",
"def send_request(request, use_ssl: false)\n req = parse_http_request(request)\n req['uri'].scheme = 'https' if use_ssl\n send_uri(req['uri'],\n method: req['method'],\n headers: req['headers'],\n body: req['body'])\n end",
"def http_request(params)\n Net::HTTP::Post.new(endpoint.request_uri).tap do |request|\n request.body = URI.encode_www_form params\n request.content_type = 'application/x-www-form-urlencoded; charset=utf-8'\n end\n end",
"def perform(arguments = {})\n case type.to_sym\n when :post, :get\n api.public_send(type, path, @arguments.merge(arguments))\n else\n raise ArgumentError, \"Unregistered request type #{request_type}\"\n end\n end",
"def request(*)\n raise 'HttpApiBuilder::BaseClient#request must be implemented, see documentation'\n end",
"def http_request(action, data, method_type = 'POST', binary_key = nil)\n\n uri = \"#{@api_uri}/#{action}\"\n if method_type != \"POST\" && (!method_type.is_a? String)\n uri += \"?\" + data.map{ |key, value| \"#{CGI::escape(key.to_s)}=#{CGI::escape(value.to_s)}\" }.join(\"&\")\n end\n\n req = nil\n\n _uri = URI.parse(uri)\n\n headers = {\n \"Content-Type\": \"text/json\",\n \"Api-Key\":\"#{@api_key}\"\n }\n\n if method_type == 'POST'\n req = set_up_post_request(\n _uri, data, headers, binary_key\n )\n\n else\n request_uri = \"#{_uri.path}?#{_uri.query}\"\n if method_type == 'DELETE'\n req = Net::HTTP::Delete.new(request_uri, headers)\n else\n req = Net::HTTP::Get.new(request_uri, headers)\n end\n end\n\n begin\n http = Net::HTTP::Proxy(@proxy_host, @proxy_port).new(_uri.host, _uri.port)\n\n if _uri.scheme == 'https'\n http.ssl_version = :TLSv1\n http.use_ssl = true\n http.set_debug_output $stderr\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE if @verify_ssl != true # some openSSL client doesn't work without doing this\n http.ssl_timeout = @opts[:http_ssl_timeout] || 5\n end\n http.open_timeout = @opts[:http_open_timeout] || 5\n http.read_timeout = @opts[:http_read_timeout] || 10\n http.close_on_empty_response = @opts[:http_close_on_empty_response] || true\n\n\n response = http.start do\n http.request(req)\n end\n\n rescue Timeout::Error, Errno::ETIMEDOUT => e\n raise UnavailableError, \"Timed out: #{_uri}\"\n rescue => e\n raise ClientError, \"Unable to open stream to #{_uri}: #{e.message}\"\n end\n\n response.body || raise(ClientError, \"No response received from stream: #{_uri}\")\n end",
"def make_request url, parameters={}, method=:get, settings={}\n raise 'not implemented'\n end",
"def send_request(url, data)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.port == 443\n http.use_ssl\t= true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n response = http.post(uri.path, data)\n response.code == '200' ? response.body : response.error!\n end",
"def send_to(provider_name, http_method='get')\n provider = get_provider(provider_name, @domain_front)\n @request = Net::HTTP.const_get(http_method.capitalize).new(\n @front_target.request_uri, provider[:headers]\n )\n @response = @http.request(@request)\n check_http(@response) # if response failed, give the user some suggestion\n rescue SocketError => e\n puts \"#{self.class}##{__method__}:\".error\n puts e.message\n rescue Net::ReadTimeout => e\n puts \"#{self.class}##{__method__}:\".error\n puts e.message\n puts \"Remote port is closed.\".error\n exit!\n rescue Exception => e\n puts \"#{self.class}##{__method__}:\".error\n puts e.full_message\n end",
"def send_request(batch)\n payload = batch.to_s\n request = Net::HTTP::Post.new(@path, @headers)\n\n if self.class.stub\n logger.debug \"stubbed request to #{@path}: \" \\\n \"batch = '#{batch}'\"\n\n [200, '', 'OK']\n else\n # If `start` is not called, Ruby adds a 'Connection: close' header to\n # all requests, preventing us from reusing a connection for multiple\n # HTTP requests\n @http.start unless @http.started?\n\n response = @http.request(request, payload)\n [response.code.to_i, response.body, response.message]\n end\n end",
"def request(http_method, path, body = '', headers = {})\n puts \"#{http_method}: #{path} - [#{body}]\" if @http_debug\n @request_client.request(http_method, path, body, headers)\n end",
"def perform_request(request_type)\n\t\t(return @error= \"Error: Doesn't seem to contain a valid RSS / Atom feed or its feed has no hub specified.\") unless @hub_url\n\t\tparams = {\n\t\t\t'hub.topic' => @feed_url,\n\t\t\t'hub.mode' => request_type,\n\t\t\t'hub.callback' => @callback_url,\n\t\t\t'hub.verify' => 'async'\n\t\t}\n\t\tsend_request(@hub_url, params)\n\tend",
"def request(*args)\n Request.new(self).request(*args)\n end",
"def send_request(request_obj)\n request(request_obj.method, request_obj.path, body: request_obj.body.to_json)\n end",
"def http *xs\n env.http *xs\n end",
"def send_request(params, payload=nil, content_type=nil)\n req_params = setup_request(params, payload, content_type)\n\n handled_request(req_params) do\n request = RestClient::Request.new(req_params)\n\n response = request.execute\n if ![200, 201, 202, 204].include?(response.code)\n @logger.warn \"Warning: unattended code #{response.code}\"\n end\n\n parsed_response = Nokogiri::XML(response)\n @logger.debug \"Send request result: #{parsed_response}\"\n\n [parsed_response, response.headers]\n end\n end",
"def send_request(handler_path, params={}, data=nil)\n params = map_params(params)\n @adapter.send_request(handler_path, params, data)\n end",
"def request(request)\n @socket.request(request)\n end",
"def send_request(opts)\n request = Net::HTTP::Post.new(opts[:uri], 'CONTENT-ENCODING' => opts[:encoding], 'HOST' => opts[:collector].name)\n request['user-agent'] = user_agent\n request.content_type = \"application/octet-stream\"\n request.body = opts[:data]\n\n response = nil\n http = http_connection\n http.read_timeout = nil\n NewRelic::TimerLib.timeout(@request_timeout) do\n ::NewRelic::Agent.logger.debug \"Sending request to #{opts[:collector]}#{opts[:uri]}\"\n response = http.request(request)\n end\n case response\n when Net::HTTPSuccess\n true # fall through\n when Net::HTTPUnauthorized\n raise LicenseException, 'Invalid license key, please visit support.newrelic.com'\n when Net::HTTPServiceUnavailable\n raise ServerConnectionException, \"Service unavailable (#{response.code}): #{response.message}\"\n when Net::HTTPGatewayTimeOut\n raise Timeout::Error, response.message\n when Net::HTTPRequestEntityTooLarge\n raise UnrecoverableServerException, '413 Request Entity Too Large'\n when Net::HTTPUnsupportedMediaType\n raise UnrecoverableServerException, '415 Unsupported Media Type'\n else\n raise ServerConnectionException, \"Unexpected response from server (#{response.code}): #{response.message}\"\n end\n response\n rescue Timeout::Error, EOFError, SystemCallError, SocketError => e\n # These include Errno connection errors, and all signify that the\n # connection may be in a bad state, so drop it and re-create if needed.\n close_shared_connection\n raise NewRelic::Agent::ServerConnectionException, \"Recoverable error connecting to #{@collector}: #{e}\"\n end",
"def requestor(req, json = nil)\n res = Net::HTTP.start(@host, @port, {:use_ssl => true}) { |http|\n create_the_request(req, json, http)\n }\n unless res.kind_of?(Net::HTTPSuccess)\n # let rails and sinatra handle this or print out if using ruby i say if, elsif, else\n handle_error(req, res)\n end\n res\n end",
"def send_request(req, t = -1)\n connect(t)\n conn.put(req.to_s)\n end",
"def request(*args)\n Request.request(self, *args)\n end",
"def send_request(url, req)\n begin\n Net::HTTP.start(url.host, url.port, :read_timeout => 180) {|http| http.request(req)}\n rescue Errno::ECONNREFUSED, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n puts e.to_s\n nil\n end\n end",
"def send_global_request(type, *extra, &callback); end",
"def send_request\n @response = _send_request\n end",
"def http(data, url, opts = {})\n method = opts[:method] || :post\n opts[:data] = data\n response = HTTParty.send(method, url, opts)\n unless (200..299).include?(response.code)\n raise HttpError.new(\"Bad response: #{response.code} #{response.body}\", response)\n end\n end",
"def perform_request(method,uri)\n url = BASE_URL + uri\n HTTParty.send(method,url)\n end",
"def send_request(body)\n status = false\n data = false\n code = \"\"\n\n Net::HTTP.start(\"#{@subdomain}.#{@options[:host]}\", 80) do |http|\n req = Net::HTTP::Post.new(@options[:pathname])\n\n req.content_type = 'application/atom+xml'\n req.content_length = body.size - 20 # Currently a bug with the Pomegranate API I believe\n req.body = body\n\n if authentication_set?\n req.ntlm_auth(@username, @options[:domain], @password)\n end\n\n response = http.request(req)\n\n code = response.code\n\n if code == \"201\"\n data = parse_xml(response.body)\n else\n break\n end\n end\n\n {:code => code, :data => data}\n end",
"def send_request\n setup_connection\n send_request_with_lazy_pirate unless error?\n end",
"def request_and_handle http_method, path, options\n if http_method.is_a?(String) || http_method.is_a?(Symbol)\n http_method = HTTP_METHODS[http_method.to_s]\n raise \"Unknown http method: #{http_method}\" unless http_method\n end\n \n req_options = default_options.dup\n req_options = req_options.merge(options)\n \n raise ConfigurationError.new \"No endpoint defined\" if !path || path.empty?\n raise ConfigurationError.new \"No hostname defined\" if !req_options[:base_uri] || req_options[:base_uri].empty?\n \n # prepare request\n req = HTTParty::Request.new http_method, path, req_options\n req.options[:timeout] = CityGrid.custom_timeout if req.options && CityGrid.custom_timeout_set?\n\n # Sanitized request for logs\n safe_req_options = strip_unsafe_params(http_method, req_options)\n req_to_output = HTTParty::Request.new http_method, path, safe_req_options\n req_for_airbrake = { :method => http_method, :path => path, :options => safe_req_options }\n\n begin\n response = req.perform\n rescue => ex \n if defined?(Rails.logger)\n Rails.logger.error safe_req_options\n Rails.logger.error req_to_output\n Rails.logger.error req_for_airbrake\n Rails.logger.error ex\n end\n raise CityGridExceptions::RequestError.new req_for_airbrake, nil, ex.message, req_to_output.to_curl\n ensure\n if CityGrid.print_curls? \n if defined?(Rails.logger)\n Rails.logger.info req_to_output.to_curl\n puts req_to_output.to_curl\n else\n puts req_to_output.to_curl\n end\n end\n end\n\n response_status = parse_response_status response\n \n begin \n # catch unparsable responses (html etc)\n if !response.parsed_response.is_a?(Hash)\n #pp \"[gem] the response was unparsable (response was not a hash)\"\n raise CityGridExceptions::ResponseParseError.new req_for_airbrake, response, \"the response was unparsable (response was not a hash)\", req_to_output.to_curl\n else\n # Parse and handle new response codes \n if !response_status.nil? && response_status[\"code\"] != \"SUCCESS\" && response_status[\"code\"] != 200\n raise CityGridExceptions.appropriate_error(response_status[\"code\"]).new req_for_airbrake, response, response_status[\"message\"].to_s, req_to_output.to_curl\n else\n return CityGrid::API::Response.new response\n end\n end\n rescue => ex\n pp \"API ERROR: #{ex}\"\n raise ex if CityGrid.raise_errors?\n end\n end",
"def run_request(method, url, body, headers)\n original_run_request(method, url, \"\", headers)\n end",
"def send(data: {}, headers: {})\n `#@native.open(#{method}, #{url})`\n @data = data\n self.headers = headers\n\n if method == :get || method == :delete\n `#@native.send()`\n elsif Hash === data\n `#@native.send(#{JSON.generate data})`\n elsif `!!data['native']`\n `#@native.send(data['native'])`\n else\n `#@native.send(data)`\n end\n\n self\n end",
"def make_request\n response = @http.request(@request)\n end",
"def send_request method, params = {}\n uri = URI.parse(@api_url)\n if Time.now.to_i > @exp + 3600\n get_acces_token\n @exp = Time.now.to_i\n end\n required = { 'access_token' => @access_token, 'method' => method }\n params = required.merge(params)\n params = URI.escape(params.collect{ |k,v| \"#{k}=#{v}\"}.join('&'))\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.request_uri)\n req['User-Agent'] = \"zhzhussupovkz pleer.com-ruby-api\"\n req.body = params\n res = http.request(req)\n if res.code == \"200\"\n data = res.body\n result = JSON.parse(data)\n else\n puts \"Invalid getting data from server\"\n exit\n end\n end",
"def make_http_request( url, options, auth_info = {} )\n try_count = 0\n \n begin\n request = Net::HTTP::Post.new(url.path)\n request.basic_auth auth_info[:hapi_username], auth_info[:hapi_password] unless auth_info.empty?\n request.set_form_data(options)\n request.add_field('User-Agent', USER_AGENT)\n \n http = Net_HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.request(request)\n rescue Errno::ECONNREFUSED\n if try_count < 2\n try_count += 1\n sleep 1\n retry\n else\n raise Backend, \"Connection refused trying to contact hAPI at #{@hapi_hostname}\"\n end\n end\n end",
"def request url, klass, object\n url = URI url\n\n request = klass.new url.path\n\n if object\n request.body = object.to_xml\n end\n\n dispatch request, to: url\n end",
"def http; end",
"def request(type, url, params = {})\n request = Request.new(type, url, params)\n make_request(request)\n\n update_history(request)\n end",
"def request(method)\n unless ::HTTP::Request::METHODS.include? method\n raise NotSupportedError, \"http.rb does not support custom HTTP methods\"\n end\n response = begin\n @client.send(method, @request.url, :body => @request.body)\n rescue OpenSSL::SSL::SSLError\n raise SSLError\n end\n\n Response.new(response.code, response.headers.to_h, response.body.to_s)\n end",
"def request(action, url, headers, options = {})\n # If the Expect header isn't set uploads are really slow\n headers['Expect'] ||= ''\n\n req = Request.new\n req.action = action\n req.timeout = self.timeout\n req.connect_timeout = self.connect_timeout\n req.max_redirects = self.max_redirects\n req.headers = self.headers.merge(headers)\n req.username = self.username\n req.password = self.password\n req.upload_data = options[:data]\n req.file_name = options[:file]\n req.proxy = proxy\n req.auth_type = auth_type\n req.insecure = insecure\n\n req.url = self.base_url.to_s + url.to_s\n raise ArgumentError, \"Empty URL\" if req.url.empty?\n\n handle_request(req)\n end",
"def request(type)\n request = case type\n when :wsdl then Net::HTTP::Get.new @endpoint.request_uri\n when :soap then Net::HTTP::Post.new @soap.endpoint.request_uri, soap_headers.merge(headers)\n end\n\n request.basic_auth(*@basic_auth) if @basic_auth\n yield request if block_given?\n request\n end",
"def request(req)\n self.class.paths << req.path\n self.class.params << req.body\n response = self.class.responses.shift\n if response.respond_to? :call then\n response.call req\n else\n res = Net::HTTPResponse.new '1.0', 200, 'OK'\n res.body = response\n res\n end\n end",
"def request(method, path, params)\n self.class.send(method, path, params)\n end",
"def _http_request(method, url, *args)\n request_args = get_hash_args(*args)\n url = get_url url unless url.to_s.start_with?('http://')\n request_args[:header] = @head\n request_args[:body] = \\\n JSON.dump(request_args[:body]) if request_args[:body]\n\n res = @http_session.request(method, url, request_args)\n status = res.status\n raise HTTPError, 'HTTPError: %s %s'\\\n % [status, (JSON.load(res.content)['message'] rescue res.reason)]\\\n if status >= 400 && status < 600\n res\n end",
"def run(url, headers, req_type, data = nil, sql = false)\n begin\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.port.to_s == \"443\"\n http.use_ssl = true\n end\n http.read_timeout = @timeout\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n requester = nil\n parsed_data = data\n\n if !sql \n parsed_data = data.to_json\n end\n\n if req_type == \"post\"\n requester = Net::HTTP::Post.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"put\"\n requester = Net::HTTP::Put.new(uri.request_uri, initheader = headers)\n requester.body = parsed_data\n elsif req_type == \"get\"\n requester = Net::HTTP::Get.new(uri.request_uri, initheader = headers)\n elsif req_type == \"delete\"\n requester = Net::HTTP::Delete.new(uri.request_uri, initheader = headers)\n end\n http.request(requester)\n rescue Timeout::Error, Errno::EINVAL,\n Errno::ECONNRESET, EOFError, Net::HTTPBadResponse,\n Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n raise e\n end\n end",
"def send_request(request) # :nodoc:\n response = @http.request(request)\n validate_response(response)\n JSON.parse(response.body)\n end",
"def http\n HTTP .headers(accept: \"application/json\")\n # .via(\"127.0.0.1\", 8888)\n end",
"def send_request(request)\n\n factory_hash = request.to_hash\n @request.body = factory_hash.to_json\n\n # send request\n response = @http.request(@request)\n http_response = HttpResponse.new(response)\n\n parser = InjectionResponseParser.new\n parser.parse(http_response)\n\n end",
"def send_request(url, data=nil)\n begin\n puts \"BigBlueButtonAPI: URL request = #{url}\" if @debug\n url_parsed = URI.parse(url)\n http = Net::HTTP.new(url_parsed.host, url_parsed.port)\n http.open_timeout = @timeout\n http.read_timeout = @timeout\n if data.nil?\n response = http.get(url_parsed.request_uri, @request_headers)\n else\n puts \"BigBlueButtonAPI: Sending as a POST request with data.size = #{data.size}\" if @debug\n opts = { 'Content-Type' => 'text/xml' }.merge @request_headers\n response = http.post(url_parsed.request_uri, data, opts)\n end\n puts \"BigBlueButtonAPI: URL response = #{response.body}\" if @debug\n\n rescue TimeoutError => error\n raise BigBlueButtonException.new(\"Timeout error. Your server is probably down: \\\"#{@url}\\\". Error: #{error}\")\n\n rescue Exception => error\n raise BigBlueButtonException.new(\"Connection error. Your URL is probably incorrect: \\\"#{@url}\\\". Error: #{error}\")\n end\n\n response\n end",
"def do_request(request, response)\n body = make_request(request)\n\n # Always 200. A simplification, but fine for user\n # error messages.\n response.status = 200\n response['Content-Type'] = 'text/html' \n response.body = body\n end",
"def create_http_request(http_method, path, *arguments)\n http_method = http_method.to_sym\n\n if [:post, :put, :patch].include?(http_method)\n data = arguments.shift\n end\n\n # if the base site contains a path, add it now\n uri = URI.parse(site)\n path = uri.path + path if uri.path && uri.path != '/'\n\n headers = arguments.first.is_a?(Hash) ? arguments.shift : {}\n\n case http_method\n when :post\n request = Net::HTTP::Post.new(path,headers)\n request[\"Content-Length\"] = '0' # Default to 0\n when :put\n request = Net::HTTP::Put.new(path,headers)\n request[\"Content-Length\"] = '0' # Default to 0\n when :patch\n request = Net::HTTP::Patch.new(path,headers)\n request[\"Content-Length\"] = '0' # Default to 0\n when :get\n request = Net::HTTP::Get.new(path,headers)\n when :delete\n request = Net::HTTP::Delete.new(path,headers)\n when :head\n request = Net::HTTP::Head.new(path,headers)\n else\n raise ArgumentError, \"Don't know how to handle http_method: :#{http_method.to_s}\"\n end\n\n if data.is_a?(Hash)\n request.body = OAuth::Helper.normalize(data)\n request.content_type = 'application/x-www-form-urlencoded'\n elsif data\n if data.respond_to?(:read)\n request.body_stream = data\n if data.respond_to?(:length)\n request[\"Content-Length\"] = data.length.to_s\n elsif data.respond_to?(:stat) && data.stat.respond_to?(:size)\n request[\"Content-Length\"] = data.stat.size.to_s\n else\n raise ArgumentError, \"Don't know how to send a body_stream that doesn't respond to .length or .stat.size\"\n end\n else\n request.body = data.to_s\n request[\"Content-Length\"] = request.body.length.to_s\n end\n end\n\n request\n end",
"def send_request(params, payload = nil, content_type = nil)\n # Create a new HTTP client\n clnt = HTTPClient.new\n\n extheader = {}\n extheader['accept'] = \"application/json\"\n extheader['Content-Type'] = content_type unless content_type.nil?\n\n url = \"#{@endpoint}#{params['command']}\"\n\n @logger.debug(\"[#{Time.now.ctime}] -> SEND #{params['method'].upcase} #{url}\")\n if payload\n @logger.debug('SEND HEADERS')\n @logger.debug(extheader)\n @logger.debug('SEND BODY')\n @logger.debug(payload)\n end\n\n begin\n response = clnt.request(\n params['method'],\n url,\n nil,\n payload,\n extheader\n )\n\n @logger.debug(\"[#{Time.now.ctime}] <- RECV #{response.status}\")\n @logger.debug('RECV HEADERS')\n @logger.debug(response.headers)\n @logger.debug('RECV BODY') if response.body.length > 0\n @logger.debug(response.body) if response.body.length > 0\n\n unless response.ok?\n error_response = JSON.parse(response.body)\n fail Errors::UnattendedCodeError,\n :message => \"#{error_response['code']}: #{error_response['message']}\"\n end\n\n if response.body.length > 0\n [JSON.parse(response.body), response.headers]\n else\n ['', response.headers]\n end\n rescue SocketError, Errno::EADDRNOTAVAIL, Errno::ETIMEDOUT, Errno::ECONNREFUSED\n raise Errors::EndpointUnavailable\n end\n end",
"def request_over_http(options, http_method, endpoint)\n if http_method == :get\n api_call = endpoint + \"?\" + options.collect{|k,v| \"#{k}=#{CGI.escape(v.to_s)}\"}.join('&')\n URI.parse(api_call).read\n else\n Net::HTTP.post_form(URI.parse(endpoint), options).body\n end\n end",
"def send_request(request)\n connect\n @handler.enqueue_request(request)\n end",
"def send_request *args, &block\n raise \"A block MUST be given on send_request.\" unless block_given?\n if args.length == 1 && args.first.kind_of?( Rpc::Request )\n _send_request args.first, &block\n elsif args.length == 1 && args.first.kind_of?( Hash )\n h = args.first\n send_request( h[\"method\"], h[\"params\"], h[\"id\"], &block )\n elsif args.length.between?(2, 3)\n _send_request Rpc::Request.new(self, *args), &block\n else\n raise Rpc::ServerError(-1, extra_msg: \"in Rpc::Connection.send_request : Wrong number of argument.\", args: args)\n end\n end",
"def request(method, path, params)\n params ||= {}\n uri = full_url(path)\n\n Trubl.logger.info(\"Trubl::Client #{method}-ing #{uri} with params #{params.merge(headers: headers)}\")\n response = HTTMultiParty.send(method, uri, params.merge(headers: headers))\n\n if !response.code =~ /20[0-9]/\n Trubl.logger.fatal(\"Trubl::Client #{response.code} #{method}-ing #{uri.to_s} #{response.parsed_response}\")\n else\n Trubl.logger.debug(\"Trubl::Client #{uri} response: #{response.body}\")\n end\n response.body.force_encoding(\"utf-8\") if response.body and response.body.respond_to?(:force_encoding)\n response\n end"
] |
[
"0.7258315",
"0.71943676",
"0.6980587",
"0.697773",
"0.6949544",
"0.67918146",
"0.655976",
"0.6523057",
"0.65212035",
"0.6504348",
"0.6470678",
"0.6458559",
"0.6436096",
"0.6427744",
"0.638929",
"0.6314951",
"0.63052225",
"0.6300841",
"0.6286664",
"0.6226868",
"0.6225718",
"0.622154",
"0.621672",
"0.62078136",
"0.62038404",
"0.6197003",
"0.6197003",
"0.6173534",
"0.61638576",
"0.6155408",
"0.6152512",
"0.6152031",
"0.61496234",
"0.61478007",
"0.6147317",
"0.6139585",
"0.6133004",
"0.6132172",
"0.6131521",
"0.61247677",
"0.61206466",
"0.6116831",
"0.6116831",
"0.6116831",
"0.6114295",
"0.61141753",
"0.6100865",
"0.609194",
"0.6080248",
"0.6071174",
"0.6066657",
"0.60611063",
"0.60544",
"0.60465723",
"0.6022708",
"0.6018039",
"0.60148704",
"0.5997764",
"0.59950924",
"0.59813935",
"0.59774107",
"0.5973028",
"0.597179",
"0.5970586",
"0.59671587",
"0.5957349",
"0.5953848",
"0.595236",
"0.59380615",
"0.5933771",
"0.59187686",
"0.59089637",
"0.5908572",
"0.58815926",
"0.5878241",
"0.5870535",
"0.5869513",
"0.5863208",
"0.58561796",
"0.5855378",
"0.58542717",
"0.5851086",
"0.58404243",
"0.5839883",
"0.5833048",
"0.5831317",
"0.5827722",
"0.5827133",
"0.5820391",
"0.5819144",
"0.5815411",
"0.5806361",
"0.5799473",
"0.57983154",
"0.57982314",
"0.57974535",
"0.5796942",
"0.5784548",
"0.5783779",
"0.5782463",
"0.5780478"
] |
0.0
|
-1
|
We cannot mark as archived the section_texts directly, as they may be used by other documents
|
def archive!
self.update(archived: true)
NotificationMailer.new(self).document_toggle_archive
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def render_archives_texts(documents)\n\n val = ''\n documents.each do |doc|\n archives = {\n \"RT\" => \"Archives or Manuscripts\",\n \"A1\" => doc['author_display'].present? ? doc['author_display'][0].to_s : doc['author_display'].to_s,\n \"JF\"=> doc['found_in_labels_ss'].to_s,\n \"VO\"=> doc['container_display'].present? ? doc['container_display'][0].to_s : doc['container_display'].to_s, #Volume container\n \"T1\"=> doc['title_display'].present? ? doc['title_display'][0].to_s : doc['title_display'].to_s,\n \"UL\"=> \"https://archives.yale.edu/#{doc['archive_space_uri_s'].to_s}\",\n \"RD\"=> Date.today\n }\n archives.each {|key|\n j_value = key[1].kind_of?(Array)? key[1][0].to_s : key[1].to_s\n val << \"#{key[0].to_s} #{j_value}\\n\" }\n val << \"\\n\"\n end\n val\n end",
"def archive(section = Doing.setting('current_section'), options)\n options ||= {}\n count = options[:keep] || 0\n destination = options[:destination] || 'Archive'\n tags = options[:tags] || []\n bool = options[:bool] || :and\n\n section = section[0] if section.is_a?(Array) && section.count == 1\n section = choose_section if section.nil? || section.empty? || section.is_a?(String) && section =~ /choose/i\n archive_all = section =~ /^all$/i # && !(tags.nil? || tags.empty?)\n section = guess_section(section) unless archive_all\n\n @content.add_section(destination, log: true)\n # add_section(Section.new('Archive')) if destination =~ /^archive$/i && !@content.section?('Archive')\n\n destination = guess_section(destination)\n\n if @content.section?(destination) && (@content.section?(section) || archive_all)\n do_archive(section, destination, { count: count, tags: tags, bool: bool, search: options[:search], label: options[:label], before: options[:before], after: options[:after], from: options[:from] })\n write(doing_file)\n else\n raise InvalidArgument, 'Either source or destination does not exist'\n end\n end",
"def new_subsection_text(revision_subsection) \n if @array_of_new_subsections[revision_subsection.id] == 'added'\n subsection_text_show(revision_subsection, 'added') \n end\n end",
"def import_text_content\n self.text_content = self.to_text\n self.save\n\n # Reindex to elasticsearch\n self.reindex\n end",
"def process_section(section, content)\n bindings = {\n :section => section,\n :name => @definition.get_name,\n :version => @definition.get_version,\n :description => content,\n }\n page = Calamum::DocGenerator.new(:section)\n page.save_template(\"#{section}.html\", bindings)\n end",
"def add_language_sections_to_article(l, a)\n l.each do |language|\n sec_title = \"#{a.article_title} for (#{language})\"\n sec_body = \"Section text body for the #{language} language....\"\n # Check for not adding a duplicate\n if Section.find_by(article_id: a.id, section_title: sec_title, section_body: sec_body).nil?\n a.sections.create({\n :section_title => sec_title, \n :section_body => sec_body})\n end\n end \n # binding.pry\n end",
"def update_tags!(filter_boxes)\n sections_with_content.each do |s|\n section = s['mampf_section']\n content_in_section(s).each do |c|\n # if tag for content already exists, add tag to the section and course\n if c['tag_id']\n tag = Tag.find_by_id(c['tag_id'])\n next unless tag\n next unless section\n next if section.in?(tag.sections)\n tag.sections |= [section]\n tag.courses |= [@lecture.course]\n next\n end\n next unless filter_boxes[c['counter']].second\n # if checkbox for tag creation is checked, create the tag,\n # associate it with course and section\n tag = Tag.new(courses: [@lecture.course],\n sections: [section])\n tag.notions.new(title: c['description'],\n locale: @lecture.locale || I18n.default_locale)\n tag.save\n end\n end\n end",
"def _section_fields\n {\n 'article' => ['r:Title', 'o:Author', 'o:DOI'],\n 'journal' => ['r:Title', 'o:ISSN', 'r:Volume', 'o:Issue', 'r:Year', 'r:Pages'],\n 'host' => ['o:Title', 'o:ISSN or ISBN', 'o:Volume', 'o:Issue', 'r:Year', 'o:Pages'],\n 'auto-cancel' => ['o:Automatic cancellation'],\n 'notes' => ['o:Notes'],\n 'conference' => ['r:Title', 'o:Location', 'r:Year', 'o:ISSN or ISBN', 'r:Pages'],\n 'book' => ['r:Title', 'o:Author', 'o:Edition', 'o:DOI', 'o:ISBN', 'r:Year', 'o:Publisher'],\n 'thesis' => ['r:Title', 'r:Author', 'o:Affiliation', 'o:Publisher', 'o:Type', 'r:Year', 'o:Pages'],\n 'report' => ['r:Title', 'o:Author', 'o:Publisher', 'o:DOI', 'o:Report Number'],\n 'standard' => ['r:Title', 'o:Subtitle', 'o:Publisher', 'o:DOI', 'o:Standard Number', 'o:ISBN', 'r:Year', 'o:Pages'],\n 'patent' => ['r:Title', 'o:Inventor', 'o:Patent Number', 'r:Year', 'o:Country'],\n 'other' => ['r:Title', 'o:Author', 'o:Publisher', 'o:DOI']\n }\nend",
"def process_sections\n @tag_selection.attributes = {'section_ids' => []}.merge(params[:tag_selection] || {})\n end",
"def store\n @files.each do |file, lines|\n text = \"\"\n dirty = false\n lines.each do |l|\n if l.is_a?(Section)\n dirty ||= l.dirty?\n text << l.format\n l.mark_clean\n else\n text << l\n end\n end\n if dirty\n Puppet::Util::FileType.filetype(:flat).new(file).write(text)\n return file\n end\n end\n end",
"def texts=(texts); end",
"def texts=(texts); end",
"def render_archives_endnote_texts(documents)\n val = ''\n documents.each do |doc|\n archives_endnote = {\n \"%0\" => \"Archives or Manuscripts\",\n \"%A\" => doc['author_display'].present? ? doc['author_display'][0].to_s : doc['author_display'].to_s,\n \"%I\"=> doc['found_in_labels_ss'].to_s,\n \"%V\"=> doc['container_display'].present? ? doc['container_display'][0].to_s : doc['container_display'].to_s, #Volume container\n \"%T\"=> doc['title_display'].present? ? doc['title_display'][0].to_s : doc['title_display'].to_s,\n \"%U\"=> \"https://archives.yale.edu/#{doc['archive_space_uri_s'].to_s}\",\n \"%O\"=> Date.today\n }\n archives_endnote.each {|key|\n j_value = key[1].kind_of?(Array)? key[1][0].to_s : key[1].to_s\n val << \"#{key[0].to_s} #{j_value}\\n\" }\n val << \"\\n\"\n end\n val\n end",
"def do_archive(section, destination, opt)\n opt ||= {}\n count = opt[:count] || 0\n tags = opt[:tags] || []\n bool = opt[:bool] || :and\n label = opt[:label]\n\n section = guess_section(section)\n destination = guess_section(destination)\n\n section_items = @content.in_section(section)\n max = section_items.count - count.to_i\n\n opt[:after] = opt[:from][0] if opt[:from]\n opt[:before] = opt[:from][1] if opt[:from]\n\n time_rx = /^(\\d{1,2}+(:\\d{1,2}+)?( *(am|pm))?|midnight|noon)$/\n\n if opt[:before].is_a?(String) && opt[:before] =~ time_rx\n opt[:before] = opt[:before].chronify(guess: :end, future: false)\n end\n\n if opt[:after].is_a?(String) && opt[:after] =~ time_rx\n opt[:after] = opt[:after].chronify(guess: :begin, future: false)\n end\n\n counter = 0\n\n @content.map do |item|\n break if counter >= max\n\n next if item.section.downcase == destination.downcase\n\n next if item.section.downcase != section.downcase && section != /^all$/i\n\n next if (opt[:before] && item.date > opt[:before]) || (opt[:after] && item.date < opt[:after])\n\n next if (!tags.empty? && !item.tags?(tags, bool)) || (opt[:search] && !item.search(opt[:search].to_s))\n\n counter += 1\n old_item = item.clone\n item.move_to(destination, label: label, log: false)\n Hooks.trigger :post_entry_updated, self, item, old_item\n item\n end\n\n if counter.positive?\n logger.count(destination == 'Archive' ? :archived : :moved,\n level: :info,\n count: counter,\n message: \"%count %items from #{section} to #{destination}\")\n else\n logger.info('Skipped:', 'No items were moved')\n end\n end",
"def render_archives_ris_texts(documents)\n val = ''\n documents.each do |doc|\n archives = {\n \"TY\" => \"Archives or Manuscripts\",\n \"AU\" => doc['author_display'].present? ? doc['author_display'][0].to_s : doc['author_display'].to_s,\n \"PB\"=> doc['found_in_labels_ss'].to_s,\n \"VL\"=> doc['container_display'].present? ? doc['container_display'][0].to_s : doc['container_display'].to_s, #Volume container\n \"T1\"=> doc['title_display'].present? ? doc['title_display'][0].to_s : doc['title_display'].to_s,\n \"UR\"=> \"https://archives.yale.edu/#{doc['archive_space_uri_s'].to_s}\",\n \"Y2\"=> Date.today\n }\n archives.each {|key|\n j_value = key[1].kind_of?(Array)? key[1][0].to_s : key[1].to_s\n val << \"#{key[0].to_s} - #{j_value}\\n\" }\n val << \"\\n\"\n end\n val\n end",
"def text\n self.text = {\n \"processed\": processed,\n \"cleaned\": cleaned\n }\n end",
"def rotate(opt)\n opt ||= {}\n keep = opt[:keep] || 0\n tags = []\n tags.concat(opt[:tag].split(/ *, */).map { |t| t.sub(/^@/, '').strip }) if opt[:tag]\n bool = opt[:bool] || :and\n\n sect = opt[:section] !~ /^all$/i ? guess_section(opt[:section]) : 'all'\n\n section = guess_section(sect)\n\n section_items = @content.in_section(section)\n max = section_items.count - keep.to_i\n\n counter = 0\n new_content = Items.new\n\n section_items.each do |item|\n break if counter >= max\n if opt[:before]\n time_string = opt[:before]\n cutoff = time_string.chronify(guess: :begin)\n end\n\n unless ((!tags.empty? && !item.tags?(tags, bool)) || (opt[:search] && !item.search(opt[:search].to_s)) || (opt[:before] && item.date >= cutoff))\n new_item = @content.delete(item)\n Hooks.trigger :post_entry_removed, self, item.clone\n raise DoingRuntimeError, \"Error deleting item: #{item}\" if new_item.nil?\n\n new_content.add_section(new_item.section, log: false)\n new_content.push(new_item)\n counter += 1\n end\n end\n\n if counter.positive?\n logger.count(:rotated,\n level: :info,\n count: counter,\n message: \"Rotated %count %items\")\n else\n logger.info('Skipped:', 'No items were rotated')\n end\n\n write(@doing_file)\n\n file = @doing_file.sub(/(\\.\\w+)$/, \"_#{Time.now.strftime('%Y-%m-%d')}\\\\1\")\n if File.exist?(file)\n init_doing_file(file)\n @content.concat(new_content).uniq!\n logger.warn('File update:', \"added entries to existing file: #{file}\")\n else\n @content = new_content\n logger.warn('File update:', \"created new file: #{file}\")\n end\n\n write(file, backup: false)\n end",
"def export_as_apa_citation_txt\n return '' unless to_marc\n super\n end",
"def collapse_document(doc); end",
"def do_inproceedings\n @lines.each {|l| l.sub!(/journal =/, \"booktitle =\") }\n end",
"def compress_version_text\n self.text = changes[\"text\"].last if changes[\"text\"]\n self.text ||= self.journaled.text if self.journaled.text\n end",
"def select_fulltext(editions)\n editions.select do |ed|\n ! ed['ocaid'].blank?\n end\n end",
"def addsection(text, title, minor = false, bot = true)\n #require login\n @site.login\n result = @site.query_prop_info(@normtitle, nil, 'edit') \n token = result['query']['pages']['page']['edittoken']\n result = @site.edit(@normtitle, section, text, token, title, minor, nil, bot) \n if result.key?('error')\n raise RbmediawikiError, \"#{title}: \"+result['error']['code']\n else\n return true\n end\n end",
"def master_text_changed(master_text)\n master_text.localized_texts.where(needs_entry: false).update_all(needs_review: true)\n end",
"def completed_text_extraction\n @found_completed_text_extraction = true\n end",
"def process_section(section_name, doc)\n entries = doc.xpath(@sections[section_name])\n if(entries.size == 0)\n return\n end\n @ccr_hash[section_name] = []\n entries.each do | e |\n entry = QME::Importer::Entry.new\n process_codes(e, entry)\n @ccr_hash[section_name] << entry\n end\n end",
"def non_localized_contents\n @non_localized_contents ||= begin\n # grab the content that belongs directly to the page\n contents_data = Gluttonberg::Content.non_localized_associations.inject([]) do |memo, assoc|\n memo += page.send(assoc).all\n end\n contents_data = contents_data.sort{|a,b| a.section_position <=> b.section_position}\n end\n @non_localized_contents\n end",
"def tt_sections text\n flow = @am.flow text.dup\n\n flow.each do |item|\n case item\n when String then\n @res << item if in_tt?\n when RDoc::Markup::AttrChanger then\n off_tags res, item\n on_tags res, item\n when RDoc::Markup::RegexpHandling then\n @res << convert_regexp_handling(item) if in_tt? # TODO can this happen?\n else\n raise \"Unknown flow element: #{item.inspect}\"\n end\n end\n\n res\n end",
"def upload_text_assets(pages, access)\n asset_store.save_full_text(self, access)\n pages.each do |page|\n asset_store.save_page_text(self, page.page_number, page.text, access)\n end\n end",
"def build_book_all_in_one_old_code_remove\r\n\r\nbook_text = <<EOS\r\n---\r\nlayout: book\r\ntitle: Contents\r\npermalink: /book.html\r\n---\r\n\r\nEOS\r\n\r\nbook_text += render_toc( inline: true )\r\n\r\n\r\n### generate pages for countries\r\n# note: use same order as table of contents\r\n\r\ncountry_count=0\r\n\r\nContinent.all.each do |continent|\r\n continent.countries.order(:title).each do |country|\r\n\r\n beers_count = country.beers.count\r\n breweries_count = country.breweries.count\r\n next if beers_count == 0 && breweries_count == 0\r\n \r\n country_count += 1\r\n puts \"build country page #{country.key}...\"\r\n country_text = render_country( country )\r\n\r\n book_text += <<EOS\r\n\r\n---------------------------------------\r\n\r\nEOS\r\n\r\n book_text += country_text\r\n end\r\nend\r\n\r\n\r\nFile.open( '_pages/book.md', 'w+') do |file|\r\n file.write book_text\r\nend\r\n\r\nend",
"def completed_text_extraction\n end",
"def find_subtitle_misalignments_between_qotd_and_content_at(date_code, posting_date_time, qotd_txt, content_at_txt, collector)\n end",
"def render_section(section)\n if section.layout == :column\n table_data = [ section.contents.map {|content| content.text if content.class == PDFBook::Content::Text} ]\n # debugger\n @pdf.table(table_data, width: @pdf.bounds.width, cell_style: { borders: []})\n @pdf.move_down 20\n else\n section.contents.each do |content|\n case content\n when PDFBook::Content::Text\n @pdf.text content.text\n @pdf.move_down 20\n end\n end\n end\n end",
"def section_preparation_finished\n end",
"def archive_content(by:)\n @letter = letter.generate_archive(by: by)\n letter.save!\n end",
"def reserve_format\n return unless @text && @content\n\n @text.wiki_format = @content.text.wiki_format\n Pwfmt::Context.reserve_format('content_text', @text)\n end",
"def section_by_id(section_id); end",
"def is_text_in_section?(section, content, flag=true)\n within(\"#{section}\") do\n if flag\n assert page.has_content?(\"#{content}\"), \"Error: #{content} not found in #{section} !\"\n else\n assert !page.has_content?(\"#{content}\"), \"Error: #{content} found in #{section} !\"\n end\n end\n end",
"def archive\n delete_content\n filename = 'archive.' + $el.file_name_nondirectory(buffer_file_name)\n timestamp = \"--- archived on #{Time.now.strftime('%Y-%m-%d at %H:%M')} --- \\n\"\n $el.append_to_file timestamp, nil, filename\n $el.append_to_file content, nil, filename\n end",
"def finish_preparations\n munge\n @document.attributes['alternative_language_counter'] = @counter + 1\n @listing_text = @listing.convert\n @colist_text = @colist&.convert\n end",
"def text_content\n body = doc.css(\"body\")\n text_table = body.css(\".grf-indent > div:nth-child(1)\")[0]\n if text_table.present?\n remove_metadata(text_table)\n remove_creator(text_table)\n text_table.inner_html\n end\n end",
"def delete(s)\n \n key = @sections.keys.grep(/#{s.downcase}/i).first\n old_value = @sections[key].flatten.join\n heading = last_heading(key)\n old_section = heading + old_value\n \n @s.sub!(old_section, '') \n load_sections(@s) \n save()\n \n :deleted\n end",
"def archive\n delete_content\n filename = 'archive.' + $el.file_name_nondirectory(buffer_file_name)\n timestamp = \"--- archived on #{Time.now.strftime('%Y-%m-%d at %H:%M')} --- \\n\"\n append_to_file timestamp, nil, filename\n append_to_file content, nil, filename\n end",
"def toc_text text\n toc.push(:item => self, :text => text, :id => nil)\n self\n end",
"def extract_text\n # check if we have a filter\n return if FILTERS[self.content_type].nil?\n\n # Create temporary working directory directory\n FileUtils.mkdir_p(File.join(RAILS_ROOT, 'tmp', 'documents'))\n\n # Find path to convert script\n convert_script = File.join(RAILS_ROOT, 'script', FILTERS[self.content_type])\n\n # Get paths to temp in/out file\n temp_file_in = self.create_temp_file.path\n temp_file_out = File.join(RAILS_ROOT, 'tmp', 'documents',\"#{self.id}.txt\")\n\n # Convert\n if system \"#{convert_script} #{temp_file_in} #{temp_file_out}\"\n self.content = File.read(temp_file_out)\n File.unlink(temp_file_out)\n else\n self.content = \"NO CONTENT\"\n end\n self.save\n end",
"def store_article_text(entry)\n puts \"storing data\"\n if(entry.link != '#')\n \n # Get html from link\n response = Net::HTTP.get(URI.parse(entry.link))\n if(response.downcase.include?(\"<h1>moved permanently</h1>\"))\n html = Nokogiri::HTML(response, nil, 'UTF-8')\n tag = html.css(\"a\")\n link = tag.attribute('href')\n response = Net::HTTP.get(URI.parse(link))\n end\n \n # Use readability to find text from html\n data = Readability::Document.new(response || \"\")\n if(data.content == nil || data.content.length < 15)\n new_data = entry.description\n else\n new_data = data.content.gsub(/<[^>]+>/,\"\").squeeze(\" \").strip.toutf8 || \"\"\n end\n \n else\n new_data = entry.description\n end\n \n # Save data if new\n if(!entry.data || entry.data != new_data)\n entry.data = new_data\n return true\n end\n return false\nend",
"def export_as_refworks_marc_txt\n return '' unless to_marc\n super\n end",
"def processSection2(section)\n string = '';\n text = section.inner_html\n text = text.delete('<p>').strip().delete('\\/').delete(','); #clean up string\n string += ',';\n string += text;\n return string;\nend",
"def section_contents\n used_sections = {}\n\n each_method do |method|\n next unless method.display?\n\n used_sections[method.section] = true\n end\n\n # order found sections\n sections = sort_sections.select do |section|\n used_sections[section]\n end\n\n # only the default section is used\n return [] if\n sections.length == 1 and not sections.first.title\n\n sections\n end",
"def deco_textilizable(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n case args.size\n when 1\n obj = options[:object]\n text = args.shift\n when 2\n obj = args.shift\n attr = args.shift\n text = obj.send(attr).to_s\n else\n raise ArgumentError, 'invalid arguments to textilizable'\n end\n return '' if text.blank?\n project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil)\n only_path = options.delete(:only_path) == false ? false : true\n\n text = text.dup\n\n ####add custom\n tmp_text = deco_block_textile_quotes(text)\n if(tmp_text) then\n text = tmp_text\n else\n text = text.dup\n end\n ####\n\n macros = catch_macros(text)\n text = Redmine::WikiFormatting.to_html(Setting.text_formatting, text, :object => obj, :attribute => attr)\n\n @parsed_headings = []\n @heading_anchors = {}\n @current_section = 0 if options[:edit_section_links]\n\n parse_sections(text, project, obj, attr, only_path, options)\n text = parse_non_pre_blocks(text, obj, macros) do |text|\n [:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links].each do |method_name|\n send method_name, text, project, obj, attr, only_path, options\n end\n end\n parse_headings(text, project, obj, attr, only_path, options)\n\n if @parsed_headings.any?\n replace_toc(text, @parsed_headings)\n end\n\n text.html_safe\n end",
"def tex_cleanup\n puts ' cleanup obsolete stuff in LaTeX'\n document.content.gsub! /\\\\textbackslash\\{}printbibliography/, '\\printbibliography'\n document.content.gsub! /\\\\textbackslash\\{}cite\\\\\\{(.*?)\\\\}/, '\\cite{\\1}'\n\n puts ' increase heading levels'\n # for the annual report the level of headings of the project reports need to be increased\n # a) headings within a project need to be named paragraphs\n document.content.gsub! /\\\\subsection{(.*)}\\\\label/, '\\subsubsection{\\1}~\\\\\\label'\n # b) project titles need to be two levels down\n document.content.gsub! /\\\\section{(.*)}\\\\label/, '\\subsection{\\1}\\label' # TODO: do we need that here?\n\n # to fix multiple occurrences of labels in the aggregated report, we prepend each label with\n # the project's slug\n document.content.gsub! /\\\\label{([\\w-]*)}/, \"\\\\label{#{document.data['slug']}-\\\\1}\"\n\n # wrap the project's report in it's own _biblatex_ reference section\n document.content.prepend(\"\\\\begin{refsection}[projects/#{document.data['slug']}]\\n\\n\")\n document.content += \"\\n\\\\end{refsection}\\n\"\n\n # add the project's title\n document.content.prepend(\"\\\\subsection{#{document.data['title']}}\\\\label{#{document.data['title'].downcase.gsub(/\\s/, '-')}}\\n\\n\")\n end",
"def sort_sections\n titles = @sections.map { |title, _| title }\n\n if titles.length > 1 and\n TOMDOC_TITLES_SORT ==\n (titles | TOMDOC_TITLES).sort_by { |title| title.to_s } then\n @sections.values_at(*TOMDOC_TITLES).compact\n else\n @sections.sort_by { |title, _|\n title.to_s\n }.map { |_, section|\n section\n }\n end\n end",
"def merge_sections cm # :nodoc:\n my_sections = sections.group_by { |section| section.title }\n other_sections = cm.sections.group_by { |section| section.title }\n\n other_files = cm.in_files\n\n remove_things my_sections, other_files do |_, section|\n @sections.delete section.title\n end\n\n other_sections.each do |group, sections|\n if my_sections.include? group\n my_sections[group].each do |my_section|\n other_section = cm.sections_hash[group]\n\n my_comments = my_section.comments\n other_comments = other_section.comments\n\n other_files = other_section.in_files\n\n merge_collections my_comments, other_comments, other_files do |add, comment|\n if add then\n my_section.add_comment comment\n else\n my_section.remove_comment comment\n end\n end\n end\n else\n sections.each do |section|\n add_section group, section.comments\n end\n end\n end\n end",
"def section_params\n params.require(:section).permit(:title, :content, :description, :status_id, :visibility_id, :document_id, :order,\n display_format:[:suppress_collapse, :collapse_default])\n end",
"def accept_paragraph paragraph\n tt_sections(paragraph.text)\n end",
"def section_properties; end",
"def merge_texts!(hash, element)\n unless element.has_text?\n hash\n else\n # must use value to prevent double-escaping\n texts = +\"\"\n element.texts.each { |t| texts << t.value }\n merge!(hash, CONTENT_KEY, texts)\n end\n end",
"def get_text_for_indexing\n text = self.body.strip\n text.sub!(/Dear .+,/, \"\")\n text.sub!(/[^\\n]+1049\\/2001[^:\\n]+:? ?/, \"\") # XXX: can't be more specific without locale\n self.remove_privacy_sensitive_things!(text)\n return text\n end",
"def to_s; \"Doc-#{target}\\n#{text}\" end",
"def merge_subtitle_marks_from_subtitle_tagging_import_into_content_at(options)\n subtitle_tagging_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :subtitle_tagging_import_dir\n )\n subtitle_tagging_import_glob_pattern = config.compute_glob_pattern(\n subtitle_tagging_import_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :subtitle_mark tokens from subtitle_tagging_import into content_at'\n merge_subtitle_marks_from_subtitle_shared_into_content_at(\n subtitle_tagging_import_glob_pattern,\n subtitle_tagging_import_base_dir,\n content_base_dir,\n options\n )\n end",
"def process_vital_signs(section_name, doc)\n results = doc.xpath(@sections[section_name])\n if (results.size == 0)\n return\n end\n @ccr_hash[section_name] = []\n results.each do |result|\n entry = QME::Importer::Entry.new\n process_codes(result, entry)\n test = result.xpath(\"./ccr:Test\")\n if (test.size > 0 && test.xpath(\"./ccr:Description/ccr:Text\").size > 0) \n process_codes(test,entry) # add them to the entry\n end\n @ccr_hash[section_name] << entry\n end\n end",
"def replace_sections(diary)\n\t\treturn if diary.nil? or !diary.categorizable?\n\n\t\tcategorized = categorize_diary(diary)\n\t\tcategories = restore_categories\n\t\tdeleted = []\n\t\tymd = diary.date.strftime('%Y%m%d')\n\n\t\tcategories.each do |c|\n\t\t\tPStore.new(cache_file(c)).transaction do |db|\n\t\t\t\tdb['category'] = {} unless db.root?('category')\n\t\t\t\tif diary.visible? and categorized[c]\n\t\t\t\t\tdb['category'].update(categorized[c])\n\t\t\t\telse\n\t\t\t\t\t# diary is invisible or sections of this category is deleted\n\t\t\t\t\tdb['category'].delete(ymd)\n\t\t\t\t\tdeleted << c if db['category'].empty?\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tif !deleted.empty?\n\t\t\tdeleted.each do |c|\n\t\t\t\tFile.unlink(cache_file(c))\n\t\t\tend\n\t\t\treplace_categories(categories - deleted)\n\t\tend\n\tend",
"def draft_release_notes_text\n extra_javascript 'docs'\n @hard_wrap = params[:hard_wrap]\n @bugs = sorted_bugs.select(&:doc_text_required?)\n end",
"def copy_text_content_from(brand)\n if !brand.nil?\n brand.text_contents.each do |text|\n tc = text.clone\n tc.brand_id = self.id\n tc.save\n end\n end\n end",
"def archive!\n DocumentArchive.create!(:consumer_id => self.consumer_id, :suggested_standard_document_id => self.suggested_standard_document_id, :rejected_at => Time.now, :suggested_at => self.suggested_at, :source => self.source, :file_content_type => self.file_content_type, :cloud_service_full_path => self.cloud_service_full_path, :original_file_name => self.original_file_name)\n end",
"def texts; end",
"def text\n # .dup is required because the String is frozen.\n mark(@doc.text.first.dup)\n end",
"def sprint_process_text(doc)\n # there is at least one <pre> with MMS text if text has been included by\n # the user. (note) we'll have to verify that if they attach multiple texts \n # to the MMS then Sprint stacks it up in multiple <pre>'s. The only <pre> \n # tag in the document is for text from the user.\n doc.search(\"/html/body//pre\").each do |pre|\n type = 'text/plain'\n text = pre.inner_html.strip\n next if text.empty?\n type, text = transform_text(type, text)\n type, file = sprint_write_file(type, text.strip)\n add_file(type, file) unless type.nil? || file.nil?\n end\n end",
"def archive!\n return false if published_at.nil?\n\n update_column :published_at, nil\n end",
"def set_search_text!\n self.text['a'] = extract_search_text :title, :meta_description\n self.text['b'] = extract_search_text :slug, :path\n self.text['c'] = extract_search_text *self.class.field_names(:textual)\n self.text['d'] = nil\n end",
"def reset_current_section!\n paragraph = current_section[:modifiers].has_key?(:paragraph)\n current_section[:modifiers].clear\n current_section[:modifiers][:paragraph] = true if paragraph\n end",
"def update\n @copy_text = CopyText.find(params[:id])\n @page_section = @copy_text.page_section\n \n @page = @page_section.page\n @site_section = @page.site_section\n\n respond_to do |format|\n if @copy_text.update_attributes(params[:copy_text]) and @page_section.update_attributes(params[:page_section])\n flash[:notice] = 'CopyText was successfully updated.'\n format.html { redirect_to site_section_page_url(@site_section, @page) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @copy_text.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def localized_contents\n @localized_contents ||= begin\n # First collect the localized content\n contents_data = Gluttonberg::Content.localization_associations.inject([]) do |memo, assoc|\n memo += send(assoc).all\n end\n contents_data = contents_data.sort{|a,b| a.section_position <=> b.section_position}\n end\n @localized_contents\n end",
"def preprocess_section (cfg, image_hash, header_hash, link_hash, menu_list) \n Dir.chdir(cfg[\"doc_home\"]) {\n cfg['sections'].keys.each { |section|\n #puts \"using #{section}\"\n #puts \" #{cfg['sections'][section]}\"\n #puts \" #{cfg['sections'][section][:files]}\"\n @image_hash = {}\n @header_hash = {}\n cfg['sections'][section][:files].each { |fname|\n relpath = \"#{cfg['sections'][section][:dir]}/#{fname}\"\n #puts \"In dir #{relpath}\"\n d = File.dirname(relpath)\n f = File.basename(relpath)\n if cfg['nested'] \n Dir.chdir(d) {\n # pre_doc is an array \n pre_doc = Kramdown::Document.new(File.read(f, encoding: \"UTF-8\"),\n {img_hash: @image_hash, hdr_hash: @header_hash, lnk_hash: @link_hash,\n menu_list: @menu_list, input: cfg['input_format']\n }).to_preprocess\n }\n else \n pre_doc = Kramdown::Document.new(File.read(f, encoding: \"UTF-8\"),\n {img_hash: @image_hash, hdr_hash: @header_hash, lnk_hash: @link_hash,\n menu_list: @menu_list, input: cfg['input_format']\n }).to_preprocess\n end\n download_images(cfg, @image_hash)\n }\n #cfg['sections'][section]['images'] = @image_hash\n foo = cfg['sections'][section]['headers'] = @header_hash\n }\n }\n end",
"def render_refworks_texts(documents)\n val = ''\n documents.each do |doc|\n if doc.exports_as? :refworks_marc_txt\n val += doc.export_as(:refworks_marc_txt) + \"\\n\"\n elsif doc.exports_as? :refworks_archives\n val += doc.export_as(:refworks_archives) + \"\\n\"\n elsif doc.doc.exports_as? :refworks_dcs\n val += doc.export_as(:refworks_dcs) + \"\\n\"\n end\n end\n val\n end",
"def delete_section( section )\n @ini.delete section.to_s\n end",
"def merge_subtitle_marks_from_subtitle_import_into_content_at(options)\n subtitle_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :subtitle_import_dir\n )\n subtitle_import_glob_pattern = config.compute_glob_pattern(\n subtitle_import_base_dir,\n options['file-selector'] || :all_files,\n options['file-extension'] || :txt_extension\n )\n content_base_dir = config.compute_base_dir(options['base-dir-2'] || :content_dir)\n\n $stderr.puts ''\n $stderr.puts '-' * 80\n $stderr.puts 'Merging :subtitle_mark tokens from subtitle_import into content_at'\n merge_subtitle_marks_from_subtitle_shared_into_content_at(\n subtitle_import_glob_pattern,\n subtitle_import_base_dir,\n content_base_dir,\n options\n )\n end",
"def delete_section(section)\n @ini.delete section.to_s\n end",
"def section_metadata\n [section_metadata_one, section_metadata_two, section_metadata_three]\n end",
"def split_into_sections text\n result = {}\n current = nil\n text.each_line do |line|\n line.chomp!\n if line =~ /^\\[(\\w+)\\]\\s*$/\n raise \"Duplicate section: #{$1}\" if result[$1]\n current = []\n result[$1] = current\n else\n current << line if current\n end\n end\n result\n end",
"def sections=(value)\n @sections = value\n end",
"def rearrange_docs!; end",
"def create\n @section = Section.new(section_params)\n @section.title = @section.title || \"\"\n\n document = @section.document\n @section.order = 1\n unless document.sections.blank?\n @section.order = document.sections.last.order + 1\n end\n\n @section.visibility = document.visibility\n @section.status = document.status\n\n update_user_attribution @section, true\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.any(:json, :js) { render :show, status: :created, location: @section }\n else\n puts @section.errors.full_messages\n format.html { render :new }\n format.any(:json, :js) { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process_section(n, level, out) \n n.children.each do |c| \n case c.name\n when \"section\", \"span\", \"div\"\n process_section(c, level+1, out) # since ipynb is flat, we need to recurse on sections \n when \"h1\", \"h2\", \"h3\", \"h4\", \"h4\", \"h5\", \"h6\"\n out << {\n \"cell_type\" => \"heading\",\n \"level\" => level,\n \"metadata\" => {}, \n \"source\" => c.text\n }\n when \"pre\", \"code\"\n # test for the code type. If it's not python, then insert the \n # appropriate cell magics\n listing = c.text\n code_type = c.attributes[\"data-code-language\"] || \"python\"\n if code_type != \"python\"\n listing = \"%%#{code_type}\\n#{listing}\"\n end\n out << { \n \"cell_type\" => \"code\",\n \"collapsed\" => false,\n \"input\" => listing, \n \"language\" => code_type,\n \"metadata\" => {}, \n \"outputs\" => []\n }\n else\n out << { \n \"cell_type\" => \"markdown\",\n \"metadata\" => {}, \n \"source\" => c.to_s\n }\n end\n end \n return out\n end",
"def update!(**args)\n @section_name = args[:section_name] if args.key?(:section_name)\n @separator = args[:separator] if args.key?(:separator)\n @tidbit_text = args[:tidbit_text] if args.key?(:tidbit_text)\n @token_begin = args[:token_begin] if args.key?(:token_begin)\n @token_end = args[:token_end] if args.key?(:token_end)\n end",
"def text_document_sync\n attributes.fetch(:textDocumentSync)\n end",
"def delete_subtitles!(subtitles_container)\n delete_and_merge_ops.each do |op|\n # Remove subtitle\n op.affected_stids.each { |aff_st|\n next unless '' == aff_st.tmp_attrs[:after]\n subtitles_container.delete_if { |new_st|\n new_st[:persistent_id] == aff_st.persistent_id\n }\n }\n end\n true\n end",
"def restore_tags\n marc.by_tags(\"599\").each do |t|\n new_content = t.fetch_first_by_tag(\"a\").content\n if new_content =~ /=[0-9]{3}\\s{2}/\n tag, content = new_content.split(\" \")\n marc.parse_marc21(tag[1..4], content)\n t.destroy_yourself\n end\n end\n self.save\n end",
"def options_for_sections(section_tags)\n title_counts = Hash.new(0)\n section_tags.each { |tag| title_counts[tag.title] += 1 }\n\n section_tags.map do |tag|\n # Annotate tags, where necessary, with their IDs\n if title_counts[tag.title] > 1\n display_name = \"#{tag.title} [#{tag.tag_id}]\"\n else\n display_name = tag.title\n end\n [display_name, tag.tag_id]\n end\n end",
"def contents_convert_utf8\n @publication.title = @publication.title ? @publication.title.force_encoding('UTF-8') : \"\"\n @publication.abstract = @publication.abstract ? @publication.abstract.force_encoding('UTF-8') : \"\"\n @publication.contents = @publication.contents ? @publication.contents.force_encoding('UTF-8') : \"\"\n end",
"def post_process(doc)\n doc.gsub(\"\\n\",'')\n end",
"def processSection0(section)\n string = '';\n buffer_array = [];\n text = section.inner_html;\n text.split('<br>').each do |info|\n buffer_array << info.strip().delete(',');\n end\n string += buffer_array.join(\",\");\n return string;\nend",
"def sections?\n false\n end",
"def on_inverted_section(name, content, raw, delims)\n \"v = #{compile!(name)}; ctx._eval_inverted_section(@output_buffer, v) {\\n#{compile!(content)}\\n}; \"\n end",
"def on_inverted_section(name, offset, content, raw, delims)\n # Convert the tokenized content of this section into a Ruby\n # string we can use.\n code = compile(content)\n\n # Compile the Ruby for this inverted section now that we know\n # what's inside.\n ev(<<-compiled)\n v = #{compile!(name)}\n if v.nil? || v == false || v.respond_to?(:empty?) && v.empty?\n #{code}\n end\n compiled\n end",
"def section_by_name(section_name); end",
"def export_to_db!(filter_boxes)\n return unless @contradiction_count.zero?\n create_new_chapters!\n @chapters.each do |c|\n create_new_sections!(c)\n c['mampf_chapter'] = c['mampf_chapter'].reload\n end\n create_or_update_chapter_items!\n create_or_update_section_items!\n create_or_update_content_items!(filter_boxes)\n update_tags!(filter_boxes)\n end",
"def add_info_on_tag_ids\n desc_hash = Notion.where(locale: @lecture.locale || I18n.default_locale)\n .pluck(:title, :tag_id, :aliased_tag_id)\n .map { |x| [x.first.downcase, x.second || x.third] }\n .select { |x| x.first.in?(@content_descriptions.map(&:downcase)) }\n .to_h\n @content.each do |c|\n c['tag_id'] = desc_hash[c['description'].downcase]\n end\n end",
"def block_docbook_defs( text )\n text.gsub!(/^-\\s+(.*?):=(.*?)=:\\s*$/m) do |m|\n \"- #{$1.strip} := <para>\"+$2.split(/\\n/).map{|w|w.strip}.delete_if{|w|w.empty?}.join(\"</para><para>\")+\"</para>\"\n end\n \n text.gsub!( DEFS_RE ) do |match|\n lines = match.split( /\\n/ )\n lines.each_with_index do |line, line_id|\n if line =~ DEFS_CONTENT_RE \n dl,continuation,dt,dd = $~[1..4]\n \n atts = pba( atts )\n atts = shelve( atts ) if atts\n lines[line_id] = line_id == 0 ? \"<variablelist>\" : \"\"\n lines[line_id] << \"\\n\\t<varlistentry><term>#{ dt.strip }</term>\\n\\t<listitem><para>#{ dd.strip }</para></listitem></varlistentry>\"\n\n end\n\n if line_id == lines.length - 1\n lines[-1] << \"\\n</variablelist>\"\n end\n end\n lines.join( \"\\n\" )\n end\n end",
"def to_docbook( *rules )\n @stack = Array.new\n @ids = Array.new\n @references = Array.new\n @automatic_content_ids = Array.new\n\n rules = DEFAULT_RULES if rules.empty?\n # make our working copy\n text = self.dup\n \n @urlrefs = {}\n @shelf = []\n @rules = rules.collect do |rule|\n case rule\n when :docbook\n DOCBOOK_RULES\n else\n rule\n end\n end.flatten\n \n # standard clean up\n incoming_entities text \n clean_white_space text \n\n # start processor\n @pre_list = []\n pre_process_docbook text\n\n no_docbook text\n docbook_rip_offtags text\n docbook_hard_break text\n\n refs text\n docbook_blocks text\n inline text\n \n smooth_offtags text\n retrieve text\n \n post_process_docbook text\n clean_html text if filter_html\n text.strip!\n \n text << \"\\n\"\n @stack.each_with_index {|sect,index| text << \"</sect#{@stack.size-index}>\\n\"}\n text << \"</chapter>\" if @chapter\n \n if (@references - @ids).size > 0\n text << %{<chapter label=\"86\" id=\"chapter-86\"><title>To Come</title>}\n (@references - @ids).each {|name| text << %!<sect1 id=\"#{name}\"><title>#{name.split('-').map {|t| t.capitalize}.join(' ')}</title><remark>TK</remark></sect1>\\n!}\n text << \"</chapter>\"\n end\n \n text\n\n end"
] |
[
"0.548371",
"0.54345596",
"0.539416",
"0.5228337",
"0.5202846",
"0.5202256",
"0.5197544",
"0.51853555",
"0.51423466",
"0.5127201",
"0.5122513",
"0.5122513",
"0.5075254",
"0.50681067",
"0.50642467",
"0.50565386",
"0.5048153",
"0.5024713",
"0.5022597",
"0.50221545",
"0.5006274",
"0.49913436",
"0.49856603",
"0.4974841",
"0.496659",
"0.49609306",
"0.49369982",
"0.49270552",
"0.49142966",
"0.4913259",
"0.48944926",
"0.4889187",
"0.48764876",
"0.48570615",
"0.4840586",
"0.48240224",
"0.48203242",
"0.4808495",
"0.4805929",
"0.48013622",
"0.47810686",
"0.47747672",
"0.47707212",
"0.47602046",
"0.47436428",
"0.47331652",
"0.4729965",
"0.4728477",
"0.47117406",
"0.47109625",
"0.47069398",
"0.4703738",
"0.4702585",
"0.46940252",
"0.4693818",
"0.46935984",
"0.4691915",
"0.46904165",
"0.4688671",
"0.46833396",
"0.46779165",
"0.4672245",
"0.46669367",
"0.4665596",
"0.4660529",
"0.46565515",
"0.46559972",
"0.46533495",
"0.46409333",
"0.46174577",
"0.46162277",
"0.46104634",
"0.45947477",
"0.45945865",
"0.45910308",
"0.4588745",
"0.45829725",
"0.45802182",
"0.4574274",
"0.45615017",
"0.4561488",
"0.454602",
"0.45437115",
"0.45434594",
"0.4539664",
"0.45355302",
"0.4525903",
"0.45199096",
"0.45135108",
"0.45111486",
"0.45109573",
"0.45089903",
"0.45051366",
"0.45035952",
"0.4503311",
"0.4502533",
"0.44970906",
"0.4496574",
"0.44894817",
"0.44891503"
] |
0.5097594
|
12
|
Document data we want to report to segment analytics
|
def reporting_properties
{
title: self.title,
id: self.id,
created_by: self.created_by&.reporting_properties,
project: self.project&.reporting_properties
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_data(startdate, enddate)\n\t\t\n\t\tdate_range = @analytics::DateRange.new(start_date: startdate, end_date: enddate)\n\t\torder_by = @analytics::OrderBy.new(field_name: 'ga:pageviews', sort_order: 'DESCENDING')\n\t\t# metric = @analytics::Metric.new(expression: 'ga:sessions')\n\t\t# metric = @analytics::Metric.new(expression: ['ga:sessions', 'ga:uniquePageviews'])\n\t\t# metric = @analytics::Metric.new\n\t\t# metric.expression = ['ga:sessions', 'ga:uniquePageviews']\n\t\t\n\t\tmetrics = ['ga:pageviews', 'ga:users', 'ga:bounces', 'ga:sessions',\n\t\t\t\t 'ga:avgTimeOnPage', 'ga:newUsers', 'ga:goal1ConversionRate', 'ga:goal1Completions'\n\t\t\t\t ]\n\n\t\t# metrics = ['ga:totalEvents'\n\t\t# \t\t ]\t\t \n\n\n\t\tmetric_type = Array.new\n\t\tmetrics.each do |m|\n\t\t\tmetric = @analytics::Metric.new\n\t\t\tmetric.expression = m\n\t\t\tmetric_type.push(metric)\n\t\tend\n\n\t\tdimensions = ['ga:pagePath', 'ga:pageTitle', 'ga:hostname' ]\n\t\t# dimensions = ['ga:pagePath', 'ga:eventCategory']\n\t\tdimension_type = Array.new\n\t\tdimensions.each do |d|\n\t\t\tdimension = @analytics::Dimension.new\n\t\t\tdimension.name = d\n\t\t\tdimension_type.push(dimension)\n\t\tend\n\n\n\t\t# dimension = @analytics::Dimension.new(name: 'ga:pagePath')\n\n\t\t# dimension_filters = @analytics::DimensionFilterClause.new(\n\t # filters: [\n\t # @analytics::DimensionFilter.new(\n\t # dimension_name: 'ga:pagePath',\n\t # operator: \"IN_LIST\",\n\t # expressions: ['/archives/69839', '/archives/54087', '/archives/68924', '/archives/58437', '/archives/65171', '/archives/64435', '/archives/61533', '/archives/68924',\n\t # \t\t\t\t'/archives/65086', '/archives/64736', '/archives/55244', '/archives/68211'\n\t # ]\n\t # )\n\t # ]\n\t # )\n\n\t\trequest = @analytics::GetReportsRequest.new(\n \t\t\treport_requests: [@analytics::ReportRequest.new(\n \t\t\tview_id: @view_id, \n \t\t\tmetrics: metric_type, \n \t\t\tdimensions: dimension_type,\n \t\t\t# dimension_filter_clauses: [dimension_filters],\n \t\t\t# dimensions: [dimension], \n \t\t\tdate_ranges: [date_range],\n \t\t\torder_bys: [order_by],\n \t\t\tpageSize: 10000\n \t\t\t)]\n\t\t)\n\t\tresponse = @client.batch_get_reports(request)\n\t\tmessageHash = {}\n\n\t\t# handling error \n\t\tif !response.reports.first.data.rows then\n\t\t\t\n\t\t\tkey = \"message\"\n\t\t\tmessageHash[key.to_sym] = \"no data\"\n\t\t \treturn messageHash\n\t\tend\n\n\n\t\tdata_from_google = response.reports.first.data.rows\n\n\t\tkey_array = dimensions + metrics\n\n\t\t# get rid of 'ga:'\n\t\tkey_array.each_with_index do |k, index| \n\t\t\tkey_array[index] = k.gsub(\"ga:\",\"\")\n\t\tend\n\n\t\tkey_array.push('id')\n\t\tkey_array.push('clickCount')\n\n\t\tset_ga_data_array = Array.new\n\n\n\t\tdata_from_google.each_with_index do |r, index|\n\n\t\t\tdatahash = {}\n\t\t\ti = 0;\n\n\t\t\t# setup dimension part\n\t\t\tr.dimensions.each do |d|\n\t\t\t\tdatahash[key_array[i]] = d\n\t\t\t\ti += 1\n\t\t\tend\n\n\t\t\t# setup metrics part\n\t\t\tr.metrics.first.values.each do |m|\n\t\t\t\tdatahash[key_array[i]] = m\n\t\t\t\ti += 1\n\t\t\tend\n\n\t\t\t\n\t\t\t# get aticle data from db\n\t\t\tarticleArr = set_article_data(datahash['hostname'], datahash['pagePath'], startdate, enddate)\n\n\t\t\t# setup id, mcv\n\t\t\tarticleArr.each do |a|\n\t\t\t\tdatahash[key_array[i]] = a\n\t\t\t\ti += 1\n\t\t\tend\n\n\t\t\tset_ga_data_array.push(datahash)\n\n\t\t\t#datahash sample -> { \"pagePath\": \"/archives/69839\", ... , \"goal1Completions\": \"23\", \"id\": 4, \"clickCount\": 0 },\n\t\tend\n\t\t\n\t\treturn set_ga_data_array\n\tend",
"def documents; end",
"def documents; end",
"def index\n # @results = []\n # @document.bioc_doc.all_annotations.each do |a|\n # e = EntityUtil.get_annotation_entity(a)\n # a.locations.each do |l|\n # @results << {did: @document.did, offset: l.offset, text: a.text, length: l.length, infons: a.infons }\n # end\n # end\n @project = @document.project\n @version = params[:version] || @document.version\n @version = @version.to_i if @version.present?\n @is_manager = @project.manager?(current_user)\n\n if @is_manager || @project.collaborate_round\n @annotations = @document.annotations.where('`version`=?', @version)\n else\n @annotations = @assign.annotations\n end\n @annotations = @annotations.order(\"offset\")\n end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def generate_solr_document\n super.tap do |solr_doc|\n solr_doc['member_works_count_isi'] = member_works_count\n solr_doc['title_ssort'] = sort_title\n solr_doc['creator_ssort'] = object.creator.first\n solr_doc['generic_type_sim'] = [\"Collection\"]\n solr_doc['banner_path_ss'] = banner_path\n solr_doc['source_collection_title_for_collections_ssim'] = source_collection\n solr_doc['deposit_collection_titles_tesim'] = deposit_collection\n solr_doc['deposit_collection_ids_tesim'] = object.deposit_collection_ids\n end\n end",
"def set_document\n @document = Document.includes(:graphs => [:nodes => [:node_tags => [:tag]], :edges => [:node_from, :node_to], :tags => [], :clusters => []]).joins(:user).where(user: current_user).find(params[:id])\n end",
"def index\n # @results = []\n # @document.bioc_doc.all_relations.each do |a|\n # e = EntityUtil.get_relation_entity(a)\n # a.locations.each do |l|\n # @results << {did: @document.did, offset: l.offset, text: a.text, length: l.length, infons: a.infons }\n # end\n # end\n @project = @document.project\n @version = params[:version] || @document.version\n @version = @version.to_i if @version.present?\n @is_manager = @project.manager?(current_user)\n\n if @is_manager\n @relations = @document.relations.where('`version`=?', @version)\n else\n @relations = @assign.relations\n end\n @relations = @relations.order(\"offset\")\n end",
"def solr_doc_data\n doc = {}\n\n\n # To support indexing of records of different classes, create a unique id by concatenating\n # class name (downcased and underscored) and record id (see solr_id below)...\n doc[:id] = solr_id\n\n\n # ... then record class name and record id as record_type, record_id\n doc[:record_type] = self.class.to_s.underscore\n doc[:record_id] = self.id\n\n\n # This will add all attributes that correspond to database columns (make sure these are all in the schema, or modify)\n attrs = self.class.column_names.map { |n| n.to_sym }\n attrs.each do |a|\n if a != :id\n doc[a] = self[a]\n end\n end\n\n\n ######################################################\n # Here you can add other elements to the doc as needed\n #\n # If you are indexing records from multiple models, it's a good idea to use a case statement here\n # to specify which fields to index for which model, e.g.:\n #\n # case self\n # when Foo\n # doc['foo_attribute'] = self.foo_attribute\n # when Boo\n # doc['boo_attribute'] = self.boo_attribute\n # end\n #\n ######################################################\n\n\n # remove nil/empty values\n doc.delete_if { |k,v| nil_or_empty?(v) }\n\n\n doc\n end",
"def data; @doc[key] end",
"def write_document_to_index(document)\n\n end",
"def extractData()\n\n @es_client = Elasticsearch::Client.new host: 'http://192.168.59.103:9200/', log: true\n gr = RDF::Vocabulary.new(\"http://purl.org/goodrelations/v1#\")\n s = RDF::Vocabulary.new(\"http://schema.org/address\")\n v = RDF::Vocabulary.new(\"http://www.w3.org/2006/vcard/ns#\")\n l = RDF::Vocabulary.new(\"http://www.linked-usdl.org/ns/usdl-core#\")\n\n company = RDF::Node.new\n addTriple( company , RDF.type, @resume_cv.Company)\n addUSDL(company, RDF.type, gr.BusinessEntity)\n\n # content = @doc.css('div').select{|document| document['id'] == \"inhalt\"}[0]\n company_name = extractAnnotation(\"name\").first\n\n add_annotation(\"name\", company_name)\n # description = @doc.css('div').select{|description| description['id'] == \"text\"}[0]\n\n\n website = extractAnnotation(\"website\").first\n streetAddress = extractAnnotation(\"streetAddress\").first\n postal = extractAnnotation(\"postal\").first\n locality = extractAnnotation(\"locality\").first\n country = extractAnnotation(\"country\").first\n phone = extractAnnotation(\"phone\").first\n mail = extractAnnotation( \"mail\").first\n region = country\n\n extractAnnotation(\"product_categories\").each do |i|\n puts \"i: #{i}\"\n product = RDF::Node.new\n addUSDL(product, RDF.type, gr.ProductOrService)\n addUSDL(product, gr.name, i)\n addUSDL(product, gr.hasManufacturer, company)\n addTriple(company, @resume_cv.produces, i)\n end\n\n extractAnnotation(\"produces\").each do |i|\n puts \"prodcat2 : #{i}\"\n offering = RDF::Node.new\n addUSDL(offering, RDF.type, gr.Offering)\n addUSDL(company, gr.offers, offering)\n addUSDL(offering, gr.name , i)\n\n addTriple(company, @resume_cv.sells , i)\n end\n\n extractAnnotation(\"distr_category\").each do |i|\n puts \"distcat : #{i}\"\n addUSDL(company, gr.category, i)\n addTriple(company, @resume_cv.distribution_type, i)\n end\n\n extractAnnotation(\"distributes_for\").each do |i|\n puts \"distfor : #{i}\"\n addUSDL(company, @resume_cv.distribution_for, i)\n addTriple(company, @resume_cv.distribution_for, i)\n end\n\n extractAnnotation(\"provides\").each do |i|\n puts \"provcat : #{i}\"\n offering = RDF::Node.new\n addUSDL(offering, RDF.type, gr.Offering)\n addUSDL(company, gr.offers, offering)\n addUSDL(offering, gr.name , i)\n addTriple(company, @resume_cv.hasSpeciality , i)\n end\n\n extractAnnotation(\"distributed_by\").each do |i|\n puts \"distfor : #{i}\"\n addUSDL(company, @resume_cv.distributed_by, i)\n addTriple(company, @resume_cv.distributed_by, i)\n end\n\n # addTriple(company , @resume_cv.isIndustry, industry)\n # addUSDL(company, gr.category, industry)\n # addTriple(company, @resume_cv.hasSpeciality, s)\n addTriple(company , @resume_cv.hasWebsite, website)\n addUSDL(company, RDF::FOAF.page, website)\n addTriple( company , @resume_cv.name, company_name)\n addUSDL( company, gr.legalName, company_name)\n # # addTriple(company , @resume_cv.hasType, type)\n # # addTriple(company , @resume_cv.wasFounded, founded)\n # # addTriple(company , @resume_cv.hasSize, compsize)\n address = RDF::Node.new\n addUSDL(address, RDF.type , v.Address)\n addUSDL(company, l.hasCommunicationChannel, address)\n\n telephone = RDF::Node.new\n addUSDL(telephone, RDF.type, v.Voice)\n addUSDL(telephone, v.hasValue, phone)\n\n addUSDL(address, v.country_name, country)\n addUSDL(address, v.locality, locality)\n addUSDL(address, v.postal_code, postal )\n addUSDL(address, v.street_address, streetAddress)\n addUSDL(address, v.has_email ,mail)\n\n addTriple(company , @resume_cv.hasLocality, locality)\n addTriple(company , @resume_cv.hasStreetAddress, streetAddress)\n addTriple(company , @resume_cv.locatedInRegion, region)\n addTriple(company , @resume_cv.postalCode, postal)\n addTriple(company , @resume_cv.country, country)\n\n add_annotation( \"locality\", locality)\n add_annotation( \"street\" , streetAddress)\n add_annotation( \"postal\" , postal)\n add_annotation( \"country\", country)\n add_annotation( \"phone\", phone)\n add_annotation( \"mail\" , mail)\n\n company_name\n end",
"def document\n {\n 'title' => 'Elasticsearch: The Definitive Guide',\n 'cover' => nil,\n 'masthead' => nil,\n }\n end",
"def set_document_analysis\n @analysis = @document.document_analysis.where.not(queued_at: nil).order('updated_at DESC').first\n end",
"def generateDataset(dataDict)\n user_name = dataDict[:userName]\n fiscal_year = dataDict[:fiscalYear]; fiscal_quarter = dataDict[:fiscalQuarter]\n fiscal_month = dataDict[:fiscalMonth]; fiscal_week = dataDict[:fiscalWeek]\n bookingColl = dataDict[:bookingColl]; gdColl = dataDict[:gdColl];\n mongoEng = dataDict[:mongoEng]; dsObj = dataDict[:dsObj]\n doc = {\n :username => user_name,\n :periods => {\n :year => fiscal_year,\n :quarter => fiscal_quarter,\n :month => fiscal_month,\n :week => fiscal_week\n }\n }\n # Till date Booking\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByHistory(),\n { :$sort => {:_id => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:tdBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n } \n else\n doc[:tdBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Architecture wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByArch2(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:archBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:archBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Vertical wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByVertical(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:verticalBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:verticalBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Technology wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByTechName(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:techBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:techBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # AT Attach wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByAtAttach(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:atAttachBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:atAttachBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Sub SCMS wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingBySubSCMS(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:subSCMSBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:subSCMSBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # GTMu wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByGTMu(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:gtmuBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:gtmuBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Region wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByRegion(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:regionBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:regionBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Top 10 Customers Ranking by Booking\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:$and] = [\n {\n \"names.customer.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByCustomer(),\n { :$sort => {:booking => -1}},\n { :$limit => 10 }\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:topCustomerBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:topCustomerBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Top 10 Partner Ranking by Booking\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:$and] = [\n {\n \"names.partner.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByPartner(),\n { :$sort => {:booking => -1}},\n { :$limit => 10 }\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:topPartnerBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:topPartnerBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Top 10 Sales_Level_6 Ranking by Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingBySL6(),\n { :$sort => {:booking => -1}},\n { :$limit => 10 }\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:topSL6Booking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:topSL6Booking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Top 10 Deals\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:$and] = [\n {\n \"names.customer.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^runrate/i\n }\n },\n {\n \"references.sales_order_number_detail\" => {\n :$ne => nil \n }\n },\n {\n \"references.sales_order_number_detail\" => {\n :$ne => \"\" \n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByCustomerSONumber(),\n { :$sort => {:booking => -1}},\n { :$limit => 10 }\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggQryTopDeals(aggregateQuery, bookingColl)\n doc[:topDeals] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:topDeals] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Billed Customers\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:$and] = [\n {\n \"names.customer.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupByCustomers(),\n ]\n if !matchObj.nil?\n returnedObj = keyValuePairByAggQryBilled(aggregateQuery, bookingColl, 'customer')\n doc[:billedCustomers] = {\n :xAxis => returnedObj[:key],\n :yAxis => returnedObj[:value]\n }\n else\n doc[:billedCustomers] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n\n\n # Repeat/New & Dormant Customers \n if fiscal_quarter.nil? && fiscal_month.nil? && fiscal_week.nil?\n #if (false)\n prevYear1 = fiscal_year.to_i - 1\n matchObj2 = Marshal.load(Marshal.dump(matchObj))\n matchObj2[:$match][\"periods.year\"] = prevYear1.to_s\n matchObj2[:$match].delete(\"periods.quarter\")\n matchObj2[:$match].delete(\"periods.month\")\n matchObj2[:$match].delete(\"periods.week\")\n\n prevYear2 = fiscal_year.to_i - 2\n prevYear3 = fiscal_year.to_i - 3\n #puts \"Prev -1: #{prevYear1}, Prev - 2: #{prevYear2}, Prev - 3: #{prevYear3}\"\n matchObj3 = Marshal.load(Marshal.dump(matchObj2))\n matchObj3[:$match].delete(\"periods.year\")\n matchObj3[:$match][:$or] = [\n { \"periods.year\" => prevYear1.to_s },\n { \"periods.year\" => prevYear2.to_s },\n { \"periods.year\" => prevYear3.to_s },\n ]\n\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByCustomer(),\n ]\n aggregateQuery2 = [\n matchObj2,\n dsObj.groupBookingByCustomer(),\n ]\n aggregateQuery3 = [\n matchObj3,\n dsObj.groupBookingByCustomer(),\n ]\n aggregateQueries = {\n :query1 => aggregateQuery,\n :query2 => aggregateQuery2,\n :query3 => aggregateQuery3,\n }\n if !matchObj.nil?\n returnedObj = keyValuePairByAggQryRepeatNew(aggregateQueries, bookingColl, 'customer')\n doc[:newAccounts] = {\n :xAxis => returnedObj[:obj1][:key],\n :yAxis0 => returnedObj[:obj1][:val],\n :yAxis => returnedObj[:obj1][:value],\n :yAxis2 => returnedObj[:obj1][:value2],\n :yAxis3 => returnedObj[:obj1][:value3],\n :yAxis4 => returnedObj[:obj2][:value2],\n :yAxis5 => returnedObj[:obj2][:value3],\n }\n doc[:repeatAccounts] = {\n :xAxis => returnedObj[:obj2][:key],\n :yAxis0 => returnedObj[:obj2][:val],\n :yAxis => returnedObj[:obj2][:value],\n :yAxis2 => returnedObj[:obj1][:value4],\n :yAxis3 => returnedObj[:obj1][:value5],\n :yAxis4 => returnedObj[:obj2][:value4],\n :yAxis5 => returnedObj[:obj2][:value5],\n }\n doc[:dormantAccounts] = {\n :xAxis => returnedObj[:obj3][:key],\n :yAxis0 => returnedObj[:obj3][:val],\n :yAxis => returnedObj[:obj3][:value],\n :yAxis2 => returnedObj[:obj3][:value2],\n :yAxis3 => returnedObj[:obj3][:value3],\n :yAxis4 => returnedObj[:obj3][:value4],\n :yAxis5 => returnedObj[:obj3][:value5],\n :yAxis6 => returnedObj[:obj3][:value6],\n }\n else\n doc[:newAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n } \n doc[:repeatAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n } \n doc[:dormantAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n :yAxis5 => [],\n :yAxis6 => [],\n } \n end # End of If condition\n else\n doc[:newAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n } \n doc[:repeatAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n } \n doc[:dormantAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n :yAxis5 => [],\n :yAxis6 => [],\n } \n end # End of checking whether the period criteria is for only YTD \n\n\n\n # Billed Partners\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:$and] = [\n {\n \"names.partner.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupByPartners(),\n ]\n if !matchObj.nil?\n returnedObj = keyValuePairByAggQryBilled(aggregateQuery, bookingColl, 'partner')\n doc[:billedPartners] = {\n :xAxis => returnedObj[:key],\n :yAxis => returnedObj[:value]\n }\n else\n doc[:billedPartners] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n\n # Technology Penetration\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:$and] = [\n {\n \"names.customer.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByCustomerTechnologies(),\n ]\n if !matchObj.nil?\n returnedObj = keyValuePairByAggQryTechPenetration(aggregateQuery, bookingColl)\n doc[:techPenetration] = {\n :xAxis => returnedObj[:key],\n :yAxis => returnedObj[:value],\n :yAxis2 => [ScalarCalculators.calculateRatio(doc[:tdBooking][:yAxis][0],returnedObj[:value][0]).to_f*THOUSAND]\n }\n else\n doc[:techPenetration] = {\n :xAxis => [],\n :yAxis => [],\n :yAxis2 => []\n } \n end # End of If condition\n\n\n # QoQ Booking\n tempQuarter = nil\n tempMonth = nil\n tempWeek = nil\n matchObj = dsObj.matchByMultipleParams(fiscal_year, tempQuarter, tempMonth, tempWeek, user_name)\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByQoQ(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:qoqBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:qoqBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # MoM Booking\n tempMonth = nil\n tempWeek = nil\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, tempMonth, tempWeek, user_name)\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByMoM(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:momBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:momBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # WoW Booking\n tempWeek = nil\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, tempWeek, user_name)\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByWoW(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:wowBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:wowBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Product Service Booking\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByProductService()\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:prodSerBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:prodSerBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Average Discount of Archs\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingNetAndListByArchs()\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggQryDiscount(aggregateQuery, bookingColl)\n doc[:disArchsBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value],\n :yAxis2 => bookingObj[:value2],\n :yAxis3 => bookingObj[:value3],\n }\n else\n doc[:disArchsBooking] = {\n :xAxis => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n } \n end # End of If condition\n\n # Average Discount of Overall \n aggregateQuery = [\n matchObj,\n dsObj.groupExclusiveBookingNetAndList(),\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggQryDiscount(aggregateQuery, bookingColl)\n doc[:disAllBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value],\n :yAxis2 => bookingObj[:value2],\n :yAxis3 => bookingObj[:value3],\n }\n else\n doc[:disAllBooking] = {\n :xAxis => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n } \n end # End of If condition\n\n # Booking History\n tempYear = nil\n matchObj = dsObj.matchByMultipleParams(tempYear, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByHistory(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingHistoryObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n #ap bookingHistoryObj\n doc[:bookingHistory] = {\n :xAxis => bookingHistoryObj[:key],\n :yAxis => bookingHistoryObj[:value]\n }\n else\n doc[:bookingHistory] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Yield Per Customer\n if !doc[:tdBooking][:yAxis].empty?\n doc[:yieldPerCustomer] = {\n :xAxis => [doc[:billedCustomers][:xAxis]],\n :yAxis => [ScalarCalculators.calculateRatio(doc[:tdBooking][:yAxis][0],doc[:billedCustomers][:yAxis][0]).to_f*THOUSAND] \n }\n else\n doc[:yieldPerCustomer] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n if !doc[:tdBooking][:yAxis].empty?\n #puts \"Initializing mongo insertion for #{user_name} | #{fiscal_year} | #{fiscal_quarter} | #{fiscal_month} | #{fiscal_week}\"\n id = mongoEng.insertDocument(gdColl, doc) \n puts \"#{user_name} | #{fiscal_year} | #{fiscal_quarter} | #{fiscal_month} | #{fiscal_week} - insertion ID: #{id}\"\n end # End of if condition checking if there is any data\n #ap doc\n #puts \"#{doc}\"\n end",
"def generate_solr_document\n super.tap do |solr_doc|\n # account\n solr_doc[Solrizer.solr_name('account', :displayable)] = object.account.to_json\n solr_doc[Solrizer.solr_name('account_type', :facetable)] = object.account.map { |a| a.account_type.first }.reject(&:blank?)\n # contact\n solr_doc[Solrizer.solr_name('contact_label', :facetable)] = object.contact.map { |c| c.label.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('contact', :displayable)] = object.contact.to_json\n # template files\n solr_doc['template_path_ss'] = object.members.select {\n |m| m.resource_type.include? ('Data paper template')}.\n map{ |f| Hyrax::Engine.routes.url_helpers.download_path(f.id)\n }\n end\n end",
"def solr_doc_data\n @doc = {\n id: solr_id,\n record_type: self.class.to_s.underscore,\n record_id: id,\n data: json_data,\n created_at: created_at,\n updated_at: updated_at\n }\n\n case self\n when Order\n add_order_data_to_solr_doc\n when Item\n add_item_data_to_solr_doc\n when User\n add_user_data_to_solr_doc\n when Location\n add_location_data_to_solr_doc\n end\n\n # remove nil/empty values\n @doc.delete_if { |k,v| nil_or_empty?(v) }\n @doc\n end",
"def write\n\t\t@day = post_params[:day] ? Day.from_identifier(post_params[:day]) : Day.from_time(Time.zone.now)\n\t\t@docs = Document.for_user(@user.id, @day.year, @day.month)\n\t\t@progress = Hash[*@docs.map { |doc| [Day.calculate_identifier(doc.year, doc.month, doc.day), (doc.words.to_f / doc.goal)] }.flatten]\n\t\t@document = get_or_create_document(@user, @day)\n\tend",
"def generate_solr_document\n super.tap do |solr_doc|\n # Only do this after the indexer has the file_set\n unless object.file_sets.nil?\n load_elections_xml(object)\n if @noko.nil?\n Rails.logger.warn(\"Couldn't find the Voting Record XML for #{solr_doc['id']}\")\n else\n solr_doc['voting_record_xml_tesi'] = @noko.to_xml\n solr_doc['format_ssim'] = 'Election Record' # solr_doc['format_tesim']\n solr_doc['title_ssi'] = solr_doc['title_tesim'].first # solr_doc['title_tesi']\n\n solr_doc['party_affiliation_sim'] = get_all_vs('//candidate/@affiliation', '//elector/@affiliation')\n solr_doc['party_affiliation_id_ssim'] = get_all_vs('//candidate/@affiliation_id', '//elector/@affiliation_id')\n # solr_doc['party_affiliation_id_ssim'].delete_if { |party_id| Party.find(party_id).nil? }\n\n solr_doc['date_tesim'] = get_all_vs('/election_record/@date')\n solr_doc['date_isi'] = solr_doc['date_tesim'].map(&:to_i).first\n # solr_doc[\"date_sim\"] = date.first[0..3] unless date.first.nil?\n\n solr_doc['office_id_ssim'] = get_v('/election_record/office/@office_id')\n solr_doc['office_role_title_tesim'] = get_all_vs('//role/@title')\n solr_doc['office_name_tesim'] = get_authority_from_nnv(solr_doc['office_id_ssim'], \"office\")\n\n solr_doc['state_name_tesim'] = solr_doc['state_name_sim'] = get_all_vs('//admin_unit[@type=\"State\"]/@name')\n\n solr_doc['election_id_ssim'] = [get_v('/election_record/@election_id')]\n solr_doc['election_type_tesim'] = solr_doc['election_type_sim'] = [get_v('/election_record/@type')]\n\n solr_doc['candidate_id_ssim'] = get_all_vs('//candidate/@name_id')\n solr_doc['candidate_name_tesim'] = get_all_vs('//candidate/@name')\n\n solr_doc['elector_name_tesim'] = get_all_vs(\"//elector/@name\")\n\n solr_doc['jurisdiction_tesim'] = solr_doc['jurisdiction_sim'] = [get_v('/election_record/office/@scope')]\n\n solr_doc['handle_ssi'] = get_v('/election_record/@handle')\n solr_doc['iteration_tesim'] = [get_v('/election_record/@iteration')]\n # solr_doc['page_image_urn_ssim'] = get_all_vs(\"//reference[@type='page_image']/@urn\").uniq\n solr_doc['iiif_page_images_ssim'] = get_iiif_ids(get_all_vs(\"//reference[@type='page_image']/@urn\").uniq)\n\n solr_doc['all_text_timv'] = get_all_text(solr_doc)\n end\n end\n end # End super.tap\n end",
"def generateProdSerDataset(dataDict)\n user_name = dataDict[:userName]\n fiscal_year = dataDict[:fiscalYear]; fiscal_quarter = dataDict[:fiscalQuarter]\n fiscal_month = dataDict[:fiscalMonth]; fiscal_week = dataDict[:fiscalWeek]; prod_ser = dataDict[:prodSer]\n bookingColl = dataDict[:bookingColl]; gdColl = dataDict[:gdColl];\n mongoEng = dataDict[:mongoEng]; dsObj = dataDict[:dsObj]\n doc = {\n :username => user_name,\n :periods => {\n :year => fiscal_year,\n :quarter => fiscal_quarter,\n :month => fiscal_month,\n :week => fiscal_week,\n :prod_ser => prod_ser,\n }\n }\n # Till date Booking\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByHistory(),\n { :$sort => {:_id => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:tdBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n } \n else\n doc[:tdBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Architecture wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByArch2(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:archBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:archBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Vertical wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByVertical(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:verticalBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:verticalBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Technology wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByTechName(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:techBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:techBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # AT Attach wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByAtAttach(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:atAttachBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:atAttachBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Sub SCMS wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingBySubSCMS(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:subSCMSBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:subSCMSBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # GTMu wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByGTMu(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:gtmuBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:gtmuBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Region wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByRegion(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:regionBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:regionBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Top 10 Customers Ranking by Booking\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n matchObj[:$match][:$and] = [\n {\n \"names.customer.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByCustomer(),\n { :$sort => {:booking => -1}},\n { :$limit => 10 }\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:topCustomerBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:topCustomerBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Top 10 Partner Ranking by Booking\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n matchObj[:$match][:$and] = [\n {\n \"names.partner.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByPartner(),\n { :$sort => {:booking => -1}},\n { :$limit => 10 }\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:topPartnerBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:topPartnerBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Top 10 Sales_Level_6 Ranking by Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingBySL6(),\n { :$sort => {:booking => -1}},\n { :$limit => 10 }\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:topSL6Booking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:topSL6Booking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Top 10 Deals\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n matchObj[:$match][:$and] = [\n {\n \"names.customer.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^runrate/i\n }\n },\n {\n \"references.sales_order_number_detail\" => {\n :$ne => nil \n }\n },\n {\n \"references.sales_order_number_detail\" => {\n :$ne => \"\" \n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByCustomerSONumber(),\n { :$sort => {:booking => -1}},\n { :$limit => 10 }\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggQryTopDeals(aggregateQuery, bookingColl)\n doc[:topDeals] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:topDeals] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Billed Customers\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n matchObj[:$match][:$and] = [\n {\n \"names.customer.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupByCustomers(),\n ]\n if !matchObj.nil?\n returnedObj = keyValuePairByAggQryBilled(aggregateQuery, bookingColl, 'customer')\n doc[:billedCustomers] = {\n :xAxis => returnedObj[:key],\n :yAxis => returnedObj[:value]\n }\n else\n doc[:billedCustomers] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n\n\n\n # Repeat/New & Dormant Customers \n if fiscal_quarter.nil? && fiscal_month.nil? && fiscal_week.nil?\n #if (false)\n prevYear1 = fiscal_year.to_i - 1\n matchObj2 = Marshal.load(Marshal.dump(matchObj))\n matchObj2[:$match][\"periods.year\"] = prevYear1.to_s\n matchObj2[:$match].delete(\"periods.quarter\")\n matchObj2[:$match].delete(\"periods.month\")\n matchObj2[:$match].delete(\"periods.week\")\n\n prevYear2 = fiscal_year.to_i - 2\n prevYear3 = fiscal_year.to_i - 3\n puts \"Prev -1: #{prevYear1}, Prev - 2: #{prevYear2}, Prev - 3: #{prevYear3}\"\n matchObj3 = Marshal.load(Marshal.dump(matchObj2))\n matchObj3[:$match].delete(\"periods.year\")\n matchObj3[:$match][:$or] = [\n { \"periods.year\" => prevYear1.to_s },\n { \"periods.year\" => prevYear2.to_s },\n { \"periods.year\" => prevYear3.to_s },\n ]\n\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByCustomer(),\n ]\n aggregateQuery2 = [\n matchObj2,\n dsObj.groupBookingByCustomer(),\n ]\n aggregateQuery3 = [\n matchObj3,\n dsObj.groupBookingByCustomer(),\n ]\n aggregateQueries = {\n :query1 => aggregateQuery,\n :query2 => aggregateQuery2,\n :query3 => aggregateQuery3,\n }\n if !matchObj.nil?\n returnedObj = keyValuePairByAggQryRepeatNew(aggregateQueries, bookingColl, 'customer')\n doc[:newAccounts] = {\n :xAxis => returnedObj[:obj1][:key],\n :yAxis0 => returnedObj[:obj1][:val],\n :yAxis => returnedObj[:obj1][:value],\n :yAxis2 => returnedObj[:obj1][:value2],\n :yAxis3 => returnedObj[:obj1][:value3],\n :yAxis4 => returnedObj[:obj2][:value2],\n :yAxis5 => returnedObj[:obj2][:value3],\n }\n doc[:repeatAccounts] = {\n :xAxis => returnedObj[:obj2][:key],\n :yAxis0 => returnedObj[:obj2][:val],\n :yAxis => returnedObj[:obj2][:value],\n :yAxis2 => returnedObj[:obj1][:value4],\n :yAxis3 => returnedObj[:obj1][:value5],\n :yAxis4 => returnedObj[:obj2][:value4],\n :yAxis5 => returnedObj[:obj2][:value5],\n }\n doc[:dormantAccounts] = {\n :xAxis => returnedObj[:obj3][:key],\n :yAxis0 => returnedObj[:obj3][:val],\n :yAxis => returnedObj[:obj3][:value],\n :yAxis2 => returnedObj[:obj3][:value2],\n :yAxis3 => returnedObj[:obj3][:value3],\n :yAxis4 => returnedObj[:obj3][:value4],\n :yAxis5 => returnedObj[:obj3][:value5],\n :yAxis6 => returnedObj[:obj3][:value6],\n }\n else\n doc[:newAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n } \n doc[:repeatAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n } \n doc[:dormantAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n :yAxis5 => [],\n :yAxis6 => [],\n } \n end # End of If condition\n else\n doc[:newAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n } \n doc[:repeatAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n } \n doc[:dormantAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n :yAxis5 => [],\n :yAxis6 => [],\n } \n end # End of checking whether the period criteria is for only YTD \n\n\n # Billed Partners\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n matchObj[:$match][:$and] = [\n {\n \"names.partner.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupByPartners(),\n ]\n if !matchObj.nil?\n returnedObj = keyValuePairByAggQryBilled(aggregateQuery, bookingColl, 'partner')\n doc[:billedPartners] = {\n :xAxis => returnedObj[:key],\n :yAxis => returnedObj[:value]\n }\n else\n doc[:billedPartners] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n\n # Technology Penetration\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n matchObj[:$match][:$and] = [\n {\n \"names.customer.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByCustomerTechnologies(),\n ]\n if !matchObj.nil?\n returnedObj = keyValuePairByAggQryTechPenetration(aggregateQuery, bookingColl)\n doc[:techPenetration] = {\n :xAxis => returnedObj[:key],\n :yAxis => returnedObj[:value],\n :yAxis2 => [ScalarCalculators.calculateRatio(doc[:tdBooking][:yAxis][0],returnedObj[:value][0]).to_f*THOUSAND]\n }\n else\n doc[:techPenetration] = {\n :xAxis => [],\n :yAxis => [],\n :yAxis2 => []\n } \n end # End of If condition\n\n\n # QoQ Booking\n tempQuarter = nil\n tempMonth = nil\n tempWeek = nil\n matchObj = dsObj.matchByMultipleParams(fiscal_year, tempQuarter, tempMonth, tempWeek, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByQoQ(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:qoqBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:qoqBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # MoM Booking\n tempMonth = nil\n tempWeek = nil\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, tempMonth, tempWeek, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByMoM(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:momBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:momBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # WoW Booking\n tempWeek = nil\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, tempWeek, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByWoW(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:wowBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:wowBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Product Service Booking\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByProductService()\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:prodSerBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:prodSerBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Average Discount of Archs\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingNetAndListByArchs()\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggQryDiscount(aggregateQuery, bookingColl)\n doc[:disArchsBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value],\n :yAxis2 => bookingObj[:value2],\n :yAxis3 => bookingObj[:value3],\n }\n else\n doc[:disArchsBooking] = {\n :xAxis => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n } \n end # End of If condition\n\n # Average Discount of Overall \n aggregateQuery = [\n matchObj,\n dsObj.groupExclusiveBookingNetAndList(),\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggQryDiscount(aggregateQuery, bookingColl)\n doc[:disAllBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value],\n :yAxis2 => bookingObj[:value2],\n :yAxis3 => bookingObj[:value3],\n }\n else\n doc[:disAllBooking] = {\n :xAxis => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n } \n end # End of If condition\n\n # Booking History\n tempYear = nil\n matchObj = dsObj.matchByMultipleParams(tempYear, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n #ap matchObj\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByHistory(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingHistoryObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n #ap bookingHistoryObj\n doc[:bookingHistory] = {\n :xAxis => bookingHistoryObj[:key],\n :yAxis => bookingHistoryObj[:value]\n }\n else\n doc[:bookingHistory] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Yield Per Customer\n if !doc[:tdBooking][:yAxis].empty?\n doc[:yieldPerCustomer] = {\n :xAxis => [doc[:billedCustomers][:xAxis]],\n :yAxis => [ScalarCalculators.calculateRatio(doc[:tdBooking][:yAxis][0],doc[:billedCustomers][:yAxis][0]).to_f*THOUSAND] \n }\n else\n doc[:yieldPerCustomer] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n if !doc[:tdBooking][:yAxis].empty?\n puts \"Initializing mongo insertion for #{user_name} | #{fiscal_year} | #{fiscal_quarter} | #{fiscal_month} | #{fiscal_week}\"\n id = mongoEng.insertDocument(gdColl, doc) \n puts \"#{user_name} | #{fiscal_year} | #{fiscal_quarter} | #{fiscal_month} | #{fiscal_week} - insertion ID: #{id}\"\n end # End of if condition checking if there is any data\n #ap doc\n #puts \"#{doc}\"\n end",
"def report\n \n end",
"def generate_document_structure; build_document_hash end",
"def reporting\n # STUB\n end",
"def request_doc\n \n end",
"def write_to(doc);end",
"def generate_solr_document\n super.tap do |solr_doc|\n solr_doc['top_level_bsi'] = object.in_works_ids.blank?\n solr_doc[Rdr::Index::Fields.in_works_ids] = object.in_works_ids\n end\n end",
"def index\n @requested_sales_documents = RequestedSalesDocument.all\n end",
"def index\n if params[:event_id] && Event.where(id: params[:event_id]).count > 0\n @event = Event.find(params[:event_id])\n @documents = @event.documents\n @descriptor = @event.name\n elsif params[:tag]\n @documents = Document.with_event.tagged_with(params[:tag])\n @descriptor = params[:tag]\n else\n @documents = Document.with_event\n @descriptor = \"All\"\n # @tags = tag_cloud\n end\n end",
"def generate_solr_document\n super.tap do |solr_doc|\n solr_doc['year_iim'] = extract_years(object.date_created)\n end\n end",
"def extract_events(document, aggregate_id); end",
"def solr_during_indexing\n {\n \"has_model_ssim\" => [\"Collection\"],\n :id => object.id,\n \"title_tesim\" => [object.title.first.to_s],\n \"title_sim\" => [object.title.first.to_s],\n \"collection_type_gid_ssim\" => [object.collection_type_gid],\n \"ark_ssi\" => object.ark,\n \"ursus_id_ssi\" => Californica::IdGenerator.blacklight_id_from_ark(object.ark),\n \"member_ids_ssim\" => [],\n \"object_ids_ssim\" => [],\n \"member_of_collection_ids_ssim\" => [], \"collection_ids_ssim\" => [],\n \"generic_type_sim\" => [\"Collection\"],\n \"bytes_lts\" => 0,\n \"visibility_ssi\" => \"restricted\"\n }\n end",
"def analyse\n call_data_service\n end",
"def manip\n d = Document.find(params[:id])\n colname = params[:manip_colname]\n @document = Document.create(\n :name => \"#{d.name}_manip\", \n :collection => d.collection,\n :stuffing_data => get_data_map(d, colname))\n \n @sdata = @document.stuffing_data\n @msdata = get_document_metadata(@document)\n \n current_page = params[:page]\n per_page = params[:per_page] # could be configurable or fixed in your app\n @paged_sdata = @sdata.paginate({:page => current_page, :per_page => 20}) \n \n chart = Chart.find_by_document_id(@document)\n @chart = chart || Chart.find(newchart({:document_id => @document}))\n \n render \"show\"\n end",
"def data \n @data \n @log.create_log_entry\n end",
"def create\n @document = Document.new(params[:document])\n @document.stuffing_data = []\n @document.user = current_user\n\n #Hack for now - add all column keys to primary keys for search\n @document.stuffing_primary_keys = get_data_colnames(@document.stuffing_data)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def document\n raise Datasource::MethodOverride.new(\"document method needs to be overridden\")\n end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def write_report\n\n end",
"def index\n day = Analytic.where(\"created_at > ?\", Time.now - 1.day).order(\"created_at DESC\")\n @analytics = {}\n @analytics[:projects] = Project.all.order(\"hits DESC\")\n @analytics[:ips] = day.distinct.pluck(:ip)\n @analytics[:visits] = day\n @analytics[:user_agents] = day.distinct.pluck(:user_agent)\n @analytics[:referers] = day.distinct.pluck(:referer)\n @analytics[:total] = Analytic.count\n @analytics[:day] = day.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @analytics, callback: params[:callback] }\n format.xml { render xml: @analytics }\n end\n end",
"def add_analytics_data(page_analytics_results)\n control = page_analytics_results.first\n treatments = page_analytics_results[1..-1]\n\n calculations = calculate_conversion_data(control, treatments)\n append_data_to_groups!(control, treatments, calculations)\n\n page_analytics_results\n end",
"def index\r\n @documents = Document.all\r\n @appoint_responsible = AppointResponsible.new\r\n end",
"def print_doc(data)\n print \"Documento #{data['id']} Status: #{data['status']} Nível do Sentimento: #{data['sentiment_score']} \\r\\n\"\n print 'Temas encontrados:', \"\\r\\n\"\n data['themes'].nil? or data['themes'].each do |theme|\n print ' ', theme['title'], ' (sentimento: ', theme['sentiment_score'], ')', \"\\r\\n\"\n end\n print 'Entidades encontradas:', \"\\r\\n\"\n data['entities'].nil? or data['entities'].each do |entity|\n print ' ', entity['title'], ' : ', entity['entity_type'], ' (sentimento: ', entity['sentiment_score'], ')', \"\\r\\n\"\n end\n\n print 'Categorias:', \"\\r\\n\"\n data['auto_categories'].nil? or data['auto_categories'].each do |entity|\n print ' ', entity['title'], ' : ', entity['type'], ' (Força: ', entity['strength_score'], ')', \"\\r\\n\"\n\n print 'Subcategorias:', \"\\r\\n\"\n data['categories'].nil? or data['categories'].each do |c|\n print ' ', c['title'], ' : ', entity['type'], ' (Força: ', entity['strength_score'], ')', \"\\r\\n\"\n end\n end\n\n print \"\\r\\n\"\n end",
"def generate_doc\n\n end",
"def report\n\t\tend",
"def as_elasticsearch\n elasticsearch_doc = super\n [:mime_type,:content_type,:file_type,:storage_location_id,:file_size,:file_entity_type,:file_name].each do |method|\n elasticsearch_doc[method.to_s] = self.send(method)\n end\n elasticsearch_doc\n end",
"def create_new_ingest_payload( xml_doc )\n\n\n payload = {}\n\n #\n # add all the required fields\n #\n\n # creation date\n payload[ :create_date ] = CurationConcerns::TimeService.time_in_utc.strftime( \"%Y-%m-%d\" )\n\n # document title\n node = xml_doc.css( 'mods titleInfo title' ).first\n title = node.text if node\n payload[ :title ] = title if title.present?\n\n # document abstract\n node = xml_doc.css( 'mods abstract' ).first\n abstract = node.text if node\n payload[ :abstract ] = abstract if IngestHelpers.field_supplied( abstract )\n\n # document author\n found = false\n name_nodes = xml_doc.css( 'mods name' )\n name_nodes.each do |nn|\n nodes = nn.css( 'roleTerm' )\n nodes.each do |rt|\n if rt.get( 'type' ) == 'text' && rt.text == 'author'\n found = true\n break\n end\n end\n if found\n #puts \"Found AUTHOR\"\n fn, ln, dept = '', '', ''\n\n nodes = nn.css( 'namePart' )\n nodes.each do |np|\n case np.get( 'type' )\n when 'given'\n fn = np.text.chomp( ',' ) # remove a trailing comma\n when 'family'\n ln = np.text\n end\n end\n\n node = nn.css( 'description' ).first\n dept = node.text if node\n\n payload[ :author_first_name ] = fn if IngestHelpers.field_supplied( fn )\n payload[ :author_last_name ] = ln if IngestHelpers.field_supplied( ln )\n payload[ :department ] = dept if IngestHelpers.field_supplied( dept )\n break\n end\n end\n\n # issue date\n node = xml_doc.css( 'mods dateIssued' ).first\n issued_date = node.text if node\n payload[ :issued ] = issued_date if issued_date.present?\n\n # embargo attributes\n #embargo_type = solr_doc.at_path( 'release_to_t[0]' )\n #payload[ :embargo_type ] = embargo_type if embargo_type.present?\n #release_date = solr_doc.at_path( 'embargo_embargo_release_date_t[0]' )\n #payload[ :embargo_release_date ] = release_date if release_date.present?\n #payload[ :embargo_period ] =\n # IngestHelpers.estimate_embargo_period( issued_date, release_date ) if issued_date.present? && release_date.present?\n\n # document source\n node = xml_doc.css( 'mods identifier' ).first\n source = node.text if node\n # the space is there for a reason... SOLR stuff, dont ask!!\n payload[ :source ] = \"#{GenericWork::THESIS_SOURCE_INGEST} :#{source}\" if source.present?\n\n #\n # handle optional fields\n #\n\n # degree program\n node = xml_doc.css( 'mods degree level' ).first\n degree = node.text if node\n payload[ :degree ] = degree if degree.present?\n\n # keywords\n keywords = []\n topic_nodes = xml_doc.css( 'mods topic' )\n topic_nodes.each do |tn|\n kwtext = tn.text\n next if kwtext == 'JTIngest'\n kwords = kwtext.split( ' -- ' )\n kwords.each do |kw|\n w = kw.chomp( ',' ) # remove a trailing comma if present\n keywords << w unless keywords.include?( w )\n end\n end\n payload[ :keywords ] = keywords unless keywords.empty?\n\n # language\n node = xml_doc.css( 'mods language' ).first\n language = node.text if node\n payload[ :language ] = IngestHelpers.language_code_lookup( language ) if language.present?\n\n # notes\n node = xml_doc.css( 'mods note' ).first\n notes = node.text if node\n payload[ :notes ] = notes if notes.present?\n\n return payload\n end",
"def index\n @reference_analytics = ReferenceAnalytic.all\n end",
"def index\n @ga_data = GaDatum.all\n end",
"def document\n self\n end",
"def document\n self\n end",
"def document(rules)\n return {\n 'title' => 'From csv key map; Generated at ' + Time.now.to_s,\n 'rules' => rules\n }\nend",
"def base_doc\n @base_doc ||= (\n doc = {\n :format_code_t => 'ead',\n :format_facet => 'Archival Collection Guide',\n :filename_t => @base_filename,\n \n #:unittitle_t => (\n # @xml.at('//archdesc[@level=\"collection\"]/did/unittitle').text rescue\n # @xml.at('//archdesc/did/unittitle').text rescue\n # 'Untitled'\n #),\n \n :institution_t => @xml.at('//publicationstmt/publisher/text()[1]').text.gsub(/\\s+/,\" \").strip,\n :institution_facet => @xml.at('//repository//corpname').children.first.text.gsub(/\\s+/,\" \").strip,\n :language_facet => self.languages,\n :rights_facet => self.rights_facet, \n :rights_t => self.rights_text,\n :hierarchy_scope => self.collection_id,\n :collapse_collection_id => self.collection_id,\n :collection_id => self.collection_id,\n :collection_facet => \"Northwest Digital Archives EAD Guides\",\n :availability_facet => \"Not online. Must visit contributing institution.\",\n :abstract_t => (@xml.at('//archdesc/did/abstract').text rescue nil),\n :text => []\n \n }\n \n # write values to :text to make them searchable\n # NOTE: isn't this already happening via copyField in the solr schema?\n doc[:text] << doc[:title_t] << doc[:institution_t] << doc[:collection_facet]\n \n doc\n )\n end",
"def count; info['doc_count']; end",
"def clinical_document(pat, visit, doc_type)\n\t\tcdoc = ClinicalDocument.new()\n\t\tcdoc.patient = pat.summary\n\t\tcdoc.visit = visit.summary\n cdoc.remote_id = 23\n\t\tcdoc.type_info = doc_type.summary #.info #{type_id: doc_type.id, type_code: doc_type.code, class_id: doc_type.document_class[:id], class_code: doc_type.document_class[:code]}\n\t\tcdoc.save\n\t\t# dv = DocumentVersion.new\n\t\t# dv.clinical_document_id = cdoc.id\n\t\t# dv.version_number = 1\n\t\t# dv.save\n\t\tcdoc\n\tend",
"def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"count_of_table_sid_by_field_sid\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = AccessReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end",
"def document\n @_data ||= OpenStruct.new(@_renderer.data)\n end",
"def data\n @data ||= doc.data.dup\n @data.delete(\"layout\")\n @data.delete(\"excerpt\")\n @data\n end",
"def process!(document); end",
"def get_demographics(patient, doc)\n patient['first'] = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:patient/cda:name/cda:given').text\n patient['last'] = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:patient/cda:name/cda:family').text\n birthdate_in_hl7ts_node = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:patient/cda:birthTime')\n birthdate_in_hl7ts = birthdate_in_hl7ts_node['value']\n patient['birthdate'] = HL7Helper.timestamp_to_integer(birthdate_in_hl7ts)\n gender_node = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:patient/cda:administrativeGenderCode')\n patient['gender'] = gender_node['code']\n race_node = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:patient/cda:raceCode')\n patient['race'] = race_node['code'] if race_node\n ethnicity_node = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:patient/cda:ethnicGroupCode')\n patient['ethnicity'] = ethnicity_node['code'] if ethnicity_node\n\n languages = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:patient').search('languageCommunication').map {|lc| lc.at_xpath('cda:languageCode')['code'] }\n patient['languages'] = languages unless languages.empty?\n \n id_node = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:id')\n patient['patient_id'] = id_node['extension']\n end",
"def generate_solr_document\n super.tap do |solr_doc|\n \n # other title\n solr_doc[Solrizer.solr_name('other_title', :stored_searchable)] = object.other_title.map { |r| r.title.first }\n solr_doc[Solrizer.solr_name('other_title', :displayable)] = object.other_title.to_json \n\n # work review process\n # solr_doc[Solrizer.solr_name('work_review_process', :stored_searchable)] = object.work_review_process.map{ |r| r.status.first }\n # solr_doc[Solrizer.solr_name('work_review_process', :displayable)] = object.work_review_process.to_json\n\n # reviewers\n solr_doc[Solrizer.solr_name('reviewers', :stored_searchable)] = object.reviewers.map { |r| r.reviewer.first }\n solr_doc[Solrizer.solr_name('reviewers', :displayable)] = object.reviewers.to_json\n\n # identifiers\n solr_doc[Solrizer.solr_name('identifier_nested', :symbol)] = object.identifier_nested.map { |i| i.obj_id.first }\n solr_doc[Solrizer.solr_name('identifier_nested', :displayable)] = object.identifier_nested.to_json\n object.identifier_nested.each do |i|\n unless (i.obj_id_scheme.first.blank? or i.obj_id.first.blank?)\n solr_doc[Solrizer.solr_name(\"identifier_#{i.obj_id_scheme.first.downcase}\", :symbol)] = i.obj_id.reject(&:blank?)\n end\n end\n\n # creator\n creators = object.creator_nested.map { |cr| (cr.name + cr.orcid).reject(&:blank?).join(' ') }\n solr_doc[Solrizer.solr_name('creator_nested', :facetable)] = creators\n solr_doc[Solrizer.solr_name('creator_nested', :stored_searchable)] = creators\n solr_doc[Solrizer.solr_name('creator_nested', :displayable)] = object.creator_nested.to_json\n \n # contributor\n # contributors = object.contributor_nested.map { |cr| (cr.contributor_first_name + cr.contributor_last_name).reject(&:blank?).join(' ') }\n # solr_doc[Solrizer.solr_name('contributor_nested', :facetable)] = contributors\n # solr_doc[Solrizer.solr_name('contributor_nested', :stored_searchable)] = contributors\n # solr_doc[Solrizer.solr_name('contributor_nested', :displayable)] = object.contributor_nested.to_json\n\n # date\n # solr_doc[Solrizer.solr_name('date_nested', :stored_searchable)] = object.date_nested.map { |s| s.date.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('date_nested', :facetable)] = object.date_nested.map { |s| s.date.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('date_nested', :displayable)] = object.date_nested.to_json\n\n # subject\n solr_doc[Solrizer.solr_name('subject_nested', :stored_searchable)] = object.subject_nested.map { |s| s.subject.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('subject_nested', :facetable)] = object.subject_nested.map { |s| s.subject.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('subject_nested', :displayable)] = object.subject_nested.to_json\n \n # #alternate identifier\n # solr_doc[Solrizer.solr_name('alt_identifier_nested', :stored_searchable)] = object.alt_identifier_nested.map { |s| s.alt_identifier.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('alt_identifier_nested', :facetable)] = object.alt_identifier_nested.map { |s| s.alt_identifier.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('alt_identifier_nested', :displayable)] = object.alt_identifier_nested.to_json\n\n #alternate identifier\n solr_doc[Solrizer.solr_name('related_identifier_nested', :stored_searchable)] = object.related_identifier_nested.map { |s| s.related_identifier.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('related_identifier_nested', :facetable)] = object.related_identifier_nested.map { |s| s.related_identifier.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('related_identifier_nested', :displayable)] = object.related_identifier_nested.to_json\n\n # #rights\n # solr_doc[Solrizer.solr_name('rights_nested', :stored_searchable)] = object.rights_nested.map { |s| s.rights.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('rights_nested', :facetable)] = object.rights_nested.map { |s| s.rights.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('rights_nested', :displayable)] = object.rights_nested.to_json\n\n #description\n solr_doc[Solrizer.solr_name('description_nested', :stored_searchable)] = object.description_nested.map { |s| s.description.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('description_nested', :facetable)] = object.description_nested.map { |s| s.description.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('description_nested', :displayable)] = object.description_nested.to_json\n\n #funding\n solr_doc[Solrizer.solr_name('funding_nested', :stored_searchable)] = object.funding_nested.map { |s| s.funding_reference.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('funding_nested', :facetable)] = object.funding_nested.map { |s| s.funding_reference.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('funding_nested', :displayable)] = object.funding_nested.to_json \n\n #geolocation\n solr_doc[Solrizer.solr_name('geolocation_nested', :stored_searchable)] = object.geolocation_nested.map { |s| s.geolocation.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('geolocation_nested', :facetable)] = object.geolocation_nested.map { |s| s.geolocation.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('geolocation_nested', :displayable)] = object.geolocation_nested.to_json\n\n end\n end",
"def document_summary_information\n @document_summary_information ||= create_document_summary_information\n end",
"def get_data(doc)\n snapshots = doc.xpath(\"//Cube[@time]\")\n snapshots.each do |snapshot|\n date_str = snapshot.attr(\"time\")\n date = Date.parse(date_str)\n last_date_processed(date)\n if (date <= @last_date_processed) || @last_date_processed.nil?\n output = {}\n snapshot.children.each do |rate|\n currency = rate.attr('currency')\n rate = rate.attr('rate')\n output[currency] = rate.to_f\n @context.options[:store][date] = output\n end\n end\n end\n end",
"def create_doc_records(proposal)\n\n #@field_delimiter = ',' # Delimiter for csv.\n EdiHelper.transform_log.write \"Transforming Hansa Carton Sales (HCS) for LoadOrder #{@record_map['id']}..\"\n\n # Get the LoadOrder\n begin\n load_order = LoadOrder.find(@record_map['id'])\n rescue ActiveRecord::RecordNotFound => error\n raise EdiOutError, \"#{@err_prefix} - LoadOrder with id #{@record_map['id']} not found.\"\n end\n\n # Get the Load\n begin\n ld = Load.find(@record_map['load_id'])\n rescue ActiveRecord::RecordNotFound => error\n raise EdiOutError, \"#{@err_prefix} - Load with id #{@record_map['load_id']} not found.\"\n end\n\n # Get the Order\n begin\n order = Order.find(@record_map['order_id'])\n rescue ActiveRecord::RecordNotFound => error\n raise EdiOutError, \"#{@err_prefix} - Order with id #{@record_map['order_id']} not found.\"\n end\n trading_partner = PartiesRole.find(order.consignee_party_role_id).party_name\n\n load_voyage = LoadVoyage.find_by_load_id(@record_map['load_id'])\n# raise EdiOutError, \"#{@err_prefix} - LoadVoyage with load_id #{@record_map['load_id']} not found.\" if load_voyage.nil?\n if load_voyage.nil?\n port_code = nil\n else\n port = VoyagePort.find(:first,\n :select => 'voyage_ports.*',\n :joins => 'join load_voyage_ports on load_voyage_ports.voyage_port_id = voyage_ports.id\n join voyage_port_types on voyage_port_types.id = voyage_ports.voyage_port_type_id',\n :conditions => ['load_voyage_ports.load_voyage_id = ? and UPPER(voyage_port_types.voyage_port_type_code) = ?',\n load_voyage.id, 'ARRIVAL'])\n raise EdiOutError, \"#{@err_prefix} - No VoyagePort for LoadVoyage with load_id #{@record_map['load_id']}.\" if port.nil?\n port_code = port.port_code\n end\n\n # ---------\n # BH record (heading)\n # ---------\n # Headings are provided by the schema's defaults. No need to set values here.\n rec_set = HierarchicalRecordSet.new({}, 'BH')\n\n # ----------\n # HCS record\n # ----------\n\n load_orders = LoadOrder.find(:all,\n\n:select => 'cartons.carton_number, pallets.pallet_number, cartons.target_market_code, cartons.farm_code, pallets.consignment_note_number,\nload_orders.dispatch_consignment_number, cartons.carton_fruit_nett_mass, cartons.track_indicator_code, load_containers.container_code,\nvoyages.vessel_code, voyages.voyage_code, vessels.vessel_registration_number, cartons.season_code, cartons.organization_code,\ncartons.sell_by_code, load_details.id load_detail_id, cartons.grade_code, cartons.commodity_code, farms.farm_group_code,\nproduction_runs.parent_run_code, pallets.is_depot_pallet ,extended_fgs.id, fg_marks.ri_mark_code, fg_marks.ru_mark_code,\nfg_marks.fg_mark_code, fg_marks.tu_mark_code, extended_fgs.units_per_carton, extended_fgs.tu_gross_mass, extended_fgs.tu_nett_mass,\nextended_fgs.ri_diameter_range, unit_pack_products.unit_pack_product_code, carton_pack_products.carton_pack_product_code,\nitem_pack_products.marketing_variety_code, extended_fgs.ri_weight_range, extended_fgs.extended_fg_code,\nextended_fgs.ru_description AS extended_fg_ru_description, extended_fgs.old_fg_code, extended_fgs.marketing_org_code,\nextended_fgs.fg_code, treatments.treatment_type_code, treatments.description AS treatment_description,\ncarton_pack_styles.carton_pack_style_code, carton_pack_styles.description AS carton_pack_style_description,\nbasic_packs.basic_pack_code, basic_packs.short_code, basic_packs.length, basic_packs.width AS basic_pack_width,\nbasic_packs.height AS basic_pack_height, carton_pack_types.type_code AS carton_pack_type_type_code,\ncarton_pack_types.description AS carton_pack_type_description, carton_pack_products.height AS carton_pack_products_height,\ncarton_pack_products.type_code AS carton_pack_product_type_code, unit_pack_product_types.type_code AS unit_pack_product_type_type_code,\nunit_pack_product_types.description AS unit_pack_product_type_description, unit_pack_product_subtypes.subtype_code,\nunit_pack_product_subtypes.description AS unit_pack_product_subtype_description,\nunit_pack_products.nett_mass AS unit_pack_product_nett_mass, commodities.commodity_code, commodities.commodity_description_long,\ncommodities.commodity_description_short, marketing_varieties.marketing_variety_description, item_pack_products.grade_code,\nitem_pack_products.product_class_code, item_pack_products.standard_size_count_value, item_pack_products.size_ref,\nitem_pack_products.cosmetic_code_name, item_pack_products.treatment_code, item_pack_products.actual_count,\nextended_fgs.created_on, extended_fgs.updated_on,rmt_setups.variety_code,incoterms.incoterm_code,currencies.currency_code, order_products.price_per_carton',\n\n:joins => 'INNER JOIN load_details ON (load_orders.load_id = load_details.load_id)\nINNER JOIN pallets ON (load_details.id = pallets.load_detail_id)\nINNER JOIN cartons ON (pallets.id = cartons.pallet_id)\nINNER JOIN production_runs ON cartons.production_run_code = production_runs.production_run_code\nINNER JOIN production_schedules ON production_runs.production_schedule_id = production_schedules.id\nINNER JOIN rmt_setups ON production_schedules.id = rmt_setups.production_schedule_id\nINNER JOIN extended_fgs ON (cartons.extended_fg_code = extended_fgs.extended_fg_code)\nINNER JOIN fg_products ON (extended_fgs.fg_code = fg_products.fg_product_code)\nINNER JOIN item_pack_products ON (fg_products.item_pack_product_code = item_pack_products.item_pack_product_code)\nLEFT JOIN order_products ON (item_pack_products.item_pack_product_code = order_products.item_pack_product_code) and order_products.old_fg_code = extended_fgs.old_fg_code and order_products.order_id=load_details.order_id\nINNER JOIN unit_pack_products ON (fg_products.unit_pack_product_code = unit_pack_products.unit_pack_product_code)\nINNER JOIN carton_pack_products ON (fg_products.carton_pack_product_code = carton_pack_products.carton_pack_product_code)\nINNER JOIN fg_marks ON (extended_fgs.fg_mark_code = fg_marks.fg_mark_code)\nINNER JOIN treatments ON (item_pack_products.treatment_id = treatments.id)\nINNER JOIN carton_pack_styles ON (carton_pack_products.carton_pack_style_code = carton_pack_styles.carton_pack_style_code)\nINNER JOIN basic_packs ON (carton_pack_products.basic_pack_code = basic_packs.basic_pack_code)\nINNER JOIN commodities ON (item_pack_products.commodity_code = commodities.commodity_code)\nINNER JOIN marketing_varieties ON (item_pack_products.marketing_variety_code = marketing_varieties.marketing_variety_code)\nAND (item_pack_products.marketing_variety_id = marketing_varieties.id)\nINNER JOIN carton_pack_types ON (carton_pack_products.type_code = carton_pack_types.type_code)\nAND (carton_pack_products.carton_pack_type_id = carton_pack_types.id)\nINNER JOIN farms ON (cartons.farm_code = farms.farm_code)\nLEFT OUTER JOIN load_containers ON (load_orders.load_id = load_containers.load_id)\nLEFT OUTER JOIN load_voyages ON (load_orders.load_id = load_voyages.load_id)\nINNER JOIN orders ON (load_orders.order_id = orders.id)\nLEFT OUTER JOIN currencies ON (orders.currency_id = currencies.id)\nLEFT OUTER JOIN incoterms ON (orders.incoterm_id = incoterms.id)\nLEFT OUTER JOIN voyages ON (load_voyages.voyage_id = voyages.id)\nLEFT OUTER JOIN vessels ON (vessels.id = voyages.vessel_id)\nINNER JOIN unit_pack_product_types ON (unit_pack_products.type_code = unit_pack_product_types.type_code)\nINNER JOIN unit_pack_product_subtypes ON (unit_pack_products.subtype_code = unit_pack_product_subtypes.subtype_code)',\n\n:conditions => ['load_orders.id = ?', @record_map['id']])\n\n\n load_orders.each do |record|\n ucr = \"#{record.season_code[-1,1]}ZA01507472C#{trading_partner}\"\n\n count_array = LoadDetail.find_by_sql(['select count(cartons.id) FROM load_details join pallets on pallets.load_detail_id = load_details.id join cartons on cartons.pallet_id = pallets.id WHERE (load_details.id = ?)', record.load_detail_id])\n no_cartons = count_array[0].count\n #sell_by = no_cartons == 1 ? 'ndc' : record.sell_by_code\n #sell_by = record.sell_by_code == '-' ? 'ndc' : record.sell_by_code\n sell_by = record.sell_by_code == '-' ? 'ndc' : 'dc'\n\n line_type = record.is_depot_pallet == 't' ? 'Class1' : record.parent_run_code.nil? ? 'Class1': 'Class2'\n\n if record.is_depot_pallet == 't'\n account_code = 'DEPOT'\n # intake_header = IntakeHeadersProduction.find(:first,\n # :conditions => ['consignment_note_number = ?',\n # record.consignment_note_number])\n else\n intake_header = IntakeHeadersProduction.find(:first,\n :conditions => ['consignment_note_number = ?',\n record.consignment_note_number])\n account_code = intake_header.account_code\n end\n\n hcs_rec = HierarchicalRecordSet.new({\n 'carton_id' => record.carton_number,\n 'pallet_id' => record.pallet_number,\n 'tradingpartner' => trading_partner,\n 'extended_fg_code' => record.extended_fg_code,\n 'target_market' => record.target_market_code,\n 'load_no' => ld.load_number,\n 'grower_id' => record.farm_code,\n 'intake_consignment_id' => record.consignment_note_number,\n 'exit_reference' => record.dispatch_consignment_number,\n 'weight' => record.carton_fruit_nett_mass,\n 'raw_material_type' => record.track_indicator_code,\n 'remarks' => order.order_customer_detail.customer_order_number,\n 'container' => record.container_code,\n 'vessel_name' => record.vessel_code,\n 'voyage_no' => record.voyage_code,\n 'customerpono' => order.order_customer_detail.customer_order_number,\n 'ucr' => ucr,\n 'sell_by_code' => sell_by,\n 'fg_code' => record.fg_code,\n 'fg_mark_code' => record.fg_mark_code,\n 'units_per_carton' => record.units_per_carton,\n 'tu_gross_mass' => record.tu_gross_mass,\n 'tu_nett_mass' => record.tu_nett_mass,\n 'ri_diameter_range' => record.ri_diameter_range,\n 'ri_weight_range' => record.ri_weight_range,\n 'ru_description' => record.extended_fg_ru_description,\n 'old_fg_code' => record.old_fg_code,\n 'marketing_org_code' => record.organization_code,\n 'grade_code' => record.grade_code,\n 'standard_size_count_value' => record.standard_size_count_value,\n 'commodity_code' => record.commodity_code,\n 'ri_mark_code' => record.ri_mark_code,\n 'ru_mark_code' => record.ru_mark_code,\n 'tu_mark_code' => record.tu_mark_code,\n 'unit_pack_product_code' => record.unit_pack_product_code,\n 'carton_pack_product_code' => record.carton_pack_product_code,\n 'marketing_variety_code' => record.marketing_variety_code,\n 'extended_fg_ru_description' => record.extended_fg_ru_description,\n 'treatment_type_code' => record.treatment_type_code,\n 'treatment_description' => record.treatment_description,\n 'carton_pack_style_code' => record.carton_pack_style_code,\n 'carton_pack_style_description' => record.carton_pack_style_description,\n 'basic_pack_code' => record.basic_pack_code,\n 'short_code' => record.short_code,\n 'length' => record.length,\n 'basic_pack_width' => record.basic_pack_width,\n 'basic_pack_height' => record.basic_pack_height,\n 'carton_pack_type_type_code' => record.carton_pack_type_type_code,\n 'carton_pack_type_description' => record.carton_pack_type_description,\n 'carton_pack_products_height' => record.carton_pack_products_height,\n 'carton_pack_product_type_code' => record.carton_pack_product_type_code,\n 'unit_pack_product_type_type_code' => record.unit_pack_product_type_type_code,\n 'unit_pack_product_type_description' => record.unit_pack_product_type_description,\n 'subtype_code' => record.subtype_code,\n 'unit_pack_product_subtype_description' => record.unit_pack_product_subtype_description,\n 'unit_pack_product_nett_mass' => record.unit_pack_product_nett_mass,\n 'commodity_description_long' => record.commodity_description_long,\n 'commodity_description_short' => record.commodity_description_short,\n 'marketing_variety_description' => record.marketing_variety_description,\n 'product_class_code' => record.product_class_code,\n 'size_ref' => record.size_ref,\n 'cosmetic_code_name' => record.cosmetic_code_name,\n 'treatment_code' => record.treatment_code,\n 'actual_count' => record.actual_count,\n 'hansaworld' => trading_partner,\n 'account' => account_code,\n 'farmsubgroup' => record.farm_group_code,\n 'farmgroup' => record.farm_group_code,\n 'depot_indicator' => record.is_depot_pallet == 't' ? 'Depot' : 'Packed_at_Kromco',\n 'season' => record.season_code,\n 'linetypedesc' => line_type,\n 'port_of_destination' => port_code,\n 'cultivar' => record.variety_code,\n 'incoterm' => record.incoterm_code,\n 'currency' => record.currency_code,\n 'carton_price' => record.price_per_carton\n\t\t}, 'HCS')\n rec_set.add_child hcs_rec\n end\n\n rec_set\n end",
"def get_doc \n @doc\n end",
"def solr_document\n document\n end",
"def document\n { _id: id, _t: time, _d: body }.compact\n end",
"def site_data; end",
"def generate_solr_document\n super.tap do |solr_doc|\n index_suppressed(solr_doc)\n index_workflow_fields(solr_doc)\n end\n end",
"def documents\n # This function and its helpers are side-effecty for speed\n @documents ||= raw[:hits][:hits].map do |hit|\n doc = extract_source(hit)\n copy_underscores(hit, doc)\n copy_highlight(hit, doc)\n doc\n end\n end",
"def get_document_data(doc)\n d = []\n begin\n d = doc.stuffing_data\n rescue\n log_and_print \"WARN: get_document_data threw an unknown exception\"\n d = []\n end\n \n return d\n end",
"def show\n query = \"SELECT date_trunc('month', created_at) as label, COUNT(*) AS value FROM form_chagas where form_chagas.created_at>='2016-01-01 00:00:00' and form_chagas.created_at<='2016-12-12 24:00:00' GROUP BY 1 ORDER BY label ASC\"\n @reporte_mensual_chagas = Paciente.find_by_sql(query)\n gon.query = query\n gon.reporte_mensual_chagas = @reporte_mensual_chagas\n respond_to do |format|\n format.html\n format.pdf do\n render :pdf => \"file_name\",\n :layout => 'pdf.html.erb',\n :page_size => 'Letter',\n :footer => {:right => '[page] de [topage]', :font_size => 7}\n end\n end\n end",
"def document_params\n params.require(:document).permit(:project_id, :did, :user_updated_at, :tool_updated_at, :annotations_count)\n end",
"def get_article_data(yesterday, view_id, domain_id, article_key)\n\t\t\n\t\tdate_range = @analytics::DateRange.new(start_date: yesterday, end_date: yesterday)\n\t\torder_by = @analytics::OrderBy.new(field_name: 'ga:pageviews', sort_order: 'DESCENDING')\n\t\tmetric = @analytics::Metric.new(expression: 'ga:pageviews')\n\n\t\tdimensions = ['ga:pageTitle', 'ga:pagePath']\n\t\tdimension_type = Array.new\n\t\tdimensions.each do |d|\n\t\t\tdimension = @analytics::Dimension.new\n\t\t\tdimension.name = d\n\t\t\tdimension_type.push(dimension)\n\t\tend\n\n\t\trequest = @analytics::GetReportsRequest.new(\n \t\t\treport_requests: [@analytics::ReportRequest.new(\n \t\t\tview_id: view_id,\n \t\t\tdimensions: dimension_type,\n \t\t\tmetrics: [metric], \n \t\t\t# dimension_filter_clauses: [dimension_filters],\n \t\t\t# dimensions: [dimension], \n \t\t\tdate_ranges: [date_range],\n \t\t\torder_bys: [order_by],\n \t\t\tpage_size: 100_000\n \t\t\t)]\n\t\t)\n\t\tresponse = @client.batch_get_reports(request)\n\t\tmessageHash = {}\n\n\t\t# handling error \n\t\tif !response.reports.first.data.rows then\n\t\t\treturn\n\t\tend\n\n\n\t\tdata_from_google = response.reports.first.data.rows\n\n\t\t# max_position_array = get_max_position(yesterday, view_id)\n\t\t\n\t\tset_ga_data_array = Array.new\n\n\t\t\n\t\tdata_from_google.each_with_index do |r, index|\n\n\t\t\tdatahash = {}\n\t\t\t\n\t\t\t# domain_id\n\t\t\tdatahash['domain_id'] = domain_id\n\n\t\t\t# dimensions = ['ga:pageTitle', 'ga:pagePath']\n\n\t\t\tdatahash['article_title'] = r.dimensions[0]\n\n\t\t\turls_rm_params = r.dimensions[1].split(/\\?/)[0]\n\n\t\t\tdatahash['article_url'] = urls_rm_params\n\n\t\t\t# total_events = 0\n\t\t\t# max_position = 1\n\t\t\t# mobile_device_info = ''\n\t\t\t# if max_position_array != nil\n\t\t\t# \tmax_arr = max_position_array.select{|max| max['article_url'] == r.dimensions[1]}\n\t\t\t# \tif !max_arr.empty?\n\t\t\t# \t\tmax_arr.each do |a|\n\t\t\t# \t\t\tif a['total_events'] > total_events\n\n\t\t\t# \t\t\t\ttotal_events = a['total_events']\n\t\t\t# \t\t\t\tmobile_device_info = a['mobileDeviceInfo']\n\t\t\t# \t\t\t\tmax_position = a['max_position']\n\n\t\t\t# \t\t\telsif a['total_events'] == total_events && a['mobileDeviceInfo'] == 'Apple iPhone'\n\n\t\t\t# \t\t\t\tif mobile_device_info == 'Apple iPhone' && a['max_position'] > max_position\n\t\t\t# \t\t\t\t\tmax_position = a['max_position']\n\t\t\t# \t\t\t\telsif mobile_device_info != 'Apple iPhone'\n\t\t\t# \t\t\t\t\tmobile_device_info = a['mobileDeviceInfo']\n\t\t\t# \t\t\t\t\tmax_position = a['max_position']\n\t\t\t# \t\t\t\tend\n\n\t\t\t# \t\t\tend\n\t\t\t\t\t\t\t\n\t\t\t# \t\tend\n\t\t\t# \tend\n\n\t\t\t# \tdatahash[article_key[i]] = max_position\n\t\t\t# else \n\t\t\t# \tdatahash[article_key[i]] = 25000\n\t\t\t# end\n\n\t\t\tdatahash['max_position'] = 0\n\n\t\t\tset_ga_data_array.push(datahash)\n\t\tend\n\t\t\n\t\treturn set_ga_data_array\n\tend",
"def collect_report_data\n report_data = { }\n\n # Read log file\n uploaded_files = parse_logfile(@logfile)\n report_data['uploaded_files'] = uploaded_files\n\n # Find local files\n local_files = []\n Find.find(@html_dir) do |path|\n if FileTest.directory?(path)\n if File.basename(path)[0] == ?.\n Find.prune\n end\n else\n local_files << path.sub(@html_path,'')\n end\n end\n report_data['local_files'] = local_files\n\n\n # Count vortex document types\n file_type_counts = { }\n uploaded_files.each do |key, val|\n type, server_path = uploaded_files[key]\n file_type_counts[type] = file_type_counts[type].to_i + 1\n end\n report_data['file_type_counts'] = file_type_counts\n\n\n # Count file extensions and calculate filesize\n extensions = { }\n uploaded_files.each do |filename, info|\n\n # TODO Remove temporarliy hack for PGP:\n if(filename == \"http\")\n next\n end\n filename = filename.gsub(\"http://varme.uio.no/pgp/\",\"\")\n\n extension = filename[/([^\\.]*)$/].downcase\n extensions[extension] = [] if(not(extensions[extension]))\n count = extensions[extension][0].to_i\n filesize = extensions[extension][1].to_i\n extensions[extension][0] = count + 1\n if(not(File.exists?(@html_path.to_s + filename)))\n throw \"Unknown file : '\" + @html_path + filename + \"' =>\" + info.to_s\n end\n extensions[extension][1] = filesize + File.size(@html_path.to_s + filename)\n end\n report_data['extensions'] = extensions\n\n\n # Count file extensions and calculate filesize for unpublished files\n unpublished_files = []\n unpublished_files_extensions = { }\n local_files.each do |local_filename|\n if(not(uploaded_files[local_filename]))then\n unpublished_files << local_filename\n extension = local_filename[/([^\\.]*)$/]\n unpublished_files_extensions[extension] = [] if(not(unpublished_files_extensions[extension]))\n count = unpublished_files_extensions[extension][0].to_i\n filesize = unpublished_files_extensions[extension][1].to_i\n unpublished_files_extensions[extension][0] = count + 1\n unpublished_files_extensions[extension][1] = filesize + File.size(@html_path.to_s + local_filename)\n end\n end\n report_data['unpublished_files'] = unpublished_files\n report_data['unpublished_files_extensions'] = unpublished_files_extensions\n\n return report_data\n end",
"def document_data_attributes(document)\n attr = {}\n\n # To add this to the div.document.result: data-foo=\"bar\"\n # do this:\n # attr['foo'] = 'bar'\n\n attr['onsite'] = 'true' if document.has_onsite_holdings?\n attr['offsite'] = 'true' if document.has_offsite_holdings?\n \n # NEXT-1635 - mark search-results docs with Hathi access status\n if (APP_CONFIG['hathi_search_results_links'])\n attr['hathi_access'] = document['hathi_access_s'] if document['hathi_access_s']\n end\n\n attr\n end",
"def get_show_data\n if (@document == nil)\n return false\n end\n \n @sdata = @document.stuffing_data #Data from couch\n current_page = params[:page]\n per_page = params[:per_page] # could be configurable or fixed in your app\n \n @paged_sdata = []\n if @sdata != nil\n @paged_sdata = @sdata.paginate({:page => current_page, :per_page => 20})\n end\n \n chart = Chart.find_by_document_id(@document)\n @chart = chart || Chart.find(newchart({:document_id => @document}))\n \n return true\n end",
"def cloud_search_document\n AWSCloudSearch::Document.new.tap do |d|\n d.id = self.id\n d.lang = \"en\"\n d.version = self.updated_at.to_i\n # class name\n d.add_field(\"type\", self.class.base_class.name)\n self.cloud_search_data.each_pair do |k,v|\n d.add_field(k.to_s, v.is_a?(Array) ? v : v.to_s)\n end\n end\n end"
] |
[
"0.6209724",
"0.6081706",
"0.6081706",
"0.60795516",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.5988254",
"0.59862673",
"0.5939075",
"0.5929875",
"0.59047717",
"0.58597285",
"0.58437073",
"0.5799511",
"0.57440996",
"0.5730302",
"0.5709174",
"0.5705721",
"0.5672913",
"0.56721795",
"0.5661525",
"0.56508946",
"0.5639641",
"0.56222355",
"0.5620992",
"0.55922616",
"0.5531291",
"0.55078113",
"0.55006635",
"0.54985285",
"0.5476674",
"0.54609317",
"0.54599214",
"0.5455295",
"0.54434085",
"0.54393524",
"0.5437806",
"0.5434697",
"0.5430698",
"0.5430698",
"0.5430698",
"0.5430698",
"0.5430698",
"0.5428083",
"0.5413994",
"0.5412865",
"0.54110456",
"0.5406112",
"0.54000837",
"0.53963846",
"0.53947496",
"0.5389125",
"0.5381371",
"0.5370719",
"0.53688926",
"0.53688926",
"0.5366813",
"0.5357648",
"0.5355554",
"0.5354535",
"0.5354031",
"0.53500706",
"0.5345446",
"0.5344371",
"0.53431535",
"0.53347075",
"0.53321207",
"0.53271407",
"0.53263754",
"0.53200275",
"0.5319863",
"0.53186023",
"0.5318454",
"0.53161293",
"0.5311131",
"0.53082067",
"0.5306522",
"0.5305797",
"0.5298509",
"0.52972937",
"0.5291854",
"0.5289546",
"0.5286144"
] |
0.0
|
-1
|
used by cancan and paper_trail
|
def current_user
# authorization initialization if not run yet
# (in the case of paper_trial it might not have run)
authorization_init
@logged_in_user
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def policy; end",
"def permitted?; end",
"def privacy\n end",
"def privacy\n end",
"def policy(record); end",
"def policies; end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\nif current_user.admin?\n\t can [:create, :show, :add_user, :remove_user, :index], Role\n\t end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n\n\n end",
"def state_permission(permission); end",
"def user_for_paper_trail \n current_usuario\n end",
"def who_we_are\r\n end",
"def permissions_policy(&block); end",
"def record; end",
"def record; end",
"def record; end",
"def before_embedded(record, action); end",
"def access_control\n \n end",
"def permissions = {}",
"def record\n\n end",
"def authorization; end",
"def details; end",
"def publisher_admin(role)\n\n can :manage, Publication, :publisher_id => role.publisher_id\n can :update, Publisher, :id => role.publisher_id\n can :update, IssueState\n can :update, AdminUser, :id => @user.id\n\n\n\n end",
"def user_for_paper_trail\n # or use just current_admin_user, which will store the id\n # then use to_i to join to admin_users table \n return current_admin_user #current_admin_user.username \n end",
"def paper_trail_enabled_for_controller\n true\n end",
"def access_info\n super\n end",
"def referenced; end",
"def initialize(user)\n\n # The first argument to `can` is the action you are giving the user\n # permission to do.\n # If you pass :manage it will apply to every action. Other common actions\n # here are :read, :create, :update and :destroy.\n #\n # The second argument is the resource the user can perform the action on.\n # If you pass :all it will apply to every resource. Otherwise pass a Ruby\n # class of the resource.\n #\n # The third argument is an optional hash of conditions to further filter the\n # objects.\n # For example, here the user can only update published articles.\n #\n # can :update, Article, :published => true\n #\n # See the wiki for details:\n # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities\n\n user ||= User.new\n\n # we don't do role inheritance b/c I have a sneaking feeling we\n # will want more fine-grained control for our roles as the system\n # grows.\n\n\n if ['contributor', 'editor', 'super_editor', 'admin'].member? user.role\n can [:edit, :update, :show], :all, :created_by_id => user.id\n can :create, DericciLink\n\n can :destroy, [Comment, Reply], :created_by_id => user.id\n cannot :manage, Page\n\n can :link, :all\n can :unlink, :all, :created_by_id => user.id\n can :history, :all\n\n can [:index, :new], DericciGame\n can :index, [Entry, Source, Manuscript, Comment]\n\n can :manage, PrivateMessage, :created_by_id => user.id\n can :manage, PrivateMessage do |pm|\n pm.users.include? user\n end\n can :manage, Rating\n cannot [:import, :upload], Entry\n end\n\n if ['editor', 'super_editor', 'admin'].member? user.role\n can :unlink, :all\n can :edit, Manuscript\n can :manage, DericciRecord\n\n cannot :deprecate, :all\n can :manage, Name\n cannot :review, Name\n # this needs to be RE-Established, since it has been overriden by line 51\n can :edit, :all, :created_by_id => user.id\n cannot :manage, Page\n end\n\n if ['super_editor'].member? user.role\n # allow super-editors to edit legacy records\n can [:edit, :update, :verify, :deprecate], Entry, :unverified_legacy_record => true\n can [:edit, :update], Source, :legacy => true\n can :manage, Place\n can :manage, Language\n end\n\n if ['admin'].member? user.role\n can :manage, :all\n can :update_type, Source\n end\n\n can [:edit, :update], Entry, contributors: { :id => user.id }\n cannot :manage, [Group]\n can [:edit, :update, :destroy], Group, admin: { :id => user.id }\n can [:destroy], Entry, {created_by_id: user.id, draft: true}\n\n can :show, Entry\n cannot :show, Entry do |entry|\n (entry.created_by != user && !entry.contributors.include?(user)) && entry.draft\n end\n end",
"def active; end",
"def active; end",
"def private_notes\n \n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n # TODO: This area looks like it needs to be refactored.\n\n if current_user.admin?\n editor_abilities\n upload_abilities\n publish_abilities\n roles_abilities\n hard_delete_abilities\n import_admin_abilities\n user_abilities\n group_abilities\n can [:create, :destroy, :update], FeaturedWork\n can [:manage], Hydra::Admin::Collection\n\n can :create, TinymceAsset\n can [:create, :update], ContentBlock\n can :read, ContentBlock\n can :characterize, GenericFile\n end\n\n\n if current_user.manager?\n upload_abilities\n publish_abilities\n roles_abilities\n import_user_abilities\n can [:manage], Hydra::Admin::Collection do |admin_set|\n # Can manage admin sets within their assigned unit.\n current_user.osul_groups.include? admin_set.unit_group\n end\n can [:manage], Osul::Group do |group|\n # Can manage the groups the user is in or the groups of the units a user is assigned to.\n current_user.osul_groups.include? group or current_user.osul_groups.include? group.unit\n end\n can [:create], Osul::Group\n can [:create, :destroy, :update], FeaturedWork\n end\n\n if current_user.data_entry?\n upload_abilities\n publish_abilities\n no_admin_set_abilities\n end\n\n if current_user.data_entry_student?\n upload_abilities\n no_admin_set_abilities\n end\n\n unless current_user.public?\n can :view_full, GenericFile\n end\n\n if current_user.role.nil?\n no_file_abilities\n no_admin_set_abilities\n end\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role if current_user.admin?\n\n can [:fa_overview], ActiveFedora::Base\n can [:advanced], ActiveFedora::Base\n can [:streets], ActiveFedora::Base\n can [:pdf_page], ActiveFedora::Base\n can [:pdf_page_metadata], ActiveFedora::Base\n can [:bookreader], ActiveFedora::Base\n can [:imageviewer], ActiveFedora::Base\n can [:streetsviewer], ActiveFedora::Base\n can [:fa_series], ActiveFedora::Base\n can [:audio_transcriptonly], ActiveFedora::Base\n can [:video_transcriptonly], ActiveFedora::Base\n end",
"def enter_created; end",
"def accessibility; end",
"def user_action_on_resource_authorized\n end",
"def refutal()\n end",
"def before_write\n end",
"def user_for_paper_trail\n current_account&.id\n end",
"def resource; end",
"def audit_user\n user\n # TODO Renable/refactor for Questioner 2.0\n # applicable_audit ? applicable_audit.reify(has_many: true) : user\n end",
"def can_do_member_scoped_actions\n can :show, :all\n can :edit, :all\n can :destroy, :all\n can :history, :all\n can :show_in_app, :all\n can :clone, :all\n # can :nested_set, :all\n can :nestable, :all\n can :change_state, :all\n end",
"def current_ability\n current_admin.ability\n end",
"def show\n authorize @recorded\n end",
"def private_notes\n end",
"def probers; end",
"def user_for_vestal_versions; end",
"def paper_trail_enabled_for_controller\n false\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n\n if user_groups.include? ['all_project_writers']\n can [:create], PulStore::Base\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end\n\n if user_groups.include? ['lae_project_writers']\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end \n\n if user_groups.include? ['all_project_writers']\n can [:destroy], PulStore::Base\n end\n\n if user_groups.include? ['lae_project_readers', 'all_project_readers' ]\n can [:show], PulStore::Base\n end\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n end\n\n# if current_user.contentadmin?\n# can [:create, :destroy], GwWork\n# can [:create, :destroy], GwEtd\n# end\n end",
"def child_relation; end",
"def backed\n\tend",
"def specialty; end",
"def after_created; end",
"def custom_permissions\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n can [:create], Collection\n can [:discover], Hydra::AccessControls::Embargo\n can [:discover], Hydra::AccessControls::Lease\n can [:create], [ CurationConcerns.config.curation_concerns ]\n can [:destroy], ActiveFedora::Base\n can [:permissions], [ CurationConcerns.config.curation_concerns ]\n end\n\n # Limits deleting objects to a the admin user\n #\n #if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n #end\n\n if current_user.has_role?('collection.manager')\n # can [:create, :show, :index, :edit, :update, :destroy], Collection\n can [:create], Collection\n end\n\n if current_user.has_role?('collection.depositor') or current_user.has_group_role?('collection.depositor')\n # can [:create, :show, :index, :edit, :update, :destroy], [ CurationConcerns.configuration.curation_concerns ]\n can [:create], [ CurationConcerns.config.curation_concerns ]\n # can [:show], Collection\n end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def custom_permissions\n #Collection Manager Permissions\n #Higher power than edit user...[Dont want edit users to be able to DELETE a COLLECTION??, (Delete a DO?)]\n if current_user.applicable_policy?(SETTING_POLICY_COLLECTION_MANAGER)\n #Marked as being able to :manage_collection\n can :manage_collection_flag, :all\n can :create, [DRI::Batch, DRI::GenericFile]\n end\n\n\n #Admin Permissions\n if current_user.applicable_policy?(SETTING_POLICY_ADMIN)\n can :admin_flag, :all\n #Disabled for now..\n can :manage, :all\n end\n\n #Create_do flag (alias for :edit collection)\n can :create_do, String do |pid|\n test_create(pid)\n end\n\n can :create_do, DRI::Batch do |collection|\n test_create(collection)\n end\n end",
"def before_recorded\n end",
"def can_do_collection_scoped_actions\n can :index, :all\n can :new, :all\n can :export, :all\n can :history, :all\n can :destroy, :all\n end",
"def extra; end",
"def transact; end",
"def check_record; end",
"def before_save(sender); end",
"def thesis_admin\n processor\n\n can :manage, :all\n cannot 'destroy', :copyright\n cannot 'destroy', :degree\n cannot 'destroy', :department\n cannot 'destroy', :hold_source\n cannot 'destroy', :license\n cannot 'destroy', :thesis\n end",
"def custom; end",
"def custom; end",
"def show\n authorize @news_log\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n # Admin user can create works of all work types\n can :create, curation_concerns_models\n end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def appraisals; end",
"def appraisals; end",
"def authorize(record, query = nil)\n super\n record\n end",
"def copy_actions\r\n end",
"def before_create_save(record); end",
"def accessible_name; end",
"def getAdvocacy\n\t\t\n\tend",
"def role; end",
"def role; end",
"def restriction \n end",
"def referenced?; end",
"def the_doctor; end",
"def informational?; end",
"def history_added; end",
"def isolated; end",
"def isolated; end",
"def schubert; end",
"def activity\n end",
"def custom_permissions\n can [:file_status, :stage, :unstage], FileSet\n\n if current_user.ingest_from_external_sources?\n end\n\n if current_user.manage_users?\n can [:show, :add_user, :remove_user, :index], Role\n end\n\n if current_user.manage_roles?\n can [:create, :show, :index, :edit, :update, :destroy], Role\n end\n\n if current_user.run_fixity_checks?\n can [:fixity], FileSet\n end\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def before_tours; end",
"def links; end",
"def links; end",
"def create?\n @current_user.permission('Bid', :clerk)\n end",
"def before_save #def self.before_save()\n @my_log.info(\"Creating user with name #{self.name}\")\n end",
"def admin_logic\n end",
"def no_admin_set_abilities\n cannot [:edit, :create, :delete], Hydra::Admin::Collection\n end",
"def trail\n attribute_get(:linkname)\n end",
"def custom_permissions\n if admin?\n can [:confirm_delete], ActiveFedora::Base\n can [:allow_downloads, :prevent_downloads], AdminSet\n\n can :manage, Spotlight::HomePage\n can :manage, Spotlight::Exhibit\n end\n\n can :read, Spotlight::HomePage\n can :read, Spotlight::Exhibit\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def smart?; self.permission_level = 2; end",
"def business_decision_support \n end",
"def relatorios\n end",
"def policy_scopes; end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def before_run; end",
"def allow_to\n # owner of story can do anything? editing?\n super :owner, :all => true\n # approved users can create new stories\n super :user, :only => [:show, :index, :search, :new, :create]\n # everybody can list and watch\n super :all, :only => [:show, :index, :search]\n end"
] |
[
"0.60415083",
"0.6033213",
"0.5940621",
"0.5919646",
"0.5919646",
"0.5888434",
"0.58724374",
"0.58302647",
"0.58047324",
"0.57648396",
"0.57643527",
"0.57518053",
"0.5743139",
"0.5743139",
"0.5743139",
"0.5741305",
"0.5740591",
"0.5723979",
"0.5688626",
"0.56697047",
"0.56681347",
"0.5638202",
"0.560696",
"0.5597879",
"0.5593459",
"0.55852544",
"0.5582291",
"0.55620444",
"0.55620444",
"0.55489296",
"0.55441874",
"0.5541268",
"0.553224",
"0.55313635",
"0.55309194",
"0.5526117",
"0.55196494",
"0.55130696",
"0.5512889",
"0.5479022",
"0.5475953",
"0.54733306",
"0.54688627",
"0.5459503",
"0.5445925",
"0.5440188",
"0.543679",
"0.5436788",
"0.54317445",
"0.5423886",
"0.54202133",
"0.5419104",
"0.54182637",
"0.5414993",
"0.54126346",
"0.54102075",
"0.54038644",
"0.5400364",
"0.53941274",
"0.5393227",
"0.53931916",
"0.5393035",
"0.5389758",
"0.5389758",
"0.5388029",
"0.5379906",
"0.5364487",
"0.5364487",
"0.53621054",
"0.5361169",
"0.5357009",
"0.5356622",
"0.53563166",
"0.5350355",
"0.5350355",
"0.5339938",
"0.5339136",
"0.53390235",
"0.5320591",
"0.5316239",
"0.53089666",
"0.53089666",
"0.53066367",
"0.53061676",
"0.5300766",
"0.52957296",
"0.52949476",
"0.52949476",
"0.5294392",
"0.52939576",
"0.5287772",
"0.52869",
"0.5277272",
"0.5276224",
"0.5275754",
"0.5274176",
"0.5273775",
"0.5270016",
"0.5269821",
"0.5264543",
"0.5261978"
] |
0.0
|
-1
|
set course_enroll for destroy action
|
def index
@course_enrollements = current_user.course_enrollements
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n current_user.enrollments.where(course_id: @course.id).first.destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_url, :flash => { :success => 'Course was successfully deleted.' } }\n format.json { head :no_content }\n end\n end",
"def destroy\n course.destroy!\n end",
"def destroy\n raise SecurityTransgression unless current_user.can_destroy? @enrollment\n course_id = @enrollment.course_id\n @enrollment.destroy\n if current_user.is_a? Student\n redirect_to user_path(current_user)\n else\n redirect_to course_path(course_id)\n end\n end",
"def destroy\n @course.destroy\n end",
"def destroy\n @enrollment = Enrollment.find(params[:id])\n @scheduled_course = @enrollment.scheduled_course\n @enrollment.destroy\n\n respond_to do |format|\n if(current_person.current_crew)\n format.html { redirect_to admin_scheduled_course_url(@scheduled_course) }\n else\n format.html { redirect_to enrollments_url }\n end\n format.xml { head :ok }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.delete\n end",
"def destroy\n authorize @course\n if @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: \"Course was successfully destroyed.\" }\n format.json { head :no_content }\n end\n else\n redirect_to courses_url, alert: \"Course has enrollments, Can not be destroyed.\"\n end\n end",
"def destroy\n @enrollment = Enrollment.find(params[:id])\n student = @enrollment.student\n course_id = @enrollment.course_id\n @enrollment.destroy\n\n respond_to do |format|\n flash[:notice] = student.name_first_last + ' unenrolled'\n format.html { redirect_to course_url(course_id) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: \"Course was successfully destroyed.\" }\n format.json { head :no_content }\n end\n else\n redirect_to @course, alert: \"Course still has enrollments.\" \n end\n end",
"def destroy\n @course.destroy\n redirect_to action: :index\n end",
"def destroy\n @course = Course.find(params[:id])\n lms_id=@course.lms_id\n @course.destroy\n lms_delete_course(lms_id)\n flash[:success] = \"Successfully destroyed course.\"\n redirect_to manage_courses_url\n end",
"def destroy\n @course.destroy\n redirect_to grade_courses_path(@grade, @courses), :notice => \"Successfully Deleted Course\"\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_courses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n course = Course.find( params[:id])\n course.destroy\n redirect_to training_courses_manage_path( params[:company_id],params[:training_id])\n end",
"def unenroll\n company = Company.find( params[:company_id])\n current_user_id = current_user( company.slug).id\n #user = User.find( current_user_id)\n course = Course.find( params[:id])\n if course.category == 1\n #course.users.delete(user)\n signup = course.course_signups.find_by_user_id( current_user_id)\n signup.destroy\n else\n signup = course.course_signups.find_by_user_id( current_user_id)\n signup.status = 0\n signup.save\n end\n redirect_to company_trainings_path( company.slug)\n end",
"def destroy\n @enrolled_in = EnrolledIn.find_by(student_id: params[:student_id], course_id: params[:course_id])\n @enrolled_in.destroy\n redirect_to enrolled_in_path(params[:course_id])\n end",
"def destroy\n @enrolled_course.destroy\n respond_to do |format|\n format.html { redirect_to enrolled_courses_url, notice: 'Enrolled course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enrollment = Enrollment.find(params[:id])\n @enrollment.delete\n end",
"def destroy\n @course = Course.where(:id=>params[:id]).first()\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_courses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_with @course, :location => admin_courses_url\n end",
"def destroy\n if @course.destroy\n flash[:success] = \"Curso deletado com sucesso\"\n redirect_to courses_path\n else\n flash[:success] = \"Não foi possível deletar o curso\"\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to professors_courses_url, notice: 'Course was successfully destroyed.' }\n end\n end",
"def destroy\n @course.destroy\n respond_with(@course)\n end",
"def destroy\n course = Course.find(params[:id])\n\n course.users.each do |user|\n User::ROLES.each do |role|\n user.remove_role role, course\n end\n end\n course.destroy\n\n flash[:notice] = \"Course successfully deleted\"\n redirect_to courses_url\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if has_permissions_or_redirect(:admin, root_path)\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to(courses_url) }\n format.xml { head :ok }\n end\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to coursees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.create_activity :delete, owner: current_user\n @course.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_path(current_user), notice: 'Course was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enrollment.destroy\n\n head :no_content\n end",
"def destroy\n @enroll.destroy\n respond_to do |format|\n format.html { redirect_to enrolls_url, notice: 'Enroll was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n course_name = @course.course_id\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course ' + course_name + ' was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enroll = Enroll.find(params[:id])\n @enroll.destroy\n\n respond_to do |format|\n format.html { redirect_to enrolls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.update(deleted: true)\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to(courses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to(courses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to(courses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @graduate_course = GraduateCourse.find(params[:id])\n @graduate_course.destroy\n respond_to do |format|\n format.html { redirect_to :action => 'administration' }\n end\n end",
"def destroy\n begin\n @course = Course.find(params[:id])\n @student = Student.find(params[:student_id])\n\n if Enrollment.where(course_id: @course.id, student_id: @student.id).count == 0\n render json: {\"message\": \"student is not enrolled in the course\"}\n return\n end\n\n @enrollment = Enrollment.find_by(course_id: @course.id, student_id: @student.id)\n \n if @enrollment.destroy\n render json: {\"message\": \"Student de-enrolled successfully\"}\n else\n render json: {\"message\": \"some server issue\"}\n end\n rescue\n render json: {\"message\": \"Course or Student not found\"}\n end\n end",
"def destroy\n @enroll = Enroll.find(params[:id])\n @enroll.destroy\n render json: JSON.parse({msg:\"success\"}.to_json)\n end",
"def destroy\n @Course = Course__c.find(params[:id])\n @Course.destroy\n\n respond_to do |format|\n format.html { redirect_to Courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.assignments.each(&:destroy)\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n TeacherCourse.where(courseid: params[:id]).destroy_all\n CourseRegistration.where(courseid: params[:id]).destroy_all\n StudentCourse.where(courseid: params[:id]).destroy_all\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enrollment=Enrollment.find(params[:id])\n if @enrollment.present?\n @enrollment.destroy\n end\n redirect_to request.referrer\n end",
"def destroy\n course = Course.find(params[:course_id])\n TestCourse.of(course).each do |tc|\n Score.where( student_id: @enroll.student_id, test_id: tc.test_id).each do |score|\n score.destroy\n end\n end\n @enroll.destroy\n respond_to do |format|\n format.html { redirect_to course_enrolls_path(course), notice: 'Enroll was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.update_attributes!(:deleted_at => Time.now)\n\n respond_to do |format|\n format.html { redirect_to(courses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n if @enrollment.destroy\n remove_attendee(event_id: @enrollment.training_session.google_calendar_event_id, attendee: Google::Apis::CalendarV3::EventAttendee.new(email: @enrollment.user.email))\n end\n respond_to do |format|\n format.html { redirect_to @enrollment.training_session, notice: 'Enrollment was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, @course\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @course = Course.find(params[:id])\r\n @course.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to courses_path }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n flash[:success] = \"Course was successfully deleted.\"\n format.html { redirect_to admin_url(current_admin.id)}\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n authorize! :destroy, @course\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluate_course = EvaluateCourse.find(params[:id])\n @evaluate_course.destroy\n\n respond_to do |format|\n format.html { redirect_to(evaluate_courses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n authorize :destroy, @course\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @enrollment.destroy\n respond_to do |format|\n format.html { redirect_to admin_enrollments_url, notice: 'enrollment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_course.destroy\n respond_to do |format|\n format.html { redirect_to admin_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_assign = StudentAssign.find(params[:id])\n @student_assign.destroy\n redirect_to(courses_url)\n\n end",
"def destroy\n admin_only\n @consuming_enrollment.destroy\n respond_to do |format|\n format.html { redirect_to consuming_enrollments_url, notice: 'Consuming enrollment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if current_user.id!=@course.owner.id\n respond_to do |format|\n format.html { redirect_to :action => 'index' ,:controller=>\"courses\", notice: 'You are Not Authorized' }\n end\n return false\n end\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Create course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to( :back ) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @course = Course.find(@grade.course_id) \n @grade.destroy\n respond_to do |format|\n format.html { redirect_to @course, notice: 'Grade was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @given_course.destroy\n respond_to do |format|\n format.html { redirect_to given_courses_url, notice: 'Given course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n \n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @course_offering.destroy\n\n respond_to do |format|\n format.html { redirect_to course_offerings_url(@course_offering.course) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enrollment = Enrollment.shard_for( params[:classroom_id] ).find(params[:id])\n @enrollment.destroy\n\n respond_to do |format|\n format.html { redirect_to enrollments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @allcourse = Allcourse.find(params[:id])\n @allcourse.destroy\n\n respond_to do |format|\n format.html { redirect_to(allcourses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_course.destroy\n respond_to do |format|\n format.html { redirect_to admin_courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n # ******************\n # Check permissions!\n unless @course\n flash[:notice] = \"Access denied. User can't delete courses\"\n render :action => 'index'\n return\n end\n # ******************\n\n flash[:notice] = 'Course was successfully deleted.'\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => 'index' }\n format.xml { head :ok }\n format.json { head(:ok).to_json}\n end\n end",
"def destroy\n @course = Course.find_by_id(params[:id])\n if @course.destroy\n flash[:notice] = \"#{@course.name} was succesfully deleted!\"\n redirect_to courses_path\n else\n render 'index' and return\n end\n end",
"def destroy\n @course_degree = CourseDegree.find(params[:id])\n @course_degree.destroy\n\n respond_to do |format|\n format.html { redirect_to(course_degrees_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n course = @course_day.course\n @course_day.destroy\n respond_to do |format|\n format.html { redirect_to course, notice: 'Course day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n LearningMaterial.destroy_course(@course)\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_path(:option=>2), notice: 'El curso fue exitosamente eliminado!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to my_created_courses_path, notice: 'Course was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to({:controller=>\"home\"}) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_path, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.74290365",
"0.7370804",
"0.72338986",
"0.7157434",
"0.7082216",
"0.70182997",
"0.70140344",
"0.6954295",
"0.69468504",
"0.6939181",
"0.6881087",
"0.68734795",
"0.6836474",
"0.68097466",
"0.6794976",
"0.678588",
"0.6783644",
"0.67827713",
"0.6757214",
"0.6747396",
"0.67430073",
"0.6720269",
"0.6716283",
"0.6708059",
"0.67031723",
"0.6676036",
"0.6664871",
"0.66635805",
"0.66575146",
"0.6641637",
"0.6630467",
"0.6623658",
"0.66221505",
"0.6620825",
"0.66053164",
"0.66053164",
"0.66053164",
"0.66029483",
"0.6594633",
"0.6581199",
"0.65762365",
"0.65520036",
"0.6550806",
"0.6544825",
"0.65412074",
"0.6538248",
"0.6528487",
"0.65202403",
"0.64992774",
"0.64992774",
"0.64992774",
"0.64992774",
"0.64992774",
"0.64992774",
"0.64992774",
"0.64992774",
"0.64992774",
"0.64992774",
"0.64992774",
"0.6499149",
"0.6495863",
"0.64947265",
"0.64906394",
"0.648432",
"0.64808923",
"0.6480081",
"0.64775527",
"0.6474361",
"0.64727664",
"0.6466055",
"0.64646703",
"0.64574397",
"0.6456304",
"0.64513135",
"0.6450917",
"0.6449428",
"0.6438514",
"0.6437575",
"0.64372545",
"0.6428929",
"0.6428929",
"0.6428929",
"0.6428929",
"0.6425316",
"0.64065135",
"0.6405127",
"0.6404616",
"0.6400452",
"0.6394364",
"0.6391667",
"0.63743526",
"0.63686424",
"0.6364132",
"0.6364132",
"0.6364132",
"0.6364132",
"0.6364132",
"0.6364132",
"0.6364132",
"0.6364132",
"0.6364132"
] |
0.0
|
-1
|
def is_pass_fail_type? criteria_type == Constants::CRITERIA_TYPE_PASS_FAIL end def is_point_type? criteria_type == Constants::CRITERIA_TYPE_POINT end
|
def get_status
if criteria_type == Constants::CRITERIA_TYPE_PASS_FAIL
temp_status = status
else
temp_status = point.zero? ? Constants::CRITERIA_STATUS_FAILED : Constants::CRITERIA_STATUS_PASSED
end
temp_status
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def valid_criteria_type # :nodoc:\n {\n 'between' => 'between',\n 'not between' => 'notBetween',\n 'equal to' => 'equal',\n '=' => 'equal',\n '==' => 'equal',\n 'not equal to' => 'notEqual',\n '!=' => 'notEqual',\n '<>' => 'notEqual',\n 'greater than' => 'greaterThan',\n '>' => 'greaterThan',\n 'less than' => 'lessThan',\n '<' => 'lessThan',\n 'greater than or equal to' => 'greaterThanOrEqual',\n '>=' => 'greaterThanOrEqual',\n 'less than or equal to' => 'lessThanOrEqual',\n '<=' => 'lessThanOrEqual'\n }\n end",
"def log_result?(type)\n \n if ($all == true) || (type == \"Log Message\" && $logs == true) || (type == \"Security Hole\" && $holes == true) || (type == \"Security Note\" && $notes == true) || (type == \"Security Warning\" && $warnings == true) \n return true\n end\n\n return false\n\nend",
"def valid_criteria_type_for_conditional_formatting\n {\n 'between' => 'between',\n 'not between' => 'notBetween',\n 'equal to' => 'equal',\n '=' => 'equal',\n '==' => 'equal',\n 'not equal to' => 'notEqual',\n '!=' => 'notEqual',\n '<>' => 'notEqual',\n 'greater than' => 'greaterThan',\n '>' => 'greaterThan',\n 'less than' => 'lessThan',\n '<' => 'lessThan',\n 'greater than or equal to' => 'greaterThanOrEqual',\n '>=' => 'greaterThanOrEqual',\n 'less than or equal to' => 'lessThanOrEqual',\n '<=' => 'lessThanOrEqual',\n 'containing' => 'containsText',\n 'not containing' => 'notContains',\n 'begins with' => 'beginsWith',\n 'ends with' => 'endsWith',\n 'yesterday' => 'yesterday',\n 'today' => 'today',\n 'last 7 days' => 'last7Days',\n 'last week' => 'lastWeek',\n 'this week' => 'thisWeek',\n 'next week' => 'nextWeek',\n 'last month' => 'lastMonth',\n 'this month' => 'thisMonth',\n 'next month' => 'nextMonth'\n }\n end",
"def valid_criteria_type_for_conditional_formatting\n {\n 'between' => 'between',\n 'not between' => 'notBetween',\n 'equal to' => 'equal',\n '=' => 'equal',\n '==' => 'equal',\n 'not equal to' => 'notEqual',\n '!=' => 'notEqual',\n '<>' => 'notEqual',\n 'greater than' => 'greaterThan',\n '>' => 'greaterThan',\n 'less than' => 'lessThan',\n '<' => 'lessThan',\n 'greater than or equal to' => 'greaterThanOrEqual',\n '>=' => 'greaterThanOrEqual',\n 'less than or equal to' => 'lessThanOrEqual',\n '<=' => 'lessThanOrEqual',\n 'containing' => 'containsText',\n 'not containing' => 'notContains',\n 'begins with' => 'beginsWith',\n 'ends with' => 'endsWith',\n 'yesterday' => 'yesterday',\n 'today' => 'today',\n 'last 7 days' => 'last7Days',\n 'last week' => 'lastWeek',\n 'this week' => 'thisWeek',\n 'next week' => 'nextWeek',\n 'last month' => 'lastMonth',\n 'this month' => 'thisMonth',\n 'next month' => 'nextMonth'\n }\n end",
"def train_type_valid?(train_type)\n train_type.downcase == 'p' || train_type.downcase == 'c'\n end",
"def result_types?(lab_test)\n lab_test.also_numeric? ||\n lab_test.ratio? || lab_test.range? || lab_test.fraction? || lab_test.text_length.present?\n end",
"def validate_type(type)\n return true if type == :normal\n return admin if type == :admin\n return registrar if type == :registrar\n raise \"Unknown login type #{type}\"\n end",
"def is_xy?(); @type == GRT_XY; end",
"def validate_parameters?(op)\n temp_params = op.temporary[:plan_params]\n errors_noted = \"The following parameters for plan #{op.plan.id} have errors: \"\n er = false\n if temp_params[:fluorescent_marker]\n errors_noted.concat(\"dark_light invalid\") && er = true if !static_params[:dark_light_options].include? temp_params[:dark_light]\n errors_noted.concat(\"marker_type not supported\") && er = true if !static_params[:marker_type_options].include? temp_params[:marker_type]\n end\n op.error :invalid_parameters, errors_noted if er\n op.temporary[:valid_params?] = !er\n end",
"def validation\n :wf_point?\n end",
"def accepts_outcome_status_of_result?\n accepted_outcome_types.member?('statusofResult')\n end",
"def draw_data?(data_type)\n case data_type\n when :line then true\n when :level then @quest.level > 0 \n when :objectives then !@quest.revealed_objectives.empty?\n when Array then (data_type - [:line]).any? { |dt| draw_data?(dt) }\n else !@quest.send(data_type).empty? # :description, :name, etc...\n end\n end",
"def check_implied_type_params\n invalid = []\n found = {\n :static => 0,\n :dhcp => 0,\n :addrconf => 0,\n }\n\n # List of all address_type properties\n @check_props = [:address,:remote_address,:down,:seconds,\n :hostname, :interface_id,:remote_interface_id]\n @check_props.freeze\n\n # Address types with acceptable properties\n @type_props = {\n :static => [:address,:remote_address,:down],\n :dhcp => [:seconds,:hostname],\n :addrconf => [:interface_id,:remote_interface_id],\n :from_gz => [],\n :inherited => []\n }\n @type_props.freeze\n\n # Set found = 1 for each type\n @type_props.each_pair do |k,v|\n v.each do |cp| found[k] = 1 if self[cp]\n end end\n\n # If more than one type is found the configuration is invalid\n if found.values.inject(0){ |s,a| s+= a } > 1\n invalid.push(\"incompatible property combination #{found.inspect}\")\n end\n\n return invalid\n end",
"def valid?\n @errors = []\n validate_field_types\n \n if integer?(\"point_base\")\n if point_base < 1\n @errors << {message: \"Point base must be greater than 0.\", variable: \"point_base\"}\n end\n end\n @errors.empty?\n end",
"def valid?\n @errors = [] \n validate_field_types\n \n if integer?(\"point_adjustment\")\n if point_adjustment < 1\n @errors << {message: \"Point adjustment must be greater than 0.\", variable: \"point_adjustment\"}\n end\n end\n\n @errors.empty?\n end",
"def unsubstituable_data_criteria?(data_criteria)\n cr = data_criteria\n cr['negation'] || cr['definition'] == 'derived' || cr['type'] == 'derived' || (cr['type'] == 'characteristic' && cr['property'] == 'birthtime')\n end",
"def validate_type(type, context:); end",
"def passed?\n !failed?\n end",
"def passed_test?(event)\n event['event'] == 'test' && event['status'] == 'pass'\n end",
"def determine_type\n\n if has_errors?\n :error\n elsif should_run_onsuccess?\n :onsuccess\n elsif should_redirect?\n :redirect\n elsif should_show_success?\n :success\n elsif should_render?\n :render\n else\n nil\n end \n end",
"def has_loan_type_conditions?\n loan_type_uids != LOAN_TYPE_UIDS\n end",
"def test_types(obj_a, obj_b)\n if obj_a.is_a?(RectangleParticle) and obj_b.is_a?(RectangleParticle)\n test_obb_vs_obb(obj_a, obj_b)\n elsif obj_a.is_a?(CircleParticle) and obj_b.is_a?(CircleParticle)\n test_circle_vs_circle(obj_a, obj_b)\n elsif obj_a.is_a?(RectangleParticle) and obj_b.is_a?(CircleParticle)\n test_obb_vs_circle(obj_a, obj_b)\n elsif obj_a.is_a?(CircleParticle) and obj_b.is_a?(RectangleParticle)\n test_obb_vs_circle(obj_b, obj_a)\n else\n false\n end\n end",
"def check_privilege(type)\n\nif type.floor == 1\n\t\"seller\"\n\nelsif type.floor == 2\n\t\"manager\"\n\nelsif type.floor == 3 \n\t\"admin\"\n\nelse \n \t\"user\"\n\n\tend\nend",
"def check_for(name, criteria)\n case(name)\n when \"response_code\", \"message\"\n compare(send(name), criteria)\n else\n true\n end\n end",
"def check_type(type)\n %w{galera mysql}.each do |t|\n return true if t == type\n end\n false\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n auto_points == o.auto_points &&\n teleop_points == o.teleop_points &&\n foul_points == o.foul_points &&\n adjust_points == o.adjust_points &&\n total_points == o.total_points &&\n robot1_auto == o.robot1_auto &&\n robot2_auto == o.robot2_auto &&\n robot3_auto == o.robot3_auto &&\n rotor1_auto == o.rotor1_auto &&\n rotor2_auto == o.rotor2_auto &&\n auto_fuel_low == o.auto_fuel_low &&\n auto_fuel_high == o.auto_fuel_high &&\n auto_mobility_points == o.auto_mobility_points &&\n auto_rotor_points == o.auto_rotor_points &&\n auto_fuel_points == o.auto_fuel_points &&\n teleop_fuel_points == o.teleop_fuel_points &&\n teleop_fuel_low == o.teleop_fuel_low &&\n teleop_fuel_high == o.teleop_fuel_high &&\n teleop_rotor_points == o.teleop_rotor_points &&\n k_pa_ranking_point_achieved == o.k_pa_ranking_point_achieved &&\n teleop_takeoff_points == o.teleop_takeoff_points &&\n k_pa_bonus_points == o.k_pa_bonus_points &&\n rotor_bonus_points == o.rotor_bonus_points &&\n rotor1_engaged == o.rotor1_engaged &&\n rotor2_engaged == o.rotor2_engaged &&\n rotor3_engaged == o.rotor3_engaged &&\n rotor4_engaged == o.rotor4_engaged &&\n rotor_ranking_point_achieved == o.rotor_ranking_point_achieved &&\n tech_foul_count == o.tech_foul_count &&\n foul_count == o.foul_count &&\n touchpad_near == o.touchpad_near &&\n touchpad_middle == o.touchpad_middle &&\n touchpad_far == o.touchpad_far\n end",
"def alternate_test_procedure_type\n begin\n last_time_diagnosis_selected.obs_datetime > last_time_lab_order_selected.obs_datetime\n rescue StandardError\n return true if last_time_lab_order_selected.nil?\n end\n end",
"def point_type_params\n params[:point_type]\n end",
"def passed?\n !failed?\n end",
"def has_individual_result?(gender_type, pool_type, event_type, category_code)\n # team.meeting_individual_results\n # .is_not_disqualified\n # .for_gender_type(gender_type)\n # .for_pool_type(pool_type)\n # .for_event_type(event_type)\n # .for_category_code(category_code).exists?\n team.meeting_individual_results\n .is_not_disqualified\n .for_team_best(pool_type, gender_type, category_code, event_type).exists?\n end",
"def check_type(required_user_type)\n\n if current_user.type != required_user_type\n\n session[:denied_url] = \"#{SITE}#{request.request_uri}\"\n redirect_to(\"/agencies/#{session[:agencyId]}/denied\") if current_user.type == 'AgencyUser'\n redirect_to(\"/approverdashboard/denied\") if current_user.type == 'ApproverUser'\n redirect_to(\"/contractors/#{current_user.id}/denied\") if current_user.type == 'ContractorUser'\n\n end\n\n end",
"def passed?\n @grade >= 2.0\n end",
"def failure_type\n @attributes[:failure_type]\n end",
"def check_advanced_criteria(data)\t \n\t\tif data.include?(:_constructor)\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def check_if_approval_is_required\n check_by_families || check_by_supplier || check_by_project ||\n check_by_office || check_by_company || check_by_zone\n end",
"def passes; end",
"def passes; end",
"def pass?\n kind == :pass\n end",
"def athlete_result?\n !team_result?\n end",
"def test_code2(flight_planner_instance)\n puts flight_planner_instance.can_i_fly?(\"MIA\", \"LAX\") == false\n puts flight_planner_instance.can_i_fly?(\"PHX\", \"LAX\") == true\nend",
"def verify_get_hint_data(params)\n params[:game].is_a?(Game) &&\n (params[:task].is_a?(Task) || params[:task_id].is_a?(String)) &&\n params[:user].is_a?(User)\n end",
"def myp_activity?\n self.strategy.class.name == \"UserStrategy\" \n end",
"def validate_type?\n config[:validate_type] || config[:validate_types]\n end",
"def criteria\n\t\tif @criteria.nil?\n\t\t\t[ :score, :buchholz_score, :neustadtl_score, :c_score, :opp_c_score, :wins ]\n\t\telse\n\t\t\t@criteria\n\t\tend\n\tend",
"def external_test_runs_passed_for?(test_type)\n test_types = ExternalTestType.get(test_type).with_related_types\n current_runs = current_external_test_runs_for(test_types)\n current_runs.any? && current_runs.all?(&:passed_ok?)\n end",
"def rectangle?()\n return @type == \"rectangle\"\n end",
"def get_conditions_options\n RedmineCharts::ConditionsUtils.types\n end",
"def mocks_required(type)\n { :date => [],\n :player => [:match],\n :set => [:match, :players],\n :game => [:match, :players, :set],\n :point => [:match, :players, :set, :game] }[type]\n end",
"def valid?\n type_validator = EnumAttributeValidator.new('String', ['BarOfPieChart', 'PieOfPieChart', 'DoughnutChart', 'PieChart', 'AreaChartArea', 'AreaChartPercentsStackedArea', 'AreaChartStackedArea', 'BarChartHorizClustered', 'BarChartHorizStacked', 'BarChartHorizPercentsStacked', 'BarChartVertClustered', 'BarChartVertStacked', 'BarChartVertPercentsStacked', 'LineChartLine', 'LineChartStackedLine', 'LineChartPercentsStackedLine', 'RadarChart', 'FilledRadarChart', 'StockHighLowClose', 'StockOpenHighLowClose', 'StockVolumeHighLowClose', 'StockVolumeOpenHighLowClose', 'ScatterStraightMarker', 'ScatterSmoothMarker', 'AreaChartArea3D', 'AreaChartStackedArea3D', 'AreaChartPercentsStackedArea3D', 'Line3DChart', 'Pie3DChart', 'Bar3DChartVert', 'Bar3DChartVertClustered', 'Bar3DChartVertPercentsStackedColumn3D', 'Bar3DChartVertPercentsStackedCone', 'Bar3DChartVertPercentsStackedCylinder', 'Bar3DChartVertPercentsStackedPyramid', 'Bar3DChartVertStackedColumn3D', 'Bar3DChartVertStackedCone', 'Bar3DChartVertStackedCylinder', 'Bar3DChartVertStackedPyramid', 'Bar3DChartHorizClustered', 'Bar3DChartHorizStackedBar3D', 'Bar3DChartHorizStackedCone', 'Bar3DChartHorizStackedCylinder', 'Bar3DChartHorizStackedPyramid', 'Bar3DChartHorizPercentsStackedBar3D', 'Bar3DChartHorizPercentsStackedCone', 'Bar3DChartHorizPercentsStackedCylinder', 'Bar3DChartHorizPercentsStackedPyramid', 'SurfaceChartContour', 'SurfaceChartWireframeContour', 'SurfaceChartSurface3D', 'SurfaceChartWireframeSurface3D', 'BubbleChart', 'HistogramChart', 'ParetoLineChart', 'BoxAndWhiskerChart', 'WaterfallChart', 'FunnelChart', 'TreemapChart', 'MapChart', 'SunburstChart'])\n return false unless type_validator.valid?(@type)\n pie_split_by_validator = EnumAttributeValidator.new('String', ['Default', 'Custom', 'ByPercentage', 'ByPos', 'ByValue'])\n return false unless pie_split_by_validator.valid?(@pie_split_by)\n bubble_size_representation_validator = EnumAttributeValidator.new('String', ['Area', 'Width'])\n return false unless bubble_size_representation_validator.valid?(@bubble_size_representation)\n true\n end",
"def valid?\n type_validator = EnumAttributeValidator.new('String', ['Appear', 'CurveUpDown', 'Ascend', 'Blast', 'Blinds', 'Blink', 'BoldFlash', 'BoldReveal', 'Boomerang', 'Bounce', 'Box', 'BrushOnColor', 'BrushOnUnderline', 'CenterRevolve', 'ChangeFillColor', 'ChangeFont', 'ChangeFontColor', 'ChangeFontSize', 'ChangeFontStyle', 'ChangeLineColor', 'Checkerboard', 'Circle', 'ColorBlend', 'ColorTypewriter', 'ColorWave', 'ComplementaryColor', 'ComplementaryColor2', 'Compress', 'ContrastingColor', 'Crawl', 'Credits', 'Custom', 'Darken', 'Desaturate', 'Descend', 'Diamond', 'Dissolve', 'EaseInOut', 'Expand', 'Fade', 'FadedSwivel', 'FadedZoom', 'FlashBulb', 'FlashOnce', 'Flicker', 'Flip', 'Float', 'Fly', 'Fold', 'Glide', 'GrowAndTurn', 'GrowShrink', 'GrowWithColor', 'Lighten', 'LightSpeed', 'MediaPause', 'MediaPlay', 'MediaStop', 'Path4PointStar', 'Path5PointStar', 'Path6PointStar', 'Path8PointStar', 'PathArcDown', 'PathArcLeft', 'PathArcRight', 'PathArcUp', 'PathBean', 'PathBounceLeft', 'PathBounceRight', 'PathBuzzsaw', 'PathCircle', 'PathCrescentMoon', 'PathCurvedSquare', 'PathCurvedX', 'PathCurvyLeft', 'PathCurvyRight', 'PathCurvyStar', 'PathDecayingWave', 'PathDiagonalDownRight', 'PathDiagonalUpRight', 'PathDiamond', 'PathDown', 'PathEqualTriangle', 'PathFigure8Four', 'PathFootball', 'PathFunnel', 'PathHeart', 'PathHeartbeat', 'PathHexagon', 'PathHorizontalFigure8', 'PathInvertedSquare', 'PathInvertedTriangle', 'PathLeft', 'PathLoopdeLoop', 'PathNeutron', 'PathOctagon', 'PathParallelogram', 'PathPeanut', 'PathPentagon', 'PathPlus', 'PathPointyStar', 'PathRight', 'PathRightTriangle', 'PathSCurve1', 'PathSCurve2', 'PathSineWave', 'PathSpiralLeft', 'PathSpiralRight', 'PathSpring', 'PathSquare', 'PathStairsDown', 'PathSwoosh', 'PathTeardrop', 'PathTrapezoid', 'PathTurnDown', 'PathTurnRight', 'PathTurnUp', 'PathTurnUpRight', 'PathUp', 'PathUser', 'PathVerticalFigure8', 'PathWave', 'PathZigzag', 'Peek', 'Pinwheel', 'Plus', 'RandomBars', 'RandomEffects', 'RiseUp', 'Shimmer', 'Sling', 'Spin', 'Spinner', 'Spiral', 'Split', 'Stretch', 'Strips', 'StyleEmphasis', 'Swish', 'Swivel', 'Teeter', 'Thread', 'Transparency', 'Unfold', 'VerticalGrow', 'Wave', 'Wedge', 'Wheel', 'Whip', 'Wipe', 'Magnify', 'Zoom', 'OLEObjectShow', 'OLEObjectEdit', 'OLEObjectOpen'])\n return false unless type_validator.valid?(@type)\n subtype_validator = EnumAttributeValidator.new('String', ['None', 'Across', 'Bottom', 'BottomLeft', 'BottomRight', 'Center', 'Clockwise', 'CounterClockwise', 'GradualAndCycleClockwise', 'GradualAndCycleCounterClockwise', 'Down', 'DownLeft', 'DownRight', 'FontAllCaps', 'FontBold', 'FontItalic', 'FontShadow', 'FontStrikethrough', 'FontUnderline', 'Gradual', 'Horizontal', 'HorizontalIn', 'HorizontalOut', 'In', 'InBottom', 'InCenter', 'InSlightly', 'Instant', 'Left', 'OrdinalMask', 'Out', 'OutBottom', 'OutCenter', 'OutSlightly', 'Right', 'Slightly', 'Top', 'TopLeft', 'TopRight', 'Up', 'UpLeft', 'UpRight', 'Vertical', 'VerticalIn', 'VerticalOut', 'Wheel1', 'Wheel2', 'Wheel3', 'Wheel4', 'Wheel8'])\n return false unless subtype_validator.valid?(@subtype)\n preset_class_type_validator = EnumAttributeValidator.new('String', ['Entrance', 'Exit', 'Emphasis', 'Path', 'MediaCall', 'OLEActionVerbs'])\n return false unless preset_class_type_validator.valid?(@preset_class_type)\n return false if @shape_index.nil?\n trigger_type_validator = EnumAttributeValidator.new('String', ['AfterPrevious', 'OnClick', 'WithPrevious'])\n return false unless trigger_type_validator.valid?(@trigger_type)\n restart_validator = EnumAttributeValidator.new('String', ['Always', 'WhenNotActive', 'Never', 'NotDefined'])\n return false unless restart_validator.valid?(@restart)\n after_animation_type_validator = EnumAttributeValidator.new('String', ['DoNotDim', 'Color', 'HideAfterAnimation', 'HideOnNextMouseClick'])\n return false unless after_animation_type_validator.valid?(@after_animation_type)\n true\n end",
"def validate_parameters\n if (latitude.to_f == 0.0) || (longitude.to_f == 0.0)\n render :status=>401,\n :json=>{:Message=>\"The latitude and longitude parameters should be float values.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if (location_lock != \"true\") || (location_lock != \"false\")\n render :status=>401,\n :json=>{:Message=>\"The location_lock should be either true or false.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if proximity.to_i == 0\n render :status=>401,\n :json=>{:Message=>\"The proximity should be an integer.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if page.to_i == 0\n render :status=>401,\n :json=>{:Message=>\"The page should be an integer.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n end",
"def per_facility?(account_type)\n facility_account_types.include?(account_type.to_s.classify)\n end",
"def by_points?\n self.promotion_category.present? and self.promotion_category.name == \"points\"\n end",
"def _validate_test_type(t)\n supported_test_types = Specification::DSL::SUPPORTED_TEST_TYPES.map(&:to_s)\n unless supported_test_types.include?(t.to_s)\n results.add_error('test_type', \"The test type `#{t}` is not supported. \" \\\n \"Supported test type values are #{supported_test_types}.\")\n end\n end",
"def check_auth_by_type(configuration, auth_type)\n configuration.each do |c|\n if \"#{c[\"name\"]}\" == auth_type && \"#{c[\"result\"]}\".to_bool\n return true\n end\n end\n false\n end",
"def enable_operation?(user,type=0)\n case self.current_state\n when ::WtypCzb::State::LOGGED\n if type ==0 \n return false\n else\n return true\n end\n when ::WtypCzb::State::ASSIGNED\n info = ( is_enabled(user) and user.hcz_czbl == 1 and self.czfzr.to_i == user.id)\n if (info.class==FalseClass) then\n return false\n else\n return true\n end\n when ::WtypCzb::State::FILLED\n info = ( is_enabled(user) and user.hcz_czsh == 1)\n if (info.class==FalseClass) then\n return false\n else\n return true\n end \n when ::WtypCzb::State::PASSED\n return false\n end\n end",
"def follow_criterias?(methods)\n all_pass = true\n if (not methods.is_a? Array) or methods.size < 0\n return false \n else\n for m in methods\n if self.class.method_defined? m\n # evaluate \n all_pass &&= self.send(m) \n return all_pass if not all_pass #break if one not pass\n else\n puts \"[Error] #{m} method is not defined!\"\n return false # fail criteria not defined\n end\n end\n return all_pass\n end\n end",
"def type?(type)\n return (type1 == type || type2 == type || type3 == type)\n end",
"def useful_validations_for_measure_type\n measure_types = selected_measure_types\n if measure_types[:discrete] == false\n Validation.all - Validation.all.measure_type('discrete')\n elsif measure_types[:continuous] == false\n Validation.all - Validation.all.measure_type('continuous')\n else\n Validation.all.to_a\n end\n end",
"def is_point?\n point_data = RGeo::GeoJSON.decode(params.to_json)\n if point_data.blank? || point_data.geometry.geometry_type.to_s != 'Point'\n json_response(nil, :unprocessable_entity, :incompatible_geomtry)\n end\n end",
"def complex_condition?(condition); end",
"def valid?\n \n \n \n \n \n \n \n allowed_values = [\"STRING\", \"BOOLEAN\", \"DECIMAL\", \"INTEGER\", \"DATE_TIME\", \"REFERENCE\", \"COMPLEX\"]\n if @type && !allowed_values.include?(@type)\n return false\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_values = [\"readWrite\", \"readOnly\", \"immutable\", \"writeOnly\"]\n if @mutability && !allowed_values.include?(@mutability)\n return false\n end\n \n \n \n \n \n allowed_values = [\"ALWAYS\", \"NEVER\", \"DEFAULT\", \"REQUEST\"]\n if @returned && !allowed_values.include?(@returned)\n return false\n end\n \n \n \n \n \n allowed_values = [\"NONE\", \"SERVER\", \"GLOBAL\"]\n if @uniqueness && !allowed_values.include?(@uniqueness)\n return false\n end\n \n \n \n \n \n \n \n end",
"def check_inputs(type)\n\t\tret_string = \"\"\n\t\t\tif !in_range && @error < 0\n\t\t\t\tret_string = \"Cannot #{type}: invalid set of landmarks and invalid error variation.\"\n\t\t\telsif !in_range\n\t\t\t\tret_string = \"Cannot #{type}: invalid set of landmarks.\"\n\t\t\telse\n\t\t\t\tret_string = \"Cannot #{type}: invalid error variation.\"\n\t\t\tend\n\n\t\tputs ret_string\n\t\treturn ret_string\n\tend",
"def passport_valid?(passport_input)\n return false unless has_required_fields?(passport_input)\n\n field_inputs = passport_input.split\n\n field_inputs.all? do |field_input|\n code, value = field_input.split(':')\n case code\n when 'byr'\n value.to_i.between?(1920, 2002)\n when 'iyr'\n value.to_i.between?(2010, 2020)\n when 'eyr'\n value.to_i.between?(2020, 2030)\n when 'hgt'\n unit = value[-2..]\n num = value[0...-2].to_i\n [\"cm\", \"in\"].include?(unit) && unit == \"cm\" ? num.between?(150, 193) : num.between?(59, 76)\n when 'hcl'\n /^#[0-9a-f]{6}$/.match?(value)\n when 'ecl'\n ['amb', 'blu', 'brn', 'gry', 'grn', 'hzl', 'oth'].include?(value)\n when 'pid'\n /^[0-9]{9}$/.match?(value)\n when 'cid'\n true\n else \n raise \"invalid code\"\n end\n end\nend",
"def point?(x)\n x.int? || x.point2d?\nend",
"def query_failure_type\n @attributes[:query_failure_type]\n end",
"def passport_valid?(passport_hash)\n has_required_fields = REQUIRED_FIELDS.all? do |required_field|\n !passport_hash[required_field].nil?\n end\n\n return false unless has_required_fields\n\n REQUIRED_FIELDS.all? do |field|\n case field\n when 'byr'\n valid_birth_year?(passport_hash[field])\n when 'iyr'\n valid_issue_year?(passport_hash[field])\n when 'eyr'\n valid_expiration_year?(passport_hash[field])\n when 'hgt'\n valid_height?(passport_hash[field])\n when 'hcl'\n valid_hair_color?(passport_hash[field])\n when 'ecl'\n valid_eye_color?(passport_hash[field])\n when 'pid'\n valid_passport_number?(passport_hash[field])\n else\n false\n end\n end\nend",
"def is_type_outstanding?(type)\n case type\n when 'Social Security Number'\n !ssn_verified? && !has_docs_for_type?(type)\n when 'American Indian Status'\n !native_verified? && !has_docs_for_type?(type)\n else\n !lawful_presence_authorized? && !has_docs_for_type?(type)\n end\n end",
"def accepts_outcome_needs_grading?\n accepted_outcome_types.member?('needs_grading')\n end",
"def valid_type?\n %w[ip domain cert].include? type\n end",
"def boolean_rule_test_sets\n {\n 'not set': 'fail',\n 'set': 'pass'\n }\nend",
"def conditions; end",
"def conditions; end",
"def is_valid?(types, item)\n types.each do |type|\n if type == :ipv4\n return true if ipv4?(item)\n elsif type == :domain\n return true if domain?(item)\n elsif type == :hash\n return true if hash?(item)\n elsif type == :classification\n return true if classification?(item)\n elsif type == :tag\n return true if tag?(item)\n elsif type == :bool\n return true if bool?(item)\n elsif type == :ssl_field\n return true if ssl_field?(item)\n elsif type == :whois_field\n return true if whois_field?(item)\n elsif type == :tracker_type\n return true if tracker_type?(item)\n end\n end\n return false\n end",
"def failed?\n status == 'failed'\n end",
"def failed?\n status == 'failed'\n end",
"def expected_value_requests_return?(type, condition)\n ret_type = \"return_#{type}\"\n condition == ret_type || condition.is_a?(Array) && condition.include?(ret_type)\n end",
"def passing?\n completed? && !has_failures? && !has_errors?\n end",
"def failed_test?(event)\n event['event'] == 'test' && event['status'] == 'fail'\n end",
"def set_inspection_type\n if self.inspection_level_code.upcase.index(\"HG\")\n inspection_type = InspectionType.find_by_inspection_type_code_and_grade_code(\"KROMCO\", self.grade_code)\n if inspection_type\n self.inspection_type_code = \"KROMCO\"\n self.inspection_type = inspection_type\n return true\n else\n errors.add_to_base(\"combination of: 'KROMCO' and 'grade_code' NOT FOUND\")\n return false\n end\n\n else\n inspection_type = InspectionType.find_by_inspection_type_code_and_grade_code(self.inspection_type_code, self.grade_code)\n if inspection_type != nil\n self.inspection_type = inspection_type\n return true\n else\n errors.add_to_base(\"combination of: 'inspection_type_code' and 'grade_code' is invalid- it must be unique\")\n return false\n end\n end\n\n end",
"def status\n return \"Passed\" if self.passed?\n return \"Failed\" if self.failed?\n return \"Not Run\"\n end",
"def valid?\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', [\"alert\", \"notification\"])\n return false unless type_validator.valid?(@type)\n priority_validator = EnumAttributeValidator.new('String', [\"P1\", \"P2\", \"P3\", \"P4\", \"P5\"])\n return false unless priority_validator.valid?(@priority)\n return true\n end",
"def optional_type\n @only_power = false\n @only_light = false\n if params.has_key? 'power' and not params.has_key? 'light' then\n @only_power = true\n elsif params.has_key? 'light' and not params.has_key? 'power' then\n @only_light = true\n end\n end",
"def may_advance_to_next_round?\n case self.performance.contest.round\n when 1\n # Check for sufficient age\n return false if [\"Ia\", \"Ib\"].include?(self.age_group)\n when 2\n # Conditions for second round\n return false if [\"Ia\", \"Ib\", \"II\"].include?(self.age_group)\n end\n\n return (self.points && self.points >= 23) # Basic condition is 23 or more points\n end",
"def valid_locator_type? type\n %w(id class css name xpath).include? type\nend",
"def valid_locator_type? type\n %w(id class css name xpath).include? type\nend",
"def estimated?\n (self.story_type == 'feature') && self.story_points\n end",
"def ok_to_sum?\n status.try(:downcase) == \"closed\" && closed_reason.try(:downcase) != \"invalid\"\n end",
"def validation_type\n\t\tvalues = self.question_items.map {|item| item.value.to_s}.sort # string sort\n\t\tb = []\n\t\t0.upto(values.length-2) do |i|\n\t\t\tb << true if(values[i+1].include?(values[i]))\n\t\tend\n\t\tif b.length > 0\n\t\t\t\"exactlyoneof\"\n\t\telse\n\t\t\t\"oneof\"\n\t\tend\n\tend",
"def comment_required?(designer_result, auditor_result)\n\n # Checking the check for the check type is overkill.\n check = Check.find(self.check_id)\n case \n when designer_result == 'No'\n check.yes_no?\n when designer_result == 'Waived'\n check.designer_only? || check.designer_auditor?\n when auditor_result == 'Waived' || auditor_result == 'Comment'\n check.designer_auditor?\n end\n\n end",
"def map_passable_rect?(x, y, d, rect)\r\r\n case @vehicle_type\r\r\n when :boat\r\r\n $game_map.boat_passable_rect?(x, y, vehicle.collision_rect)\r\r\n when :ship\r\r\n $game_map.ship_passable_rect?(x, y, vehicle.collision_rect)\r\r\n when :airship\r\r\n true\r\r\n else\r\r\n super\r\r\n end\r\r\n end",
"def can_use_leo?\n faculty?\n end",
"def validate_wpm_parameters(wpm_type)\n errors = validate_common_parameters\n\n # Work\n @check_guid = get_field('check_guid', '')\n @from_date = get_field('from_date')\n @to_date = get_field('to_date')\n @detail_level = get_int_field('detail_level', 1)\n @scope = get_field('scope')\n @count = get_int_field('count')\n\n # The rules:\n # ALL require \"check_guid\"\n # :last_value ignores rest\n # :aggregated requires: \"from_date\", \"to_date\", \"detail_level\", \"scope\"\n # :most_recent requires: \"from_date\", \"to_date\", \"detail_level\", OR\n # \"count\", \"detail_level\"\n\n errors << 'No Check GUID specified' if @check_guid.empty?\n # Could probably validate guid a little better than that...\n\n if wpm_type == WPM_LAST_VALUE\n # No additional checks required\n end\n\n if wpm_type == WPM_MOST_RECENT\n # Check count (optional)\n errors << \"'Count #{@count}' out of range. Must be between 1 and <tbd>\" if @count < 1\n end\n\n if wpm_type == WPM_AGGREGATED || wpm_type == WPM_MOST_RECENT\n # Check detail level\n errors << \"'Detail Level #{@detail_level}' out of range. Must be between 1 and 3\" if @detail_level < 1 || @detail_level > 3\n\n if wpm_type == WPM_AGGREGATED || @count == 0\n # Check scope\n @scope = @scope.downcase if @scope\n errors << \"'Scope #{@scope}' out of range. Must be either 'd' (day), or 'h' (hour)\" if @scope != 'd' && @scope != 'h'\n\n # Check dates\n end\n end\n\n if !errors.empty?\n raise ConfigError, \"Configuration errors: #{errors.join(', ')}\"\n end\n end",
"def paperwork_type\n if invoice?\n \"sales invoice\"\n elsif quote? || pay_by_phone?\n \"quotation\"\n elsif pro_forma?\n \"pro forma invoice\"\n else\n \"order details\"\n end\n end",
"def check_place_params *args\n if args.length != 3\n throw_error \"wrong number of arguments for place: (#{args.length} for 3)\"\n return false\n end\n # params number is 3 ...\n x = args[0].to_i if is_integer args[0]\n y = args[1].to_i if is_integer args[1]\n face = args[2]\n faces = Constants::FACES\n\n case\n when !is_integer(args[0])\n throw_error \"x should be an integer\"\n when !is_integer(args[1])\n throw_error \"y should be and integer\"\n when face.class != String\n throw_error \"face should be string type\"\n when x > @xmax || x < 0\n throw_error \"x exceed the limitation\"\n when y > @ymax || y < 0\n throw_error \"y exceed the limitation\"\n when faces.index(face.downcase).nil?\n throw_error \"face value should be one of the #{faces}\"\n else\n return true\n end \n end",
"def skip_condition_met?\n points = encounter_points_needed\n return false if $game_party.encounter_points < points\n condition = troop.skip_condition\n return false unless condition\n params = condition.parameters\n result = false\n case params[0]\n when 0 # Switch\n result = ($game_switches[params[1]] == (params[2] == 0))\n when 1 # Variable\n value1 = $game_variables[params[1]]\n if params[2] == 0\n value2 = params[3]\n else\n value2 = $game_variables[params[3]]\n end\n case params[4]\n when 0 # value1 is equal to value2\n result = (value1 == value2)\n when 1 # value1 is greater than or equal to value2\n result = (value1 >= value2)\n when 2 # value1 is less than or equal to value2\n result = (value1 <= value2)\n when 3 # value1 is greater than value2\n result = (value1 > value2)\n when 4 # value1 is less than value2\n result = (value1 < value2)\n when 5 # value1 is not equal to value2\n result = (value1 != value2)\n end\n #when 2 # Self switch\n #if @event_id > 0\n #key = [$game_map.map_id, @event_id, params[1]]\n #result = ($game_self_switches[key] == (params[2] == 0))\n #end\n when 3 # Timer\n if $game_timer.working?\n if params[2] == 0\n result = ($game_timer.sec >= params[1])\n else\n result = ($game_timer.sec <= params[1])\n end\n end\n when 4 # Actor\n actor = $game_actors[params[1]]\n if actor\n case params[2]\n when 0 # in party\n result = ($game_party.members.include?(actor))\n when 1 # name\n result = (actor.name == params[3])\n when 2 # Class\n result = (actor.class_id == params[3])\n when 3 # Skills\n result = (actor.skill_learn?($data_skills[params[3]]))\n when 4 # Weapons\n result = (actor.weapons.include?($data_weapons[params[3]]))\n when 5 # Armors\n result = (actor.armors.include?($data_armors[params[3]]))\n when 6 # States\n result = (actor.state?(params[3]))\n end\n end\n when 5 # Enemy\n enemy = $game_troop.members[params[1]]\n if enemy\n case params[2]\n when 0 # appear\n result = (enemy.alive?)\n when 1 # state\n result = (enemy.state?(params[3]))\n end\n end\n #when 6 # Character\n #character = get_character(params[1])\n #if character\n #result = (character.direction == params[2])\n #end\n when 7 # Gold\n case params[2]\n when 0 # Greater than or equal to\n result = ($game_party.gold >= params[1])\n when 1 # Less than or equal to\n result = ($game_party.gold <= params[1])\n when 2 # Less than\n result = ($game_party.gold < params[1])\n end\n when 8 # Item\n result = $game_party.has_item?($data_items[params[1]])\n when 9 # Weapon\n result = $game_party.has_item?($data_weapons[params[1]], params[2])\n when 10 # Armor\n result = $game_party.has_item?($data_armors[params[1]], params[2])\n when 11 # Button\n result = Input.press?(params[1])\n when 12 # Script\n result = eval(params[1])\n when 13 # Vehicle\n result = ($game_player.vehicle == $game_map.vehicles[params[1]])\n end\n return result\n end",
"def kind_of?(p0) end",
"def c1_task?\n product.c1_test || (product.c3_test && eh_measures?)\n end",
"def passed?\n config.threshold.nil? ||\n (config.threshold_must_match && percent == config.threshold) ||\n percent >= config.threshold\n end",
"def valid?\n !type.nil?\n end"
] |
[
"0.6035881",
"0.585241",
"0.5829122",
"0.5829122",
"0.5780756",
"0.5769717",
"0.5678688",
"0.5623546",
"0.5582708",
"0.5572946",
"0.550275",
"0.54975027",
"0.5470265",
"0.54502994",
"0.54390216",
"0.54305667",
"0.5426283",
"0.5387452",
"0.5381422",
"0.5335307",
"0.53101057",
"0.5300721",
"0.5297296",
"0.529566",
"0.5292223",
"0.5289988",
"0.5286886",
"0.52752054",
"0.52744436",
"0.52696484",
"0.52573234",
"0.52556044",
"0.52374977",
"0.523299",
"0.5227858",
"0.5226579",
"0.5226579",
"0.52245164",
"0.52076834",
"0.5198865",
"0.51984906",
"0.51941854",
"0.5194028",
"0.5190347",
"0.51881266",
"0.5186475",
"0.5186129",
"0.5173162",
"0.5154968",
"0.51534563",
"0.51480126",
"0.5146904",
"0.5146507",
"0.51446027",
"0.51360625",
"0.51172996",
"0.5106644",
"0.51065344",
"0.50994873",
"0.5096911",
"0.5093066",
"0.5075475",
"0.50724953",
"0.5068057",
"0.5062645",
"0.5062513",
"0.5057631",
"0.5055399",
"0.50543386",
"0.5054198",
"0.5049397",
"0.5043226",
"0.5043226",
"0.5041681",
"0.5040519",
"0.5040519",
"0.50347865",
"0.5034785",
"0.5030392",
"0.5027536",
"0.50255185",
"0.50244504",
"0.5019848",
"0.50166005",
"0.50094116",
"0.50094116",
"0.5007001",
"0.50052464",
"0.50039834",
"0.5000947",
"0.49999508",
"0.49980837",
"0.49937996",
"0.49875262",
"0.4986768",
"0.49815914",
"0.49809003",
"0.4978387",
"0.49762326",
"0.49755165"
] |
0.7072243
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_career
@career = Career.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
|
Only allow a trusted parameter "white list" through.
|
def career_params
params.require(:career).permit(:name, :description)
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 get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\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 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 specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"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 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 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 sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def parameters\n nil\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.7122899",
"0.7054107",
"0.69478",
"0.6902101",
"0.67359334",
"0.67178756",
"0.66889167",
"0.6677724",
"0.6661157",
"0.6555896",
"0.6527207",
"0.64584696",
"0.64517015",
"0.6450208",
"0.644749",
"0.6435074",
"0.6413329",
"0.6413329",
"0.6391818",
"0.6380081",
"0.6380081",
"0.6375536",
"0.6360849",
"0.635511",
"0.6285548",
"0.62798816",
"0.62468714",
"0.6227613",
"0.6224945",
"0.6224163",
"0.62108225",
"0.62080175",
"0.6177938",
"0.6171946",
"0.6168783",
"0.615999",
"0.614475",
"0.6136407",
"0.61226404",
"0.61090046",
"0.60992956",
"0.6075657",
"0.60532176",
"0.6040335",
"0.6035594",
"0.60304934",
"0.60196596",
"0.6018118",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.6018028",
"0.60165983",
"0.6005772",
"0.6004614",
"0.60022306",
"0.59969896",
"0.59954774",
"0.59947675",
"0.59847546",
"0.5984462",
"0.597783",
"0.5975277",
"0.59699774",
"0.59675187",
"0.5966527",
"0.5966527",
"0.5957506",
"0.59521663",
"0.59506977",
"0.59479433",
"0.5944202",
"0.59313655",
"0.5930722",
"0.592726",
"0.5924843",
"0.5918731",
"0.59178615",
"0.5914195",
"0.59137934",
"0.5908005",
"0.59058493",
"0.5904342",
"0.59020513",
"0.59004885",
"0.58971745",
"0.5896885",
"0.58949924"
] |
0.0
|
-1
|
This two methods were overwritten for devise compability
|
def encrypted_password
nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def capable_login_auth?; end",
"def devise_modules_hook!; end",
"def devise_controller?; end",
"def user_provider; end",
"def devise_parameter_sanitizer; end",
"def fetchable_fields\n super - [:password, :password_confirmation]\n # if (context[:current_user].guest)\n # super - [:email]\n # else\n # super\n # end\n end",
"def devise_mappings; end",
"def capable_auth_types; end",
"def user_authentication\n end",
"def available_email_login?\n true\nend",
"def current_user\n #super the main class of devise current_user\n super || guest_user\n end",
"def active_for_authentication?; end",
"def active_for_authentication?; end",
"def auth_methods; end",
"def user_os_complex\r\n end",
"def authentication_type; end",
"def private; end",
"def current_user\n # if a user is logged in we just use devise's implementation.\n super || guest_user\n end",
"def user_verification; end",
"def http_authenticatable?; end",
"def warden; end",
"def warden; end",
"def warden; end",
"def user_verification?; end",
"def authorization_mode; end",
"def devise_scope(scope); end",
"def valid_for_authentication?; end",
"def valid_for_authentication?; end",
"def current_user\n # super: don't change anything, i just want the exact same behavior \n # as in the method that we are overriding\n\n # what this line means is that if the user is logged in, super is true,\n # then call super treat everything normal, and ignore right hand side\n # if super == false, call right hand side\n\n # super comes from devise class\n # meanwhile the r.h.s comes from open struct class\n super || guest_user\n end",
"def authorization; end",
"def authenticatable_name; end",
"def instruct_user!\n end",
"def auth_param; end",
"def can_use_legacy_login?\n !ccid.present?\n end",
"def permitted?; end",
"def auth_store; end",
"def auth(value); end",
"def authentication_profile\n super\n end",
"def capable_plain_auth?; end",
"def ignore_unavailable_authentication_information_state\n super\n end",
"def user_for_vestal_versions; end",
"def skip_pundit?\n devise_controller?\n end",
"def allow_registration?\n true\n end",
"def user_consenting; end",
"def trust_registration_number; end",
"def access_info\n super\n end",
"def access_control\n \n end",
"def valid_for_platform?; true; end",
"def auth\n end",
"def auth\n end",
"def allowed_auth_methods; end",
"def authentication_method\n super\n end",
"def email_login\n end",
"def user_init; end",
"def http_auth_login\n # FIXME: Implement\n end",
"def auth_scheme; end",
"def needs_login?() false end",
"def active_for_authentication? \n \tsuper && approved?\n \t\n\tend",
"def capable_cram_md5_auth?; end",
"def candidate_sign_up\n\n end",
"def update_application_controller\n inject_into_file 'app/controllers/application_controller.rb', after: \"protect_from_forgery with: :exception\\n\" do <<-'RUBY'\n before_action :authenticate_or_token\n\n protected\n def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:locale, :name, :username, :email, :password, :password_confirmation, :role, :remember_me) }\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :username, :email, :password, :remember_me) }\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :password, :password_confirmation, :current_password, :role) }\n I18n.locale = @current_user.locale || I18n.default_locale unless @current_user.nil?\n end\n\n # Validate user session if is not API call\n def authenticate_or_token\n authenticate_user! if params[:controller].index('api').nil? && request.fullpath != root_path\n @current_user = current_user if @current_user.nil?\n end\n\n RUBY\n end\n end",
"def user_type; end",
"def devise(*modules)\n # hack to get around Neo4j's requirement to index before uniqueness validation\n index :email, :type => :exact if modules.include?(:validatable)\n super\n end",
"def current_user\n \tsuper || guest_user\n \t#Super quiere decir que exactamente con los valores \n \t#del metodo original sin cambiar nada\n end",
"def user_options; end",
"def provider; end",
"def user_provider=(_arg0); end",
"def authenticated?; super; end",
"def authenticate_name\n super\n end",
"def fetch_details_from_devise\n self.username = 'devise_user'\n self.save\n end",
"def params_authenticatable?; end",
"def password_required?\n return false if self.guest? || self.customer?\n super\n end",
"def credentials; end",
"def credentials; end",
"def credentials; end",
"def credentials; end",
"def credentials; end",
"def clean_up_passwords; end",
"def safe_by_default; end",
"def authentication\n raise NotImplementedError\n end",
"def sign_up_candidate\n\n end",
"def current_cephuser\n raise NotImplementedError\n end",
"def security_server_client\n end",
"def registration_approval_required?; false; end",
"def user; end",
"def user; end",
"def sign_in\n\tend",
"def allow_params_authentication!; end",
"def authen_method_guest!()\n @authen_method = TAC_PLUS_AUTHEN_METH_GUEST\n end",
"def login_attribute\n super\n end",
"def ensure_password\n self.password ||= Devise.friendly_token[0,20]\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 credential; end",
"def credential; end",
"def http_auth?; end",
"def signup_info\n end",
"def require_login\n end",
"def secure_subresource_integrity_context?; end",
"def secure_subresource_integrity_context?; end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:email, :password) }\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation) }\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:email, :password, :password_confirmation, :current_password) }\n end",
"def host_authorization; end"
] |
[
"0.64125067",
"0.6393043",
"0.638745",
"0.6305253",
"0.62551534",
"0.60903037",
"0.60615915",
"0.60024744",
"0.5968084",
"0.5934227",
"0.5887459",
"0.5873767",
"0.5873767",
"0.58577114",
"0.58548737",
"0.5841072",
"0.57956654",
"0.5750887",
"0.5727954",
"0.5701004",
"0.5686679",
"0.5686679",
"0.5686679",
"0.5645135",
"0.5620467",
"0.56054085",
"0.5602617",
"0.5602617",
"0.5589932",
"0.5587549",
"0.5571437",
"0.55633545",
"0.5558655",
"0.55583006",
"0.5553611",
"0.5548888",
"0.5539134",
"0.55311906",
"0.5530838",
"0.55275726",
"0.55182356",
"0.5517667",
"0.55142486",
"0.55052984",
"0.5504191",
"0.55030835",
"0.5499215",
"0.5494769",
"0.5494236",
"0.5494236",
"0.54845476",
"0.5484161",
"0.54837763",
"0.54801315",
"0.5472134",
"0.54667634",
"0.54605246",
"0.54598975",
"0.54545546",
"0.5453628",
"0.5451344",
"0.5448692",
"0.5439031",
"0.543874",
"0.54381204",
"0.54344445",
"0.54313433",
"0.54286456",
"0.542837",
"0.54267657",
"0.5416241",
"0.5414749",
"0.5412832",
"0.5412832",
"0.5412832",
"0.5412832",
"0.5412832",
"0.5410274",
"0.53978956",
"0.53860694",
"0.5384756",
"0.53833437",
"0.5381409",
"0.53790593",
"0.53690886",
"0.53690886",
"0.53597414",
"0.5358617",
"0.53534216",
"0.5350772",
"0.5347918",
"0.53391373",
"0.5338711",
"0.5338711",
"0.5336746",
"0.5320909",
"0.5317583",
"0.5314142",
"0.5313076",
"0.5309089",
"0.530574"
] |
0.0
|
-1
|
To make things even harder to read, we'll remove spaces too. For example, this string: two drums and a cymbal fall off a cliff can be disemvoweled to get: twdrmsndcymblfllffclff We also want to keep the vowels we removed around (in their original order), which in this case is: ouaaaaoai
|
def remove_vowels(string)
vowels = ['a', 'e', 'i', 'o', 'u']
final_string = ""
vowels_used = ""
string.gsub!(" ", "")
string.each_char do |letter|
if !(vowels.include?(letter))
final_string << letter
else
vowels_used << letter
end
end
[final_string, vowels_used]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove_vowels str\n reggie = /[aAeEiIoOuU]/\n holder_arr = str.split('')\n holder_arr.map! { |letter|\n if reggie.match letter\n letter = ''\n else \n letter\n end\n }\n holder_arr.join('')\nend",
"def disemvowel(str)\n # str.gsub(\"aeiou\", \"\")\n # str.split - ['a'],['e'],['i'],['o'],['u'].join(' ')\n # str.tr('aeiou', '').join(' ')\n\n str.tr('aeiouAEIOU', '')\nend",
"def cleanup_noregexp str\n str2 = ''\n str.chars.each do |chr|\n case chr.downcase\n when ('a'..'z')\n str2 << chr\n else\n str2 << ' '\n end\n end\n str2.squeeze(' ')\nend",
"def cleanup2(string)\n string.gsub(/[^a-z]/i, ' ').squeeze\nend",
"def disemvowl(string)\n vowels = 'aeiou'\n string.each_char { |char|\n string.delete!(char) if vowels.include?(char.titleize)\n }\nend",
"def cleanup(string)\n characters = string.chars\n characters.each_with_index do |char, index|\n if !('a'..'z').include?(char.downcase)\n if characters[index - 1] == ' '\n characters[index - 1] = ''\n characters[index] = ' '\n else\n characters[index] = ' '\n end\n end\n end\n characters.join\nend",
"def strip_vowels(s)\n s.delete \"aeiouAEIOU\"\nend",
"def no_vowels str\n # delete the vowels in the str if str has vowels a, e, i, o, u\n str.delete 'aeiouAEIOU'\nend",
"def cleanup(string)\n string.gsub!(/[^a-zA-Z]/, ' ').squeeze(' ')\nend",
"def ordered_vowel_words(string)\n output_string = []\n string.scan(/\\w+/).each {|word| output_string << word if word_valid?(word) }\n output_string\n (string.split.size == 1 && word_valid?(string) == false) ? \"\" : output_string.join(' '))\nend",
"def cleanup(string)\n string.gsub(/[^a-z]/i, ' ').squeeze(' ')\nend",
"def disemvowel input\n vowels = 'aeiouAEIOU'\n # output = ''\n # input.split('').each do |char|\n # if !vowels.include?char\n # output += char\n # end\n # end\n # output\n # input.split('').delete_if {|char| vowels.include?char}\nend",
"def remove_vowels(sentence)\n sentence.split.map{|word| word.delete\"aeiouyAEIOUY\"}.join(\" \")\nend",
"def cleanup(str)\n char_clean = []\n str.chars.each do |char|\n if /[a-z]/.match(char)\n char_clean << char\n else\n char_clean << ' ' unless char_clean[-1] == ' '\n end\n end\n char_clean.join\nend",
"def no_vowels (str)\n str_array = str.split(' ')\n str_array.delete('a', 'e', 'i', 'o', 'u')\n return str_array.join(' ')\nend",
"def remove_vowels str\n str.delete \"aeiouAEIOU\"\nend",
"def remove_vowels(string)\n string.delete('[aeiou]+[AEIOU]+')\nend",
"def cleanup(string)\n string.gsub(/[^a-z]/i, \" \").squeeze(' ')\nend",
"def cleanup(str)\r\n str.gsub!(/[^a-z]/, ' ').squeeze(' ')\r\nend",
"def sanitize_me(string)\n string = string.split(\" \")\n collection = []\n string.each do |word|\n collection << word.gsub(/[^A-Za-z]/,\"\").chars.sort.join\n end\n collection.join(\" \")\nend",
"def cleanup(string)\n string.gsub(/[^a-z]/, ' ').squeeze(' ')\nend",
"def cleanup(sentence)\n sentence.gsub(/[^a-z]+/i, ' ')\nend",
"def cleanup str\n str2 = str.gsub(/[^A-Za-z]/, ' ')\n str3 = str2.gsub(/[ ]{2,}/, ' ')\nend",
"def cleanup(str)\n # str.gsub!(/[^a-z]/, ' ').squeeze(' ')\n str.tr_s(' -/:-@[-`{-~', ' ')\nend",
"def noVowels string\n # # Create a string that contains all the vowels\n # vowels = 'aeiou'\n # # Split the string into an array\n # strArray = string.split('')\n # # Use 'select' to only keep the characters that are not vowels\n # consonantArray = strArray.select { |value| !vowels.include?(value.downcase) }\n # # Join the array into a string\n # consonantsOnly = consonantArray.join('')\n\n #Use the delete method that checks lowercase vowels and uppercase vowels\n string.delete \"aeiouAEIOU\"\n # Implicity return a string with all the vowels removed with the line above\nend",
"def disemvowel str\n\n\tstr.gsub(/[aeiou]/,'')\n\nend",
"def clean_up(string)\n arr = string.split\n final_arr = []\n new_arr = arr.map do |word|\n word.scan(/\\w/).join\n end\n new_arr.each do |word|\n if word != \"\"\n final_arr << word\n end\n end\n final_arr.join(' ')\nend",
"def disemvowel(str)\n vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']\n (str.chars - vowels).join(\"\")\nend",
"def disemvowel(str)\n new_str = str.gsub(/[aeiouAEIOU]/, '') \n new_str\nend",
"def cut_vowels string\n string.delete 'AEIOUaeiou'\nend",
"def cleanup(str)\n str.gsub(/([^a-z])/, ' ').squeeze(' ')\nend",
"def crunch(str)\n str.split.map do |word|\n word.chars.each_with_object('') do |char, clean_word|\n clean_word << char if char != clean_word[-1]\n end\n end.join(' ')\nend",
"def cleanup(str)\n str.gsub(/[^a-z]/,\" \").squeeze(\" \")\nend",
"def cleanup(str)\n str.gsub!(/[^a-z]+/i, ' ') if str.match(/[^a-z]+/i)\n str\nend",
"def cleanup(string)\n i = 0\n final = ''\n while i < string.length\n final << (('a'..'z').cover?(string[i]) ? string[i] : ' ')\n i += 1\n end\n final.squeeze(' ')\nend",
"def cleanup(string)\n string.gsub!(/\\W/, ' ').squeeze(' ')\nend",
"def cleanup(string)\n string.gsub(/[^a-z0-9]/, \" \").gsub(/\\s+/, \" \")\n # string.gsub(/[^a-z]/, ' ').squeeze(' ')\nend",
"def disemvowel(str)\n str.gsub(/[aeiouAEIOU]/,'')\nend",
"def cleanup(input)\n input.gsub(/[^a-zA-Z]/, ' ').squeeze(' ')\nend",
"def cleanup(str)\n str.chars.map { |char| ('a'..'z').include?(char.downcase) ? char : ' ' }.join.squeeze(' ')\nend",
"def hipsterfy(word)\n chars = word.split(\"\")\n\n i = chars.length - 1\n while i >= 0\n if $vowels.include?(chars[i])\n chars.delete_at(i)\n break\n end\n i -= 1\n end\n\n chars.join(\"\")\nend",
"def strip_vowels(str)\n str.delete \"aeiouAEIOU\"\nend",
"def clean(string)\n string.gsub(/[',.!?:;]['s]/, \"\")\n\nend",
"def clean_phrase\n clean_phrase = @phrase.dup\n clean_phrase.downcase!\n clean_phrase.squeeze!\n clean_phrase.gsub!(/[[:space:]]/, '')\n clean_phrase = clean_phrase.split(//)\n end",
"def remove_vowels(strings)\n vowels = ['a', 'e', 'i', 'o', 'u']\n new_strings = []\n\n strings.each do |str|\n selected_chars = str.split('').delete_if { |char| vowels.include?(char) }\n new_strings << selected_chars.join('')\n end\n\n new_strings.join(', ')\nend",
"def cleanup_noreg(string)\n blocks = string.split\n result = blocks.map do |word|\n word = word.chars.map! do |char|\n if char.downcase == char.downcase.upcase\n ' '\n else \n char\n end\n end\n word = word.join\n # p word\n #p word.squeeze(\" \")\n #word.squeeze(\" \")\n # take note that here +*& is a block or word, and gets replaced by a space without\n # any contiguous letter chars\n # so after join on line 48, there are 3 spaces between my and line, without the squeeze call\n word\n end\n result = result.join(' ').squeeze(' ')#.squeeze\nend",
"def cleanup(str)\nstr.gsub!(/[^0-9A-Za-z]/, \" \").squeeze(\" \")\n\nend",
"def disemvowel(str)\n str.gsub /[aeiou]/i, ''\nend",
"def no_voweles (str)\n p str.delete \"aeiouAEIOU\"\n end",
"def delete_vowel(string)\n VOWELS.each do |letter|\n if string.match(letter)\n string.delete!(letter)\n end\n end\n string\nend",
"def remove_vowels(str)\n vowels = %w(a e i o u)\n no_vowels_arr = []\n\n str.each do |word|\n new_str = ''\n word.chars.each do |letter|\n if vowels.include?(letter.downcase)\n next\n else\n new_str << letter\n end\n end\n no_vowels_arr << new_str \n end\n no_vowels_arr\nend",
"def disemvowel(string)\n no_vowel_string = string.gsub(/[aeiou]/, \"\")\n return no_vowel_string\nend",
"def remove_vowels string\n string.delete 'aeiouAEIOU'\nend",
"def remove_vowels string\n string.delete 'aeiouAEIOU'\nend",
"def cleanup(string)\n array = string.chars\n output = \"\"\n i = 0\n for i in (i..array.length-1)\n if array[i] =~ /[A-Za-z]/\n output << array[i]\n else\n output << \" \"\n end\n output.gsub!(\" \", \" \")\n i += 1\n end\n output\nend",
"def vowel string\n # string = string.split(\"\")\n # string = string.downcase\n string = string.delete 'AaEeIiOoUu'\n # string = string.capitalize\n\nend",
"def cleanup(str)\n clean = str.chars.map do |char|\n ('a'..'z').include?(char) ? char : ' '\n end\n clean.join.squeeze(' ')\nend",
"def remove_vowels(s)\n vowels = /[aeiou]/i\n s.gsub!(vowels, '')\n s\nend",
"def cleanup(str)\n letters = (\"a\"..\"z\")\n\n str = str.split(\"\").map do |char|\n p char\n if letters.include?(char)\n char\n else \n \" \"\n end\n end\n\n str = str.join\n\n str.squeeze!(\" \")\nend",
"def cleanup(string)\n letters = %w(a b c d e f g h i j k l m n o p q r s t u w v x y z\n A B C D E F G H I J K L M N O P Q R S T U W V X Y Z )\n index = 0\n loop do\n string[index] = ' ' unless letters.include?(string[index])\n index += 1\n break if index == string.size\n end\n string.squeeze(' ')\nend",
"def cleanup(str)\n str.gsub!(/[^0-9a-z ]/i, ' ')\n str.gsub!(/\\s+/, ' ')\nend",
"def cleanup(string)\n switch = 0\n clean_string = []\n string\n .downcase\n .chars\n .map do |char|\n case ('a'..'z').cover?(char)\n when true\n clean_string << char\n switch = 0\n when false\n next if switch == 1\n clean_string << ' '\n switch = 1\n end\n end\n clean_string.join\nend",
"def reverberate(str)\n reverberated = []\n vowels = \"aeiou\"\n\n str = str.split(\" \")\n str.each_with_index do |word, idx|\n if word.length < 3\n reverberated << word\n elsif vowels.include?(word[-1])\n reverberated << word + word.downcase\n else \n i = word.length - 1\n suffix = \"\"\n while i >= 0 \n if !vowels.include?(word[i])\n suffix += word[i]\n else\n suffix += word[i]\n suffix = suffix.reverse\n reverberated << (word + suffix)\n break\n end\n i -= 1\n end\n end\n end\n reverberated.join(\" \")\nend",
"def remove_vowels string\n string.delete \"aeiouAEIOU\"\nend",
"def cleanup(str)\n\tnew_str = str.gsub(/[^a-z]/i, ' ').split.join(' ')\n\t\" #{new_str} \"\nend",
"def disemvowel(str)\n array = str.chars\n array.each_with_index do |char, i|\n if \"aeiouAEIOU\".include?(char)\n array[i] = nil\n end\n end\n\n new_string = array.join\n return new_string\nend",
"def removeVowels(string)\n string.delete\"a\" \"e\" \"i\" \"o\" \"u\"\nend",
"def vowel_remover string\n string.delete \"aeiouAEIOU\"\nend",
"def elim_vowels(string)\r\n string.downcase.delete(\"aeiou\")\r\nend",
"def cleanup(str)\n output = [] \n no_go = false\n str = str.gsub(/[^A-Za-z0-9 ]/, ' ').split(\"\")\n str.each_index do |i|\n if str[i]==\" \"\n output.push(str[i]) unless no_go == true\n no_go = true\n else\n output.push(str[i]) \n no_go = false\n end\n end\n output.join\nend",
"def cleanup(string)\n string.gsub(/[\\W\\d]/, ' ').gsub(/\\s+/, ' ')\nend",
"def cleanup(string)\n string.gsub!(/\\W+/, ' ')\nend",
"def cleanup(string)\n string.gsub(/[^A-Za-z0-9]/, \" \").squeeze\nend",
"def regex_strip(string)\n return string.gsub(/[^\\p{L}\\p{N}]/u, \" \")\n end",
"def remove_vowels string \n string.delete \"aeiouAEIOU\"\nend",
"def clean(string)\n string = string.gsub(\".\",\"\")\n string = string.gsub(/\\s+/,\" \")\n string = string.downcase\n return string\n end",
"def clean(string)\n string = string.gsub(\".\",\"\")\n string = string.gsub(/\\s+/,\" \")\n string = string.downcase\n return string\n end",
"def cleanup string\n string.gsub(/\\W|\\d/, ' ').gsub(/\\ (?=\\ )/, '')\nend",
"def cleanup(str)\r\n str.chars.map {|char| char.match(/[A-Za-z0-9]/) ? char : ' ' }.join.squeeze(\" \")\r\nend",
"def cleanup(str)\n str.gsub(/\\W/, ' ').squeeze(' ')\nend",
"def custom_squeeze(string)\n final=\"\"\n characters_array= string.split(\"\")\n characters_array.each_with_index do |char, index|\n unless index >= 0 && characters_array[index - 1] == char\n final += char\n end\n end\n p final\nend",
"def cleanup(str)\n str.gsub(/[^a-zA-Z]+/, ' ')\nend",
"def remove_vowels(str) # yellow\n vowel = \"aeiou\"\n removed = \"\"\n str.each_char do |char|\n unless vowel.include?(char)\n removed += char\n end\n end\n return removed\nend",
"def cleanup(text)\n text.gsub(/[^a-z]/i,\" \").squeeze(\" \")\nend",
"def no_vowels(string)\n string.delete\"aeiouAEIOU\"\n# use the .delete accessor and include uppercase and lower case characters to be deleted\nend",
"def reverberate(sentence)\n vowels = \"aeiou\"\n words = sentence.split(\" \")\n converted_sentence = []\n\n words.each do |word|\n if word.length < 3\n converted_sentence << word\n elsif vowels.include?(word[-1].downcase)\n converted_sentence << word + word[0].downcase + word[1..-1]\n else\n uppercase = word[0] == word[0].upcase ? true : false\n count = word.length - 1\n\n while count > 0\n if vowels.include?(word[count])\n new_word = word + word[count..-1]\n converted_sentence << new_word\n break\n end\n count -= 1\n end\n end\n end\n\n converted_sentence.join(\" \")\nend",
"def remove_vowels(s)\n s.downcase.delete('aeiou')\nend",
"def cleanup(string)\n\ts = string.gsub(/[^0-9a-z]/i, ' ')\n\ts.squeeze(\" \")\nend",
"def abbreviate_sentence(sentence)\n vowels =\"aeiou\"\n new_word = \"\"\n \n sentence.split(\" \").each do |word| \n word.each_char do |char| \n if vowels.include?(char) && word.length > 4\n char = \"\"\n end\n new_word += char \n end\n new_word += \" \"\n end\n\n new_word\nend",
"def cleanup_new(string)\n string.tr(' -/:-@[-`{-~',' ')\nend",
"def disemvowel(string)\n string.delete \"aeiouAEIOU\"\nend",
"def cleanup(txt)\n txt.gsub(/[^a-z]/i, ' ').squeeze(' ')\nend",
"def devowel(sent)\n sent_arr = sent.split(' ')\n output_arr = []\n vowels = 'aeiou'\n\n sent_arr.each do |word|\n word.each_char do |char|\n if vowels.include?(char.downcase)\n word.delete!(char)\n end\n end\n output_arr << word\n end\n\n output_arr.join(' ')\nend",
"def cleanup(str)\n str.gsub(/\\W+/,' ')\nend",
"def disemvowel(str)\n str = str.delete 'AEIOUaeiou'\nend",
"def devowel(str)\n str.delete(VOWELS)\nend",
"def disemvowel(str)\n str.delete('aeiouAEIOU')\nend",
"def disemvowel(str)\n str.delete(\"aAeEiIoOuU\")\nend",
"def reverberate(sent) \n vowels = 'aeiou'\n words = sent.split\n new_words = []\n\n\n words.each do |word|\n if word.length < 3 \n new_words << word \n elsif vowels.include?(word[-1].downcase)\n new_words << word + word.downcase\n else\n i = word.length - 1\n while i >= 0 \n if vowels.include?(word[i]) \n new_words << word + word[i .. -1]\n break\n end \n\n i -= 1\n end \n end \n end \n\n new_words.join(' ')\n\nend",
"def cleanup(str)\n str.gsub(/\\W+/, ' ')\nend"
] |
[
"0.75706637",
"0.7558028",
"0.7462536",
"0.73287064",
"0.7279852",
"0.7271789",
"0.72627985",
"0.72091013",
"0.72044814",
"0.7203919",
"0.7198793",
"0.71929234",
"0.719145",
"0.7189943",
"0.7186061",
"0.71720684",
"0.71579576",
"0.71396464",
"0.7137439",
"0.7134888",
"0.70926404",
"0.70833707",
"0.7072434",
"0.7063691",
"0.70461553",
"0.7018259",
"0.7013512",
"0.7013281",
"0.70089114",
"0.69967914",
"0.69880825",
"0.69855136",
"0.69841903",
"0.6979978",
"0.6961954",
"0.6958411",
"0.69557416",
"0.6953738",
"0.6937606",
"0.69288456",
"0.69169843",
"0.6913446",
"0.6911287",
"0.69111454",
"0.69110096",
"0.69108456",
"0.6906966",
"0.69061375",
"0.6901039",
"0.6899352",
"0.689906",
"0.6898864",
"0.68916965",
"0.68916965",
"0.6890703",
"0.68860775",
"0.6881529",
"0.6880054",
"0.6871306",
"0.6863479",
"0.68597716",
"0.68572646",
"0.6854047",
"0.68393683",
"0.683525",
"0.68266034",
"0.6826034",
"0.6803663",
"0.6800785",
"0.6800509",
"0.6794387",
"0.6794296",
"0.6787726",
"0.6784816",
"0.67829794",
"0.6782964",
"0.6782964",
"0.67801505",
"0.6777856",
"0.6776564",
"0.6774401",
"0.6758177",
"0.6754797",
"0.67443895",
"0.673991",
"0.6736716",
"0.6732094",
"0.67195874",
"0.6707457",
"0.6689713",
"0.6670708",
"0.6669693",
"0.66691506",
"0.66593325",
"0.66587675",
"0.66539663",
"0.665349",
"0.66385096",
"0.6635958",
"0.6634146"
] |
0.7584386
|
0
|
The MFS API exposes a FileToken creation via several different URLs. However we will never want to create a file token that we do not already have a file to hand, and hence we only use the FileStore URL.
|
def create(file, properties = {})
path = @file_repository.path_for(file, 'createfiletoken')
@client.post(path, properties).tap do |token|
token.file = file
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def save(file_token, file)\n create(file, {\n :RedirectWhenExpiredUrl => file_token.redirect_when_expired_url,\n :Unlimited => file.unlimited,\n :MaxDownloadAttempts => file.max_download_attempts,\n :MaxDownloadSuccesses => file.max_download_successes\n })\n end",
"def token_uri; end",
"def initialize(token)\n @token = token\n @file_cache = {}\n end",
"def fetch_token_from_tempfile\n # Store in env for command line!\n file = File.new('.token', 'r')\n token = file.read\n file.close\n token\n end",
"def store\n @transform_tasks.push(\n add_transform_task('store', {})\n )\n response = UploadUtils.make_call(url, 'get')\n response_body = JSON.parse(response.body)\n handle = response_body['url'].split('/').last\n FilestackFilelink.new(handle, apikey: @apikey, security: @security)\n end",
"def get_compare_file\n compare_file = is_enable_direct_url == true ? {\n :fileType => \"docx\", # file type\n :url => DocumentHelper.get_server_url(true) + \"/assets/sample/sample.docx\", # server url to the compared file\n :directUrl => DocumentHelper.get_server_url(false) + \"/assets/sample/sample.docx\" # direct url to the compared file\n } : {\n :fileType => \"docx\", # file type\n :url => DocumentHelper.get_server_url(true) + \"/assets/sample/sample.docx\" # server url to the compared file\n }\n\n if JwtHelper.is_enabled # check if a secret key to generate token exists or not\n compare_file[\"token\"] = JwtHelper.encode(compare_file) # encode a payload object into a token and write it to the compare_file object\n end\n \n return compare_file\n end",
"def get_access_token_file\n\t\t\tsprintf('%s/%s-tidyclub-oauth-token', Dir.tmpdir, @club_name)\n\t\tend",
"def create\n file = params[:file_store][:file]\n file_store = FileStore.new\n file_store.sha1_hash = Digest::SHA1.file(file.path).hexdigest\n file_store.file = file\n file_store.user_id, file_store.user_uname = user['id'], user['uname']\n\n if file_store.save\n File.delete file.path\n render json: { sha1_hash: file_store.sha1_hash }, status: :created\n else\n render json: file_store.errors, status: :unprocessable_entity\n end\n end",
"def create\n @url = params[:url]\n token = SecureRandom.hex(4)\n @tiny_token = Url.create(\n url: @url,\n token: token,\n domain: \"#{ENV['HOSTNAME']}/#{token}\" \n )\n redirect_to url_path(token)\n \n end",
"def token_url\n params[:url] + (params[:token_path] || '/token')\n end",
"def create_set_and_add_token\n token = SecureRandom.urlsafe_base64\n @user.token = token\n response.headers['X-AUTH-TOKEN'] = token\n end",
"def filename\n if super.present?\n \"#{secure_token}.#{file.extension}\"\n end\n end",
"def tokens_path\n @tokens_path || \"/requests/tokens/\"\n end",
"def create_file_from_url(env, uri, file_name, auth_header = {})\n ::FileSet.new(import_url: uri.to_s, label: file_name) do |fs|\n actor = file_set_actor_class.new(fs, env.user)\n actor.create_metadata(visibility: env.curation_concern.visibility)\n actor.attach_to_work(env.curation_concern)\n fs.save!\n ordered_members << fs\n if uri.scheme == 'file'\n # Turn any %20 into spaces.\n file_path = CGI.unescape(uri.path)\n IngestLocalFileJob.perform_later(fs, file_path, env.user)\n else\n ImportUrlJob.perform_later(fs, operation_for(user: actor.user), auth_header)\n end\n end\n end",
"def create_token_url(cmatch, tstamp)\n token_url = $base_url + \"token/\" + cmatch\n record_token(cmatch, tstamp)\n return token_url\nend",
"def token_url\n \"#{sk_url}/oauth/token\"\n end",
"def generate_remote_token!\n remote_tokens.create.token\n end",
"def create_temp_url(file, expires = Time.now.to_i + 600, account_meta_key = @account_meta_key)\n \n # Generate tempURL\n method = 'GET'\n \n public_url = URI(file.public_url)\n base = \"#{public_url.scheme}://#{public_url.host}/\"\n path = public_url.path\n\n hmac_body = \"#{method}\\n#{expires}\\n#{path}\"\n sig = Digest::HMAC.hexdigest(hmac_body, account_meta_key, Digest::SHA1)\n\n \"#{file.public_url}?temp_url_sig=#{sig}&temp_url_expires=#{expires}\"\n end",
"def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present? \n end",
"def token_store_key\n @token_store_key ||=\n begin\n # Strip the host part to just the hostname (i.e. no scheme or port)\n host = @settings.host!\n host = URI(host).hostname if host =~ /\\Ahttps?:\\/\\//\n identity_segment = if fmid_token = @settings.fmid_token\n require \"digest\"\n Digest::SHA256.hexdigest(fmid_token)\n else\n @settings.username!\n end\n \"#{host}:#{@settings.database!}:#{identity_segment}\"\n end\n end",
"def content_tokens\n filename\n end",
"def public_url_token(options={})\n o = set_defaults(options)\n\n t = token_secret\n e = o[:expires]\n u = o[:use]\n c = o[:class]\n i = o[:id]\n n = o[:name]\n x = o[:extension]\n\n str = [t,e,u,c,i,n,x].join(\"|\")\n logger.debug(str)\n\n Digest::MD5.hexdigest(str)\n end",
"def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present?\n end",
"def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present?\n end",
"def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present?\n end",
"def retrieve!(identifier)\n File.new(uploader, self, uploader.store_path(identifier))\n end",
"def request_token_url\n @options[:request_token_url] || site + request_token_path\n end",
"def save_access_token(token, now)\n File.open('/opt/gluu-server/etc/certs/api_token.json', 'w') do |f|\n JSON.dump(\n {\n token: token,\n exp: now\n },\n f,\n )\n end\n end",
"def create_file_from_url(url, file_name)\n ::GenericFile.new(import_url: url, label: file_name).tap do |gf|\n actor = Sufia::GenericFile::Actor.new(gf, current_user)\n actor.create_metadata(params[:batch_id])\n gf.save!\n Sufia.queue.push(ImportUrlJob.new(gf.id))\n end\n end",
"def filename\n \"#{secure_token}.#{file.extension}\" if original_filename\n end",
"def new_store_file(option={}) # :nodoc:\n dir = option['tmpdir'] || Dir::tmpdir\n prefix = option['prefix']\n suffix = option['suffix']\n require 'digest/md5'\n md5 = Digest::MD5.hexdigest(session_id)[0,16]\n path = dir+\"/\"\n path << prefix if prefix\n path << md5\n path << suffix if suffix\n if File::exist? path\n hash = nil\n elsif new_session\n hash = {}\n else\n raise NoSession, \"uninitialized session\"\n end\n return path, hash\n end",
"def create_development(proxy_uri = nil, &block)\n service_options = { client: Azure::Storage::Common::Client::create_development(proxy_uri, &block), api_version: Azure::Storage::File::Default::STG_VERSION }\n Azure::Storage::File::FileService.new(service_options, &block)\n end",
"def create_token(opts = {})\n self.token = Digest::SHA256.hexdigest(\n Time.now.to_s + Rails.application.secrets.salt + email\n )\n save if opts[:save] == true\n end",
"def create_file_from_url_through_active_fedora(env, uri, file_name, auth_header)\n import_url = URI.decode_www_form_component(uri.to_s)\n ::FileSet.new(import_url: import_url, label: file_name) do |fs|\n actor = Hyrax::Actors::FileSetActor.new(fs, env.user)\n actor.create_metadata(visibility: env.curation_concern.visibility)\n actor.attach_to_work(env.curation_concern)\n fs.save!\n if uri.scheme == 'file'\n # Turn any %20 into spaces.\n file_path = CGI.unescape(uri.path)\n IngestLocalFileJob.perform_later(fs, file_path, env.user)\n else\n ImportUrlJob.perform_later(fs, operation_for(user: actor.user), auth_header)\n end\n end\n end",
"def token_store_path\n return ENV['GOOGLE_CREDENTIAL_STORE'] if ENV.has_key?('GOOGLE_CREDENTIAL_STORE')\n return well_known_path_for('credentials.yaml')\n end",
"def cached_access_token(config)\n File.read(config.access_token_filename).chomp\n end",
"def token(add_params = nil)\n params = {\n uid: uid,\n }\n api_call('/stores/:uid/token(.:format)',:post,params,add_params)\n end",
"def create_file_from_url(url, file_name)\n ::FileSet.new(import_url: url, label: file_name) do |fs|\n actor = CurationConcerns::Actors::FileSetActor.new(fs, user)\n actor.create_metadata(curation_concern, visibility_attributes)\n fs.save!\n uri = URI.parse(URI.encode(url))\n if uri.scheme == 'file'\n IngestLocalFileJob.perform_later(fs, URI.decode(uri.path), user)\n else\n ImportUrlJob.perform_later(fs, file_name, log(actor.user))\n end\n end\n end",
"def generate_token\n self.token = custom_token.presence || SecureRandom.hex(3)\n self.custom_token = nil\n generate_token if AliasedLink.exists?(token: token)\n end",
"def token_store_path\n return ENV['GOOGLE_CREDENTIAL_STORE'] if ENV.has_key?('GOOGLE_CREDENTIAL_STORE')\n return well_known_path_for('credentials.yaml')\n end",
"def create_token_for(app_name)\n timestamp = Time.now.utc.strftime(\"%Y%m%d%H%M%S\")\n display = \"#{app_name}_#{timestamp}\"\n Vault.auth_token.create(name: app_name,\n ttl: '720h',\n display_name: display,\n policies: [app_name])\n end",
"def create_share_token\n # Don't update it if you don't need to! We never want this to change\n self.share_token = SecureRandom.hex(13) unless share_token\n end",
"def token_url(user, ip, playback)\n auth_token = get_token(user, ip)\n if auth_token.present?\n uri = playback.url\n uri += URI.parse(uri).query.blank? ? \"?\" : \"&\"\n uri += \"token=#{auth_token}\"\n uri\n end\n end",
"def post_file(filename,repo)\n curl_post(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\",{\"operation\"=> \"create\"}).body_str\n end",
"def file_url\n end",
"def new_file(key, klass = nil, bytes = 0, &block) # :yields: file\n raise MogileFS::ReadOnlyError if readonly?\n opts = { :domain => @domain, :key => key, :multi_dest => 1 }\n opts[:class] = klass if klass\n res = @backend.create_open(opts)\n\n dests = if dev_count = res['dev_count'] # multi_dest succeeded\n (1..dev_count.to_i).map do |i|\n [res[\"devid_#{i}\"], res[\"path_#{i}\"]]\n end\n else # single destination returned\n # 0x0040: d0e4 4f4b 2064 6576 6964 3d31 2666 6964 ..OK.devid=1&fid\n # 0x0050: 3d33 2670 6174 683d 6874 7470 3a2f 2f31 =3&path=http://1\n # 0x0060: 3932 2e31 3638 2e31 2e37 323a 3735 3030 92.168.1.72:7500\n # 0x0070: 2f64 6576 312f 302f 3030 302f 3030 302f /dev1/0/000/000/\n # 0x0080: 3030 3030 3030 3030 3033 2e66 6964 0d0a 0000000003.fid..\n\n [[res['devid'], res['path']]]\n end\n\n case (dests[0][1] rescue nil)\n when nil, '' then\n raise MogileFS::EmptyPathError\n when /^http:\\/\\// then\n MogileFS::HTTPFile.open(self, res['fid'], klass, key,\n dests, bytes, &block)\n else\n raise MogileFS::UnsupportedPathError,\n \"paths '#{dests.inspect}' returned by backend is not supported\"\n end\n end",
"def saved_token(auth_params, quiet)\n if File.exists?(Token_file) \n file = File.open(Token_file, \"r\")\n oauth_token = file.gets\n #puts \"File time: #{file.mtime}, Now: #{Time.now}\"\n token_age = TimeDifference.between(file.mtime, Time.now).in_minutes\n file.close\n\n if token_age > Token_expire_time\n STDERR.puts \"Saved token is #{token_age} minutes old, getting a new one\"\n file = File.open(Token_file, \"w+\")\n oauth_token = get_token(auth_params)\n file.write(oauth_token)\n file.close\n else\n if quiet == false\n STDERR.puts \"Using a saved token #{token_age} minutes old\"\n end\n end\n else\n if quiet == false\n STDERR.puts \"Creating new token file (#{Token_file})\"\n end\n oauth_token = get_token(auth_params)\n File.write(Token_file, oauth_token)\n end\n return oauth_token\nend",
"def initialize(token, token_type = TokenCredentials::DEFAULT_SCHEME)\n @token = token\n @token_type = token_type\n end",
"def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:)\n instrument :url, key: key do |payload|\n verified_token_with_expiration = ActiveStorage.verifier.generate(\n {\n key: key,\n content_type: content_type,\n content_length: content_length,\n checksum: checksum\n },\n { expires_in: expires_in,\n purpose: :blob_token }\n )\n\n generated_url = url_helpers.update_rails_imgur_service_url(verified_token_with_expiration, host: current_host)\n\n payload[:url] = generated_url\n generated_url\n end\n end",
"def file_uri_scheme; end",
"def token_url(params=nil)\n connection.build_url(options[:token_url], params).to_s\n end",
"def generate_token\n self.token = SecureRandom.urlsafe_base64\n end",
"def generate_token\n self.token ||= Base64.urlsafe_encode64(SecureRandom.random_bytes(12))\n end",
"def load_access_token\n return unless File.exist?(FIELDAGENT_ACCESS_TOKEN_FILENAME)\n\n File.read(FIELDAGENT_ACCESS_TOKEN_FILENAME)\nend",
"def file_name(token)\n FileHelper.file_cache_name(file_cache_dir, token)\n end",
"def initialize(filename, options = {})\n type_options = options.extract!(:type)\n options.merge!(:authenticate? => true)\n \n @type = type_options[:type] || :create\n \n @parameters = ParameterList.new(options)\n @parameters << FileParameter.new('photo', filename)\n end",
"def get_stores_token_with_http_info(token, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StoresApi.get_stores_token ...'\n end\n # verify the required parameter 'token' is set\n if @api_client.config.client_side_validation && token.nil?\n fail ArgumentError, \"Missing the required parameter 'token' when calling StoresApi.get_stores_token\"\n end\n # resource path\n local_var_path = '/stores/{token}'.sub('{' + 'token' + '}', CGI.escape(token.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?\n\n # header parameters\n header_params = opts[: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 = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'StoreResponseModel'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"StoresApi.get_stores_token\",\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 => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StoresApi#get_stores_token\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_internal_token!\n self.token ||= generate_token\n end",
"def retrieve!(identifier)\n HesCloudStorage::HesCloudStorageEngine::File.new(uploader, self, ::File.basename(uploader.store_path(identifier), uploader.root))\n end",
"def store_file(*args)\n data, content_type, filename = args.reverse\n if filename\n http.put(204, luwak, escape(filename), data, {\"Content-Type\" => content_type})\n filename\n else\n response = http.post(201, luwak, data, {\"Content-Type\" => content_type})\n response[:headers][\"location\"].first.split(\"/\").last\n end\n end",
"def initialize(token, read_api_url = READ_API_URL, write_api_url = WRITE_API_URL)\n @token = token\n @read_api_url = read_api_url\n @write_api_url = write_api_url\n end",
"def initialize(token, read_api_url = READ_API_URL, write_api_url = WRITE_API_URL)\n @token = token\n @read_api_url = read_api_url\n @write_api_url = write_api_url\n end",
"def endpoint_url_with_token(action, token = nil)\n @token = token if token\n \"#{endpoint_url(action)}?token=#{@token}\"\n end",
"def token_endpoint\n URI::HTTPS.build(host: @host, path: '/' + @tenant + TOKEN_PATH)\n end",
"def filename\n \"#{original_filename}+#{secure_token}.#{file.extension}\" if original_filename.present?\n end",
"def new_token\n SecureRandom.urlsafe_base64\nend",
"def new_token\n \t SecureRandom.urlsafe_base64\n \tend",
"def makeURL(path)\n \"#{self.api_endpt + path}?token=#{self.token}\"\n end",
"def store(key_store_file, password)\n\n end",
"def store_token\n user_config.set :pivotal_token, token\n end",
"def build_tiny_url\n self.tiny_url = Token.generate_url\n end",
"def create uri\n filename = uri_to_file(uri)\n @change_semaphore.synchronize do\n library.create_from_disk filename\n end\n end",
"def cache_refresh_token(config, token)\n File.write(config.refresh_token_filename, token)\n end",
"def get_token\n\t\tservice = current_user.services.find_by(name: \"Onedrive\")\n\t\tclient = OAuth2::Client.new(Rails.application.secrets.onedrive_key,\n\t\t\t\t\t\t\t\t\tRails.application.secrets.onedrive_secret,\n\t\t\t\t\t\t\t\t\t:site => 'https://login.live.com',\n\t\t\t\t\t\t\t\t\t:response_type => 'code',\n\t\t\t\t\t\t\t\t\t:token_url => '/oauth20_token.srf')\n\t\t# If service doesn't exist, create a new token and create the service\n\t\tif !service\n\t\t\ttoken = client.auth_code.get_token(params[:code], :redirect_uri => onedrive_callback_url)\n\t\t\tdrive_info = JSON.parse(RestClient.get(\"https://api.onedrive.com/v1.0/drives/me\", {:Authorization => \"Bearer #{token.token}\"}))\n\t\t\tservice = current_user.services.create!(name: \"Onedrive\", access_token: token.to_hash, used_space: drive_info[\"quota\"][\"used\"], total_space: drive_info[\"quota\"][\"total\"])\n\t\t# Else if there is a service and the token is expired refresh it and save it\n\t\telsif Time.at(eval(service.access_token)[:expires_at]) < Time.now\n\t\t\ttoken = OAuth2::AccessToken.from_hash(client, eval(service.access_token))\n\t\t\tservice.update(access_token: token.refresh!.to_hash)\n\t\tend\n\t\t# Return the access token\n\t\t@token = eval(service.access_token)[:access_token]\n\tend",
"def create_file_from_url_through_valkyrie(env, uri, file_name, auth_header)\n import_url = URI.decode_www_form_component(uri.to_s)\n fs = Hyrax.persister.save(resource: Hyrax::FileSet.new(import_url: import_url, label: file_name))\n actor = Hyrax::Actors::FileSetActor.new(fs, env.user, use_valkyrie: true)\n actor.create_metadata(visibility: env.curation_concern.visibility)\n actor.attach_to_work(env.curation_concern)\n if uri.scheme == 'file'\n # Turn any %20 into spaces.\n file_path = CGI.unescape(uri.path)\n IngestLocalFileJob.perform_later(fs, file_path, env.user)\n else\n ImportUrlJob.perform_later(fs, operation_for(user: actor.user), auth_header)\n end\n end",
"def retrieve!(identifier)\n CarrierWave::Storage::TrueVault::File.new(api_key, vault_id, identifier)\n end",
"def storage_access_token\n self.storage.service.credentials.client.access_token\n end",
"def set_gtfs_file (gtfs_feed_file_sym)\n @@gtfs_files[self] = gtfs_feed_file_sym\n end",
"def file_set_url(file_set_id)\n \"https://#{ENV['SERVER_NAME']}/downloads/#{file_set_id}\"\n end",
"def create_secret_token\n time = Time.now\n salt = rand(2048)\n random_string = \"#{url}#{time}#{salt}\"\n random_token = Digest::SHA256.hexdigest(random_string)\n secret_token = Base64.urlsafe_encode64(random_token.to_s)\n\n self.secret_token = secret_token\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def retrieve!(file)\n\t\t\t\tclient = uploader.jwt_private_key_path.present? ? box_client_jwt : box_client\n\t\t\t\tCarrierWave::Storage::Box::File.new(uploader, config, uploader.store_path(file), client)\n\t\t\tend",
"def store_access_token(url, user, token, insecure)\n config = Compliance::Configuration.new\n config.clean\n config['server'] = url\n config['insecure'] = insecure\n config['user'] = user\n config['token'] = token\n config['server_type'] = 'compliance'\n config['version'] = Compliance::API.version(config)\n config.store\n\n [true, 'API access token stored']\n end",
"def fetch\n response = request.post(path: \"/#{base_path}/token\", claims_token: claims_token.static)\n\n self.access_token = Oj.load(response.body)['token']\n self\n end",
"def generate_access_token\n self.access_token ||= self.create_access_token\n save && access_token\n end",
"def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:, custom_metadata: {})\n raise NotImplementedError\n end",
"def store_token(token)\n return unless token && !token.empty?\n File.open(TOKEN_FILE, 'w') do |f|\n f.write(token)\n end\n load_token\n rebuild_user_repos_cache\n end",
"def file_uri_scheme=(_arg0); 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 store(file)\n sharefile_file = file.to_file\n @content_type ||= file.content_type\n root_folder = @config[:sharefile_root]\n @file = @client.store_document(root_folder, @path, sharefile_file)\n end",
"def create_token\n return api_call('request-token',{\"apiKey\"=> @@_api_key });\n end",
"def token\n auth_client.token(settings.oauth2_token).tap do |token|\n settings.save_oauth2_token(token.to_hash)\n end\n end",
"def create_token\n @user = User.find(params[:id])\n @token = Token.generate(@user)\n\n respond_to do |format|\n if @token.save\n format.html { redirect_to action: 'index'}\n format.json { render :show, status: :created, location: @token }\n else\n format.html { render :new }\n format.json { render json: @token.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_token\n\t\tSecureRandom.urlsafe_base64\n\tend",
"def token(request)\n end",
"def generate_token\n token_hash = SecureRandom.hex\n token_hash.force_encoding('utf-8')\n access_tokens.create(token: token_hash, token_expire: Time.now + DEFAULT_TOKEN_EXPIRE)\n end",
"def generate_token\n token_hash = SecureRandom.hex\n token_hash.force_encoding('utf-8')\n access_tokens.create(token: token_hash, token_expire: Time.now + DEFAULT_TOKEN_EXPIRE)\n end",
"def create_user(type: :collection_manager, token: true)\n user = FactoryBot.create(type)\n user.create_token if token\n user.save\n user\nend"
] |
[
"0.6421063",
"0.5708221",
"0.55999655",
"0.55879956",
"0.557966",
"0.5577307",
"0.5471286",
"0.5462341",
"0.5447786",
"0.5443468",
"0.5438388",
"0.54278076",
"0.54076326",
"0.5395299",
"0.5373914",
"0.5370456",
"0.53535146",
"0.5275479",
"0.52753377",
"0.5241569",
"0.522696",
"0.52259874",
"0.51362014",
"0.51362014",
"0.51362014",
"0.51206136",
"0.51127976",
"0.5099958",
"0.50996983",
"0.5098968",
"0.50888073",
"0.5087778",
"0.5084262",
"0.50835603",
"0.50807214",
"0.5076334",
"0.50724554",
"0.5066878",
"0.5063556",
"0.5056438",
"0.5051715",
"0.5043353",
"0.50334954",
"0.50242865",
"0.50197476",
"0.50029606",
"0.49992144",
"0.49886948",
"0.49762395",
"0.4954156",
"0.49503887",
"0.49494433",
"0.49418518",
"0.49416795",
"0.49404263",
"0.49357378",
"0.49356887",
"0.49340692",
"0.49312744",
"0.49303958",
"0.49277803",
"0.49277803",
"0.49172682",
"0.49171355",
"0.49127066",
"0.48909983",
"0.48837996",
"0.4879169",
"0.48791173",
"0.48785004",
"0.48654234",
"0.48635122",
"0.485955",
"0.48503593",
"0.48403525",
"0.48364788",
"0.48341998",
"0.48305523",
"0.48296085",
"0.482857",
"0.48276874",
"0.48276874",
"0.48276874",
"0.48273778",
"0.4826505",
"0.48252192",
"0.4817432",
"0.48128882",
"0.48096427",
"0.4805984",
"0.4797504",
"0.47959226",
"0.47955337",
"0.47940767",
"0.47900558",
"0.47896668",
"0.47881708",
"0.47871414",
"0.47871414",
"0.47851455"
] |
0.604284
|
1
|
As an alternative a FileToken object can be created and the appropriate values set, then the save method called which creates the token on the server and its details loaded.
|
def save(file_token, file)
create(file, {
:RedirectWhenExpiredUrl => file_token.redirect_when_expired_url,
:Unlimited => file.unlimited,
:MaxDownloadAttempts => file.max_download_attempts,
:MaxDownloadSuccesses => file.max_download_successes
})
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_set_and_add_token\n token = SecureRandom.urlsafe_base64\n @user.token = token\n response.headers['X-AUTH-TOKEN'] = token\n end",
"def create_token(opts = {})\n self.token = Digest::SHA256.hexdigest(\n Time.now.to_s + Rails.application.secrets.salt + email\n )\n save if opts[:save] == true\n end",
"def saved_token(auth_params, quiet)\n if File.exists?(Token_file) \n file = File.open(Token_file, \"r\")\n oauth_token = file.gets\n #puts \"File time: #{file.mtime}, Now: #{Time.now}\"\n token_age = TimeDifference.between(file.mtime, Time.now).in_minutes\n file.close\n\n if token_age > Token_expire_time\n STDERR.puts \"Saved token is #{token_age} minutes old, getting a new one\"\n file = File.open(Token_file, \"w+\")\n oauth_token = get_token(auth_params)\n file.write(oauth_token)\n file.close\n else\n if quiet == false\n STDERR.puts \"Using a saved token #{token_age} minutes old\"\n end\n end\n else\n if quiet == false\n STDERR.puts \"Creating new token file (#{Token_file})\"\n end\n oauth_token = get_token(auth_params)\n File.write(Token_file, oauth_token)\n end\n return oauth_token\nend",
"def create(file, properties = {})\n path = @file_repository.path_for(file, 'createfiletoken')\n @client.post(path, properties).tap do |token|\n token.file = file\n end\n end",
"def save_token\n self.token = SecureRandom.uuid unless self.token\n end",
"def save_access_token(token, now)\n File.open('/opt/gluu-server/etc/certs/api_token.json', 'w') do |f|\n JSON.dump(\n {\n token: token,\n exp: now\n },\n f,\n )\n end\n end",
"def save_authentication_token(token)\n carrier_setting.settings['token'] = token\n carrier_setting.settings['token_expire_date'] = DateTime.now + 7.hours\n carrier_setting.save\n end",
"def set_token! model\n token = set_token model\n model.save!\n token\n end",
"def set_internal_token!\n self.token ||= generate_token\n end",
"def save_token(path, token)\n File.open(path, 'w') do |f|\n begin\n f.flock(File::LOCK_EX)\n f.puts token.to_json\n ensure\n f.flock(File::LOCK_UN)\n end\n end\n end",
"def fetch_token_from_tempfile\n # Store in env for command line!\n file = File.new('.token', 'r')\n token = file.read\n file.close\n token\n end",
"def create_token\n\t\tself.token = BCrypt::Password.create(User.find(self.user_id).email + Time.now.to_f.to_s)\n\tend",
"def create_token\n token = SecureRandom.hex(10) #on crée un token de 10 caractères au hasard\n self.token = token #affectation du token à la candidature\n self.save\n end",
"def generate_token!\n self.token = SecureRandom.hex\n save!\n end",
"def token\n auth_client.token(settings.oauth2_token).tap do |token|\n settings.save_oauth2_token(token.to_hash)\n end\n end",
"def save_token(token)\n File.write(config_file, token)\n end",
"def initialize(token)\n @token = token\n @file_cache = {}\n end",
"def create\n @token = Token.new\n @token.id = SecureRandom.hex[0..7]\n @token.name = token_params.name\n @token.bin = token_params.number[0,6]\n @token.last4 = token_params.number[13,16]\n\n if @token.save\n render json: @token, status: :created, location: @token\n else\n render json: @token.errors, status: :unprocessable_entity\n end\n end",
"def generate_auth_token\n token = AuthToken.new(user: self)\n token if token.save\n end",
"def save token_object\n #raise StandardError\n unless token_object.respond_to?('token')\n raise TokenObjectError\n end \n super(token_object)\n end",
"def create_token\n @account_token = SecureRandom.urlsafe_base64(nil, false)\n @authentication_token = create_authentication_token\n key = account_token_key(@account_token)\n redis_token = Redis::HashKey.new(key)\n expire_time = DateTime.now + ACCOUNT_TOKEN_TTL\n redis_token.bulk_set({expire_at: expire_time.to_s, authentication_token: @authentication_token})\n redis_token.expireat(expire_time.to_i)\n update_app_info\n {account_token: @account_token, authentication_token: @authentication_token}\n end",
"def create_token\n if self.token.nil?\n self.token = loop do\n random_token = \"BON-#{SecureRandom.uuid.split('-').first}\"\n break random_token unless self.class.exists?(token: random_token)\n end\n end\n end",
"def create_file(file)\n @generic_file = GenericFile.new\n @generic_file.batch_id = object.batch.pid\n @generic_file.add_file(file.read, 'content', file.name)\n @generic_file.apply_depositor_metadata(object.edit_users.first)\n @generic_file.date_uploaded = Time.now.ctime\n @generic_file.date_modified = Time.now.ctime\n @generic_file.save\n end",
"def ensure_token\n if self.token_expiration and Time.now > self.token_expiration\n self.token = nil\n end\n self.token ||= self.generate_token\n self.token_expiration = Time.now + 1.day\n self.save\n return self.token\n end",
"def save_token\n self.token ||= Digest::MD5.hexdigest(login + Time.now.to_i.to_s)[0..5]\n $redis.set \"#{KEY}:#{login}:token\", token\n $redis.set \"#{KEY}:#{token}:login\", login\n end",
"def store_token\n user_config.set :pivotal_token, token\n end",
"def generate_token\n new_token =\n SimpleTokenAuthentication::TokenGenerator.instance.generate_token\n update(authentication_token: new_token)\n self\n end",
"def regenerate_token\n self.auth_token = nil\n generate_token\n save!\n end",
"def set_token\n self.token ||= encrypted_data\n end",
"def store_token(token)\n return unless token && !token.empty?\n File.open(TOKEN_FILE, 'w') do |f|\n f.write(token)\n end\n load_token\n rebuild_user_repos_cache\n end",
"def set_token\n self.token = Digest::SHA2.hexdigest \"#{username}-#{lastvisitDate.to_i}\" if self.token.blank?\n end",
"def generate_token\n #Token.generate_token(self.id)\n end",
"def save_ebay_auth_token(*auth_token)\n begin\n @ebay_user = ebayapi_get_user\n @user_auth_token_exists = get_current_user_auth_token(@ebay_user.user_id)\n if @user_auth_token_exists\n # to update it\n ebay_auth_token=EbayAuthToken.find_by_user_id_and_ebay_uid(current_user.id,@ebay_user.user_id)\n ebay_auth_token.update_attribtes(:auth_token => auth_token.auth_token ,:expiration_time => auth_token.hard_expiration_time,:updated_at=> Time.now)\n\n elsif\n # to insert a new one\n EbayAuthToken.create(:token_set_name => \"\",:auth_token => auth_token.auth_token,:expiration_time => auth_token.hard_expiration_time, :user_id => current_user.id ,:primary_set => false, :ebay_uid => @ebay_user.user_id)\n end\n rescue Exception => e\n logger.info e.message\n\n end\n end",
"def issue_token(kind)\n session = Session.new(user: self, seconds: 3600)\n session.save\n if kind == :reset_token\n self.reset_token = session.token\n elsif kind == :verification_token\n self.verification_token = session.token\n end\n end",
"def create_or_update_token(omniauth)\n # Update token if present\n if token\n token.update_attributes(\n twitter_id: omniauth.uid.to_i,\n token: omniauth.credentials.token,\n secret: omniauth.credentials.secret\n )\n # or create token\n else\n create_token do |t|\n t.twitter_id = omniauth.uid.to_i\n t.token = omniauth.credentials.token\n t.secret = omniauth.credentials.secret\n end\n end\n end",
"def create\n puts \"MESSAGE 14 IN CREATE\"\n @auth = request.env['omniauth.auth']['credentials']\n # The following statement saves the tokens to the database\n Token.create(\n access_token: @auth['token'],\n refresh_token: @auth['refresh_token'],\n expires_at: Time.at(@auth['expires_at']).to_datetime)\n end",
"def generate_token\n self.token = SecureRandom.hex if new_record?\n end",
"def generate_token\n self.update({:token => SecureRandom.hex})\n end",
"def generate_remote_token!\n remote_tokens.create.token\n end",
"def write_token\n 'ddbc8384eaf4b6f0e70d66b606ccbf7ad4bb22bfe113'\n end",
"def create_token\n begin\n token = random_token\n end while repository[token] && repository[token] > Time.now - 172800\n repository[token] = Time.now\n token\n end",
"def generate_token\n self.token ||= Base64.urlsafe_encode64(SecureRandom.random_bytes(12))\n end",
"def generate_token\n self.status = STATUS[:present]\n self.access_token = SecureRandom.urlsafe_base64(45, true)\n self.expires = Time.zone.now.to_i + TOKEN_LIFE\n self.login_time = Time.zone.now\n self.user_events.build(event_name: 'Login', event_time: Time.zone.now)\n save\n self.access_token\n end",
"def generate_access_token\n self.access_token ||= self.create_access_token\n save && access_token\n end",
"def create_double_opt_in_token\n t_double_opt_in_token = Digest::MD5.hexdigest(\"#{@user_id}::#{@user.email}::#{Time.now.to_i}::token_sale_double_opt_in::#{rand}\")\n db_row = TemporaryToken.create!(\n {\n client_id: @client_id,\n entity_id: @user_id, kind: GlobalConstant::TemporaryToken.double_opt_in_kind,\n token: t_double_opt_in_token\n }\n )\n\n double_opt_in_token_str = \"#{db_row.id.to_s}:#{t_double_opt_in_token}\"\n encryptor_obj = LocalCipher.new(GlobalConstant::SecretEncryptor.email_tokens_key)\n r = encryptor_obj.encrypt(double_opt_in_token_str)\n return r unless r.success?\n @double_opt_in_token = r.data[:ciphertext_blob]\n end",
"def generate_authentication_token\n self.auth_token = User.new_token\n\t\t\tself.auth_expires_at = Time.now + 240.hours\n\tend",
"def generate_new_authentication_token\n token = User.generate_unique_secure_token\n update_attributes authentication_token: token\n end",
"def token(auth_code = T.unsafe(nil), headers = T.unsafe(nil)); end",
"def set_token\n self.token = SecureRandom.hex(16)\n end",
"def set_token\n self.token = SecureRandom.hex(16)\n end",
"def generate_token\n self.token = SecureRandom.urlsafe_base64\n end",
"def token\n Notify.spit 'Already have your Evernote token? Paste it now:'\n\n begin\n set_evertils_token\n rescue RuntimeError\n Notify.error ERROR_MESSAGE\n rescue Interrupt\n Notify.error ERROR_MESSAGE\n end\n\n Notify.success('Token saved!')\n end",
"def create_authentication_token!\n begin\n self.authentication_token = User.token\n end while User.exists?(authentication_token: self.authentication_token)\n end",
"def insert_update_token_details\n @token_details = Token.where(client_id: @client_id).first\n @token_details ||= Token.new(client_id: @client_id)\n\n @token_details.name = @name\n @token_details.symbol = @symbol\n @token_details.conversion_factor = @conversion_factor\n @token_details.delayed_recovery_interval = GlobalConstant::ClientToken.delayed_recovery_interval\n @token_details.stake_currency_id = @stake_currency_id\n @token_details.decimal = @stake_currency_decimal\n @token_details.preferred_display_currency_id = QuoteCurrency.details_by_symbol(GlobalConstant::QuoteCurrency.USD)[:id]\n\n @token_details.save! if @token_details.changed?\n\n KitSaasSharedCacheManagement::TokenDetails.new([@client_id]).clear\n\n success\n end",
"def create(body = {})\n @client.token.create(body)\n end",
"def create_token\n @user = User.find(params[:id])\n @token = Token.generate(@user)\n\n respond_to do |format|\n if @token.save\n format.html { redirect_to action: 'index'}\n format.json { render :show, status: :created, location: @token }\n else\n format.html { render :new }\n format.json { render json: @token.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(file=@file)\n if self.legacy?\n return unless @password.send(:to_file, self) \n end\n super\n end",
"def fetch\n response = request.post(path: \"/#{base_path}/token\", claims_token: claims_token.static)\n\n self.access_token = Oj.load(response.body)['token']\n self\n end",
"def regenerate_auth_token!\n generate_auth_token\n set_auth_token_expiry\n\n save\n end",
"def token\n @token ||= Token.new(config)\n end",
"def store(id, token)\n fail 'expected string parameter for id in Google::Auth::Stores - load' if id == nil\n tokenuser = Tokenuser.where(client_id: id).first\n if tokenuser\n tokenuser.update(token_json: token)\n else\n tokenuser = Tokenuser.new(client_id: id,\n token_json: token)\n tokenuser.save\n end\n tokenuser.token_json\n end",
"def generate_token\n token_gen = SecureRandom.hex\n self.token = token_gen\n token_gen\n end",
"def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end",
"def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end",
"def create\n @token = Token.new(params[:token])\n\n if @token.save\n render json: @token, status: :created, location: @token\n else\n render json: @token.errors, status: :unprocessable_entity\n end\n end",
"def assign_authentication_token\n self.authentication_token = generate_authentication_token\n end",
"def update_token! options = {}\n # Normalize all keys to symbols to allow indifferent access internally\n options = deep_hash_normalize options\n\n self.expires_in = options[:expires] if options.key? :expires\n self.expires_in = options[:expires_in] if options.key? :expires_in\n self.expires_at = options[:expires_at] if options.key? :expires_at\n\n # By default, the token is issued at `Time.now` when `expires_in` is\n # set, but this can be used to supply a more precise time.\n self.issued_at = options[:issued_at] if options.key? :issued_at\n\n # Special case where we want expires_at to be relative to issued_at\n if options.key?(:issued_at) && options.key?(:expires_in)\n set_relative_expires_at options[:issued_at], options[:expires_in]\n end\n\n self.access_token = options[:access_token] if options.key? :access_token\n self.refresh_token = options[:refresh_token] if options.key? :refresh_token\n self.id_token = options[:id_token] if options.key? :id_token\n\n self\n end",
"def create\n data = self.class.create_payment_token(self)\n self.id = data.id\n data\n end",
"def create_new_auth_token(client_id=nil)\n client_id ||= SecureRandom.urlsafe_base64(nil, false)\n last_token ||= nil\n token = SecureRandom.urlsafe_base64(nil, false)\n token_hash = BCrypt::Password.create(token)\n expiry = (Time.now + DeviseTokenAuth.token_lifespan).to_i\n\n if self.tokens[client_id] and self.tokens[client_id]['token']\n last_token = self.tokens[client_id]['token']\n end\n\n self.tokens[client_id] = {\n token: token_hash,\n expiry: expiry,\n last_token: last_token,\n updated_at: Time.now\n }\n\n self.save!\n\n return build_auth_header(token, client_id)\n end",
"def generate_token\n self.token = secure_digest(Time.now, candidate_id)\n end",
"def setup_token\n token = SecureRandom.hex(16)\n @token = token\n token\n end",
"def generate_token\n self.token = UniqueToken.generate\n end",
"def assign_secure_token\n self.secure_token = SecureRandom.hex\n end",
"def access_token\n User.create_access_token(self)\n end",
"def generate_token\n self.token = SecureRandom.base64(64)\n end",
"def create_api_token\n begin\n ApiToken.create(api_consumer: self)\n end\n end",
"def create_token\n return api_call('request-token',{\"apiKey\"=> @@_api_key });\n end",
"def create_remember_token\r\n #Creates the token\r\n self.remember_token = SecureRandom.urlsafe_base64\r\n #note: the capital \"R\" here, and caps in general MATTER\r\n \r\n #w/o the \"self\" assignment, would create local variable called\r\n #remember_token, using self ensures that assignment sets the\r\n #user's remember_token in the database with its other attributes\r\n #when the user is saved\r\n \r\n #SecureRandom is a module in the Ruby standard library that\r\n #creates a Base64 string safe for us in URIs (and therefore\r\n #cookies), it returns a random 16 character string, each character\r\n #has 64 possibilities\r\n end",
"def set_token\n @token = ENV[\"TYPEFORM_API_TOKEN\"]\n end",
"def set_token\n @token = @instance.tokens.find(params[:id] || params[:token_id])\n end",
"def create_token\n client_requested_expires_in = server.jwt['exp'].to_i - server.jwt['iat'].to_i\n server_expires_in = Authorization::Token.access_token_expires_in(configuration, client)\n if server_expires_in\n expires_in = (client_requested_expires_in > 0 && client_requested_expires_in <= server_expires_in) ? client_requested_expires_in : server_expires_in\n else\n expires_in = nil\n end\n @access_token = AccessToken.find_or_create_for(application: client.application, resource_owner: resource_owner, scopes: scopes, expires_in: expires_in, use_refresh_token: configuration.refresh_token_enabled?)\n end",
"def save\n if (file && api_key)\n self._upload(api_key, file)\n end\n super\n end",
"def create_token_for(client, scope, identity = nil, expires = nil)\n expires_at = Time.now.to_i + expires if expires && expires != 0\n token = { :_id=>Server.secure_random, :scope=>scope,\n :client_id=>client.id, :created_at=>Time.now.to_i,\n :expires_at=>expires_at, :revoked=>nil }\n token[:identity] = identity if identity\n collection.insert token\n Client.collection.update({ :_id=>client.id }, { :$inc=>{ :tokens_granted=>1 } })\n Server.new_instance self, token\n end",
"def create_token_for(app_name)\n timestamp = Time.now.utc.strftime(\"%Y%m%d%H%M%S\")\n display = \"#{app_name}_#{timestamp}\"\n Vault.auth_token.create(name: app_name,\n ttl: '720h',\n display_name: display,\n policies: [app_name])\n end",
"def auth_token\n TokenProvider.issue_token(\n first_name: object.first_name,\n last_name: object.last_name,\n username: object.username,\n user_id: object.id,\n role: object.role\n )\n end",
"def generate_token\n\t\tself.token = SecureRandom.hex\n end",
"def create\n @token = Token.new(params[:token])\n \n respond_to do |format|\n if @token.save\n format.html { redirect_to @token, notice: 'Token was successfully created.' }\n format.json { render json: @token, status: :created, location: @token }\n else\n format.html { render action: \"new\" }\n format.json { render json: @token.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_token\n \t SecureRandom.urlsafe_base64\n \tend",
"def set_token model\n challenge = generate_challenge model\n model[challenge_column] = encrypt challenge\n build_token model, challenge\n end",
"def set_token\n @token = Token.find(params[:id])\n end",
"def create\n @token = Token.new(token_params)\n\n respond_to do |format|\n if @token.save\n format.html { redirect_to admin_token_path(@token), notice: 'Token was successfully created.' }\n format.json { render :show, status: :created, location: admin_token_path(@token) }\n else\n format.html { render :new }\n format.json { render json: @token.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_token(token)\n puts(token.to_json)\n @api.post(\"#{Paths::TOKENS}\", :body => token)\n end",
"def create_auth_token(key)\n\t\tself.auth_token = Digest::SHA1.hexdigest(\"#{random_string}--#{Time.now}---#{key}\")\n\tend",
"def token\n begin\n self.token = SecureRandom.hex\n end while self.class.exists?(token: auth_token)\n end",
"def store_access_token(data)\n @access_token = data['access_token']\n @expires_at = Time.now + data['expires_in']\n end",
"def principal_token=(token)\n end",
"def token\n unless defined?(@token)\n @token = {\n 'id' => self.catalog['token']['id'],\n 'expires' => Time.parse(self.catalog['token']['expires'])\n }\n @token['tenant'] = self.catalog['token']['tenant']['id'] if self.catalog['token']['tenant']\n end\n @token\n end",
"def create\n @apn_token = ApnToken.find_by(token: apn_token_params[:token])\n @apn_token = ApnToken.new(apn_token_params) unless @apn_token\n @apn_token.updated_at = Time.now\n respond_to do |format|\n if @apn_token.save\n format.html { redirect_to @apn_token, notice: 'Apn token was successfully created.' }\n format.json { render :show, status: :created, location: @apn_token }\n else\n format.html { render :new }\n format.json { render json: @apn_token.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_token\n @token = @instance.tokens.find(params[:id] || params[:token_id])\n end",
"def set_token\n @token = @instance.tokens.find(params[:id] || params[:token_id])\n end"
] |
[
"0.6669474",
"0.6643992",
"0.65656835",
"0.65253764",
"0.6418239",
"0.6336571",
"0.6302997",
"0.6250146",
"0.62203854",
"0.62145793",
"0.61862487",
"0.6174834",
"0.6094246",
"0.60820854",
"0.60649407",
"0.6040726",
"0.603184",
"0.6012607",
"0.5979807",
"0.5972874",
"0.59642714",
"0.594636",
"0.59424084",
"0.593697",
"0.5905255",
"0.5885991",
"0.5876451",
"0.58701867",
"0.585737",
"0.58532655",
"0.5843447",
"0.5808575",
"0.580851",
"0.5803958",
"0.5792561",
"0.5788453",
"0.57881045",
"0.5777213",
"0.5773074",
"0.5769548",
"0.57638365",
"0.57615966",
"0.57553864",
"0.5737499",
"0.5731774",
"0.5730622",
"0.5727303",
"0.5722053",
"0.5719595",
"0.5719595",
"0.5708426",
"0.5705933",
"0.5697892",
"0.56971955",
"0.5688275",
"0.5686725",
"0.5674481",
"0.566569",
"0.5665324",
"0.5659795",
"0.5640029",
"0.5637729",
"0.56353956",
"0.56353956",
"0.5633364",
"0.5630277",
"0.5627066",
"0.5623679",
"0.56213295",
"0.56195617",
"0.5607952",
"0.5597486",
"0.55962867",
"0.55936706",
"0.5583067",
"0.55818033",
"0.55739534",
"0.55687463",
"0.5565462",
"0.55647933",
"0.55628365",
"0.55622435",
"0.5562218",
"0.5553281",
"0.5553021",
"0.5547317",
"0.5539623",
"0.55279434",
"0.5526759",
"0.55256",
"0.55234116",
"0.5518764",
"0.5506593",
"0.5504583",
"0.5500413",
"0.54978853",
"0.5497552",
"0.5491661",
"0.5489193",
"0.5489193"
] |
0.73821336
|
0
|
Returns true if the user is logged in helper methods aren't available in tests! so we can't use the other method, but we will call it a different name to avoid confusion other method: logged_in in helpers/sessions_helper. since helpers/sessions_helper isn't availabled, we also can't use the current_user method defined there, so we will use 'session' which is available
|
def is_logged_in?
!session[:user_id].nil?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user_logged_in?\n # Because helper methods are not available in tests,\n # we can’t use the `current_user` method,\n # but the `session` method is available.\n ! session[:user_id].nil?\n end",
"def is_logged_in\n #since these are also marked as helper methods, they are availalble in not just all ctronollers (cuz they inherit from appc ontroler) but also avialble to views\n\n (session[:user_id] && session[:user_id].present? ) ? true : false\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\r\n !!current_user\r\n end",
"def logged_in?\n\t\t!!current_user\n end",
"def logged_in?\n #turn current_user into boolean to know if logged in\n #double !! in rails helps reuturn boolean which returns true or false\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in? \n # !!current_user either returning true or false without if statement\n if current_user #forcing current_user user object: true, or nil: false\n true\n else\n false\n end\n end",
"def appHelper_ifUserLogged\n if session[:user_name] \n return true\n end\n return false\n end",
"def logged_in?\n !!@current_user\n end",
"def logged_in?\n !!current_user #smart way of giving the true if true and not just opposite!\n end",
"def logged_in?\n\t\t!!current_user\n\tend",
"def logged_in?\n\t\t!!current_user\n\tend",
"def logged_in?\n\t\t!!current_user\n\tend",
"def logged_in?\n\t\t!!current_user\n\tend",
"def logged_in?\n\t\t!!current_user\n\tend",
"def logged_in?\n\t\t!!current_user\n\tend",
"def logged_in?\n !!session[:user_id]\n # !!@current_user\n end",
"def logged_in?\n \t!!current_user\n end",
"def logged_in?\n!!current_user\nend",
"def logged_in?\n !!logged_in_user \n end",
"def logged_in?\n\t\t !!current_user\n end",
"def logged_in?\n !!logged_user\n end",
"def logged_in?\n !!getCurrentUser\n end",
"def logged_in?\n !!logged_in_user\n end",
"def logged_in?\n !!logged_in_user\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n current_user != :false \n end",
"def logged_in?\r\n current_user != :false\r\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n !!current_user\n end",
"def logged_in?\n current_user != :false\n end",
"def logged_in?\n #Boolean to see if current user is logged in or not\n !!current_user\n end",
"def logged_in?\n !!session[:user]\nend",
"def logged_in?\n\t !!current_user\n\tend",
"def logged_in?\n if current_user\n true\n else \n false\n end\n end",
"def logged_in?\n if current_user\n true\n else\n false\n end\n end",
"def is_logged_in?\n\t\t!! current_user\n\tend",
"def logged_in?\n return !current_user.nil?\n end",
"def logged_in?\n return !current_user.nil?\n end",
"def logged_in?\n return true if self.current_user\n return false\n end",
"def logged_in?\n session_user != nil\nend",
"def logged_in?\n !current_user.nil?\n end",
"def logged_in?\n !current_user_session.nil?\n end",
"def logged_in?\n !current_user_session.nil?\n end",
"def logged_in?\n # Call the `current_user()` method and check if a logged-in user exists.\n ! current_user().nil?\n end",
"def logged_in?\n ## to query if the logged in, call the current_user with !! preceeded, this turns it to true or false\n # TRUE or FALSE\n !!current_user\n end",
"def user_logged_in?\n !current_user.nil?\n end",
"def user_logged_in?\n !current_user.nil?\n end",
"def user_logged_in?\n !current_user.nil?\n end"
] |
[
"0.8104003",
"0.7483097",
"0.7174814",
"0.7174814",
"0.7174814",
"0.7174814",
"0.71568",
"0.7148025",
"0.71366453",
"0.71314925",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71287936",
"0.71283036",
"0.71279335",
"0.71279335",
"0.71279335",
"0.71279335",
"0.71279335",
"0.71279335",
"0.71279335",
"0.71279335",
"0.71279335",
"0.7127018",
"0.71234214",
"0.7119048",
"0.71026176",
"0.7101324",
"0.71002394",
"0.71002394",
"0.71002394",
"0.71002394",
"0.71002394",
"0.71002394",
"0.70943886",
"0.70902365",
"0.70774233",
"0.70704746",
"0.70680195",
"0.7059686",
"0.70594364",
"0.70547223",
"0.70547223",
"0.70506656",
"0.70506656",
"0.7050598",
"0.70429",
"0.7039243",
"0.7039243",
"0.7009947",
"0.70081466",
"0.7004628",
"0.70023185",
"0.69986063",
"0.69918704",
"0.6973325",
"0.69670296",
"0.69670296",
"0.69551814",
"0.6942877",
"0.69380265",
"0.69307566",
"0.69307566",
"0.69299114",
"0.69279385",
"0.69235116",
"0.69235116",
"0.69235116"
] |
0.0
|
-1
|
Logs in a test user This helper method will be used for testing the checkbox
|
def log_in_as(user, options = {})
password = options[:password] || 'password'
remember_me = options[:remember_me] || '1'
# in integration tests, we can post to the sessions path,
# but in other tests we won't be able to, so we need to check
if integration_test?
# create a user
post login_path, session: {email: user.email,
password: password,
remember_me: remember_me}
else
# if not in integration test, then we need to manipulate the session method
# directly (not really sure)
session[:user_id] = user.id
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user_login(user)\n click_log_in\n fill_login_credentials(user)\n end",
"def login_as_testuser\n login 'testuser@test.com', 'TestPass'\n end",
"def sign_in(test_user = :user_1)\n visit new_user_session_path\n fill_in 'Email', with: users(test_user).email\n fill_in 'Password', with: 'password'\n click_on 'Log in'\n end",
"def log_user_in(user)\n visit new_user_session_path\n fill_in \"Email\", :with => user.email\n fill_in \"Password\", :with => user.password\n click_button\n controller.user_signed_in?.should be_true\nend",
"def sign_in(test_user = :king_kong)\n visit new_user_session_path\n fill_in 'Email', with: users(test_user).email\n fill_in 'Password', with: 'password'\n click_on 'Log in'\n end",
"def login_for_test\n user = User.find params[:id]\n sign_in(user)\n render :text => \"OK\"\n end",
"def log_web_user_in\n # Remeber to set :js => true\n user = create_factory_user\n\n # Signin\n visit root_path\n page.find('.sign-in').trigger(:mouseover)\n fill_in \"user_email\", :with => user.email\n fill_in \"user_password\", :with => user.password\n click_button \"hit it\"\n\n # Disable the tutorial screen\n no_tutorial\n\n # Make sure you're logged in\n page.should have_content(\"Here are the people\")\n page.should have_content(\"add new contact\")\n\n return user\n end",
"def login_with(user)\n visit new_user_sessions_path\n fill_in \"user_session_email\", with: 'test@test.com'\n fill_in \"user_session_password\", with: \"123456\"\n click_button \"Sign in\"\n end",
"def log_in_as(user, options = {})\n # note the password must match with the users.yml in fixtures folder\n password = options[:password] || \"123456\" # a better way would be to use fetch\n remember_me = options[:remember_me] || \"1\"\n if integration_test? # if it is integration test\n post login_path, session: { email: user.email,\n password: password,\n remember_me: remember_me }\n else # if not integration test, set this\n session[:user_id] = user.id\n end\n end",
"def login_with(user)\n visit new_user_session_path\n fill_in \"user_email\", with: user.email\n fill_in \"user_password\", with: \"123456\"\n click_button \"Sign in\"\n end",
"def login_as(user)\n visit new_user_session_path\n fill_in :user_email, with: user.email\n fill_in :user_password, with: 'password123'\n click_button 'Login'\n end",
"def login(user)\n visit new_user_session_path\n fill_in 'user_email', with: user.email\n fill_in 'user_password', with: user.password\n click_button 'Log in'\n end",
"def login(user)\n visit login_path\n fill_in :email, with: user.email\n fill_in :password, with: user.password\n click_button \"Log in\"\n end",
"def login_as(user)\n unless user.is_a?(User)\n user = get_user(user)\n end\n clear_cookies\n GDS::SSO.test_user = user\n end",
"def login_user(user)\n fill_in 'Email', with: user.email\n fill_in 'Password', with: user.password\n click_button 'Sign in'\nend",
"def test_sign_in(user)\n controller.sign_in(user)\n end",
"def sign_in_as_a_user\n @user ||= FactoryGirl.create :user\n login_as @user\n end",
"def login_as_user(user)\n visit login_path\n fill_in('Email', :with => user.email)\n fill_in('Password', :with => user.password)\n click_on 'log_in_submit_form'\n end",
"def sign_in_user\n @user = FactoryGirl.create(:user, password: STARTER_PASSWORD)\n do_login(@user, STARTER_PASSWORD)\n end",
"def sign_in_user(user)\n wait_until {sign_in.visible?}\n sign_in.click\n enter_credentials(user)\n sign_in_button.click\n end",
"def log_in_as(user, options = {})\n password = options[:password] || 'password'\n remember_me = options[:remember_me] || '1'\n if integration_test?\n post login_path, session: { email: user.email, password: password, remember_me: remember_me }\n else\n session[:user_id] = user.id\n end\n end",
"def sign_in_user(user)\n visit new_user_session_path\n fill_in 'Email', with: user.email\n fill_in 'Password', with: user.password\n click_button 'Sign in'\n user\n end",
"def log_in_as(user, options = {})\n password = options[:password] || 'password'\n remember_me = options[:remember_me] || '1'\n if integration_test?\n post login_path, session: { email: user.email,\n password: password,\n remember_me: remember_me }\n else\n session[:user_id] = user.id\n end\n end",
"def login_user\n @user = FactoryBot.create(:user)\n login_as @user\n end",
"def log_in_as(user, options = {})\n password = options[:password] || 'password'\n remember_me = options[:remember_me] || '1'\n if integration_test?\n post login_path, session: { email: user.email,\n password: password,\n remember_me: remember_me }\n else\n session[:user_id] = user.id\n end\n end",
"def login(user)\n if user == \"guest\"\n visit \"/log_out\"\n return\n end\n user = FactoryGirl.create(:user, role: user.to_s) unless user.instance_of?(User)\n visit \"/log_in\"\n page.fill_in \"Email\", with: user.email\n page.fill_in \"Password\", with: user.password\n click_button \"Log in\"\n user\nend",
"def login_user(user = nil, test_context = {})\n user ||= @user\n @controller.send(:auto_login, user)\n @controller.send(:after_login!, user, [user.send(user.sorcery_config.username_attribute_names.first), 'secret'])\n end",
"def sign_in(user, password: 'waffle')\n visit root_path\n fill_in \"Login\", with: user.login\n fill_in \"Password\", with: password\n click_button \"Sign In\"\n end",
"def login_user_for_feature(user)\n visit new_user_session_path\n close_cookies_alert\n fill_in 'Email', with: user.email\n fill_in 'Password', with: user.password\n click_on 'Log in'\n user_should_be_logged_in\n page_should_finish_loading\nend",
"def login_user\n visit landing_page_path\n click_on 'Login'\n fill_in 'Email', with: users(:tony).email\n fill_in 'Password', with: 'password'\n click_on 'Log in'\n end",
"def boyutluseyler_sign_in_with(user, remember: false)\n visit new_user_session_path\n\n fill_in 'user_login', with: user.email\n fill_in 'user_password', with: '123456'\n check 'user_remember_me' if remember\n\n click_button 'btn_sign_in'\n end",
"def login_as(user)\n login(users(user).email, users(user).password)\n end",
"def log_in_as(user, options = {})\n password = options[:password] || 'password'\n remember_me = options[:remember_me] || '1'\n if integration_test?\n post user_session_path, session: { email: user.email,\n password: password,\n remember_me: remember_me }\n else\n session[:user_id] = user.id\n end\n end",
"def sign_in\n \n user = nil \n \n #session[:cas_user] = \"testguy\"\n \n # Check if the user has signed in with CAS\n if session[:cas_user].present?\n email = session[:cas_user] + \"@purdue.edu\"\n user = StudyUser.find_user_by_email( email ) \n end\n \n # Sign in the user\n testing_enabled_today = TestMeta.test_enabled_today?\n if user and testing_enabled_today\n session[:user] = user.id\n redirect_to welcome_test_index_path\n else\n flash[:user_does_not_exist] = true unless user\n redirect_to root_path\n end \n end",
"def login(user=:joerg)\r\n login_as(user)\r\n end",
"def sign_in_default_user\n user = FactoryGirl.create(:user)\n visit new_user_session_path\n fill_in 'Email', with: user.email\n fill_in 'Password', with: user.password\n # apparently, there are 2 \"Log In\" in main page which confuses Capybara (!!!)\n page.find('.btn.btn-primary').click\n end",
"def log_in(user)\n email = $credentials[user]['email']\n password = $credentials[user]['password']\n case user\n when 'User A'\n transporter.go_to_url(USER_A_HOST)\n set_field('identifier', email)\n click_btn('Next')\n set_field('password', password)\n click_btn('Next')\n when 'User B'\n transporter.go_to_url(USER_B_HOST)\n end\n end",
"def login_as_user\n user = FactoryBot.create(:user)\n login_as(user)\n end",
"def sign_in(user)\n\tvisit signin_path\n\tfill_in \"Name\", with: user.name\n\tfill_in \"Password\", with: user.password\n\tclick_button \"Sign in\"\n\n\t# filling in the form doesn’t work when not using Capybara\n\tcookies[:remember_token] = user.remember_token\nend",
"def do_login_ui(name='admin', is_admin=true)\n email = \"#{name}@concord.org\"\n pass = \"#{name}pAsS\"\n u = User.find_or_create_by_name(name) do |u|\n u.email_address = email\n u.password = u.password_confirmation = pass\n u.state = 'active'\n u.administrator = is_admin\n end\n u.save!\n\n visit '/logout'\n visit '/login'\n fill_in \"login\", :with => email\n fill_in \"password\", :with => pass\n click_button 'Login'\nend",
"def sign_in(user)\n\tvisit signin_path\n\tfill_in \"Email\", with: user.email\n\tfill_in \"Password\", with: user.password\n\tclick_button \"Sign in\"\n\t # Sign in when not using Capybara as well.\n\tcookies[:remember_token] = user.remember_token;\nend",
"def log_in_as(user, options = {})\n password = options[:password] || 'password'\n if integration_test?\n post login_path, params: {\n session: { email: user.email, password: password }\n }\n else\n session[:user_id] = user.id\n end\n end",
"def login_as(user)\n @request.session[:user_id] = users(user).id # obtained from fixture\n end",
"def sign_in(user)\n login_as user\n end",
"def sign_in\n $users.logged_in_user.sign_out unless $users.current_user==nil\n # This line is required because visiting the login page doesn't\n # actually work when you're currently logged in.\n #s_o.click if s_o.present?\n visit LoginPage do |log_in|\n log_in.username.set @user_name\n log_in.login\n end\n# on(Researcher).logout_button.wait_until_present\n @session_status='logged in'\n end",
"def sign_in(user)\n\tvisit signin_path\n\tfill_in \"Email\", with: user.email\n\tfill_in \"Password\", with: user.password\n\tclick_button \"Sign in\"\n\n\t# filling in the form doesn’t work when not using Capybara\n\tcookies[:remember_token] = user.remember_token\nend",
"def login_user\n password = Faker::Internet.password\n with_versioning do\n @logged_in_user = create(:user, password: password, password_confirmation: password)\n end\n sign_in_with_credentials(@logged_in_user.email, password)\n end",
"def sign_in_ui(user)\n visit user_session_url\n\n fill_in \"user_email\", with: user.email\n fill_in \"user_password\", with: user.password\n\n click_on \"Log in\"\n end",
"def sign_in_as(user)\n visit '/'\n click_link 'Sign in'\n fill_in 'Email', with: user.email\n fill_in 'Password', with: 'topsecret'\n click_button \"Sign in\"\n end",
"def log_in_as(user, options = {})\n \n password = options[:password] || 'password'\n remember_me = options[:remember_me] || '1'\n \n if integration_test?\n post vlogin_path, session: { email: user.email,\n password: password,\n remember_me: remember_me }\n else\n session[:user_id] = user.id\n end\n end",
"def setup_user\n login_as(User.where(email: 'masterchef@cookbook.com').first, scope: :user)\n end",
"def test_sign_in(user)\n controller.sign_in(user)\n end",
"def login\n # puts \"UserNAme #{username}.\"\n self.login_username_element.when_present(30)\n # expect(self.login_username?).to be_truthy\n self.login_username= DT['ENV']['Username']\n self.login_password= DT['ENV']['Password']\n self.login_login\n end",
"def fill_in_login(user =\n User.create!(email: \"me@weenhanceit.com\",\n password: \"password\"))\n visit(new_user_session_path)\n expect has_field?(\"Email\")\n fill_in \"Email\", with: user.email\n fill_in \"Password\", with: \"password\"\n click_button \"Sign in\"\n end",
"def setup\n login_user\n end",
"def sign_in_manual(user)\n visit new_user_session_path\n fill_in \"user_email\", with: user.email\n fill_in \"user_password\", with: user.password\n click_button \"Sign in\"\nend",
"def login(user)\n sleep 0.3\n get_elem_and_click(:xpath, LOGIN_BUTTON)\n get_elem_and_fill(:xpath, \"//input[@type='email']\", user.email)\n get_elem_and_fill(:xpath, \"//input[@name='password']\", user.password)\n get_elem_and_click(:xpath, \"//button[@type='submit']\")\n end",
"def valid_signin(user)\n fill_in \"Email\", with: user.email\n fill_in \"Password\", with: user.password\n click_button \"Sign in\"\nend",
"def valid_signin(user) \n fill_in \"Email\", with: user.email\n fill_in \"Password\", with: user.password\n click_button \"Sign in\"\nend",
"def login_user(user = User.create!(email: 'marcos@iugu.com.br', password: '123456'))\n \tlogin_as user, scope: :user\n user\n end",
"def login_helper\n username = prompt.ask(\"Enter Username\")\n password = prompt.ask(\"Enter Password\")\n if User.find_by(name: username, password: password)\n self.user = User.find_by(name: username, password: password)\n # no music yet\n puts \"Let's Get Cookin, #{self.user.name.upcase}!!!\"\n sleep(1.5)\n main_menu\n else\n puts \"Incorrect Username or Password\"\n sleep(1.5)\n login_page\n end\n end",
"def sign_in_as(user, options = {})\n password = options[:password] || 'password'\n remember_me = options[:remember_me] || '1'\n if integration_test?\n post_via_redirect user_session_path, 'user[email]' => user.email, 'user[password]' => password#, 'user[remember_me]' => remember_me\n else\n session[:user_id] = user.id\n end\n end",
"def log_in(user_name)\n if User.find_by_user_name(user_name)\n session[:user_name] = user_name\n true\n else\n false\n end\n end",
"def test\n user = User.find_by(email: \"testing@email.com\")\n login user\n flash[:success] = t(\"sessions.create.success\")\n redirect_to root_path\n end",
"def login\n make_login_call\n end",
"def login_as(email, password)\n click_link \"Log in\"\n fill_in 'Email', with: email\n fill_in 'Password', with: password\n click_button 'Log in'\n end",
"def log_in\n end",
"def log_in(user, password='password', email='email')\n visit new_session_path #tells rspec which link to go to, can also specify the link, ex: visit '/session/new'\n if email == 'email'\n fill_in 'email', with: user.email # this just checks if I didn't input the email paramter. If I did, then it wouldn't be 'email' since that wouldn't work as a valid email. If I did input an email paramter, it woudln't equal 'email'\n else\n fill_in 'email', with: email\n end\n fill_in 'password', with: password # I use 'password' both in the create_user method above and the file where I actually called this method, so I don't need an if statement for it\n click_button 'Log In'\n end",
"def login(user_fixture)\n user = users(user_fixture)\n @request.session[:user_id] = user.id\n @request.session[:last_authenticated_action_at] = Time.now\n user\n end",
"def sign_in(user)\n visit signin_path\n fill_in \"Name\", with: user.name\n fill_in \"Email\", with: user.uid\n click_button \"Sign In\"\nend",
"def user_login\n @user = User.create(username: \"maksim\", password: \"secreto\", bio: \"I got nothing\", email: \"umm@gmail.com\")\n visit login_path\n within \"form\" do\n fill_in \"username\", with: \"maksim\"\n fill_in \"password\", with: \"secreto\"\n end\n click_button \"Log in\"\nend",
"def system_sign_in user, passwd=nil, locale='en'\n passwd ||= user.password\n page.find(\"#topNav a[href='/#{locale}/users/sign_in']\").click\n # page.find(\"#main-container form input[name='user[email]']\").set(user.email)\n fill_in \"user[email]\", with: user.email\n fill_in \"user[password]\", with: passwd\n click_button \"Sign in\"\n end",
"def visit_signin_and_login(user)\n visit signin_path\n fill_in 'Email', with: user.email\n fill_in 'Password', with: user.password\n click_button 'Sign in'\nend",
"def login(email_id, pass_word)\n\t\n\tputs \"************** START : Log into Razoo ****************\"\t\n\t$browser.click \"link=Log in\"\n\t$browser.wait_for_page_to_load \n\tputs \"Step 1 : Entering valid User credintials - User Name as #{email_id} and Password as #{pass_word}\"\n\t$browser.type \"user_session_email\", email_id \n\t$browser.type \"user_session_password\", pass_word\n\t$browser.click \"//button[@type='submit']\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Login successful!\")\n\t\tputs \"Step 2 : Passed. Login was Successful!!!\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 : Failed. Login Failed\"\n\tend\n\tputs \"************** END : Log into Razoo ****************\"\t\nend",
"def sign_in\n visit new_user_session_path\n fill_in 'Email', with: users(:user_one).email\n fill_in 'Password', with: \"password\"\n find('#log_in_confirm_button').click_on 'Log In'\n page.must_have_content \"Logged in as\"\n page.must_have_content \"Sign Out\"\n page.wont_have_content \"Log In\"\n page.wont_have_content \"Invalid email or password\"\n end",
"def log_user_in(user)\n set_omniauth_user user\n visit '/'\n click_link 'Log In'\n end",
"def login_user(user)\n visit 'http://localhost:9000'\n fill_in('Email', with: user[:email])\n fill_in('Password', with: user[:password])\n click_button \"Login\"\nend",
"def login(email_id, pass_word)\n\t\n\tputs \"************** START : Login to Razoo ****************\"\t\n\t$browser.click \"link=Log in\"\n\t$browser.wait_for_page_to_load \n\tputs \"Step 1 : Entering valid User credintials - User Name as #{email_id} and Password as #{pass_word}\"\n\t$browser.type \"user_session_email\", email_id \n\t$browser.type \"user_session_password\", pass_word\n\t$browser.click \"//button[@type='submit']\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Login successful!\")\n\t\tputs \"Step 2 : Passed. Login was Successful!!!\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 : Failed. Login Failed\"\n\tend\n\tputs \"************** END : Login to Razoo ****************\"\t\nend",
"def login(email_id, pass_word)\n\t\n\tputs \"************** START : Login to Razoo ****************\"\t\n\t$browser.click \"link=Log in\"\n\t$browser.wait_for_page_to_load \n\tputs \"Step 1 : Entering valid User credintials - User Name as #{email_id} and Password as #{pass_word}\"\n\t$browser.type \"user_session_email\", email_id \n\t$browser.type \"user_session_password\", pass_word\n\t$browser.click \"//button[@type='submit']\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Login successful!\")\n\t\tputs \"Step 2 : Passed. Login was Successful!!!\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 : Failed. Login Failed\"\n\tend\n\tputs \"************** END : Login to Razoo ****************\"\t\nend",
"def login(email_id, pass_word)\n\t\n\tputs \"************** START : Login to Razoo ****************\"\t\n\t$browser.click \"link=Log in\"\n\t$browser.wait_for_page_to_load \n\tputs \"Step 1 : Entering valid User credintials - User Name as #{email_id} and Password as #{pass_word}\"\n\t$browser.type \"user_session_email\", email_id \n\t$browser.type \"user_session_password\", pass_word\n\t$browser.click \"//button[@type='submit']\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Login successful!\")\n\t\tputs \"Step 2 : Passed. Login was Successful!!!\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 : Failed. Login Failed\"\n\tend\n\tputs \"************** END : Login to Razoo ****************\"\t\nend",
"def login_user\n puts \"Please enter your name\"\n name = CLI.gets_with_quit\n\n if self.user_exists(name)\n user = self.find_user(name)\n if check_password(user)\n CLI.active_user = user\n # fall through to CLI.start\n else\n CLI.start\n end\n\n else\n puts \"Sorry, User not found!\"\n if CLI.yes_no(\"Sign Up\")\n self.signup_user(name)\n else\n CLI.start\n end\n end\n end",
"def log_in\n visit \"/gp/login.do\"\n fill_in \"id\", :with => @user\n fill_in \"clave\", :with => @password\n first(\".bLogin a\").click\n end",
"def sign_in(user_data)\n fill_in 'Email:', :with => user_data['email']\n fill_in 'Password:', :with => user_data['password']\n click_button 'Sign In'\n end",
"def log_in_as(user, options = {})\n password = options[:password] || 'password'\n remember_me = options[:remember_me] || '1'\n\n if integration_test?\n # We don't have access to session variables.\n post login_path, session: { email: user.email,\n password: password,\n remember_me: remember_me }\n else\n # Manipulate the session method directly.\n session[:user_id] = user.id\n end\n end",
"def log_in_with(email, password)\n click_on \"Log In\"\n fill_in :email, with: email\n fill_in :password, with: password\n click_on \"Finish\"\n end",
"def log_in_with(email, password, admin = nil)\n visit new_user_session_path(admin: admin)\n find('#login_email').set(email)\n find('#login_password').set(password)\n click_button 'Access Courses'\nend",
"def login_admin_anna\n user = User.find_by(name: \"Anna\")\n log_in(user)\n end",
"def log_mobile_user_in\n # Remeber to set :js => true\n \n # Create user\n user = create_factory_user\n \n # Log mobile user in\n # Remember to run $ rails s -e test\n visit(\"http://m.lvh.me:3000\")\n fill_in \"user_email\", :with => user.email\n fill_in \"user_password\", :with => user.password\n click_button \"sign in\"\n\n # Ensure that login worked\n page.should have_css(\"#write-note\")\n page.should have_css(\"body#mobile\")\n\n find(\".cog\").click\n page.should have_content(\"#{user.email}\")\n page.should have_content(\"Im A Test User\")\n find('#bio').find('#name').should have_content(\"Im A Test User\")\n\n return user\n end",
"def login\n create(:user).tap{ |user| login_as(user) }\n end",
"def login(user)\n visit \"/login\"\n within (\".form\") do\n fill_in :email, with: user.email\n fill_in :password, with: user.password\n click_button \"Login\"\n end\n end",
"def login(name='user', password='super')\r\n post:login, :user=>{:username=>name, :password=>password}\r\n assert_redirected_to :action =>'index'\r\n assert_not_nil(session[:user])\r\n user = User.find(session[:user].id)\r\n assert_equal 'super', user.username\r\n end",
"def login_user\n visit \"/login\"\n fill_in \"session[name]\", with: \"DJ\"\n fill_in \"session[password]\", with: \"pw\"\n click_link_or_button(\"Login\")\n end",
"def UserLogin(user)\n choose_language(user.language)\n username_tb.type_text(user.username)\n password_tb.type_text(user.password)\n partnerType = user.partnerType\n case partnerType\n when 'home'\n home_login_btn.click\n when 'pro'\n login_btn.click\n ent_restore_link.click\n when 'ent'\n login_btn.click\n #if (user.keyType == 'ckey')\n # if (\"#{QA_ENV['environment']}\" == \"staging\")\n # ent_restore_link_ckey.click\n # else if (\"#{QA_ENV['environment']}\" == \"production\")\n # ent_restore_link_ckey1.click\n # end\n # end\n #end\n\n if (\"#{QA_ENV['environment']}\" == \"staging\")\n if (user.keyType == 'ckey')\n ent_restore_link_ckey.click\n else\n ent_restore_link_stag.click\n end\n else if (\"#{QA_ENV['environment']}\" == \"production\")\n if (user.keyType == 'ckey')\n ent_restore_link_ckey1.click\n else\n ent_restore_link.click\n end\n\n else\n ent_restore_link.click\n end\n end\n\n when 'oem'\n login_btn.click\n ent_restore_link.click\n end\n #puts \"**********\"\n #puts page.response_headers()\n #puts `pwd`\n end",
"def test_login_username_password\n user = create(:user)\n\n try_password_login user.display_name, \"test\"\n\n assert_template \"changeset/history\"\n assert_select \"span.username\", user.display_name\n end",
"def sign_in_via_form\n @user = FactoryGirl.create(:user)\n visit new_user_session_path\n fill_in_login_form\n end",
"def login_into_alchemy\n visit '/alchemy/admin/login'\n fill_in('alchemy_user_session_login', :with => 'jdoe')\n fill_in('alchemy_user_session_password', :with => 's3cr3t')\n click_on('Login')\n end",
"def setup_log_in\n @user = users(:user_test)\n\n if @user.api_key.blank?\n flunk \"You must set the \\\"CHALLONGE_MGR_TEST_USER_API_KEY\\\"\" \\\n \" environment variable to run system tests.\" \\\n end\n\n log_in_as(@user)\n end",
"def login(user, pwd)\n touch(\"* id:'#{edit_email}'\")\n enter_text(\"* id:'#{edit_email}'\", user)\n touch(\"* id:'#{edit_password}'\")\n enter_text(\"* id:'#{edit_password}'\", pwd)\n end",
"def login_account(username, password)\n login_form.email_txt.set username\n login_form.password_txt.set password\n login_form.login_btn.click\n end",
"def login_as(user)\n session[:user_id] = user.id\n end"
] |
[
"0.7752128",
"0.772213",
"0.7699351",
"0.76878947",
"0.7575415",
"0.7524393",
"0.7517012",
"0.74389786",
"0.7388671",
"0.7339582",
"0.7323013",
"0.72963667",
"0.7230384",
"0.72084993",
"0.7204875",
"0.71991295",
"0.717661",
"0.7166339",
"0.71626675",
"0.7160628",
"0.71403235",
"0.7130805",
"0.7116088",
"0.7113606",
"0.71062976",
"0.7091183",
"0.7089868",
"0.70858544",
"0.7083044",
"0.70817983",
"0.7056273",
"0.7053054",
"0.7042562",
"0.70424455",
"0.7039092",
"0.7037342",
"0.7032591",
"0.70301753",
"0.7019099",
"0.7008709",
"0.7005066",
"0.6998293",
"0.69840467",
"0.6977567",
"0.6970877",
"0.6967053",
"0.6950929",
"0.695068",
"0.694022",
"0.6932629",
"0.69318503",
"0.6926063",
"0.6923265",
"0.6921705",
"0.6900902",
"0.68940735",
"0.6884689",
"0.6872644",
"0.6871505",
"0.6867584",
"0.68659055",
"0.6859277",
"0.68361974",
"0.6832624",
"0.6829201",
"0.68257725",
"0.68239564",
"0.6821782",
"0.681902",
"0.68177634",
"0.68075645",
"0.68045735",
"0.6802144",
"0.6795532",
"0.67886823",
"0.6779952",
"0.6778769",
"0.6776412",
"0.6776412",
"0.6776412",
"0.67759544",
"0.67682296",
"0.6765305",
"0.67640024",
"0.675869",
"0.67486906",
"0.6746846",
"0.6741614",
"0.67320466",
"0.67307866",
"0.6728204",
"0.6724739",
"0.6719643",
"0.6719602",
"0.6714582",
"0.67144954",
"0.6713768",
"0.6713758",
"0.6706656",
"0.6701114"
] |
0.6804621
|
71
|
Returns true inside an integration test
|
def integration_test?
# checks for the existance of a method only found in integration tests
defined?(post_via_redirect)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test?\n true\n end",
"def test?\n false\n end",
"def test?\n self.environment == ENV_TEST\n end",
"def test_truth\n end",
"def integration_test?\n defined?(follow_redirect!)\n end",
"def integration_test()\n return [\"all\"]\n end",
"def test?\n settings.environment == 'test'\n end",
"def integration_test?\n defined?(post_via_redirect)\n end",
"def integration_test?\n defined?(post_via_redirect)\n end",
"def integration_test?\n defined?(post_via_redirect)\n end",
"def integration_test?\n defined?(post_via_redirect)\n end",
"def integration_test?\n defined?(post_via_redirect)\n end",
"def integration_test?\n defined?(post_via_redirect)\n end",
"def integration_test?\n defined?(post_via_redirect)\n end",
"def integration_test?\n defined?(post_via_redirect)\n end",
"def integration_test?\n defined?(post_via_redirect)\n end",
"def integration_test?\n defined?(post_via_redirect)\n end",
"def integration_test?\n defined?(post_via_redirect)\n end",
"def test_nothing\n return true\n end",
"def testing\n # ...\n end",
"def test_environment_valid?\n return true unless @environment == \"test\"\n !!@test_url\n end",
"def integration_test?\n # The post_via_redirect method is available only in integration tests.\n defined?(post_via_redirect)\n end",
"def test_env?\n @test_environment\n end",
"def test?\n RUBYMOTION_ENV == 'test'\n end",
"def run_integration_tests?\n ENV['TEST_DATADOG_INTEGRATION']\n end",
"def tested?\n @tested\n end",
"def test?\n @test\n end",
"def test?\n params['x_test_request'] == 'true'\n end",
"def test?\n !production?\n end",
"def passed?\n return @test_passed\n end",
"def test?\n params['x_test_request'] == 'true'\n end",
"def test?\n rspec? || env == 'test'\n end",
"def test?\n Base.gateway_mode == :test\n end",
"def test?\n Base.gateway_mode == :test\n end",
"def test?\n Base.gateway_mode == :test\n end",
"def test?\n rspec? || minitest?\n end",
"def uncovered\n return true\n end",
"def test? ; @app.options[:env] == :test ; end",
"def test; true; end",
"def test?\n self.endpoint == DEFAULT_ENDPOINT\n end",
"def test_truth\n assert true\n end",
"def testing?\n !!@test\n end",
"def test_firewall_service_enabled\n assert true\n end",
"def running_test_step; end",
"def test_truth\r\n assert true\r\n end",
"def test_truth\r\n assert true\r\n end",
"def test_truth\r\n assert true\r\n end",
"def running_test_case; end",
"def instrumentalists?\n true\n end",
"def test?\n @@mode == :test\n end",
"def test?\n self.class.test?\n end",
"def expected?\n false\n end",
"def test\n data = Fyb.private.test.perform.parse\n data['msg'] == 'success'\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end"
] |
[
"0.7441766",
"0.72441983",
"0.7133517",
"0.71330607",
"0.7086181",
"0.706544",
"0.7021346",
"0.69783634",
"0.69783634",
"0.69783634",
"0.69783634",
"0.69783634",
"0.69783634",
"0.69783634",
"0.6974975",
"0.6974975",
"0.6974975",
"0.6974975",
"0.6951244",
"0.68909526",
"0.68901294",
"0.68720496",
"0.6851101",
"0.6839785",
"0.6827623",
"0.6826994",
"0.6824249",
"0.6794538",
"0.67684406",
"0.6764786",
"0.6721825",
"0.6672613",
"0.66723704",
"0.66723704",
"0.66723704",
"0.6645915",
"0.66180325",
"0.65940195",
"0.6587948",
"0.6587648",
"0.655143",
"0.65386796",
"0.6530503",
"0.65158147",
"0.65157735",
"0.65157735",
"0.65157735",
"0.6512968",
"0.6449867",
"0.6430276",
"0.64227724",
"0.63956535",
"0.6385664",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263",
"0.63756263"
] |
0.71672475
|
2
|
UITableView delegate for default contents of UITableView, and UISearchDisplayController's UISearchResultsTableView
|
def tableView(table_view, numberOfRowsInSection: section)
case
when table_view.instance_of?(UITableView)
if @venues
@venues.length
else
0
end
when table_view.instance_of?(UISearchResultsTableView)
if @user_searched_venues
@user_searched_venues.length
else
0
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fetchControllerForTableView(tableView)\n Cliente.searchController(@searchString, withScope:nil) \n end",
"def index_table(klass, objects)\n # get links from class' helper\n links = send(\"#{klass.table_name}_index_links\", objects).compact\n\n # if there are any batch links, insert the 'select all' link\n batch_ops = !links.reject{|l| !l.match(/class=\"batch_op_link\"/)}.empty?\n links.insert(0, select_all_link) if batch_ops\n \n # render, getting fields and checking if there are no objects at all\n render(\"layouts/index_table\",\n :klass => klass,\n :objects => objects,\n :paginated => objects.respond_to?(:total_entries),\n :links => links.flatten.join.html_safe,\n :fields => send(\"#{klass.table_name}_index_fields\"),\n :batch_ops => batch_ops\n )\n end",
"def index\n \n get_table_name #method for table_names and model_names \n\n get_table_column_name # method for table_name, column_names and model_name \n\n get_table_data # method for table data\n\n @model_data = []\n \n @model_data = @model_name.order(sort_column + \" \" + sort_direction).page(params[:page]).per(10)\n\n respond_to do |format|\n\t format.html\n\t format.json\n \tend\n\n end",
"def on_select(tableView, tableViewDelegate)\n # implement in row class\n end",
"def index_table\n @q = Country.search(params[:q])\n @countries = @q.result.includes(:user_countries)\n\n respond_to do |format|\n format.html { render '_index_table', layout: nil}\n format.xml { render '_index_table', :xml => @countries, layout: nil }\n end\n end",
"def index\n @display_type = DISPLAY_TYPE_SIMPLE\n\n# @app_search.default 'id', 'desc'\n# @app_search.sort 'name', 'databases.name'\n\n @tablename = params[:tablename]\n @columns = ActiveRecord::Base.connection.columns(@tablename)\n\n where = \"\"\n unless params[:keyword].blank?\n where = \" where\"\n @columns.each{|column|\n where += \" #{column.name} like '#{@app_search.keyword}' or\"\n }\n where = where.slice(0, where.size - 2)\n end\n\n alls = ActiveRecord::Base.connection.execute(\"select * from \" + @tablename + where)\n\n session_set_ids(alls)\n session[:prm].delete(:tablename)\n page = alls.paginate(:page => params[:page], :per_page => PAGINATE_PER_PAGE);\n @databases = page\n\n xmls = alls\n\n respond_to do |format|\n format.html # index.html.erb\n format.csv { send_data(xmls.to_csv(:columns => @columns, :table_name => @tablename), :type => \"text/csv\") }\n# format.xml { send_data(xmls.to_xml, :type => \"text/xml; charset=utf8;\", :disposition => \"attachement\") }\n end\n end",
"def searchDisplayController(controller, shouldReloadTableForSearchString:search_string)\n @mt_filtered_data = nil\n @mt_filtered_data = []\n\n @mt_table_view_groups.each do |section|\n new_section = {}\n new_section[:cells] = []\n\n section[:cells].each do |cell|\n if cell[:title].to_s.downcase.strip.include?(search_string.downcase.strip)\n new_section[:cells] << cell\n end\n end\n\n if new_section[:cells] && new_section[:cells].length > 0\n new_section[:title] = section[:title]\n @mt_filtered_data << new_section\n end\n end\n true\n end",
"def index\n @data_tables = DataTable.all\n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @data_tables.as_json(only: [:title, :username, :name, :email, :hometown]) }\n # end\n end",
"def table_list(objetos, show_all_actions = true, options = {})\n render :partial => '/admin/shared/table_list', :locals => { :objetos => objetos, :show_all_actions => show_all_actions, :options => options }\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: TipoDocumentoDatatable.new(view_context, { query: TipoDocumento.all.order(:codigo) }) }\n end\n end",
"def index\n @post_tables = PostTable.all\n\n if params[:search]\n @post_tables = PostTable.search(params[:search]).order(\"created_at DESC\")\n else\n @post_tables = PostTable.all.order(\"created_at DESC\")\n end\n end",
"def index\n add_to_sortable_columns(\"search\", :model => Recipe)\n if params[:user_id] && logged_in? && @current_user.id.to_i == params[:user_id].to_i\n @user = User.find(params[:user_id])\n @recipes = @user.recipes.paginate(:all,\n :order => sortable_order('search', Recipe, 'title'),\n :page => params[:page])\n elsif params[:user_id]\n @user = User.find(params[:user_id])\n @recipes = @user.recipes.paginate_public(:all,\n :order => sortable_order('search', Recipe, 'title'),\n :page => params[:page])\n else\n @recipes = Recipe.paginate(\n :conditions => [\"NOT private OR user_id = ?\", @current_user.id],\n :order => sortable_order('search', Recipe, 'id'),\n :page => params[:page])\n end\n # So that after adding a food we can come back to this\n store_location\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @recipes.to_xml }\n end\n end",
"def indexKaminariTable\n\n @sort = nil\n @direction = nil\n @sort = params[:sort] if params[:sort]\n @direction = params[:direction] if params[:direction]\n\n @sort = 'id' if @sort == nil\n @direction = 'asc' if @direction == nil\n if params[:search]\n @downloads = Download.where(\"name like :search\", search: params[:search]).order(\"#{@sort} #{@direction}\").page(params[:page]).per(get_perPage)\n else\n @downloads = Download.order(\"#{@sort} #{@direction}\").page(params[:page]).per(get_perPage)\n end\n\n end",
"def index\n @scan = scan\n\n html_block = if render_partial?\n proc { render partial: 'table' }\n else\n proc { redirect_to @scan }\n end\n\n respond_to do |format|\n format.html( &html_block )\n format.js { render partial: 'table.js' }\n #format.json { render json: @issues }\n end\n end",
"def index\n @title = t 'view.contents.index_title'\n @searchable = true\n @contents = @contents.filtered_list(params[:q]).page(params[:page])\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 respond_to do |format|\n format.html\n format.json { render json: MsdsDatatables.new(view_context) }\n end\n end",
"def full_search_table_render(form_input_hash)\n\tprep_html(response_obj(prep_query(form_input_hash)))\nend",
"def index\n respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @documents }\n # This will die if not asekd by our dataTables, because we're using params[:collection_id]\n format.json { render json: DocumentsMainDatatable.new(view_context, current_user)}\n end\n end",
"def searchDisplayController(controller, shouldReloadTableForSearchString:search_string)\n @promotion_table_data.search(search_string)\n true\n end",
"def set_up_table_view\n self.table_view\n _table_view = self.create_table_view_from_data(self.table_data)\n adjusted_frame = self.view.bounds\n adjusted_frame.size.width = app_delegate.panels.leftVisibleWidth\n _table_view.frame = adjusted_frame\n self.view = UIView.new\n self.view.addSubview(_table_view)\n end",
"def table_of(things,opts={})\n kind = things.first.table_name\n # columns = things.first.visible_columns\n add_class_to_html_options(opts, kind)\n content_tag(\n :table,\n render(:partial => \"/#{kind}/table_row\", :collection => things),\n opts\n )\n end",
"def tableView(tableView, objectValueForTableColumn:column, row:index)\n filteredData[index].send(column.identifier)\n end",
"def index\n if params[:format].nil? or params[:format] == 'html'\n @iteration = params[:iteration][/\\d+/] rescue 1\n @formats = Format.sorted_order(\"#{sort_column} #{sort_direction}\").search(params[:search]).paginate(\n :page => params[:page], \n :per_page => params[:DataTables_Table_0_length]\n )\n else\n @format = Format.api_search(params)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.xml { render :xml => @formats }\n format.csv { render :csv => @formats }\n format.json { render :json => @formats }\n end\n end",
"def index\n if params[:format].nil? or params[:format] == 'html'\n @iteration = params[:iteration][/\\d+/] rescue 1\n @posteriors = Posterior.sorted_order(\"#{sort_column} #{sort_direction}\").search(params[:search]).paginate(\n :page => params[:page], \n :per_page => params[:DataTables_Table_0_length]\n )\n else # Allow url queries of data, with scopes, only xml & csv ( & json? )\n @posteriors = Posterior.api_search(params)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.xml { render :xml => @posteriors }\n format.csv { render :csv => @posteriors }\n format.json { render :json => @posteriors }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json:DisDatasourceDatatable.new(view_context) }\n end\n end",
"def viewDidLoad\n @actions = {NSIndexPath.indexPathForRow(0, inSection:0) => LATE_ACTION,\n NSIndexPath.indexPathForRow(1, inSection:0) => OUT_ACTION,\n NSIndexPath.indexPathForRow(0, inSection:1) => STATS_ACTION,\n NSIndexPath.indexPathForRow(1, inSection:1) => SETTINGS_ACTION\n }\n tableView.backgroundColor = UIColor.fromHexCode('5f', 'ff', '8f') # light green\n self.view.backgroundColor = UIColor.fromHexCode('5f', 'ff', '8f')\n tableView.sectionHeaderHeight = 40\n tableView.rowHeight = 64\n tableView.tableFooterView = UIView.alloc.initWithFrame(CGRectZero)\n navigationController.navigationBar.setBackgroundImage(UIImage.imageNamed(\"banner.png\"), forBarMetrics:UIBarMetricsDefault)\n end",
"def alias_tabla(controller)\n\t\tcase controller\n\t\twhen 'clientes'\n\t\t\t'registros'\n\t\telse\n\t\t\tcontroller\n\t\tend\n\tend",
"def index\n @sub_data_tables = SubDataTable.all\n end",
"def index\n\n # if we’re searching\n if params.key?( :search ) and action_allowed?( :search )\n\n # we’re searching: attempt to do a custom search\n @content = add_pagination_and_sorting( custom_search )\n\n else\n\n # otherwise, grab all the things\n @content = add_pagination_and_sorting( custom_index )\n\n end\n\n generate_titles\n\n end",
"def handle_search\n if request.id == 'csv'\n csv(:search_results)\n elsif request.id\n table_page(*model.search_results(normalized_type, request))\n else\n page do\n Forme.form(model.new(nil, request), form_attributes(:action=>url_for(\"search/1\"), :method=>:get), form_opts) do |f|\n model.columns_for(:search_form, request).each do |column|\n col_opts = column_options_for(:search_form, request, f.obj, column).merge(:name=>column, :id=>column)\n if html = model.edit_html_for(f.obj, column, :search_form, request)\n col_opts[:html] = html\n end\n f.input(column, col_opts)\n end\n f.button(:value=>'Search', :class=>'btn btn-primary')\n end\n end\n end\n end",
"def index \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => SelecaoAdmin::EnrolledsDatatable.new(view_context) }\n end\n end",
"def index\n\t\t# Creation of the search object and search do\n if params[:filter]\n params[:by] = \"#{params[:filter][:field]}-#{params[:filter][:way]}\"\n params[:per_page] = \"#{params[:filter][:limit]}\".to_i\n end\n\t\t@search = Search.new(setting_searching_params(:from_params => params))#.advance_search_fields\n\t\t@paginated_objects = @current_objects = @search.do_search\n\t\t# Definition of the template to use to retrieve information\n\t\tif @search.category == 'user' || @search.category == 'workspace'\n\t\t\t@templatee = \"#{@search.category.pluralize}/index\"\n\t\telse\n \t@templatee = \"generic_for_items/index\"\n\t\tend\n\t\t@ajax_url = request.path\n\t\t# Management of the response depending of the request type\n\t\tif !request.xhr?\n\t\t\trespond_to do |format|\n\t \t\t\tformat.html { render :template => \"admin/searches/index.html.erb\" }\n\t\t\t\tformat.xml { render :xml => @paginated_objects }\n\t\t\t\tformat.json { render :json => @paginated_objects }\n\t\t\t\tformat.atom { render :template => \"#{@templatee}.atom.builder\", :layout => false }\n\t\t\tend\n\t\telse\n @no_div = true\n\t\t\trender :partial => @templatee, :layout => false\n\t\tend\n end",
"def index\n @datatable = ComplainsDatatable.new view_context\n end",
"def index\n @hr_tables = HrTable.search(params[:search]) \n #@hr_tables = HrTable.all\n end",
"def ar_index_table_data\n returning(\"\") do |result|\n \n for resource in @resources\n columns= [ar_label(resource)]\n\n controller.ardata.fields.for_index.each_with_index do |column_title, index|\n next if not @display_current_ar_index_table_column[index]\n columns << ar_get_resource_value(resource, column_title[0])\n end\n\n columns << ar_show_link(resource) if controller.ardata.links.include? :show\n columns << ar_edit_link(resource) if controller.ardata.links.include? :edit\n columns << ar_destroy_link(resource) if controller.ardata.links.include? :destroy\n\n columns= columns.map{|elem| content_tag :td, elem}.join(\"\\n \")\n columns= \"\\n #{columns}\\n \"\n\n result << \"\\n #{content_tag(:tr, columns, :class => cycle(\"even\", \"odd\")) }\\n\" \n end\n\n #Die!! Array :) See ar_index_table_headers\n @display_current_ar_index_table_column= nil\n end\n end",
"def data(*args, &block) # :yields: tablebody\n options = args.extract_options!\n if block_given?\n yield self\n else\n @table_fields += args.empty? ? orm_fields : args.collect {|f| TableField.new(f.to_sym)}\n @sortable_fields = options[:sortables] || []\n @current_sortable = [:created_at, \"DESC\"]\n if @sortable_fields.include?(@params[:sort_by].try(:to_sym))\n @current_sortable[0] = @params[:sort_by].to_sym\n end\n if [\"ASC\", \"DESC\"].include?(@params[:sort])\n @current_sortable[1] = @params[:sort]\n end\n end\n\n if (options[:mass_actions])\n @table_fields = [TableField.new(:mass_actions)] + @table_fields\n end\n\n @mass_action = options[:mass_actions]\n @mass_action_prefix = options[:mass_action_prefix]\n @cell_links = options[:links] || []\n @cell_prefix = options[:action_prefix]\n action_cells(options[:actions], options[:action_prefix])\n [\"\\n\", head, \"\\n\", body, \"\\n\"].join(\"\").html_safe\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: TurnoDatatable.new(view_context, { query: Turno.all }) }\n end\n end",
"def tableView(tableView, cellForRowAtIndexPath: indexPath)\n cell = tableView.dequeueReusableCellWithIdentifier(\"Cell\") || UITableViewCell.alloc.initWithStyle(UITableViewCellStyleDefault, reuseIdentifier:\"Cell\")\n cell.textLabel.text = \"Cell #{indexPath.row}\"\n cell\n end",
"def index\n if params[:format].nil? or params[:format] == 'html'\n @iteration = params[:iteration][/\\d+/] rescue 1\n @methods = Methods.sorted_order(\"#{sort_column('methods','name')} #{sort_direction}\").search(params[:search]).paginate(\n :page => params[:page], \n :per_page => params[:DataTables_Table_0_length]\n )\n log_searches(Methods)\n else # Allow url queries of data, with scopes, only xml & csv ( & json? )\n @methods = Methods.api_search(params)\n log_searches(Methods.method(:api_search), params)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.xml { render :xml => @methods }\n end\n end",
"def show\n @contents = DataTable.all\n\n \n end",
"def table(name, locator, row_wrapper: nil)\n self.finders[name] = TableFinder.new(:find, locator, wrapper: row_wrapper)\n end",
"def table\n projects = join_builder\n page = (table_params[:page] || 0).to_i\n page_size = (table_params[:page_size] || projects.count).to_i\n search = (table_params[:search])\n offset = page*page_size\n\n sort_column = table_params[:sort_column]\n sort_order = table_params[:sort_order]\n\n ### Update SORT Preferences ###\n if sort_column\n current_user.update_table_prefs(:projects, sort_column, sort_order)\n end\n\n query = nil \n if search\n searchable_columns = [:project_number, :fy_year, :title]\n search_string = \"%#{search}%\"\n search_year = (is_number? search) ? search.to_i : nil \n query = (query_builder(searchable_columns, search_string))\n .or(org_query search_string)\n .or(capital_project_type_query search_string)\n projects = projects.where(query)\n end\n\n projects = projects.order(current_user.table_sort_string :projects)\n \n project_table = projects.offset(offset).limit(page_size).map{ |p| p.rowify }\n render status: 200, json: {count: projects.count, rows: project_table} \n\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: ItemsDatatable.new(view_context, current_user) }\n end\n end",
"def index\n if params[:format].nil? or params[:format] == 'html'\n @iteration = params[:iteration][/\\d+/] rescue 1\n @models = Model.sorted_order(\"#{sort_column} #{sort_direction}\").search(params[:search]).paginate(\n :page => params[:page], \n :per_page => params[:DataTables_Table_0_length]\n )\n else # Allow url queries of data, with scopes, only xml & csv ( & json? )\n @models = Model.api_search(params)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.xml { render :xml => @models }\n format.csv { render :csv => @models }\n format.json { render :json => @models }\n end\n end",
"def index\n if params[:format].nil? or params[:format] == 'html'\n @iteration = params[:iteration][/\\d+/] rescue 1\n @models = Model.sorted_order(\"#{sort_column} #{sort_direction}\").search(params[:search]).paginate(\n :page => params[:page], \n :per_page => params[:DataTables_Table_0_length]\n )\n else # Allow url queries of data, with scopes, only xml & csv ( & json? )\n @models = Model.api_search(params)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.xml { render :xml => @models }\n format.csv { render :csv => @models }\n format.json { render :json => @models }\n end\n end",
"def data_tables\n @data_tables ||= @holdings_page.search('#rightcol')\n end",
"def index\n @datat_table_data = DatatTableDatum.all\n end",
"def index\n #search query, check params for search then search by appropriate fields\n @q = Entry.all\n @author_id = params[:search][:author_id] if params[:search]\n @text = params[:search][:text] if params[:search]\n @q = Entry.search(@q, @text) if !@text.blank?\n @q = @q.where(author_id: params[:search][:author_id]) if !@author_id.blank?\n\n #final result and column toggle sort\n @entries = @q.paginate(:page => params[:page], :per_page => 30).includes(:author).order(sort_column + \" \" + sort_direction)\n end",
"def index\n return appctrl_not_permitted() if ( @current_user.restricted? )\n\n # Set up the column data; see the index helper functions in\n # application_helper.rb for details.\n\n @columns = [\n { :header_text => 'Name', :value_method => 'name', :value_in_place => true },\n { :header_text => 'Code', :value_method => 'code', :value_in_place => true },\n { :header_text => 'Account type', :value_method => 'user_type' },\n { :header_text => 'E-mail address', :value_method => 'email', :value_helper => 'userhelp_email' },\n { :header_text => 'Identity URL', :value_method => 'identity_url', :value_helper => 'userhelp_identity_url' },\n ]\n\n # Get the basic options hash from ApplicationController, then work out\n # the conditions on objects being fetched, including handling the search\n # form data.\n\n options = appctrl_index_assist( User )\n active_vars = { :active => true }\n inactive_vars = { :active => false }\n conditions_sql = \"WHERE ( active = :active )\\n\"\n\n # If asked to search for something, build extra conditions to do so.\n\n range_sql, range_start, range_end = appctrl_search_range_sql( User )\n\n unless ( range_sql.nil? )\n search = \"%#{ params[ :search ] }%\" # SQL wildcards either side of the search string\n conditions_sql << \"AND #{ range_sql } ( name ILIKE :search OR email ILIKE :search OR identity_url ILIKE :search )\\n\"\n\n vars = { :search => search, :range_start => range_start, :range_end => range_end }\n active_vars.merge!( vars )\n inactive_vars.merge!( vars )\n end\n\n # Sort order is already partially compiled in 'options' from the earlier\n # call to 'appctrl_index_assist'.\n\n order_sql = \"ORDER BY #{ options[ :order ] }, name ASC, code ASC\"\n options.delete( :order )\n\n # Compile the main SQL statement.\n\n finder_sql = \"SELECT * FROM users\\n\" <<\n \"#{ conditions_sql }\\n\" <<\n \"#{ order_sql }\"\n\n # Now paginate using this SQL. The only difference between the active and\n # inactive cases is the value of the variables passed to Active Record for\n # substitution into the final SQL query going to the database.\n\n @active_users = User.paginate_by_sql( [ finder_sql, active_vars ], options )\n @inactive_users = User.paginate_by_sql( [ finder_sql, inactive_vars ], options )\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: InvoiceDrugsDatatable.new(params, view_context: view_context) }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: PostsDatatable.new(view_context) }\n end\n end",
"def tableView(aTableView, willDisplayCell:cell, forTableColumn:aTableColumn, row:rowIndex)\n cell.setRepresentedObject(@videoCollection[rowIndex])\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: DataTable::Nodes.new(view_context) }\n end\n end",
"def tables\n return enum_for(:tables) unless block_given?\n\n yield nil, rows\n end",
"def index\n if params[:format].nil? or params[:format] == 'html'\n @iteration = params[:iteration][/\\d+/] rescue 1\n @pfts = Pft.sorted_order(\"#{sort_column} #{sort_direction}\").search(params[:search]).paginate(\n :page => params[:page], \n :per_page => params[:DataTables_Table_0_length]\n )\n log_searches(Pft)\n else # Allow url queries of data, with scopes, only xml & csv ( & json? )\n @pfts = Pft.api_search(params)\n log_searches(Pft.method(:api_search), params)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.xml { render :xml => @pfts }\n format.csv { render :csv => @pfts }\n format.json { render :json => @pfts }\n end\n end",
"def results_view\n 'general_ledger_account_search_results_table'\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: SituacionRevistaDatatable.new(view_context, { query: SituacionRevistum.all.order(:codigo) }) }\n end\n end",
"def index\n @table_defs = TableDef.all\n respond_to do |format|\n format.js\n format.html\n end\n end",
"def index\n #using kaminari for pagination\n #@use_cases = UseCase.order(:id).page(params[:page]).per(5)\n\n #search\n if params[:search]\n key = \"%#{params[:search]}%\"\n @use_cases = UseCase.where( 'use_case_no LIKE :search OR client_name LIKE :search', search: key).page(params[:page]).per(5)\n else\n @use_cases = UseCase.all.page(params[:page]).per(5)\n end\n\n #dataTable stuffs, unused.\n respond_to do |format|\n format.html\n format.json { render json: UseCaseDatatable.new(params) }\n end\n end",
"def numberOfRowsInTableView(tableView)\n filteredData.size\n end",
"def index\n if params[:format].nil? or params[:format] == 'html'\n @iteration = params[:iteration][/\\d+/] rescue 1\n @priors = Prior.sorted_order(\"#{sort_column('priors','updated_at')} #{sort_direction}\").search(params[:search]).paginate(\n :page => params[:page], \n :per_page => params[:DataTables_Table_0_length]\n )\n log_searches(Prior)\n else # Allow url queries of data, with scopes, only xml & csv ( & json? )\n @priors = Prior.api_search(params)\n log_searches(Prior.method(:api_search), params)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.xml { render :xml => @priors }\n format.csv { render :csv => @priors }\n format.json { render :json => @priors }\n end\n end",
"def tableView(tableView, shouldShowMenuForRowAtIndexPath:indexPath)\n true\n end",
"def table config={}, &block\n #def tabular_widget config={}, &block\n require 'canis/core/widgets/table'\n events = [:PROPERTY_CHANGE, :LEAVE, :ENTER, :CHANGE, :ENTER_ROW, :PRESS ]\n block_event = nil\n # if no width given, expand to stack width\n #config.delete :title\n useform = nil\n\n w = Table.new useform, config # NO BLOCK GIVEN\n w.width ||= :expand \n w.height ||= :expand # TODO This has to come before other in stack next one will overwrite.\n _position(w)\n if block_given?\n #@current_object << w\n yield_or_eval &block\n #@current_object.pop\n end\n return w\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.haml\n format.json {\n page = 1\n\n page = params[:iDisplayStart].to_i/10+1 if params[:iDisplayStart]\n e = Course\n e = e.joins(:instructor, :college)\n\n total_record_size = 0\n display_length = 10\n\n if params[:iDisplayLength].to_i > 10\n display_length = params[:iDisplayLength].to_i\n end\n\n if params[:iSortCol_0].to_i != 0\n sort_column = DatatableFields[params[:iSortCol_0].to_i]\n sort_direction = params[:sSortDir_0]\n if [\"instructor\", \"college\"].include?(sort_column)\n sc = \"\"\n case sort_column\n when /instructor/\n sc = \"instructors.name\"\n when /college/\n sc = \"colleges.college_tag\"\n end\n e = e.order(\"#{sc} #{sort_direction}\")\n else\n e = e.order(\"#{sort_column} #{sort_direction}\")\n end\n end\n\n\n if params[:sSearch] != \"\" && !params[:sSearch].nil?\n \n search = DatatableFields.collect{|d| \"#{d} LIKE '%#{params[:sSearch]}%'\" unless [\"college\",\"instructor\", \"add\", \"friends\"].include?(d) }.compact.join(' OR ')\n search2 = \" OR instructors.name LIKE '%SUB%' OR colleges.college_tag LIKE '%SUB%' \".gsub('SUB', params[:sSearch])\n search += search2\n\n e = e.where(search)\n total_record_size = e.count\n e = e.page(page).per(display_length)\n #logger.info \"EQ: \" + e.to_sql\n else\n total_record_size = e.count\n e = e.page(page).per(display_length)\n end\n\n\n json = DatatablesRails::Structify.new(e)\n \n json.formatter do |u|\n course = Course.find(u['id'])\n if current_user.courses.where(:id => u['id']).first.blank?\n u['add'] = self.class.helpers.link_to \"Add\", user_courses_path(:course_id => u['id']), :method => :post, :remote => :true, :onclick => \"$(this).html('Added')\"\n else\n u['add'] = \"Added\"\n end\n u['course_number'] = self.class.helpers.link_to u['course_number'], course_path(:id => u['id'])\n u['instructor'] = self.class.helpers.link_to course.try(:instructor).try(:name), instructor_path(:id => course.try(:instructor_id))\n u['college'] = course.college.college_tag.upcase\n u['begin_time'] = u['begin_time'].strftime(\"%I:%M %p\")\n u['end_time'] = u['end_time'].strftime(\"%I:%M %p\")\n u['friends'] = current_user.find_friends_in_course(u['id']).size\n end\n json_struct = json.struct\n json_struct[\"iTotalRecords\"] = total_record_size\n json_struct[\"iTotalDisplayRecords\"] = total_record_size\n json_struct[\"sEcho\"] = params[:sEcho]\n render :json => json_struct\n\n }\n end\n end",
"def results_view\n 'capital_project_search_results_table'\n end",
"def index\n #@deduccion_ganancias_tables = DeduccionGananciasTable.all\n @search = DeduccionGananciasTable.search(params[:search])\n @deduccion_ganancias_tables = @search.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # indexoo.html.erb\n format.xml { render :xml => @deduccion_ganancias_tables }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: ReimbursementsDatatable.new(view_context) }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: SoldiersDatatable.new(view_context) }\n end\n end",
"def index\n @clientes = current_user.vendedor ? current_user.vendedor.clientes : Cliente.all\n\n\t\trespond_to do |format|\n format.html { render layout: \"dataTables\" }\n\t\t\tformat.csv { send_data @clientes.to_csv }\n end\n end",
"def autocomplete\r\n# return '' unless session[:edit_mode] > 0 # \r\n return render text: t('drgcms.not_authorized') unless dc_user_can(DcPermission::CAN_VIEW)\r\n# TODO Double check if previous line works as it should.\r\n table = params['table'].classify.constantize\r\n id = [params['id']] || '_id'\r\n# call method in class if search parameter has . This is for user defined searches\r\n# result must be returned as array of [id, search_field_value]\r\n a = if params['search'].match(/\\./)\r\n name, method = params['search'].split('.')\r\n table.send(method, params['input']).inject([]) do |r,v|\r\n r << { label: v[0], value: v[0], id: v[1].to_s }\r\n end\r\n# simply search which will search and return field_name defined in params['search']\r\n else\r\n table.where(params['search'] => /#{params['input']}/i).limit(20).inject([]) do |r,v|\r\n r << { label: v[params['search']], value: v[params['search']], id: v.id.to_s }\r\n end\r\n end\r\n\r\n render inline: a.to_json, formats: 'js'\r\nend",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: MotivoBajaDatatable.new(view_context, { query: MotivoBaja.all }) }\n end\n end",
"def sectionIndexTitlesForTableView(table_view)\n if self.respond_to?(:table_data_index)\n self.table_data_index\n end\n end",
"def autocomplete\r\n # table parameter must be defined. If not, get it from search parameter\r\n if params['table'].nil? && params['search'].match(/\\./)\r\n name = params['search'].split('.').first\r\n params['table'] = name.underscore\r\n end\r\n if params['table'].match('_control')\r\n # it must be at least logged on\r\n return render json: { label: t('drgcms.not_authorized') } unless dc_user_can(DcPermission::CAN_VIEW, 'dc_memory')\r\n else\r\n return render json: { label: t('drgcms.not_authorized') } unless dc_user_can(DcPermission::CAN_VIEW)\r\n end\r\n\r\n table = params['table'].classify.constantize\r\n input = params['input'].gsub(/\\(|\\)|\\[|\\]|\\{|\\|\\.|\\,}/, '')\r\n # call method in class if search parameter contains . This is for user defined searches\r\n a = if params['search'].match(/\\./)\r\n #method, additional_params = params['search'].split('.')\r\n #data = additional_params ? table.send(method, input, additional_params, self) : table.send(method, input)\r\n name, method = params['search'].split('.')\r\n data = table.send(method, input)\r\n data.map do |v|\r\n { label: v[0], value: v[0], id: (v[1] || v[0]).to_s }\r\n end\r\n # will search and return field_name defined in params['search']\r\n else\r\n table.where(params['search'] => /#{input}/i).limit(20).map do |v|\r\n { label: v[params['search']], value: v[params['search']], id: v.id.to_s }\r\n end\r\n end\r\n\r\n render json: a\r\nend",
"def awakeFromNib\n @table.setTarget(self)\n @table.setDoubleAction('on_entry_activation:')\n @table.setDelegate(self)\n create_list_of_files\n filter_files(nil)\n end",
"def table\n\n ### Get the default set of users ###\n users = join_builder\n\n ### Pluck out the Params ###\n page = (table_params[:page] || 0).to_i\n page_size = (table_params[:page_size] || users.count).to_i\n role = params[:role]\n search = (table_params[:search])\n offset = page*page_size\n sort_column = params[:sort_column]\n sort_order = params[:sort_order]\n columns = params[:columns]\n\n organization_id = [params[:organization_id].to_i] & @organization_list\n\n ### Update SORT and COLUMNS Preferences ###\n if sort_column.present? || columns.present?\n current_user.update_table_prefs(:users, sort_column, sort_order, columns)\n end\n\n ### Search ###\n if search.present?\n searchable_columns = [:first_name, :last_name, :phone, :phone_ext, :email, :title, :external_id] \n search_string = \"%#{search}%\"\n query = query_builder(searchable_columns, search_string)\n case search.downcase\n when 'active'\n query = query.or(User.arel_table[:active].eq(true))\n when 'inactive'\n query = query.or(User.arel_table[:active].eq(false))\n end\n users = users.where(query)\n\n ####### Get users who match search on role\n ##users_on_role = (role_query search_string).pluck(:id)\n ######## Search on every column (except role)\n ##all_user_table = User.joins(:organization).joins(:roles).where(query).pluck(:id)\n ######### Take the union of the above searches\n ##users = User.where(id: [users_on_role + all_user_table].uniq)\n end\n\n ### Filter ###\n if role.present?\n users = users.joins(:roles).where({roles: {name: role.split(',')}}).distinct\n end\n\n # Handle org list\n unless organization_id.empty?\n users = users.where(organization_id: organization_id)\n else\n users = users.where(organization: @organization_list)\n end\n \n ### SORT ###\n users = users.order(current_user.table_sort_string :users)\n\n ### Rowify Everything ###\n column_prefs = current_user.column_preferences :users\n user_table = users.offset(offset).limit(page_size).map{ |u| u.rowify column_prefs}\n render status: 200, json: {count: users.count, rows: user_table}\n end",
"def index\n # this will return all if no search param is passed, \n # so also acts like a normal index method\n \n case ActiveRecord::Base.connection.adapter_name\n when 'SQLite'\n @location_profiles = LocationProfile.find(:all, :conditions => ['name LIKE ?', \"%#{params[:search]}%\"]).paginate :per_page => 10, \n :page => params[:page], :conditions => ['name LIKE ?', \"%#{params[:search]}%\"], :order => 'name'\n when 'MySQL'\n @location_profiles = LocationProfile.find(:all, :conditions => ['name LIKE ?', \"%#{params[:search]}%\"]).paginate :per_page => 10, \n :page => params[:page], :conditions => ['name LIKE ?', \"%#{params[:search]}%\"], :order => 'name'\n when 'PostgreSQL'\n @location_profiles = LocationProfile.find(:all, :conditions => ['name ILIKE ?', \"%#{params[:search]}%\"]).paginate :per_page => 10, \n :page => params[:page], :conditions => ['name ILIKE ?', \"%#{params[:search]}%\"], :order => 'name'\n else\n raise 'Unsupported DB adapter'\n end \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @location_profiles }\n format.text # index.text.erb\n format.js { render :json => @location_profiles.to_json() }\n end\n end",
"def tableView( table_view, cellForRowAtIndexPath: index_path )\n cell = nil\n\n if index_path.row == 0\n cell = tableView.dequeueReusableCellWithIdentifier( DISPLAY_CELL_ID, forIndexPath: index_path )\n cell.selectionStyle = UITableViewCellSelectionStyleNone\n\n # remove old embedded control\n view_to_remove = cell.contentView.viewWithTag( VIEW_TAG )\n view_to_remove.removeFromSuperview unless view_to_remove.nil?\n \n cell.textLabel.text = @data_source_array[ index_path.section ][ :label ]\n button = @data_source_array[ index_path.section ][ :view ]\n\n # make sure this button is right-justified to the right side of the cell\n new_frame = button.frame\n new_frame.origin.x = CGRectGetWidth( cell.contentView.frame ) - CGRectGetWidth( new_frame ) - 10.0\n\n # if the cell is ever resized, keep the button over to the right\n button.frame = new_frame\n button.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin\n\n cell.contentView.addSubview( button )\n else\n cell = tableView.dequeueReusableCellWithIdentifier( SOURCE_CELL_ID , forIndexPath: index_path ).tap do |c|\n c.selectionStyle = UITableViewCellSelectionStyleNone\n c.textLabel.opaque = false\n c.textLabel.textAlignment = NSTextAlignmentCenter\n c.textLabel.textColor = UIColor.grayColor\n c.textLabel.numberOfLines = 2\n c.textLabel.highlightedTextColor = UIColor.blackColor\n c.textLabel.font = UIFont.systemFontOfSize( 12.0 )\n c.textLabel.text = @data_source_array[ index_path.section ][ :source ]\n end\n end\n\n cell\n end",
"def index\n respond_to do |format|\n\n\n format.html\n\n\n format.json { render json: DistributorDatatable.new(view_context, current_user) }\n\n end\n end",
"def tableView(tableView, willDisplayHeaderView:view, forSection:section)\n view.textLabel.setTextColor(UIColor.whiteColor)\n view.backgroundView.backgroundColor = rmq.color.purple\n end",
"def index\n\n #@content_lists_count = current_user.contents.count\n #@total = current_user.contents.count\n\n #@contents = current_user.contents.order(\"contents.updated_at\").paginate(:per_page => 20, :page => params[:page])\n #@total = current_user.contents.count\n\n index_columns ||= [:name,:subject,:status_string,:updated_at,:created_user]\n current_page = params[:page] ? params[:page].to_i : 1\n rows_per_page = params[:rows] ? params[:rows].to_i : 10\n\n conditions={:page => current_page, :per_page => rows_per_page}\n conditions[:order] = params[\"sidx\"] + \" \" + params[\"sord\"] unless (params[:sidx].blank? || params[:sord].blank?)\n \n if params[:_search] == \"true\"\n conditions[:conditions]=filter_by_conditions(index_columns)\n end\n \n @contents = current_user.contents.where(conditions[:conditions]).order(conditions[:order]).paginate(conditions)\n total_entries=@contents.total_entries\n @total = total_entries\n\n count = @contents.count - 1\n for i in 0..count\n name = @contents[i].name\n #@subscribers[i].email = \"<b><a>\"+ email +\"</a></b>\"\n \n id = @contents[i].id.to_s\n @contents[i].name = '<h3 class=\"dlink\"><a href=\"/contents/' + id + '\" style=\"color: #00008d;\">' + name + '</a><span class=\"actions\"> <a href=\"/contents/' + id + '/edit\">Edit</a> <a href=\"/contents/' + id + '\" data-confirm=\"Are you sure?\" data-method=\"delete\" rel=\"nofollow\">Delete</a></span></h3>'\n\n end\n\n respond_with(@contents) do |format|\n format.json { render :json => @contents.to_jqgrid_json(index_columns, current_page, rows_per_page, total_entries)} \n end\n\n\n\n #@contacts = Contact.all\n\n\n# respond_to do |format|\n# format.html # index.html.erb\n# format.xml { render :xml => @contents }\n# format.json { render :json => @contents }\n# end\n end",
"def display_all_cell_headers\n # Interface method\n end",
"def table\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: IntervalsDatatable.new(view_context) }\n end\n end",
"def contents\n super || DataTable.new(1, 1, '')\n end",
"def tableView(tableView, rowViewForRow:row)\n FBSidePanelTableRowView.new\n end",
"def index\n @ordenes = @vendedor ? Orden.por_vendedor(@vendedor.id) : Orden.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html { render layout: \"dataTables\" }\n\t\t\tformat.csv { send_data @ordenes.to_csv }\n\t\t\tformat.pdf do\n\t\t\t\trender pdf: 'ordenes', # file name\n\t\t\t\tlayout: 'layouts/application.pdf.erb', # layout used\n\t\t\t\tshow_as_html: params[:debug].present? # allow debuging\n\t\t\tend\n\t\tend\n end",
"def tables\n @entries = Table.includes(:outlet, :table_section).where(\"location_id=? #{@outlet_query}\", params[:location_id].to_i).paginate(:page => params[:page]) if request.xhr? \n end",
"def tableView(tableView, cellForRowAtIndexPath: indexPath)\n cell = tableView.dequeueReusableCellWithIdentifier(CELL_IDENTIFIER)\n cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator\n cell.textLabel.text = self.menu_list.objectAtIndex(indexPath.row).objectForKey(TITLE_KEY)\n cell.detailTextLabel.text = self.menu_list.objectAtIndex(indexPath.row).objectForKey(EXPLAIN_KEY)\n cell\n end",
"def tables(opts=OPTS, &block)\n tables_or_views('TABLE', opts, &block)\n end",
"def show_table(table, repository: nil, nested: nil)\n\n columns = %w(Item Value)\n prefix = repository ? \"about-#{repository}\" : 'about'\n div_opt = { class: \"#{prefix}-table-container\" }\n table_opt = { class: \"#{prefix}-table\" }\n\n if table.is_a?(Hash)\n # Turn off <thead> if nested.\n table_opt[:class] += ' nested' if nested\n thead = !nested\n colgroup = true\n else\n # Translate the array into a key/value pair form that will be iterated\n # over the same way a Hash is.\n unless table.is_a?(Array)\n logger.warn { \"#{__method__}: #{table.class}: should be Enumerable\" }\n end\n table = Array.wrap(table).map { |v| [nil, v] }\n thead = colgroup = false\n end\n\n # The <table> element inside a container.\n content_tag(:div, div_opt) do\n content_tag(:table, table_opt) do\n\n # Define columns with a distinct CSS class for styling.\n colgroup &&=\n content_tag(:colgroup) do\n (1..columns.size).map { |i|\n content_tag(:col, '', class: \"col#{i}\")\n }.join.html_safe\n end\n\n # Table header if requested and table is a hash.\n thead &&=\n content_tag(:thead) do\n columns.map { |x|\n content_tag(:th, h(x), class: 'heading')\n }.join.html_safe\n end\n\n # Table body in which Enumerable values are handled as nested tables.\n tbody =\n content_tag(:tbody) do\n table.map { |k, v|\n nested_table =\n case v\n when Hash then v.present?\n when Array then v.first.is_a?(Enumerable) || (v.size > 2)\n end\n content_tag(:tr) do\n k = k&.to_s\n v = nested_table ? show_table(v, nested: true) : v.inspect\n [k, v].map { |x|\n content_tag(:td, h(x), class: 'cell') if x\n }.join.html_safe\n end\n }.join(\"\\n\").html_safe\n end\n\n [colgroup, thead, tbody].reject(&:blank?).join(\"\\n\").html_safe\n end\n end\n end",
"def table_content\n # This makes a call to gift_rows and gets back an array of data that will \n # populate the columns and rows of a table I then included some styling to \n # include a header and make its text bold. I made the row background colors \n # alternate between grey and white Then I set the table column widths\n table gift_rows do\n row(0).font_style = :bold\n self.header = true\n self.row_colors = ['DDDDDD', 'FFFFFF']\n self.column_widths = [180, 180, 180]\n end\n end",
"def show_table(name, table, table_hash, conditions = {}, delete = [])\n\t\t\t \tbegin\n\t\t\t\t\tdefault_columns = []\n\t\t\t\t\ttable_hash.each do |key, val|\n\t\t\t\t\t\tdefault_columns << key\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tdelete.each do |i| ; default_columns.delete_if {|v| (v == i)} ; end\n\t\t\t\t\t\n\t\t\t\t\ttbl = Rex::Ui::Text::Table.new({'Header' => name, 'Columns' => default_columns})\n\t\t\t\t\t\n\t\t\t\t\tlen1 = table.length - 1\n\t\t\t\t\tlen2 = default_columns.length - 1\n\t\t\t\t\n\t\t\t\t\tfind_all(table, table_hash, conditions).each do |victim|\n\t\t\t\t\t\tline = []\n\t\t\t\t\t\tfor i in 0..len2\n\t\t\t\t\t\t\tline << victim[table_hash[default_columns[i]]].to_s\n\t\t\t\t\t\tend\n\t\t\t\t\t\ttbl << line\n\t\t\t\t\tend\n\t\t\t\t\t\t\t\n\t\t\t\t\tprint_line\n\t\t\t\t\tprint_line tbl.to_s\n\t\t\t\trescue\n\t\t\t\t\tprint_error(\"Error 9: #{$!}\") if (XSSF_MODE[0] =~ /^Debug$/i)\n\t\t\t\tend\n\t\t\tend",
"def table_of_contents\n accept RDoc::Markup::ToTableOfContents.to_toc\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: ItemStoresDatatable.new(view_context) }\n end\n end",
"def index\n @students = Student.all\n respond_to do |format|\n format.html\n format.json {render json: StudentsDatatable.new(view_context)}\n end\n end",
"def table options = {} \n render_partial :table, template_locals(:table_row, options)\n end",
"def index\n params[:term] ||= ''\n params[:page] ||= '1'\n params[:order] ||= 'name'\n params[:dir] ||= 'up'\n\n dir = params[:dir] == 'up' ? 'ASC' : 'DESC'\n stats = current_user ? \"status_id IN (4,3,2)\" : \"status_id = 4\"\n @sub = Submission.where([\"name LIKE ? AND #{stats}\", params[:term] + '%'])\n .order(\"#{params[:order]} #{dir}\")\n .paginate(:page => params[:page], :per_page => 12)\n if request.xhr?\n render :partial => 'search_table', :layout => false\n else\n render 'index', :layout => (logged_in? ? 'application' : 'public')\n end\n end",
"def index\n\n if params[:format].nil? or params[:format] == 'html'\n @iteration = params[:iteration][/\\d+/] rescue 1\n @citations = Citation.sorted_order(\"#{sort_column('citations','author')} #{sort_direction}\").search(params[:search]).paginate(\n :page => params[:page], \n :per_page => params[:DataTables_Table_0_length]\n )\n log_searches(Citation)\n else\n @citations = Citation.api_search(params)\n log_searches(Citation.method(:api_search), params)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js \n format.xml { render :xml => @citations }\n format.csv { render :csv => @citations }\n format.json { render :json => @citations }\n end\n end",
"def numberOfSectionsInTableView tableView\n 1\n end",
"def index\n session[:search_filter_info] = {}\n\t\t@screen = Screen.find(params[:id])\n @action_source = params[:action_source] || 'index'\n @quick_operation = params[:quick_operation] || 'index'\n @filtered_reference = params[:filtered_reference] || {}\n @row_ids = []\n @row_pattern = Row.find(params[:row_pattern_id].to_i) unless params[:row_pattern_id].nil?\n\n rpp = ApplicationController.current_user.rows_per_page\n @pageno = (!@action_source.include?('page_')) ? 1 : params[:pageno].gsub('/','')\n\n case @action_source\n when 'index'\n options = @quick_operation == 'index' ? Row.filter_by_custom_fields(params[:id].to_i, {}, 'index', false) : {}\n\n @row_ids = options[:filtered_row_ids] || []\n @row_ids_wo_limit = options[:filtered_row_ids_wo_limit] || []\n @row_pattern = Row.find(options[:row_pattern_id]) unless options[:row_pattern_id].nil?\n session[:sort_field_id_order] = options[:sort_field_id_order] || []\n\n RowsController.store_session_row_ids(session.session_id, @screen.id, @row_ids, @row_ids_wo_limit)\n\n when 'search', 'page_search', 'page_index'\n\n session[:search_filter_info] = {}\n\n @filtered_reference.each do |key, other|\n cf = CustomField.find(key)\n case cf\n when CustomFields::TextField\n fieldValue = other\n session[:search_filter_info][cf.name] = fieldValue\n when CustomFields::Reference\n fieldValue = Cell.find(:first, :conditions => {:row_id => other.values}).value\n session[:search_filter_info][cf.name] = fieldValue\n when CustomFields::DateTimeField\n count = other.length\n i=0\n for i in 0..(count-1)\n fieldDate = other.keys[i]\n fieldValue = other.values[i]\n session[:search_filter_info][fieldDate] = fieldValue\n end\n else\n fieldValue = other\n a=10\n end\n end\n\n\n\n screen_id = params[:request_id] || @screen.id\n purge = !params[:request_id].nil?\n @row_ids = RowsController.get_session_row_ids(session.session_id, screen_id.to_i, purge)\n \n if params.has_key?(:sort_field_id)\n session[:sort_field_id_order] = Row.reorder_field_sorting(session[:sort_field_id_order], params[:sort_field_id])\n\n @row_ids = Row.sort(@row_ids, session[:sort_field_id_order])\n\n RowsController.store_session_row_ids(session.session_id, @screen.id, @row_ids)\n end\n end\n\n @sort_field_id_order = session[:sort_field_id_order]\n \n @row_ids ||= []\n\n @row_count = @row_ids.size\n\n #Page generator\n pageno_from = (rpp*(@pageno.to_i-1))\n pageno_to = ((rpp*@pageno.to_i)-1)\n\n @maxpage = (@row_ids.size.to_f / rpp).ceil\n @row_ids = @row_ids[pageno_from..pageno_to] || []\n\n @rows = @screen.rows.find(:all,\n :conditions => {\n :rows => { :id => @row_ids }\n }\n )\n\n @rows.sort!{|a, b| @row_ids.index(a.id) <=> @row_ids.index(b.id)}\n\n GC.start\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rows }\n end\n end"
] |
[
"0.5536448",
"0.5417154",
"0.5326385",
"0.5308815",
"0.50853115",
"0.50801945",
"0.49760684",
"0.49630967",
"0.4951682",
"0.49376687",
"0.49332392",
"0.49173078",
"0.49159804",
"0.4900891",
"0.48927355",
"0.48763564",
"0.48569173",
"0.48541132",
"0.4845098",
"0.4835976",
"0.48048466",
"0.48011366",
"0.4791917",
"0.47900274",
"0.47868037",
"0.47787422",
"0.47743073",
"0.47712004",
"0.47676462",
"0.4765532",
"0.47654557",
"0.47644174",
"0.47387648",
"0.47361836",
"0.47328547",
"0.4726421",
"0.47185606",
"0.47174194",
"0.47005332",
"0.46964547",
"0.4693139",
"0.46896398",
"0.4687907",
"0.4684925",
"0.4684925",
"0.46763277",
"0.46729723",
"0.46706396",
"0.4664924",
"0.46601856",
"0.46590742",
"0.46582317",
"0.46561053",
"0.46475697",
"0.46472594",
"0.46437773",
"0.46421698",
"0.4639549",
"0.46395284",
"0.4639449",
"0.46340397",
"0.4622923",
"0.46206045",
"0.4619602",
"0.46182132",
"0.4617048",
"0.46129912",
"0.46104896",
"0.4609109",
"0.46077383",
"0.46070588",
"0.45896983",
"0.4576833",
"0.4572018",
"0.45679447",
"0.4565382",
"0.45639288",
"0.45630804",
"0.45616364",
"0.45449415",
"0.45387053",
"0.45382142",
"0.453687",
"0.45367098",
"0.4524969",
"0.45228934",
"0.4522001",
"0.45171982",
"0.45139",
"0.450896",
"0.45083398",
"0.4504114",
"0.44956094",
"0.44921455",
"0.44902596",
"0.4487801",
"0.44870552",
"0.44869038",
"0.44856697",
"0.44856063"
] |
0.54704094
|
1
|
Checks each way matches the live version and deletes it if it does not.
|
def refresh_way
@osm.way.each_key do |way|
@log.info('refreshing ' + way)
response = query_server('/way/' + way)
if !response.nil?
xml = StringIO.new(response)
importer = Xml_import_osm.new(@new_osm)
listner = Listener.new(importer)
REXML::Document.parse_stream(response, listner)
if compare_way(@osm.way[way], @new_osm.way[way]) == false
#remove way
@log.debug(way + ' differs from live version')
@osm.way.delete(way)
end
else
#remove way
@log.debug(way + ' differs from live version')
@osm.way.delete(way)
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def free!\n return false if matches.empty?\n match_preference_indexes = matches.map { | match | preferences.index match }\n max = match_preference_indexes.max # The index of the match with the lowest preference\n candidate_to_reject = preferences[ max ]\n\n # Delete from both sides\n candidate_to_reject.matches.delete self\n self.matches.delete candidate_to_reject\n end",
"def clean_old_versions( versions_to_keep )\n find( :all, :conditions => [ 'number <= ?', self.maximum( :number ) - versions_to_keep ] ).each do |version|\n version.destroy\n end\n end",
"def clean_db(prev_versions)\nputs \"CLEAN DB CALLED\"\n if Version.count > prev_versions\n to_remove = Version.count - prev_versions\n puts \"Removing #{to_remove} old versions from database\"\n Version.all(:limit => to_remove, :order => [ :processed.asc ]).each do |old_version|\n old_version.units.all.each do |old_unit|\n #old_unit.images.all.each do |old_image|\n # old_image.destroy\n #end\n old_unit.destroy\n end\n old_version.destroy\n end\n end\n end",
"def test_deleteway_valid\n way = create(:way_with_nodes, :nodes_count => 3)\n nodes = way.nodes.each_with_object({}) { |n, ns| ns[n.id] = n.version }\n cs_id = way.changeset.id\n user = way.changeset.user\n\n # Of the three nodes, two should be kept since they are used in\n # a different way, and the third deleted since it's unused\n\n a = way.nodes[0]\n create(:way_node, :node => a)\n b = way.nodes[1]\n create(:way_node, :node => b)\n c = way.nodes[2]\n\n amf_content \"deleteway\", \"/1\", [\"#{user.email}:test\", cs_id, way.id, way.version, nodes]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal way.id, result[2]\n assert_equal way.version + 1, result[3]\n assert_equal({ c.id.to_s => 2 }, result[4])\n\n new_way = Way.find(way.id)\n assert_equal way.version + 1, new_way.version\n assert_equal false, new_way.visible\n\n way.nds.each do |node_id|\n assert_equal result[4][node_id.to_s].nil?, Node.find(node_id).visible\n end\n end",
"def cleanup_oldies\n debug_msg \"Removing old builds\"\n to_remove = []\n @builds.simple_builds.each do |build|\n current = nil\n build.versioned_builds.sort.each do |versioned|\n to_remove << current if current && current.same_minor?(versioned)\n current = versioned\n end\n end\n to_remove.each do |build|\n debug_msg \" - #{build}\"\n FileUtils.rm_rf File.join(@public_dir, build.to_s)\n end\n @builds.merged_builds.each do |merged|\n to_remove.each do |build|\n if merged.include? build\n debug_msg \" - #{merged}\"\n FileUtils.rm_rf File.join(@public_dir, merged.to_s) \n end\n end\n end\n \n end",
"def cleanup_distances!\n r = get_result(:distances)\n ref = project.datasets.select(&:is_ref?).select(&:is_active?).map(&:name)\n return if r.nil?\n [:haai_db, :aai_db, :ani_db].each do |db_type|\n db = r.file_path(db_type)\n next if db.nil? or not File.size? db\n sqlite_db = SQLite3::Database.new db\n table = db_type[-6..-4]\n val = sqlite_db.execute \"select seq2 from #{table}\"\n next if val.empty?\n (val.map(&:first) - ref).each do |extra|\n sqlite_db.execute \"delete from #{table} where seq2=?\", extra\n end\n end\n end",
"def cleanup_distances!\n r = get_result(:distances)\n ref = project.datasets.select(&:ref?).select(&:active?).map(&:name)\n return if r.nil?\n\n %i[haai_db aai_db ani_db].each do |db_type|\n db = r.file_path(db_type)\n next if db.nil? || !File.size?(db)\n\n sqlite_db = SQLite3::Database.new db\n table = db_type[-6..-4]\n val = sqlite_db.execute \"select seq2 from #{table}\"\n next if val.empty?\n\n (val.map(&:first) - ref).each do |extra|\n sqlite_db.execute \"delete from #{table} where seq2=?\", extra\n end\n end\n end",
"def remove_sync_matches(product)\n product.master.integration_sync_matches.destroy_all\n end",
"def remove_stowaways(requested_root_version, versions)\n versions.reject do |version|\n version.item_type == requested_root_version.item_type && version.item_id != requested_root_version.item_id\n end\n end",
"def test_deleteway_inuse\n way = create(:way_with_nodes, :nodes_count => 4)\n create(:relation_member, :member => way)\n nodes = way.nodes.each_with_object({}) { |n, ns| ns[n.id] = n.version }\n cs_id = way.changeset.id\n user = way.changeset.user\n\n amf_content \"deleteway\", \"/1\", [\"#{user.email}:test\", cs_id, way.id, way.version, nodes]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 2, result.size\n assert_equal -1, result[0]\n assert_match /Way #{way.id} is still used/, result[1]\n\n new_way = Way.find(way.id)\n assert_equal way.version, new_way.version\n assert_equal true, new_way.visible\n\n way.nds.each do |node_id|\n assert_equal true, Node.find(node_id).visible\n end\n end",
"def purge\n begin\n purge!\n rescue API::VersionMismatch\n false\n end\n end",
"def purge\n begin\n purge!\n rescue API::VersionMismatch\n false\n end\n end",
"def check_for_matches(guess, key)\n check_for_direct_matches(guess, key)\n delete_matches(@@direct_matches, guess)\n delete_matches(@@direct_matches, key)\n check_for_color_matches(guess, key)\n end",
"def destroy_current_puzzle_if_any\n\n return true if $redis.keys(\"#{remote_ip}.hidden.ids\").empty?\n \n $redis.keys(\"#{remote_ip}.hidden.*\").each do |key|\n $redis.del(key)\n end\n\n $redis.del(\"#{remote_ip}.#{session}.image_reference\")\n end",
"def clean()\n rels = releases()\n rels.pop()\n\n unless rels.empty?\n rm = ['rm', '-rf'].concat(rels.map {|r| release_dir(r)})\n rm << release_dir('skip-*')\n cmd.ssh(rm)\n end\n end",
"def remove_oneway_links\n @links.delete_if { |k,l|\n l.oneway?\n }\n end",
"def clean_up\n if self.deleted?\n # clean room type mapping\n RoomTypeChannelMapping.find_all_by_room_type_id(self.id).each do |rtcm|\n rtcm.update_attribute(:deleted, true)\n end\n # clean master rate mapping\n RoomTypeMasterRateMapping.find_all_by_room_type_id(self.id).each do |rtmr|\n RoomTypeMasterRateChannelMapping.find_all_by_room_type_master_rate_mapping_id(rtmr.id).each do |rtc|\n rtc.update_attribute(:deleted, true)\n end\n rtmr.update_attribute(:deleted, true)\n end\n # clean availability link from\n RoomTypeInventoryLink.find_all_by_room_type_from_id(self.id).each do |rml|\n rml.update_attribute(:deleted, true)\n end\n # clean availability link to\n RoomTypeInventoryLink.find_all_by_room_type_to_id(self.id).each do |rml|\n rml.update_attribute(:deleted, true)\n end\n end\n end",
"def ensure_deletion_fixes \n # TO DO\n end",
"def free_all_servers\n success = true\n last_fitnesse_path = @@last_fitnesse_path\n @@locked_servers.each do |fpath, servers| \n init_for_path(fpath)\n edit_lines_in_file do |lines|\n lines.map! do |line|\n if /^\\*/ === line\n servers.each do |selected_server|\n if /^\\*#{Regexp.escape(selected_server)}( |$)/ === line\n line = selected_server \n servers.delete(selected_server)\n break\n end\n end\n # Breakout occurs here.\n end\n line\n end # lines.map!\n end # edit_lines_in_file\n success &= (servers.length == 0)\n @@locked_servers[fpath] = []\n end\n init_for_path(last_fitnesse_path)\n return success\n end",
"def remove_unused_polylines\n\t\t#Polyline.delete(self.polyline_id)\n\t\tPolyline.destroy_all([\"id = ?\", self.polyline_id])\n\t\t\n\t\tSyncronisation.destroy_all([\"route_id = ?\", self.id])\n\t\t\n\t\t#Polyline.find(:all, :conditions => [\"video_id = ?\", self.id]).each { |object| object.destroy }\n\tend",
"def destroy\n begin\n destroy!\n rescue API::VersionMismatch\n false\n end\n end",
"def clean\n disable_referential_integrity do\n tables_cache.keys.reverse_each do |table|\n ActiveRecord::Base.connection.execute %(\n DELETE FROM #{table}\n )\n end\n end\n end",
"def destroy_games_to_edit\n user_bracket.games.select do |game|\n Bracket.rounds.index(game.round) >= Bracket.rounds.index(@current_round)\n end.each{|game| game.destroy}\n end",
"def cleanup()\n Track.where(scanned: false).delete_all()\n Disc.delete_all(\"id NOT IN (SELECT DISTINCT(disc_id) FROM tracks)\")\n Album.delete_all(\"id NOT IN (SELECT DISTINCT(album_id) FROM tracks)\")\n Artist.delete_all(\"id NOT IN (SELECT DISTINCT(artist_id) FROM tracks)\")\n end",
"def clean_db\n\n puts \"Caching wikipedia links\"\n @wikipedia_cache = {}\n Artist.all\n .where('wikilink IS NOT NULL')\n .pluck( 'name' , 'wikilink' )\n .each { |result| @wikipedia_cache[ key_name(result[0]) ] = result[1] }\n\n puts \"Cleaning db\"\n PlayerState.delete_all\n PlayListSong.delete_all\n Song.delete_all\n Album.delete_all\n Artist.delete_all\n end",
"def remove_old_answers\n if self.valid?\n self.choice_questions.includes(:choice_answers).each {|x| x.choice_answers.each(&:destroy)}\n end\n end",
"def do_delete\n moved = []\n # evacuate the room.\n\n if !@stuff.empty? \n moved = @stuff.dup\n moved.each do |person|\n if person.is_a?(Player)\n # send them to a safe vnum...we're going to use vnum 1\n person.go_anywhere\n end\n end\n end\n \n\n 4.times do |i|\n ex = self.exit_list[i]\n next if ex == nil\n\n log :debug, \"ex #{ex.direction} deleted\"\n\n if ex.towards_room.gri.exit_list[ex.direction.exit_code_rev] \n if ex.towards_room.gri.exit_list[ex.direction.exit_code_rev].towards_room.gri == self # if it's the same room as being deleted we delete \n ex.towards_room.gri.exit_list[ex.direction.exit_code_rev].do_delete\n end\n end\n ex.do_delete\n end\n\n moved.each do |p|\n p.execute_command(\"look\")\n end\n Tag.clear_tag(self)\n @vtag = nil\n a = @vnum / 1000\n Vnum.rooms[@vnum % 1000] = nil # unlinked from main list.\n end",
"def destroy\n # destroy related matchings\n \n @related_matchings = AppCourseMatching.where(course_id: self.id)\n @related_matchings.destroy_all\n \n #destroy itself\n super\n end",
"def delete_league\n\t#p \"clear teams y/n\"\n\t#opt = gets.chomp!\n\t#if opt == \"y\"\n\t\tFile.delete('teams.db')\n\t#end\nend",
"def update_available_players\r\n create_new_players\r\n available_players = Player.where(available: true)\r\n available_players.each do |tlfl_player|\r\n if !@active_players.find {|fd_player| fd_player[\"PlayerID\"] == tlfl_player.fd_id} \r\n tlfl_player.destroy\r\n end\r\n end\r\n end",
"def destroy_removed_migrations\n # @todo Make these methods into a more DRY manner for grabbing each record type and diff'ing them.\n # \n # We create an array for each record type that includes all records that we are going to destroy. We do this by taking the previous records array, converting them to a standard array and keeping them if any previous records occur in the migrated records array.\n versions_to_remove = GuidesGenerator::Migrator::previous_versions.to_a.keep_if do |version|\n !GuidesGenerator::Migrator::migrated_versions.include?(version)\n end\n\n sections_to_remove = GuidesGenerator::Migrator::previous_sections.to_a.keep_if do |sections|\n !GuidesGenerator::Migrator::migrated_sections.include?(sections)\n end\n\n documents_to_remove = GuidesGenerator::Migrator::previous_documents.to_a.keep_if do |document|\n !GuidesGenerator::Migrator::migrated_documents.include?(document)\n end\n\n # After we have all the arrays of records to remove iterate over each array and destroy the records.\n [versions_to_remove, sections_to_remove, documents_to_remove].each {|records| records.each {|record| record.destroy}}\n end",
"def remove_old\n count = WrongAnswer.count(:all, :conditions => { :user_id => user.id })\n if count > APP_SETTINGS['wrong_answers_to_store']\n WrongAnswer.find(:first, :conditions => { :user_id => user.id }).destroy\n end\n end",
"def clean\n\t\t\n\t\t@db.del 'twitter'\n\t\t@db.del 'rpg'\n\t\n\tend",
"def orphaned_design_checks\n \n log = []\n \n total_design_checks = self.design_checks.size\n self.trim_checklist_for_design_type\n self.get_design_checks\n \n completed_check_counts = self.completed_check_count\n \n attached_design_checks = []\n self.checklist.each_check { |ch| attached_design_checks << ch.design_check }\n\n directory_name = self.design.directory_name\n \n orphaned_design_checks = self.design_checks - attached_design_checks\n \n if orphaned_design_checks.size > 0\n \n self.designer_completed_checks = completed_check_counts[:self]\n self.auditor_completed_checks = completed_check_counts[:peer]\n self.save\n \n log << \" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\"\n log << \" REMOVING INAPPROPRIATE DESIGN CHECKS\"\n log << \" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\"\n\n orphaned_design_checks.each do |dc|\n check = Check.find(dc.check_id)\n \n log << \"\"\n log << \" DESIGN CHECK ID: \" + dc.id.to_s\n log << \" CHECK ID: \" + dc.check_id.to_s\n log << \" SELF CHECKED: \" + dc.self_auditor_checked?.to_s\n log << \" PEER CHECKED: \" + dc.peer_auditor_checked?.to_s\n log << \" NEW REVIEW: \" + check.full_review?.to_s\n log << \" BB REVIEW: \" + check.dot_rev_check?.to_s\n \n dc.destroy \n \n design_check_list = DesignCheck.find(:all, :conditions => \"audit_id=#{self.id} AND check_id=#{dc.check_id}\")\n if design_check_list.size > 1\n log << \"\"\n log << \" **********************************************\"\n log << \" **********************************************\"\n log << \" ***** WARNING: FOUND MULTIPLE DESIGN CHECKS!!!\"\n log << \" **********************************************\"\n log << \" **********************************************\"\n log << \"\"\n end\n end\n end\n \n log\n \n end",
"def test_version\n way = create(:way, :with_history)\n used_way = create(:way, :with_history)\n create(:relation_member, :member => used_way)\n way_with_versions = create(:way, :with_history, :version => 4)\n\n create(:way_tag, :way => way)\n create(:way_tag, :way => used_way)\n create(:way_tag, :way => way_with_versions)\n propagate_tags(way, way.old_ways.last)\n propagate_tags(used_way, used_way.old_ways.last)\n propagate_tags(way_with_versions, way_with_versions.old_ways.last)\n\n check_current_version(way.id)\n check_current_version(used_way.id)\n check_current_version(way_with_versions.id)\n end",
"def destroy\n transaction do\n if self.old_version\n self.old_version.update_column :new_version_id, nil\n end\n super\n end\n end",
"def cleanup(release)\n\n if (release)\n num = @release_version\n str = \"release\"\n else\n num = @devel_version\n str = \"devel\"\n end\n\n keys_to_delete = []\n @link_map.keys.each do |k|\n if k =~ /packages\\/#{num}/\n newkey = k.sub \"packages/#{num}\", \"packages/#{str}\"\n @link_map[newkey] = 1\n keys_to_delete.push k\n end\n end\n for key in keys_to_delete\n @link_map.delete key\n end\nend",
"def test_version\n check_current_version(current_ways(:visible_way).id)\n check_current_version(current_ways(:used_way).id)\n check_current_version(current_ways(:way_with_versions).id)\n end",
"def outdated_delete\n outdated.delete_all\n end",
"def destroy\n Site.delete_all \"sitename = 'lost+found'\" \n super\n end",
"def clean_database\n\t\t\t\tbegin\n\t\t\t\t\tupdate_all(XSSF_VICTIM_DB, XSSF_VICTIM_HASH, {\"CURRENT_ATTACK_URL\" => nil, \"TUNNELED\" => false})\n\t\t\t\t\tdelete_all(XSSF_WAITING_ATTACKS_DB) \n\t\t\t\trescue\n\t\t\t\t\tprint_error(\"Error 10: #{$!}\") if (XSSF_MODE[0] =~ /^Debug$/i)\n\t\t\t\tend\n\t\t\tend",
"def delete_essence_menu_if_trashed\n #deletes essence menu if the element containing the essence has been trashed in the cms\n Alchemy::EssenceMenu2.all.each do |e|\n if e.element.trashed? == true\n e.destroy\n end\n end\n Alchemy::EssenceMenu.all.each do |e|\n if e.element.trashed? == true\n e.destroy\n end\n end\n end",
"def nuke\n self.open_graph_event.destroy unless self.open_graph_event.nil?\n self.teamsheet_entries.destroy_all\n self.messages.destroy_all\n self.activity_items.destroy_all\n self.result.destroy unless self.result.nil?\n self.destroy\n end",
"def clean_database\n [Entry, Room, User].each do |model|\n model.delete_all\n end\nend",
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n bad_comps = Comparison.find(:all, :conditions => \"compared_to = #{params[:id]}\")\n for comp in bad_comps\n comp.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to(places_url) }\n format.xml { head :ok }\n end\n end",
"def clear_teams\n\t@table_array.each do |each_table_name|\n\t\t@db.execute(\"DROP TABLE IF EXISTS \" + each_table_name)\n\tend\nend",
"def destroy_obsolete_git_files\n return unless git_repository.valid?\n website_git_files.find_each do |git_file|\n dependency = git_file.about\n # Here, dependency can be nil (object was previously destroyed)\n is_obsolete = dependency.nil? || !dependency.in?(recursive_dependencies_syncable_following_direct)\n if is_obsolete\n Communication::Website::GitFile.mark_for_destruction(self, git_file)\n end\n end\n self.git_repository.sync!\n end",
"def remove_dead_symlinks\n base_paths.each do |path|\n command = \"find #{path} -xtype l -delete\"\n Pkg::Util::Net.remote_execute(Pkg::Config.staging_server, command)\n end\n end",
"def clean_up_my_app(orchestrate)\n\n\t# -----------------------------------------------------------------------------------\n\t# Delete the 'league/teams' relationship for each league\n\t#\n\tif @population_control['member-teams'] == :delete\n\t\tif false\n\t\t\t@all_league_ids.each do |league_id_str|\n\t\t\t\t# # Try deleting each relation individually (directly via the API)\n\t\t\t\t# filename = \"#{@root_name}-leagues-#{league_id_str}-teams-t2-relation.json\"\n\t\t\t\t# keys_B = JSON.parse(open(\"#{@src_dir}/#{filename}\").read)['member-team-ids']\n\t\t\t\t# keys_B.each do |key_B|\n\t\t\t\t# \torchestrate.delete_relation({\n\t\t\t\t# \t\tcollection_A: :leagues,\n\t\t\t\t# \t\tkey_A: league_id_str,\n\t\t\t\t# \t\trelation: :teams,\n\t\t\t\t# \t\tcollection_B: :teams,\n\t\t\t\t# \t\tkey_B: key_B,\n\t\t\t\t# \t})\n\t\t\t\t# end\n\n\t\t\t\t# Try deleting each relation individually (via the helper)\n\t\t\t\tdelete_relation_list({\n\t\t\t\t\tclient: orchestrate,\n\t\t\t\t\tcollection_A: 'leagues',\n\t\t\t\t\tkey_A: league_id_str, \n\t\t\t\t\trelation: 'teams'\n\t\t\t\t})\n\n\t\t\t\t# Try deleting the entire relationship\n\t\t\t\torchestrate.delete_relations(collection_A: 'leagues', key_A: league_id_str, relation: 'teams')\n\t\t\tend\n\t\tend\n\tend\n\n\t# -----------------------------------------------------------------------------------\n\t# Delete the 'league/standings' events for each league\n\t#\n\tif @population_control[:standings] == :delete\n\t\tif false\n\t\t\t@all_league_ids.each do |league_id_str|\n\t\t\t\torchestrate.delete_events(collection_A: 'leagues', key: league_id_str, event_type: 'standings')\n\t\t\tend\n\t\tend\n\tend\n\n\t# -----------------------------------------------------------------------------------\n\t# Delete the 'leagues' collection keys\n\t#\n\tif @population_control[:leagues] == :delete\n\t\t@all_league_ids.each do |league_id_str|\n\t\t\torchestrate.delete_key(collection: 'leagues', key: league_id_str)\n\t\tend\n\tend\nend",
"def destroy_relations\n begin\n File.delete FRIENDS_IDS_PATH + self.twitter_id.to_s\n File.delete FOLLOWER_IDS_PATH + self.twitter_ids.to_s\n rescue\n puts \"Didnt find the corresponding files.\"\n end \n end",
"def delete_version\n @object.delete(:version)\n end",
"def cleanup!\n FileUtils.rm_rf(obsolete_files)\n FileUtils.rm_rf(metadata_file) unless @site.incremental?\n end",
"def delete_exists_pairs_in_response\n make_currency_pairs - CurrencyPair.pluck(:pair)\n end",
"def destroy!\n self.update(:menu_match => nil, :link_url => nil, :deletable => true)\n\n self.destroy\n end",
"def destroy\n\n @synonymous = Synonymou.all\n\n @synonymous.each do |synonymou|\n if synonymou.word_id==@word.id\n synonymou.destroy\n elsif synonymou.word_2_id==@word.id\n synonymou.destroy\n end\n end\n\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url, notice: 'Word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def chef_to_be_removed(chef_server_list)\n servers_up = cloud_server_list\n chef_server_list.delete_if do |name,server|\n puts \"Do not delete #{name}, it's up\" if servers_up[name]\n !! servers_up[name]\n end\nend",
"def remove_moved_files\n scan_for_merges.each do |file|\n if File.amp_lexist?(@repo.working_join(file))\n UI.debug(\"removing #{file}\")\n File.unlink(@repo.working_join(file))\n end\n end\n end",
"def valid_versions\n valids = versions.reject{ |v,f| !f.exists? }\n valids.delete(:original) if self.pdf.filename == self.original.filename\n valids\n end",
"def unload!\n @versions = nil\n @version_json = {}\n @last_update = {}\n @maps = {}\n @mappings = nil\n end",
"def destroy\n @way = Way.find(params[:id])\n @way.destroy\n\n respond_to do |format|\n format.html { redirect_to(ways_url) }\n format.xml { head :ok }\n end\n end",
"def delete_existing\n Answer.delete_all\n Question.delete_all\n Knock.delete_all\n Door.delete_all\n Canvasser.delete_all\nend",
"def normalize_games\n @match.games.each do |game|\n if !game.player1_score.present? && !game.player2_score.present?\n @match.games.delete(game)\n next\n end\n game.player1_id = @match.player1_id\n game.player2_id = @match.player2_id\n end\n end",
"def remove_should_check_existing?\n true\n end",
"def cleanup_old_ships(ships_tsw)\n ships_tsw.safely do |ships|\n ships.delete_if { |k, v| 86400 < v.seconds_since_last_contact }\n end\n end",
"def cleanup_old_person\n\t\tself.person_was.destroy if self.person_was && self.person_was.show_positions.count == 0 && self.person_was.netid.blank?\n\tend",
"def clean\n @lock.synchronize do\n now = Time.now\n dtime = Global.tuple_space_disconnection_time\n @tuple_space.delete_if {|_, holder| (now - holder[:last_time]) > dtime}\n end\n end",
"def destroy_simple_game\n Zone.destroy_all\n ZoneHolder.destroy_all\n User.destroy_all\n Team.destroy_all\n Task.destroy_all\n Hint.destroy_all\n Code.destroy_all\n CodeString.destroy_all\n TeamCode.destroy_all\n TeamHint.destroy_all\n Log.destroy_all\n Game.destroy_all\nend",
"def pretend_links_do_not_exist\n test_mode && remove_old_links\n end",
"def delete_dead_tuple_spaces\n @tuple_space_lock.synchronize do\n @tuple_space.delete_if do |_, space|\n not(Util.ignore_exception {timeout(1) {space.ping}})\n end\n end\n end",
"def test_history_equals_versions\n check_history_equals_versions(current_ways(:visible_way).id)\n check_history_equals_versions(current_ways(:used_way).id)\n check_history_equals_versions(current_ways(:way_with_versions).id)\n end",
"def cleanUpWorkingFiles()\n system(\"rm -f #{@tripFile} #{routeFile} #{routeAltFile}\") ;\n end",
"def clear_old_versions\n return if self.class.max_version_limit == 0\n excess_baggage = send(self.class.version_column).to_i - self.class.max_version_limit\n if excess_baggage > 0\n self.class.versioned_class.delete_all [\"#{self.class.version_column} <= ? and #{self.class.versioned_foreign_key} = ?\", excess_baggage, id]\n end\n end",
"def clean_handles\n @handle_keys.each do |k, v|\n if @handle_last_pinged[v] && @handle_last_pinged[v] < Time.now - 30\n log \"removed clone handle: #{v}\"\n remove_user_by_handle(v)\n end\n end\n end",
"def clean!\n for duplicate in duplicates.map{|duplicate| duplicate[0]}\n @commands.delete_if{ |i| i[0] == duplicate}\n @commands << [duplicate, ENV[duplicate]]\n end\n end",
"def cleanup(bucket, prefix, versions)\n objects = @con.get_bucket(bucket, :prefix => prefix).body['Contents']\n\n return if objects.size <= versions\n\n objects[0...(objects.size - versions)].each do |o|\n Monsove.logger.info(\"Removing outdated version #{o['Key']}\")\n @con.delete_object(bucket, o['Key'])\n end\n end",
"def clean\n nonces = Dir[@nonce_dir.join(\"*\")]\n now = Time.now\n \n nonces.each do |nonce|\n filename = nonce_dir.join(nonce)\n begin\n st = File.stat(filename)\n rescue Errno::ENOENT\n next\n else\n nonce_age = now - st.mtime\n self.remove_if_present(filename) if nonce_age > @max_nonce_age\n end\n end\n\n association_filenames = Dir[@association_dir.join(\"*\")]\n association_filenames.each do |af|\n begin\n f = File.open(af, 'r')\n rescue Errno::ENOENT\n next\n else\n begin\n assoc_s = f.read\n ensure\n f.close\n end\n begin\n association = OpenID::Association.deserialize(assoc_s)\n rescue \"VersionError\"\n self.remove_if_present(af)\n next\n else\n self.remove_if_present(af) if association.expires_in == 0 \n end\n end\n end\n end",
"def purge_associations\n EspRulesList.where(list_type: type, list_id: id).delete_all\n ExportedLead.where(list_type: type, list_id: id).delete_all\n MessageAutoResponse.where(esp_list_type: type, esp_list_id: id).delete_all\n end",
"def clean_bck!\n self.each do |bck|\n if bck.to_keep == false\n bck.delete!\n end\n end\n end",
"def cleanup\n @@palindromes.each do |k, v|\n if k < (Time.now - 10.minutes)\n @@palindromes.delete(k)\n end\n end\n end",
"def test_destroy\n\n checklist_0_1 = checklists(:checklist_0_1)\n \n # Try destroying without logging in.\n put(:destroy, { :id => checklist_0_1.id }, {})\n assert_redirected_to(:controller => 'user', :action => 'login')\n\n # Try destroying from a non-Admin account.\n put(:destroy, { :id => checklist_0_1.id }, rich_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n\n total_checks = Check.count\n total_subsections = Subsection.count\n total_sections = Section.count\n total_checklists = Checklist.count\n \n ids = { :checks => [], :subsections => [], :sections => [] }\n checklist_0_1.sections.each do |section|\n ids[:sections] << section.id\n section.subsections.each do |subsection|\n ids[:subsections] << subsection.id\n subsection.checks.each do |check|\n ids[:checks] << check.id\n end\n end\n end\n\n\n post(:destroy, {:id => checklist_0_1.id}, cathy_admin_session)\n assert_redirected_to(:action => 'list')\n \n total_checks -= ids[:checks].size\n total_subsections -= ids[:subsections].size\n total_sections -= ids[:sections].size\n \n assert_equal(total_checks, Check.count)\n assert_equal(total_subsections, Subsection.count)\n assert_equal(total_sections, Section.count)\n assert_equal(total_checklists-1, Checklist.count)\n\n all_checks = Check.find(:all)\n all_subsections = Subsection.find(:all)\n all_sections = Section.find(:all)\n all_checklists = Checklist.find(:all)\n ids[:checks].each { |id| assert(!all_checks.detect { |c| c.id == id }) }\n ids[:subsections].each { |id| assert(!all_subsections.detect { |ss| ss.id == id })}\n ids[:sections].each { |id| assert(!all_sections.detect { |s| s.id == id })}\n assert(!all_checklists.detect { |cl| cl.id == checklist_0_1 })\n \n end",
"def delete_now\n revisions.each do |rev_id| \n CouchDB.delete( \"#{uri}?rev=#{rev_id}\" )\n end\n true \n end",
"def update_soft_deletion_for_variants\n if self.variants.present? and self.status_changed?\n self.variants.each do |variant|\n variant.permalink = [variant.permalink, \"-\", SecureRandom.hex(8)].join\n variant.status = self.status\n variant.save\n end\n end\n end",
"def cleanup\n @keys.each { |key, time|\n if expired_kalive?(key, 300)\n delete_key(key)\n end\n\n if expired_unlocked?(key, 60)\n unblock_key(key)\n end\n }\n \n end",
"def destroy\n links = Link.all.where(board_id: params[:id])\n links.each do |link|\n link.comments.each do |comment|\n comment.votes.each do |vote|\n vote.destroy\n end\n comment.destroy\n end\n link.destroy\n end\n Board.find(params[:id]).destroy\n redirect_to :back\n end",
"def clean_changes! = changes.delete_if { |_, values| values.all?(&:blank?) || values[0] == values[1] }",
"def cleanup\n delete!\n return true\n rescue PoolNode::Conflict\n # still in use\n return false\n end",
"def delete_ok?\n product_versions.empty? && variants.empty?\n end",
"def destroy\r\n if @game.is_empty?\r\n increment_winner_statistic\r\n\r\n # destroy bots users\r\n bots_ids = @game.users.collect {|user| user.id if user.is_bot}\r\n User.where(id: bots_ids).destroy_all\r\n @game.players.destroy_all # todo use it in future\r\n @game.destroy\r\n end\r\n end",
"def spots_to_remove\n Spot.outdated\n end",
"def cleanup\n @models.reverse_each(&:destroy_all)\n end",
"def update_future_versions_of_destruction\n conditions =\n \"mock_list_id = #{self.mock_list_id} AND version > #{self.version}\"\n future_mocks = self.class.all(:conditions => conditions)\n future_mocks.each do |mock|\n mock.update_attribute(:version, mock.version - 1)\n end\n end",
"def destroy\n self.class.where(:id => self.id).update_all(:is_mirrored => false) if self.is_mirrored?\n super\n end",
"def remove_should_check_existing?\n false\n end",
"def delete_maps\n own_maps.each do | map |\n logger.debug \"deleting map #{map.inspect}\"\n map.destroy\n end\n end",
"def delete_maps\n own_maps.each do | map |\n logger.debug \"deleting map #{map.inspect}\"\n map.destroy\n end\n end",
"def destroy\n @league.fantasy_teams.delete_all\n @league.draft_picks.delete_all\n @league.destroy\n respond_to do |format|\n format.html { redirect_to leagues_url, notice: 'League was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deleteWaypoint _wp\n SQF.deleteWaypoint _wp\n end",
"def cleanup_unused_schemas!\n schemas_string = JSON.generate(schemas)\n used_references = schemas_string.scan(/\\{\\\"\\$ref\\\":\\\"#\\/components\\/schemas\\/(.*?)\\\"/).flatten.uniq\n existing_references = schemas.keys.select { |x| x.include?(\"Reference\") }\n unused_references = existing_references - used_references\n\n schemas.except!(*unused_references)\n end",
"def check_version\n set_current_version # make @current_version usable.\n\n # If the version has changed, update all champions and their stats.\n if Champion.first.version != @current_version\n update_version\n end\n end",
"def cleanup_completed_torrents(active_torrents = Torrent.active.all)\n active_torrents.each do |active_torrent|\n if active_torrent.stop_seeding?(self.setting.ratio)\n if remove_torrent(active_torrent)\n active_torrent.set_state(:completed)\n active_torrent.save!\n end\n end\n end\n end"
] |
[
"0.616391",
"0.6065155",
"0.59841365",
"0.5879119",
"0.58750343",
"0.58690405",
"0.57966816",
"0.5785772",
"0.5773108",
"0.575508",
"0.572038",
"0.572038",
"0.56487286",
"0.5619987",
"0.5585794",
"0.5555359",
"0.55174065",
"0.54747474",
"0.5465739",
"0.54227656",
"0.53936046",
"0.53868496",
"0.53656286",
"0.5360714",
"0.53597784",
"0.53513926",
"0.5348465",
"0.53342974",
"0.5288367",
"0.5286789",
"0.5275646",
"0.52620643",
"0.526151",
"0.52603716",
"0.525026",
"0.524729",
"0.5244069",
"0.5235473",
"0.5210481",
"0.5202926",
"0.5199676",
"0.51924556",
"0.5191863",
"0.51823133",
"0.51779425",
"0.51553756",
"0.5148667",
"0.5144894",
"0.5143398",
"0.5134685",
"0.5128752",
"0.51285815",
"0.5122134",
"0.51207364",
"0.512073",
"0.5118615",
"0.51130307",
"0.51059014",
"0.51006454",
"0.508697",
"0.5077243",
"0.5065424",
"0.50642926",
"0.50593334",
"0.50575835",
"0.5057329",
"0.50542676",
"0.50540483",
"0.5049382",
"0.50464976",
"0.5046385",
"0.50340074",
"0.5029734",
"0.5028151",
"0.50225073",
"0.5022321",
"0.50193244",
"0.50145924",
"0.5013217",
"0.50070655",
"0.5005373",
"0.50044256",
"0.49993676",
"0.4998138",
"0.49935955",
"0.4991501",
"0.49840975",
"0.49776402",
"0.4974495",
"0.49712345",
"0.4967234",
"0.49644464",
"0.4963453",
"0.49615264",
"0.49615264",
"0.4961493",
"0.49577153",
"0.49510226",
"0.4946619",
"0.4945743"
] |
0.6493353
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_api_v1_nomination
@api_v1_nomination = Api::V1::Nomination.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
|
Only allow a trusted parameter "white list" through.
|
def api_v1_nomination_params
params.fetch(:api_v1_nomination, {})
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
|
GET /zoneamentos/1 GET /zoneamentos/1.json
|
def show
@zoneamento = Zoneamento.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @zoneamento }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @zona = Zona.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zona }\n end\n end",
"def index\n @zones = Zone.all\n render json: @zones\n #@zones\n end",
"def index\n @zones = Zone.all\n\n render json: @zones\n end",
"def show\n render json: [*@zone]\n end",
"def show\n render json: @ozones\n end",
"def show\n render json: @zone\n end",
"def index\n @ozones = Ozone.all\n render json: @ozones\n end",
"def show\n @admin_zone = Admin::Zone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_zone }\n end\n end",
"def show\n @timezone = Timezone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timezone }\n end\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 new\n @zoneamento = Zoneamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @zoneamento }\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 all_zones\n @zones = Zone.all\n @user = current_user\n\n respond_to do |format|\n format.html # all_zones.html.erb\n format.json { render json: @zones }\n end\n end",
"def show\n @zone_status = ZoneStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zone_status }\n end\n end",
"def show\n @erogenous_zone = ErogenousZone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @erogenous_zone }\n end\n end",
"def index\n @zonas = Zona.all\n end",
"def display\n @reservas = Reserva.order(fecha_inicio_estadia: :desc)\n render json: @reservas, include: [:cliente, :habitacion]\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 render json: @departamento\n end",
"def show\n @toy_zone = ToyZone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @toy_zone }\n end\n end",
"def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end",
"def new\n @zona = Zona.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zona }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def index\n @planificaciones = Planificacion.order('created_at DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @planificaciones }\n end\n end",
"def show\n @zutat = Zutat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zutat }\n end\n end",
"def index\n @zones = Zone.all\n end",
"def index\n @zones = Zone.all\n end",
"def show\n @plannegocio = Plannegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plannegocio }\n end\n end",
"def show\n @time_zone = TimeZone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_zone }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end",
"def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end",
"def show\n @turma = Turma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @turma }\n end\n end",
"def show\n @mapeamento = Mapeamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mapeamento }\n end\n end",
"def show\n @municipio_de_la_preparatoria_o_universidad_de_origen = MunicipioDeLaPreparatoriaOUniversidadDeOrigen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @municipio_de_la_preparatoria_o_universidad_de_origen }\n end\n end",
"def show\n @plato = Plato.find(params[:id])\n\n if !@plato.comentario.first.nil?\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id], include: [comentario:{only: [:id]}])\n else\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id])\n end\n end",
"def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def show\n @zone = Zone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def show\n @preparatoria_o_universidad_de_origen = PreparatoriaOUniversidadDeOrigen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origen }\n end\n end",
"def show\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @areco }\n end\n end",
"def index\n @ozones = Ozone.all\n end",
"def index\n @zonals = Zonal.all\n end",
"def show\n @coordinador = Coordinador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coordinador }\n end\n end",
"def show\n @asociado = Asociado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asociado }\n end\n end",
"def show\n @ordinario = Ordinario.find(params[:id])\n @alumnos = @ordinario.alumnos\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ordinario }\n end\n end",
"def InfoFarmacia\n \tid = params[:id]\n @farmacias = Farmacium.find_by_sql(\"SELECT nombre, correo, direccion, latitud, longitud, telefono1, telefono2 FROM farmacia where id = #{id}\")\n render json: @farmacias\n end",
"def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end",
"def show\n @capacidad = Capacidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacidad }\n end\n end",
"def show\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aviso }\n end\n end",
"def index\n @razones_sociale = RazonesSociale.find(params[:razon])\n @razones_comerciales = @razones_sociale.razones_comerciales\n end",
"def show\n @vano = Vano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vano }\n end\n end",
"def show\n @realiza = Realiza.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @realiza }\n end\n end",
"def show\n @requerimiento ||= Requerimiento.where(:numero => params[:id]).first\n @areas = Area.where(\" nombre like '%DIT%' \")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @requerimiento }\n end\n end",
"def show\n @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 index\n @plan_de_venta = PlanDeVentum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plan_de_venta }\n end\n end",
"def show\n @cervejaria = Cervejaria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cervejaria }\n end\n end",
"def index\n if @country\n @zones = @country.zones\n else\n @zones = Zone.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\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 new\n @zone = Zone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zone }\n end\n end",
"def show\n @user = User.find(params[:user_id])\n declare_sticker\n @zone = Zone.find(params[:id])\n\n respond_to do |format|\n format.html { gmaps_zone_marker } # show.html.erb\n format.json { render json: @zone }\n end\n end",
"def FarmaciasCercanas\n @farmacias = Farmacium.find_by_sql(\"SELECT id, nombre,latitud, longitud FROM farmacia where correo <> 'ADMIN'\")\n render json: @farmacias\n end",
"def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\n end\n end",
"def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def index\n @flights = Flight.all\n render json: @flights\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end",
"def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end",
"def index\n @ventas = Venta.order(\"fecha desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas }\n end\n end",
"def show\n render json: @tutorado, status: :ok\n end",
"def show\n @fornecedor_custo = FornecedorCusto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fornecedor_custo }\n end\n end",
"def show\n @zone_updater = ZoneUpdater.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zone_updater }\n end\n end",
"def show\n @tipo_atendimento = TipoAtendimento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_atendimento }\n end\n end",
"def show\n @odontologia1 = Odontologia1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odontologia1 }\n end\n end",
"def destroy\n @zoneamento = Zoneamento.find(params[:id])\n @zoneamento.destroy\n\n respond_to do |format|\n format.html { redirect_to zoneamentos_url }\n format.json { head :no_content }\n end\n end",
"def show\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torso }\n end\n end",
"def 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 @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 show\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv_adicionale }\n end\n end",
"def show\n @local_deportivo = LocalDeportivo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @local_deportivo }\n end\n end",
"def show\n @razmer_go = RazmerGo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @razmer_go }\n end\n end",
"def show\n @municipio = Municipio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @municipio }\n end\n end",
"def show\n @municipio = Municipio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @municipio }\n end\n end",
"def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end",
"def show\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ativo_outro }\n end\n end",
"def show\n @local_deportivo = LocalDeportivo.find(params[:id], :conditions=> \"estado = 'C' OR estado is NULL\")\n \n @espacio_deportivos = @local_deportivo.espacio_deportivos.find(:all)\n \n \n respond_to do |format|\n format.html \n format.json { render json: {:espacio_deportivos =>@espacio_deportivos, :local_deportivo => @local_deportivo }}\n end\n \n end",
"def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end",
"def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def show\n @wycieczka = Wycieczka.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wycieczka }\n end\n end",
"def index\n render json: @fiestas\n end",
"def index\n @formatos = Formato.where(ativo: true)\n \t\n render json: @formatos\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n @etnia = Etnia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etnia }\n end\n end",
"def show\n @movimentacao_de_estoque = MovimentacaoDeEstoque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movimentacao_de_estoque }\n end\n end",
"def show\n @flight = Flight.find(params[:id])\n render json: @flight\n end",
"def Plan_Paciente\n id = params[:id]\n plan_paciente = PlanPaciente.find_by_sql(\"SELECT nombre FROM plan_pacientes where laboratorio_id= #{id}\")\n render json: plan_paciente\n end",
"def show\n @municipio_dominio = MunicipioDominio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @municipio_dominio }\n end\n end",
"def show\n @fulcliente = Fulcliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fulcliente }\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 @trabalho = Trabalho.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trabalho }\n end\n end"
] |
[
"0.72250354",
"0.71677834",
"0.71508473",
"0.70448995",
"0.70400196",
"0.7023082",
"0.7017232",
"0.6704599",
"0.66656727",
"0.66629034",
"0.6648785",
"0.66203594",
"0.66101664",
"0.659395",
"0.6587109",
"0.6580519",
"0.655609",
"0.65008765",
"0.64913195",
"0.6480973",
"0.6437018",
"0.6427739",
"0.63907677",
"0.63907677",
"0.6376576",
"0.63613534",
"0.63596046",
"0.63596046",
"0.635204",
"0.634262",
"0.6337544",
"0.6337483",
"0.6240601",
"0.6223698",
"0.6196189",
"0.6194708",
"0.6193974",
"0.6186573",
"0.6185738",
"0.61837316",
"0.6177715",
"0.6171663",
"0.6169817",
"0.61657786",
"0.6159404",
"0.61583745",
"0.6156531",
"0.61509657",
"0.6147799",
"0.6147105",
"0.6132753",
"0.61224157",
"0.61212367",
"0.6116886",
"0.61157244",
"0.6108136",
"0.6106448",
"0.6105601",
"0.61043483",
"0.6103945",
"0.60994804",
"0.6098403",
"0.60981977",
"0.60945016",
"0.6092154",
"0.6086783",
"0.6086783",
"0.6082834",
"0.60760814",
"0.60753495",
"0.6069451",
"0.6067432",
"0.60611445",
"0.606013",
"0.6059564",
"0.6057604",
"0.60575974",
"0.60575974",
"0.6056689",
"0.60562545",
"0.6055883",
"0.60550153",
"0.60550153",
"0.60544765",
"0.6051593",
"0.605152",
"0.60464525",
"0.60453534",
"0.6035684",
"0.60334045",
"0.60303295",
"0.60303295",
"0.6028461",
"0.60218185",
"0.60206556",
"0.6019843",
"0.60179317",
"0.60166156",
"0.6014345",
"0.6013191"
] |
0.762167
|
0
|
GET /zoneamentos/new GET /zoneamentos/new.json
|
def new
@zoneamento = Zoneamento.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @zoneamento }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @zone = Zone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zone }\n end\n end",
"def new\n @zona = Zona.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zona }\n end\n end",
"def create\n @zoneamento = Zoneamento.new(params[:zoneamento])\n\n respond_to do |format|\n if @zoneamento.save\n format.html { redirect_to @zoneamento, :notice => 'Zoneamento was successfully created.' }\n format.json { render :json => @zoneamento, :status => :created, :location => @zoneamento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @zoneamento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @admin_zones = Admin::Zone.all\n @admin_zone = Admin::Zone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_zone }\n end\n end",
"def new\n @ordinario = Ordinario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ordinario }\n end\n end",
"def new\n @zone = Zone.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @tecnico = Tecnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def new\n @timezone = Timezone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timezone }\n end\n end",
"def create\n @zona = Zona.new(params[:zona])\n\n respond_to do |format|\n if @zona.save\n format.html { redirect_to @zona, notice: 'Zona creata con successo.' }\n format.json { render json: @zona, status: :created, location: @zona }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @toy_zone = ToyZone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @toy_zone }\n end\n end",
"def new\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aviso }\n end\n end",
"def new\n @cliente = Cliente.new\n localidad_new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @tecnico = Tecnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @tecnico }\n end\n end",
"def new\n @zone_status = ZoneStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zone_status }\n end\n end",
"def new\n @asociado = Asociado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asociado }\n end\n end",
"def new\n @plannegocio = Plannegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plannegocio }\n end\n end",
"def new\n @areco = Areco.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @areco }\n end\n end",
"def new\n @locacao = Locacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @locacao }\n end\n end",
"def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @premio }\n end\n end",
"def new\n @viaje = Viaje.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @viaje }\n end\n end",
"def new\n @erogenous_zone = ErogenousZone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @erogenous_zone }\n end\n end",
"def create\n @zone = Zone.new(zone_params)\n\n respond_to do |format|\n if @zone.save\n format.html { redirect_to @zone, notice: 'Área creada exitosamente' }\n format.json { render :show, status: :created, location: @zone }\n else\n format.html { render :new }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @capacidad = Capacidad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capacidad }\n end\n end",
"def new\n @coordinador = Coordinador.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coordinador }\n end\n end",
"def create\n @zone = Zone.new(params[:zone])\n\n respond_to do |format|\n if @zone.save\n format.html { redirect_to zones_url, notice: 'Zone was successfully created.' }\n format.json { render json: @zone, status: :created, location: @zone }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @tiezi = Tiezi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tiezi }\n end\n end",
"def new\n @presenza = Presenza.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presenza }\n end\n end",
"def new\n @caixa = Caixa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caixa }\n end\n end",
"def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @premio }\n end\n end",
"def new\n @torso = Torso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @torso }\n end\n end",
"def new\n @zayavka = Zayavka.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zayavka }\n end\n end",
"def new\n @venta = Venta.new(:fecha => Date.today, confirmada: true)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venta }\n end\n end",
"def new\n @user = User.find(params[:user_id])\n declare_sticker\n @zone = Zone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zone }\n end\n end",
"def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end",
"def new\n @trnodo = Trnodo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trnodo }\n end\n end",
"def new\n @atracao = Atracao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @atracao }\n end\n end",
"def new\n @paciente = Paciente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paciente }\n end\n end",
"def new\n @municipio = Municipio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @municipio }\n end\n end",
"def new\n @municipio = Municipio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @municipio }\n end\n end",
"def new\n @posto = Posto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @posto }\n end\n end",
"def new\n @sezione = Sezione.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sezione }\n end\n end",
"def new\n @local_deportivo = LocalDeportivo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @local_deportivo }\n end\n end",
"def new\n @karteikarte = Karteikarte.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @karteikarte }\n end\n end",
"def new\n @selecao = Selecao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @selecao }\n end\n end",
"def new\n @servicio = Servicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def new\n @asignatura = Asignatura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asignatura }\n end\n end",
"def new\n @local_desportivo = LocalDesportivo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @local_desportivo }\n end\n end",
"def new\n @zone_updater = ZoneUpdater.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zone_updater }\n end\n end",
"def new\n @sistema = Sistema.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sistema }\n end\n end",
"def new\n @preparatoria_o_universidad_de_origen = PreparatoriaOUniversidadDeOrigen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origen }\n end\n end",
"def new\n @publicidad = Publicidad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publicidad }\n end\n end",
"def new\n @estatuto = Estatuto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @estatuto }\n end\n end",
"def new\n @turma = Turma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @turma }\n end\n end",
"def new\n @torneo = Torneo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @torneo }\n end\n end",
"def new\n @tipo_atendimento = TipoAtendimento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_atendimento }\n end\n end",
"def new_for_order\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html\n format.json { render json: @cliente }\n end\n end",
"def new\n @etnia = Etnia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @etnia }\n end\n end",
"def create\n @zone = Zone.new(zone_params)\n\n if @zone.save\n render json: @zone, status: :created, location: @zone\n else\n render json: @zone.errors, status: :unprocessable_entity\n end\n end",
"def new\n @prioridade = Prioridade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prioridade }\n end\n end",
"def new\n @pagamento = Pagamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pagamento }\n end\n end",
"def new\n puts 'NEW METHOD'\n @pessoa = Pessoa.new\n @pessoa.enderecos.build\n 2.times { @pessoa.telefones.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def new\n @comentario = Comentario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comentario }\n end\n end",
"def new\n @veiculo = Veiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def new\n @puntaje = Puntaje.new\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def new\n @puntaje = Puntaje.new\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def new\n @origin = OriginAddr.new\n \n drop_breadcrumb('新增')\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @origin }\n end\n end",
"def creacion\n fiesta = Fiesta.new (params[:id])\n if Fiesta.save\n puts \"su fiesta a sido registrada\"\n else \n puts \"su fiesta no a sido registrada\"\n end\n render = json: fiesta \n end",
"def new\n @municipio_de_la_preparatoria_o_universidad_de_origen = MunicipioDeLaPreparatoriaOUniversidadDeOrigen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @municipio_de_la_preparatoria_o_universidad_de_origen }\n end\n end",
"def create\n @zone = Zone.new(zone_params)\n\n respond_to do |format|\n if @zone.save\n format.html { redirect_to zones_path, notice: \"Zone was successfully created.\" }\n format.json { render :show, status: :created, location: @zone }\n else\n format.html { render :new }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @juzgado }\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @po }\n end\n end",
"def new\n @peso = Peso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @peso }\n end\n end",
"def new\n @time_zone = TimeZone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_zone }\n end\n end",
"def new\n @empresa = Empresa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @empresa }\n end\n end",
"def new\n @nabe = Nabe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nabe }\n end\n end",
"def new\n @vano = Vano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vano }\n end\n end",
"def new\n @vocacionada = Vocacionada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vocacionada }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @vodka = Vodka.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vodka }\n end\n end",
"def new\n @seguidore = Seguidore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seguidore }\n end\n end",
"def new\n @estacionamiento = Estacionamiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @estacionamiento }\n end\n end",
"def create\n authorize! :create, Tipo\n @tipo = Tipo.new(tipo_params)\n log(\"Se ha creado la nomina #{@lt}\", 0)\n\n respond_to do |format|\n if @tipo.save\n format.html { redirect_to tipos_path, notice: 'La nómina fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @tipo }\n else\n format.html { render :new }\n format.json { render json: @tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zakaz = Zakaz.new(params[:zakaz])\n\n respond_to do |format|\n if @zakaz.save\n format.html { redirect_to @zakaz, notice: 'Zakaz was successfully created.' }\n format.json { render json: @zakaz, status: :created, location: @zakaz }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zakaz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @tipo_pensum = TipoPensum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_pensum }\n end\n end",
"def new\n @trlocalidad = Trlocalidad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trlocalidad }\n end\n end",
"def new\n @capacitacion = Capacitacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capacitacion }\n end\n end",
"def new\n @area_usuario = AreaUsuario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area_usuario }\n end\n end",
"def new\n @orgao = Orgao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orgao }\n end\n end",
"def new\n @estudiante = Estudiante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @estudiante }\n end\n end",
"def new\n @estabelecimento = Estabelecimento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @estabelecimento }\n end\n end",
"def new\n @tenni = Tenni.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tenni }\n end\n end",
"def new\n\n @paciente = Paciente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paciente }\n end\n end",
"def new\n @tipomedalla = Tipomedalla.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipomedalla }\n end\n end",
"def new\n @monnaie = Monnaie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monnaie }\n end\n end",
"def new\n render :json => @fiestas.push(params[:fiesta])\n end",
"def new\n DebugLog(params.inspect)\n @lancamentorapido = Lancamentorapido.new\n \n @categorias = Category.all\n @centrosdecusto = Centrodecusto.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lancamentorapido }\n end\n end"
] |
[
"0.7623028",
"0.7604283",
"0.7564461",
"0.7119359",
"0.708741",
"0.7068637",
"0.7065412",
"0.705248",
"0.7048611",
"0.7044334",
"0.7004042",
"0.69979227",
"0.69949514",
"0.6982268",
"0.69760436",
"0.6965255",
"0.6962943",
"0.6946886",
"0.6910817",
"0.6907048",
"0.6903603",
"0.68863845",
"0.6876245",
"0.68751436",
"0.6871307",
"0.68665344",
"0.6864997",
"0.68629336",
"0.685029",
"0.6843347",
"0.68383694",
"0.68377787",
"0.6836288",
"0.6824072",
"0.6824058",
"0.6815636",
"0.68131745",
"0.68062925",
"0.68062925",
"0.6804335",
"0.67994803",
"0.67968917",
"0.67861253",
"0.6782028",
"0.6781261",
"0.6779953",
"0.67768735",
"0.6773485",
"0.6769866",
"0.6766949",
"0.67622757",
"0.67609954",
"0.67599005",
"0.67576873",
"0.67557365",
"0.6753383",
"0.67500263",
"0.6742324",
"0.67339766",
"0.6733524",
"0.6733084",
"0.672933",
"0.67231065",
"0.6719168",
"0.6719168",
"0.67167765",
"0.67123854",
"0.6710163",
"0.6708086",
"0.670461",
"0.67039824",
"0.6701873",
"0.67006654",
"0.6696078",
"0.6694233",
"0.6690583",
"0.6689002",
"0.66876876",
"0.66876876",
"0.66876876",
"0.66876876",
"0.66876876",
"0.668658",
"0.66862774",
"0.6685146",
"0.6679639",
"0.6678561",
"0.66767323",
"0.6676067",
"0.66722727",
"0.6663422",
"0.6660648",
"0.666005",
"0.66580886",
"0.66564846",
"0.665611",
"0.665524",
"0.66526186",
"0.66498995",
"0.66384906"
] |
0.8057776
|
0
|
POST /zoneamentos POST /zoneamentos.json
|
def create
@zoneamento = Zoneamento.new(params[:zoneamento])
respond_to do |format|
if @zoneamento.save
format.html { redirect_to @zoneamento, :notice => 'Zoneamento was successfully created.' }
format.json { render :json => @zoneamento, :status => :created, :location => @zoneamento }
else
format.html { render :action => "new" }
format.json { render :json => @zoneamento.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @zona = Zona.new(params[:zona])\n\n respond_to do |format|\n if @zona.save\n format.html { redirect_to @zona, notice: 'Zona creata con successo.' }\n format.json { render json: @zona, status: :created, location: @zona }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zone = Zone.new(zone_params)\n\n if @zone.save\n render json: @zone, status: :created, location: @zone\n else\n render json: @zone.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n has = params[\"area\"].to_json\n data_has = JSON.parse(has)\n @zone = Zone.new();\n @zone.nombre_zona = params[\"nombre_zona\"]\n @zone.color = params[\"color\"]\n\n respond_to do |format|\n if @zone.save\n \n data_has.each do |geo|\n @coordenada = CoordinateZone.new()\n geo.each do |data|\n @coordenada.zone_id = @zone.id\n @coordenada.latitud = data[\"lat\"].to_f\n @coordenada.longitud = data[\"lng\"].to_f \n end\n @coordenada.save\n end\n\n format.html { redirect_to @zone, notice: 'Zone was successfully created.' }\n format.js \n # format.js { render js: \"window.location.href=#{ directories_path }\" }\n format.json { render :show, status: :created, location: @zone }\n \n else\n format.html { render :new }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def create\n @zone = Zone.new(zone_params)\n\n respond_to do |format|\n if @zone.save\n format.html { redirect_to @zone, notice: 'Área creada exitosamente' }\n format.json { render :show, status: :created, location: @zone }\n else\n format.html { render :new }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zonas = Zona.all\n @zona = Zona.create(zona_params)\n end",
"def create\n @ozone = Ozone.new(ozone_params)\n\n if @ozone.save\n render json: @ozone, status: :created, location: @ozone \n else\n render json: @ozone.errors, status: :unprocessable_entity \n end\n end",
"def zona_params\n params.require(:zona).permit(:nom, :clima, :temperatura, :humitat)\n end",
"def zona_params\n params.require(:zona).permit(:nom, :clima, :temperatura, :humitat)\n end",
"def create\n @zone = Zone.new(zone_params)\n\n respond_to do |format|\n if @zone.save\n format.html { redirect_to zones_path, notice: \"Zone was successfully created.\" }\n format.json { render :show, status: :created, location: @zone }\n else\n format.html { render :new }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zone = Zone.new(params[:zone])\n\n respond_to do |format|\n if @zone.save\n format.html { redirect_to zones_url, notice: 'Zone was successfully created.' }\n format.json { render json: @zone, status: :created, location: @zone }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ozone = Ozone.new(ozone_params)\n\n respond_to do |format|\n if @ozone.save\n format.html { redirect_to @ozone, notice: 'Ozone was successfully created.' }\n format.json { render :show, status: :created, location: @ozone }\n else\n format.html { render :new }\n format.json { render json: @ozone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zakaz = Zakaz.new(params[:zakaz])\n\n respond_to do |format|\n if @zakaz.save\n format.html { redirect_to @zakaz, notice: 'Zakaz was successfully created.' }\n format.json { render json: @zakaz, status: :created, location: @zakaz }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zakaz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zamowienia = Zamowienia.new(zamowienia_params)\n\n respond_to do |format|\n if @zamowienia.save\n format.html { redirect_to @zamowienia, notice: 'Zamowienia was successfully created.' }\n format.json { render :show, status: :created, location: @zamowienia }\n else\n format.html { render :new }\n format.json { render json: @zamowienia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zona_produccion = ZonaProduccion.new(zona_produccion_params)\n\n respond_to do |format|\n if @zona_produccion.save\n format.html { redirect_to @zona_produccion, notice: 'Zona producción creada exitosamente.' }\n format.json { render :show, status: :created, location: @zona_produccion }\n else\n format.html { render :new }\n format.json { render json: @zona_produccion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def zone_params\n params.require(:zone).permit(:nombre, :dirquejas, :usuario)\n end",
"def create\n @planejamento = Planejamento.new(planejamento_params)\n\n respond_to do |format|\n if @planejamento.save\n format.html { redirect_to @planejamento, notice: 'Planejamento was successfully created.' }\n format.json { render :show, status: :created, location: @planejamento }\n else\n format.html { render :new }\n format.json { render json: @planejamento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tangazo = Tangazo.new(tangazo_params)\n\n respond_to do |format|\n if @tangazo.save\n format.html { redirect_to @tangazo, notice: 'Tangazo was successfully created.' }\n format.json { render :show, status: :created, location: @tangazo }\n else\n format.html { render :new }\n format.json { render json: @tangazo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zonal = Zonal.new(zonal_params)\n\n respond_to do |format|\n if @zonal.save\n format.html { redirect_to @zonal, notice: 'Zonal was successfully created.' }\n format.json { render :show, status: :created, location: @zonal }\n else\n format.html { render :new }\n format.json { render json: @zonal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_zones = Admin::Zone.all\n @admin_zone = Admin::Zone.new(params[:admin_zone])\n\n respond_to do |format|\n if @admin_zone.save\n flash[:notice] = 'Zone was successfully created.'\n format.html { redirect_to admin_zones_path, notice: 'Zone was successfully created.' }\n format.json { render json: @admin_zone, status: :created, location: @admin_zone }\n else\n \n format.html { render action: \"new\" }\n format.json { render json: @admin_zone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @zoneamento = Zoneamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @zoneamento }\n end\n end",
"def create\n @departamento = Departamento.new(departamento_params)\n\n if @departamento.save\n render json: @departamento, status: :created, location: @departamento\n else\n render json: @departamento.errors, status: :unprocessable_entity\n end\n end",
"def create\n @kontoumsatz = Kontoumsatz.new(kontoumsatz_params)\n\n respond_to do |format|\n if @kontoumsatz.save\n format.html { redirect_to @kontoumsatz, notice: 'Kontoumsatz was successfully created.' }\n format.json { render :show, status: :created, location: @kontoumsatz }\n else\n format.html { render :new }\n format.json { render json: @kontoumsatz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.create(post_params)\n puts \"LLLLLOOOOOOOLLLLLL\"\n puts current_usuario.to_json\n @post = current_usuario.posts.create(post_params)\n \n @post.sangre = current_usuario.tipoDeSangre\n\n\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zaduzenja = Zaduzenja.new(zaduzenja_params)\n\n respond_to do |format|\n if @zaduzenja.save\n format.html { redirect_to @zaduzenja, notice: 'Zaduzenja was successfully created.' }\n format.json { render :show, status: :created, location: @zaduzenja }\n else\n format.html { render :new }\n format.json { render json: @zaduzenja.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def create\n @azienda = Azienda.new(azienda_params)\n\n respond_to do |format|\n if @azienda.save\n format.html { redirect_to @azienda, notice: 'Azienda was successfully created.' }\n format.json { render :show, status: :created, location: @azienda }\n else\n format.html { render :new }\n format.json { render json: @azienda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @toy_zone = ToyZone.new(params[:toy_zone])\n\n respond_to do |format|\n if @toy_zone.save\n format.html { redirect_to @toy_zone, :notice => 'Toy zone was successfully created.' }\n format.json { render :json => @toy_zone, :status => :created, :location => @toy_zone }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @toy_zone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tareas = Tarea.all\n @tareapositivas = Tarea.where(listo: true)\n @tarea = Tarea.new(tarea_params)\n\n respond_to do |format|\n if @tarea.save\n format.html { redirect_to @tarea, notice: 'Tarea was successfully created.' }\n format.json { render :show, status: :created, location: @tarea }\n else\n format.html { render :new }\n format.json { render json: @tarea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @turma = Turma.new(turma_params)\n @turma.usuario = current_usuario\n @turma.turma_ativa = true\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to turmas_path, notice: 'Turma salva com sucesso.' }\n format.json { render :show, status: :created, location: @turma }\n else\n format.html { render :new }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @erogenous_zone = ErogenousZone.new(params[:erogenous_zone])\n\n respond_to do |format|\n if @erogenous_zone.save\n format.html { redirect_to @erogenous_zone, :notice => 'Erogenous zone was successfully created.' }\n format.json { render :json => @erogenous_zone, :status => :created, :location => @erogenous_zone }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @erogenous_zone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def zone_params\n # params.require(:zone) #.permit( :zone, :nombre_zona, :color)\n end",
"def create\n @farmaceutico = Farmaceutico.new(farmaceutico_params)\n\n respond_to do |format|\n if @farmaceutico.save\n format.html { redirect_to @farmaceutico, notice: 'Farmaceutico was successfully created.' }\n format.json { render :show, status: :created, location: @farmaceutico }\n else\n format.html { render :new }\n format.json { render json: @farmaceutico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tecnico = Tecnico.new(params[:tecnico])\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, :notice => 'Tecnico was successfully created.' }\n format.json { render :json => @tecnico, :status => :created, :location => @tecnico }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tecnico.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # @reserva = Reserva.new(reserva_params)\n\n # zrespond_to do |format|\n # if @reserva.save\n # format.html { redirect_to @reserva, notice: 'Reserva was successfully created.' }\n # format.json { render :show, status: :created, location: @reserva }\n # else\n # format.html { render :new }\n # format.json { render json: @reserva.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @turma = Turma.new(params[:turma])\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to @turma, notice: 'Turma criada com sucesso.' }\n format.json { render json: @turma, status: :created, location: @turma }\n else\n format.html { render action: \"new\" }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @timezone = Timezone.new(params[:timezone])\n\n respond_to do |format|\n if @timezone.save\n format.html { redirect_to @timezone, notice: 'Timezone was successfully created.' }\n format.json { render json: @timezone, status: :created, location: @timezone }\n else\n format.html { render action: \"new\" }\n format.json { render json: @timezone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cityzone = Cityzone.new(cityzone_params)\n\n respond_to do |format|\n if @cityzone.save\n format.html { redirect_to @cityzone, notice: 'Cityzone was successfully created.' }\n format.json { render :show, status: :created, location: @cityzone }\n else\n format.html { render :new }\n format.json { render json: @cityzone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def creacion\n fiesta = Fiesta.new (params[:id])\n if Fiesta.save\n puts \"su fiesta a sido registrada\"\n else \n puts \"su fiesta no a sido registrada\"\n end\n render = json: fiesta \n end",
"def create\n @tiendas_juego = TiendasJuego.new(tiendas_juego_params)\n\n respond_to do |format|\n if @tiendas_juego.save\n format.html { redirect_to @tiendas_juego, notice: 'Tiendas juego was successfully created.' }\n format.json { render :show, status: :created, location: @tiendas_juego }\n else\n format.html { render :new }\n format.json { render json: @tiendas_juego.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @prueba_json = PruebaJson.new(prueba_json_params)\n\n respond_to do |format|\n if @prueba_json.save\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully created.' }\n format.json { render action: 'show', status: :created, location: @prueba_json }\n else\n format.html { render action: 'new' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @turma = @disciplina.turmas.new(turma_params)\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to @turma, notice: 'A Turma foi criada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @turma }\n else\n format.html { render action: 'new' }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ranchada = Ranchada.new(ranchada_params)\n @ranchada.state = State.find_by_nombre('Actualizado');\n\n respond_to do |format|\n if @ranchada.save\n AuditoriaDataAccess.log current_user, Auditoria::ALTA, Auditoria::RANCHADA, @ranchada\n format.html { redirect_to ranchadas_url, notice: 'Ranchada creada correctamente.' }\n format.json { render :show, status: :created, location: @ranchada }\n format.js { render :show, status: :created, location: @ranchada }\n else\n if @ranchada.zone\n @zonas = Zone.where(:area_id => @ranchada.zone.area.id)\n else\n @zonas = Zone.zonas_primer_area\n @ranchada.area_id = @zonas.first.area_id\n @ranchada.zone_id = @zonas.first.id\n end\n format.html { render :new }\n format.json { render json: @ranchada.errors, status: :unprocessable_entity }\n format.js { render json: @ranchada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipovestuario = Tipovestuario.new(tipovestuario_params)\n\n respond_to do |format|\n if @tipovestuario.save\n format.html { redirect_to @tipovestuario, notice: 'Tipovestuario was successfully created.' }\n format.json { render :show, status: :created, location: @tipovestuario }\n else\n format.html { render :new }\n format.json { render json: @tipovestuario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def zonal_params\n params.require(:zonal).permit(:nombre_zona, :descripcion)\n end",
"def create\n @estadia = Estadia.new(estadia_params)\n\n #Quando cria uma estadia nova, seta a data como a hora corrente\n @estadia.data_entrada = Time.now\n #ocupa a vaga\n @estadia.vaga.ocupada = true\n\n respond_to do |format|\n if @estadia.vaga.save && @estadia.save\n format.html { redirect_to @estadia, notice: 'Estadia was successfully created.' }\n format.json { render :show, status: :created, location: @estadia }\n else\n format.html { render :new }\n format.json { render json: @estadia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @servico_pacote = Servico::Pacote.new(servico_pacote_params)\n\n respond_to do |format|\n if @servico_pacote.save\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @servico_pacote }\n else\n format.html { render action: 'new' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n \n respond_to do |format|\n if @paciente.save\n format.html { redirect_to @paciente, notice: 'Paciente creado exitosamente.' }\n format.json { render :show, status: :created, location: @paciente }\n else \n format.html { render :new}\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tecnico = Tecnico.new(params[:tecnico])\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, notice: 'Tecnico criado com sucesso.' }\n format.json { render json: @tecnico, status: :created, location: @tecnico }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @postavka = Postavka.new(postavka_params)\n\n respond_to do |format|\n if @postavka.save\n format.html { redirect_to @postavka, notice: 'Postavka was successfully created.' }\n format.json { render action: 'show', status: :created, location: @postavka }\n else\n format.html { render action: 'new' }\n format.json { render json: @postavka.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @posto = Posto.new(params[:posto])\n\n respond_to do |format|\n if @posto.save\n format.html { redirect_to @posto, notice: 'Posto de Saude cadastrado com sucesso' }\n format.json { render json: @posto, status: :created, location: @posto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @posto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @armazena = Armazena.new(armazena_params)\n\n respond_to do |format|\n if @armazena.save\n format.html { redirect_to @armazena, notice: 'Armazena was successfully created.' }\n format.json { render :show, status: :created, location: @armazena }\n else\n format.html { render :new }\n format.json { render json: @armazena.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vacuna = Vacuna.new(vacuna_params)\n @vacuna.mascota_id = @mascota.id\n respond_to do |format|\n if @vacuna.save\n format.html { redirect_to @vacuna, notice: 'Vacuna Agregada exitosamente' }\n format.json { render :show, status: :created, location: @vacuna }\n else\n format.html { render :new }\n format.json { render json: @vacuna.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, :notice => 'Premio was successfully created.' }\n format.json { render :json => @premio, :status => :created, :location => @premio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @time_zone = TimeZone.new(params[:time_zone])\n\n respond_to do |format|\n if @time_zone.save\n format.html { redirect_to @time_zone, notice: 'Time zone was successfully created.' }\n format.json { render json: @time_zone, status: :created, location: @time_zone }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_zone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zbozi = Zbozi.new(zbozi_params)\n\n respond_to do |format|\n if @zbozi.save\n format.html { redirect_to @zbozi, notice: 'Zbozi was successfully created.' }\n format.json { render :show, status: :created, location: @zbozi }\n else\n format.html { render :new }\n format.json { render json: @zbozi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mapeamento = Mapeamento.new(params[:mapeamento])\n\n respond_to do |format|\n if @mapeamento.save\n format.html { redirect_to @mapeamento, notice: 'Mapeamento was successfully created.' }\n format.json { render json: @mapeamento, status: :created, location: @mapeamento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mapeamento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tarifas_servicio = TarifasServicio.new(tarifas_servicio_params)\n\n respond_to do |format|\n if @tarifas_servicio.save\n format.html { redirect_to tarifas_servicios_url, notice: 'Tarifas servicio Se creó correctamente.' }\n format.json { render :show, status: :created, location: @tarifas_servicio }\n else\n format.html { render :new }\n format.json { render json: @tarifas_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_aposta = TipoAposta.new(tipo_aposta_params)\n\n respond_to do |format|\n if @tipo_aposta.save\n format.html { redirect_to @tipo_aposta, notice: 'Tipo aposta was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_aposta }\n else\n format.html { render :new }\n format.json { render json: @tipo_aposta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @razones_sociale = current_user.razones_sociales.build(razones_sociale_params)\n\n respond_to do |format|\n if @razones_sociale.save\n format.html { redirect_to @razones_sociale, notice: 'Razones sociale was successfully created.' }\n format.json { render :show, status: :created, location: @razones_sociale }\n else\n format.html { render :new }\n format.json { render json: @razones_sociale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @etnia = Etnia.new(params[:etnia])\n\n respond_to do |format|\n if @etnia.save\n format.html { redirect_to @etnia, notice: 'Etnia was successfully created.' }\n format.json { render json: @etnia, status: :created, location: @etnia }\n else\n format.html { render action: \"new\" }\n format.json { render json: @etnia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zutaten = Zutaten.new(zutaten_params)\n\n respond_to do |format|\n if @zutaten.save\n format.html { redirect_to @zutaten, notice: 'Zutaten was successfully created.' }\n format.json { render :show, status: :created, location: @zutaten }\n else\n format.html { render :new }\n format.json { render json: @zutaten.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asignatura = Asignatura.new(asignatura_params)\n\n respond_to do |format|\n if @asignatura.save\n format.json { render json: \"Asignatura Creada\", status: :created, location: @asignatura }\n else\n format.json { render json: @asignatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @veterinario = Veterinario.new(veterinario_params)\n\n respond_to do |format|\n if @veterinario.save\n format.html { redirect_to @veterinario, notice: \"Veterinario was successfully created.\" }\n format.json { render :show, status: :created, location: @veterinario }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @veterinario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movimento_de_estoque = MovimentoDeEstoque.new(movimento_de_estoque_params)\n\n respond_to do |format|\n if @movimento_de_estoque.save\n format.html { redirect_to @movimento_de_estoque, notice: 'Movimento de estoque was successfully created.' }\n format.json { render :show, status: :created, location: @movimento_de_estoque }\n else\n format.html { render :new }\n format.json { render json: @movimento_de_estoque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zorra = Zorra.new(zorra_params)\n\n respond_to do |format|\n if @zorra.save\n format.html { redirect_to @zorra, notice: 'Zorra was successfully created.' }\n format.json { render :show, status: :created, location: @zorra }\n else\n format.html { render :new }\n format.json { render json: @zorra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @karteikarte = Karteikarte.new(params[:karteikarte])\n\n respond_to do |format|\n if @karteikarte.save\n format.html { redirect_to @karteikarte, notice: 'Karteikarte was successfully created.' }\n format.json { render json: @karteikarte, status: :created, location: @karteikarte }\n else\n format.html { render action: \"new\" }\n format.json { render json: @karteikarte.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @veterinario = Veterinario.new(veterinario_params)\n\n respond_to do |format|\n if @veterinario.save\n format.html { redirect_to @veterinario, notice: 'Veterinario was successfully created.' }\n format.json { render :show, status: :created, location: @veterinario }\n else\n format.html { render :new }\n format.json { render json: @veterinario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @razones_sociale = RazonesSociale.find(params[:razones_comerciale][:razones_sociale_id])\n @razones_comerciale = @razones_sociale.razones_comerciales.build(razones_comerciale_params)\n\n respond_to do |format|\n if @razones_comerciale.save\n format.html { redirect_to @razones_comerciale, notice: 'Razones comerciale was successfully created.' }\n format.json { render :show, status: :created, location: @razones_comerciale }\n else\n format.html { render :new }\n format.json { render json: @razones_comerciale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @kazoku = Kazoku.new(params[:kazoku])\n\n respond_to do |format|\n if @kazoku.save\n format.html { redirect_to @kazoku, :notice => 'Kazoku was successfully created.' }\n format.json { render :json => @kazoku, :status => :created, :location => @kazoku }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @kazoku.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @asiento_de_servicio = AsientoDeServicio.new(asiento_de_servicio_params)\n\n respond_to do |format|\n if @asiento_de_servicio.save\n format.html { redirect_to @asiento_de_servicio, notice: 'Asiento de servicio was successfully created.' }\n format.json { render :show, status: :created, location: @asiento_de_servicio }\n else\n format.html { render :new }\n format.json { render json: @asiento_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def criar_sobrevivente\n @suvivor = Sobrevivente.create(\n name: params[:name], genero: params[:genero], idade: params[:idade],\n lat: params[:lat], lon: params[:lon],\n agua: params[:agua], comida: params[:comida], medicamento: params[:medicamento],\n municao: params[:municao]\n )\n render json: @suvivor\n end",
"def create\n @plan_quirurgico = PlanQuirurgico.new(plan_quirurgico_params)\n @plan_quirurgico.servicios = params[:servicios]\n @plan_quirurgico.estatus = \"En Proceso\"\n puts params\n puts @plan_quirurgico.examen \n respond_to do |format|\n if @plan_quirurgico.save\n format.html { redirect_to @plan_quirurgico, notice: 'El plan quirurgico fue registrado exitosamente.' }\n format.json { render :show, status: :created, location: @plan_quirurgico }\n else\n format.html { render :new }\n format.json { render json: @plan_quirurgico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estacionamiento = Estacionamiento.new(estacionamiento_params)\n @lista_departamentos = Ubigeo.find_by_sql(\"select distinct idDepartamento, Departamento from ubigeos\")\n @lista_provincias = Ubigeo.find_by_sql(\"select distinct idProvincia, Provincia from ubigeos\")\n @lista_distritos = Ubigeo.find_by_sql(\"select distinct idDistrito, Distrito from ubigeos\")\n @serv_adicinales = ServAdicinale.all\n\n respond_to do |format|\n if @estacionamiento.save\n format.html { redirect_to @estacionamiento, notice: 'Estacionamiento was successfully created.' }\n format.json { render :show, status: :created, location: @estacionamiento }\n else\n format.html { render :new }\n format.json { render json: @estacionamiento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zutat = Zutat.new(params[:zutat])\n\n respond_to do |format|\n if @zutat.save\n format.html { redirect_to @zutat, notice: 'Zutat was successfully created.' }\n format.json { render json: @zutat, status: :created, location: @zutat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zutat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proyect = current_user.proyects.new(proyect_params)\n @proyect.zone = @zone\n respond_to do |format|\n if @proyect.save\n format.html { redirect_to [@zone,@proyect], notice: 'Proyecto Creado correctamente.' }\n format.json { render :show, status: :created, location: @proyect }\n else\n format.html { render :new }\n format.json { render json: @proyect.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zonecouverturemotif = Zonecouverturemotif.new(zonecouverturemotif_params)\n\n respond_to do |format|\n if @zonecouverturemotif.save\n format.html { redirect_to @zonecouverturemotif, notice: 'Zonecouverturemotif was successfully created.' }\n format.json { render :show, status: :created, location: @zonecouverturemotif }\n else\n format.html { render :new }\n format.json { render json: @zonecouverturemotif.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @artesano = Artesano.new(artesano_params)\n\n respond_to do |format|\n if @artesano.save\n format.html { redirect_to @artesano, notice: 'Artesano was successfully created.' }\n format.json { render :show, status: :created, location: @artesano }\n else\n format.html { render :new }\n format.json { render json: @artesano.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 create\n @asiento = Asiento.new(params[:asiento])\n\n respond_to do |format|\n if @asiento.save\n format.html { redirect_to @asiento, :notice => 'El apunte fue creado.' }\n format.json { render :json => @asiento, :status => :created, :location => @asiento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @zona = Zona.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zona }\n end\n end",
"def create\n @city = City.first\n @idcity= @city.id\n @zone = Zone.new(zone_params)\n @zone.city_id = @idcity\n if @zone.save \n render json: { status: :created }\n else\n render json: @zone.errors, status: :unprocessable_entity\n end\n end",
"def create\n @estabelecimento = Estabelecimento.new(params[:estabelecimento])\n\n respond_to do |format|\n if @estabelecimento.save\n format.html { redirect_to @estabelecimento, :notice => 'Estabelecimento was successfully created.' }\n format.json { render :json => @estabelecimento, :status => :created, :location => @estabelecimento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @estabelecimento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @pozi = Pozi.new(pozi_params)\n\n respond_to do |format|\n if @pozi.save\n format.html { redirect_to pozis_path, notice: 'Pozi was successfully created.' }\n format.json { render :show, status: :created, location: @pozi }\n else\n format.html { render :new }\n format.json { render json: @pozi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @panneau = Panneau.new(panneau_params)\n\n respond_to do |format|\n if @panneau.save\n format.html { redirect_to @panneau, notice: 'Panneau was successfully created.' }\n format.json { render :show, status: :created, location: @panneau }\n else\n format.html { render :new }\n format.json { render json: @panneau.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, notice: 'Premio was successfully created.' }\n format.json { render json: @premio, status: :created, location: @premio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movimentacao_de_estoque = MovimentacaoDeEstoque.new(params[:movimentacao_de_estoque])\n\n respond_to do |format|\n if @movimentacao_de_estoque.save\n format.html { redirect_to @movimentacao_de_estoque, notice: 'Movimentacao de estoque was successfully created.' }\n format.json { render json: @movimentacao_de_estoque, status: :created, location: @movimentacao_de_estoque }\n else\n format.html { render action: \"new\" }\n format.json { render json: @movimentacao_de_estoque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movimentode_estoque = MovimentodeEstoque.new(movimentode_estoque_params)\n\n respond_to do |format|\n if @movimentode_estoque.save\n format.html { redirect_to @movimentode_estoque, notice: 'Movimentode estoque was successfully created.' }\n format.json { render :show, status: :created, location: @movimentode_estoque }\n else\n format.html { render :new }\n format.json { render json: @movimentode_estoque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estatuto = Estatuto.new(params[:estatuto])\n\n respond_to do |format|\n if @estatuto.save\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully created.' }\n format.json { render json: @estatuto, status: :created, location: @estatuto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zanyatium = Zanyatium.new(zanyatium_params)\n\n respond_to do |format|\n if @zanyatium.save\n format.html { redirect_to zanyatia_path, notice: 'Запись успешно добавлена.' }\n format.json { render :show, status: :created, location: zanyatia_path }\n else\n format.html { render :new }\n format.json { render json: @zanyatium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asignatura = Asignatura.new(params[:asignatura])\n\n respond_to do |format|\n if @asignatura.save\n format.html { redirect_to @asignatura, notice: 'Asignatura was successfully created.' }\n format.json { render json: @asignatura, status: :created, location: @asignatura }\n else\n format.html { render action: \"new\" }\n format.json { render json: @asignatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estabelecimento = Estabelecimento.new(estabelecimento_params)\n @usuario = Usuario.find(usuario_params[:id])\n @estabelecimento_usuario = EstabelecimentosUsuario.create(estabelecimento: @estabelecimento, usuario: @usuario, ic_criador: true)\n\n respond_to do |format|\n if @estabelecimento.save\n format.html { redirect_to @estabelecimento, notice: 'Estabelecimento was successfully created.' }\n format.json { render json: @estabelecimento }\n else\n format.html { render :new }\n format.json { render json: @estabelecimento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @espacio_deportivo = EspacioDeportivo.new(params[:espacio_deportivo])\n\n respond_to do |format|\n if @espacio_deportivo.save\n format.html { redirect_to root_url, :notice => \"Se hizo correctamente la creacion del espacio deportivo\" }\n format.json { render json: @espacio_deportivo, status: :created, location: @espacio_deportivo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @espacio_deportivo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @tapioca = Tapioca.new(tapioca_params)\n\n respond_to do |format|\n if @tapioca.save\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tapioca }\n else\n format.html { render action: 'new' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @viaje = Viaje.new(viaje_params)\n\n respond_to do |format|\n if @viaje.save\n format.html { redirect_to @viaje, notice: 'Viaje was successfully created.' }\n format.json { render :show, status: :created, location: @viaje }\n else\n format.html { render :new }\n format.json { render json: @viaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end",
"def create\n @zabydovnuk = Zabydovnuk.new(zabydovnuk_params)\n\n respond_to do |format|\n if @zabydovnuk.save\n format.html { redirect_to @zabydovnuk, notice: 'Zabydovnuk was successfully created.' }\n format.json { render :show, status: :created, location: @zabydovnuk }\n else\n format.html { render :new }\n format.json { render json: @zabydovnuk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_de_servicio = TipoDeServicio.new(tipo_de_servicio_params)\n\n respond_to do |format|\n if @tipo_de_servicio.save\n format.html { redirect_to @tipo_de_servicio, notice: 'Tipo de servicio was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_de_servicio }\n else\n format.html { render :new }\n format.json { render json: @tipo_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6964226",
"0.6833536",
"0.682575",
"0.6816956",
"0.6778134",
"0.6775695",
"0.6562692",
"0.6562692",
"0.65248847",
"0.6518081",
"0.6441273",
"0.6433194",
"0.6298556",
"0.62896526",
"0.6277612",
"0.6274929",
"0.6269913",
"0.62663525",
"0.62549305",
"0.62502044",
"0.62232614",
"0.6199619",
"0.615758",
"0.6149519",
"0.61372614",
"0.6125993",
"0.608111",
"0.6077178",
"0.60705954",
"0.60545516",
"0.60542554",
"0.6051682",
"0.60487896",
"0.60410863",
"0.60270643",
"0.60159206",
"0.60066336",
"0.5990388",
"0.5979926",
"0.5959708",
"0.59507185",
"0.5945316",
"0.5940606",
"0.59315646",
"0.59233785",
"0.59210867",
"0.5920455",
"0.5908768",
"0.590796",
"0.590182",
"0.58972234",
"0.58965147",
"0.58939314",
"0.588285",
"0.58720165",
"0.586995",
"0.5865337",
"0.586375",
"0.58628005",
"0.5853576",
"0.5852902",
"0.5847545",
"0.5841875",
"0.58372575",
"0.58362734",
"0.5833933",
"0.5832974",
"0.58283436",
"0.5814465",
"0.58115375",
"0.5809671",
"0.58083767",
"0.5807665",
"0.58064675",
"0.58057386",
"0.5803102",
"0.5802064",
"0.58006895",
"0.5798552",
"0.57977927",
"0.5795492",
"0.57939005",
"0.57921964",
"0.57912815",
"0.5790801",
"0.5790785",
"0.5785164",
"0.57784176",
"0.5776266",
"0.576863",
"0.5761813",
"0.5761671",
"0.5759814",
"0.57592565",
"0.57584715",
"0.5755344",
"0.57516015",
"0.5743387",
"0.5741768",
"0.57405555"
] |
0.74957556
|
0
|
PUT /zoneamentos/1 PUT /zoneamentos/1.json
|
def update
@zoneamento = Zoneamento.find(params[:id])
respond_to do |format|
if @zoneamento.update_attributes(params[:zoneamento])
format.html { redirect_to @zoneamento, :notice => 'Zoneamento was successfully updated.' }
format.json { head :no_content }
else
format.html { render :action => "edit" }
format.json { render :json => @zoneamento.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @zona = Zona.find(params[:id])\n\n respond_to do |format|\n if @zona.update_attributes(params[:zona])\n format.html { redirect_to @zona, notice: 'Zona aggiornata con successo.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @zona.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 @zonas = Zona.all\n @zona.update_attributes(zona_params)\n end",
"def update\n respond_to do |format|\n if @zone.update(zone_params)\n format.html { redirect_to @zone, notice: 'Área actualizada exitosamente' }\n format.json { render :show, status: :ok, location: @zone }\n else\n format.html { render :edit }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @zone = Zone.find(params[:id])\n\n if @zone.update(zone_params)\n head :no_content\n else\n render json: @zone.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @ozone.update(ozone_params)\n \n render json @ozone\n else\n \n render json: @ozone.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @zone.update(zone_params)\n format.html { redirect_to @zone, notice: \"Zone was successfully updated.\" }\n format.json { render :show, status: :ok, location: @zone }\n else\n format.html { render :edit }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @zone = Zone.find(params[:id])\n\n respond_to do |format|\n if @zone.update_attributes(params[:zone])\n format.html { redirect_to @zone, notice: 'Zone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n # @zone = Zone.find(params[:id])\n # @zone.nombre_zona = params[\"nombre_zona\"]\n @coordenada = CoordinateZone.where('zone_id = ?', @zone.id)\n @coordenada.each do |cz|\n cz.destroy\n end\n\n respond_to do |format|\n if @zone.update #(zone_params)\n format.html { redirect_to @zone, notice: 'Zone was successfully updated.' }\n format.js \n format.json { render :show, status: :ok, location: @zone }\n else\n format.html { render :edit }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n t = Time.now\n @zone.fechacam = t.strftime(\"%d/%m/%Y %H:%M:%S\")\n if @zone.update(zone_params)\n render json: { :message => \"Success!\" }\n else\n render json: @zone.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @ozone.update(ozone_params)\n format.html { redirect_to @ozone, notice: 'Ozone was successfully updated.' }\n format.json { render :show, status: :ok, location: @ozone }\n else\n format.html { render :edit }\n format.json { render json: @ozone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @zone = Zone.find(params[:id])\n\n respond_to do |format|\n if @zone.update_attributes(params[:zone])\n format.html { redirect_to zones_url, notice: 'Zone was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @erogenous_zone = ErogenousZone.find(params[:id])\n\n respond_to do |format|\n if @erogenous_zone.update_attributes(params[:erogenous_zone])\n format.html { redirect_to @erogenous_zone, :notice => 'Erogenous zone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @erogenous_zone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ozone = Ozone.new(ozone_params)\n\n if @ozone.save\n render json: @ozone, status: :created, location: @ozone \n else\n render json: @ozone.errors, status: :unprocessable_entity \n end\n end",
"def create\n @zoneamento = Zoneamento.new(params[:zoneamento])\n\n respond_to do |format|\n if @zoneamento.save\n format.html { redirect_to @zoneamento, :notice => 'Zoneamento was successfully created.' }\n format.json { render :json => @zoneamento, :status => :created, :location => @zoneamento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @zoneamento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_zones = Admin::Zone.all\n @admin_zone = Admin::Zone.find(params[:id])\n\n respond_to do |format|\n if @admin_zone.update_attributes(params[:admin_zone])\n flash[:notice] = 'Zone was successfully updated.'\n format.html { redirect_to admin_zones_path, notice: 'Zone was successfully updated.' }\n format.json { head :no_content }\n else\n \n format.html { render action: \"edit\" }\n format.json { render json: @admin_zone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_zona\n @zona = Zona.find(params[:id])\n end",
"def set_zona\n @zona = Zona.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @zonal.update(zonal_params)\n format.html { redirect_to @zonal, notice: 'Zonal was successfully updated.' }\n format.json { render :show, status: :ok, location: @zonal }\n else\n format.html { render :edit }\n format.json { render json: @zonal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @toy_zone = ToyZone.find(params[:id])\n\n respond_to do |format|\n if @toy_zone.update_attributes(params[:toy_zone])\n format.html { redirect_to @toy_zone, :notice => 'Toy zone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @toy_zone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @zona_produccion.update(zona_produccion_params)\n format.html { redirect_to @zona_produccion, notice: 'Zona producción actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @zona_produccion }\n else\n format.html { render :edit }\n format.json { render json: @zona_produccion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_situacao\n logger.debug \"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ\"\n\n id_busca = params[:id]\n @os_id = params[:os_id]\n @os_tarefa = OsTarefa.find(id_busca)\n @os_tarefa.situacao=params[:situacao]\n @ordem_servico = OrdemServico.find(@os_id)\n logger.debug \"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ\"\n\n if @os_tarefa.situacao=='REJEITADA'\n @os_tarefa.ordem_servico_pagamento= nil\n @os_tarefa.situacao=OsTarefa.situacoes[2]\n else\n @os_tarefa.ordem_servico_pagamento= @ordem_servico\n @os_tarefa.situacao=OsTarefa.situacoes[0]\n end\n @os_tarefa.save\n respond_to do |format|\n\n format.json { head :no_content }\n format.js { render :layout => false }\n\n end\n end",
"def destroy\n @zoneamento = Zoneamento.find(params[:id])\n @zoneamento.destroy\n\n respond_to do |format|\n format.html { redirect_to zoneamentos_url }\n format.json { head :no_content }\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 respond_to do |format|\n set_funcionario\n if @ordem_servico.update(ordem_servico_params)\n format.html { redirect_to @ordem_servico, notice: t('messages.cadastro_atualizado') }\n format.json { render :show, status: :ok, location: @ordem_servico }\n else\n format.html { render :edit }\n format.json { render json: @ordem_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitacoes_avaliacoes_servico.update(solicitacoes_avaliacoes_servico_params)\n format.html { redirect_to @solicitacoes_avaliacoes_servico, notice: 'Solicitacoes avaliacoes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitacoes_avaliacoes_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @aviso.update(aviso_params)\n format.html { redirect_to avisos_path, notice: 'Aviso was successfully updated.' }\n format.json { render :show, status: :ok, location: @aviso }\n else\n format.html { render :edit }\n format.json { render json: @aviso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @azienda.update(azienda_params)\n format.html { redirect_to @azienda, notice: 'Azienda was successfully updated.' }\n format.json { render :show, status: :ok, location: @azienda }\n else\n format.html { render :edit }\n format.json { render json: @azienda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cityzone.update(cityzone_params)\n format.html { redirect_to @cityzone, notice: 'Cityzone was successfully updated.' }\n format.json { render :show, status: :ok, location: @cityzone }\n else\n format.html { render :edit }\n format.json { render json: @cityzone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipovestuario.update(tipovestuario_params)\n format.html { redirect_to @tipovestuario, notice: 'Tipovestuario was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipovestuario }\n else\n format.html { render :edit }\n format.json { render json: @tipovestuario.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 destroy\n @zona = Zona.find(params[:id])\n @zona.destroy\n\n respond_to do |format|\n format.html { redirect_to zone_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @tb_servicio.update(tb_servicio_params)\n format.html { redirect_to @tb_servicio, notice: 'Tb servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tb_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tb_servicio.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 @razones_sociale.update(razones_sociale_params)\n format.html { redirect_to @razones_sociale, notice: 'Razones sociale was successfully updated.' }\n format.json { render :show, status: :ok, location: @razones_sociale }\n else\n format.html { render :edit }\n format.json { render json: @razones_sociale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_de_servicio.update(tipo_de_servicio_params)\n format.html { redirect_to @tipo_de_servicio, notice: 'Tipo de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zona = Zona.new(params[:zona])\n\n respond_to do |format|\n if @zona.save\n format.html { redirect_to @zona, notice: 'Zona creata con successo.' }\n format.json { render json: @zona, status: :created, location: @zona }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico.update(servico_params)\n format.html { redirect_to servicos_url, notice: 'Serviço atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @servico }\n else\n format.html { render :edit }\n format.json { render json: @servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tareas = Tarea.all\n @tareapositivas = Tarea.where(listo: true)\n respond_to do |format|\n if @tarea.update(tarea_params)\n format.html { redirect_to root_path, notice: 'Tarea was successfully updated.' }\n format.json { render :show, status: :ok, location: @tarea }\n else\n format.html { render :edit }\n format.json { render json: @tarea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n\n respond_to do |format|\n if @aviso.update_attributes(params[:aviso])\n format.html { redirect_to @aviso, notice: 'Aviso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aviso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @farmaceutico.update(farmaceutico_params)\n format.html { redirect_to @farmaceutico, notice: 'Farmaceutico was successfully updated.' }\n format.json { render :show, status: :ok, location: @farmaceutico }\n else\n format.html { render :edit }\n format.json { render json: @farmaceutico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n puts \"HACE ALGOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO\"\n if !params[:reserva][:tipo_reserva].blank?\n @tipo_reserva = TipoReserva.find(params[:reserva][:tipo_reserva])\n @reserva.tipo_reserva = @tipo_reserva\n end\n\n if !params[:reserva][:habitacion].blank?\n @habitacion = Habitacion.find(params[:reserva][:habitacion])\n @reserva.habitacion = @habitacion\n end\n\n if !params[:reserva][:cliente].blank?\n @cliente = Cliente.find(params[:reserva][:cliente])\n @reserva.cliente = @cliente\n end\n if !params[:reserva][:confirmada].blank?\n @reserva.confirmada = params[:reserva][:confirmada]\n end\n if @reserva.update(reserva_params)\n format.html { redirect_to reservas_url, notice: 'Reserva modificada con exito.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reserva.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_cosa }\n else\n format.html { render :edit }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zone = Zone.new(zone_params)\n\n if @zone.save\n render json: @zone, status: :created, location: @zone\n else\n render json: @zone.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @situacao_reserva.update(situacao_reserva_params)\n format.html { redirect_to action: \"new\", notice: 'Situação reserva atualizado com sucesso..' }\n format.json { render :show, status: :ok, location: @situacao_reserva }\n else\n format.html { render :edit }\n format.json { render json: @situacao_reserva.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @coordenador_estagio = CoordenadorEstagio.find(params[:id])\n\n respond_to do |format|\n if @coordenador_estagio.update_attributes(params[:coordenador_estagio])\n format.html { redirect_success(\"Coordenador alterado com sucesso!\",:coordenador_estagio, :index)}\n format.json { head :no_content }\n else\n format.html { redirect_error(\"Erro ao alterar coordenador!\",:coordenador_estagio, :index)}\n format.json { render json: @coordenador_estagio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tienda_cliente.update(tienda_cliente_params)\n format.html { redirect_to @tienda_cliente, notice: 'La tienda se actualizó exitosamente.' }\n format.json { render :show, status: :ok, location: @tienda_cliente }\n else\n format.html { render :edit }\n format.json { render json: @tienda_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ozone = Ozone.new(ozone_params)\n\n respond_to do |format|\n if @ozone.save\n format.html { redirect_to @ozone, notice: 'Ozone was successfully created.' }\n format.json { render :show, status: :created, location: @ozone }\n else\n format.html { render :new }\n format.json { render json: @ozone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @asiento_de_servicio.update(asiento_de_servicio_params)\n format.html { redirect_to @asiento_de_servicio, notice: 'Asiento de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @asiento_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @asiento_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zone = Zone.new(zone_params)\n\n respond_to do |format|\n if @zone.save\n format.html { redirect_to @zone, notice: 'Área creada exitosamente' }\n format.json { render :show, status: :created, location: @zone }\n else\n format.html { render :new }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tarea.update(tarea_params)\n format.html { redirect_to @tarea, notice: 'La Tarea ha sido modificada correctamente.' }\n format.json { render :show, status: :ok, location: @tarea }\n else\n format.html { render :edit }\n format.json { render json: @tarea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n if @os_tarefa.update(os_tarefa_params)\n #se as situacao da tarefa nao for aceita, altera a ordem_servico_pagamento para null\n if(@os_tarefa.situacao!=OsTarefa.situacoes[0] && @os_tarefa.situacao!=OsTarefa.situacoes[1])\n\n @os_tarefa.ordem_servico_pagamento=nil\n @os_tarefa.save\n end\n\n if @os_tarefa.ordem_servico.id!=nil\n format.html { redirect_to \"/ordem_servicos/\"+@os_tarefa.ordem_servico.id.to_s, notice: 'A Tarefa foi atualizado(a)' }\n format.json { head :no_content }\n else\n format.html { redirect_to @os_tarefa, notice: 'A Tarefa foi atualizado(a)' }\n format.json { render :show, status: :ok, location: @os_tarefa }\n end\n else\n format.html { render :edit }\n format.json { render json: @os_tarefa.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 @time_zone = TimeZone.find(params[:id])\n\n respond_to do |format|\n if @time_zone.update_attributes(params[:time_zone])\n format.html { redirect_to @time_zone, notice: 'Time zone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_zone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @taco.update(taco_params)\n format.html { redirect_to @taco, notice: 'Taco was successfully updated.' }\n format.json { render :show, status: :ok, location: @taco }\n else\n format.html { render :edit }\n format.json { render json: @taco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @planejamento.update(planejamento_params)\n format.html { redirect_to @planejamento, notice: 'Planejamento was successfully updated.' }\n format.json { render :show, status: :ok, location: @planejamento }\n else\n format.html { render :edit }\n format.json { render json: @planejamento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @aviso.update(aviso_params)\n format.html { redirect_to @aviso, notice: 'Aviso was successfully updated.' }\n format.json { render :show, status: :ok, location: @aviso }\n else\n format.html { render :edit }\n format.json { render json: @aviso.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 @trabajo.update(trabajo_params)\n format.html { redirect_to cliente_path(@cliente), notice: 'Trabajo was successfully updated.' }\n format.json { render :show, status: :ok, location: cliente_trabajo_path(@cliente, @trabajo) }\n else\n format.html { render :edit }\n format.json { render json: @trabajo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @solicitacoes_avaliacoes_servico.update(ativo: false)\n respond_to do |format|\n format.html { redirect_to solicitacoes_avaliacoes_servicos_url }\n format.json { head :no_content }\n end\n end",
"def set_ozone\n @ozone = Ozone.find(params[:id])\n end",
"def set_ozone\n @ozone = Ozone.find(params[:id])\n end",
"def create\n @city = City.first\n @idcity= @city.id\n @zone = Zone.new(zone_params)\n @zone.city_id = @idcity\n if @zone.save \n render json: { status: :created }\n else\n render json: @zone.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @vacina.update(vacina_params)\n format.html { redirect_to @vacina, notice: 'Vacina editada com sucesso.' }\n format.json { render :show, status: :ok, location: @vacina }\n else\n format.html { render :edit }\n format.json { render json: @vacina.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @zone = Zone.find(params[:id])\n\n respond_to do |format|\n if @zone.update_attributes(params[:zone])\n flash[:notice] = 'Zone was successfully updated.'\n format.html { redirect_to(context_url) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def create_method\n :put_json\n end",
"def update\n authorize! :update, Cargo\n respond_to do |format|\n # if !@cargo.sueldos.where(created_at: Time.now.beginning_of_month..Time.now.end_of_month).empty?\n nuevo = false\n if $quincena == 0\n nuevo = @cargo.sueldos.where(created_at: Time.now.beginning_of_month..(Time.now.beginning_of_month + 14.days)).empty?\n else\n nuevo = @cargo.sueldos.where(created_at: (Time.now.beginning_of_month + 15.days)..Time.now.end_of_month).empty?\n end\n key, value = params[:cargo][:sueldos_attributes].first\n\n if nuevo\n\n viejo = @cargo.sueldos.where(activo: true).last\n\n @cargo.sueldos.update_all(activo: false)\n crear = @cargo.sueldos.new\n crear.monto = params[:cargo][:sueldos_attributes][key][:monto]\n crear.sueldo_integral = params[:cargo][:sueldos_attributes][key][:sueldo_integral]\n\n params[:cargo][:sueldos_attributes][key][:monto] = viejo.monto\n params[:cargo][:sueldos_attributes][key][:sueldo_integral] = viejo.sueldo_integral\n\n end\n if @cargo.update(cargo_params)\n log(\"Se ha actualizado el cargo: #{@lt}\", 1)\n\n format.html { redirect_to @cargo, notice: 'Los datos del cargo fueron actualizados exitosamente.' }\n format.json { render :show, status: :ok, location: @cargo }\n else\n format.html { render :edit }\n format.json { render json: @cargo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @zone_status = ZoneStatus.find(params[:id])\n\n respond_to do |format|\n if @zone_status.update_attributes(params[:zone_status])\n format.html { redirect_to @zone_status, notice: 'Zone status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @zone_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @proyect.update(proyect_params)\n format.html { redirect_to [@zone,@proyect], notice: 'El proyecto fue actualizado exitosamente' }\n format.json { render :show, status: :ok, location: @proyect }\n else\n format.html { render :edit }\n format.json { render json: @proyect.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tiendas_juego.update(tiendas_juego_params)\n format.html { redirect_to @tiendas_juego, notice: 'Tiendas juego was successfully updated.' }\n format.json { render :show, status: :ok, location: @tiendas_juego }\n else\n format.html { render :edit }\n format.json { render json: @tiendas_juego.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @empresa_servicio = EmpresaServicio.find(params[:id])\n respond_to do |format|\n if @empresa_servicio.update_attributes(params[:empresa_servicio])\n\n format.html { redirect_to empresa_empresa_servicios_path, notice: \"Los datos del servicio fueron actualizados para la empresa #{@empresa_servicio.empresa.nombre_empresa}\"}\n \n else\n format.html { render action: \"edit\" }\n format.json { render json: @empresa_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @aviso.atualizadoPor = \"Gustavo Soares\" #adicionar gem devise\n @aviso.dataDeAtualizacao = Time.now\n\n respond_to do |format|\n if @aviso.update(aviso_params)\n format.html { redirect_to @aviso, notice: 'Aviso was successfully updated.' }\n format.json { render :show, status: :ok, location: @aviso }\n else\n format.html { render :edit }\n format.json { render json: @aviso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n if @ativo_outro.update_attributes(params[:ativo_outro])\n format.html { redirect_to @ativo_outro, notice: 'Ativo foi salvo com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ativo_outro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @zakaz = Zakaz.find(params[:id])\n\n respond_to do |format|\n if @zakaz.update_attributes(params[:zakaz])\n format.html { redirect_to @zakaz, notice: 'Zakaz was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @zakaz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if not params[:pk].blank?\n params[:cinema][:name] = params[:value]\n end\n respond_to do |format|\n if @cinema.update(cinema_params)\n format.js\n format.json { head :no_content }\n else\n format.js\n format.json { render json: @cinema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n if @solicitud_servicio.update_attributes(params[:solicitud_servicio])\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @timezone = Timezone.find(params[:id])\n\n respond_to do |format|\n if @timezone.update_attributes(params[:timezone])\n format.html { redirect_to @timezone, notice: 'Timezone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timezone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @anuncio.update(anuncio_params)\n format.html { redirect_to @anuncio.street, notice: 'Anuncio was successfully updated.' }\n format.json { render :show, status: :ok, location: @anuncio }\n else\n format.html { render :edit }\n format.json { render json: @anuncio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servidor.update(servidor_params)\n format.html { redirect_to servidores_path, success: 'Servidor atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @servidor }\n else\n format.html { render :edit }\n format.json { render json: @servidor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movimentode_estoque.update(movimentode_estoque_params)\n format.html { redirect_to @movimentode_estoque, notice: 'Movimentode estoque was successfully updated.' }\n format.json { render :show, status: :ok, location: @movimentode_estoque }\n else\n format.html { render :edit }\n format.json { render json: @movimentode_estoque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @venta.update(venta_params)\n format.html { redirect_to @venta, notice: 'Venta was successfully updated.' }\n format.json { render :show, status: :ok, location: @venta }\n else\n format.html { render :edit }\n format.json { render json: @venta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_zone\n @zone = Zone.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @zamowienia.update(zamowienia_params)\n format.html { redirect_to @zamowienia, notice: 'Zamowienia was successfully updated.' }\n format.json { render :show, status: :ok, location: @zamowienia }\n else\n format.html { render :edit }\n format.json { render json: @zamowienia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @route = Route.find(params[:id])\n if user_signed_in?\n routeInfo = JSON.parse(params[:route_map_points].gsub(\"jb\",\"latitude\").gsub(\"kb\",\"longitude\"))\n \n \n @route.route_points = routeInfo['overview_path']\n @route.starting_point = routeInfo['overview_path'].first\n @route.end_point = routeInfo['overview_path'].last\n\n\n respond_to do |format|\n if @route.save(params[:route])\n if @route.schedule.update_attributes(\n departure: params[:route_schedule_departure], \n arrival: params[:route_schedule_arrival]) \n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end\nend\n # DELETE /routes/1\n # DELETE /routes/1.json\n def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end\nend",
"def update\r\n respond_to do |format|\r\n if @sivic_turma.update(sivic_turma_params)\r\n format.html { redirect_to @sivic_turma, 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_turma.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @tarifas_servicio.update(tarifas_servicio_params)\n format.html { redirect_to tarifas_servicios_url, notice: 'Tarifas servicio Se ha actualizado correctamente..' }\n format.json { render :show, status: :ok, location: @tarifas_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tarifas_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @relatorio_plano_de_voo.update(relatorio_plano_de_voo_params)\n format.html { redirect_to @relatorio_plano_de_voo, notice: 'Relatorio plano de voo was successfully updated.' }\n format.json { render :show, status: :ok, location: @relatorio_plano_de_voo }\n else\n format.html { render :edit }\n format.json { render json: @relatorio_plano_de_voo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @achadoperdido.data_entrega = @achadoperdido.morador_id != nil ? Time.zone.now : nil\n respond_to do |format|\n if @achadoperdido.update(achadoperdido_params)\n format.html { redirect_to @achadoperdido, notice: 'Alteração realizada com sucesso.' }\n format.json { render :show, status: :ok, location: @achadoperdido }\n else\n format.html { render :edit }\n format.json { render json: @achadoperdido.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 respond_to do |format|\n if @movimento_de_estoque.update(movimento_de_estoque_params)\n format.html { redirect_to @movimento_de_estoque, notice: 'Movimento de estoque was successfully updated.' }\n format.json { render :show, status: :ok, location: @movimento_de_estoque }\n else\n format.html { render :edit }\n format.json { render json: @movimento_de_estoque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n obtener_datos()\n @status = params[:statusproyect]\n @cliente = params[:cliente] + \" \" +params[:cliente_apellido]\n respond_to do |format|\n if @ventum.update(cliente: @cliente, clave:@clave, fecha:@fecha, iva:@iva,subtotal:@preciofinal ,total:@totalcosto, descuentogeneral: @descglobal , distribuidor: @distribuidor, status: @status)\n @detail.each do |x|\n x.destroy\n end\n salvar()\n format.html { redirect_to @ventum, notice: 'Venta actualizada correctamente.' }\n format.json { render :show, status: :ok, location: @ventum }\n else\n format.html { render :edit }\n format.json { render json: @ventum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @realiza = Realiza.find(params[:id])\n @pagamento=Pagamento.new(:servico_id=>@realiza.servico_id,:cliente_id=>@realiza.cliente_id,:valor=>@realiza.servico.preco,\n :formapagamentoe_id=>params[:pagamento])\n respond_to do |format|\n if @realiza.update_attributes(params[:realiza]) and @pagamento.save\n format.html { redirect_to @realiza, notice: 'Realiza was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @realiza.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vacina.update(vacina_params)\n format.html { redirect_to @vacina, notice: \"Vacina was successfully updated.\" }\n format.json { render :show, status: :ok, location: @vacina }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @vacina.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @os_entregavel.update(os_entregavel_params)\n if @os_entregavel.ordem_servico.id!=nil\n format.html { redirect_to \"/ordem_servicos/\"+@os_entregavel.ordem_servico.id.to_s, notice: 'Os entregavel foi atualizado(a)' }\n format.json { head :no_content }\n else\n format.html { redirect_to @os_entregavel, notice: 'Os entregavel foi atualizado(a)' }\n format.json { render :show, status: :ok, location: @os_entregavel }\n end\n else\n format.html { render :edit }\n format.json { render json: @os_entregavel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_aposta.update(tipo_aposta_params)\n format.html { redirect_to @tipo_aposta, notice: 'Tipo aposta was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_aposta }\n else\n format.html { render :edit }\n format.json { render json: @tipo_aposta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n has = params[\"area\"].to_json\n data_has = JSON.parse(has)\n @zone = Zone.new();\n @zone.nombre_zona = params[\"nombre_zona\"]\n @zone.color = params[\"color\"]\n\n respond_to do |format|\n if @zone.save\n \n data_has.each do |geo|\n @coordenada = CoordinateZone.new()\n geo.each do |data|\n @coordenada.zone_id = @zone.id\n @coordenada.latitud = data[\"lat\"].to_f\n @coordenada.longitud = data[\"lng\"].to_f \n end\n @coordenada.save\n end\n\n format.html { redirect_to @zone, notice: 'Zone was successfully created.' }\n format.js \n # format.js { render js: \"window.location.href=#{ directories_path }\" }\n format.json { render :show, status: :created, location: @zone }\n \n else\n format.html { render :new }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n\n end\n end"
] |
[
"0.6687032",
"0.6471863",
"0.6412868",
"0.63772184",
"0.6300222",
"0.623089",
"0.6163724",
"0.61377126",
"0.61177385",
"0.6109353",
"0.61014104",
"0.6077665",
"0.60147405",
"0.5972893",
"0.5904185",
"0.58748996",
"0.5862537",
"0.5862537",
"0.5858848",
"0.5838853",
"0.5830405",
"0.5788473",
"0.57809347",
"0.5779925",
"0.5776198",
"0.57668185",
"0.57601",
"0.57351005",
"0.57311255",
"0.5728176",
"0.5710319",
"0.57042116",
"0.5695568",
"0.5689632",
"0.5683011",
"0.5681613",
"0.5678441",
"0.56722116",
"0.56666183",
"0.56639856",
"0.56638974",
"0.5659251",
"0.565772",
"0.56576246",
"0.5651756",
"0.56478316",
"0.5647259",
"0.5645681",
"0.5639559",
"0.56388336",
"0.5629568",
"0.56231195",
"0.5621603",
"0.5616933",
"0.5610358",
"0.5609481",
"0.5603842",
"0.56037587",
"0.560137",
"0.55998987",
"0.55986834",
"0.55981845",
"0.5597093",
"0.5597093",
"0.5596196",
"0.5594717",
"0.5579888",
"0.55798304",
"0.55786586",
"0.5573962",
"0.5573543",
"0.55698085",
"0.55637527",
"0.5560718",
"0.5554361",
"0.55542785",
"0.55532753",
"0.55514",
"0.554098",
"0.55351233",
"0.5531675",
"0.55315524",
"0.55281603",
"0.5521105",
"0.5518457",
"0.55182964",
"0.55138606",
"0.55137336",
"0.55110204",
"0.55092204",
"0.55081373",
"0.55077195",
"0.55056596",
"0.5502531",
"0.55010855",
"0.5497973",
"0.5497973",
"0.5495128",
"0.5493886",
"0.54893756"
] |
0.67096937
|
0
|
DELETE /zoneamentos/1 DELETE /zoneamentos/1.json
|
def destroy
@zoneamento = Zoneamento.find(params[:id])
@zoneamento.destroy
respond_to do |format|
format.html { redirect_to zoneamentos_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @zona = Zona.find(params[:id])\n @zona.destroy\n\n respond_to do |format|\n format.html { redirect_to zone_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def 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 @tangazo.destroy\n respond_to do |format|\n format.html { redirect_to tangazos_url, notice: 'Tangazo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @zone.destroy()\n render json: { :message => \"Success!\" }\n else\n render json: { :message => \"La zona no pudo ser eliminada\" }\n end\n end",
"def destroy\n @asociado = Asociado.find(params[:id])\n @asociado.destroy\n\n respond_to do |format|\n format.html { redirect_to asociados_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @estado_remate.destroy\n respond_to do |format|\n format.html { redirect_to estado_remates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servico_pacote.destroy\n respond_to do |format|\n format.html { redirect_to servico_pacotes_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 @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 @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 @zone.destroy\n respond_to do |format|\n format.html { redirect_to action: \"index\" }\n format.json { head :no_content }\n #testing\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todoroute.destroy\n respond_to do |format|\n format.html { redirect_to todoroutes_url, notice: 'Todoroute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cargo_eleicao = CargoEleicao.find(params[:id])\n @cargo_eleicao.destroy\n\n respond_to do |format|\n format.html { redirect_to cargo_eleicaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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 delete\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to avisos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @zamowienia.destroy\n respond_to do |format|\n format.html { redirect_to zamowienias_url, notice: 'Zamowienia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trabajo.destroy\n respond_to do |format|\n format.html { redirect_to cliente_url(@cliente), notice: 'Trabajo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realiza = Realiza.find(params[:id])\n @realiza.destroy\n\n respond_to do |format|\n format.html { redirect_to realizas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ocorrencia.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tapioca.destroy\n respond_to do |format|\n format.html { redirect_to tapiocas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_plan.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end",
"def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to referencia_bases_url, notice: \"Referencia base was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unidad.destroy\n respond_to do |format|\n format.html { redirect_to unidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ordem_servico.destroy\n respond_to do |format|\n format.html { redirect_to ordem_servicos_url, notice: t('messages.cadastro_removido') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @zone = Zone.find(params[:id])\n @zone.destroy\n\n respond_to do |format|\n format.html { redirect_to zones_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tipovestuario.destroy\n respond_to do |format|\n format.html { redirect_to tipovestuarios_url, notice: 'Tipovestuario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @azienda.destroy\n respond_to do |format|\n format.html { redirect_to aziendas_url, notice: 'Azienda was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @areco = Areco.find(params[:id])\n @areco.destroy\n\n respond_to do |format|\n format.html { redirect_to arecos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farmacium.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\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 @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @zaduzenja.destroy\n respond_to do |format|\n format.html { redirect_to zaduzenjas_url, notice: 'Zaduzenja was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_estudiante.destroy\n respond_to do |format|\n format.html { redirect_to datos_estudiantes_url, notice: 'Datos estudiante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orcamento.destroy\n respond_to do |format|\n format.html { redirect_to orcamentos_url, notice: 'Orçamento apagado com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @especialidad.destroy\n respond_to do |format|\n format.html { redirect_to especialidads_url, notice: 'Servicio eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to tipo_referencia_bases_url, notice: \"Tipo referencia base was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visitante.destroy\n respond_to do |format|\n format.html { redirect_to visitantes_url, notice: 'Visitante 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 @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 @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @obra.destroy\n respond_to do |format|\n format.html { redirect_to obras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contatos_cliente.destroy\n respond_to do |format|\n format.html { redirect_to contatos_clientes_url, notice: 'Contatos cliente was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fulcliente = Fulcliente.find(params[:id])\n @fulcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to fulclientes_url }\n format.json { head :ok }\n end\n end",
"def 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 @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 @asiento_de_servicio.destroy\n respond_to do |format|\n format.html { redirect_to asiento_de_servicios_url, notice: 'Asiento de servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diagnoz = Diagnoz.find(params[:id])\n @diagnoz.destroy\n\n respond_to do |format|\n format.html { redirect_to diagnozs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vacuna.destroy\n respond_to do |format|\n format.html { redirect_to mascota_url, notice: 'Vacuna was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estado_despacho.destroy\n respond_to do |format|\n format.html { redirect_to estado_despachos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asociacion.destroy\n respond_to do |format|\n format.html { redirect_to asociaciones_url, notice: 'Asociacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineamiento.destroy\n respond_to do |format|\n format.html { redirect_to lineamientos_url, notice: 'Lineamiento was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @clientes_servico.destroy\n respond_to do |format|\n format.html { redirect_to clientes_servicos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unova.destroy\n respond_to do |format|\n format.html { redirect_to unovas_url, notice: 'Unova was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoveiculo.destroy\n respond_to do |format|\n format.html { redirect_to tipoveiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to datos_url, notice: 'Dato was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurantes_proximo.destroy\n respond_to do |format|\n format.html { redirect_to restaurantes_proximos_url, notice: 'Restaurantes proximo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventario_cosa.destroy\n respond_to do |format|\n format.html { redirect_to inventario_cosas_url, notice: 'Inventario cosa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asos_datum.destroy\n respond_to do |format|\n format.html { redirect_to asos_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_de_servicio.destroy\n respond_to do |format|\n format.html { redirect_to tipo_de_servicios_url, notice: 'Tipo de servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nota_tecnica.destroy\n respond_to do |format|\n format.html { redirect_to nota_tecnicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @veiculo = Veiculo.find(params[:id])\n @veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to veiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farmaceutico.destroy\n respond_to do |format|\n format.html { redirect_to farmaceuticos_url, notice: 'Farmaceutico was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rango_fecha.destroy\n respond_to do |format|\n format.html { redirect_to rango_fechas_url, notice: 'Rango fecha was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: \"Solicitud was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: 'Solicitud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @razones_sociale.destroy\n respond_to do |format|\n format.html { redirect_to razones_sociales_url, notice: 'Razones sociale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_unidad.destroy\n respond_to do |format|\n format.html { redirect_to tipo_unidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sivic_plano.destroy\n respond_to do |format|\n format.html { redirect_to sivic_planos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tb_servicio.destroy\n respond_to do |format|\n format.html { redirect_to tb_servicios_url, notice: 'Tb servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daw_trabajo.destroy\n respond_to do |format|\n format.html { redirect_to daw_trabajos_url, notice: 'Daw trabajo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to objetos_url, notice: 'Objeto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to objetos_url, notice: 'Objeto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @direcciont.destroy\n respond_to do |format|\n format.html { redirect_to direccionts_url, notice: 'Direcciont was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estadia.destroy\n respond_to do |format|\n format.html { redirect_to estadia_url, notice: 'Estadia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @etnia = Etnia.find(params[:id])\n @etnia.destroy\n\n respond_to do |format|\n format.html { redirect_to etnias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ayuda_localidad.destroy\n respond_to do |format|\n format.html { redirect_to ayuda_localidads_url, notice: 'Ayuda localidad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n @crear = Clientesmkt.create_mikrotik\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @serv_adicionale = ServAdicionale.find(params[:id])\n @serv_adicionale.destroy\n\n respond_to do |format|\n format.html { redirect_to serv_adicionales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vacina.destroy\n respond_to do |format|\n format.html { redirect_to vacinas_url, notice: 'Vacina excluida.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #--ADICIONADO\n @cliente.perfilclientes.destroy\n #--ADICIONADO\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @obra.destroy\n respond_to do |format|\n format.html { redirect_to obras_url, notice: 'Obra removida com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @zonal.destroy\n respond_to do |format|\n format.html { redirect_to zonals_url, notice: 'Zonal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitante.destroy\n respond_to do |format|\n format.html { redirect_to solicitantes_url, notice: 'Solicitante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ativo_outro = AtivoOutro.find(params[:id])\n @ativo_outro.destroy\n\n respond_to do |format|\n format.html { redirect_to ativo_outros_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @basico_marca_vehiculo.destroy\n respond_to do |format|\n format.html { redirect_to basico_marca_vehiculos_url, notice: 'Marca vehiculo was successfully destroyed.' }\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 @razmer_go = RazmerGo.find(params[:id])\n @razmer_go.destroy\n\n respond_to do |format|\n format.html { redirect_to razmer_gos_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.75745666",
"0.74508953",
"0.7318672",
"0.7273874",
"0.7253935",
"0.72427744",
"0.7231707",
"0.7230406",
"0.72280294",
"0.72023827",
"0.72023827",
"0.7201055",
"0.71909916",
"0.71902084",
"0.71819806",
"0.71762544",
"0.7173782",
"0.7173738",
"0.7171127",
"0.7166722",
"0.7165646",
"0.71610975",
"0.71595544",
"0.71579725",
"0.71576023",
"0.7154366",
"0.7152948",
"0.7152829",
"0.71446466",
"0.7142582",
"0.7140147",
"0.71381336",
"0.7136943",
"0.7135871",
"0.7131876",
"0.7131131",
"0.7129205",
"0.712828",
"0.7118625",
"0.7115257",
"0.71148884",
"0.7110373",
"0.7108978",
"0.7108239",
"0.7105969",
"0.71056044",
"0.71002203",
"0.7099372",
"0.7097328",
"0.7096963",
"0.70940256",
"0.7089346",
"0.70854634",
"0.70843804",
"0.708319",
"0.70754796",
"0.7074586",
"0.7072092",
"0.7071036",
"0.7070989",
"0.70704293",
"0.7067897",
"0.70677567",
"0.706673",
"0.70647913",
"0.7064178",
"0.70639825",
"0.70628303",
"0.70597225",
"0.7059708",
"0.7059708",
"0.7059708",
"0.7058541",
"0.7056315",
"0.70561135",
"0.70552677",
"0.7055035",
"0.7053686",
"0.70510215",
"0.7048611",
"0.7047148",
"0.7046859",
"0.7046518",
"0.7046518",
"0.7046143",
"0.70434654",
"0.70419234",
"0.704166",
"0.7040501",
"0.7040301",
"0.70397604",
"0.70394576",
"0.7039266",
"0.70377755",
"0.7037024",
"0.70358646",
"0.7033679",
"0.70315987",
"0.703059",
"0.7030428"
] |
0.77349323
|
0
|
use init_cairo_bind(true) when initializing the screen Texture or you might run into some trouble :x
|
def init_cairo_bind(dry=false)
args = if self.disposed? || dry
[width, height];
else
dumpdata = dump('bgra');
format = Cairo::Format::ARGB32;
stride = Cairo::Format.stride_for_width(format, width);
[dumpdata, format, width, height, stride];
end
@_cairo_surface = Cairo::ImageSurface.new(*args)
@_cairo_context = Cairo::Context.new(@_cairo_surface)
bind_to_cairo(@_cairo_surface)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def begin_canvas\n if @width && @height\n @surface = ::Cairo::ImageSurface.new(::Cairo::FORMAT_ARGB32, @width, @height)\n else\n @surface = ::Cairo::ImageSurface.from_png(@file)\n end\n bind_context\n end",
"def init_screen\n nl\n Curses.noecho # Don't echo characters to the screen.\n crmode\n Curses.init_screen # Initialize the screen buffer.\n Curses.start_color\n #Curses.color_set(COLOR_GREEN)\n Curses.stdscr.keypad(true) # Enable arrow keys.\n Curses.doupdate\n curs_set(0,0)\n begin\n yield\n ensure\n Curses.close_screen\n end\n end",
"def initialize w, h, bpp = 0, name = self.class.name, full = false\n SDL.init SDL::INIT_VIDEO\n SDL::TTF.init\n\n full = full ? SDL::FULLSCREEN : 0\n\n self.font = SDL::TTF.open(\"/System/Library/Fonts/Menlo.ttc\", 32, 0)\n\n SDL::WM.set_caption name, name\n\n self.screen = SDL::Screen.open w, h, bpp, SDL::HWSURFACE|SDL::DOUBLEBUF|full\n self.w, self.h = screen.w, screen.h\n\n self.color = {}\n self.rgb = Hash.new { |hash, k| hash[k] = screen.get_rgb(color[k]) }\n\n register_color :black, 0, 0, 0\n register_color :white, 255, 255, 255\n register_color :red, 255, 0, 0\n register_color :green, 0, 255, 0\n register_color :blue, 0, 0, 255\n register_color :gray, 127, 127, 127\n register_color :yellow, 255, 255, 0\n register_color :alpha, 0, 0, 0, 0\n\n (0..99).each do |n|\n m = (255 * (n / 100.0)).to_i\n register_color (\"gray%02d\" % n).to_sym, m, m, m\n register_color (\"red%02d\" % n).to_sym, m, 0, 0\n register_color (\"green%02d\" % n).to_sym, 0, m, 0\n register_color (\"blue%02d\" % n).to_sym, 0, 0, m\n end\n\n self.paused = false\n end",
"def init_sprite\n return if @mouse && !@mouse.disposed?\n init_fps_text\n return if @no_mouse\n @mouse = Sprite.new\n @mouse.z = 200_001\n mouse_skin = PSDK_CONFIG.mouse_skin || (Config.const_defined?(:MouseSkin) && Config::MouseSkin)\n if mouse_skin && RPG::Cache.windowskin_exist?(mouse_skin)\n @mouse.bitmap = RPG::Cache.windowskin(mouse_skin)\n else\n @mouse.bitmap = Bitmap.new(\"\\x89PNG\\r\\n\\x1A\\n\\x00\\x00\\x00\\rIHDR\\x00\\x00\\x00\\n\\x00\\x00\\x00\\x11\\x04\\x03\\x00\\x00\\x00\\x16\\r \\xD6\\x00\\x00\\x00\\x0FPLTENNN\\xA3I\\xA4\\xE5\\xE5\\xE5\\xD3\\xD3\\xD3\\xC3\\xC3\\xC3RUt6\\x00\\x00\\x00\\x02tRNS\\xFF\\x00\\xE5\\xB70J\\x00\\x00\\x00GIDATx\\x015\\xCA\\xC1\\t\\xC40\\fD\\xD1/[\\x05\\xAC:XH\\x03\\x01\\xA7\\x00\\x1F\\xA6\\xFF\\x9A2\\x16D\\x87\\a\\x9F\\x11Q>h\\xC7\\t\\xC6\\xBF\\xBD\\x1C\\xCCu\\xB7+\\xDA}|\\x14LI\\x9B\\x94\\x80D^\\xA9\\xF4\\x1Am\\xD5\\xCF?\\x9F\\xEE\\x17sz\\a\\xBD\\xEBds/\\x00\\x00\\x00\\x00IEND\\xAEB`\\x82\", true)\n end\n\n detect_gl_version\n end",
"def init_screen\n\t\t@screen = Curses.init_screen\n\t\tCurses.start_color\n\t\tCurses.stdscr.keypad(true)\n\t\tCurses.init_pair(Curses::COLOR_GREEN, Curses::COLOR_GREEN, Curses::COLOR_BLACK)\n\t\tCurses.init_pair(Curses::COLOR_RED, Curses::COLOR_RED, Curses::COLOR_BLACK)\n\t\tCurses.init_pair(Curses::COLOR_WHITE, Curses::COLOR_WHITE, Curses::COLOR_BLACK)\n\t\tCurses.init_pair(Curses::COLOR_CYAN, Curses::COLOR_CYAN, Curses::COLOR_BLACK)\n\t\tCurses.init_pair(Curses::COLOR_BLUE, Curses::COLOR_BLUE, Curses::COLOR_BLACK)\n\t\tCurses.init_pair(Curses::COLOR_YELLOW, Curses::COLOR_YELLOW, Curses::COLOR_BLACK)\n\t\tCurses.init_pair(Curses::COLOR_MAGENTA, Curses::COLOR_MAGENTA, Curses::COLOR_BLACK)\n\t\tbegin\n\t\t\tyield\n\t\tensure\n\t\t\tCurses.close_screen\n\t\tend\n\tend",
"def setup\n\t\ttext_font create_font(\"SanSerif\",10);\n\t\tscreen = [1920,1040] #JackRabbit\n\t\t# product[1920,1040] = 1996800\n\n\t\t# screen = [1500,900] #HOME\n\t\t# product[1500,900] = 1350000\n\n\t\t@it = 0\n\n\t\tsize(*screen)\n\t\t@w,@h = screen.map{|d| d/2}\n\t\t@i, @t = [0] * 2 ; background(0)\n\t\t@colors = (0..3).map{|i|rand(255)}\n\t\tframe_rate 2.5 ; colorMode(HSB,360,100,100)\n\t\tno_fill() ; no_stroke ; @xy = [0,0]\n\t\t\t\n\t\tcl = VERTS.map{|c| rand(30) }\n\t\t@cc = VERTS.map{|r| [(20 + rand(@w)) * 1.9,\n\t\t\t\t\t\t\t\t\t\t\t\t (20 + rand(@h)) * 1.9] }.zip(cl)\n\tend",
"def create_screenshot_graphic\n @screenshot_loaded = false\n @screenshot = Sprite.new(@viewport)\n @screenshot.opacity = 0\n end",
"def init_screen screen\n\n screen.set_editable false\n screen.set_xalign 1\n screen.set_can_focus false\n\n end",
"def initialize(width = 800, height = 600)\n\t\t@width = width\n\t\t@height = height\n\t\tSDL.init SDL::INIT_VIDEO\n\t\t@screen = SDL::set_video_mode @width, @height, 24, SDL::SWSURFACE\n\t\t@color_bg = @screen.format.mapRGB 240, 240, 240\n\t\t@color_fg = @screen.format.mapRGB 0, 0, 0\n\t\tclear\n\tend",
"def sprite w, h\n new_screen = SDL::Surface.new SDL::SWSURFACE, w, h, screen\n old_screen = screen\n\n self.screen = new_screen\n yield if block_given?\n\n new_screen.set_color_key SDL::SRCCOLORKEY, 0\n\n new_screen\n ensure\n self.screen = old_screen\n end",
"def on_background_init()\n background_path = LVGL::Hacks.get_asset_path(\"app-background.svg\")\n if File.exist?(background_path)\n @background = LVGL::LVImage.new(@screen).tap do |el|\n el.set_protect(LVGL::PROTECT::POS)\n el.set_height(LVGUI.pixel_scale(1280))\n el.set_width(LVGUI.pixel_scale(720))\n el.set_src(\"#{background_path}?height=#{LVGUI.pixel_scale(1280)}\")\n el.set_x((@screen.get_width() - el.get_width()) / 2) # center\n el.set_y(@screen.get_height() - el.get_height()) # Stick to the bottom\n end\n end\n end",
"def setup\n OpenGL.reset_flags\n end",
"def use_cairo(&block)\n @cairo_context.save\n block.yield(@cairo_context)\n @cairo_context.restore\n end",
"def create_graphic\n y = @enchant_list.bottom_corner\n h = Graphics.height - y - @enchant_window.height\n @graphic = GraphicUnifier.new(0, y, Graphics.width, h)\n @graphic.viewport = @viewport2\n @enchant_window.graphic = @graphic\n @enchant_window.scroll = @enchant_list.item\n end",
"def initialize texture_size = [512,512]\n @texture_size = texture_size\n @texture = Array.new(@texture_size[0]) { Array.new(@texture_size[1]) { Array.new(3){1} } }\n @windows = [@texture_size[0]/8, @texture_size[1]/8]\n @texture_link = [0]\n \n @windows[0].times do |i|\n @windows[1].times do |j|\n px_origin = i*8\n py_origin = j*8\n # Got a little 8x8 window with pixel coords starting in px/py origin being topleft corner of window\n \n # Walls\n 8.times do |x|\n @texture[px_origin + x][py_origin] = [0,0,0]\n @texture[px_origin + x][py_origin+7] = [0,0,0]\n @texture[px_origin][py_origin + x] = [0,0,0]\n @texture[px_origin + 7][py_origin + x] = [0,0,0]\n end\n \n # Inside color, either mostly on or mostly off\n if rand > DARK_TO_LIGHT_RATIO\n cr = rand/4.0\n else\n cr = 3.0/4 + rand/4.0\n end\n c = [cr,cr,cr]\n \n # Inside\n 6.times do |x|\n 6.times do |y|\n px = px_origin + 1 + x\n py = py_origin + 1 + y\n \n @texture[px][py] = c\n end\n end \n end\n end\n \n loadTexture\n end",
"def show\n call Screen.setColor(true)\n call draw\n end",
"def initialize\n\n #Graphics.freeze\n\n @closing = false\n @savequit = false\n\n $mouse.change_cursor('Default')\n sys('open')\n\n # Vp\n @vp = Viewport.new(0,0,$game.width,$game.height)\n @vp.z = 3500\n\n @snap = Sprite.new(@vp)\n @snap.z = -101\n @snap.bitmap = $game.snapshot\n\n # Background\n @bg = Sprite.new(@vp)\n @bg.z = -100\n #@bg.bitmap = Bitmap.new(640,480)\n #@bg.bitmap.fill(Color.new(0,0,0,180))\n @bg.bitmap = $cache.menu_background(\"sample\")\n #@bg.bitmap = $cache.menu_background(\"witch\")\n @bg.opacity = 0\n \n #@bg.y = 30\n #@bg.do(seq(go(\"y\",-50,150,:qio),go(\"y\",20,150,:qio)))\n\n #self.do(delay(300))\n\n @next_menu = $menu.menu_page\n $menu.menu_page = nil\n\n @menu = nil\n\n #Graphics.transition(20,'Graphics/Transitions/trans') \n\n end",
"def sprite w, h\n new_screen = SDL::Surface.new SDL::SWSURFACE, w, h, screen\n old_screen = screen\n old_w, old_h = self.w, self.h\n self.w, self.h = w, h\n\n self.screen = new_screen\n yield if block_given?\n\n new_screen.set_color_key SDL::SRCCOLORKEY, 0\n\n new_screen\n ensure\n self.screen = old_screen\n self.w, self.h = old_w, old_h\n end",
"def setup \n size 640, 360 \n no_stroke\n rect_mode CENTER \n frame_rate 30 \n @a, @s = 0.0, 0.0\nend",
"def initialize_screen\n try_set_screen\n\t Klass.initialize(@handle)\n\t true\n end",
"def texture\n\t\t@font.font_texture\n\t\t# ^ if you don't bind the texture, just get white squares\n\tend",
"def blit; end",
"def initialize(w, h, title)\r\n puts \"Initializing...\"\r\n # Open a window with a drawable area measuring w x h pixels\r\n @screen = Rubygame::Screen.open [w, h]\r\n # Set the title of the window\r\n @screen.title = title\r\n\r\n # Create a queue to receive events+\r\n # + events such as \"the mouse has moved\", \"a key has been pressed\" and so on\r\n @event_queue = Rubygame::EventQueue.new\r\n\r\n # Use new style events so that this software will work with Rubygame 3.0\r\n @event_queue.enable_new_style_events\r\n\r\n setup_clock\r\n\r\n Rubygame::TTF.setup\r\n end",
"def init_fps_text\n return if @ingame_fps_text && !@ingame_fps_text.disposed?\n @ingame_fps_text = Text.new(0, nil, 0, 0, w = Graphics.width - 2, 13, '', 2, 1)\n @gpu_fps_text = Text.new(0, nil, 0, 16, w, 13, '', 2, 1)\n @ruby_fps_text = Text.new(0, nil, 0, 32, w, 13, '', 2, 1)\n @ingame_fps_text.z = @gpu_fps_text.z = @ruby_fps_text.z = 200_000\n self.fps_visible = PARGV[:\"show-fps\"]\n end",
"def draw\n draw_background\n draw_ambient\n draw_objects\n draw_ui\n end",
"def read_canvas\n @surface = ::Cairo::ImageSurface.from_png(@file)\n bind_context\n end",
"def setup\n\t\tsize(1800,900) ; background(20) ; frame_rate 30 #JR\n\t\t# size(1400,850) ; background(20) ; frame_rate 30\n\t\t@w, @h = [width,height].map{|i|i/2.0} ; @i = 0\n \t@m = [235,18,85]\n\n \ttext_font create_font(\"SanSerif\",25) ; stroke(200,200,200)\n \t# @img = loadImage(\"/Users/Jon/Desktop/craigslist_map2.jpg\")\n \t@img = loadImage(\"/Users/Jon/Desktop/full_santa_fe.png\")\n\tend",
"def draw\r\n yield @screen\r\n\r\n # Show the changes to the screen surface by flipping the buffer that is visible\r\n # to the user. All changes made to the screen surface will appear\r\n # simultaneously\r\n @screen.flip\r\n end",
"def tick args\n args.outputs.background_color = [0, 0, 0]\n args.outputs.borders << { x: 0, y: 0, w: 1280, h: 720, r: 255, g: 255, b: 255 }\n\n args.outputs.labels << { x: 30, y: 30.from_top, text: \"render scale: #{args.grid.native_scale}\", r: 255, g: 255, b: 255 }\n args.outputs.labels << { x: 30, y: 60.from_top, text: \"render scale: #{args.grid.native_scale_enum}\", r: 255, g: 255, b: 255 }\n\n args.outputs.sprites << { x: -640 - 50, y: 360 - 50, w: 100, h: 100, path: \"sprites/square.png\" }\n args.outputs.sprites << { x: -320 - 50, y: 360 - 50, w: 100, h: 100, path: \"sprites/square.png\" }\n\n args.outputs.sprites << { x: 0 - 50, y: 360 - 50, w: 100, h: 100, path: \"sprites/square.png\" }\n args.outputs.sprites << { x: 320 - 50, y: 360 - 50, w: 100, h: 100, path: \"sprites/square.png\" }\n args.outputs.sprites << { x: 640 - 50, y: 360 - 50, w: 100, h: 100, path: \"sprites/square.png\" }\n args.outputs.sprites << { x: 960 - 50, y: 360 - 50, w: 100, h: 100, path: \"sprites/square.png\" }\n args.outputs.sprites << { x: 1280 - 50, y: 360 - 50, w: 100, h: 100, path: \"sprites/square.png\" }\n\n args.outputs.sprites << { x: 1600 - 50, y: 360 - 50, w: 100, h: 100, path: \"sprites/square.png\" }\n args.outputs.sprites << { x: 1920 - 50, y: 360 - 50, w: 100, h: 100, path: \"sprites/square.png\" }\n\n args.outputs.sprites << { x: 640 - 50, y: 720, w: 100, h: 100, path: \"sprites/square.png\" }\n args.outputs.sprites << { x: 640 - 50, y: 100.from_top, w: 100, h: 100, path: \"sprites/square.png\" }\n args.outputs.sprites << { x: 640 - 50, y: 360 - 50, w: 100, h: 100, path: \"sprites/square.png\" }\n args.outputs.sprites << { x: 640 - 50, y: 0, w: 100, h: 100, path: \"sprites/square.png\" }\n args.outputs.sprites << { x: 640 - 50, y: -100, w: 100, h: 100, path: \"sprites/square.png\" }\nend",
"def make_screen\n flags = [HWSURFACE, DOUBLEBUF] # FULLSCREEN will be added later\n @screen = Screen.open( [600, 900], 0, flags )\n @screen.title = \"Geotower for great good!\"\n end",
"def draw\n\t\t# Complete the missing code\n\t\tdraw_background()\n\tend",
"def retrofy\r\n Gosu::enable_undocumented_retrofication\r\n self\r\n \r\n #\r\n # The below code depends on the bad opengl gem\r\n # And it could affect other images anyhow... \r\n # So let's use Gosu::enable_undocumented_retrofication until further notice.\r\n #\r\n \r\n #glBindTexture(GL_TEXTURE_2D, self.gl_tex_info.tex_name)\r\n #glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)\r\n #glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)\r\n #self\r\n end",
"def init_battleback\r\n # Make battleback sprite\r\n @battleback_sprite = Sprite.new(@viewport1)\r\n end",
"def initialize window, path, tileable = false\n super\n @image = Gosu::Image.new(window, path, tileable)\n end",
"def setup\n \n\t# The size function is a statement that tells the computer \n\t# how large to make the window.\n\t# Each function statement has zero or more parameters. \n\t# Parameters are data passed into the function\n\t# and used as values for specifying what the computer will do.\n\tsize 640, 360\n\t\n\t# The background function is a statement that tells the computer\n\t# which color to make the background of the window \n\tbackground 102\n\t\nend",
"def initialize(session,*dims)\n @session = session\n super(@session.viewport)\n self.set_dimensions(*dims)\n self.bitmap = Bitmap.new(self.width,self.height)\n # Get our background and text color from the config\n @bg_color ||= @session.config.bgColor\n @text_color ||= @session.config.textColor\n @font_name ||= @session.config.fontName\n # Draw the background color, and text entry field\n self.bitmap.fill_rect(self.bitmap.rect,@bg_color)\n @text_entry = Window_TextEntry_Console.new(\n self,\"\",0,0,self.width,CONSOLE_LINE_HEIGHT*3\n )\n @text_entry.viewport = self.viewport\n @text_entry.visible = false\n # Initialize the window with a single line and set the maximum\n # amount of lines\n @lines = []\n @lines << ConsoleLineSprite.new(self)\n @max_lines = self.height/CONSOLE_LINE_HEIGHT\n self.reposition_entry\n end",
"def setup\n size(640, 360)\n background(102)\nend",
"def create_spriteset_and_background\n super(ext_text(8997, 19))\n end",
"def InitGL(width, height)\n # Load the textures\n LoadGLTextures()\n\n # Enable Texture mapping\n glEnable(GL_TEXTURE_2D)\n\n # Clear the background to black\n glClearColor(0.0, 0.0, 0.0, 0.0)\n\n # Enable clearing of the depth buffer\n glClearDepth(1.0)\n\n # Enable smoothing and color shading\n glShadeModel(GL_SMOOTH)\n\n # Reset the Projection Matrix\n glMatrixMode(GL_PROJECTION)\n glLoadIdentity()\n\n # Calculate the aspect ratio of the window\n gluPerspective(45.0,Float(width)/Float(height),0.1,100.0)\n\n # Reset back to the model Matrix\n glMatrixMode(GL_MODELVIEW)\n\t \n if HEXAGON_TILE\n\tPregenerate_Hexagon() \n end\nend",
"def draw\n @screen.insert(@frame, 0, 0)\n @screen.draw(0, 0, 0)\n end",
"def initialize()\n screen=Gdk::Screen.default\n\t\t#Variable pour resize le texte\n\t\t@pad=screen.height*0.03\n\t\t@police=screen.height*0.02\n win = Gtk::Window.new\n\t\tw=screen.width\n\t\th=screen.height\n win.set_default_size(w/4,h/10)\n win.set_resizable(false)\n\t\twin.window_position= :center_always\n\n\t\t@menu=Gtk::Box.new(:vertical, 25)\n\t\t@gtkObject= Gtk::Table.new(3,3)\n\t\t@gtkObject.attach(@menu,1,2,1,2)\n\n\t\t@buffer = GdkPixbuf::Pixbuf.new(file: File.dirname(__FILE__) + \"/../../../../Assets/Backgrounds/nature.jpg\")\n\t\t@buffer=@buffer.scale(w/4,h/10+100)\n\n pb = Text.new(\"Login not found \\n OR \\nwrong password\",@police)\n\t\tpb.colorChange(\"red\")\n @menu.pack_start(pb.gtkObject,expand: false, fill: true, padding: @pad)\n\t\t@gtkObject.attach(Gtk::Image.new(pixbuf: @buffer),0,3,0,3)\n\t\twin.add(@gtkObject)\n\t\twin.show_all\n\n end",
"def test_default\n [@window, @sprite, @bitmap].each{|container|\n uc = UCCharacterGraphic.new(container, Rect.new(0, 0, 40, 40), nil)\n uc.draw()\n }\n return true\n end",
"def reboot\n img = ['blue_flower', 'red_flower', 'white_flower', 'pink_flower'].sample\n @image = Gosu::Image.new window, 'images/flowers/' + img +'.png', true\n @drawing = true\n end",
"def step\n # Draw everything\n @image.draw @screen\n end",
"def setup_screen\n rl = ResourceLocator.instance\n if rl.is_gem?('kuiper')\n rl.dirs << Gem.loaded_specs['kuiper'].full_gem_path\n end\n rl.dotfile=\".kuiper\"\n repository = Repository.new()\n rl.storage[:repository] = repository\n rl.storage[:visual_log] = [] # Distinct from the rl.logger; this is on-screen\n optpath = rl.dotpath_for(\"options.yml\")\n if File.exists?(optpath)\n options = Options.from_file(optpath)\n else\n options = Options.new(optpath)\n options.save\n end\n rl.storage[:options] = options\n w,h = options.screen_size\n screen = rl.screen( w, h, options.fullscreen )\n icon = rl.image_for(\"kuicon.png\",false,false)\n screen.icon = icon\n screen.title = \"Kuiper\"\n setup_joystick\n return screen\nend",
"def make_screen\n @screen = Screen.new(Configuration.screen[:size], 32, [HWSURFACE, DOUBLEBUF])\n\n @screen.title = \"Towerdefence!\"\n end",
"def initialize(save_file=nil)\n super()\n\n @tiles = Gosu::Image.load_tiles(\n RES_DIR.join(\"tiled-icons-16x16.png\").to_s, \n 16, 16,\n retro: true)\n\n @letters = Gosu::Image.load_tiles(\n RES_DIR.join(\"tiled-font-8x16.png\").to_s,\n 8, 16,\n retro: true)\n\n @tile_scale = Size[2,2]\n @grid_size = Size[32,32]\n @map_size = Size[25,19]\n @window = Window.new(size: Size[800,608])\n @window.on_input= self.method(:on_input)\n @window.on_update= self.method(:on_update)\n @window.on_draw= self.method(:on_draw)\n\n @prng = Random.new\n\n sword = {\n tile_index: 5,\n card_type: :weapon,\n description: \"sword\",\n cooldown: 3,\n cooldown_timer: -1\n }\n\n magic_missile = {\n tile_index: 6,\n card_type: :spell,\n description: \"magic missile\",\n contamination: 3,\n }\n\n meat = {\n tile_index: 4,\n card_type: :item,\n description: \"hunk of meat\",\n }\n\n @player = { \n name: \"Player\",\n tile_index: 0,\n action: nil,\n position: Point[1,1],\n movement: nil,\n card_state: {\n contaminated: true,\n weapon: sword,\n spell: magic_missile,\n item: meat,\n deck: [],\n }\n }\n\n goblin = {\n name: \"Goblin\",\n tile_index: 1,\n action: nil,\n position: Point[3,3],\n movement: nil,\n ai_method: :goblin_ai,\n }\n\n walls = Bitmap.new(MAP_SIZE).from_s(WALLS).active_coords.map do |pt|\n {\n tile_index: 2,\n position: pt,\n obstructing: true\n }\n end\n\n @movement = [@player, goblin]\n @with_cards = [@player]\n @ai_method = [goblin]\n @action = [@player, goblin]\n @visible = [@player, goblin, *walls]\n\n @map = {\n size: Size[20,20],\n index: {\n @player[:position] => [@player],\n goblin[:position] => [ goblin],\n },\n }\n\n @map[:index].default_proc = Proc.new do |hash, key|\n hash[key]= []\n end\n\n walls.each do |entity|\n pos = entity[:position]\n @map[:index][pos] << entity\n end\n end",
"def initialize(*args, &block)\n super(*args, &block)\n reset_font_settings\n set_data_font(:normal)\n @maqj_default_font = contents.font.dup\n # Change the windowskin, tone if they are set to be changed\n self.windowskin = Cache.system($game_system.quest_windowskin) if $game_system.quest_windowskin\n self.opacity = $game_system.quest_window_opacity if $game_system.quest_window_opacity\n end",
"def init_curses\n # signal(SIGINT, finish)\n\n Curses.init_screen\n Curses.raw\n Curses.nonl\n #Curses.cbreak\n Curses.noecho\n Curses.curs_set(0)\n Curses.ESCDELAY = 10\n Curses.start_color\n Curses.init_pair(1, Curses::COLOR_WHITE, Curses::COLOR_BLUE);\n\n @screen = Curses.stdscr\n\n @screen.scrollok(true)\n @screen.keypad(true)\n end",
"def start\n @start.call\n @on_start.each(&:call)\n @on_start.clear\n io_initialize\n frame_reset\n @no_mouse = (PSDK_CONFIG.mouse_disabled && !PARGV[:tags])\n init_sprite\n end",
"def draw\n dc = Wx::MemoryDC.new\n dc.select_object(self)\n yield dc\n dc.select_object( Wx::NULL_BITMAP )\n end",
"def test_default\n [@window, @sprite, @bitmap].each{|container|\n uc = UCIcon.new(container, Rect.new(0, 0, 24, 24), nil)\n uc.draw()\n }\n return true\n end",
"def initialize(param = {})\n super(param) ;\n\n @drawMutex = Mutex::new() ;\n @drawMutex.synchronize(){\n setupWindow(param) ;\n @exitWhenQuit = true ;\n }\n\n end",
"def main_sprite ; end",
"def reset\n @victory = false\n @win = false\n drawFromPixmap\n end",
"def initialize\n super(RESOLUTION[0], RESOLUTION[1], {:update_interval => UP_MS_DRAW, :fullscreen => ISFULLSCREEN})\n $program = self # global pointer to window creation object\n controls_init # prep the input controls scheme manager\n gl_version = glGetString(GL_VERSION).to_s\n gl_version = gl_version.split(' ')\n @openGL_version = Gem::Version.new(gl_version[0])\n puts(\"Using OpenGL version: #{@openGL_version} On a #{gl_version[1]} Driver Version: #{gl_version[2]}\")\n puts(\"*\" * 70)\n @@active_state = Map.new( { :level => \"\" } )\n end",
"def create_spriteset_and_background\n super('GTS')\n end",
"def create_graphics\n create_viewport\n create_background\n create_buttons\n init_entering\n end",
"def victory_screen\n system 'clear'\n 'GAME OVER'\n Catpix::print_image \"victory_screen.jpg\",\n :limit_x => 1.0,\n :limit_y => 0,\n :center_x => true,\n :center_y => true,\n :bg => \"white\",\n :bg_fill => true\n abort(\"See you next time.\".red)\nend",
"def update\n super\n # update_bitmap # Not needed for now\n update_screen # Update the position the graphic should be displayed\n # update_frame # Update the frame count (if wanted later)\n end",
"def Main\n #Begin preinitialization\n preInit()\n\n #Render Game Window and begin drawing onto the screen.\n\n DEBUG.cout(\"Initializing Game Window...\", 0, false)\n window = GameWindow.new\n window.show\n\n #End game and return to desktop\n return nil\nend",
"def draw_setup(gc)\n if @obj.stroke and @obj.strokewidth > 0\n gc.set_foreground @obj.stroke\n gc.set_alpha @obj.stroke_alpha\n gc.set_line_width @obj.strokewidth\n true\n end\n end",
"def test04()\n begin\n origModes = \"kCGBlendModeNormal kCGBlendModeMultiply kCGBlendModeScreen \"+\n \"kCGBlendModeOverlay kCGBlendModeDarken kCGBlendModeLighten \" + \n \"kCGBlendModeColorDodge kCGBlendModeColorBurn kCGBlendModeSoftLight \" +\n \"kCGBlendModeHardLight kCGBlendModeDifference kCGBlendModeExclusion \" +\n \"kCGBlendModeHue kCGBlendModeSaturation kCGBlendModeColor \" +\n \"kCGBlendModeLuminosity kCGBlendModeClear kCGBlendModeCopy \" +\n \"kCGBlendModeSourceIn kCGBlendModeSourceOut kCGBlendModeSourceAtop \" +\n \"kCGBlendModeDestinationOver kCGBlendModeDestinationIn \" +\n \"kCGBlendModeDestinationOut kCGBlendModeDestinationAtop kCGBlendModeXOR \" +\n \"kCGBlendModePlusDarker kCGBlendModePlusLighter\"\n blendModes = MIMeta.listcgblendmodes\n unless origModes.eql? blendModes\n raise \"Blend modes are different, new:\" + blendModes\n end\n\n origPresets = \"AlphaOnly8bpcInt Gray8bpcInt Gray16bpcInt Gray32bpcFloat \" +\n \"AlphaSkipFirstRGB8bpcInt AlphaSkipLastRGB8bpcInt \"+\n \"AlphaPreMulFirstRGB8bpcInt AlphaPreMulBGRA8bpcInt AlphaPreMulLastRGB8bpcInt \" +\n \"AlphaPreMulLastRGB16bpcInt AlphaSkipLastRGB16bpcInt \" +\n \"AlphaSkipLastRGB32bpcFloat AlphaPreMulLastRGB32bpcFloat \" +\n \"CMYK8bpcInt CMYK16bpcInt CMYK32bpcFloat PlatformDefaultBitmapContext\"\n presets = MIMeta.listpresets\n unless origPresets.eql? presets\n raise \"Presets are different, new:\" + presets\n end\n\n origCommands = [:getproperty, :setproperty, :getproperties, :setproperties,\n :create, :close, :closeall, :addimage, :export, :drawelement, :snapshot,\n :finalizepage, :getpixeldata, :calculategraphicsizeoftext, :renderfilterchain,\n :assignimagetocollection, :removeimagefromcollection, :processframes,\n :createtrack, :addinputtowriter, :addimagesampletowriter,\n :finishwritingframes, :cancelwritingframes, :addmovieinstruction,\n :inserttracksegment, :insertemptytracksegment]\n\n commands = MIMeta.listallcommands\n unless origCommands.eql? commands\n raise \"Command lists are different, new:\" + commands.to_s\n end\n\n origObjects = [:bitmapcontext, :imageimporter, :imageexporter,\n :imagefilterchain, :pdfcontext, :nsgraphiccontext,\n :movieimporter, :movieeditor, :videoframeswriter]\n objectTypes = MIMeta.listobjecttypes\n\n unless origObjects.eql? objectTypes\n raise \"List of objects is different, new:\" + commands.to_s\n end\n\n origInputVideoWriterPresets = \"h264preset_sd jpegpreset h264preset_hd \" +\n \"prores4444preset prores422preset\"\n \n videoWriterPresets = MIMeta.listvideoframewriterpresets\n unless origInputVideoWriterPresets.eql? videoWriterPresets\n raise \"List of video writer presets is different, new:\" + videoWriterPresets.to_s\n end\n\n origUserInterfaceFonts = \"kCTFontUIFontMiniEmphasizedSystem \" +\n \"kCTFontUIFontSmallToolbar kCTFontUIFontWindowTitle \" +\n \"kCTFontUIFontMenuTitle kCTFontUIFontSystem kCTFontUIFontMenuItem \" +\n \"kCTFontUIFontEmphasizedSystem kCTFontUIFontToolbar kCTFontUIFontMessage \" +\n \"kCTFontUIFontEmphasizedSystemDetail kCTFontUIFontSmallEmphasizedSystem \" +\n \"kCTFontUIFontUserFixedPitch kCTFontUIFontMiniSystem kCTFontUIFontLabel \" +\n \"kCTFontUIFontControlContent kCTFontUIFontSystemDetail kCTFontUIFontViews \"+\n \"kCTFontUIFontUser kCTFontUIFontSmallSystem kCTFontUIFontApplication\" +\n \"kCTFontUIFontToolTip\"\n \n userInterfaceFonts = MIMeta.listuserinterfacefonts\n unless userInterfaceFonts.eql? userInterfaceFonts\n raise \"User iterface fonts are different, new:\" + userInterfaceFonts\n end\n\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: #{Smig.get_exitstring}\"\n end\n puts e.message\n puts e.backtrace.to_s\n puts #{Smig.exitstring}\"\n# exit 240\n end\nend",
"def load_frames\n\t\tw,h = @_w, @_h # convenience assignments\n\t\twt = 0.8 * w\n\t\tdw = 0.5 * (w-wt) \n\t img = Surface.new([w,h]).fill(@@bg_color)\n\t img.draw_polygon_s([[0,h], [dw,0], [dw+wt,0], [w,h],[0,h]], BROWN)\n\t return [img]\n\tend",
"def setup\n size 640, 360\n @num_chars = 26\n @key_scale = 200.0 / @num_chars - 1.0\n @rect_width = width / 4\n no_stroke\n background 0\nend",
"def draw(screen)\n @clock.tick\n # Do we need to redraw the screen?\n do_redraw = Plugin.loader.background.changed?\n screen.drawlist.each { |widget| \n if widget.changed?\n do_redraw = true\n break\n end\n } if not do_redraw\n # Ok, redraw it\n if do_redraw\n glClear(GL_COLOR_BUFFER_BIT)\n screen.drawlist.each { |widget| \n widget.draw\n }\n self.redraw\n end\n end",
"def setup \n size 640, 360\n no_stroke\n frame_rate 30 \n @x, @y = 0.0, 0.0\n @size = 80.0\nend",
"def draw_custom_image\r\r\n bitmap = Cache.picture($game_map.ach_display.graphic)\r\r\n rect = Rect.new(0,0,bitmap.width,bitmap.height)\r\r\n target = Rect.new(0,0,contents.width,contents.height)\r\r\n contents.stretch_blt(target, bitmap, rect, 255)\r\r\n end",
"def create_graphics\n create_character_sprite\n create_phrase\n create_inputs\n refresh_chars\n end",
"def text(x, y, text)\n sfc = @font.render(text, stroke)\n tex = SDL2.SDL_CreateTextureFromSurface(@ren, sfc)\n\n w_p = FFI::MemoryPointer.new :int, 1, false\n h_p = FFI::MemoryPointer.new :int, 1, false\n err = SDL2.SDL_QueryTexture(tex, nil, nil, w_p, h_p)\n raise \"SDL_QueryTexture: #{SDL2::SDL_GetError}\" if err != 0\n\n r = SDL2::SDL_Rect.new\n r[:x] = x\n r[:y] = y\n r[:w] = w_p.get_int(0)\n r[:h] = h_p.get_int(0)\n SDL2.SDL_RenderCopy(@ren, tex, nil, r)\n need_update\n end",
"def initialize(actor)\n super(Combo_Window_Settings[0], Combo_Window_Settings[1], Combo_Window_Settings[2], Combo_Window_Settings[3])\n self.contents = Bitmap.new(width - 32, height - 32)\n self.z = 4000\n @combo_page = 0\n @max_size = ((self.width - 32) / 52).to_i\n if Combo_Window_Bg != nil\n @background_image = Sprite.new\n @background_image.bitmap = RPG::Cache.windowskin(Combo_Window_Bg)\n @background_image.x = self.x + Combo_Window_Bg_Postion[0]\n @background_image.y = self.y + Combo_Window_Bg_Postion[1]\n @background_image.z = self.z - 1\n @background_image.visible = self.visible\n end\n self.back_opacity = Combo_Window_Settings[4]\n self.opacity = Combo_Window_Settings[4] if Combo_Window_Settings[5] \n @actor = actor\n create_input_images if Input_Images\n refresh\n end",
"def draw_interface\n\n\t\tmessage_top\t= 10.0\n\n\t\tmatrix_mode\t= Pointer.new_with_type('i')\n\n\t\twidth\t\t= @camera.view_width\n\t\theight\t\t= @camera.view_height\n\t\t\n\t\t# Set orthograhic 1:1 pixel transform in local view coords :\n\t\tglGetIntegerv(GL_MATRIX_MODE, matrix_mode)\n\t\tglMatrixMode(GL_PROJECTION)\n\t\tglPushMatrix\n\t\tglLoadIdentity\n\t\tglMatrixMode(GL_MODELVIEW)\n\t\tglPushMatrix\n\t\tglLoadIdentity\n\t\tglScalef(2.0 / width, -2.0 / height, 1.0);\n\t\tglTranslatef(-width / 2.0, -height / 2.0, 0.0)\n\t\t\t\n\t\tglColor4f(1.0, 1.0, 1.0, 1.0)\n\n\n\t\t# Drawing the info string :\n\t\t@info_glstring.drawAtPoint(NSMakePoint(10.0, height - @info_glstring.frameSize.height - 10.0))\n\n\n\t\t# Drawing the camera string :\n\t\t@camera_glstring.drawAtPoint(NSMakePoint(10.0, message_top))\n\t\tmessage_top += @camera_glstring.frameSize.height + 3.0\n\n\n\t\t# Drawing the help string :\n\t\tif @draw_help_flag then\n\t\t\tdrawing_x\t\t= ((width - @help_glstring.textureSize.width) / 2.0).floor\n\t\t\tdrawing_y\t\t= ((height - @help_glstring.textureSize.height) / 3.0).floor\n\t\t\tdrawing_point\t= NSMakePoint(drawing_x, drawing_y)\n\t\t\t@help_glstring.drawAtPoint(drawing_point)\n\t\tend\n\n\n\t\t# Drawing the OpenGL capacities string :\n\t\tif @draw_capacities_flag then\n\t\t\trenderer\t= Pointer.new_with_type('i')\n\t\t\tpixelFormat.getValues(\trenderer,\n\t\t\t\t\t\t\t\t\tforAttribute:NSOpenGLPFARendererID,\n\t\t\t\t\t\t\t\t\tforVirtualScreen:openGLContext.currentVirtualScreen)\n\t\t\tputs \"renderer for screen #{openGLContext.currentVirtualScreen} : #{renderer[0]}\"\n\t\t\t#draw_capacities(@display_capacities, @display_numbers, renderer[0], width);\n\t\tend\n\n\n\t\t# Drawing the message string :\n\t\tcurrent_time\t= get_elapsed_time\n\t\tif current_time - @message_time < MESSAGE_PERSISTANCE then\n\t\t\tfade\t\t= (MESSAGE_PERSISTANCE - get_elapsed_time + @message_time) * 0.1\t# premultiplied fade\n\t\t\tglColor4f(fade, fade, fade, fade)\n\t\t\t@message_glstring.drawAtPoint(NSMakePoint(10.0, message_top))\n\t\t\tmessage_top += @message_glstring.textureSize.height + 3.0\n\t\tend\n\n\n\t\t# Drawing the error message if needed :\n\t\tif ((current_time - @error_time) < MESSAGE_PERSISTANCE) then\n\t\t\tfade\t\t= (MESSAGE_PERSISTANCE - get_elapsed_time + @error_time) * 0.1\t# premultiplied fade\n\t\t\tglColor4f(fade, fade, fade, fade)\n @error_glstring.drawAtPoint(NSMakePoint(10.0, message_top)) if @error_glstring\n\t\tend\n\n\n\t\t# Reset orginal martices :\n\t\tglPopMatrix\t\t# GL_MODELVIEW\n\t\tglMatrixMode(GL_PROJECTION)\n\t\tglPopMatrix\n\t\tglMatrixMode(matrix_mode[0])\n\n\t\tglDisable(GL_TEXTURE_RECTANGLE_EXT)\n\t\tglDisable(GL_BLEND)\n\n\t\tif glIsEnabled(GL_DEPTH_TEST) then\t# ????\n\t\t\tglEnable(GL_DEPTH_TEST)\t\t\t# ????\n\t\tend\t\t\t\t\t\t\t\t\t# ????\n\n\t\treport_error\n\n\tend",
"def pbSceneStandby\n Graphics.frame_reset; yield\n $scene.disposeSpritesets if $scene && $scene.is_a?(Scene_Map)\n $scene.createSpritesets if $scene && $scene.is_a?(Scene_Map)\nend",
"def initialize(window)\n # @lines is an array of strings\n @lines = Array.new\n @current_pos = 0\n @current = true\n @hidden = false\n @cur_start_y = START_Y\n @font = Gosu::Font.new(window, Gosu::default_font_name, FONT_HEIGHT)\n @ctc = Gosu::Image.load_tiles(window, \"resources/sakura.png\", 20, 20, false)\n end",
"def create_signal_picture\n @segnal = Sprite.new(@viewport)\n @segnal.bitmap = Cache.picture(MAP_SIGNAL)\n center(@segnal)\n @segnal.opacity = 0\n end",
"def create_graphics\n create_viewport\n create_background\n create_pokemon_sprite\n create_egg_sprite\n end",
"def load_dependencies\n begin\n require 'cairo'\n rescue LoadError\n require 'rubygems'\n begin\n require 'cairo'\n rescue LoadError\n puts \"Compass::Canvas\\n_______________\\n\\n\"\n puts \"Unable to load Cairo backend. Please install it with the following command:\\n\\n\"\n puts \" gem install cairo\\n\\n\"\n puts \"For more information, please visit https://github.com/rcairo/rcairo\"\n raise\n end\n end\n end",
"def InitGL(width, height) # We call this right after our OpenGL window \n return false unless load_gl_textures() # If Texture Didn't Load Return FALSE \n glEnable(GL_TEXTURE_2D)\t\t\t\t\t\t\t# Enable Texture Mapping\n glShadeModel(GL_SMOOTH)\t\t\t\t\t\t\t# Enable Smooth Shading\n glClearColor(0.0, 0.0, 0.0, 0.5)\t\t\t\t# Black Background\n glClearDepth(1.0)\t\t\t\t\t\t\t\t\t# Depth Buer Setup\n glEnable(GL_DEPTH_TEST)\t\t\t\t\t\t\t# Enables Depth Testing\n glDepthFunc(GL_LEQUAL)\t\t\t\t\t\t\t\t# The Type Of Depth Testing To Do\n glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)\t# Really Nice Perspective Calculations\n\n glLightfv(GL_LIGHT1, GL_AMBIENT, $LightAmbient)\t\t# Setup The Ambient Light\n glLightfv(GL_LIGHT1, GL_DIFFUSE, $LightDiffuse)\t\t# Setup The Diffuse Light\n glLightfv(GL_LIGHT1, GL_POSITION,$LightPosition)\t# Position The Light\n glEnable(GL_LIGHT1)\t\t\t\t\t\t\t\t# Enable Light One\n glColor4f(1.0, 1.0, 1.0, 0.5) # Full Brightness 50% alpha\n glBlendFunc(GL_SRC_ALPHA,GL_ONE)\n return true # Initialization Went OK\nend",
"def setup\n size 640, 360\n stroke_weight 10\n no_loop\nend",
"def create_focus_sprite\n @focus_bg = Sprite_Screen.new(@viewport1)\n @focus_bg.bitmap.fill_rect(@focus_bg.bitmap.rect, Color.new(255,255,255))\n @focus_bg.z = 3\n @focus_bg.opacity = 0\n end",
"def setup\n size 640, 360\n @num_chars = 26\n @key_scale = 200.0 / @num_chars-1.0\n @rect_width = width/4 \n no_stroke\n background 0\nend",
"def start\n super\n create_menu_background\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, YE::SYSTEM::WINDOW_HELP)\n @system_window = Window_System.new(0, 0, 640, 384)\n \n positions = []\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cWindowSkinsLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucBGMVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucSFXVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucBGSVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cBattleAnimLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cAutoDashLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cInstantTextLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cDifficultyLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cInGameTutoLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cReturnTitleLabel.rect.y, \n @system_window.width-32, 24)))\n \n @command_window = Window_Custom_Selectable.new(0, 0, 640, 384, positions, true)\n @command_window.opacity = 0\n @command_window.visible = true\n @command_window.active = true\n @command_window.z = 1000\n if @menu_index != nil\n @command_window.index = @menu_index\n update_help()\n else\n @command_window.index = 0\n end\n\n @last_index = -1\n end",
"def tick args\n # sets console command when sample app initially opens\n if Kernel.global_tick_count == 0\n puts \"\"\n puts \"\"\n puts \"=========================================================\"\n puts \"* INFO: Static Sprites, Classes, Draw Override\"\n puts \"* INFO: Please specify the number of sprites to render.\"\n args.gtk.console.set_command \"reset_with count: 100\"\n end\n\n # init\n if args.state.tick_count == 0\n args.state.stars = args.state.star_count.map { |i| Star.new args.grid }\n args.outputs.static_sprites << args.state.stars\n end\n\n # render framerate\n args.outputs.background_color = [0, 0, 0]\n args.outputs.primitives << args.gtk.current_framerate_primitives\nend",
"def setGameSurface gameSurface\n @gameSurface = gameSurface\n end",
"def initialize(window, rect, actor, align=0, opacity=255, valign=0, direction=0,\n active=true, visible=true)\n super(active, visible)\n self.actor = actor\n @direction = direction\n @cCharGraphic = CImage.new(window, rect, nil, nil, align, opacity, valign,\n active, visible)\n end",
"def initialize(win, game, uiManager, backAction)\n super(win,\"/../../../Assets/Backgrounds/fond-naturel.png\")\n\n screen=Gdk::Screen.default\n pathAssets=File.dirname(__FILE__) + \"/../../../Assets/\"\n\n menuTitle=Titre.new(label:\"Victoire\", width:screen.width*0.2, height:screen.height*0.05)\n chronoText=Text.new(label:\"Votre temps :\", width:screen.width*0.2, height:screen.height*0.05)\n chronoText.setBackgroundSize(screen.width*0.2,screen.height*0.05)\n chronoText.setBackground(1,1,1,1)\n chronoUi=ChronoUi.new(game.getTimer)\n\n menuButton=Button.new(label: \"Retour à la selection\", width: screen.width*0.1,height: screen.height*0.08, size: 20)\n menuButton.onClick(){\n backAction.call\n }\n\n replayButton=Button.new(image:pathAssets + \"Button/replay.png\", width: screen.width*0.1,height: screen.height*0.08)\n replayButton.resizeImage(40,40)\n replayButton.onClick(){\n game.restart\n gameScreen = GameScreen.new(win,game,uiManager, backAction)\n gameScreen.applyOn(win)\n }\n\n\n chronoBox = Gtk::Box.new(:horizontal)\n chronoBox.pack_start(chronoText.gtkObject, expand: true, fill: false, padding: 20)\n chronoBox.pack_start(chronoUi.gtkObject, expand: true, fill: false, padding: 20)\n\n buttonBox = Gtk::Box.new(:horizontal)\n buttonBox.pack_start(menuButton.gtkObject, expand: true, fill: false, padding: 0)\n buttonBox.pack_start(replayButton.gtkObject, expand: true, fill: false, padding: 0)\n\n globalBox = Gtk::Box.new(:vertical)\n globalBox.pack_start(menuTitle.gtkObject, expand: true, fill: false, padding: 10)\n globalBox.pack_start(chronoBox, expand: true, fill: false, padding: 10)\n globalBox.pack_start(buttonBox, expand: true, fill: false, padding: 10)\n\n @gtkObject = Gtk::Table.new(4,4)\n @gtkObject.attach(globalBox,0,4,0,4)\n @gtkObject.attach(Gtk::Image.new(pixbuf: @buffer),0,4,0,4)\n\n end",
"def setup\n\t\tsize(displayWidth, displayHeight)\n\t\tcolorMode(HSB,360,100,100,60)\n\t\t@w, @h = [width/2.0, 0]\n\t\t@i = 0 ; @t = 0\n frame_rate 20\n\t\tbackground(0)\n\n\t\t@monster = Monster.new 7, width, height\n\t\tstroke_width(160)\n\tend",
"def rainbowIntro(viewport=nil)\n @viewport = viewport if !@viewport && !viewport.nil?\n @sprites = {} if !@sprites\n # takes screenshot\n bmp = Graphics.snap_to_bitmap\n # creates non-blurred overlay\n @sprites[\"bg1\"] = Sprite.new(@viewport)\n @sprites[\"bg1\"].bitmap = Bitmap.new(@viewport.width, @viewport.height)\n @sprites[\"bg1\"].bitmap.blt(0, 0, bmp, @viewport.rect)\n @sprites[\"bg1\"].center!(true)\n # creates blurred overlay\n @sprites[\"bg2\"] = Sprite.new(@viewport)\n @sprites[\"bg2\"].bitmap = @sprites[\"bg1\"].bitmap.clone\n @sprites[\"bg2\"].blur_sprite(3)\n @sprites[\"bg2\"].center!(true)\n @sprites[\"bg2\"].opacity = 0\n # creates rainbow rings\n for i in 1..2\n z = [0.35, 0.1]\n @sprites[\"glow#{i}\"] = Sprite.new(@viewport)\n @sprites[\"glow#{i}\"].bitmap = pbBitmap(\"Graphics/EBDX/Transitions/Common/glow\")\n @sprites[\"glow#{i}\"].ox = @sprites[\"glow#{i}\"].bitmap.width/2\n @sprites[\"glow#{i}\"].oy = @sprites[\"glow#{i}\"].bitmap.height/2\n @sprites[\"glow#{i}\"].x = @viewport.width/2\n @sprites[\"glow#{i}\"].y = @viewport.height/2\n @sprites[\"glow#{i}\"].zoom_x = z[i-1]\n @sprites[\"glow#{i}\"].zoom_y = z[i-1]\n @sprites[\"glow#{i}\"].opacity = 0\n end\n # main animation\n for i in 0...32.delta_add\n # zooms in the two screenshots\n @sprites[\"bg1\"].zoom_x += 0.02/self.delta\n @sprites[\"bg1\"].zoom_y += 0.02/self.delta\n @sprites[\"bg2\"].zoom_x += 0.02/self.delta\n @sprites[\"bg2\"].zoom_y += 0.02/self.delta\n # fades in the blurry screenshot\n @sprites[\"bg2\"].opacity += 12/self.delta\n # fades to white\n if i >= 16.delta_add\n @sprites[\"bg2\"].tone.all += 16/self.delta\n end\n # zooms in rainbow rings\n if i >= 28.delta_add\n @sprites[\"glow1\"].opacity += 64/self.delta\n @sprites[\"glow1\"].zoom_x += 0.02/self.delta\n @sprites[\"glow1\"].zoom_y += 0.02/self.delta\n end\n Graphics.update\n end\n @viewport.color = Color.new(255, 255, 255, 0)\n # second part of animation\n for i in 0...48.delta_add\n # zooms in rainbow rings\n @sprites[\"glow1\"].zoom_x += 0.02/self.delta\n @sprites[\"glow1\"].zoom_y += 0.02/self.delta\n if i >= 8.delta_add\n @sprites[\"glow2\"].opacity += 64/self.delta\n @sprites[\"glow2\"].zoom_x += 0.02/self.delta\n @sprites[\"glow2\"].zoom_y += 0.02/self.delta\n end\n # fades viewport to white\n if i >= 32.delta_add\n @viewport.color.alpha += 16/self.delta\n end\n Graphics.update\n end\n @viewport.color = Color.white\n # disposes of the elements\n pbDisposeSpriteHash(@sprites)\n EliteBattle.set(:colorAlpha, 255)\n return true\n end",
"def draw\n @font.draw(Const::SERVER_WAIT, @window.width / 5,\n @window.height / 2 - Const::GAME_WIN_GAP, 0)\n @font.draw(\"#{Const::SERVER_PORT}#{@port}\", @window.width / 3.5,\n @window.height / 2, 0)\n @title_image.draw(@img_x, @img_y, 1, @img_size_factor, @img_size_factor)\n end",
"def setup\n size 640, 360 \n \n stroke 255\n no_fill\nend",
"def init\r\n\r\n Curses.noecho\r\n Curses.start_color\r\n Curses.init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK)\r\n Curses.init_pair(COLOR_RED, COLOR_RED, COLOR_WHITE)\r\n\r\n @@now = Time.now\r\n @@before_time = @@now\r\n\r\n @@limit = @@max_limit\r\n\r\n end",
"def init_actorsprites\r\n # Make actor sprites\r\n @actor_sprites = []\r\n @actor_sprites.push(Sprite_Battler.new(@viewport2))\r\n @actor_sprites.push(Sprite_Battler.new(@viewport2))\r\n @actor_sprites.push(Sprite_Battler.new(@viewport2))\r\n @actor_sprites.push(Sprite_Battler.new(@viewport2))\r\n end",
"def initialize(actor)\n super(Input_Window_Settings[0], Input_Window_Settings[1], actor.bar_size + 32, 64)\n self.contents = Bitmap.new(width - 32, height - 32)\n self.z = 4000\n if Input_Window_Bg != nil\n @background_image = Sprite.new\n @background_image.bitmap = RPG::Cache.windowskin(Input_Window_Bg)\n @background_image.x = self.x + Input_Window_Bg_Postion[0]\n @background_image.y = self.y + Input_Window_Bg_Postion[1]\n @background_image.z = self.z - 1\n @background_image.visible = self.visible\n end\n self.back_opacity = Input_Window_Settings[2]\n self.opacity = Input_Window_Settings[2] if Input_Window_Settings[3] \n @actor = actor\n create_input_images if Input_Images\n refresh\n end",
"def setup_display\n gameboard.build_display\n build_white_side\n build_black_side\n end",
"def initialize(x, y, args)\n speed_values = args.state.speed_values\n @x_vel = speed_values[rand(speed_values.length)]\n @y_vel = speed_values[rand(speed_values.length)]\n @truex = x - @x_vel\n @truey = y - @y_vel\n @w = 10\n @h = 10\n @x = x - (@w / 2)\n @y = y - (@h / 2)\n @r = 255\n @g = 255\n @b = 255\n @a = 2558\n @path = 'sprites/black.png'\n args.outputs.static_sprites << self\n end",
"def run\n super\n \n net_service = _get_entity_name\n \n target = net_service.split(\":\").first\n port = net_service.split(\":\").last.split(\"/\").first\n \n unless port == \"3389\"\n _log \"Incorrect RDP port! Will not perform certificate extraction.\"\n return\n end\n \n rdesktop_command = \"xvfb-run scrying -t rdp://#{target} -o /tmp/scrying_outputs\"\n _log \"Running: #{rdesktop_command}\"\n _unsafe_system(rdesktop_command)\n \n if File.file?(\"/tmp/scrying_outputs/rdp/#{target}-3389.png\")\n _log \"Found screenshot! Attaching to entity as detail\"\n # todo, set image as entity detail\n screenshot_image = Base64.strict_encode64(File.read(\"/tmp/scrying_outputs/rdp/#{target}-3389.png\"))\n _set_entity_detail \"extended_screenshot_contents\", screenshot_image\n _set_entity_detail \"screenshot_exists\", true\n\n \n # delete temporary screenshot file\n _unsafe_system(\"rm /tmp/scrying_outputs/rdp/#{target}-3389.png\")\n else\n _set_entity_detail \"screenshot_exists\", false\n end\n\n end",
"def draw\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, @y, @x + @size, @y + @size)\n end",
"def create_screen(w = 640, h = 480, bpp = 16, flags = SDL::SWSURFACE)\n init\n self.screen ||= SDL.set_video_mode(w, h, bpp, flags).tap{|o|\n def o.update(x = 0, y = 0, w = 0, h = 0)\n update_rect(x, y, w, h)\n end\n }\n end",
"def graphic\n\n\t\topt = resource[:graphics]\n\t\tcase opt\n\t\t\twhen :enable || nil then args = [\"--vnc\"]\n\t\t\twhen :disable then args = [\"--nographics\"]\n\t\t\telse args = [\"--vncport=\" + opt.split(':')[1]]\n\t\tend\n\t\targs\n\n end",
"def setup_main_window\n main_window = Curses::Window.new(48, 60, 0, 0)\n main_window.attron(Curses.color_pair(8))\n main_window.box('|', '-')\n main_window.noutrefresh\n main_window\nend"
] |
[
"0.64196277",
"0.61500865",
"0.6149609",
"0.60725325",
"0.60695654",
"0.5986396",
"0.59153575",
"0.5892777",
"0.58486634",
"0.5818615",
"0.5808936",
"0.57825184",
"0.57356095",
"0.5685138",
"0.5645222",
"0.5634565",
"0.5628851",
"0.5623956",
"0.5614604",
"0.56089425",
"0.5603214",
"0.5599866",
"0.55728096",
"0.5563215",
"0.5559391",
"0.55149066",
"0.55118066",
"0.55009",
"0.5498",
"0.5488288",
"0.54792845",
"0.5472134",
"0.54587936",
"0.5458436",
"0.54553026",
"0.5452726",
"0.5450155",
"0.5449995",
"0.5445032",
"0.54388",
"0.5425169",
"0.54211694",
"0.54190457",
"0.5417753",
"0.54143614",
"0.54094905",
"0.540073",
"0.53966266",
"0.53874594",
"0.5383826",
"0.5376228",
"0.5362917",
"0.53587675",
"0.5357354",
"0.5349083",
"0.5348441",
"0.5331027",
"0.53230673",
"0.532233",
"0.5316578",
"0.5314576",
"0.53035855",
"0.5296407",
"0.52912647",
"0.5287578",
"0.5287402",
"0.52874017",
"0.52865374",
"0.52863413",
"0.5283126",
"0.5280507",
"0.5271315",
"0.5271132",
"0.5265699",
"0.52655655",
"0.5264117",
"0.52537256",
"0.5246459",
"0.52432317",
"0.5234631",
"0.523174",
"0.52304643",
"0.5224681",
"0.5216962",
"0.5211278",
"0.520381",
"0.52037495",
"0.5200243",
"0.51992327",
"0.5197103",
"0.5196605",
"0.51963615",
"0.5195014",
"0.518921",
"0.51869565",
"0.51850426",
"0.5183799",
"0.51833785",
"0.5182833",
"0.5182482"
] |
0.67981416
|
0
|
we want a name that start with capital
|
def capitalize_name
self.name = name.sub(/\S/, &:upcase) unless name.nil?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def snake_case(name); end",
"def proper_name(name)\n return name if name =~ /[[:upper:]]/\n\n name.gsub(/\\b[[:alpha:]]+/) { |w| w =~ PARTICLE_REGEX ? w : w.capitalize }\n end",
"def capitalize() end",
"def downcase_name\n name.downcase!\n end",
"def capitalize!() end",
"def snakecase(name)\n name.gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').downcase\n end",
"def capitalized\n name.titleize.capitalize\n end",
"def name\n camel = self.class.to_s.gsub(/.*::/, '')\n camel.gsub(/(\\S)([A-Z])/, '\\1_\\2').downcase\n end",
"def ucfirst\n self.sub(/^(\\w)/) { |s| s.capitalize }\n end",
"def snake_case(name)\n name.gsub(/([a-z])([A-Z0-9])/, '\\1_\\2' ).downcase\nend",
"def normalize_name(name)\n CapitalizeNames.capitalize(name)\n end",
"def name_case!\n self.gsub!(self, self.name_case)\n end",
"def namify\n self.name.split(\" \").map{|x| x.first.capitalize}[0..1].join(\"\")\n end",
"def camel_case\n gsub /(?:^|_)(.)/ do $1.upcase end\n end",
"def lowercase_name\n name.downcase\n end",
"def caps(name)\n\tputs \"#{name.upcase}\"\nend",
"def capitalize_name\n self.name = self.name.split.collect(&:capitalize).join(' ') if self.name && !self.name.blank?\n end",
"def uppercase_name\n self.name = name.split.map(&:capitalize).join(' ')\n self.location = location.split.map(&:capitalize).join(' ')\n end",
"def initial(name)\n name.scan(/[[:upper:]]/).first.to_s\n end",
"def case_fix(name)\r\n fixed_name = name.split(' ')\r\n fixed_name.each do |word|\r\n word.capitalize!\r\n end\r\n fixed_name.join(' ')\r\nend",
"def camel_case(name)\n if name.include? '_'\n name.split('_').map{|e| e.capitalize}.join\n else\n unless name =~ (/^[A-Z]/)\n name.capitalize\n else\n name\n end\n end\nend",
"def capitalize\n \"Foo\"\n end",
"def spy_name(real_name)\n capitalize(next_letter(swap(real_name)))\nend",
"def name ; self[:name].downcase end",
"def short_name \r\n name.gsub(/([A-Z])[^A-Z]+/, '\\1')\r\n end",
"def downcase() end",
"def snakecase(string); end",
"def camel_case(str); end",
"def camelize(name, uc_first=true)\n parts = name.to_s.split('_')\n assemble = lambda { |head, tail| head + tail.capitalize }\n uc_first ? parts.inject('', &assemble) : parts.inject(&assemble)\n end",
"def oracle_upcase(name)\n name =~ /[A-Z]/ ? name : name.upcase\n end",
"def upcase\n @name.upcase\n end",
"def camelcase(s)\n\n\nend",
"def prepare_name(name)\n name.to_s.upcase\n end",
"def downcase!() end",
"def titlecase\n\t\tsplit(/(\\W)/).map(&:capitalize).join\n\tend",
"def uppercase_name\n # self.name.upcase\n name.upcase #self is the implicit reciever\n end",
"def to_name(name)\n name.to_s.downcase\n end",
"def capitalize(input); end",
"def upcase() end",
"def titlecase()\r\n ignore_list = %w{of etc and by the for on is at to but nor or a via}\r\n capitalize_all_ex(ignore_list)\r\n end",
"def human_name\n name.capitalize.to_s\n end",
"def camelcase(name)\n name = name.to_s\n name.split('_').each do |n|\n # Numbers won't be recognized as a split point when going back to underscore, so need to\n # register this field beginning with a number as an acronym\n @required_acronyms << n if n =~ /^\\d/\n end\n name.camelcase\n end",
"def capital(skip_prefixed_underscores: false)\n LuckyCase.capitalize self, skip_prefixed_underscores: skip_prefixed_underscores\n end",
"def downcase; end",
"def name\n @name.capitalize\n end",
"def name\n @name.capitalize\n end",
"def capitalize(skip_prefixed_underscores: false)\n self.capital skip_prefixed_underscores: skip_prefixed_underscores\n end",
"def capitalize_names!\n @artist_name = StringUtils.mixed_case(@artist_name)\n @name = StringUtils.mixed_case(@name)\n @subtitle = StringUtils.mixed_case(@subtitle)\n @genre = StringUtils.mixed_case(@genre)\n @mixer = StringUtils.mixed_case(@mixer)\n @version_name = StringUtils.mixed_case(@version_name)\n @version_name.gsub!(/(\\A|\\s)(Version|Release)\\b/) {|string| string.downcase} if @version_name\n end",
"def oracle_upcase(name)\n name =~ /[A-Z]/ ? name : name.upcase\n end",
"def gen_name\n name.to_s.downcase\n end",
"def capitalize\n `return self.charAt(0).toUpperCase() + self.substr(1).toLowerCase();`\n end",
"def capitalize\n `return self.charAt(0).toUpperCase() + self.substr(1).toLowerCase();`\n end",
"def caps(str)\n str.upcase\n end",
"def capitalize_name!\n @fullname = @fullname.upcase\n return @fullname.upcase\n end",
"def capitalize\n (self.to_s.capitalize! || self).to_sym\n end",
"def to_camel_case\n return self if self !~ /_/ && self !~ /\\s/ && self =~ /^[A-Z]+.*/\n\n gsub(/[^a-zA-Z0-9ññÑáéíóúÁÉÍÓÚüÜ_]/, \"_\")\n .split(\"_\").map(&:capitalize).join\n end",
"def title_case\n\t\tself.split.collect{ |s| s.capitalize_first }.join(\" \")\n\tend",
"def camel_case\n return self if self !~ /_/ && self =~ /[A-Z]+.*/\n split('_').map{|e| e.capitalize}.join\n end",
"def camel_case\n return self if self !~ /_/ && self =~ /[A-Z]+.*/\n split('_').map{|e| e.capitalize}.join\n end",
"def titlecase(input)\n input.titlecase\n end",
"def mixed_case(name)\n\tname.downcase.gsub(/\\b\\w/) {|first| first.upcase}\nend",
"def titlecase!\n replace(titlecase)\n end",
"def upcase!() end",
"def name_upper\n return GameData::Text.get(0,@step_remaining==0 ? @id : 0).upcase\n end",
"def capitalize_names!\n @artist_name = StringUtils.mixed_case(@artist_name)\n @name = StringUtils.mixed_case(@name)\n @genre = StringUtils.mixed_case(@genre)\n @mixer = StringUtils.mixed_case(@mixer)\n end",
"def get_camel_caps input\n tmp = input.split(\"_\")\n tmp.each do |x|\n x.downcase!\n x.capitalize!\n end\n return tmp.join(\"\")\n end",
"def camel(snake_case)\n snake_case.to_s.capitalize.gsub(/_./) { |match| match[1].upcase }\n end",
"def snake_case\n return downcase if match(/\\A[A-Z]+\\z/)\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z])([A-Z])/, '\\1_\\2').\n downcase\n end",
"def titlecase\n gsub(/\\b\\w/){ $`[-1,1] == \"'\" ? $& : $&.upcase }\n end",
"def camelize!\n self.titleize!\n self.replace(self[0, 1].downcase + self[1..-1])\n end",
"def copy_name_to_lowercase_name\n self.lowercase_name = File.basename(self.github_url.to_s).presence || name.to_s.downcase.parameterize\n end",
"def caps(string)\n return string.upcase\nend",
"def caps(string)\n return string.upcase\nend",
"def is_upper?(c)\n return c == c.capitalize\n end",
"def formalize_marker_name marker\r\n if marker\r\n marker = marker.delete(' ')\r\n marker = marker.downcase\r\n marker = marker.capitalize\r\n end\r\n return marker\r\n end",
"def is_lower?(c)\n return c != c.capitalize\n end",
"def snake_case\n self.gsub(/([a-z])([A-Z])/) {|s| \"#{s[0]}_#{s[1]}\"}.gsub(/([A-Z])([A-Z][a-z])/) {|s| \"#{s[0]}_#{s[1..2]}\"}.downcase\n end",
"def undercover_name(name)\n name.downcase.split(' ').map!{|name| name.split('').map! {|letter| next_letter(letter)}.join('').capitalize}.reverse.join(\" \")\nend",
"def name_with_middle; end",
"def snake_case2\n (self.gsub! /(.)([A-Z])/, '\\1_\\2').downcase\n rescue\n self\n end",
"def name=(name)\r\n @name = name.capitalize\r\n end",
"def mixed_case_2(name)\n\tname.downcase.gsub(/\\b\\w/, &:upcase)\nend",
"def origName(name)\n\t\treturn @origName[name.downcase]\n\tend",
"def snake_case(str); end",
"def shortname\n name.downcase.gsub(/[^a-z]/, \"\")\n end",
"def camel_case\n return self if self !~ /_/ && self =~ /[A-Z]+.*/\n split('_').map{|e| e.capitalize}.join\n end",
"def first_name\n self.name.split(' ').first.titlecase\n end",
"def humanize\n self.downcase.gsub(/_/, \" \").capitalize\n end",
"def name= string\n super(string ? string.downcase : string)\n end",
"def downcase(input); end",
"def name\n self.title.downcase.split(' ').join(\"_\")\n end",
"def human_name\n Helpers.underscore(@name)\n end",
"def titleize\n self.underscore.humanize.gsub(/\\b(?<!['’`])[a-z]/) { $&.capitalize }\n end",
"def capitalize(word)\n\nend",
"def snakify\n return downcase if match(/\\A[A-Z]+\\z/)\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z])([A-Z])/, '\\1_\\2').\n downcase\n end",
"def change_name(original)\n original.gsub!(' ','_')\n INVALID_CHARS.split('').each do |char|\n original.gsub!(char,'')\n end\n original.downcase\n end",
"def upcase; end",
"def objective_name snake_name\n\tsnake_name.split(\"_\").reduce(\"\") { |result, part| \n\t\tif result != \"\"\n\t\t\tresult + part.capitalize\n\t\telse\n\t\t\tpart\n\t\tend\n\t}\nend",
"def pascalcase_to_snakecase(word)\n\tword.gsub(/\\B([A-Z])(?=[a-z0-9])|([a-z0-9])([A-Z])/, '\\2_\\+').downcase\nend",
"def fix_capitalized_species_epithet(str)\n # Is second word capitalized?\n return str unless str.match?(/^\\S+ [A-Z]/)\n\n # Trust it if there is actually a name with that author present.\n return str if Name.find_by(search_name: str).present?\n\n # Try converting second word to lowercase.\n str2 = str.sub(/ [A-Z]/, &:downcase)\n\n # Return corrected name if that name exists, else keep original name.\n if Name.where(search_name: str2).or(Name.where(text_name: str2)).present?\n str2\n else\n str\n end\n end"
] |
[
"0.8480844",
"0.79358935",
"0.79127574",
"0.7908961",
"0.7896077",
"0.7847313",
"0.78266174",
"0.78051573",
"0.7730899",
"0.76901996",
"0.76875067",
"0.7671091",
"0.7629492",
"0.7627836",
"0.7615682",
"0.7610093",
"0.7604014",
"0.7603991",
"0.76028335",
"0.7601348",
"0.7596056",
"0.7593279",
"0.7583026",
"0.7577004",
"0.7554271",
"0.75508624",
"0.7541987",
"0.75063884",
"0.7453805",
"0.7447106",
"0.7436158",
"0.7435726",
"0.74347496",
"0.7410169",
"0.7400315",
"0.7377449",
"0.737436",
"0.7359963",
"0.7352308",
"0.7345866",
"0.732728",
"0.7313374",
"0.73098457",
"0.7294825",
"0.729296",
"0.729296",
"0.729142",
"0.7267004",
"0.7251138",
"0.7229921",
"0.72291505",
"0.72291505",
"0.7219838",
"0.72125876",
"0.71945226",
"0.71740973",
"0.7170036",
"0.7167402",
"0.7167402",
"0.7167092",
"0.71581763",
"0.71560454",
"0.7153634",
"0.71515805",
"0.7150733",
"0.7130346",
"0.7130039",
"0.71206886",
"0.7118192",
"0.71162707",
"0.7105521",
"0.71042275",
"0.71042275",
"0.7098634",
"0.7096711",
"0.70940363",
"0.70868087",
"0.7086436",
"0.7085239",
"0.7079176",
"0.70789933",
"0.7064208",
"0.70610243",
"0.7057665",
"0.7042822",
"0.7037071",
"0.7034543",
"0.703134",
"0.70286924",
"0.7017364",
"0.7015244",
"0.70149887",
"0.7011917",
"0.7004155",
"0.6998315",
"0.69960785",
"0.69937086",
"0.69934726",
"0.69907963",
"0.6986336"
] |
0.75121486
|
27
|
The name of the parser.
|
def parser
attributes.fetch(:parser)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parser_to_name(parser_name)\n parser_name.split(\"_\").map(&:capitalize).join(\" \")\nend",
"def __name__() @__grammar__.name end",
"def name\n @name ||= (@config[:name] || self.class.name.split(/::/).last.titleize)\n end",
"def name\n self.text =~ /^(.*)$/\n return $1\n end",
"def name\n @name ||= path.split('/').last\n end",
"def browser_name\n browser_parser.name\n end",
"def tag_name\n @tag_name ||= name && name.to_s.split(\"::\")[-1].downcase\n end",
"def parser(name = T.unsafe(nil)); end",
"def name\n @name ||= to_s.split(\"#\").last.delete(\">\")\n end",
"def has_parser?(name); end",
"def tag_name\n self.class.name.downcase.match(/[^:]+$/)[0]\n end",
"def name\n $0.split(\"/\").last\n end",
"def name\n @token\n #match(/^Information\\son\\s([^\\s]+)/)\n end",
"def name\n @name ||= section.symstr.name_at(header.st_name)\n end",
"def my_name\n @my_name ||= self.class.name.split(\"::\").last\n end",
"def name\n NAME\n end",
"def option_parser_short_name\n [ short_prefix, short_name ].join('')\n end",
"def ___name\n @name\n end",
"def filename\n @__lexer.filename\n end",
"def __name\n @name\n end",
"def name\n self.class.name.split(\"::\").last\n end",
"def name\n @name ||= self.class.non_namespaced_name\n end",
"def parser\n if !defined?(@parser) || !@parser\n DEFAULT_PARSER\n else\n @parser || DEFAULT_PARSER\n end\n end",
"def name\n self.class.name.split('::').last\n end",
"def name\n self.class.name.split('::').last\n end",
"def plugin_name\n name.split('::').last.underscore.to_sym\n end",
"def name\n self.class.name.split(\"::\").last.downcase\n end",
"def lexer_name_for(*args)\n # Pop off the last arg if it's a hash, which becomes our opts\n if args.last.is_a?(Hash)\n opts = args.pop\n else\n opts = {}\n end\n\n if args.last.is_a?(String)\n code = args.pop\n else\n code = nil\n end\n\n mentos(:lexer_name_for, args, opts, code)\n end",
"def nextName\n\t while @currInput.pos >= @currInput.length\n\t\t@inputStack.pop()\n\t\t@currInput = @inputStack.last\n\t end\n\n\t @currInput.string[@currInput.pos .. -1] =~ NAME_REGEX\n\t name = $1\n\t if name.nil?\n\t\tstr = \"expected name but saw illegal non-name character\"\n\t\traise ParserError.new(str, self)\n\t end\n\t skipChars(name.length)\n\t return name\n\tend",
"def parser_for_version(version)\n require \"parser/#{version}\"\n Parser.const_get version.capitalize\n end",
"def name\n return self.class.name.split('::').last\n end",
"def my_name \n @my_name ||= self.class.name.split(\"::\").last\n end",
"def description\n parser.description\n end",
"def simple_name\n name.split('::').last\n end",
"def simple_name\n name.split('::').last\n end",
"def name\n @token\n #match(/^Information\\son\\s([&#+][^:]+):$/)\n end",
"def name\n # override this after inheriting\n # should return a string with no spaces\n # this is the name used to reference the validator in config files\n raise NotImplementedError\n end",
"def kramdown_parser(name)\n get_config_val(@kramdown_parsers, name)\n end",
"def getName()\n\t\t\treturn @_name\n\t\tend",
"def name\n definition[:name]\n end",
"def parse_name\n name = ''\n content = file_content\n\n s = content.index(NAME_START_DELIMITER)\n e = content.index(NAME_END_DELIMITER)\n\n unless s.nil?\n s += NAME_START_DELIMITER.size\n name = content[s..e-1].strip\n end\n\n return name\n end",
"def name\n return @name if @name\n\n @name =\n @call_seq[/^.*?\\.(\\w+)/, 1] ||\n @call_seq[/^.*?(\\w+)/, 1] ||\n @call_seq if @call_seq\n end",
"def name\n end",
"def name\n @name ||= @node['name']\n end",
"def name\n @name || path_name\n end",
"def name(formatter = nil)\n f = self.class.name_formatter(formatter)\n if formatter\n eval('\"' + f[:string] + '\"')\n else\n @name ||= eval('\"' + f[:string] + '\"')\n end\n end",
"def element_parse_naming\n OBJ_ELEMENT_PARSE_NAMING\n end",
"def name\n\n tree[0]\n end",
"def name\n @name ||= @node['name']\n end",
"def name\n (@name ||= namespace).to_s.underscore.symbolize\n end",
"def parser\n @parser ||= Parser.new(self)\n end",
"def parser\n @parser ||= Parser.new(self)\n end",
"def name\n options[:name]\n end",
"def initialize parser\n @parser = parser\n end",
"def tagname\n @node[0].gsub(/[^a-zA-Z]/, \"\")\n end",
"def name\n @name ||= filename.split(\".\").first.sub(/^_/, \"\")\n end",
"def default_graphql_name\n to_s.split(\"::\").last.sub(/\\Z/, \"\")\n end",
"def name\n @_name\n end",
"def name\n options[:name]\n end",
"def name\n self.class.name.split('::').last\n end",
"def browser_sym\n browser_parser.sym\n end",
"def name() return @name end",
"def name() return @name end",
"def parser\n @parser ||= Parser.new(self)\n end",
"def name\n node.name\n end",
"def name\n node.name\n end",
"def name\n self.class.name.split(\"Ohai::NamedPlugin::\")[1].to_sym\n end",
"def name\n @name ||= parse_name(id.name)\n end",
"def name\n self.class.to_s.split('::').last\n end",
"def name(options = {})\n @name\n end",
"def name\n end",
"def name\n [self[:namespace], self[:short_name]].reject(&:blank?).join(Tag.namespace_separator)\n end",
"def name\n raise \"No name defined for #{self.class}\"\n end",
"def element_parse_naming\n XML_ELEMENT_PARSE_NAMING\n end",
"def parser_params\n params[:parser]\n end",
"def parser\n Parser.new(self, :mode=>mode)\n end",
"def command_name\n @command_name ||= if command = name.to_s.split(\"::\").last\n command.chomp!(\"Command\")\n command.underscore\n end\n end",
"def name\n @name ||= self.class.name\n end",
"def parse_name(name)\n name = name.to_s\n @title = name.capitalize unless @title\n name\n end",
"def name\n @root_name\n end",
"def name() end",
"def name\n\t\treturn @name\n\tend",
"def family\n BROWSER_PARSERS[family_sym]\n end",
"def name\n @name ||= self.to_s.demodulize.underscore\n end",
"def ruby_name\n @ruby_name || @name\n end",
"def parser\n create_option_parser if @parser.nil?\n @parser\n end",
"def name\n @name ||= @project.dir.path.match(/.*\\/(.*)$/).nil? ? \"unknown\" : $1\n end",
"def name\n @name\n end",
"def get_token_name\n @@token_list[@state - 1]\n end",
"def name()\n return @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n @name\n end",
"def name\n self[ :name ]\n end",
"def parse\n split_name\n Governator::Name.new(original, first, middle, nickname, last, suffix)\n end"
] |
[
"0.7134003",
"0.6830112",
"0.63767326",
"0.6350017",
"0.6295229",
"0.62603974",
"0.6214667",
"0.6205194",
"0.61756384",
"0.6131977",
"0.6127147",
"0.6067495",
"0.606744",
"0.6046374",
"0.60438764",
"0.6021423",
"0.6008149",
"0.6004922",
"0.599922",
"0.5977121",
"0.59762365",
"0.59551114",
"0.5952841",
"0.5940727",
"0.59248614",
"0.59225357",
"0.59213054",
"0.5915152",
"0.59067345",
"0.59016",
"0.58945704",
"0.5890975",
"0.588544",
"0.58848345",
"0.58848345",
"0.5884506",
"0.58809",
"0.5857851",
"0.5848223",
"0.5840774",
"0.5830064",
"0.5826103",
"0.5817314",
"0.5816197",
"0.5814099",
"0.58130133",
"0.57963294",
"0.57819897",
"0.5779853",
"0.57688487",
"0.57688344",
"0.57688344",
"0.5760216",
"0.5728167",
"0.57278305",
"0.5725677",
"0.572106",
"0.5715528",
"0.5714898",
"0.5710082",
"0.57081187",
"0.5707677",
"0.5707677",
"0.5697503",
"0.56972045",
"0.56972045",
"0.5696846",
"0.5692686",
"0.5686836",
"0.5677694",
"0.5669774",
"0.5668491",
"0.5662889",
"0.5662581",
"0.56501096",
"0.56481457",
"0.56476194",
"0.5646446",
"0.5644395",
"0.5640204",
"0.5638452",
"0.563793",
"0.5637145",
"0.5636518",
"0.5633787",
"0.5632271",
"0.5632172",
"0.5625157",
"0.5621596",
"0.56146944",
"0.56131923",
"0.56131923",
"0.56131923",
"0.56131923",
"0.56131923",
"0.56131923",
"0.56131923",
"0.56131923",
"0.56119734",
"0.5609397"
] |
0.5858677
|
37
|
The version of the parser.
|
def version
attributes.fetch(:version)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def http_version\n @parser.http_version\n end",
"def version()\r\n return ParseDecision::VERSION\r\n end",
"def version\n @version || 0\n end",
"def version\n @version\n end",
"def version\n @version ||= File.read(file)[version_regex]\n end",
"def version\n VERSION\n end",
"def version\n VERSION\n end",
"def version\n 0\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n @version ||= '1.0'\n end",
"def version_number\n @version\n end",
"def version\n @version ||= __determine_version\n end",
"def version\n @__version\n end",
"def version\n logger.debug \"Parsing version from output using #{description}\"\n matches = output.match PARSE_VERSION_FROM_OUTPUT\n raise InvalidFormat.new output if matches.nil?\n matches.captures[0]\n end",
"def version\n root.attribute('version').value.split('.').map { |n| n.to_i }\n end",
"def version\n @version ||= File.read(path('version.txt')).strip\n end",
"def version\n options['version']\n end",
"def version\n self[:version]\n end",
"def version\n resolved_version\n end",
"def version\n m = VERSION_REGEX.match(@text)\n return -1 unless m\n\n m[1].to_i\n end",
"def version\n read_property 'Version'\n end",
"def version\n 1\n end",
"def version\n @version ||= '1.0'\n end",
"def ver\n @values['ver']\n end",
"def version_number\n return @version_number\n end",
"def version\n VERSION\n end",
"def version\n VERSION\n end",
"def version\n VERSION\n end",
"def version\n @version ||= File.read(path('version.txt')).strip\n end",
"def description\n \"Derelict::Parser::Version instance\"\n end",
"def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end",
"def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end",
"def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end",
"def version\n next_version\n end",
"def version\n puts \"v0.3\"\n end",
"def getVersion\r\n\t\t\t\t\treturn @version\r\n\t\t\t\tend",
"def version\n @version ||= version_hex.to_s(16).chars.entries.join('.')\n end",
"def version\n @version ||= @doc.at('/document/@SSLyzeVersion').value.split(' ',2).last\n end",
"def version\n version_property ? version_property.ruby_value : nil\n end",
"def get_version\n\t\tend",
"def version\n case @version\n when Module\n \"#{@version::Major}.#{@version::Minor}.#{@version::Release}\"\n when Proc # not sure about this\n @version.call\n when NilClass\n 'unknown'\n else\n @version\n end\n end",
"def version\n name.split('_')[1]\n end",
"def current_version\n @version\n end",
"def get_version()\n\t\tend",
"def version\n @version ||= create_version\n end",
"def version\n VersionInfo.new(command(\"Browser.getVersion\"))\n end",
"def version\n build_string\n end",
"def version\n (version_from_class.to_f / 10).to_s\n end",
"def version\n '2.0.7.7' # Version number <major-update>.<minor-update>.<patch-update>.<commit-count>\n end",
"def version\n cmd(COMMANDS[:version], 2)\n end",
"def version\n @version.dup\n end",
"def version\n @version.dup\n end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version\n @version ||= data.version\n end",
"def version(version = nil)\n @version = version if version\n @version\n end",
"def version\n @version ||= File.open(@filename) do |io|\n io.read(8)[5..-1].to_sym\n end\n end",
"def version\n @spec.version\n end",
"def version\n @version ||= exec('SHOW server_version')[0]['server_version'].split[0]\n end",
"def current_version\n version_number rev\n end",
"def version\n nil\n end",
"def version\n return last_version if versionable?\n version_number\n end",
"def version\n \"0.2.0\"\n end",
"def semver_version\n return @semver.format '%M.%m.%p' if @semver\n nil\n end",
"def version\n\t\treturn @version ||= self.find_version\n\tend",
"def parser_for_version(version)\n require \"parser/#{version}\"\n Parser.const_get version.capitalize\n end",
"def version\n self.class.version\n end",
"def version\n versions.last.miq_semver.split(\".\").first + \".0.0\"\n end",
"def version\n super.to_s\n end",
"def version\n super.to_s\n end",
"def version\n nil\n end",
"def version s=nil; @version = s if s; @version end"
] |
[
"0.77527565",
"0.76115483",
"0.7453702",
"0.74077964",
"0.7375093",
"0.7334682",
"0.73187536",
"0.7303047",
"0.7299586",
"0.7299586",
"0.7299586",
"0.7299586",
"0.7299586",
"0.7299586",
"0.7299586",
"0.7299586",
"0.7299586",
"0.72762567",
"0.72730726",
"0.7269243",
"0.7261451",
"0.72582084",
"0.72527933",
"0.72341704",
"0.7161143",
"0.7141094",
"0.7116549",
"0.7114312",
"0.70906943",
"0.7083992",
"0.7076832",
"0.70746964",
"0.7073495",
"0.7048049",
"0.7048049",
"0.7048049",
"0.704738",
"0.70385087",
"0.70376575",
"0.70375353",
"0.70375353",
"0.6996966",
"0.6995901",
"0.69957185",
"0.69812155",
"0.6977454",
"0.69731295",
"0.69649607",
"0.69633764",
"0.69545335",
"0.6943546",
"0.6940567",
"0.69260454",
"0.6918721",
"0.69176745",
"0.6915258",
"0.69040203",
"0.6899833",
"0.6892434",
"0.6892434",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68891895",
"0.68833274",
"0.68617857",
"0.68556106",
"0.6854701",
"0.685441",
"0.6835137",
"0.68340605",
"0.68333256",
"0.682958",
"0.68211466",
"0.681756",
"0.681684",
"0.6807241",
"0.6805286",
"0.6798922",
"0.6798922",
"0.6786342",
"0.67746496"
] |
0.0
|
-1
|
Converts Blockly xml into a Blockly::Code object.
|
def parse(xml_text)
xml = XmlSimple.xml_in(xml_text, { 'ForceContent' => true })
parse_block(xml['block'][0])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def from_xml(xml)\n\t\tend",
"def parse_lang_for_codeblock(source); end",
"def compile(xml)\n XML.default_line_numbers = true\n\n doc = nil\n\n if xml.is_a?(String)\n doc = LibXML::XML::Document.string xml\n doc = doc.root\n elsif xml.is_a?(LibXML::XML::Document)\n doc = xml.root\n else\n doc = xml\n end\n\n @context.compile_structural(doc)\n end",
"def parse_codeblock; end",
"def parse_xml(xml)\n new from_xml(xml)\n end",
"def from_xml(*args, &block)\n create_represented(*args, &block).from_xml(*args)\n end",
"def make_ast(code)\n YARD::Parser::Ruby::RubyParser.new(code, nil).parse.ast\n end",
"def codify(txt)\n enclose('code', txt)\n end",
"def parse(code, version=1.8)\n config = version == 1.8 ? CONFIG_18 : CONFIG_19\n PARSER.parse \"<code>\", source(code), config\n end",
"def parse(code, version=1.8)\n config = version == 1.8 ? CONFIG_18 : CONFIG_19\n PARSER.parse \"<code>\", source(code), config\n end",
"def parse_code(code)\n p Parser::CurrentRuby.parse(code)\n end",
"def thru_coderay\n gsub %r{<(code)(.*?)>(.*?)</\\1>}m do\n atts, code = $2, CGI.unescapeHTML($3)\n\n lang =\n if $2 =~ /lang=('|\")(.*?)\\1/i\n $2\n else\n :ruby\n end\n\n tag =\n if code =~ /\\n/\n :pre\n else\n :code\n end\n\n html = CodeRay.scan(code, lang).html(:css => :style)\n\n %{<#{tag} class=\"code\"#{atts}>#{html}</#{tag}>}\n end\n end",
"def parse(code, file = '(ruby-lint)', line = 1)\n buffer = ::Parser::Source::Buffer.new(file, line)\n buffer.source = code\n ast = internal_parser.parse(buffer)\n\n internal_parser.reset\n\n return AST::Node.new(:root, [ast])\n end",
"def parse(code = nil, options = nil, &block)\n Parsing::parse(code, options, &block)\n end",
"def code(lang, &block)\n source_code = capture(&block).strip\n eval('_erbout', block.binding).concat %Q(<pre class=\"CodeRay\"><code class=\"language-#{lang}\">#{html_escape source_code}</code></pre>)\nend",
"def initialize(data={})\n data = CXML.parse(data) if data.kind_of?(String)\n\n if data.kind_of?(Hash) && !data.empty?\n @code = data['code'].to_i\n @text = data['text']\n @xml_lang = data['xml:lang']\n end\n end",
"def block_code(code, language)\n code\n end",
"def call\n eval(@code)\n end",
"def to_code\n if @sexp\n \"/*:#{@sexp.line}:#{@sexp.column}*/#{@code}\"\n else\n @code\n end\n end",
"def load_from_xml(xml_text)\n item = parse_xml(xml_text)\n if block_given? then self.create(item) { |i| yield(i) }\n else self.create(item)\n end\n end",
"def code\n @code\n end",
"def code\n @code\n end",
"def code\n @code\n end",
"def process_code(text)\n begin\n results = text.clone\n # processing code function\n text.scan(/\\${i2x.code\\((.*?)\\)}/).each { |k|\n k.each { |m|\n puts \"\\n\\tProcessing: #{m}\"\n results[\"${i2x.code(#{m})}\"] = eval(m.to_s).to_s\n }\n } if text.include? 'i2x.code'\n rescue Exception => e\n Services::Slog.exception e\n end\n results\n end",
"def from_xml(xml)\n @xml = xml\n self.before_from_xml if defined?(before_from_xml)\n from_xml_via_map(@xml)\n end",
"def thru_coderay #:nodoc:\n gsub %r{<(code)(.*?)>(.*?)</\\1>}m do\n elem, atts, code = $1, $2, CGI.unescapeHTML($3).sub(/\\A\\r?\\n/, '')\n\n lang_regexp = /\\blang=('|\")(.*?)\\1/io\n lang = atts[lang_regexp, 2]\n lang = :ruby if lang !~ /\\S/\n atts.sub! lang_regexp, %{lang=\"#{lang}\"}\n\n body = CodeRay.scan(code, lang).html(:css => :style)\n\n if code =~ /\\n/\n span = :para\n head = \"<ins><pre\"\n tail = \"</pre></ins>\"\n\n else\n span = :line\n head = \"<#{elem}\"\n tail = \"</#{elem}>\"\n end\n\n unless atts.sub!(/\\b(class=('|\"))(.*?\\2)/){ $1 + span + ' ' + $3 }\n atts << %{ class=\"#{span}\"}\n end\n\n %{#{head}#{atts}>#{body}#{tail}}\n end\n end",
"def from &code\n @vars = Variabler.new\n sexp = code.to_sexp(strip_enclosure: true)\n sourcecode = statements(sexp)\n pp sexp\n return @vars.sourcecode + NL + sourcecode\n end",
"def initialize\r\n @code = ''\r\n @tags = []\r\n end",
"def parse( x )\n cycle( xml( x ) )\n end",
"def code\n body.code.intern if body.respond_to?(:code) && body.code\n end",
"def code\n @attributes[:code]\n end",
"def code\n @attributes[:code]\n end",
"def code\n @attributes[:code]\n end",
"def code\n @attributes[:code]\n end",
"def initialize(run, xml)\n @run = run\n\n parse_xml(xml)\n end",
"def code\n info['Code']\n end",
"def decode(xml)\n if !xml.respond_to?(:read)\n xml = StringIO.new(xml)\n end\n ::XmlSimple.xml_in(xml, 'ForceArray'=>false)\n rescue\n case $!\n when parse_error\n raise $!\n else\n raise parse_error, \"Couldn't parse the given document.\"\n end \n end",
"def code\n @code\n end",
"def code\n @code\n end",
"def code\n @info.code\n end",
"def code\n @data['code']\n end",
"def code\n @data['code']\n end",
"def compile\n lexer = Bolverk::ASM::Lexer.new(@stream)\n tokens = lexer.scan\n\n parser = Bolverk::ASM::Parser.new(tokens)\n parse_tree = parser.parse\n\n generator = Bolverk::ASM::Generator.new(parse_tree)\n source = generator.generate\n\n return source\n end",
"def parse_codespan; end",
"def as_code(text)\n '/code ' + sanitze_for_chat(text)\n end",
"def codeblock\n H[:pre, attr, H[:code, value]]\n end",
"def get_code_fragment(str)\n $document\n .at_css('#tryruby-content code')\n &.inner_html\n .to_s\n .strip\n .gsub(\"<\", \"<\")\n .gsub(\">\", \">\")\n .gsub(\"&\", \"&\")\n end",
"def parse(input)\n if /^[1-6]{4}$/.match(input)\n code = input.split(//)[(0..3)]\n code.map!(&:to_i)\n Code.new(code)\n else\n input_error\n end\n end",
"def getCode()\n return @code\n end",
"def parse\n Ox.parse(@xml)\n end",
"def code\n @data['code']\n end",
"def from_xml(xml)\n parsed_status = \"unknown\"\n\n if xml\n build_names = []\n xml.elements.each(\"feed/entry/title\") {|entry| build_names << entry.text}\n\n build_master = build_names.find {|build_name| build_name.include?(@build_name) }\n parsed_status = build_master.match(/\\(.+\\)/).to_s\n end\n\n case parsed_status\n when \"(stable)\"\n \"stable\"\n when \"(back to normal)\"\n \"stable\"\n when \"(?)\"\n \"building\"\n when \"(aborted)\"\n \"aborted\"\n when /broken/\n \"broken\"\n when \"unknown\"\n \"unknown\"\n else\n \"failed\"\n end\n\n end",
"def execute(xml)\n\t\tmessage = {\n\t\t\ttoken: Afasgem.get_token,\n\t\t\tconnectorType: @connectorname,\n\t\t\tconnectorVersion: 1,\n\t\t\tdataXml: xml\n\t\t}\n\t\tresp = @client.call(:execute, message: message)\n\t\treturn resp\n\tend",
"def initialize(code)\n @code = code\n end",
"def initialize(code)\n @code = code\n end",
"def code_type()\n path = @opts[:file]\n if path.end_with? '.rb'\n :ruby\n elsif path.end_with? '.xml'\n :xml\n else\n :text\n end\n end",
"def initialize(content)\n @content = Aspen::AST::Nodes::Content.new(content)\n end",
"def from_trusted_xml(xml)\n from_xml xml, []\n end",
"def initialize(code, scope, sexp = nil)\n @code = code.to_s\n @sexp = sexp\n @scope = scope\n end",
"def parse_codeblocks(html); end",
"def initialize(xml)\n @source = isxml?(xml) ? xml : File.read(xml)\n @doc_stream = AltoDocStream.new\n parser = Nokogiri::XML::SAX::Parser.new(doc_stream)\n parser.parse(@source)\n end",
"def code(a_code)\n\t\ta_code\n\tend",
"def initialize(code)\n @code = code\n end",
"def parse(text)\n text.split(/(<code.*?>.*?<\\/code>)/m).inject(\"\") do |result, piece|\n if piece =~ /^<code/\n result << highlight(piece.gsub(/<code.*?>|<\\/code>/, \"\"), parse_lang(piece)).chomp\n else\n result << format(piece)\n end\n end\n end",
"def to_ruby(sexp)\n begin\n Sorcerer.source(sexp)\n rescue => e\n p e\n 'UNKNOWN'\n end\n end",
"def code\n @grpc.language_code\n end",
"def getFunctionCodeNode(node, name)\n unless node.nil?\n if(node.type.to_s.eql? \"def\" and node.children[0].to_s.eql? name)\n return node.loc.expression.source\n end\n end\n end",
"def initialize(code)\n @original_code = code\n end",
"def initialize(code, name)\n @code, @name = code, name\n @tags = [code]\n end",
"def call(ast)\n ast\n end",
"def ruby_source_from_string(s)\n parser = MetagrammarParser.new\n result = parser.parse(s)\n unless result\n raise RuntimeError.new(parser.failure_reason)\n end\n result.compile\n end",
"def code()\n return @code.clone()\n end",
"def process_xml(xml)\n doc = REXML::Document.new xml\n @message_identifier = doc.text(\"//imsx_statusInfo/imsx_messageIdentifier\").to_s\n @code_major = doc.text(\"//imsx_statusInfo/imsx_codeMajor\")\n @code_major.downcase! if @code_major\n @severity = doc.text(\"//imsx_statusInfo/imsx_severity\")\n @severity.downcase! if @severity\n @description = doc.text(\"//imsx_statusInfo/imsx_description\")\n @description = @description.to_s if @description\n @message_ref_identifier = doc.text(\"//imsx_statusInfo/imsx_messageRefIdentifier\")\n @operation = doc.text(\"//imsx_statusInfo/imsx_operationRefIdentifier\")\n @score = doc.text(\"//readResultResponse//resultScore/textString\")\n @score = @score.to_s if @score\n end",
"def parse xml\n begin\n output = Crack::XML.parse xml\n rescue Exception => e\n puts \"Exception parsing message #{e.message}\"\n return {}\n end\n end",
"def load\n doc = Nokogiri::XML(open(filename))\n xml_template_code = doc.css('Code')[0].content\n unless code == xml_template_code\n raise StandardError, \"template codes '#{code}' and '#{xml_template_code}' don't match\"\n end\n @xml_doc = doc\n end",
"def value_from_node(xml)\n collect_for(xml) do |node|\n create_object.from_node(node)\n end\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def xml(*args, &blk)\n XML.new(*args, &blk)\nend",
"def code\r\n render :template => 'mxes/code/code' \r\n end",
"def code\r\n return @code[@index]\r\n end",
"def process(code, context)\n compiler = Verneuil::Compiler.new\n program = compiler.compile(code)\n # p program\n Verneuil::Process.new(program, context)\nend",
"def parse(source); end",
"def code\n self.class.code\n end",
"def source\n case type\n when 'block'\n xpath 'source', 'dev'\n when 'file'\n xpath 'source', 'file'\n else\n raise \"unknown source type #{type}\"\n end\n end",
"def parse(&block)\n @block = block\n puts \"Parsing #{xml_url}\"\n @parser.parse\n end",
"def initialize(code)\n \tval = Atom.new code\n\n \tif val.value == false\n \t\t@value = Sequence.new(code).tokenize.set_execution_order\n \telse\n \t\t@value = val\n \tend\n end",
"def compile(source)\n ast = transformer.apply(parser.parse(source))\n ast.compile\n end",
"def code\n @code ||= @codes.first\n end",
"def from_node(node); end",
"def to_code\n \"#{@x}\"\n end",
"def parse(content)\n TOMLP::Parser.new(content).parse\n end",
"def load_xml(str)\r\n @xml = REXML::Document.new(str.to_s)\r\n xml_to_instance\r\n self\r\n end",
"def from_xml_elem(ctx, root)\n #p [:from_xml_elem, :ctx, root]\n attributes = root.attributes.inject({ }) { |hash, (k, v)| hash[k] = EscapeXML.unescape(v.to_s); hash}\n text, children = root.children.partition{ |x| text_node?(x) }\n text = text.map{ |x| x.to_s}.reject{ |s| s =~ /^\\s*$/}.join('')\n element_name = root.name\n if element_name !~ /[A-Z]/\n element_name = Doodle::Utils.camel_case(element_name)\n end\n klass = Utils.const_lookup(element_name, ctx)\n #p [:creating_new, klass, text, attributes]\n #p [:root1, root]\n # don't pass in empty text - screws up when class has only\n # child elements (and no attributes) because tries to\n # instantiate child element from empty string \"\"\n if text == \"\"\n text = nil\n end\n args = [text, attributes].compact\n oroot = klass.new(*args) {\n #p [:in_block]\n from_xml_elem(root)\n }\n #p [:oroot, oroot]\n oroot\n end",
"def code\n\t\ttoken\n\tend",
"def coerce(arg)\n case arg\n when AstNode\n arg\n when Proc, String\n CodeTree::parse(arg)\n else\n raise \"Unable to coerce #{arg.inspect} to a CodeTree::AstNode\"\n end\n end",
"def compile_to_ruby_source_as parser_class_name\r\n result = \"class #{parser_class_name} < Dhaka::CompiledParser\\n\\n\"\r\n result << \" self.grammar = #{grammar.name}\\n\\n\"\r\n result << \" start_with #{start_state.id}\\n\\n\"\r\n states.each do |state|\r\n result << \"#{state.compile_to_ruby_source}\\n\\n\"\r\n end\r\n result << \"end\"\r\n result\r\n end",
"def get_content_from_data(raw_xml)\n Nokogiri::XML(raw_xml)\n end",
"def blocks_to_embed(block_xml)\n return block_xml\n end"
] |
[
"0.5553657",
"0.5515942",
"0.53827",
"0.5287956",
"0.5235847",
"0.5155124",
"0.51472616",
"0.5062968",
"0.5052478",
"0.5052478",
"0.50476193",
"0.5043959",
"0.50289917",
"0.50228316",
"0.49587598",
"0.4934622",
"0.48698857",
"0.4868327",
"0.4866545",
"0.4842544",
"0.48278898",
"0.48066166",
"0.48066166",
"0.48018694",
"0.47705334",
"0.47548407",
"0.47467187",
"0.473909",
"0.47234273",
"0.47179165",
"0.46989477",
"0.46989477",
"0.46989477",
"0.46989477",
"0.4656862",
"0.46434227",
"0.46286932",
"0.4621522",
"0.4621522",
"0.4601848",
"0.4596475",
"0.4596475",
"0.4592924",
"0.45884132",
"0.4586944",
"0.45780382",
"0.4576117",
"0.45633942",
"0.45575535",
"0.4550886",
"0.45409298",
"0.45345578",
"0.45180508",
"0.4507339",
"0.4507339",
"0.448747",
"0.44818962",
"0.4472226",
"0.44703376",
"0.44694987",
"0.44692948",
"0.4458144",
"0.44571277",
"0.44530702",
"0.44365397",
"0.44315898",
"0.44200987",
"0.4419399",
"0.44173473",
"0.44157806",
"0.4415239",
"0.4414421",
"0.4413912",
"0.4407467",
"0.44061273",
"0.44036278",
"0.43955046",
"0.43955046",
"0.43955046",
"0.43953156",
"0.43850982",
"0.43738118",
"0.43720406",
"0.4358338",
"0.4355456",
"0.4354608",
"0.43440217",
"0.4343556",
"0.4343188",
"0.43379104",
"0.43367332",
"0.4334559",
"0.4333613",
"0.4324146",
"0.42959413",
"0.42901307",
"0.4287145",
"0.42850095",
"0.42814332",
"0.42765117"
] |
0.50400543
|
12
|
TODO(mtomczak): In all parser statements, will need to clean up to catch syntax failures Blockly allows (such as incomplete blocks)
|
def parse_arithmetic_op(block)
Blockly::Code::Op.new(
next_block_id,
block['title'][0]['content'],
parse_block(block['value'][0]['block'][0]),
parse_block(block['value'][1]['block'][0]))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parse_codeblock; end",
"def parse_lang_for_codeblock(source); end",
"def parse_codeblock_fenced; end",
"def parse_block_extensions; end",
"def parse_block(*_arg0); end",
"def blocks_parse(input)\n return nil\nend",
"def parse_block_math; end",
"def invalid_syntax\n mutations.reject do |mutation|\n ::Parser::CurrentRuby.parse(mutation.source)\n rescue ::Parser::SyntaxError # rubocop:disable Lint/HandleExceptions\n end\n end",
"def statement_block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n return_value = StatementBlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n __BLOCK4__ = nil\n statement_list5 = nil\n\n tree_for_BLOCK4 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 23:5: ^( BLOCK ( statement_list )? )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __BLOCK4__ = match( BLOCK, TOKENS_FOLLOWING_BLOCK_IN_statement_block_80 )\n\n tree_for_BLOCK4 = @adaptor.copy_node( __BLOCK4__ )\n\n root_1 = @adaptor.become_root( tree_for_BLOCK4, root_1 )\n\n\n\n if @input.peek == DOWN\n match( DOWN, nil )\n # at line 23:14: ( statement_list )?\n alt_3 = 2\n look_3_0 = @input.peek( 1 )\n\n if ( look_3_0.between?( AMP, AMP_ASGN ) || look_3_0 == POST_DECR || look_3_0.between?( GEQ, AREF ) || look_3_0.between?( GREATER, HAT ) || look_3_0.between?( ARROW, HAT_ASGN ) || look_3_0.between?( ASGN, REGEX ) || look_3_0.between?( IN, RETURN ) || look_3_0 == INCR || look_3_0.between?( BREAK, RSHIFT3 ) || look_3_0.between?( LABEL, CATCH ) || look_3_0 == RSHIFT_ASGN || look_3_0 == LEQ || look_3_0.between?( LESS, SLASH ) || look_3_0.between?( SLASH_ASGN, CONTINUE ) || look_3_0.between?( STAR, DECR ) || look_3_0 == STAR_ASGN || look_3_0.between?( LSHIFT, THIS ) || look_3_0 == THROW || look_3_0.between?( MINUS, MOD ) || look_3_0.between?( MOD_ASGN, TYPEOF ) || look_3_0.between?( NEQ, UMINUS ) || look_3_0.between?( NEQQ, UNDEFINED ) || look_3_0.between?( NEW, UPLUS ) || look_3_0.between?( OBJECT, FALSE ) || look_3_0.between?( WITH, PLUS ) || look_3_0.between?( ID, DOC ) )\n alt_3 = 1\n end\n case alt_3\n when 1\n # at line 23:14: statement_list\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_list_IN_statement_block_82 )\n statement_list5 = statement_list\n @state.following.pop\n\n @adaptor.add_child( root_1, statement_list5.tree )\n\n\n end\n\n match( UP, nil )\n end\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 3 )\n\n end\n \n return return_value\n end",
"def process_block_token(tk); end",
"def parse_codeblocks(html); end",
"def block(sexp)\n statements(sexp)\n end",
"def block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n return_value = BlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n statement_block2 = nil\n statement3 = nil\n\n\n begin\n # at line 18:3: ( statement_block | statement )\n alt_2 = 2\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0 == BLOCK )\n alt_2 = 1\n elsif ( look_2_0.between?( AMP, AMP_ASGN ) || look_2_0 == POST_DECR || look_2_0.between?( GEQ, AREF ) || look_2_0.between?( GREATER, HAT ) || look_2_0.between?( ARROW, HAT_ASGN ) || look_2_0.between?( ASGN, REGEX ) || look_2_0.between?( IN, RETURN ) || look_2_0 == INCR || look_2_0.between?( BREAK, RSHIFT3 ) || look_2_0.between?( LABEL, CATCH ) || look_2_0 == RSHIFT_ASGN || look_2_0 == LEQ || look_2_0.between?( LESS, SLASH ) || look_2_0.between?( SLASH_ASGN, CONTINUE ) || look_2_0.between?( STAR, DECR ) || look_2_0 == STAR_ASGN || look_2_0.between?( LSHIFT, THIS ) || look_2_0 == THROW || look_2_0.between?( MINUS, MOD ) || look_2_0.between?( MOD_ASGN, TYPEOF ) || look_2_0.between?( NEQ, UMINUS ) || look_2_0.between?( NEQQ, UNDEFINED ) || look_2_0.between?( NEW, UPLUS ) || look_2_0.between?( OBJECT, FALSE ) || look_2_0.between?( WITH, PLUS ) || look_2_0.between?( ID, DOC ) )\n alt_2 = 2\n else\n raise NoViableAlternative( \"\", 2, 0 )\n end\n case alt_2\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 18:5: statement_block\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_block_IN_block_59 )\n statement_block2 = statement_block\n @state.following.pop\n\n @adaptor.add_child( root_0, statement_block2.tree )\n\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 19:5: statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_IN_block_65 )\n statement3 = statement\n @state.following.pop\n\n @adaptor.add_child( root_0, statement3.tree )\n\n\n end\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n end\n \n return return_value\n end",
"def parse_codespan; end",
"def process_block_token(tk)\n if balances?(tk)\n @statement << tk\n @state = :first_statement\n process_statement_end(tk)\n elsif @block_num > 1 || (@block.empty? && [TkSPACE, TkNL].include?(tk.class))\n @statement << tk\n else\n if @block.empty?\n @statement << TkBlockContents.new(tk.line_no, tk.char_no)\n end\n @block << tk\n end\n end",
"def browser_block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 26 )\n return_value = BrowserBlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal102 = nil\n string_literal105 = nil\n browser_name103 = nil\n statement_block104 = nil\n block106 = nil\n\n tree_for_char_literal102 = nil\n tree_for_string_literal105 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 417:5: '!' browser_name statement_block ( 'else' block )?\n char_literal102 = match( NOT, TOKENS_FOLLOWING_NOT_IN_browser_block_2757 )\n if @state.backtracking == 0\n\n tree_for_char_literal102 = @adaptor.create_with_payload( char_literal102 )\n @adaptor.add_child( root_0, tree_for_char_literal102 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_browser_name_IN_browser_block_2759 )\n browser_name103 = browser_name\n @state.following.pop\n if @state.backtracking == 0\n root_0 = @adaptor.become_root( browser_name103.tree, root_0 )\n end\n @state.following.push( TOKENS_FOLLOWING_statement_block_IN_browser_block_2762 )\n statement_block104 = statement_block\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, statement_block104.tree )\n end\n # at line 417:39: ( 'else' block )?\n alt_20 = 2\n look_20_0 = @input.peek( 1 )\n\n if ( look_20_0 == ELSE )\n alt_20 = 1\n end\n case alt_20\n when 1\n # at line 417:41: 'else' block\n string_literal105 = match( ELSE, TOKENS_FOLLOWING_ELSE_IN_browser_block_2766 )\n @state.following.push( TOKENS_FOLLOWING_block_IN_browser_block_2769 )\n block106 = block\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, block106.tree )\n end\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\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 end\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__, 26 )\n\n end\n \n return return_value\n end",
"def process_token(tk)\n # p tk.class, tk.text, @state, @level, @current_block, \"<br/>\"\n case @state\n when :first_statement\n return if process_initial_comment(tk)\n return if @statement.empty? && [TkSPACE, TkNL, TkCOMMENT].include?(tk.class)\n @comments_last_line = nil\n if @statement.empty? && tk.class == TkALIAS\n @state = :alias_statement\n @alias_values = []\n push_token(tk)\n return\n end\n return if process_simple_block_opener(tk)\n push_token(tk)\n return if process_complex_block_opener(tk)\n\n if balances?(tk)\n process_statement_end(tk)\n else\n @state = :balance\n end\n when :alias_statement\n push_token(tk)\n @alias_values << tk unless [TkSPACE, TkNL, TkCOMMENT].include?(tk.class)\n if @alias_values.size == 2\n @state = :first_statement\n if [NilClass, TkNL, TkEND_OF_SCRIPT, TkSEMICOLON].include?(peek_no_space.class)\n @done = true\n end\n end\n when :balance\n @statement << tk\n return unless balances?(tk)\n @state = :first_statement\n process_statement_end(tk)\n when :block_statement\n push_token(tk)\n return unless balances?(tk)\n process_statement_end(tk)\n when :pre_block\n @current_block = nil\n process_block_token(tk) unless tk.class == TkSEMICOLON\n @state = :block\n when :block\n process_block_token(tk)\n when :post_block\n if tk.class == TkSPACE\n @statement << tk\n return\n end\n\n process_statement_end(tk)\n @state = :block\n end\n\n if @first_line == tk.line_no && !@statement.empty? && TkCOMMENT === tk\n process_initial_comment(tk)\n end\n end",
"def test_empty_block_parses_and_types_without_error\n assert_nothing_raised do\n parse_and_type(<<-CODE)\n interface Bar do;def run:void;end;end\n\n class BarOner\n def initialize; end\n def foo(a:Bar)\n 1\n end\n end\n BarOner.new.foo do\n end\n CODE\n end\n end",
"def test_empty_block_parses_and_types_without_error\n assert_nothing_raised do\n parse_and_type(<<-CODE)\n interface Bar do;def run:void;end;end\n\n class BarOner\n def initialize; end\n def foo(a:Bar)\n 1\n end\n end\n BarOner.new.foo do\n end\n CODE\n end\n end",
"def test_it_raise_error_if_internal_definition_is_at_wrong_position\n source = \"(define (foo x) (+ x 1) (define y 4) (* x y))\"\n assert_raises(Rubasteme::SchemeSyntaxErrorError) {\n _ = parse(source)\n }\n end",
"def parse_blocks(el, text = T.unsafe(nil)); end",
"def parse(thing, &block); end",
"def parse(thing, &block); end",
"def extract_code_blocks\n body.match /```([a-z]+)?\\n(.*)\\n```/\n end",
"def parse_statement\n\n if peek?(:KW_RETURN)\n stmt = parse_function_return\n elsif peek_any?([:KW_BREAK, :KW_CONTINUE])\n stmt = parse_loop_skip\n elsif peek?(:ID) and peek2?(:OP_ASSIGNMENT) or (peek?(:ID) and peek2?(:L_SQ_BRACKET))\n stmt = parse_assignment\n elsif peek_any?([:KW_READ, :KW_PRINT])\n stmt = parse_IO_op\n elsif peek_any?([:KW_BOOL, :KW_INT, :KW_FLOAT, :KW_STRING]) and !peek2?(:L_SQ_BRACKET)\n stmt = parse_variable_declaration\n elsif peek_any?([:KW_PRINT_VRAM, :KW_CLEAR_VRAM, :KW_FLUSH_VRAM])\n stmt = parse_VRAM_op\n elsif peek?(:KW_SLEEP)\n stmt = parse_sleep\n elsif peek?(:KW_RAND)\n stmt = parse_rand\n else\n stmt = StmtExpr.new(parse_expression)\n end\n\n expect(:SEPARATOR)\n\n stmt\n end",
"def parse_blocks(el, text = nil)\n @stack.push([@tree, @src, @block_ial])\n @tree, @block_ial = el, nil\n @src = (text.nil? ? @src : ::Kramdown::Utils::StringScanner.new(text, el.options[:location]))\n\n status = catch(:stop_block_parsing) do\n until @src.eos?\n @block_parsers.any? do |name|\n if @src.check(@parsers[name].start_re)\n send(@parsers[name].method)\n else\n false\n end\n end || begin\n warning('Warning: this should not occur - no block parser handled the line')\n add_text(@src.scan(/.*\\n/))\n end\n end\n end\n\n @tree, @src, @block_ial = *@stack.pop\n status\n end",
"def next_statement\n statement, block, comments = TokenList.new, nil, nil\n stmt_number, level = 0, 0\n new_statement, open_block = true, false\n last_tk, last_ns_tk, before_last_tk = nil, nil, nil\n open_parens = 0\n\n while tk = @tokens.shift\n #p tk.class\n # !!!!!!!!!!!!!!!!!!!! REMOVED TkfLPAREN, TkfLBRACK\n open_parens += 1 if [TkLPAREN, TkLBRACK].include? tk.class\n open_parens -= 1 if [TkRPAREN, TkRBRACK].include?(tk.class) \n \n #if open_parens < 0 || level < 0\n # STDERR.puts block.to_s + \" TOKEN #{tk.inspect}\"\n # exit\n #end\n\n # Get the initial comments\n if statement.empty?\n # Two new-lines in a row will destroy any comment blocks\n if [TkCOMMENT].include?(tk.class) && last_tk.class == TkNL && \n (before_last_tk && (before_last_tk.class == TkNL || before_last_tk.class == TkSPACE))\n comments = nil\n elsif tk.class == TkCOMMENT\n # Remove the \"#\" and up to 1 space before the text\n # Since, of course, the convention is to have \"# text\"\n # and not \"#text\", which I deem ugly (you heard it here first)\n comments ||= []\n comments << tk.text.gsub(/^#+\\s{0,1}/, '') \n comments.pop if comments.size == 1 && comments.first =~ /^\\s*$/\n end\n end\n \n # Ignore any initial comments or whitespace\n unless statement.empty? && [TkSPACE, TkNL, TkCOMMENT].include?(tk.class)\n # Decrease if end or '}' is seen\n level -= 1 if [TkEND, TkRBRACE].include?(tk.class)\n \n # If the level is greater than 0, add the code to the block text\n # otherwise it's part of the statement text\n if stmt_number > 0\n #puts \"Block of #{statement}\"\n #puts \"#{stmt_number} #{tk.line_no} #{level} #{open_parens} #{tk.class.class_name} \\t#{tk.text.inspect} #{tk.lex_state} #{open_block.inspect}\" \n block ||= TokenList.new\n block << tk\n elsif stmt_number == 0 && tk.class != TkNL && tk.class != TkSEMICOLON && tk.class != TkCOMMENT\n statement << tk \n end\n\n #puts \"#{tk.line_no} #{level} #{open_parens} #{tk.class.class_name} \\t#{tk.text.inspect} #{tk.lex_state} #{open_block.inspect}\" \n\n # Increase level if we have a 'do' or block opening\n if tk.class == TkLBRACE #|| tk.class == TkfLBRACE\n level += 1 \n elsif [TkDO, TkBEGIN].include?(tk.class) \n #p \"#{tk.line_no} #{level} #{tk} \\t#{tk.text} #{tk.lex_state}\" \n level += 1 \n open_block = false # Cancel our wish to open a block for the if, we're doing it now\n end\n\n # Vouch to open a block when this statement would otherwise end\n open_block = [level, tk.class] if (new_statement || \n (last_tk && last_tk.lex_state == EXPR_BEG)) && \n OPEN_BLOCK_TOKENS.include?(tk.class)\n\n # Check if this token creates a new statement or not\n #puts \"#{open_parens} open brackets for: #{statement.to_s}\"\n if open_parens == 0 && ((last_tk && [TkSEMICOLON, TkNL, TkEND_OF_SCRIPT].include?(tk.class)) ||\n (open_block && open_block.last == TkDEF && tk.class == TkRPAREN))\n \n # Make sure we don't have any running expressions\n # This includes things like\n #\n # class <\n # Foo\n # \n # if a ||\n # b\n if (last_tk && [EXPR_END, EXPR_ARG].include?(last_tk.lex_state)) || \n (open_block && [TkNL, TkSEMICOLON].include?(tk.class) && last_ns_tk.class != open_block.last)\n stmt_number += 1\n new_statement = true\n #p \"NEW STATEMENT #{block.to_s}\"\n\n # The statement started with a if/while/begin, so we must go to the next level now\n if open_block && open_block.first == level\n if tk.class == TkNL && block.nil?\n block = TokenList.new\n block << tk\n end\n\n open_block = false\n level += 1\n end\n end\n elsif tk.class != TkSPACE\n new_statement = false \n end\n\n # Else keyword is kind of weird\n if tk.is_a? TkELSE\n new_statement = true\n stmt_number += 1\n open_block = false\n end\n\n # We're done if we've ended a statement and we're at level 0\n break if new_statement && level == 0\n \n #raise \"Unexpected end\" if level < 0\n end\n \n #break if new_statement && level == 0\n\n before_last_tk = last_tk\n last_tk = tk # Save last token\n last_ns_tk = tk unless [TkSPACE, TkNL, TkEND_OF_SCRIPT].include? tk.class\n end\n\n # Return the code block with starting token and initial comments\n # If there is no code in the block, return nil\n comments = comments.compact if comments\n statement.empty? ? nil : Statement.new(statement, block, comments)\n end",
"def accept_block_quote block_quote\n tt_sections block_quote.text\n end",
"def lbrace!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n type = LBRACE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 149:10: '{'\n match( 0x7b )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n end",
"def test_block_empty\n check(C::Block, <<-EOS)\n | {\n | }\n EOS\n end",
"def exception_on_syntax_error; end",
"def gparse &blk\n begin\n yield\n rescue Parslet::ParseFailed => failure\n puts failure.parse_failure_cause.ascii_tree\n end\nend",
"def _parse()\n\t\tliteral = (@type == 'LITERAL')\n\n\t\ti = 0\n\t\twhile(@template.buffer != '' || @template._read_line())\n\t\t\tmatches = Array(/#{@@SIFTER_CONTROL_PATTERN}/m.match(@template.buffer))\n\t\t\tif(matches.length <= 0)\n\t\t\t\t# Text\n\t\t\t\tself._append_text(@template.buffer)\n\t\t\t\t@template.buffer = ''\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\tif(literal && matches[3] != 'END_LITERAL')\n\t\t\t\t# LITERAL block\n\t\t\t\tself._append_text(matches[1] + matches[2])\n\t\t\t\t@template.buffer = matches[7]\n\t\t\t\t@template.preserve_spaces_flag = true\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\tif(matches[1] && matches[7] && /[^\\s]/.match(matches[1] + matches[7]))\n\t\t\t\tself._append_text(matches[1])\n\t\t\t\t@template.buffer = matches[7]\n\t\t\t\t@template.preserve_spaces_flag = true\n\t\t\telsif(@template.preserve_spaces_flag || matches[3] == 'END_NOBREAK')\n\t\t\t\tself._append_text(matches[1].gsub(/[^\\r\\n]/, ''))\n\t\t\t\t@template.buffer = matches[7]\n\t\t\t\t@template.buffer.gsub!(/[^\\r\\n]/, '')\n\t\t\telse\n\t\t\t\t@template.buffer = ''\n\t\t\tend\n\n\t\t\ttype = (matches[5]? matches[5]: '')\n\t\t\tparam = (matches[6]? matches[6]: '').gsub(/^\\s+|\\s+$/, '')\n\n\t\t\tif(matches[4])\n\t\t\t\t# End of block\n\t\t\t\tif(\n\t\t\t\t\tparam == '' && \n\t\t\t\t\t(@type == type || (@type == 'ELSE' && (type == 'IF' || type == 'LOOP')))\n\t\t\t\t)\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\t@template._raise_error(__LINE__)\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tif((type == 'LOOP' || type == 'FOR') && param != '')\n\t\t\t\t# LOOP, FOR block\n\t\t\t\tif(!self._append_element(type, param))\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telsif(type == 'IF' && param != '')\n\t\t\t\t# IF block\n\t\t\t\tif(!(param = Sifter._check_condition(param)))\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\t\tif(!self._append_element(type, param))\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telsif(type == 'ELSE')\n\t\t\t\t# ELSE block\n\t\t\t\tif(@type == 'LOOP' && param == '')\n\t\t\t\t\tif(!@parent._append_element(type, param))\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\t\t\t\t\tbreak\n\t\t\t\telsif(@type == 'IF' || @type == 'ELSE')\n\t\t\t\t\tif(param != '' && !(param = Sifter._check_condition(param)))\n\t\t\t\t\t\t@template._raise_error(__LINE__)\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\t\t\t\t\tif(!@parent._append_element(type, param))\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\t@template._raise_error(__LINE__)\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telsif(type == '?' && param != '')\n\t\t\t\t# ?\n\t\t\t\tmatches = Array(/#{SIFTER_CONDITIONAL_EXPRESSION}/.match(param))\n\t\t\t\tif(matches.length <= 0 || !(matches[1] = Sifter._check_condition(matches[1])))\n\t\t\t\t\t@template._raise_error(__LINE__)\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\t\tif(!self._append_element('IF', matches[1], true, matches[2].gsub(/\\\\(.)/, '\\\\1')))\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\t\tif(!self._append_element('ELSE', '', true, matches[3].gsub(/\\\\(.)/, '\\\\1')))\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telsif(type == 'EMBED')\n\t\t\t\t# EMBED block\n\t\t\t\tparam.downcase!\n\t\t\t\tif(param == '' || param == 'xml' || param == 'html')\n\t\t\t\t\tif(!self._append_element(type, (param == 'html')? 1: 3))\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t@template._raise_error(__LINE__)\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telsif((type == 'NOBREAK' || type == 'LITERAL') && param == '')\n\t\t\t\t# NOBREAK, LITERAL block\n\t\t\t\tif(!self._append_element(type, ''))\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telsif(type == 'INCLUDE' && param != '')\n\t\t\t\t# INCLUDE\n\t\t\t\tif(!self._append_template(param))\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t# Syntax error\n\t\t\t\t@template._raise_error(__LINE__)\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\n\t\treturn true\n\tend",
"def parse_block_html; end",
"def initialize block_parser\n @block_parser = block_parser\nend",
"def next_statement; end",
"def process_simple_block_opener(tk)\n return unless [TkLBRACE, TkDO, TkBEGIN, TkELSE].include?(tk.class) &&\n # Make sure hashes are parsed as hashes, not as blocks\n (@last_ns_tk.nil? || @last_ns_tk.lex_state != EXPR_BEG)\n\n @level += 1\n @state = :block\n @block_num += 1\n if @block.nil?\n @block = TokenList.new\n tokens = [tk, TkStatementEnd.new(tk.line_no, tk.char_no)]\n tokens = tokens.reverse if TkBEGIN === tk.class\n @statement.concat(tokens)\n else\n @statement << tk\n end\n\n true\n end",
"def parse_statements(context = nil, single = NORMAL, &block)\n begin\n\t\t\t\tlast_seekpos = -1\n nest = 1\n\n while tk = get_tk\n case tk\n when TkCLASS\n parse_class(context, single, tk, &block)\n when TkMODULE\n parse_module(context, single, tk, &block)\n when TkDEF\n nest += 1\n parse_method(context, single, tk, &block)\n when TkALIAS\n parse_alias(context, single, tk, &block)\n when TkCASE,\n TkDO,\n TkFOR,\n TkIF,\n TkUNLESS,\n TkUNTIL,\n TkWHILE,\n TkBEGIN\n nest += 1\n when TkIDENTIFIER\n case tk.name\n when \"attr\"\n parse_attr(context, single, tk, &block)\n when /^attr_(reader|writer|accessor)$/\n parse_attr_accessor(context, single, tk, &block)\n end\n when TkEND\n return if (nest -= 1) == 0\n end\n begin\n get_tkreaded\n skip_tkspace(false) # don't skip newlines\n\t\t\t\t\t\t# prevent endless loop (tokenizer does not always behave\n\t\t\t\t\t\t# at eof)\n\t\t\t\t\t\ttmp_tk = tk\n\t\t\t\t\t\tseekpos = tmp_tk.seek if tmp_tk and tmp_tk.seek\n\t\t\t\t\t if last_seekpos == seekpos\n\t\t\t\t\t\t\twarn('bailing out early',0,tk)\n \treturn\n\t\t\t\t\t\tend\n\t\t\t\t\t\tlast_seekpos = seekpos\n end while peek_tk == TkNL\n\t\t\t\t\t# p [@input_file_name, peek_tk]\n end\n rescue\n\t\t\t\twarn('parse error',0,tk,$!)\n end\n end",
"def _BlockEnd\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = match_string(\"}\")\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_Le)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n _tmp = apply(:_EmptyLine)\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_BlockEnd unless _tmp\n return _tmp\n end",
"def consume!\n empty_line ||\n name_token ||\n comment_token ||\n whitespace_token ||\n line_token ||\n heredoc_token ||\n string_token ||\n number_token ||\n regex_token ||\n literal_token\n end",
"def read_block_text(name, containers, contents)\n i = -1\n in_block = false\n block_indentation = nil\n block_end_token = nil\n chunk = nil\n contents.each_line do |line|\n if line =~ /^(\\s*)#{name}\\s*.*?(({|do|->\\s*{|lambda\\s*{)(.*))/\n block_indentation, text = $1, $2\n i += 1\n chunk = containers[i].code_chunk\n chunk.text = text + \"\\n\"\n in_block = true\n block_end_token = case text\n when /^{/\n \"}\"\n when /^do\\b/\n \"end\"\n when /^(->|lambda)\\s*({|do)/\n $2 == \"{\" ? \"}\" : \"end\"\n else\n \"}|end\" # regex\n end\n elsif in_block\n line =~ /^(\\s*)(.*)/\n indentation, text = $1, $2\n if indentation.length <= block_indentation.length\n if text =~ /^#{block_end_token}/\n chunk.text << line\n end\n in_block = false\n else\n chunk.text << line\n end\n end\n end\n containers.each do |thing|\n text = thing.code_chunk.text\n text.strip! if text\n end\n end",
"def next_statement\n @state = :first_statement\n @statement_stack = []\n @level = 0\n @block_num = 0\n @done = false\n @current_block = nil\n @comments_line = nil\n @comments_hash_flag = nil\n @statement = TokenList.new\n @block = nil\n @comments = nil\n @last_tk = nil\n @last_ns_tk = nil\n @before_last_tk = nil\n @before_last_ns_tk = nil\n @first_line = nil\n\n until @done\n tk = @tokens.shift\n break if tk.nil?\n process_token(tk)\n\n @before_last_tk = @last_tk\n @last_tk = tk # Save last token\n unless [TkSPACE, TkNL, TkEND_OF_SCRIPT].include? tk.class\n @before_last_ns_tk = @last_ns_tk\n @last_ns_tk = tk\n end\n end\n\n # Return the code block with starting token and initial comments\n # If there is no code in the block, return nil\n @comments = @comments.compact if @comments\n if @block || !@statement.empty?\n sanitize_statement_end\n sanitize_block\n @statement.pop if [TkNL, TkSPACE, TkSEMICOLON].include?(@statement.last.class)\n stmt = Statement.new(@statement, @block, @comments)\n if @comments && @comments_line\n stmt.comments_range = (@comments_line..(@comments_line + @comments.size - 1))\n stmt.comments_hash_flag = @comments_hash_flag\n end\n stmt\n elsif @comments\n @statement << TkCOMMENT.new(@comments_line, 0)\n @statement.first.set_text(\"# \" + @comments.join(\"\\n# \"))\n Statement.new(@statement, nil, @comments)\n end\n end",
"def prepare_block_str!\n raise ParserError, @block_str if @block_str.start_with? '-'\n\n @block_str = @block_str.\n gsub(/(\\d{4})/) { \"#{$1[0..1]}:#{$1[2..3]}\" }. # 4 digits\n gsub(/(\\d{3})/) { \"0#{$1[0]}:#{$1[1..2]}\" }. # 3 digits\n gsub(/now/) { RoundedTime.now.strftime('%H:%M') } # now\n\n return unless @block_str =~ HALF_BLOCK_RGX\n\n # Complete or start an ongoing block.\n @block_str = if (ob = @day.blocks.find(&:ongoing?))\n \"#{ob.start_s}-#{@block_str}\"\n else\n \"#{@block_str}-#{@block_str}\"\n end\n end",
"def block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 14)\n return_value = BlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lp = nil\n rp = nil\n char_literal76 = nil\n char_literal78 = nil\n opts = nil\n altpair77 = nil\n altpair79 = nil\n\n tree_for_lp = nil\n tree_for_rp = nil\n tree_for_char_literal76 = nil\n tree_for_char_literal78 = nil\n stream_T__81 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__81\")\n stream_T__82 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__82\")\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__83\")\n stream_T__78 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__78\")\n stream_altpair = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule altpair\")\n stream_options_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule options_spec\")\n begin\n # at line 194:9: lp= '(' ( (opts= options_spec )? ':' )? altpair ( '|' altpair )* rp= ')'\n lp = match(T__81, TOKENS_FOLLOWING_T__81_IN_block_1124) \n if @state.backtracking == 0\n stream_T__81.add(lp)\n end\n # at line 195:3: ( (opts= options_spec )? ':' )?\n alt_31 = 2\n look_31_0 = @input.peek(1)\n\n if (look_31_0 == OPTIONS || look_31_0 == T__78) \n alt_31 = 1\n end\n case alt_31\n when 1\n # at line 195:5: (opts= options_spec )? ':'\n # at line 195:5: (opts= options_spec )?\n alt_30 = 2\n look_30_0 = @input.peek(1)\n\n if (look_30_0 == OPTIONS) \n alt_30 = 1\n end\n case alt_30\n when 1\n # at line 195:6: opts= options_spec\n @state.following.push(TOKENS_FOLLOWING_options_spec_IN_block_1133)\n opts = options_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_options_spec.add(opts.tree)\n end\n\n end\n char_literal76 = match(T__78, TOKENS_FOLLOWING_T__78_IN_block_1137) \n if @state.backtracking == 0\n stream_T__78.add(char_literal76)\n end\n\n end\n @state.following.push(TOKENS_FOLLOWING_altpair_IN_block_1144)\n altpair77 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add(altpair77.tree)\n end\n # at line 196:11: ( '|' altpair )*\n loop do #loop 32\n alt_32 = 2\n look_32_0 = @input.peek(1)\n\n if (look_32_0 == T__82) \n alt_32 = 1\n\n end\n case alt_32\n when 1\n # at line 196:13: '|' altpair\n char_literal78 = match(T__82, TOKENS_FOLLOWING_T__82_IN_block_1148) \n if @state.backtracking == 0\n stream_T__82.add(char_literal78)\n end\n @state.following.push(TOKENS_FOLLOWING_altpair_IN_block_1150)\n altpair79 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add(altpair79.tree)\n end\n\n else\n break #loop 32\n end\n end\n rp = match(T__83, TOKENS_FOLLOWING_T__83_IN_block_1165) \n if @state.backtracking == 0\n stream_T__83.add(rp)\n end\n # AST Rewrite\n # elements: options_spec, altpair\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 198:9: -> ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n # at line 198:12: ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(@adaptor.create!(BLOCK, lp, \"BLOCK\"), root_1)\n\n # at line 198:34: ( options_spec )?\n if stream_options_spec.has_next?\n @adaptor.add_child(root_1, stream_options_spec.next_tree)\n\n end\n\n stream_options_spec.reset();\n # at line 198:48: ( altpair )+\n unless stream_altpair.has_next?\n raise ANTLR3::RewriteEarlyExit\n end\n\n while stream_altpair.has_next?\n @adaptor.add_child(root_1, stream_altpair.next_tree)\n\n end\n\n stream_altpair.reset\n @adaptor.add_child(root_1, @adaptor.create!(EOB, rp, \"EOB\"))\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\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 end\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__, 14)\n\n end\n \n return return_value\n end",
"def block_node; end",
"def block_node; end",
"def bad_valid_syntax(str_sample)\n index = 0\n openers = [\"[\",\"{\", \"[\"]\n opener_stack = {\n \"{\":[],\n \"(\":[],\n \"[\":[]\n }\n while index < str_sample.size\n curr_char = str_sample[index]\n if openers.include?(curr_char)\n opener_stack[curr_char].push(index)\n elsif curr_char == \"}\"\n start = opener_stack[\"{\"].pop\n return false if (start..index).includes?(opener_stack[\"[\"].last)\n return false if (start..index).includes?(opener_stack[\"(\"].last)\n elsif curr_char == \")\"\n start = opener_stack[\"(\"].pop\n return false if (start..index).includes?(opener_stack[\"{\"].last)\n return false if (start..index).includes?(opener_stack[\"[\"].last)\n elsif curr_char ==\"]\"\n start = opener_stack[\"[\"].pop\n return false if (start..index).includes?(opener_stack[\"{\"].last)\n return false if (start..index).includes?(opener_stack[\"(\"].last)\n end\n index += 1\n end\n opener_stack.all?{|opener|opener.empty?}\nend",
"def fix_context(language, context_lines, position_in_line)\r\n context_lines = context_lines.dup\r\n # make sure there is at least one line\r\n if context_lines.empty?\r\n context_lines << \"\"\r\n end\r\n position_in_line ||= context_lines.last.size\r\n # cut off last line right of cursor\r\n if position_in_line < 1\r\n context_lines.pop\r\n context_lines << \"\"\r\n else\r\n context_lines << context_lines.pop[0..position_in_line-1]\r\n end\r\n problem = nil\r\n line = context_lines.last\r\n if line =~ /\\{\\s*$/\r\n # remove curly brace from last line, required for correct counting of num_elements;\r\n # also make sure that there is whitespace at the end of line, otherwise a word\r\n # might get removed as \"just being completed\"\r\n line.sub!(/\\{\\s*$/,\" \")\r\n problem = :after_curly\r\n end\r\n \r\n num_elements = in_block = in_array = missing_comma = role = prefix = nil\r\n tokens = tokenize(line, language.reference_regexp)\r\n tokens.pop if tokens.last && tokens.last.kind == :newline\r\n if tokens.size > 0 && tokens[0].kind == :identifier\r\n if tokens.size > 1 || line =~ /\\s+$/\r\n # this line contains a new element\r\n num_elements = 1\r\n in_block = false\r\n in_array = false\r\n role = nil\r\n missing_comma = false\r\n unlabled_index = 0\r\n tokens[1..-1].each do |token|\r\n break if token.kind == :error\r\n if token.kind == \"[\"\r\n in_array = true\r\n elsif token.kind == \"]\"\r\n in_array = false\r\n missing_comma = true\r\n role = nil\r\n elsif token.kind == :label\r\n role = token.value.sub(/:$/, \"\")\r\n elsif token.kind == \",\"\r\n missing_comma = false\r\n role = nil unless in_array\r\n unlabled_index += 1 unless in_array\r\n end\r\n end\r\n if ((tokens.size == 1 && line =~ /\\s+$/) || \r\n tokens.last.kind == \",\" ||\r\n in_array ||\r\n ([:error, :string, :integer, :float, :boolean, :identifier, :reference].\r\n include?(tokens.last.kind) && line !~ /\\s$/)) &&\r\n !tokens.any?{|t| t.kind == :label} &&\r\n !(problem == :after_curly)\r\n role ||= unlabled_index \r\n end\r\n if [:string, :integer, :float, :boolean, :identifier, :reference].\r\n include?(tokens.last.kind) && line =~ /\\s$/ && tokens.size > 1\r\n missing_comma = true\r\n role = nil unless in_array\r\n end\r\n if [:error, :string, :integer, :float, :boolean, :identifier, :reference].\r\n include?(tokens.last.kind) && line !~ /\\s$/\r\n last_error = tokens.rindex{|t| t.kind == :error && t.value == '\"'}\r\n last_string = tokens.rindex{|t| t.kind == :string}\r\n if last_error && (!last_string || last_error > last_string)\r\n prefix = line[tokens[last_error].scol-1..-1]\r\n else\r\n prefix = line[tokens.last.scol-1..-1]\r\n end\r\n else\r\n prefix = \"\"\r\n end\r\n else\r\n # in completion of command\r\n num_elements = 0\r\n missing_comma = false\r\n in_block = (context_lines.size > 1)\r\n prefix = tokens[0].value.to_s\r\n role, in_array = find_role(context_lines[0..-2])\r\n # fix single role lable\r\n if context_lines[-2] =~ /^\\s*\\w+:\\s*$/\r\n context_lines[-1] = context_lines.pop\r\n end\r\n end\r\n elsif line.strip.empty?\r\n # in completion of command but without prefix\r\n num_elements = 0\r\n missing_comma = false\r\n in_block = (context_lines.size > 1)\r\n prefix = \"\"\r\n role, in_array = find_role(context_lines[0..-2])\r\n # fix single role lable\r\n if context_lines[-2] =~ /^\\s*\\w+:\\s*$/\r\n context_lines[-1] = context_lines.pop\r\n end\r\n else\r\n # comment, closing brackets, etc.\r\n num_elements = 0\r\n missing_comma = false\r\n in_block = (context_lines.size > 1)\r\n return nil\r\n end\r\n\r\n # remove prefix, a value which is currently being completed should not be part of the\r\n # context model\r\n if prefix && prefix.size > 0\r\n line.slice!(-(prefix.size)..-1)\r\n end\r\n\r\n context_lines.reverse.each do |l|\r\n if l =~ /\\{\\s*$/\r\n context_lines << \"}\"\r\n num_elements += 1\r\n elsif l =~ /\\[\\s*$/\r\n context_lines << \"]\"\r\n end\r\n end\r\n problem = :missing_comma if !problem && missing_comma\r\n ContextInternal.new(context_lines, num_elements, role, prefix, in_array, in_block, problem)\r\n end",
"def process_block(exp)\n code = []\n until exp.empty? do\n code << process(exp.shift)\n end\n\n body = code.join(\";\\n\")\n body += \";\" unless body =~ /[;}]\\Z/\n body += \"\\n\"\n\n return body\n end",
"def parse_stmt()\n\t\tif next_TokenGrabbed(\"skip\")\n\t\t\tputs \"Skip Hit.\"\n\t\t\ttrue\n\n\n\t\t\t# FIXME: This code sucks harder than a black hole.\n\t\telsif next_TokenGrabbed(\"if\")\n\t\t\tputs \"if statement Hit.\"\n\t\t\t\tif next_TokenGrabbed(\"(\")\n\t\t\t\tputs \"Open Paren Hit.\"\n\t\t\t\tparse_lexpr()\n\t\t\t\t\tif next_TokenGrabbed(\")\")\n\t\t\t\t\tputs \"Close Paren Hit.\"\n\t\t\t\t\t\tif next_TokenGrabbed(\"then\")\n\t\t\t\t\t\tputs \"Then Statement Hit.\"\n\t\t\t\t\t\t\tif next_TokenGrabbed(\"(\")\n\t\t\t\t\t\t\tputs \"Open Paren Hit.\"\n\t\t\t\t \t\t\tparse_stmts()\n\t\t\t\t\t\t\t\tif next_TokenGrabbed(\")\")\n\t\t\t\t\t\t\t\tputs \"Close Paren Hit.\"\n\t\t\t\t\t\t\t\tif next_TokenGrabbed(\"else\")\n\t\t\t\t\t\t\t\tputs \"else statement Hit.\"\n\t\t\t\t\t\t\t\t\tif next_TokenGrabbed(\"(\")\n\t\t\t\t\t\t\tputs \"Open Paren Hit.\"\n\t\t\t\t \t\t\tparse_stmts()\n\t\t\t\t\t\t\t\tif next_TokenGrabbed(\")\")\n\t\t\t\t\t\t\t\tputs \"Close Paren Hit.\"\n\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\n\t\telsif next_TokenGrabbed(\"while\")\n\t\t\tputs \"while statement Hit.\"\n\t\t\tif next_TokenGrabbed(\"(\")\n\t\t\t\tputs \"Open Paren Hit.\"\n\t\t\t\t parse_lexpr()\n\t\t\t\t\tif next_TokenGrabbed(\")\")\n\t\t\t\t\tputs \"Close Paren Hit.\" #FIXME: This breaks sometimes.\n\t\t\t\tif next_TokenGrabbed(\"do\")\n\t\t\t\t\tputs \"do statement Hit.\"\n\t\t\tif next_TokenGrabbed(\"(\")\n\t\t\t\tputs \"Open Paren Hit.\"\n\t\t\t\t\tparse_stmts()\n\t\t\t\tif next_TokenGrabbed(\")\")\n\t\t\t\tputs \"Close Paren Hit.\"\n\t\t\t\t\n\t\t\t\t\t# This stuff.. I have no idea. I'm afraid to touch it.\n\t\t\t\t\t\ttrue\n\t\t\t\t\telse\n\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\n\t\telsif @next_token[0].match(/[a-zA-Z]+[\\w]*/) #FIXME: Can this be done any better?\n\t\t\tputs \"Identifier Hit!\"\n\t\t\tadvance()\n\t\t\tif next_TokenGrabbed(\":=\")\n\t\t\t\tputs \"Assignment oper Hit.\"\n\t\t\t\tparse_expr()\n\t\t\t\ttrue\n\n\t\telse \n\t\t\tputs \"Error: Line \" + @token[1].to_s + \": unknown token: \" + @token[0] #This should NEVER happen.\n\t\t\tfalse\n\t\tend\n\tend\n\tend",
"def block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n return_value = BlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lp = nil\n rp = nil\n char_literal76 = nil\n char_literal78 = nil\n opts = nil\n altpair77 = nil\n altpair79 = nil\n\n tree_for_lp = nil\n tree_for_rp = nil\n tree_for_char_literal76 = nil\n tree_for_char_literal78 = nil\n stream_T__81 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__81\" )\n stream_T__82 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__82\" )\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__83\" )\n stream_T__78 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__78\" )\n stream_altpair = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule altpair\" )\n stream_options_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule options_spec\" )\n begin\n # at line 185:9: lp= '(' ( (opts= options_spec )? ':' )? altpair ( '|' altpair )* rp= ')'\n lp = match( T__81, TOKENS_FOLLOWING_T__81_IN_block_1119 )\n if @state.backtracking == 0\n stream_T__81.add( lp )\n end\n # at line 186:3: ( (opts= options_spec )? ':' )?\n alt_31 = 2\n look_31_0 = @input.peek( 1 )\n\n if ( look_31_0 == OPTIONS || look_31_0 == T__78 )\n alt_31 = 1\n end\n case alt_31\n when 1\n # at line 186:5: (opts= options_spec )? ':'\n # at line 186:5: (opts= options_spec )?\n alt_30 = 2\n look_30_0 = @input.peek( 1 )\n\n if ( look_30_0 == OPTIONS )\n alt_30 = 1\n end\n case alt_30\n when 1\n # at line 186:6: opts= options_spec\n @state.following.push( TOKENS_FOLLOWING_options_spec_IN_block_1128 )\n opts = options_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_options_spec.add( opts.tree )\n end\n\n end\n char_literal76 = match( T__78, TOKENS_FOLLOWING_T__78_IN_block_1132 )\n if @state.backtracking == 0\n stream_T__78.add( char_literal76 )\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_altpair_IN_block_1139 )\n altpair77 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add( altpair77.tree )\n end\n # at line 187:11: ( '|' altpair )*\n while true # decision 32\n alt_32 = 2\n look_32_0 = @input.peek( 1 )\n\n if ( look_32_0 == T__82 )\n alt_32 = 1\n\n end\n case alt_32\n when 1\n # at line 187:13: '|' altpair\n char_literal78 = match( T__82, TOKENS_FOLLOWING_T__82_IN_block_1143 )\n if @state.backtracking == 0\n stream_T__82.add( char_literal78 )\n end\n @state.following.push( TOKENS_FOLLOWING_altpair_IN_block_1145 )\n altpair79 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add( altpair79.tree )\n end\n\n else\n break # out of loop for decision 32\n end\n end # loop for decision 32\n rp = match( T__83, TOKENS_FOLLOWING_T__83_IN_block_1160 )\n if @state.backtracking == 0\n stream_T__83.add( rp )\n end\n # AST Rewrite\n # elements: altpair, options_spec\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 189:9: -> ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n # at line 189:12: ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create( BLOCK, lp, \"BLOCK\" ), root_1 )\n\n # at line 189:34: ( options_spec )?\n if stream_options_spec.has_next?\n @adaptor.add_child( root_1, stream_options_spec.next_tree )\n\n end\n\n stream_options_spec.reset();\n # at line 189:48: ( altpair )+\n stream_altpair.has_next? or raise ANTLR3::RewriteEarlyExit\n\n while stream_altpair.has_next?\n @adaptor.add_child( root_1, stream_altpair.next_tree )\n\n end\n stream_altpair.reset\n @adaptor.add_child( root_1, @adaptor.create( EOB, rp, \"EOB\" ) )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\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 end\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__, 14 )\n\n end\n \n return return_value\n end",
"def block_name \n :CodeBlock \n end",
"def block_name \n :CodeBlock \n end",
"def process_statement_end(tk)\n # Whitespace means that we keep the same value of @new_statement as last token\n return if tk.class == TkSPACE\n\n return unless\n # We might be coming after a statement-ending token...\n (@last_tk && [TkSEMICOLON, TkNL, TkEND_OF_SCRIPT].include?(tk.class)) ||\n # Or we might be at the beginning of an argument list\n (@current_block == TkDEF && tk.class == TkRPAREN)\n\n # Continue line ending on . or ::\n return if @last_tk && [EXPR_DOT].include?(@last_tk.lex_state)\n\n # Continue a possible existing new statement unless we just finished an expression...\n return unless (@last_tk && [EXPR_END, EXPR_ARG].include?(@last_tk.lex_state)) ||\n # Or we've opened a block and are ready to move into the body\n (@current_block && [TkNL, TkSEMICOLON].include?(tk.class) &&\n # Handle the case where the block statement's expression is on the next line\n #\n # while\n # foo\n # end\n @last_ns_tk.class != @current_block &&\n # And the case where part of the expression is on the next line\n #\n # while foo ||\n # bar\n # end\n @last_tk.lex_state != EXPR_BEG)\n\n # Continue with the statement if we've hit a comma in a def\n return if @current_block == TkDEF && peek_no_space.class == TkCOMMA\n\n if [TkEND_OF_SCRIPT, TkNL, TkSEMICOLON].include?(tk.class) && @state == :block_statement &&\n [TkRBRACE, TkEND].include?(@last_ns_tk.class) && @level == 0\n @current_block = nil\n end\n\n unless @current_block\n @done = true\n return\n end\n\n @state = :pre_block\n @level += 1\n @block_num += 1\n unless @block\n @block = TokenList.new\n @statement << TkStatementEnd.new(tk.line_no, tk.char_no)\n end\n end",
"def test_ifStatement\n lex(\n \"if true then\n if false then \n id := int ;\n else\n id := int - int ;\n end ;\n else \n id := int - int ;\n end ; eof\n \")\n assert_nothing_raised(ParseError){parseStatements()}\n end",
"def scan_body\n case\n when text = @scanner.scan(/\\{\\{/) \n @context = :statement\n token(:VAR_OPEN, text)\n\n when text = @scanner.scan(/\\{%/)\n @context = :statement\n token(:STMT_OPEN, text)\n\n when text = @scanner.scan(/\\{#/)\n # scan until the end of the comment bracket, ignore the text for all\n # purposes except for advancing the counters appropriately\n comment = @scanner.scan_until(/#\\}/)\n\n # increment the counters based on the content of the counter\n update_counter(text + comment)\n\n # scan in the body context again, since we're not actually returning a\n # token from the comment. Don't scan if we're at the end of the body,\n # just return a terminator token.\n if @scanner.eos?\n [false, false]\n else\n scan_body\n end\n\n else\n # scan ahead until we find a variable opening tag or a block opening tag\n text = @scanner.scan_until(/\\{[\\{%#]/)\n\n # if there was no instance of an opening block then just take what remains \n # in the scanner otherwise return the pointer to before the block\n if text\n text = text[0..-3]\n @scanner.pos -= 2\n else\n text = @scanner.rest\n @scanner.terminate\n end\n\n token(:TEXT_BLOCK, text)\n end\n end",
"def program\n if next_token\n if next_token.is_identifier?(\";\", \"\\n\")\n read_next\n NullStmnt.create\n else\n if next_token.is_identifier?(\"def\")\n define\n else\n statement\n end.tap do\n read_next if next_token && next_token.is_identifier?(\";\", \"\\n\")\n end\n end\n else\n nil\n end\n end",
"def scan_statement\n # eat any whitespace at the start of the string\n whitespace = @scanner.scan_until(/\\S/)\n\n if whitespace\n @scanner.pos -= 1\n update_counter(whitespace[0..-2])\n end\n\n # look for matches\n case\n when text = @scanner.scan(/\\}\\}/)\n @context = :body\n token(:VAR_CLOSE, text)\n \n when text = @scanner.scan(/%\\}/)\n @context = :body\n token(:STMT_CLOSE, text)\n\n when text = @scanner.scan(/[=]=/) # i've added the square brackets because syntax highlighters dont like /=\n token(:OP_EQ, text)\n\n when text = @scanner.scan(/>=/)\n token(:OP_GEQ, text)\n\n when text = @scanner.scan(/<=/)\n token(:OP_LEQ, text)\n\n when text = @scanner.scan(/[=]>/) # i've added the square brackets because syntax highlighters dont like /=\n token(:OP_MAP, text)\n\n when text = @scanner.scan(/(if|else|endif|for|in|endfor|block|endblock|extends|render)[\\W]/)\n keyword = text[0..-2]\n @scanner.pos -= 1\n\n token(keyword.upcase.to_sym, keyword)\n\n when text = @scanner.scan(/[+\\-]?[0-9]+\\.[0-9]+/)\n token(:REAL, text)\n\n when text = @scanner.scan(/[+\\-]?[1-9][0-9]*|0/)\n token(:INTEGER, text)\n \n when text = @scanner.scan(/['][^']*[']|[\"][^\"]*[\"]/)\n token(:STRING, text)\n\n when text = @scanner.scan(/[A-Za-z_][A-Za-z0-9_\\.]*/)\n token(:IDENTIFIER, text)\n\n else\n next_character = @scanner.getch\n token(next_character, next_character)\n end\n end",
"def test_bad_block\r\n\t\ts = \"SYSTEM>Gaozu(100)\"\r\n\t\ttb = Block.new(\"0\", \"0\", s, \"1518893687.329767000\", \"fd19\")\r\n\t\t\r\n\t\tassert_equal 0, tb.validate_block\r\n\tend",
"def parse(source_buffer); end",
"def parse(source_buffer); end",
"def parse(source_buffer); end",
"def test_check_good_block\n line = ['0', '0', 'SYSTEM>569274(100)', '1553184699.650330000', '288d']\n line_num = 1\n assert_output(nil) { @verify.check_block(line, line_num) }\n end",
"def rbrace!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = RBRACE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 132:10: '}'\n match( 0x7d )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 11 )\n\n end",
"def parse(block)\n ast = block.to_ast\n # produces sth. like:\n # (block\n # (send ..)\n # (args)\n # (begin ..)\n # )\n inner_ast = ast.children[2] # pick up (begin..)\n if inner_ast.type == :send\n lines = [inner_ast]\n else\n lines = inner_ast.children\n end\n\n lines.map do |node|\n if node.type == :send\n buf = []\n extract_value(node, buf)\n buf.reverse\n end\n end\n end",
"def rb!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 39 )\n\n type = RB\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 364:6: ')'\n match( 0x29 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 39 )\n\n end",
"def lex_en_line_begin; end",
"def lex_en_line_begin; end",
"def lex_en_line_begin; end",
"def read_block_text(name, containers, contents)\n i = -1\n in_block = false\n block_indentation = nil\n block_end_token = nil\n contents.each_line do |line|\n if line =~ /^(\\s*)#{name}\\s*.*?(({|do|->\\s*{|lambda\\s*{)(.*))/\n block_indentation, text = $1, $2\n i += 1\n containers[i].text = text + \"\\n\"\n in_block = true\n block_end_token = case text\n when /^{/\n \"}\"\n when /^do\\b/\n \"end\"\n when /^(->|lambda)\\s*({|do)/\n $2 == \"{\" ? \"}\" : \"end\"\n else\n \"}|end\" # regex\n end\n elsif in_block\n line =~ /^(\\s*)(.*)/\n indentation, text = $1, $2\n if indentation.length <= block_indentation.length\n if text =~ /^#{block_end_token}/\n containers[i].text << line\n end\n in_block = false\n else\n containers[i].text << line\n end\n end\n end\n containers.each { |thing| thing.text.strip! if thing.text }\n end",
"def parse_block_source(example)\n @debug = false\n\n # Source code for rspec is living on the metadata[:block].source location\n unless defined?(example.metadata) && defined?(example.metadata[:block]) && defined?(example.metadata[:block].source)\n @source = ''\n return\n end\n\n unless example.metadata[:source_override].nil?\n @source = example.metadata[:source_override]\n return\n end\n \n source = example.metadata[:block].source.strip\n\n segments = source.match(EXTRACT_CONTENT_REX)\n\n unless defined?(segments) && defined?(segments[:content])\n @source = ''\n return\n end\n @source = remove_wasted_indentation(segments[:content])\n @source\n end",
"def parse_block_extensions\n # Parse the string +str+ and extract the annotation or the list of tests\n if @src.scan(RESPECTESTS_START)\n last_child = @tree.children.last\n if last_child.type == :header\n parse_respec_tests_list(@src[1], last_child.options[:respec_section] ||= {})\n @tree.children << new_block_el(:eob, :respec_section)\n else\n parse_respec_tests_list(@src[1], last_child.options[:ial] ||= {})\n @tree.children << new_block_el(:eob, :ial)\n end\n # Original parser of block extensions\n elsif @src.scan(ALD_START)\n parse_attribute_list(@src[2], @alds[@src[1]] ||= Utils::OrderedHash.new)\n @tree.children << new_block_el(:eob, :ald)\n true\n elsif @src.check(EXT_BLOCK_START)\n parse_extension_start_tag(:block)\n elsif @src.scan(IAL_BLOCK_START)\n if @tree.children.last && @tree.children.last.type != :blank &&\n (@tree.children.last.type != :eob || [:link_def, :abbrev_def, :footnote_def].include?(@tree.children.last.value))\n parse_attribute_list(@src[1], @tree.children.last.options[:ial] ||= Utils::OrderedHash.new)\n @tree.children << new_block_el(:eob, :ial) unless @src.check(IAL_BLOCK_START)\n else\n parse_attribute_list(@src[1], @block_ial ||= Utils::OrderedHash.new)\n end\n true\n else\n false\n end\n end",
"def accept_block_quote block_quote\n @indent += 2\n\n block_quote.parts.each do |part|\n @prefix = '> '\n\n part.accept self\n end\n\n @indent -= 2\n end",
"def parse\n _build_document\n _close_open_block_commands\n @document\n end",
"def parse_codeblock_fenced\n if @src.check(self.class::FENCED_CODEBLOCK_MATCH)\n start_line_number = @src.current_line_number\n @src.pos += @src.matched_size\n el = new_block_el(:codeblock, @src[5], nil, :location => start_line_number, :raw_text => @src.matched.dup)\n lang = @src[3].to_s.strip\n unless lang.empty?\n el.options[:lang] = lang\n el.attr['class'] = \"language-#{@src[4]}\"\n end\n @tree.children << el\n true\n else\n false\n end\n end",
"def pre_block\n end",
"def pre_block\n end",
"def program \n\t\n\t$cst.add_branch(\"Program\")\n\t\n\tblock\n\tmatch_token(\"T_EOFSIGN\", $tokens[$index])\n\nend",
"def statement; end",
"def fragment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 3)\n\n type = FRAGMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 9:12: 'fragment'\n match(\"fragment\")\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 3)\n\n end",
"def t__72!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 17)\n\n type = T__72\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 23:9: '}'\n match(?})\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 17)\n\n end",
"def bb_unconditional_branch\n @file.puts \" @current_block.left = arg1.basic_block\"\n @file.puts \" @current_block.close\"\n @file.puts \" @current_block = new_basic_block\"\n end",
"def statement\n # Get first token\n curr_token = get_next_token\n\n # Use curr_token to determine which rule to use\n if curr_token.type == \"HOW\"\n how\n elsif curr_token.type == \"QUIT\"\n quit\n elsif curr_token.type == \"VARIABLE\"\n assign(curr_token)\n else\n raise @err_class, \"I don't know what you're talking about!\" \n end\n end",
"def parse(source); end",
"def parse_begin_statement\n expect(:begin)\n expect(:LF)\n\n block = node(:block_statement, body: parse_statements)\n handlers = parse_rescue_clauses\n finalizer = parse_ensure_clause\n\n expect(:end)\n expect(:LF) if match(:LF)\n node(:try_statement, block: block, handlers: handlers, finalizer: finalizer)\n end",
"def syntax_error(state, event, legal_events, line)\n end",
"def block_name_declaration(block_name)\n buff_code \"#{block_name} = __blocks.delete('#{block_name}') { __create_block('#{block_name}') }\"\n end",
"def with_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n return_value = WithStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n string_literal35 = nil\n clause36 = nil\n block37 = nil\n\n tree_for_string_literal35 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 66:5: ^( 'with' clause block )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal35 = match( WITH, TOKENS_FOLLOWING_WITH_IN_with_statement_305 )\n\n tree_for_string_literal35 = @adaptor.copy_node( string_literal35 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal35, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_clause_IN_with_statement_307 )\n clause36 = clause\n @state.following.pop\n\n @adaptor.add_child( root_1, clause36.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_block_IN_with_statement_309 )\n block37 = block\n @state.following.pop\n\n @adaptor.add_child( root_1, block37.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 10 )\n\n end\n \n return return_value\n end",
"def test_good_block\r\n\t\ts = \"SYSTEM>Gaozu(100)\"\r\n\t\ttb = Block.new(\"0\", \"0\", s, \"1518893687.329767000\", \"fd18\")\r\n\t\t\r\n\t\tassert_equal 1, tb.validate_block\r\n\tend",
"def pygment_code_block(block)\n write_data block, 'code.rb', false\n system 'pygmentize -o block.html code.rb'\n File.open('block.html', 'r').read\n end",
"def check(source)\n compiler = VishCompiler.new source\n begin\n compiler.parse\n compiler.transform\n compiler.analyze\n puts 'Syntax OK'\n 0\nrescue Parslet::ParseFailed => failure\n $stderr.puts \"Syntax Error: #{failure.message}\"\n $stderr.puts failure.parse_failure_cause.ascii_tree\n 1\n rescue CompileError => err\n $stderr.puts \"Compile error: #{err.message}\"\n 2\n end\nend",
"def multiline_comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n\n\n\n type = MULTILINE_COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 229:21: '/*' ( . )* '*/'\n match( \"/*\" )\n\n # at line 229:26: ( . )*\n while true # decision 7\n alt_7 = 2\n look_7_0 = @input.peek( 1 )\n\n if ( look_7_0 == 0x2a )\n look_7_1 = @input.peek( 2 )\n\n if ( look_7_1 == 0x2f )\n alt_7 = 2\n elsif ( look_7_1.between?( 0x0, 0x2e ) || look_7_1.between?( 0x30, 0xffff ) )\n alt_7 = 1\n\n end\n elsif ( look_7_0.between?( 0x0, 0x29 ) || look_7_0.between?( 0x2b, 0xffff ) )\n alt_7 = 1\n\n end\n case alt_7\n when 1\n # at line 229:26: .\n match_any\n\n else\n break # out of loop for decision 7\n end\n end # loop for decision 7\n\n\n match( \"*/\" )\n\n\n # --> action\n channel = HIDDEN;\n # <-- action\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 50 )\n\n\n end",
"def try_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 13 )\n return_value = TryStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal44 = nil\n f = nil\n f2 = nil\n statement_block45 = nil\n catch_clause46 = nil\n\n tree_for_string_literal44 = nil\n stream_TRY = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token TRY\" )\n stream_statement_block = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule statement_block\" )\n stream_catch_clause = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule catch_clause\" )\n stream_finally_clause = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule finally_clause\" )\n begin\n # at line 338:5: 'try' ( statement_block -> statement_block ) (f= finally_clause -> | ( catch_clause ->)+ (f2= finally_clause ->)? | -> ^( 'try' statement_block ) )\n string_literal44 = match( TRY, TOKENS_FOLLOWING_TRY_IN_try_statement_2203 )\n if @state.backtracking == 0\n stream_TRY.add( string_literal44 )\n end\n # at line 339:5: ( statement_block -> statement_block )\n # at line 339:7: statement_block\n @state.following.push( TOKENS_FOLLOWING_statement_block_IN_try_statement_2211 )\n statement_block45 = statement_block\n @state.following.pop\n if @state.backtracking == 0\n stream_statement_block.add( statement_block45.tree )\n end\n # AST Rewrite\n # elements: statement_block\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 339:23: -> statement_block\n @adaptor.add_child( root_0, stream_statement_block.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\n # at line 340:5: (f= finally_clause -> | ( catch_clause ->)+ (f2= finally_clause ->)? | -> ^( 'try' statement_block ) )\n alt_10 = 3\n case look_10 = @input.peek( 1 )\n when FINALLY then alt_10 = 1\n when CATCH then alt_10 = 2\n when EOF, GENERAL, GET, ARROW, RBRACE, IF, REGEX, BL_END, INCR, BREAK, RETURN, IS_DEFINED, RPAREN, CASE, LBRACE, COMMA, LBRACK, SEMI, CONST, SET, CONTINUE, LET, DDOC, DECR, LPAREN, DEFAULT, DELETE, DGENERAL, MACRO, SWITCH, DIRECTIVE, MINUS, THIS, DO, THROW, TILDE, TRUE, TRY, TYPEOF, DSTRING, NEW, EACH, NOT, UNDEFINED, ELSE, NULL, UNLESS, UNTIL, FALSE, VAR, VOID, FOR, WHILE, WITH, FUNCTION, PLUS, YIELD, IS_UNDEFINED, POUND, DEF, CLASS_DEF, OBJECT_DEF, EJS, ID, STRING, NUMBER, IVAR, DOC, T__148, T__149, T__150 then alt_10 = 3\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 10, 0 )\n end\n case alt_10\n when 1\n # at line 340:7: f= finally_clause\n @state.following.push( TOKENS_FOLLOWING_finally_clause_IN_try_statement_2227 )\n f = finally_clause\n @state.following.pop\n if @state.backtracking == 0\n stream_finally_clause.add( f.tree )\n end\n # AST Rewrite\n # elements: \n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 340:27: ->\n @adaptor.add_child( root_0, ( prepend_tree( f.tree, return_value.tree ) ) )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 341:7: ( catch_clause ->)+ (f2= finally_clause ->)?\n # at file 341:7: ( catch_clause ->)+\n match_count_8 = 0\n while true\n alt_8 = 2\n look_8_0 = @input.peek( 1 )\n\n if ( look_8_0 == CATCH )\n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line 341:9: catch_clause\n @state.following.push( TOKENS_FOLLOWING_catch_clause_IN_try_statement_2244 )\n catch_clause46 = catch_clause\n @state.following.pop\n if @state.backtracking == 0\n stream_catch_clause.add( catch_clause46.tree )\n end\n # AST Rewrite\n # elements: \n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 341:27: ->\n @adaptor.add_child( root_0, ( prepend_tree( catch_clause46.tree, return_value.tree ) ) )\n\n\n\n return_value.tree = root_0\n\n end\n else\n match_count_8 > 0 and break\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n eee = EarlyExit(8)\n\n\n raise eee\n end\n match_count_8 += 1\n end\n\n # at line 342:7: (f2= finally_clause ->)?\n alt_9 = 2\n look_9_0 = @input.peek( 1 )\n\n if ( look_9_0 == FINALLY )\n alt_9 = 1\n end\n case alt_9\n when 1\n # at line 342:9: f2= finally_clause\n @state.following.push( TOKENS_FOLLOWING_finally_clause_IN_try_statement_2268 )\n f2 = finally_clause\n @state.following.pop\n if @state.backtracking == 0\n stream_finally_clause.add( f2.tree )\n end\n # AST Rewrite\n # elements: \n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 342:27: ->\n @adaptor.add_child( root_0, ( prepend_tree( f2.tree, return_value.tree ) ) )\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n when 3\n # at line 343:27: \n # AST Rewrite\n # elements: statement_block, TRY\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 343:27: -> ^( 'try' statement_block )\n # at line 343:30: ^( 'try' statement_block )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_TRY.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_statement_block.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\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 end\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__, 13 )\n\n end\n \n return return_value\n end",
"def program\n block_statement\n return expected(\"End\") unless $lookahead == \"e\"\n comment \"END\" # 68k has an \"END\" instruction\nend",
"def scan\n @top_level.comment ||= \"\"\n state=:code_blank\n line_number = 0\n line = nil\n\n # This started out as a really long nested case statement,\n # which also led to repetitive code. I'd like to avoid that\n # so I'm using a \"table\" instead.\n\n # Firstly we need some procs to do the transition and processing\n # work. Because these are procs they are closures, and they can\n # use variables in the local scope.\n #\n # First, the \"nothing to see here\" stuff.\n code_noop = lambda do\n if line =~ /^\\s+$/\n state = :code_blank\n end\n end\n\n pod_noop = lambda do\n if line =~ /^\\s+$/\n state = :pod_blank\n end\n @top_level.comment += filter(line)\n end\n\n begin_noop = lambda do\n if line =~ /^\\s+$/\n state = :begin_blank\n end\n @top_level.comment += filter(line)\n end\n\n # Now for the blocks that process code and comments...\n\n transit_to_pod = lambda do\n case line\n when /^=(?:pod|head\\d+)/\n state = :pod_no_blank\n @top_level.comment += filter(line)\n when /^=over/\n state = :over_no_blank\n @top_level.comment += filter(line)\n when /^=(?:begin|for)/\n state = :begin_no_blank\n end\n end\n\n process_pod = lambda do\n case line\n when /^\\s*$/ then\n state = :pod_blank\n @top_level.comment += filter(line)\n when /^=cut/ then\n state = :code_no_blank\n when /^=end/ then\n $stderr.puts \"'=end' unexpected at #{line_number} in #{@file_name}\"\n else\n @top_level.comment += filter(line)\n end\n end\n\n process_begin = lambda do\n case line\n when /^\\s*$/ then\n state = :begin_blank\n @top_level.comment += filter(line)\n when /^=end/ then\n state = :code_no_blank\n when /^=cut/\n $stderr.puts \"'=cut' unexpected at #{line_number} in #{@file_name}\"\n else\n @top_level.comment += filter(line)\n end\n end\n\n transitions = { :code_no_blank => code_noop,\n :code_blank => transit_to_pod,\n :pod_no_blank => pod_noop,\n :pod_blank => process_pod,\n :begin_no_blank => begin_noop,\n :begin_blank => process_begin,\n }\n\n @content.each_line do |l|\n line = l\n line_number += 1\n transitions[state].call\n end\n\n @top_level\n end",
"def block?; end",
"def parse!\n ast = root\n error(\"Unexpected EOS (rest: '#{rest}')\") unless eos?\n error(\"Unclosed parentheses (#{unclosed_parens})\") unless unclosed_parens == 0\n ast\n end",
"def semi!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 38 )\n\n\n\n type = SEMI\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 59:7: ';'\n match( 0x3b )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 38 )\n\n\n end",
"def consume_simple_block(input = @tokens)\n start_token = input.current[:node]\n end_token = BLOCK_END_TOKENS[start_token]\n\n block = {\n :start => start_token.to_s,\n :end => end_token.to_s,\n :value => [],\n :tokens => [input.current]\n }\n\n block[:tokens].concat(input.collect do\n while token = input.consume\n break if token[:node] == end_token\n\n input.reconsume\n block[:value] << consume_component_value(input)\n end\n end)\n\n create_node(:simple_block, block)\n end",
"def compile_statement\n # write_tag '<statement>'\n return compile_let_statement if check?(TokenType::LET)\n return compile_while_statement if check?(TokenType::WHILE)\n return compile_do_statement if check?(TokenType::DO)\n return compile_return_statement if check?(TokenType::RETURN)\n return compile_if_statement if check?(TokenType::IF)\n # write_tag '</statement>'\n end",
"def parse(data)\n sections, docs, code = [], [], []\n lines = data.split(\"\\n\")\n\n # The first line is ignored if it is a shebang line. We also ignore the\n # PEP 263 encoding information in python sourcefiles, and the similar ruby\n # 1.9 syntax.\n lines.shift if lines[0] =~ /^\\#\\!/\n lines.shift if lines[0] =~ /coding[:=]\\s*[-\\w.]+/ &&\n [ \"python\", \"rb\" ].include?(@options[:language])\n\n # To detect both block comments and single-line comments, we'll set\n # up a tiny state machine, and loop through each line of the file.\n # This requires an `in_comment_block` boolean, and a few regular\n # expressions for line tests. We'll do the same for fake heredoc parsing.\n in_comment_block = false\n in_heredoc = false\n single_line_comment, block_comment_start, block_comment_mid, block_comment_end =\n nil, nil, nil, nil\n if not @options[:comment_chars][:single].nil?\n single_line_comment = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:single])}\\\\s?\")\n end\n if not @options[:comment_chars][:multi].nil?\n block_comment_start = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:start])}\\\\s*$\")\n block_comment_end = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:end])}\\\\s*$\")\n block_comment_one_liner = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:start])}\\\\s*(.*?)\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:end])}\\\\s*$\")\n block_comment_start_with = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:start])}\\\\s*(.*?)$\")\n block_comment_end_with = Regexp.new(\"\\\\s*(.*?)\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:end])}\\\\s*$\")\n if @options[:comment_chars][:multi][:middle]\n block_comment_mid = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:middle])}\\\\s?\")\n end\n end\n if not @options[:comment_chars][:heredoc].nil?\n heredoc_start = Regexp.new(\"#{Regexp.escape(@options[:comment_chars][:heredoc])}(\\\\S+)$\")\n end\n lines.each do |line|\n # If we're currently in a comment block, check whether the line matches\n # the _end_ of a comment block or the _end_ of a comment block with a\n # comment.\n if in_comment_block\n if block_comment_end && line.match(block_comment_end)\n in_comment_block = false\n elsif block_comment_end_with && line.match(block_comment_end_with)\n in_comment_block = false\n docs << line.match(block_comment_end_with).captures.first.\n sub(block_comment_mid || '', '')\n else\n docs << line.sub(block_comment_mid || '', '')\n end\n # If we're currently in a heredoc, we're looking for the end of the\n # heredoc, and everything it contains is code.\n elsif in_heredoc\n if line.match(Regexp.new(\"^#{Regexp.escape(in_heredoc)}$\"))\n in_heredoc = false\n end\n code << line\n # Otherwise, check whether the line starts a heredoc. If so, note the end\n # pattern, and the line is code. Otherwise check whether the line matches\n # the beginning of a block, or a single-line comment all on it's lonesome.\n # In either case, if there's code, start a new section.\n else\n if heredoc_start && line.match(heredoc_start)\n in_heredoc = $1\n code << line\n elsif block_comment_one_liner && line.match(block_comment_one_liner)\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n docs << line.match(block_comment_one_liner).captures.first\n elsif block_comment_start && line.match(block_comment_start)\n in_comment_block = true\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n elsif block_comment_start_with && line.match(block_comment_start_with)\n in_comment_block = true\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n docs << line.match(block_comment_start_with).captures.first\n elsif single_line_comment && line.match(single_line_comment)\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n docs << line.sub(single_line_comment || '', '')\n else\n code << line\n end\n end\n end\n sections << [docs, code] if docs.any? || code.any?\n normalize_leading_spaces(sections)\n end"
] |
[
"0.754856",
"0.69873405",
"0.6962336",
"0.68896824",
"0.66750926",
"0.66511756",
"0.66362494",
"0.66300225",
"0.65354717",
"0.6476929",
"0.6448425",
"0.64442104",
"0.644317",
"0.6222991",
"0.62110335",
"0.62019753",
"0.6178083",
"0.61281323",
"0.61281323",
"0.61205536",
"0.6085117",
"0.6084314",
"0.6084314",
"0.60757494",
"0.60605866",
"0.60535413",
"0.60446787",
"0.6037149",
"0.6021075",
"0.6012209",
"0.6010416",
"0.59797764",
"0.59757423",
"0.5965153",
"0.5932331",
"0.59287155",
"0.5923725",
"0.5922071",
"0.59184843",
"0.5913416",
"0.59121174",
"0.59110975",
"0.59085035",
"0.5908061",
"0.5905139",
"0.5905139",
"0.5882806",
"0.5870401",
"0.58689916",
"0.5847882",
"0.58409435",
"0.583411",
"0.583411",
"0.58216566",
"0.58161724",
"0.5815236",
"0.57936686",
"0.5790069",
"0.5783049",
"0.578236",
"0.578236",
"0.578236",
"0.5767171",
"0.5765466",
"0.57619584",
"0.57594395",
"0.5753474",
"0.5753474",
"0.5753474",
"0.575149",
"0.5749937",
"0.5720757",
"0.5719345",
"0.5709539",
"0.57014775",
"0.568011",
"0.568011",
"0.5677175",
"0.56719023",
"0.56697977",
"0.5669025",
"0.566551",
"0.5658724",
"0.56535995",
"0.56517196",
"0.56505173",
"0.564742",
"0.5646581",
"0.56456506",
"0.5637545",
"0.5637366",
"0.5635685",
"0.5615116",
"0.5611665",
"0.55855054",
"0.5577382",
"0.5574945",
"0.5569901",
"0.55689555",
"0.55634874",
"0.55403024"
] |
0.0
|
-1
|
This method is not yet implemented. This method (should) extracts previously stored data for reuse. options [Hash]:: A hash that is passed to this extension by the main LEWT program containing rutime options.
|
def extract( options )
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ft_options(user_options, default, logger)\n # check version for this feature\n os_version = OpenStudio::VersionString.new(OpenStudio.openStudioVersion)\n\n os300 = OpenStudio::VersionString.new('3.0.0')\n os330 = OpenStudio::VersionString.new('3.3.0')\n known_ft_opts = {\n # All Versions\n runcontrolspecialdays: { method_name: :setKeepRunControlSpecialDays, min_version: nil },\n ip_tabular_output: { method_name: :setIPTabularOutput, min_version: nil },\n no_lifecyclecosts: { method_name: :setExcludeLCCObjects, min_version: nil },\n # 3.0.0\n no_sqlite_output: { method_name: :setExcludeSQliteOutputReport, min_version: os300 },\n no_html_output: { method_name: :setExcludeHTMLOutputReport, min_version: os300 },\n no_variable_dictionary: { method_name: :setExcludeVariableDictionary, min_version: os300 },\n # 3.3.0\n no_space_translation: { method_name: :setExcludeSpaceTranslation, min_version: os330 }\n }\n\n ft_opts = {}\n\n # try to read from OSW\n if @run_options.is_initialized\n ftOpts = \"\"\n if @run_options.get.respond_to?(:forwardTranslatorOptions)\n # 3.6.0 and above. It still defines forwardTranslateOptions for\n # backward compatibility but trying to avoid a Warn in the log\n ftOpts = @run_options.get.forwardTranslatorOptions().string()\n elsif @run_options.get.respond_to?(:forwardTranslateOptions)\n ftOpts = @run_options.get.forwardTranslateOptions()\n end\n if !ftOpts.empty?\n jsonOpts = JSON.parse(ftOpts, symbolize_names: true)\n\n jsonOpts.each do |opt_flag_name, opt_flag|\n unless known_ft_opts.key?(opt_flag_name)\n log_message = \"'ft_options' suboption '#{opt_flag_name}' is not recognized, ignoring it.\"\n logger.warn log_message\n next\n end\n min_version = known_ft_opts[opt_flag_name.to_sym][:min_version]\n if !min_version.nil? && os_version < min_version\n log_message = \"'ft_options' suboption '#{opt_flag_name}' is only supported for OpenStudio Version >= #{min_version.str}, ignoring it.\"\n logger.warn log_message\n next\n end\n ft_opts[opt_flag_name] = { method_name: known_ft_opts[opt_flag_name][:method_name], value: opt_flag }\n end\n end\n end\n\n # user option trumps all others, so do it last\n if user_options[:ft_options]\n user_options[:ft_options].each do |opt_flag_name, opt_flag|\n puts \"#{opt_flag_name} = #{opt_flag}\"\n unless known_ft_opts.key?(opt_flag_name)\n log_message = \"'ft_options' suboption '#{opt_flag_name}' is not recognized, ignoring it.\"\n logger.warn log_message\n next\n end\n min_version = known_ft_opts[opt_flag_name][:min_version]\n if !min_version.nil? && os_version < min_version\n log_message = \"'ft_options' suboption '#{opt_flag_name}' is only supported for OpenStudio Version >= #{min_version.str}, ignoring it.\"\n logger.warn log_message\n next\n end\n ft_opts[opt_flag_name] = { method_name: known_ft_opts[opt_flag_name][:method_name], value: opt_flag }\n end\n end\n\n if !ft_opts.empty?\n return ft_opts\n end\n\n return default\n end",
"def parse_options(args)\n program = Pathname.new(__FILE__).realpath\n header = <<-END_HEADER\n# Running #{program} on #{Time.now}\n# Command-line arguments are: #{args}\n# Command-line to reproduce: #{program} #{args.join(\" \")}\n#\nEND_HEADER\n timestamp = Time.now.strftime(\"%Y%m%d%H%M%S\")\n current_dir = Pathname.pwd\n output_basename = current_dir + \"log\"\n output_basename.mkdir unless output_basename.directory?\n options = OpenStruct.new\n options.log_level = :off\n options.log_destination = STDOUT\n options.db_url = { :adapter => :in_memory }\n options.generate = nil\n options.time = 60\n options.profile_strings = false\n options.output_filename = \"dm-tpcc-#{timestamp}.out\"\n options.data_directory = current_dir + \"data\"\n options.load = false\n options.save_data = false\n\n opts = OptionParser.new do |opts|\n opts.banner = \"Usage: dm-tpcc [options]\"\n opts.separator \"\"\n\n opts.on(\"-g NUM_WAREHOUSES\", \"--generate NUM_WAREHOUSES\", Integer,\n \"Generate data for the number of warehouses.\") do |g| \n options.generate = g \n end\n\n opts.on(\"-s DIRECTORY_NAME\", \"--save DIRECTORY_NAME\",\n \"Save generated data for later use.\") do |s| \n options.data_directory = s unless (s.nil? || s.empty?)\n end\n\n opts.on(\"-S\", \"--save-data\", \"Save generated data for later use.\") do |s| \n options.save_data = s\n end\n\n opts.on(\"-D\", \"--load-data\", \"Load data from saved datasets.\") do |l|\n options.load = l\n end\n\n opts.on(\"--profile-string-algorithms\",\n \"Profile different string generators\") do |sg| \n options.profile_strings = sg \n end\n\n opts.on(\"-d DB_URL\", \"--db-url DB_URL\", String,\n \"Specify a DataMapper DB URL\") do |dburl| \n options.db_url = dburl \n end\n\n opts.on(\"-l LOG_LEVEL\", \"--log-level LOG_LEVEL\", LOG_LEVELS,\n \"Specify a log level.\") do |l| \n options.log_level = l.to_sym \n end\n\n opts.on(\"-L LOG_FILE\", \"--log-file LOG_FILE\", String,\n \"Specify a log file.\") do |f| \n options.log_destination = File.new(f, \"a+\") \n end\n\n opts.on(\"-o FILENAME\", \"--output FILENAME\", String,\n \"Filename to save output to.\") do |outputfile| \n options.output_filename = outputfile\n end\n\n opts.on(\"-t DURATION\", \"--time DURATION\", Integer,\n \"Duration of the test in seconds.\") do |time| \n options.time = time \n end\n\n opts.on(\"--once\", \"Run just one time\") do |once| \n options.once = once \n end\n\n opts.separator \"Common Options:\"\n opts.on_tail(\"-h\", \"--help\", \"Show this message.\") do\n puts opts\n\n print \"\\nLog Levels:\\n\"\n LOG_LEVELS.keys.each { |l| print \"\\t#{l}\\n\" }\n print \"\\nExample Database URLS:\\n\"\n $example_dbs.each { |db| print \"\\t#{db}\\n\" }\n exit\n end\n opts.on_tail(\"--version\", \"Show version\") do\n puts DataMapper::TPCC::VERSION\n exit\n end\n end\n\n opts.parse!(args)\n \n # Process options into global variables (ick)\n $output = File.open(output_basename + options.output_filename, \"w+\")\n $output.print header\n $data_directory = options.data_directory\n $data_directory.mkdir unless $data_directory.directory?\n\n options\nend",
"def get_options\n options = {}\n options[:commands] = []\n options[:commands] << :add\n options[:commands] << :update\n options[:commands] << :print\n \n options[:tag_file] = File.expand_path('../data/example-tags.xml', File.dirname(__FILE__))\n \n options[:in_path] = File.expand_path('../data/tokyo-drift.flv', File.dirname(__FILE__))\n options[:out_path] = File.expand_path('../data/tokyo-drift-processed.flv', File.dirname(__FILE__))\n \n options[:metadatacreator] = \"inlet media FLVTool2 v1.0.7 - http://www.inlet-media.de/flvtool2\"\n options[:metadata] = {}\n options[:in_pipe] = false\n options[:out_pipe] = false\n options[:simulate] = false\n options[:verbose] = false\n options[:recursive] = false\n options[:preserve] = false\n options[:xml] = false\n options[:compatibility_mode] = false\n options[:in_point] = nil\n options[:out_point] = nil\n options[:keyframe_mode] = false\n options[:tag_number] = nil\n options[:stream_log] = true\n options[:collapse] = false\n \n return options\nend",
"def process_options options={}\n\t\t\t\tif options[:term].nil? == false\n\t\t\t\t\t@@gp.set term:\"#{options[:term]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:datafilesep].nil? == false\n\t\t\t\t\t@@gp.set \"datafile separator '#{options[:datafilesep]}'\"\n\t\t\t\tend\n\n\t\t\t\tif ((options[:xtype].nil? == false and options[:xtype] == :date) or\n\t\t\t\t\t(options[:ytype].nil? == false and options[:ytype] == :date)) and\n\t\t\t\t\t(options[:timefmt].nil? == false)\n\t\t\t\t\tif options[:xtype] == :date\n\t\t\t\t\t\t@@gp.set \"xdata time\"\n\t\t\t\t\tend\n\n\t\t\t\t\tif options[:ytype] == :date\n\t\t\t\t\t\t@@gp.set \"ydata time\"\n\t\t\t\t\tend\n\n\t\t\t\t\t@@gp.set \"timefmt '#{options[:timefmt]}'\"\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif options[:xrange].nil? == false\n\t\t\t\t\tif options[:xtype].nil? == false and options[:xtype] == :date\n\t\t\t\t\t\t@@gp.set \"xrange ['#{Time.at(options[:xrange].begin).strftime(\"%Y-%m-%d %H:%M:%S\")}':'#{Time.at(options[:xrange].end).strftime(\"%Y-%m-%d %H:%M:%S\")}']\"\n\t\t\t\t\telse\n\t\t\t\t\t\t@@gp.set \"xrange [#{options[:xrange].begin}:#{options[:xrange].end}]\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"xrange\"\n\t\t\t\tend\n\n\t\t\t\tif options[:yrange].nil? == false\n\t\t\t\t\tif options[:ytype].nil? == false and options[:ytype] == :date\n\t\t\t\t\t\t@@gp.set \"yrange ['#{Time.at(options[:yrange].begin).strftime(\"%Y-%m-%d %H:%M:%S\")}':'#{Time.at(options[:yrange].end).strftime(\"%Y-%m-%d %H:%M:%S\")}']\"\n\t\t\t\t\telse\n\t\t\t\t\t\t@@gp.set \"yrange [#{options[:yrange].begin}:#{options[:yrange].end}]\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"yrange\"\n\t\t\t\tend\n\n\t\t\t\tif options[:xtics].nil? == false\n\t\t\t\t\t@@gp.set \"xtics #{options[:xtics]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:ytics].nil? == false\n\t\t\t\t\t@@gp.set \"ytics #{options[:ytics]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:mxtics].nil? == false\n\t\t\t\t\t@@gp.set \"mxtics #{options[:mxtics]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:mytics].nil? == false\n\t\t\t\t\t@@gp.set \"mytics #{options[:mytics]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:logx].nil? == false and options[:logx] == true\n\t\t\t\t\t@@gp.set \"log x\"\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"log x\"\n\t\t\t\tend\n\n\t\t\t\tif options[:logy].nil? == false and options[:logy] == true\n\t\t\t\t\t@@gp.set \"log y\"\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"log y\"\n\t\t\t\tend\n\n\t\t\t\tif options[:xformat].nil? == false\n\t\t\t\t\t@@gp.set \"format x '#{options[:xformat]}'\"\n\t\t\t\tend\n\n\t\t\t\tif options[:yformat].nil? == false\n\t\t\t\t\t@@gp.set \"format y '#{options[:yformat]}'\"\n\t\t\t\tend\n\n\t\t\t\tif options[:xlabel].nil? == false\n\t\t\t\t\t@@gp.set \"xlabel '#{options[:xlabel]}'\"\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"xlabel\"\n\t\t\t\tend\n\n\t\t\t\tif options[:ylabel].nil? == false\n\t\t\t\t\t@@gp.set \"ylabel '#{options[:ylabel]}'\"\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"ylabel\"\n\t\t\t\tend\n\n\t\t\t\tif options[:key].nil? == false\n\t\t\t\t\t@@gp.set \"key #{options[:key]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:grid].nil? == false\n\t\t\t\t\t@@gp.set \"grid #{options[:grid]}\"\n\t\t\t\tend\n\t\t\tend",
"def getUserOptions\n opts = Trollop::options do\n opt :verbose, \"print out all kinds of information about execution\"\n opt :file, \"specify an input email template file\", :type => :string\n\topt :auth, \"specify an file containing authentication info\", :type => :string\n opt :limit, \"specify the maximum number of users you want to query from an API\", :type => :integer\n end\n \n $verbose = opts[:verbose]\n $file = opts[:file]\n $auth = opts[:auth]\n $limit = opts[:limit]\n \n #kill the program if the user specifies a non existent template file\n Trollop::die :file, \"must exist\" unless File.exist?($file) if $file\n \n #kill the program if the user specifies a non existent authorization file\n Trollop::die :auth, \"must exist\" unless File.exist?($auth) if $auth\nend",
"def process_options\n output_help if @options.help\n @afilename = @options.ipfile \n @ofilename = @options.opfile \n @user = @options.user\n # convert 'since' time to seconds\n since = @options.since \n case since\n when /\\d+m/\n @seconds = since.to_i * 60\n when /\\d+h/\n @seconds = since.to_i * 60 * 60\n when /\\d+d/\n @seconds = since.to_i * 24 * 60 * 60 \n else\n puts \"Unexpected pattern encountered in '--since' option!\"\n exit 99\n end\n end",
"def get_data(options)\r\n data = options[:data]\r\n\r\n data\r\n end",
"def extract_modified_lines(file_path, options); end",
"def extract_modified_lines(file_path, options); end",
"def userargs\n #\n # Portion to interact with user at commandline. Processes users arguments and aligns them within an options hash\n # These options are globally avalilable, and are not mutable. The can be overwritten so be sure to save the contents\n # rather than attempting to read directly from the has itself.\n #\n begin # Catch/Rescue block start\n $options = OpenStruct.new # create a new OpenStruct object\n OptionParser.new do |opt|\n opt.on('-t','--type TYPE','Consume all files of type [\"TXT\",\"GZ\"] in a directory') { |o|\n $options[:type] = o } # consumes all files of given within a given directory\n opt.on('-i','--input FILE/FOLDER','location of file(s) to process') { |o|\n $options[:input] = o } # create files in directory given by user, default if not given\n opt.on('-e','--explode','Explode contents of \"tar.gz\" files to disk') { |o|\n $options[:explode] = o } # create files from compressed file in directory given by user, default if not given\n opt.on('-o','--output{=FOLDERNAME}','Location on disk to store contents generated') { |o|\n $options[:folder] = o } # location (folder) where to store the generated output\n opt.on('-d','--debug','Enables debugging information to be displayed, performance hit') { |o|\n $options[:debug] = o } # enabled debugging output, performance hit\n opt.on('-v','--verbose','Adds additional information to STDOUT, performance hit increases') { |o|\n $options[:verbose] = o } # adds additional debugging information to STDOUT, greater performance hit\n opt.on('-s','--sleep{=TIME}','Adds pause to decrease STDOUT flooding, performance hit increases') { |o|\n $options[:sleep] = o } # adds additional debugging information to STDOUT, greater performance hit\n end.parse! # Stop parsing options from user @ cli\n rescue => someerror # catch error to var\n puts \"[ERROR]:: OptionsParser fault: #{someerror}\"\n end # Catch/Rescue block end\nend",
"def token_data options = {}\n if options[:force_reload]\n @_token_data = load_token_debug_data\n else\n @_token_data ||= load_token_debug_data\n end\n end",
"def extract_data_from_options(options)\n OPTIONS.each do |option|\n instance_variable_set \"@#{option}\", options[option]\n end\n end",
"def modified_files(options); end",
"def modified_files(options); end",
"def _run_options(options)\n options['current_account'] = current_account if current_account\n options['current_admin'] = current_admin if current_admin\n options\n end",
"def revive options\n setup options\n end",
"def persist_options()\n return unless $options[:persist]\n\n def update_if_there(opts, x) opts[x] = $options[x] if $options[x] end\n options = {}\n update_if_there(options, :source)\n update_if_there(options, :tpch_data_path)\n update_if_there(options, :inorder_path)\n update_if_there(options, :k3_csv_path)\n update_if_there(options, :dbt_data_path)\n update_if_there(options, :mosaic_path)\n update_if_there(options, :uid)\n update_if_there(options, :jobid)\n update_if_there(options, :skew)\n File.write($last_path, JSON.dump(options))\nend",
"def options_reload\n @cooldown, @ignore, @control, @thread =\n OPTIONS.values_at(:cooldown, :ignore, :control, :thread)\n end",
"def rufus_options\n opts = {}\n [:first_at, :last_at, :number_of_times].each do |opt|\n opts[opt] = self.send(opt) if self.send(opt).present?\n end\n\n # rufus gives an error if first_at is in the past, so drop it\n opts.delete(:first_at) if opts[:first_at].present? ? Rufus::Scheduler.parse(opts[:first_at]) < Time.now : false \n\n # set a skip flag if last_at is in the past\n if opts[:last_at].present?\n opts[:_skip] = true if Rufus::Scheduler.parse(opts[:last_at]) < Time.now\n end\n\n opts\n end",
"def parse_options()\n options = {}\n \n optparse = OptionParser.new do |opts|\n # Set up the help banner\n\n opts.banner = \"\\nUsage: weekly_agents [options] ...\\n\\n\"\n \n # Define the options\n\n opts.on( '-s','--start_time START', \n Integer, \n 'Start collecting stats from START (seconds since the epoch)' \n ) do |s|\n options[:start_time] = s\n end\n\n opts.on( '-h','--hours HOURS', \n Integer, \n 'Collect stats for HOURS' \n ) do |h|\n options[:hours] = h\n end\n\n opts.on( '-d','--days DAY', \n Integer, \n 'Collect stats for DAYS' \n ) do |d|\n options[:days] = d\n end\n\n opts.on( '-m','--minutes MINUTES', \n Integer, \n 'Collect stats for MINUTES' \n ) do |m|\n options[:minutes] = m\n end\n\n opts.on( '-u', '--usage', 'Display this screen' ) do\n puts (opts)\n print <<-'EOF'\n\n --start_time expect a time argument in the the form of seconds since the epoch, e.g.:\n\n --start_time=`date --date \"2011-03-21\" +%s`\n\n The --hours, --minutes and --days options are used to specify the \n the length of the time span for which we want to accumulate statistics. \n default is seven days\n\n Normal usage of this script is to run it with out any options, \n in which case it gathers statistics for the last week\n\n EOF\n\n exit 0\n end\n \n end\n \n optparse.parse!\n\n xoptions = options.clone()\n\n xoptions.delete_if do |key, value|\n (key == :start_time)\n end\n \n if (xoptions.size > 1) then\n\n puts \"You have selected mutually exclusive options:\"\n\n xoptions.each do |key, val|\n case key\n when :hours\n puts \" --hours\"\n when :days\n puts \" --days\"\n when :days\n puts \" --minutes\"\n end # end case\n end # end do\n puts\n puts optparse.to_s\n exit 1\n\n end #end if\n\n return options\n\nend",
"def populate_cc_user_data(options)\n install_locale = options['q_struct']['locale'].value\n if install_locale.match(/\\./)\n install_locale = install_locale.split(\".\")[0]\n end\n if options['livecd'] == true\n install_target = \"/target\"\n else\n install_target = \"\"\n end\n install_nameserver = options['q_struct']['nameserver'].value\n install_base_url = \"http://\"+options['hostip']+\"/\"+options['name']\n install_layout = install_locale.split(\"_\")[0]\n install_variant = install_locale.split(\"_\")[1].downcase\n install_gateway = options['q_struct']['gateway'].value\n admin_shell = options['q_struct']['admin_shell'].value\n admin_sudo = options['q_struct']['admin_sudo'].value\n disable_dhcp = options['q_struct']['disable_dhcp'].value\n install_name = options['q_struct']['hostname'].value\n resolved_conf = \"/etc/systemd/resolved.conf\"\n admin_user = options['q_struct']['admin_username'].value\n admin_group = options['q_struct']['admin_username'].value\n admin_home = \"/home/\"+options['q_struct']['admin_username'].value\n admin_crypt = options['q_struct']['admin_crypt'].value\n install_nic = options['q_struct']['interface'].value\n if disable_dhcp.match(/true/)\n install_ip = options['q_struct']['ip'].value\n end\n install_cidr = options['q_struct']['cidr'].value\n install_disk = options['q_struct']['partition_disk'].value\n if install_disk.match(/\\//)\n install_disk = install_disk.split(/\\//)[-1]\n end\n #netplan_file = \"#{install_target}/etc/netplan/01-netcfg.yaml\"\n netplan_file = \"#{install_target}/etc/netplan/50-cloud-init.yaml\"\n locale_file = \"#{install_target}/etc/default/locales\"\n grub_file = \"#{install_target}/etc/default/grub\"\n ssh_dir = \"#{install_target}/home/#{admin_user}/.ssh\"\n auth_file = \"#{ssh_dir}/authorized_keys\"\n sudo_file = \"#{install_target}/etc/sudoers.d/#{admin_user}\"\n if options['vmnetwork'].to_s.match(/hostonly/)\n ks_ip = options['hostonlyip']\n else\n if disable_dhcp.match(/false/)\n ks_ip = options['hostonlyip']\n else\n ks_ip = options['hostip']\n end\n end\n if disable_dhcp.match(/false/)\n install_dhcp = \"yes\"\n else\n install_dhcp = \"no\"\n end\n if options['copykeys'] == true\n ssh_keyfile = options['sshkeyfile']\n if File.exist?(ssh_keyfile)\n ssh_key = %x[cat #{ssh_keyfile}].chomp\n ssh_dir = \"#{install_target}/home/\"+admin_user+\"/.ssh\"\n end\n end\n ks_port = options['httpport']\n user_data = []\n exec_data = []\n user_data.push(\"#cloud-config\")\n if !options['vm'].to_s.match(/mp|multipass/)\n in_target = \"curtin in-target --target=/target -- \"\n user_data.push(\"autoinstall:\")\n user_data.push(\" version: 1\")\n user_data.push(\" apt:\")\n user_data.push(\" geoip: true\")\n user_data.push(\" preserve_sources_list: false\")\n user_data.push(\" primary:\")\n if options['arch'].to_s.match(/arm/)\n user_data.push(\" - arches: [arm64, arm]\")\n else\n user_data.push(\" - arches: [amd64, i386]\")\n end\n user_data.push(\" uri: http://archive.ubuntu.com/ubuntu\")\n user_data.push(\" - arches: [default]\")\n user_data.push(\" uri: http://ports.ubuntu.com/ubuntu-ports\")\n user_data.push(\" identity:\")\n user_data.push(\" hostname: #{install_name}\")\n user_data.push(\" password: #{admin_crypt}\")\n user_data.push(\" realname: #{admin_user}\")\n user_data.push(\" username: #{admin_user}\")\n user_data.push(\" keyboard:\")\n user_data.push(\" layout: #{install_layout}\")\n user_data.push(\" variant: #{install_variant}\")\n user_data.push(\" locale: #{install_locale}.UTF-8\")\n user_data.push(\" network:\")\n user_data.push(\" network:\")\n user_data.push(\" version: 2\")\n user_data.push(\" ethernets:\")\n user_data.push(\" #{install_nic}:\")\n user_data.push(\" dhcp4: #{install_dhcp}\")\n user_data.push(\" ssh:\")\n user_data.push(\" install-server: true\")\n user_data.push(\" allow-pw: true\")\n user_data.push(\" storage:\")\n user_data.push(\" config:\")\n user_data.push(\" - grub_device: true\")\n user_data.push(\" id: disk-#{install_disk}\")\n user_data.push(\" path: /dev/#{install_disk}\")\n user_data.push(\" ptable: gpt\")\n user_data.push(\" type: disk\")\n user_data.push(\" wipe: superblock-recursive\")\n user_data.push(\" - device: disk-#{install_disk}\")\n user_data.push(\" flag: bios_grub\")\n user_data.push(\" id: partition-0\")\n user_data.push(\" number: 1\")\n user_data.push(\" size: 1048576\")\n user_data.push(\" type: partition\")\n user_data.push(\" - device: disk-#{install_disk}\")\n user_data.push(\" id: partition-1\")\n user_data.push(\" number: 2\")\n user_data.push(\" size: -1\")\n user_data.push(\" type: partition\")\n user_data.push(\" wipe: superblock\")\n user_data.push(\" - name: root_vg\")\n user_data.push(\" devices: [partition-1]\")\n user_data.push(\" preserve: false\")\n user_data.push(\" type: lvm_volgroup\")\n user_data.push(\" id: lvm_volgroup-0\")\n user_data.push(\" - name: root_lv\")\n user_data.push(\" volgroup: lvm_volgroup-0\")\n user_data.push(\" size: -1\")\n user_data.push(\" wipe: superblock\")\n user_data.push(\" preserve: false\")\n user_data.push(\" type: lvm_partition\")\n user_data.push(\" id: lvm_partition-0\")\n user_data.push(\" - fstype: ext4\")\n user_data.push(\" id: format-0\")\n user_data.push(\" type: format\")\n user_data.push(\" volume: lvm_partition-0\")\n user_data.push(\" - device: format-0\")\n user_data.push(\" id: mount-0\")\n user_data.push(\" path: /\")\n user_data.push(\" type: mount\")\n user_data.push(\" updates: security\")\n user_data.push(\" user-data:\")\n user_data.push(\" disable-root: false\")\n if disable_dhcp.match(/true/)\n exec_data.push(\"ip addr add #{install_ip}/#{install_cidr} dev #{install_nic}\")\n end\n exec_data.push(\"ip link set #{install_nic} up\")\n exec_data.push(\"ip route add default via #{install_gateway}\")\n exec_data.push(\"echo 'DNS=#{install_nameserver}' >> #{resolved_conf}\")\n exec_data.push(\"systemctl restart systemd-resolved\")\n else\n in_target = \"\"\n if options['method'].to_s.match(/ci/)\n user_data.push(\"hostname: #{install_name}\")\n user_data.push(\"groups:\")\n user_data.push(\" - #{admin_user}: #{admin_group}\")\n user_data.push(\"users:\")\n user_data.push(\" - default\")\n user_data.push(\" - name: #{admin_user}\")\n user_data.push(\" gecos: #{admin_user}\")\n user_data.push(\" primary_group: #{admin_group}\")\n user_data.push(\" shell: #{admin_shell}\")\n user_data.push(\" passwd: #{admin_crypt}\")\n user_data.push(\" sudo: #{admin_sudo}\")\n user_data.push(\" lock_passwd: false\")\n end\n end\n if options['dnsmasq'] == true && options['vm'].to_s.match(/mp|multipass/)\n exec_data.push(\"/usr/bin/systemctl disable systemd-resolved\")\n exec_data.push(\"/usr/bin/systemctl stop systemd-resolved\")\n exec_data.push(\"rm /etc/resolv.conf\")\n if options['q_struct']['nameserver'].value.to_s.match(/\\,/)\n nameservers = options['q_struct']['nameserver'].value.to_s.split(\"\\,\")\n nameservers.each do |nameserver|\n exec_data.push(\"echo 'nameserver #{nameserver}' >> /etc/resolv.conf\")\n end\n else\n nameserver = options['q_struct']['nameserver'].value.to_s\n exec_data.push(\" - echo 'nameserver #{nameserver}' >> /etc/resolv.conf\")\n end\n else \n exec_data.push(\"echo 'DNS=#{install_nameserver}' >> #{install_target}#{resolved_conf}\")\n exec_data.push(\"#{in_target}/usr/sbin/locale-gen #{install_locale}.UTF-8\")\n end\n exec_data.push(\"echo 'LC_ALL=en_US.UTF-8' > #{locale_file}\")\n exec_data.push(\"echo 'LANG=en_US.UTF-8' >> #{locale_file}\")\n exec_data.push(\"echo '#{admin_user} ALL=(ALL) NOPASSWD:ALL' > #{sudo_file}\")\n if options['copykeys'] == true and File.exist?(ssh_keyfile) and !options['vm'].to_s.match(/mp|multipass/)\n exec_data.push(\"#{in_target}groupadd #{admin_user}\")\n exec_data.push(\"#{in_target}useradd -p '#{admin_crypt}' -g #{admin_user} -G #{admin_group} -d #{admin_home} -s /usr/bin/bash -m #{admin_user}\")\n exec_data.push(\"mkdir -p #{ssh_dir}\")\n exec_data.push(\"echo '#{ssh_key}' > #{auth_file}\")\n exec_data.push(\"chmod 600 #{auth_file}\")\n exec_data.push(\"chmod 700 #{ssh_dir}\")\n exec_data.push(\"#{in_target}chown -R #{admin_user}:#{admin_user} #{admin_home}\")\n end\n if !options['vm'].to_s.match(/mp|multipass/)\n if options['vm'].to_s.match(/kvm/)\n exec_data.push(\"systemctl enable serial-getty@ttyS0.service\")\n exec_data.push(\"systemctl start serial-getty@ttyS0.service\")\n else\n if options['serial'] == true\n if options['biosdevnames'] == true\n exec_data.push(\"echo 'GRUB_CMDLINE_LINUX=\\\\\\\"net.ifnames=0 biosdevname=0 console=tty0 console=ttyS0\\\\\\\"' >> #{grub_file}\")\n else\n exec_data.push(\"echo 'GRUB_CMDLINE_LINUX=\\\\\\\"console=tty0 console=ttyS0\\\\\\\"' >> #{grub_file}\")\n end\n exec_data.push(\"echo 'GRUB_TERMINAL_INPUT=\\\\\\\"console serial\\\\\\\"' >> #{grub_file}\")\n exec_data.push(\"echo 'GRUB_TERMINAL_OUTPUT=\\\\\\\"console serial\\\\\\\"' >> #{grub_file}\")\n else\n if options['biosdevnames'] == true\n exec_data.push(\"echo 'GRUB_CMDLINE_LINUX=\\\\\\\"net.ifnames=0 biosdevname=0\\\\\\\"' >> #{grub_file}\")\n end\n end\n end\n if !options['vm'].to_s.match(/mp|multipass/)\n if options['dhcp'] == false || options['dnsmasq'] == true\n exec_data.push(\"echo '# This file describes the network interfaces available on your system' > #{netplan_file}\")\n exec_data.push(\"echo '# For more information, see netplan(5).' >> #{netplan_file}\")\n exec_data.push(\"echo 'network:' >> #{netplan_file}\")\n exec_data.push(\"echo ' version: 2' >> #{netplan_file}\")\n exec_data.push(\"echo ' renderer: networkd' >> #{netplan_file}\")\n exec_data.push(\"echo ' ethernets:' >> #{netplan_file}\")\n exec_data.push(\"echo ' #{install_nic}:' >> #{netplan_file}\")\n else\n if disable_dhcp.match(/true/)\n exec_data.push(\"echo ' addresses: [#{install_ip}/#{install_cidr}]' >> #{netplan_file}\")\n exec_data.push(\"echo ' gateway4: #{install_gateway}' >> #{netplan_file}\")\n else\n exec_data.push(\"echo ' dhcp4: true' >> #{netplan_file}\")\n end\n end\n if options['serial'] == true || options['biosdevnames'] == true\n exec_data.push(\"#{in_target}update-grub\")\n end\n if options['reboot'] == true\n exec_data.push(\"#{in_target}reboot\")\n end\n end\n end\n return user_data,exec_data\nend",
"def parse_tire_option_values\n start_time = Time.now\n model_counter = 0\n variant_counter = 0\n option_list = {}\n valid_options = %w{load_range load_factor load_index sidewall utqg speed_rating size}\n mfg_list = get_manufacturer_list\n mfg_list.each do |mfg|\n puts \"Creating option values from product data for #{mfg}, adding them to application.yml\\n\"\n file = open_file_read('tires', mfg)\n data = YAML.load(file) \n data.each_key do |model| \n # a new model would be a type of wheel for a manufacturer\n model_counter +=1\n # each model points to an array of variants, each differing in some way\n data[model].each_pair do |key, value|\n if key == :variants\n value.each do |v|\n variant_counter += 1\n v.each_key do |k|\n if valid_options.include?(k.to_s)\n option_list[v[k]] = [] unless option_list.has_key?(v[k])\n new_option_value = {\n \"option_type\" => k.to_s.dasherize,\n \"name\" => v[k].to_s,\n \"presentation\" => v[k].to_s\n }\n option_list[v[k]] << new_option_value unless option_list[v[k]].include?(new_option_value)\n end\n end\n end\n end\n end\n end\n end\n puts \"Writing the options to option_values file now, for #{model_counter} models and #{variant_counter} variants...\\n\"\n @@config[:option_variants].merge!(option_list)\n f = File.open(APP_DATA,'w')\n YAML.dump(@@config, f)\n f.close \n puts \"Task took #{Time.now - start_time}\\n\" \n end",
"def initialize(options)\n @options = options.dup\n @file_name = @options[:file].strip\n @changes = []\n @error = nil\n \n hash = {\n get_user: @options[:get_user],\n cmd: 'Report',\n family: 'aix',\n general: \"Changes c, \\\n \tDefects d, \\\n \tFiles f, \\\n \tPath p, \\\n \tTracks t, \\\n \tLevels l, \\\n \tReleases r, \\\n \tVersions v, \\\n \tVersions prev \\\n \t\",\n where: \"f.basename = '#{file_name}' AND \\\n\t f.id = c.fileid AND \\\n\t c.trackid = t.id AND \\\n\t d.id = t.defectid AND \\\n\t f.pathid = p.id AND \\\n\t t.releaseid = r.id AND \\\n\t v.id = c.versionid AND \\\n prev.id = v.previousId AND \\\n l.id IN ( \\\n\t SELECT l.id \\\n FROM Levels l, \\\n LevelMembers lm \\\n WHERE lm.trackid = t.id AND \\\n l.id = lm.levelid AND \\\n ( l.type = 'published' or \\\n ( l.type = 'production' AND \\\n NOT EXISTS ( \\\n SELECT * \\\n FROM Levels l, \\\n LevelMembers lm \\\n WHERE l.id = lm.levelid AND \\\n l.type = 'published' AND \\\n t.id = lm.trackid ) \\\n ) \\\n ) \\\n UNION \\\n\t SELECT l.id \\\n FROM Levels l, \\\n LevelMembers lm \\\n WHERE l.name is null AND \\\n NOT EXISTS ( \\\n\t \tSELECT * \\\n FROM Levels l, \\\n LevelMembers lm \\\n WHERE l.id = lm.levelid AND \\\n l.type in ( 'production', \\\n 'published' ) AND \\\n t.id = lm.trackid ) \\\n ) \\\n ORDER BY path, release, c.versionId \\\n\t \",\n select: \"r.name AS release, \\\n d.type AS defect_type, \\\n d.name AS defect, \\\n l.name AS level, \\\n v.SID AS sccsid, \\\n p.name AS path, \\\n c.type, \\\n d.reference, \\\n prev.SID AS prev_sccsid, \\\n d.abstract\"\n }\n\n cmd = execute_cmvc_command.new(hash)\n if (cmd.rc == 0)\n if cmd.stdout.blank?\n @error = \"No output returned\"\n else\n @changes = cmd.stdout.split(\"\\n\").map do |line|\n Change.new(*line.split('|', 10))\n end\n end\n else\n @error = cmd.stderr\n end\n end",
"def relevant_options_digest(options); end",
"def extract_data!(options)\n if options.has_key?(:data)\n data = options.delete :data\n \n if Array === data\n data.each.with_index do |filepath, idx|\n if filepath.is_a?(Faraday::UploadIO)\n options[\"data[#{idx}]\"] = filepath\n else\n mime_type = extract_mimetype(filepath)\n options[\"data[#{idx}]\"] = Faraday::UploadIO.new(filepath, mime_type)\n end\n end\n elsif data.is_a?(Faraday::UploadIO)\n options[\"data\"] = data\n else\n mime_type = extract_mimetype(data)\n options[\"data\"] = Faraday::UploadIO.new(data, mime_type)\n end\n end\n end",
"def user_options(options)\n merged_options = options.dup\n merged_options[:cpu_cores] = get_option(:cores_per_socket)\n merged_options[:memory] = get_option(:vm_memory)\n merged_options.compact\n end",
"def update_config_options\n options = Util::OptsParser.options(ARGV)\n Util::Configuration.tag_time_to_live_in_seconds = options[:ttl]\n Util::Configuration.case_sensitive_matching = options[:case]\n Util::Configuration.hashtag_storage_class = options[:storage]\n Util::Configuration.log_capture_device = options[:log_device]\n Util::Configuration.automatic_restart = options[:automatic_restart]\n current_config = Util::Configuration.to_a\n current_config << \"Port: #{options[:port]}\"\n logger.info(current_config.join(', '))\n options\n end",
"def meta_data options={}\n if data_type\n output = data_type.meta_data( self )\n else\n output = { :filename => filename, \n :category => category.to_s,\n :location => location,\n :source_name => source.name }\n end\n \n if options[:skip]\n options[:skip].each do |label|\n output.delete(label)\n end\n end\n \n return output\n \n end",
"def fetch_options\n options = {}\n opts = GetoptLong.new(\n ['--radar-scan-path', GetoptLong::REQUIRED_ARGUMENT],\n ['--known-items-dir-path', GetoptLong::REQUIRED_ARGUMENT],\n ['--help', GetoptLong::NO_ARGUMENT]\n )\n opts.each do |opt, arg|\n options[opt] = arg\n end\n\n if options['--help']\n puts 'Usage: bin/space-radar [--radar-scan-path FILE] [--known-items-dir-path FOLDER]'\n puts 'The data files need to have the \\'txt\\' extension.'\n puts 'The default data will be used if no paths given.'\n exit 0\n end\n\n options\n end",
"def output_cc_user_data(options,user_data,exec_data,output_file)\n if !options['vm'].to_s.match(/mp|multipass/)\n in_target = \"curtin in-target --target=/target -- \"\n else\n in_target = \"\"\n end\n check_dir = File.dirname(output_file)\n check_dir_exists(options,check_dir)\n tmp_file = \"/tmp/user_data_\"+options['name']\n file = File.open(tmp_file, 'w')\n end_char = \"\\n\"\n user_data.each do |line|\n output = line+end_char\n file.write(output)\n end\n pkg_list = options['q_struct']['additional_packages'].value\n if options['vm'].to_s.match(/mp|multipass/)\n file.write(\"packages:\\n\")\n pkg_list.split(\" \").each do |line|\n output = \" - \"+line+\"\\n\"\n file.write(output)\n end\n file.write(\"runcmd:\\n\")\n exec_data.each do |line|\n output = \" - \"+line+\"\\n\"\n file.write(output)\n end\n else\n end_char = \"\"\n file.write(\" late-commands:\\n\")\n file.write(\" [\")\n exec_data.each do |line|\n output = \" \\\"\"+line+\"\\\",\"+end_char\n file.write(output)\n end\n file.write(\" \\\"#{in_target}apt update\\\",\")\n output = \" \\\"#{in_target}apt install -y \"+pkg_list+\"\\\",\"+end_char\n file.write(output)\n file.write(\" \\\"date\\\" ]\\n\\n\")\n end\n file.close\n message = \"Creating:\\tCloud user-data file \"+output_file\n command = \"cat #{tmp_file} >> #{output_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n print_contents_of_file(options,\"\",output_file)\n return\nend",
"def raw_data(options, context)\n # nil key is used to indicate that the cache contains the raw content of\n # the eyaml file\n raw_data = context.cached_value(nil)\n if raw_data.nil?\n if options.include?('path')\n raw_data = load_data_hash(options['path'], context)\n context.cache(nil, raw_data)\n else\n raise ArgumentError,\n \"'ldap_lookup_key': one of 'path', 'paths' 'glob', 'globs' or 'mapped_paths' must be declared in hiera.yaml when using this lookup_key function\"\n end\n end\n raw_data\n end",
"def gather_options\n @_options\n end",
"def options() end",
"def get_data\n data_array = File.open(RightScale::MetaDataFile)\n data_array.each do |d|\n key, data = d.split('=')\n key.strip!\n data.strip!\n rightscale_deprecated[key.sub(/RS_/,'')] = data unless add_server(key,data) \n end\nend",
"def generate_delta_scan_data(options)\r\n self.send(\"delta_scan#{@method_suffix}\", options)\r\n end",
"def run(runner, user_arguments)\n super(runner, user_arguments)\n\n # use the built-in error checking \n if !runner.validateUserArguments(arguments(), user_arguments)\n return false\n end\n\n # Assign the user inputs to variables\n reporting_frequency = runner.getStringArgumentValue(\"reporting_frequency\",user_arguments)\n inc_output_variables = runner.getBoolArgumentValue(\"inc_output_variables\",user_arguments)\n\n # Define run directory location\n run_dir_typical = File.absolute_path(File.join(Dir.pwd, 'run'))\n run_dir_comstock = File.absolute_path(File.join(Dir.pwd, '..'))\n if File.exist?(run_dir_typical)\n run_dir = run_dir_typical\n runner.registerInfo(\"run_dir = #{run_dir}\")\n elsif File.exist?(run_dir_comstock)\n run_dir = run_dir_comstock\n runner.registerInfo(\"run_dir = #{run_dir}\")\n else\n runner.registerError(\"Could not find directory with EnergyPlus output, cannont extract timeseries results\")\n return false\n end\n\n # Write the file that defines the unit conversions\n convert_txt_path = File.join(run_dir, 'convert.txt')\n File.open(convert_txt_path, 'w') do |f|\n # electricity\n f.puts('!Electricity')\n f.puts('conv,J,kWh,2.777778E-07,0')\n f.puts('wild,elec,J,kWh')\n # natural gas\n f.puts('!Natural Gas')\n f.puts('conv,J,kBtu,9.484517E-07,0')\n f.puts('wild,gas,J,kBtu')\n # water\n f.puts('!Water')\n f.puts('conv,m3,gal,2.641720E+02,0')\n end\n\n # Write the RVI file, which defines the CSV columns requested\n rvi_path = File.join(run_dir, 'var_request.rvi')\n enduse_timeseries_name = 'enduse_timeseries.csv'\n File.open(rvi_path,'w') do |f|\n f.puts('ip.eso') # convertESOMTR always uses this name\n f.puts(enduse_timeseries_name)\n\n # End Use/Fuel Type\n end_uses.each do |end_use|\n fuel_types.each do |fuel_type|\n variable_name = if end_use == 'Facility'\n \"#{fuel_type}:#{end_use}\"\n else\n \"#{end_use}:#{fuel_type}\"\n end\n f.puts(variable_name)\n end\n end\n\n # End Use Subcategories\n end_use_subcats.each do |subcat|\n f.puts(subcat)\n end\n\n # Optionally request timeseries\n if inc_output_variables\n output_vars.each do |output_var|\n f.puts(output_var)\n end\n end\n f.puts('0') # end-of-file marker\n end\n\n # Copy the necessary executables to the run directory\n start_time = Time.new\n resources_dir = File.absolute_path(File.join(__dir__, 'resources'))\n runner.registerInfo(\"resources_dir = #{resources_dir}\")\n\n # Copy convertESOMTR\n convert_eso_name = if os == :windows\n 'convertESOMTR.exe'\n elsif os == :linux\n 'convertESOMTR'\n elsif os == :macosx\n 'convertESOMTR.osx' # Made up extension to differentiate from linux\n end\n orig_convert_eso_path = File.join(resources_dir, convert_eso_name)\n convert_eso_path = File.join(run_dir, convert_eso_name)\n FileUtils.cp(orig_convert_eso_path, convert_eso_path)\n\n # Copy ReadVarsESO\n readvars_eso_name = if os == :windows\n 'ReadVarsESO.exe'\n elsif os == :linux\n 'ReadVarsESO'\n elsif os == :macosx\n 'ReadVarsESO.osx' # Made up extension to differentiate from linux\n end\n orig_readvars_eso_path = File.join(resources_dir, readvars_eso_name)\n readvars_eso_path = File.join(run_dir, readvars_eso_name)\n FileUtils.cp(orig_readvars_eso_path, readvars_eso_path) \n\n # Copy libraries (OSX only)\n if os == :macosx\n ['libgcc_s.1.dylib', 'libgfortran.5.dylib', 'libquadmath.0.dylib'].each do |dylib|\n FileUtils.cp(File.join(resources_dir, dylib), File.join(run_dir, dylib)) \n end\n end\n end_time = Time.new\n runner.registerInfo(\"Copying executables took #{end_time - start_time} seconds\")\n\n # Call convertESOMTR\n start_time = Time.new\n command = \"#{convert_eso_path}\"\n stdout_str, stderr_str, status = Open3.capture3(command, chdir: run_dir)\n if status.success?\n runner.registerInfo(\"Successfully ran convertESOMTR: #{command}\")\n else\n runner.registerError(\"Error running convertESOMTR: #{command}\")\n runner.registerError(\"stdout: #{stdout_str}\")\n runner.registerError(\"stderr: #{stderr_str}\")\n return false\n end\n end_time = Time.new\n runner.registerInfo(\"Running convertESOMTR took #{end_time - start_time} seconds\")\n\n # Call ReadVarsESO\n start_time = Time.new\n command = \"#{readvars_eso_path} #{File.basename(rvi_path)} #{reporting_frequency} Unlimited FixHeader\"\n stdout_str, stderr_str, status = Open3.capture3(command, chdir: run_dir)\n if status.success?\n runner.registerInfo(\"Successfully ran convertESOMTR: #{command}\")\n else\n runner.registerError(\"Error running convertESOMTR: #{command}\")\n runner.registerError(\"stdout: #{stdout_str}\")\n runner.registerError(\"stderr: #{stderr_str}\")\n return false\n end\n end_time = Time.new\n runner.registerInfo(\"Running ReadVarsESO took #{end_time - start_time} seconds\")\n\n return true\n end",
"def get_options\r\n\r\n # The myopts specified on the command line will be collected in *myopts*.\r\n # We set default values here.\r\n myopts = OpenStruct.new\r\n myopts.ifile = nil\r\n myopts.ofile = nil\r\n myopts.dbtype = nil\r\n\r\n opts = OptionParser.new do |opts|\r\n opts.banner = \"Database Loader #{VERSION}\"\r\n opts.separator \"\"\r\n opts.separator \"Usage: ruby #{$0} [options]\"\r\n opts.separator \"\"\r\n opts.separator \"Options:\"\r\n opts.on(\"-i\", \"--ifile FILE\", String,\r\n \"Select the yaml file to read\",\r\n \" defaults to same as database\") {|myopts.ifile|}\r\n opts.on(\"-o\", \"--ofile FILE\", String,\r\n \"Select the database file to write\",\r\n \" extension determined automatically\") {|myopts.ofile|}\r\n opts.on(\"-t\", \"--type DBTYPE\", DATABASES,\r\n \"Select the database type - required (no default)\",\r\n \" One of: #{DATABASES.join(\", \")}\",\r\n \" Example: -t gdbm\") {|myopts.dbtype|}\r\n opts.on_tail(\"-h\", \"--help\", \"Show this message\") do\r\n puts opts.help\r\n exit\r\n end\r\n opts.on_tail(\"-v\", \"--version\", \"Show version\") do\r\n puts \"Database Loader #{VERSION}\"\r\n exit\r\n end\r\n end\r\n\r\n opts.parse!(ARGV)\r\n raise(OptionParser::MissingArgument.new(\"-t\")) if myopts.dbtype == nil\r\n raise(OptionParser::ParseError, \"Must specify input file!\") if myopts.ifile.nil?\r\n myopts.ofile = myopts.ifile.dup if myopts.ofile.nil?\r\n myopts.ofile << \".gdbm\" if myopts.dbtype == :gdbm\r\n myopts.ofile << \".sqlite\" if myopts.dbtype == :sqlite\r\n myopts.ofile << \".sqlite3\" if myopts.dbtype == :sqlite3\r\n myopts.ifile << \".yaml\"\r\n\r\n return myopts\r\n rescue OptionParser::ParseError\r\n puts \"ERROR - #{$!}\"\r\n puts \"For help...\"\r\n puts \" ruby #{$0} --help\"\r\n exit\r\n end",
"def extract_options(args)\n options = args.last\n options.respond_to?(:to_hash) ? options.to_hash.dup : {}\n end",
"def extract_options(text, options)\n if text.is_a? Hash\n # we need to dup the text object because we're deleting keys from this object which manipulates the object passed in here\n # if this object is reused after beeing injected into this component, the keys would be missing\n self.options = text.dup\n else\n self.text = text\n # we need to dup the options object because we're deleting keys from this object which manipulates the object passed in here\n # if this object is reused after beeing injected into this component, the keys would be missing\n self.options = options.dup || {}\n end\n self.options.symbolize_keys!\n end",
"def process_options\n @options.verbose = false if @options.quiet\n @options.forceUpdate = true unless Time.parse(@options.since.to_s)\n end",
"def parse_options(args)\n\t\t\t\tbegin\n\t\t\t\t\t@options['output'] = :stdout\n\t\t\t\t\t@options['verbose'] = false\n\t\t\t\t\t@options['rescan'] = false\n\t\t\t\t\t@options[:timeout] = 25\n\t\t\t\t\t@options[:directory] = nil\n\n\t\t\t\t\topts = OptionParser.new do |opt|\n\t\t\t\t\t\topt.banner = \"#{APP_NAME} v#{VERSION}\\nJacob Hammack\\n#{HOME_PAGE}\\n\\n\"\n\t\t\t\t\t\topt.banner << \"Usage: #{APP_NAME} <options>\"\n\t\t\t\t\t\topt.separator('')\n\t\t\t\t\t\topt.separator('File Options')\n\n\t\t\t\t\t\topt.on('-h HASH', '--search-hash HASH', 'Searches a single hash on virustotal.com') do |hash|\n\t\t\t\t\t\t\t@hashes.push(hash)\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-r HASH[,HASH]', '--rescan-hash HASH[,HASH]', 'Requests a rescan of a single hash, or multiple hashes (comma separated), by virustotal.com') do |hash|\n\t\t\t\t\t\t\t@options['rescan'] = true\n\t\t\t\t\t\t\t@hashes.push(hash)\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-f FILE', '--search-hash-file FILE', 'Searches each hash in a file of hashes on virustotal.com') do |file|\n\t\t\t\t\t\t\tif File.exists?(file)\n\t\t\t\t\t\t\t\tputs \"[+] Adding file #{file}\" if @options['verbose']\n\t\t\t\t\t\t\t\t@files_of_hashes.push(file)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tputs \"[!] #{file} does not exist, please check your input!\\n\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-u FILE', '--upload-file FILE', 'Uploads a file to virustotal.com for analysis') do |file|\n\t\t\t\t\t\t\tif File.exists?(file)\n\t\t\t\t\t\t\t\tputs \"[+] Adding file #{file}\" if @options['verbose']\n\t\t\t\t\t\t\t\t@uploads.push(file)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tputs \"[!] #{file} does not exist, please check your input!\\n\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.separator('')\n\t\t\t\t\t\topt.separator(\"Url Options\")\n\n\t\t\t\t\t\topt.on('-s SITE', '--search-site SITE', 'Searches for a single url on virustotal.com') { |site|\n\t\t\t\t\t\t\t@sites.push(site)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\topt.separator('')\n\t\t\t\t\t\topt.separator('Output Options')\n\n\t\t\t\t\t\topt.on('-j', '--json-output', 'Print results as json to stdout') do\n\t\t\t\t\t\t\t@options['output'] = :json\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-x', '--xml-output', 'Print results as xml to stdout') do\n\t\t\t\t\t\t\t@options['output'] = :xml\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-y', '--yaml-output', 'Print results as yaml to stdout') do\n\t\t\t\t\t\t\t@options['output'] = :yaml\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('--stdout-output', 'Print results as normal text line to stdout, this is default') do\n\t\t\t\t\t\t\t@options['output'] = :stdout\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.separator ''\n\t\t\t\t\t\topt.separator 'Advanced Options'\n\n\t\t\t\t\t\topt.on('-c', '--create-config', 'Creates a skeleton config file to use') do\n\t\t\t\t\t\t\tcreate_config\n\t\t\t\t\t\t\texit\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-d DIRECTORY', '--directory', 'Scans a directory recursively for files and submits the hashes') do |directory|\n\t\t\t\t\t\t\t@options[:directory] = directory\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-p PROXY', '--proxy-server', 'Uses a specified proxy server') do |proxy|\n\t\t\t\t\t\t\t@options['proxy'] = proxy\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('--[no-]verbose', 'Print verbose information') do |v|\n\t\t\t\t\t\t\t@options['verbose'] = v\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.separator ''\n\t\t\t\t\t\topt.separator 'Other Options'\n\n\t\t\t\t\t\topt.on('-v', '--version', 'Shows application version information') do\n\t\t\t\t\t\t\tputs \"#{APP_NAME} - #{VERSION}\"\n\t\t\t\t\t\t\texit\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on_tail('-?', '--help', 'Show this message') { |help|\n\t\t\t\t\t\t\tputs opt.to_s + \"\\n\"\n\t\t\t\t\t\t\texit\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\n\t\t\t\t\tif ARGV.length != 0\n\t\t\t\t\t\topts.parse!\n\t\t\t\t\telse\n\t\t\t\t\t\tputs opts.to_s + \"\\n\"\n\t\t\t\t\t\texit\n\t\t\t\t\tend\n\t\t\t\trescue OptionParser::MissingArgument\n\t\t\t\t\tputs opts.to_s + \"\\n\"\n\t\t\t\t\texit\n\t\t\t\tend\n\t\t\tend",
"def extract_options(opts)\n lastmod = opts.delete(:lastmod)\n changefreq = opts.delete(:changefreq)\n priority = opts.delete(:priority)\n\n [lastmod, changefreq, priority]\n end",
"def cleaner_options\n\tcls\n\tbanner\n\tputs \"#{HC}#{FGRN}Type '#{FWHT}EXIT#{FGRN}' or '#{FWHT}QUIT#{FGRN}' to exit Log Cleaner\"\n\tputs\n\tputs \"#{HC}#{FGRN}view #{FWHT}<#{RS}#{FGRN}FileName#{HC}#{FWHT}> => #{FGRN}View Current Timestamp Info for File\"\n\tputs \"#{HC}#{FGRN}search #{FWHT}<#{RS}#{FGRN}String or Regex#{HC}#{FWHT}> => #{FGRN}Search through found Log Files for given String or Regex\"\n\tputs \"#{HC}#{FGRN}fsearch #{FWHT}<#{RS}#{FGRN}FileName#{HC}#{FWHT}> <#{RS}#{FGRN}String or Regex#{HC}#{FWHT}> => #{FGRN}Search through Specified Log File for given String or Regex\"\n\tputs \"#{HC}#{FGRN}show logs #{FWHT}=>#{FGRN} Show Found Log Files#{RS}\"\n\tputs \"#{HC}#{FGRN}show arc #{FWHT}=>#{FGRN} Show any Archived Log Files Found#{RS}\"\n\tputs \"#{HC}#{FGRN}show bin #{FWHT}=>#{FGRN} Show any Binary Log Files Found#{RS}\"\n\tputs \"#{HC}#{FGRN}show nonbin #{FWHT}=>#{FGRN} Show any Log Files Found that are NOT Binary#{RS}\"\n\tputs \"#{HC}#{FGRN}show top #{FWHT}=>#{FGRN} Show Top 25 IP Found in All Log Files#{RS}\"\n\tputs \"#{HC}#{FGRN}timestomp #{FWHT}<#{RS}#{FGRN}originalFile#{HC}#{FWHT}> <#{RS}#{FGRN}newFile#{HC}#{FWHT}> =>#{FGRN} Alter Timestamp on newFile so it matches that of originalFile#{RS}\"\n\tputs \"#{HC}#{FGRN}spoof #{FWHT}<#{RS}#{FGRN}Original#{HC}#{FWHT}> <#{RS}#{FGRN}Replacement#{HC}#{FWHT}> =>#{FGRN} Spoof the Replacement for Original in All Found Matches in All Log Files#{FWHT}!#{RS}\"\n\tputs \"#{HC}#{FGRN}fspoof #{FWHT}<#{RS}#{FGRN}FileName#{HC}#{FWHT}> <#{RS}#{FGRN}Original#{HC}#{FWHT}> <#{RS}#{FGRN}Replacement#{HC}#{FWHT}> =>#{FGRN} Spoof the Replacement for Original in All Found Matches in Specified Log Files#{FWHT}!#{RS}\"\n\tputs \"#{HC}#{FGRN}trunc #{FWHT}<#{RS}#{FGRN}Byte Size#{HC}#{FWHT}> =>#{FGRN} Truncate ALL Log Files to Specified Byte Size#{FWHT}(#{FGRN}rewinds the log files!#{FWHT})#{RS}\"\n\tputs \"#{HC}#{FGRN}ftrunc #{FWHT}<#{RS}#{FGRN}FileName#{HC}#{FWHT}> <#{RS}#{FGRN}Byte Size#{HC}#{FWHT}> =>#{FGRN} Truncate Specified Log File to Specified Byte Size#{FWHT}(#{FGRN}rewinds the log file!#{FWHT})#{RS}\"\n\tputs \"#{HC}#{FGRN}global nuke #{FWHT}=>#{FGRN} Nuke All Found Log Files#{FWHT}!#{RS}\"\n\tputs\nend",
"def assign_data(options={})\n @assign_data\n end",
"def time_entries(options = {})\n entries = []\n time_invested(options).groups.each { |g| entries << g[\"time_entries\"] }\n\n process_list_response( entries.flatten , Unfuddled::TimeEntry )\n end",
"def parse_options\nmain_opts = %w(jadd cadd jgadd cgadd wadd sum list ausgleich)\nbetrag_opts = %w(jadd cadd jgadd cgadd wadd)\n\n\tusage if ARGV.size < 1\n\n\toptions = {:modus => ARGV.shift}\n\n\tusage unless main_opts.include?(options[:modus])\n\n\tif betrag_opts.include?(options[:modus])\n\t\tusage if ARGV.size < 1\n\t\toptions[:betrag] = ARGV.shift.to_f\n\t\toptions[:tags] = sanitize_tags(ARGV)\n\n\t\toptions[:jahr] = Time.now.year\n\t\toptions[:monat] = Time.now.month\n\telsif options[:modus] == \"sum\" || options[:modus] == \"list\"\n\t\t#usage if ARGV.size < 1\n\t\toptions[:name] = parse_name\n\t\toptions[:jahr], options[:monat] = parse_date\n\telsif options[:modus] == \"ausgleich\"\n\t\toptions[:jahr], options[:monat] = parse_date\n\tend\n\n\treturn options\nend",
"def store_options\n pure_options = []\n self.options.each do |o|\n pure_options << {'text' => o.text, 'correct' => o.correct}\n end\n \n self.json_options = pure_options.to_json\n end",
"def load_data(options={})\n @data = @files.collect do |seeds_file|\n seeds_file.instanciate_data(@keys, :override => options[:override]) \n end.flatten.compact\n end",
"def download_cache_options=(options)\n \n @download_cache_options ||= Hash.new\n \n if download_cache_options\n @download_cache_options.merge!(options) \n else\n @download_cache_options = @options\n end \n \n end",
"def evaluate_mupfile(options = {})\n raise ArgumentError.new('No option hash passed to evaluate_mupfile!') unless options.is_a?(Hash)\n\n @@options = options.dup\n @@configs = {}\n\n fetch_mupfile_contents\n instance_eval_mupfile(mupfile_contents)\n \n @@configs.each do |key, value|\n @@options[key] = value unless @@options.key?(key)\n end\n @@options\n end",
"def extract_options\n last.is_a?(::Hash) ? last : {}\n end",
"def getCurrentOptionData(date)\n assert(date.kind_of?(Util::ETime))\n\n debug = false\n\n dateParts = date.toDateStr().split('-').map { |p| p.to_i() }\n params = {\n :q => @symbol,\n :expd => dateParts[2],\n :expm => dateParts[1],\n :expy => dateParts[0],\n :output => :json\n }\n page = nil\n begin\n page = @@agent.get(CURRENT_OPTION_DATA_URI, params)\n rescue => e\n logger.error(\"Unable to find option data for #{@symbol}\")\n return nil\n end\n \n ret = []\n begin\n json = JSON.parse(page.body.gsub(/(\\w+):/, '\"\\1\":')) # convert to proper json\n assert(json.has_key?('calls'))\n assert(json.has_key?('puts'))\n assert(json['puts'].length()>0)\n assert(json['calls'].length()>0)\n assert(json['puts'].length() == json['calls'].length())\n \n # puts:\n # - cid: '681345055999672' # ?\n # name: '' # ?\n # s: AKAM120317P00020000 # :name\n # e: OPRA # ?\n # p: ! '-' # :price\n # c: ! '-' # :change\n # b: ! '-' # :bid\n # a: '0.01' # :ask\n # oi: ' 0' # :interest\n # vol: ! '-' # :volume\n # strike: '20.00' # :strike\n # expiry: Mar 17, 2012 # :expiration\n\n for type in ['calls', 'puts']\n for o in json[type]\n\n name = nil\n begin\n assert(o.has_key?('s'))\n name = o['s']\n assert(name != nil) \n assert(name.length()>0)\n end\n \n underlying = nil\n begin\n underlying = @symbol\n assert(underlying != nil)\n assert(underlying.length()>0)\n end\n \n option_type = nil\n begin\n option_type = (type == 'puts') ? 'put' : 'call'\n assert(option_type.match(/(put|call)/))\n end\n\n expiration = nil\n begin\n assert(o.has_key?('expiry'))\n assert(o['expiry'].length()>0)\n expiration = Util::ETime::FromDateStr(o['expiry'])\n assert(expiration.kind_of?(Util::ETime))\n end\n\n strike = nil\n begin\n assert(o.has_key?('strike'))\n assert(o['strike'] != nil)\n strike = Integer(o['strike'].to_f() * 100)\n assert(strike > 0)\n end\n \n price = nil\n begin\n assert(o.has_key?('p'))\n debug &&(\"parsing price[#{o[:p]}]\")\n price = (o['p'].match(/^-$/)) ? nil : Integer(o['p'].to_f() * 100)\n # nil is okay\n end\n\n change = nil\n begin\n assert(o.has_key?('c'))\n debug &&(\"parsing change[#{o[:c]}]\")\n change = (o['c'].match(/^-$/)) ? nil : Integer(o['c'].to_f() * 100)\n # nil is okay\n end\n\n bid = nil\n begin\n assert(o.has_key?('b'))\n debug &&(\"parsing bid[#{o['b']}]\")\n bid = (o['b'].match(/^-$/)) ? nil : Integer(o['b'].to_f() * 100)\n # nil is okay\n end\n\n ask = nil\n begin\n assert(o.has_key?('a'))\n debug &&(\"parsing ask[#{o['a']}]\")\n ask = (o['a'].match(/^-$/)) ? nil : Integer(o['a'].to_f() * 100)\n # nil is okay\n end\n\n volume = nil\n begin\n assert(o.has_key?('vol'))\n debug &&(\"parsing volume[#{o['vol']}]\")\n volume = (o['vol'].match(/^-$/)) ? nil : o['vol'].to_i()\n # nil is okay\n end\n\n interest = nil\n begin\n assert(o.has_key?('oi'))\n debug &&(\"parsing interest[#{o['oi']}]\")\n interest = (o['oi'].match(/^-$/)) ? nil : o['oi'].to_i()\n # nil is okay\n end\n\n ret.push({ :name => name,\n :underlying => underlying,\n :option_type => option_type,\n :expiration => expiration,\n :strike => strike,\n :price => price,\n :change => change,\n :bid => bid,\n :ask => ask,\n :volume => volume,\n :interest => interest })\n end\n end\n \n end\n \n\n assert(ret != nil)\n return ret\n end",
"def options\n data[:options]\n end",
"def extract(options = {})\n # Ensure that unspecified options have default values.\n file_path = options.has_key?(:file_path) ?\n options[:file_path].to_s :\n @zip_path\n restore_permissions = options.has_key?(:permissions) ?\n options[:permissions] :\n false\n restore_ownerships = options.has_key?(:ownerships) ?\n options[:ownerships] :\n false\n restore_times = options.has_key?(:times) ?\n options[:times] :\n false\n\n # Make the directory.\n FileUtils.mkdir_p(file_path)\n\n # Restore the metadata.\n ::File.chmod(mode, file_path) if restore_permissions\n ::File.chown(uid, gid, file_path) if restore_ownerships\n ::File.utime(atime, mtime, file_path) if restore_times\n\n nil\n end",
"def fields_from_options( options )\n\t\tfields = {}\n\n\t\toptions.each do |key, value|\n\t\t\tself.log.debug \"Applying option %p: %p\" % [ key, value ]\n\t\t\tcase key\n\t\t\twhen :add\n\t\t\t\tfields.merge!( value )\n\t\t\twhen :timed\n\t\t\t\tduration_callback = lambda {|ev| Concurrent.monotonic_time - ev.start }\n\t\t\t\tfields.merge!( duration: duration_callback )\n\t\t\telse\n\t\t\t\traise \"unknown event option %p\" % [ key ]\n\t\t\tend\n\t\tend\n\n\t\treturn fields\n\tend",
"def options; @opts end",
"def process_options\n \n end",
"def process_options\n \n end",
"def process_options\n \n end",
"def initialize(options={})\r\n @file_added = options[:file_added]\r\n @file_removed = options[:file_removed]\r\n @file_changed = options[:file_changed]\r\n @file_info = {}\r\n end",
"def extract_options(*args)\n args = args.dup\n index = args.rindex { |e| e.is_a?(Hash) } || args.length\n args[-1] = args[index] || {}\n args[index] = nil if index < args.length - 1\n args\n end",
"def options\n @options ||= Launchr::OrderedHash.new\n @options\n end",
"def add_options; end",
"def cache_statistics data\n self.start_date = DateTime.parse data.first[:timestamp]\n self.duration = DateTime.parse(data.last[:timestamp]).to_time - DateTime.parse(data.first[:timestamp]).to_time\n calculate_distance\n self.min_speed = data.map{|p| p[:speed]}.min\n self.max_speed = data.map{|p| p[:speed]}.max\n self.min_height = data.map{|p| p[:alt]}.min\n self.max_height = data.map{|p| p[:alt]}.max\n save\n end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end",
"def options; end"
] |
[
"0.5364491",
"0.5349642",
"0.5312582",
"0.5285913",
"0.5261508",
"0.52003205",
"0.5170419",
"0.5070996",
"0.5070996",
"0.50575185",
"0.5041466",
"0.50088626",
"0.49867913",
"0.49867913",
"0.49824324",
"0.49823636",
"0.49693188",
"0.4954354",
"0.49489403",
"0.49433717",
"0.49333972",
"0.49225968",
"0.49147382",
"0.49016064",
"0.489873",
"0.48973373",
"0.4895995",
"0.48803508",
"0.4878114",
"0.48648006",
"0.48635814",
"0.48611787",
"0.4861089",
"0.48581025",
"0.48546505",
"0.48396748",
"0.48358575",
"0.48256058",
"0.4816069",
"0.48113132",
"0.4809777",
"0.47897634",
"0.47855088",
"0.47775424",
"0.47759447",
"0.4771754",
"0.47579557",
"0.47565743",
"0.47534466",
"0.47468734",
"0.47423097",
"0.47270635",
"0.47268227",
"0.4722677",
"0.47117788",
"0.4711002",
"0.47079408",
"0.47079408",
"0.47079408",
"0.47058177",
"0.46952337",
"0.4690138",
"0.46836987",
"0.46835715",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205",
"0.46802205"
] |
0.56524736
|
0
|
Captures the extract data and converts it to a YML string storing it as a property on this object. Returns an empty array so as not to interupt the process loop. options [Hash]:: A hash that is passed to this extension by the main LEWT program containing rutime options. data [Hash]:: The extracted data as a hash.
|
def process( options, data )
@extractData = data.to_yaml
return []
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def render( options, data )\n @processData = data.to_yaml\n name = options[:store_filename]\n yml = options[:store_hook] == \"extract\" ? @extractData : @processData\n name != nil ? store(yml, name ) : [yml]\n end",
"def extract( options )\n \n end",
"def populate(options = {})\n opts = options.merge(\n suppress_missing: @suppress_missing,\n output_handler: lambda{ |data, chunk|\n if file_name = options[:response_file]\n data.to_file(file_name,\n file_mode: chunk == 0 ? 'w' : 'a',\n include_col_headers: chunk == 0)\n end\n process_data(data, chunk)\n }\n )\n extract_specs = [extract_specs] unless extract_specs.is_a?(Array)\n @data = []\n extract_specs.each do |extract_spec|\n @layout_mapped = false\n @extract.extract_data(nil, opts)\n end\n sort_data if @sort_required\n filter_data if @filter_required\n @data\n end",
"def extract_data!(options)\n if options.has_key?(:data)\n data = options.delete :data\n \n if Array === data\n data.each.with_index do |filepath, idx|\n if filepath.is_a?(Faraday::UploadIO)\n options[\"data[#{idx}]\"] = filepath\n else\n mime_type = extract_mimetype(filepath)\n options[\"data[#{idx}]\"] = Faraday::UploadIO.new(filepath, mime_type)\n end\n end\n elsif data.is_a?(Faraday::UploadIO)\n options[\"data\"] = data\n else\n mime_type = extract_mimetype(data)\n options[\"data\"] = Faraday::UploadIO.new(data, mime_type)\n end\n end\n end",
"def meta_data options={}\n if data_type\n output = data_type.meta_data( self )\n else\n output = { :filename => filename, \n :category => category.to_s,\n :location => location,\n :source_name => source.name }\n end\n \n if options[:skip]\n options[:skip].each do |label|\n output.delete(label)\n end\n end\n \n return output\n \n end",
"def parse_tire_option_values\n start_time = Time.now\n model_counter = 0\n variant_counter = 0\n option_list = {}\n valid_options = %w{load_range load_factor load_index sidewall utqg speed_rating size}\n mfg_list = get_manufacturer_list\n mfg_list.each do |mfg|\n puts \"Creating option values from product data for #{mfg}, adding them to application.yml\\n\"\n file = open_file_read('tires', mfg)\n data = YAML.load(file) \n data.each_key do |model| \n # a new model would be a type of wheel for a manufacturer\n model_counter +=1\n # each model points to an array of variants, each differing in some way\n data[model].each_pair do |key, value|\n if key == :variants\n value.each do |v|\n variant_counter += 1\n v.each_key do |k|\n if valid_options.include?(k.to_s)\n option_list[v[k]] = [] unless option_list.has_key?(v[k])\n new_option_value = {\n \"option_type\" => k.to_s.dasherize,\n \"name\" => v[k].to_s,\n \"presentation\" => v[k].to_s\n }\n option_list[v[k]] << new_option_value unless option_list[v[k]].include?(new_option_value)\n end\n end\n end\n end\n end\n end\n end\n puts \"Writing the options to option_values file now, for #{model_counter} models and #{variant_counter} variants...\\n\"\n @@config[:option_variants].merge!(option_list)\n f = File.open(APP_DATA,'w')\n YAML.dump(@@config, f)\n f.close \n puts \"Task took #{Time.now - start_time}\\n\" \n end",
"def get_options\n options = {}\n options[:commands] = []\n options[:commands] << :add\n options[:commands] << :update\n options[:commands] << :print\n \n options[:tag_file] = File.expand_path('../data/example-tags.xml', File.dirname(__FILE__))\n \n options[:in_path] = File.expand_path('../data/tokyo-drift.flv', File.dirname(__FILE__))\n options[:out_path] = File.expand_path('../data/tokyo-drift-processed.flv', File.dirname(__FILE__))\n \n options[:metadatacreator] = \"inlet media FLVTool2 v1.0.7 - http://www.inlet-media.de/flvtool2\"\n options[:metadata] = {}\n options[:in_pipe] = false\n options[:out_pipe] = false\n options[:simulate] = false\n options[:verbose] = false\n options[:recursive] = false\n options[:preserve] = false\n options[:xml] = false\n options[:compatibility_mode] = false\n options[:in_point] = nil\n options[:out_point] = nil\n options[:keyframe_mode] = false\n options[:tag_number] = nil\n options[:stream_log] = true\n options[:collapse] = false\n \n return options\nend",
"def extra_substitutions_data\n return @extra_substitutions_data if @extra_substitutions_data\n return unless extra_substitutions\n\n @extra_substitutions_data = YAML.safe_load(extra_substitutions, [Symbol])\n end",
"def collect_alma_data( source_dir:, source_file_name:, ingestConf:, options:)\n\n puts \"START COLLECTING\"\n ######################################################################################\n reiresConfJson = File.read(File.join(File.dirname(__FILE__), '../config/config.cfg'))\n reiresConf = JSON.parse(reiresConfJson)\n\n ######################### Dataset and Dataprovider Configuration ######################\n @dataset = ingestConf[\"dataset\"]\n @provider = ingestConf[\"provider\"]\n @license = ingestConf[\"license\"]\n\n @mediaUrlPrefix = ingestConf[\"mediaUrlPrefix\"]\n @same_as_template = ingestConf[\"same_as_template\"]\n\n @metaLanguage = ingestConf[\"metaLanguage\"]\n @unicode_script = ingestConf[\"unicode_script\"]\n @recordLanguage = ingestConf[\"recordLanguage\"]\n @defaulttype =ingestConf[\"defaulttype\"] \n @genericRecordDesc = ingestConf[\"genericRecordDesc\"]\n\n ingestdata = {\n \"provider\" => @provider,\n \"dataset\" => @dataset,\n \"license\" => @license,\n \"name\" => @genericRecordDesc\n }\n @isBasedOn = build_isBasedOn(ingestdata)\n\n #######################################################################################\n @url_prefix = reiresConf[\"url_prefix\"]\n @prefixid = \"#{reiresConf[\"prefixid\"]}_#{ @provider[\"@id\"] }_#{ @dataset[\"@id\"] }\"\n\n # @sdLicense = reiresConf[\"sdLicense\"]\n # @sdPublisher = reiresConf[\"sdPublisher\"]\n #######################################################################################\n\n \n #Link to Limo => bases on institution id\n #same_as_template = \"https://limo.libis.be/primo-explore/search?query=any,contains,<#record_id>&vid=KULeuven&lang=en_US\"\n #Link to Limo => bases on networkzone id (different publishing profile)\n # same_as_template = https://limo.libis.be/primo-explore/fulldisplay?docid=<#record_id>&context=L&vid=KULeuven&search_scope=ALL_CONTENT&tab=all_content_tab&lang=en_US\n\n records_dir = \"#{RECORDS_DIR}/Alma_KULeuven/#{@dataset[\"@id\"]}\"\n \n @counter = 0\n record_count = 0\n \n if options[:full_export] \n log(\"Clear records #{records_dir}/*.json\")\n Dir.glob(\"#{records_dir}/*.json\").each { |file| File.delete(file)}\n else\n log(\"DO NOT CLEAR RECORDS DIR; It is a partial export [#{records_dir}]\")\n end\n\n source_dir = source_dir || SOURCE_RECORDS_DIR\n log(\"SOURCE_RECORDS_DIR : #{ source_dir }\")\n log(\"source_file_name : #{ source_file_name }\")\n \n# filter(data, '$..collection.record').each do |record|\n\n nori = Nori.new(parser: :nokogiri, strip_namespaces: true, convert_tags_to: lambda {|tag| tag.gsub(/^@/, '_')})\n\n Dir[\"#{source_dir}/#{source_file_name}\"].each_with_index do |source_file, index| \n log(\" parsing #{source_file}\")\n timing_start = Time.now\n x = XmlSplit.new(source_file, 'record')\n x.each_with_index { |node,i| \n filter( nori.parse(node) , '$.record').each do |record|\n #@logger.debug(\" ReIReS parser - record : #{record} \")\n ## To debug a large xml-file.\n ## Split the xml-file in smal chunks; 1 json representation per file\n\n=begin\n #if i % 7 == 0\n split_dir = \"/app/records/split_records\"\n unless File.directory?(split_dir)\n FileUtils.mkdir_p(split_dir)\n end\n file_name = \"#{split_dir}/record_#{i}.json\"\n File.open(file_name, 'wb') do |f|\n f.puts record.to_json\n end\n #end\n=end \n #if i.between?(24660 , 24670)\n parse_record( record: record, index: i, records_dir: records_dir)\n #end\n end\n index += 1\n if index % 5000 == 0\n @logger.info(\" ReIReS parser - #{index} records already parsed \") \n end\n }\n record_count += index\n end\n\n####### PARSE A FEW RECORDS !!!!!!!!!!!!!!!!!!######################\n=begin\nfiles =[]\nfiles << \"/app/records/split_records/record_68138.xml\"\nfiles << \"/app/records/split_records/record_15489.xml\"\n###################################################################\nrecords_dir = \"/app/records/Alma_KULeuven/test/\"\nDir.glob(\"#{records_dir}/*.json\").each { |file| File.delete(file)}\n\nfiles.each_with_index do |file,i| \n record = JSON.parse(File.read(file))\n parse_record( record: record, index: 0, records_dir: records_dir)\nend\n=end\n\nend",
"def setup options\n @out = get_output(options)\n end",
"def parse_options(args)\n program = Pathname.new(__FILE__).realpath\n header = <<-END_HEADER\n# Running #{program} on #{Time.now}\n# Command-line arguments are: #{args}\n# Command-line to reproduce: #{program} #{args.join(\" \")}\n#\nEND_HEADER\n timestamp = Time.now.strftime(\"%Y%m%d%H%M%S\")\n current_dir = Pathname.pwd\n output_basename = current_dir + \"log\"\n output_basename.mkdir unless output_basename.directory?\n options = OpenStruct.new\n options.log_level = :off\n options.log_destination = STDOUT\n options.db_url = { :adapter => :in_memory }\n options.generate = nil\n options.time = 60\n options.profile_strings = false\n options.output_filename = \"dm-tpcc-#{timestamp}.out\"\n options.data_directory = current_dir + \"data\"\n options.load = false\n options.save_data = false\n\n opts = OptionParser.new do |opts|\n opts.banner = \"Usage: dm-tpcc [options]\"\n opts.separator \"\"\n\n opts.on(\"-g NUM_WAREHOUSES\", \"--generate NUM_WAREHOUSES\", Integer,\n \"Generate data for the number of warehouses.\") do |g| \n options.generate = g \n end\n\n opts.on(\"-s DIRECTORY_NAME\", \"--save DIRECTORY_NAME\",\n \"Save generated data for later use.\") do |s| \n options.data_directory = s unless (s.nil? || s.empty?)\n end\n\n opts.on(\"-S\", \"--save-data\", \"Save generated data for later use.\") do |s| \n options.save_data = s\n end\n\n opts.on(\"-D\", \"--load-data\", \"Load data from saved datasets.\") do |l|\n options.load = l\n end\n\n opts.on(\"--profile-string-algorithms\",\n \"Profile different string generators\") do |sg| \n options.profile_strings = sg \n end\n\n opts.on(\"-d DB_URL\", \"--db-url DB_URL\", String,\n \"Specify a DataMapper DB URL\") do |dburl| \n options.db_url = dburl \n end\n\n opts.on(\"-l LOG_LEVEL\", \"--log-level LOG_LEVEL\", LOG_LEVELS,\n \"Specify a log level.\") do |l| \n options.log_level = l.to_sym \n end\n\n opts.on(\"-L LOG_FILE\", \"--log-file LOG_FILE\", String,\n \"Specify a log file.\") do |f| \n options.log_destination = File.new(f, \"a+\") \n end\n\n opts.on(\"-o FILENAME\", \"--output FILENAME\", String,\n \"Filename to save output to.\") do |outputfile| \n options.output_filename = outputfile\n end\n\n opts.on(\"-t DURATION\", \"--time DURATION\", Integer,\n \"Duration of the test in seconds.\") do |time| \n options.time = time \n end\n\n opts.on(\"--once\", \"Run just one time\") do |once| \n options.once = once \n end\n\n opts.separator \"Common Options:\"\n opts.on_tail(\"-h\", \"--help\", \"Show this message.\") do\n puts opts\n\n print \"\\nLog Levels:\\n\"\n LOG_LEVELS.keys.each { |l| print \"\\t#{l}\\n\" }\n print \"\\nExample Database URLS:\\n\"\n $example_dbs.each { |db| print \"\\t#{db}\\n\" }\n exit\n end\n opts.on_tail(\"--version\", \"Show version\") do\n puts DataMapper::TPCC::VERSION\n exit\n end\n end\n\n opts.parse!(args)\n \n # Process options into global variables (ick)\n $output = File.open(output_basename + options.output_filename, \"w+\")\n $output.print header\n $data_directory = options.data_directory\n $data_directory.mkdir unless $data_directory.directory?\n\n options\nend",
"def extract_data_from_options(options)\n OPTIONS.each do |option|\n instance_variable_set \"@#{option}\", options[option]\n end\n end",
"def user_data(instance)\n hostname = instance[\"hostname\"]\n # write specific per instance cloud-init config and script files out of erb templates.\n %w(config script).each do |ud|\n e = ERB.new(File.read(File.join('templates', ud + \".erb\")))\n outfile = File.join(@dataDir, hostname + \"-\" + ud)\n File.open(outfile, 'w') {|f| f.write e.result(binding)}\n end\n\n # files = Hash[*%w{mimeOut script config}.collect {|n| [n, File.join(@dataDir, hostname + \"-\" + n]}.flatten]\n # files = %w{mimeOut script config}.inject({}) { |f,n| f[n] = File.join(@dataDir, hostname + \"-\" + n); f}\n mimeOut = File.join(@dataDir, hostname + \"-ud\")\n script = File.join(@dataDir, hostname + \"-script\")\n config = File.join(@dataDir, hostname + \"-config\")\n system(\"./write-mime-multipart --output=#{mimeOut} #{script}:text/x-shellscript #{config}\")\n @logger.info(\"Generated multipart for #{hostname}\")\n return File.read(mimeOut)\nend",
"def extract(options = {})\n self.warn(self, \"Don't use the extractor anymore, use release.use(:mockup, options) and release.use(:url_relativizer, options) processors\")\n @extractor_options = options\n end",
"def data\n YAML::load_file(files[:config])\n end",
"def get_data\n data_array = File.open(RightScale::MetaDataFile)\n data_array.each do |d|\n key, data = d.split('=')\n key.strip!\n data.strip!\n rightscale_deprecated[key.sub(/RS_/,'')] = data unless add_server(key,data) \n end\nend",
"def get_data(options)\r\n data = options[:data]\r\n\r\n data\r\n end",
"def collect_time_information\n ### Time information\n mark_data_time_information = Array.new\n time_information = @case_details[:case][:system][:time]\n\n mark_data_time_information << 'Answer the following about each time period present in the evidence on the system'\n time_information.each do | key, value | mark_data_time_information << \"-#{key.capitalize}::#{value}\"\n end\n mark_data_time_information << ''\n\n return mark_data_time_information\n end",
"def extractMetadata()\n Logging.LogScriptInfo \"Extract metadata from #{@logFile}...\"\n\n # Get the meta datas from the json report\n metas = {}\n iterations = []\n # totalDpsMeanStdDev = 0\n\n # Fight infos\n metas[\"fightLength\"] = @jsonData[\"sim\"][\"options\"][\"max_time\"].round\n metas[\"fightLengthVariation\"] = @jsonData[\"sim\"][\"options\"][\"vary_combat_length\"]\n metas[\"targetError\"] = @jsonData[\"sim\"][\"options\"][\"target_error\"]\n\n # Template infos\n @jsonData[\"sim\"][\"players\"].each do |player|\n if player[\"name\"] == \"Template\"\n # Get the gear using items simc encoded string\n gearSlots = [\"head\", \"neck\", \"shoulders\", \"back\", \"chest\", \"wrists\", \"hands\", \"waist\", \"legs\", \"feet\", \"finger1\", \"finger2\", \"trinket1\", \"trinket2\", \"main_hand\", \"off_hand\"]\n gear = []\n gearSlots.each do |gearSlot|\n item = player[\"gear\"][gearSlot]\n if item\n gear.push \"#{gearSlot}=#{item[\"encoded_item\"]}\"\n end\n end\n\n # Get the talents spell id\n talents = []\n player[\"talents\"].each do |talent|\n columnOffset = talent[\"tier\"] - (talents.length + 1)\n talents.fill(0, talents.length, columnOffset) if columnOffset > 0\n talents.push talent[\"spell_id\"]\n end\n\n metas[\"templateGear\"] = gear\n metas[\"templateTalents\"] = talents\n metas[\"templateDPS\"] = player[\"collected_data\"][\"dps\"][\"mean\"].round\n iterations.push player[\"collected_data\"][\"dps\"][\"count\"]\n # totalDpsMeanStdDev += player['collected_data']['dps']['mean_std_dev']\n end\n end\n @jsonData[\"sim\"][\"profilesets\"][\"results\"].each do |player|\n iterations.push player[\"iterations\"]\n # totalDpsMeanStdDev += player['stddev'] / Math.sqrt(player['iterations'])\n end\n\n # Statistics\n metas[\"elapsedTime\"] = @jsonData[\"sim\"][\"statistics\"][\"elapsed_time_seconds\"].round(2)\n metas[\"totalEventsProcessed\"] = @jsonData[\"sim\"][\"statistics\"][\"total_events_processed\"]\n metas[\"totalIterations\"] = iterations.sum\n metas[\"totalActors\"] = iterations.size\n # metas['totalIterationsMean'] = iterations.sum.to_f / iterations.size.to_f\n # metas['totalIterationsVariance'] = iterations.inject(0.0) { |s, x| s + (x - metas['statistics']['total_iterations_mean']) ** 2 }\n # metas['totalIterationsStdDev'] = Math.sqrt(metas['statistics']['total_iterations_variance'])\n # metas['totalIterationsSem'] = metas['statistics']['total_iterations_stddev'] / Math.sqrt(iterations.size)\n # metas['totalMeanDpsStdDev'] = totalDpsMeanStdDev / iterations.size\n # metas['totalMeanDpsVariance'] = metas['statistics']['total_mean_dps_stddev'] ** 2\n # metas['totalMeanDpsSem'] = metas['statistics']['total_mean_dps_stddev'] / Math.sqrt(iterations.size)\n\n # Build infos\n metas[\"simcBuildTimestamp\"] = DateTime.parse(@jsonData[\"build_date\"] + \" \" + @jsonData[\"build_time\"] + \" \" + Time.now.strftime(\"%:z\")).to_time.to_i\n metas[\"simcGitRevision\"] = @jsonData[\"git_revision\"]\n metas[\"wowVersion\"] = @jsonData[\"sim\"][\"options\"][\"dbc\"][@jsonData[\"sim\"][\"options\"][\"dbc\"][\"version_used\"]][\"wow_version\"]\n metas[\"wowBuild\"] = @jsonData[\"sim\"][\"options\"][\"dbc\"][@jsonData[\"sim\"][\"options\"][\"dbc\"][\"version_used\"]][\"build_level\"]\n\n # Add additional data\n metas.merge!(@additionalMetadata)\n\n return metas\n end",
"def evaluate_mupfile(options = {})\n raise ArgumentError.new('No option hash passed to evaluate_mupfile!') unless options.is_a?(Hash)\n\n @@options = options.dup\n @@configs = {}\n\n fetch_mupfile_contents\n instance_eval_mupfile(mupfile_contents)\n \n @@configs.each do |key, value|\n @@options[key] = value unless @@options.key?(key)\n end\n @@options\n end",
"def get_data(arg)\n dir_to_data = Dir.pwd + '/features/support'\n data = YAML.load_file(\"#{dir_to_data}/data_list.yml\")\n data['DataSet'][\"#{arg}\"]\nend",
"def process_options options={}\n\t\t\t\tif options[:term].nil? == false\n\t\t\t\t\t@@gp.set term:\"#{options[:term]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:datafilesep].nil? == false\n\t\t\t\t\t@@gp.set \"datafile separator '#{options[:datafilesep]}'\"\n\t\t\t\tend\n\n\t\t\t\tif ((options[:xtype].nil? == false and options[:xtype] == :date) or\n\t\t\t\t\t(options[:ytype].nil? == false and options[:ytype] == :date)) and\n\t\t\t\t\t(options[:timefmt].nil? == false)\n\t\t\t\t\tif options[:xtype] == :date\n\t\t\t\t\t\t@@gp.set \"xdata time\"\n\t\t\t\t\tend\n\n\t\t\t\t\tif options[:ytype] == :date\n\t\t\t\t\t\t@@gp.set \"ydata time\"\n\t\t\t\t\tend\n\n\t\t\t\t\t@@gp.set \"timefmt '#{options[:timefmt]}'\"\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif options[:xrange].nil? == false\n\t\t\t\t\tif options[:xtype].nil? == false and options[:xtype] == :date\n\t\t\t\t\t\t@@gp.set \"xrange ['#{Time.at(options[:xrange].begin).strftime(\"%Y-%m-%d %H:%M:%S\")}':'#{Time.at(options[:xrange].end).strftime(\"%Y-%m-%d %H:%M:%S\")}']\"\n\t\t\t\t\telse\n\t\t\t\t\t\t@@gp.set \"xrange [#{options[:xrange].begin}:#{options[:xrange].end}]\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"xrange\"\n\t\t\t\tend\n\n\t\t\t\tif options[:yrange].nil? == false\n\t\t\t\t\tif options[:ytype].nil? == false and options[:ytype] == :date\n\t\t\t\t\t\t@@gp.set \"yrange ['#{Time.at(options[:yrange].begin).strftime(\"%Y-%m-%d %H:%M:%S\")}':'#{Time.at(options[:yrange].end).strftime(\"%Y-%m-%d %H:%M:%S\")}']\"\n\t\t\t\t\telse\n\t\t\t\t\t\t@@gp.set \"yrange [#{options[:yrange].begin}:#{options[:yrange].end}]\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"yrange\"\n\t\t\t\tend\n\n\t\t\t\tif options[:xtics].nil? == false\n\t\t\t\t\t@@gp.set \"xtics #{options[:xtics]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:ytics].nil? == false\n\t\t\t\t\t@@gp.set \"ytics #{options[:ytics]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:mxtics].nil? == false\n\t\t\t\t\t@@gp.set \"mxtics #{options[:mxtics]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:mytics].nil? == false\n\t\t\t\t\t@@gp.set \"mytics #{options[:mytics]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:logx].nil? == false and options[:logx] == true\n\t\t\t\t\t@@gp.set \"log x\"\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"log x\"\n\t\t\t\tend\n\n\t\t\t\tif options[:logy].nil? == false and options[:logy] == true\n\t\t\t\t\t@@gp.set \"log y\"\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"log y\"\n\t\t\t\tend\n\n\t\t\t\tif options[:xformat].nil? == false\n\t\t\t\t\t@@gp.set \"format x '#{options[:xformat]}'\"\n\t\t\t\tend\n\n\t\t\t\tif options[:yformat].nil? == false\n\t\t\t\t\t@@gp.set \"format y '#{options[:yformat]}'\"\n\t\t\t\tend\n\n\t\t\t\tif options[:xlabel].nil? == false\n\t\t\t\t\t@@gp.set \"xlabel '#{options[:xlabel]}'\"\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"xlabel\"\n\t\t\t\tend\n\n\t\t\t\tif options[:ylabel].nil? == false\n\t\t\t\t\t@@gp.set \"ylabel '#{options[:ylabel]}'\"\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"ylabel\"\n\t\t\t\tend\n\n\t\t\t\tif options[:key].nil? == false\n\t\t\t\t\t@@gp.set \"key #{options[:key]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:grid].nil? == false\n\t\t\t\t\t@@gp.set \"grid #{options[:grid]}\"\n\t\t\t\tend\n\t\t\tend",
"def template_data_unformat(data)\n Hash.new.tap do |result|\n if(v = data.to_smash.get(:config, :content))\n result[:config] = {\n :content => yamlize(v)\n }\n end\n if(data[:imports])\n result[:imports] = data[:imports].map do |item|\n Smash.new(\n :name => item['name'],\n :content => yamlize(item['content'])\n )\n end\n end\n end\n end",
"def parse_options()\n options = {}\n \n optparse = OptionParser.new do |opts|\n # Set up the help banner\n\n opts.banner = \"\\nUsage: weekly_agents [options] ...\\n\\n\"\n \n # Define the options\n\n opts.on( '-s','--start_time START', \n Integer, \n 'Start collecting stats from START (seconds since the epoch)' \n ) do |s|\n options[:start_time] = s\n end\n\n opts.on( '-h','--hours HOURS', \n Integer, \n 'Collect stats for HOURS' \n ) do |h|\n options[:hours] = h\n end\n\n opts.on( '-d','--days DAY', \n Integer, \n 'Collect stats for DAYS' \n ) do |d|\n options[:days] = d\n end\n\n opts.on( '-m','--minutes MINUTES', \n Integer, \n 'Collect stats for MINUTES' \n ) do |m|\n options[:minutes] = m\n end\n\n opts.on( '-u', '--usage', 'Display this screen' ) do\n puts (opts)\n print <<-'EOF'\n\n --start_time expect a time argument in the the form of seconds since the epoch, e.g.:\n\n --start_time=`date --date \"2011-03-21\" +%s`\n\n The --hours, --minutes and --days options are used to specify the \n the length of the time span for which we want to accumulate statistics. \n default is seven days\n\n Normal usage of this script is to run it with out any options, \n in which case it gathers statistics for the last week\n\n EOF\n\n exit 0\n end\n \n end\n \n optparse.parse!\n\n xoptions = options.clone()\n\n xoptions.delete_if do |key, value|\n (key == :start_time)\n end\n \n if (xoptions.size > 1) then\n\n puts \"You have selected mutually exclusive options:\"\n\n xoptions.each do |key, val|\n case key\n when :hours\n puts \" --hours\"\n when :days\n puts \" --days\"\n when :days\n puts \" --minutes\"\n end # end case\n end # end do\n puts\n puts optparse.to_s\n exit 1\n\n end #end if\n\n return options\n\nend",
"def create_run_info(opts)\n BawWorkers::Validation.check_custom_hash(opts, BawWorkers::Jobs::Analysis::Payload::OPTS_FIELDS)\n\n normalise_regex = /[^a-z0-9]/i\n current_time = Time.zone.now.utc.iso8601.to_s.downcase.gsub(normalise_regex, '_')\n\n dir_run = File.join(@dir_worker_top, BawWorkers::Jobs::Analysis::Runner::DIR_RUNS,\n \"#{opts[:job_id]}_#{opts[:id]}_#{current_time}\")\n dir_run_temp = File.join(dir_run, BawWorkers::Jobs::Analysis::Runner::DIR_TEMP)\n file_run_log = File.join(dir_run, BawWorkers::Jobs::Analysis::Runner::FILE_LOG)\n\n FileUtils.mkpath([dir_run, dir_run_temp])\n\n {\n dir_run: dir_run,\n dir_run_temp: dir_run_temp,\n file_run_log: file_run_log\n }\n end",
"def data\n return @data if @data\n\n if File.exist?(settings_path)\n @data = YAML.load_file(settings_path)\n @data = user_settings.merge(@data)\n else\n puts \"ERROR: No settings file at #{settings_path}\"\n puts \"Please create a settings file via: ufo init\"\n exit 1\n end\n end",
"def extractMetadata()\n Logging.LogScriptInfo \"Extract metadata from #{@logFile}...\"\n\n # Get the meta datas from the json report\n metas = { }\n metas['build_date'] = @jsonData['build_date']\n metas['build_time'] = @jsonData['build_time']\n metas['git_revision'] = @jsonData['git_revision']\n metas['options'] = @jsonData['sim']['options']\n metas['overrides'] = @jsonData['sim']['overrides']\n metas['statistics'] = @jsonData['sim']['statistics']\n @jsonData['sim']['players'].each do |player|\n if player['name'] == 'Template'\n metas['player'] = player\n end\n end\n metas['profilesets_overrides'] = { }\n @jsonData['sim']['profilesets']['results'].each do |player|\n next unless player['overrides']\n metas['profilesets_overrides'][player['name']] = player['overrides']\n end\n\n # Timestamps\n metas['build_timestamp'] = DateTime.parse(@jsonData['build_date'] + ' ' + @jsonData['build_time'] + ' ' + Time.now.strftime('%:z')).to_time.to_i\n metas['result_timestamp'] = Time.now.to_i\n\n # Add additional data\n metas.merge!(@additionalMetadata)\n\n return metas\n end",
"def run( data = {} )\n run_with_data( collect_data( data ) )\n end",
"def prepare_test_data(data)\n case data[:type][1]\n when 'file' then\n data[:file_type] = data[:file_type][1]\n data[:allowed_dirs] = data[:allowed_dirs][1]\n\n when 'relationship' then\n data[:channels] = data[:channels][0]\n data[:categories] = [] #data[:categories][1] #@todo swtich to names?\n data[:authors] = [] #data[:authors][1] #@todo swtich to names?\n data[:statuses] = [] #data[:statuses][1]\n data[:order_field] = data[:order_field][1]\n data[:order_dir] = data[:order_dir][1]\n\n when 'text' then\n data[:field_fmt] = data[:field_fmt][1]\n data[:field_content_type] = data[:field_content_type][1]\n data[:field_text_direction] = data[:field_text_direction][1]\n\n when 'textarea' then\n data[:field_fmt] = data[:field_fmt][1]\n data[:field_text_direction] = data[:field_text_direction][1]\n\n when 'rte' then\n data[:field_text_direction] = data[:field_text_direction][1]\n\n when 'checkboxes', 'multi_select', 'radio', 'select' then\n data[:field_fmt] = data[:field_fmt][1]\n end\n\n return data\n end",
"def collect_stats\n # code callously ripped from statistics.rake !\n folders = STATS_FOLDERS.select{|name, dir| File.directory?(dir) }\n cs = CodeStatistics.new(*folders)\n statz = cs.statistics\n tyme = Time.now.to_i\n yaml = { \"build_#{ tyme }\" => statz }.to_yaml\n return yaml.sub(/^---/, '') # abrogate that pesky document marker!\n end",
"def parse(options = {})\n\n parse_properties\n parse_workout\n \n if(options[:calculate_marker_values])\n calculate_marker_values()\n end\n\n if(options[:calculate_peak_power_values])\n calculate_peak_power_values(:durations => options[:durations], :total_duration => @workout.markers.first.duration_seconds)\n end\n @workout\n end",
"def transform(raw_data)\n if self.content =~ /\\A(---.*?)---(.*)/m\n self.attributes = YAML.load($1).symbolize_keys\n self.content = $2\n\n [:created_at, :updated_at].each do |field|\n attr = self.attributes[field]\n self.attributes[field] = Time.parse(attr) if attr\n end\n end\n end",
"def create_config()\n # Materialize an array of desired trial configurations\n tests = []\n if $options[:experiments].include? :scalability\n $options[:scale_factors].each do |sf|\n get_node_counts(sf).each do |nodes|\n $options[:queries].each do |q|\n get_trials(sf).each do |trial|\n tests << $headers[0..-1].zip([:scalability, sf, nodes, get_switches(nodes), 2, q, trial]).to_h\n end end end end end\n # Latency experiments\n sample_delays = {0.1=>100, 1=>1000, 10=>10000, 100=>100000}\n if $options[:experiments].include? :latency\n [0.1, 1, 10, 100].each do |sf|\n get_node_counts(sf).reject {|nd| nd > 16}.each do |nodes|\n switch_counts = $options[:switch_counts].select {|s| s <= nodes}\n switch_counts.each do |switches|\n ['4', '3'].each do |q|\n get_trials(sf).each do |trial|\n t = $headers[0..-1].zip([:latency, sf, nodes, switches, 2, q, trial]).to_h\n t[:sample_delay] = sample_delays[sf]\n tests << t\n end end end end end end\n # Memory tests\n if $options[:experiments].include? :memory\n [1, 10].each do |sf|\n [1, 4, 8].each do |nodes|\n ['3'].each do |q|\n $options[:gc_epochs].each do |gc_epoch|\n $options[:delays].each do |delay|\n get_trials(sf).each do |trial|\n t = $headers[0..-1].zip([:memory, sf, nodes, get_switches(nodes), 2, q, trial]).to_h\n t[:gc_epoch] = gc_epoch\n t[:delay] = delay\n tests << t\n end end end end end end end\n #puts tests\n config = {\n :options => $options,\n :tests => tests\n }\n config\nend",
"def load_data(options={})\n @data = @files.collect do |seeds_file|\n seeds_file.instanciate_data(@keys, :override => options[:override]) \n end.flatten.compact\n end",
"def generateConfigData(configurationData)\n if !check_tasks_validity(configurationData[:tasks])\n raise ArgumentError.new(\"Bad tasks configuration\")\n end\n serverOutput=\"server {\n listen 80 default_server;\n listen [::]:80 default_server ipv6only=on;\n root /usr/share/nginx/html;\n\t client_max_body_size 100m;\n index index.html index.htm;\n\t large_client_header_buffers 4 40k;\n server_name #{@server_name};\\n\"\n loadBalancing={}\n configurationData[:tasks].each do |task|\n if task[:serviceName] == nil then\n next\n end\n if !loadBalancing.has_key?(task[:serviceName]) then\n loadBalancing[task[:serviceName]]=[];\n end\n if task[:filtered] == true then\n loadBalancing[task[:serviceName]].push(\"server #{task[:instance_private_ip]}:#{task[:host_port]} weight=0;\")\n else\n loadBalancing[task[:serviceName]].push(\"server #{task[:instance_private_ip]}:#{task[:host_port]};\")\n end\n end\n upstreamOutput=\"\"\n loadBalancing.each do |name,entry|\n if name == \"/\" then\n upstreamOutput+=\"upstream #{NginxConfigurator::ROOT_NAME} {\\n\"\n else\n upstreamOutput+=\"upstream #{name} {\\n\"\n end\n entry.each do |uri|\n upstreamOutput+=uri+\"\\n\"\n end\n upstreamOutput+=\"}\\n\"\n if name == \"/\" then\n serverOutput+=\"location / {\"\n else\n serverOutput+=\"location /#{name}/ {\"\n end\n if name == \"/\" then\n serverOutput+=\"\\nproxy_pass http://#{NginxConfigurator::ROOT_NAME};\"\n else\n serverOutput+=\"\\nproxy_pass http://#{name};\"\n end\n serverOutput+=\"\\n proxy_set_header Host $host; \\n proxy_set_header X-Real-IP $remote_addr; \\n }\\n\"\n end\n serverOutput+=\"}\"\n return \"### Created at #{Time.new()} ###\n ### automated nginx configuration ###\n #{upstreamOutput}\n #{serverOutput}\n\n ### betterez inc.\n \"\n end",
"def parse_service_data_from_options\n data = {}\n data[:strategy] = deploy_strategy if deploy_strategy\n data[:ports] = parse_ports(ports_list) unless ports_list.empty?\n data[:links] = parse_links(link_list) unless link_list.empty?\n data[:memory] = parse_memory(memory) if memory\n data[:memory_swap] = parse_memory(memory_swap) if memory_swap\n data[:shm_size] = parse_memory(shm_size) if shm_size\n data[:cpus] = cpus if cpus\n data[:cpu_shares] = cpu_shares if cpu_shares\n data[:affinity] = affinity_list unless affinity_list.empty?\n data[:env] = env_list unless env_list.empty?\n data[:secrets] = parse_secrets(secret_list) unless secret_list.empty?\n data[:container_count] = instances if instances\n data[:cmd] = Shellwords.split(cmd) if cmd\n data[:user] = user if user\n data[:image] = parse_image(image) if image\n data[:privileged] = privileged?\n data[:cap_add] = cap_add_list if cap_add_list\n data[:cap_drop] = cap_drop_list if cap_drop_list\n data[:net] = net if net\n data[:log_driver] = log_driver if log_driver\n data[:log_opts] = parse_log_opts(log_opt_list) if log_opt_list\n deploy_opts = parse_deploy_opts\n data[:deploy_opts] = deploy_opts unless deploy_opts.empty?\n health_check = parse_health_check\n data[:health_check] = health_check unless health_check.empty?\n data[:pid] = pid if pid\n data[:stop_signal] = stop_signal if stop_signal\n data[:stop_grace_period] = stop_timeout if stop_timeout\n data\n end",
"def extract( options )\n matchData = get_matched_customers( options[:target] )\n @dStart = options[:start].to_date\n @dEnd = options[:end].to_date\n @targets = self.get_matched_customers(options[:target])\n exFile = lewt_settings[\"milestones_filepath\"] || File.expand_path(File.join(File.dirname(__FILE__), \"../../../tests/milestones.csv\"))\n return get_milestones ( exFile )\n end",
"def load_data(data_file)\n puts \"FileGenTask: Loading data from YML file [ #{data_file} ]\" if @verbose\n df = DataFile.new\n @data = df.read( data_file )\n end",
"def default_data!(data)\n data.merge(\n \"features_folder\" => (data[\"features\"] || \"features\").downcase.strip,\n \"app_host\" => (data[\"app_host\"] || \"\").downcase.strip,\n \"driver\" => (data[\"driver\"] || \"chrome\").downcase.strip,\n \"headless\" => (data[\"headless\"].to_s.downcase.strip == \"true\"),\n \"print_progress\" => (data[\"print_progress\"].to_s.downcase.strip == \"true\"),\n \"pause\" => (data[\"pause\"] || \"0\").to_s.downcase.strip.to_i,\n \"stop_on_error\" => (data[\"stop_on_error\"] || \"false\").to_s.downcase.strip,\n \"max_wait_time\" => (data[\"max_wait_time\"] || Capybara.default_max_wait_time).to_s.downcase.strip.to_i,\n \"user_agent\" => (data[\"user_agent\"] || \"\").strip,\n # Because we want to default to 'true', but allow users to override it\n # with 'false' it causes us to mess with the logic. Essentially if the\n # user does enter false (either as a string or as a boolean) the result\n # will be 'true', so we flip it back to 'false' with !.\n # Else the condition fails and we get 'false', which when flipped gives\n # us 'true', which is what we want the default value to be\n # rubocop:disable Style/InverseMethods\n \"display_failures\" => !(data[\"display_failures\"].to_s.downcase.strip == \"false\"),\n # rubocop:enable Style/InverseMethods\n \"custom\" => (data[\"custom\"] || nil)\n )\n end",
"def parse_args(args)\n options = {\n :excount => 5,\n :testdata => nil,\n :console => false,\n :raw => false,\n :pronounciation_offset => 1,\n :definition_offset => 2,\n :url => \"m\"\n }\n\n opt_parser = OptionParser.new do |opts|\n opts.banner = \"Usage: #{$0} <input filepath> [options]\"\n\n opts.separator \"\"\n opts.separator \"Data options:\"\n opts.on(\"-p N\", Integer, \"Offset to pronunciation column, default 1\") do |n|\n options[:pronounciation_offset] = n\n end\n opts.on(\"-d N\", Integer, \"Offset to definition column, default 2\") do |n|\n options[:definition_offset] = n\n end\n opts.on(\"-n N\", Integer, \"Number of example sentences, default 5\") do |n|\n options[:excount] = n\n end\n opts.on(\"-u U\", String, \"Source url (#{WWWJDICExampleProvider::SOURCES.to_s}), default #{options[:url]}\") do |u|\n options[:url] = u\n end\n\n opts.separator \"\"\n opts.separator \"Testing:\"\n opts.on(\"-t\", \"--testdata [DATAFILE]\",\n \"Path to yaml data file of examples (useful for testing)\") do |d|\n options[:testdata] = d\n end\n\n opts.separator \"\"\n opts.separator \"Output:\"\n opts.on(\"-c\", \"--console\", \"Dump to console only\") do |c|\n options[:console] = c\n end\n opts.on(\"-r\", \"--raw\", \"Output raw data (all examples)\") do |c|\n options[:raw] = c\n end\n\n opts.separator \"\"\n opts.on_tail(\"-h\", \"--help\", \"Show this message\") do\n puts opts\n exit\n end\n end\n\n opt_parser.parse!(args)\n options\nend",
"def parse_data(data)\n # 結果が確定していない為、集計対象外\n return if unclosed?(data)\n\n site_id = data[\"_id\"][\"site_id\"]\n user_id = data[\"_id\"][\"user_id\"]\n user_code = data[\"_id\"][\"user_code\"]\n user_staff_address_uid = data[\"_id\"][\"user_staff_address_uid\"]\n group_id = data[\"_id\"][\"group_id\"]\n date = data[\"_id\"][\"date\"]\n fiscal_year = data[\"_id\"][\"fiscal_year\"]\n month = data[\"_id\"][\"month\"]\n start_at = data[\"_id\"][\"start_at\"]\n end_at = data[\"_id\"][\"end_at\"]\n capital_code = data[\"_id\"][\"capital_code\"]\n project_code = data[\"_id\"][\"project_code\"]\n detail_code = data[\"_id\"][\"detail_code\"]\n file_id = data[\"_id\"][\"file_id\"]\n\n duty_day_time_minute = data[\"duty_day_time_minute\"]\n duty_day_in_work_time_minute = data[\"duty_day_in_work_time_minute\"]\n duty_night_time_minute = data[\"duty_night_time_minute\"]\n\n leave_day_time_minute = data[\"leave_day_time_minute\"]\n leave_night_time_minute = data[\"leave_night_time_minute\"]\n\n week_in_compensatory_minute = data[\"week_in_compensatory_minute\"]\n holiday_compensatory_minute = data[\"holiday_compensatory_minute\"]\n break_time_minute = data[\"break_time_minute\"]\n\n unrate_week_out_compensatory_minute = data[\"week_out_compensatory_minute\"]\n week_out_compensatory_minute = 0\n\n # 週内、週外残業(土日)があった場合、休出区分割増にならない\n if week_in_compensatory_minute > 0 || unrate_week_out_compensatory_minute > 0\n duty_day_time_minute += leave_day_time_minute\n duty_night_time_minute += leave_night_time_minute\n\n leave_day_time_minute = 0\n leave_night_time_minute = 0\n end\n\n # 週外残業は、その週の業務時間合計が 38.75h (2325m) を超えない場合、割増がつかない\n week_working = nil\n if unrate_week_out_compensatory_minute > 0\n @week_working_extractor.week_at(site_id, user_id, date.to_date)\n week_working = @week_working_extractor.week_working\n week_working_minute = @week_working_extractor.week_minutes\n\n if week_working_minute >= 2325\n unrate_week_out_compensatory_minute = 0\n week_out_compensatory_minute = data[\"week_out_compensatory_minute\"]\n end\n end\n\n @subtractors[user_id] ||= Gws::Affair::Subtractor.new(threshold)\n w_c_m = week_out_compensatory_minute # 0. 025/100\n i_w_m = duty_day_in_work_time_minute # 1. 100/100\n d_d_m = duty_day_time_minute # 2. 125/100\n l_d_m = leave_day_time_minute # 3. 135/100\n d_n_m = duty_night_time_minute # 4. 150/100\n l_n_m = leave_night_time_minute # 5. 160/100\n\n under_minutes, over_minutes = @subtractors[user_id].subtract(w_c_m, i_w_m, d_d_m, l_d_m, d_n_m, l_n_m)\n\n under_overtime_minute = under_minutes.sum\n over_overtime_minute = over_minutes.sum\n overtime_minute = under_overtime_minute + over_overtime_minute\n\n @prefs[user_id] ||= {}\n @prefs[user_id][file_id] = {\n # user\n user_id: user_id,\n user_code: user_code,\n user_staff_address_uid: user_staff_address_uid,\n\n # group\n group_id: group_id,\n\n # date\n date: date.localtime,\n fiscal_year: fiscal_year,\n month: month,\n start_at: start_at.localtime,\n end_at: end_at.localtime,\n\n # capital\n capital_code: capital_code,\n project_code: project_code,\n detail_code: detail_code,\n\n # minutes\n week_in_compensatory_minute: week_in_compensatory_minute,\n holiday_compensatory_minute: holiday_compensatory_minute,\n week_out_compensatory_minute: week_out_compensatory_minute,\n unrate_week_out_compensatory_minute: unrate_week_out_compensatory_minute,\n break_time_minute: break_time_minute,\n week_working: week_working,\n overtime_minute: overtime_minute,\n under: {\n duty_day_time_minute: under_minutes[2].to_i,\n duty_night_time_minute: under_minutes[4].to_i,\n duty_day_in_work_time_minute: under_minutes[1].to_i,\n leave_day_time_minute: under_minutes[3].to_i,\n leave_night_time_minute: under_minutes[5].to_i,\n week_out_compensatory_minute: under_minutes[0].to_i,\n overtime_minute: under_overtime_minute\n },\n over: {\n duty_day_time_minute: (over_minutes[2].to_i + over_minutes[1].to_i),\n duty_night_time_minute: over_minutes[4].to_i,\n leave_day_time_minute: over_minutes[3].to_i,\n leave_night_time_minute: over_minutes[5].to_i,\n week_out_compensatory_minute: over_minutes[0].to_i,\n overtime_minute: over_overtime_minute\n }\n }\n end",
"def update_config_options\n options = Util::OptsParser.options(ARGV)\n Util::Configuration.tag_time_to_live_in_seconds = options[:ttl]\n Util::Configuration.case_sensitive_matching = options[:case]\n Util::Configuration.hashtag_storage_class = options[:storage]\n Util::Configuration.log_capture_device = options[:log_device]\n Util::Configuration.automatic_restart = options[:automatic_restart]\n current_config = Util::Configuration.to_a\n current_config << \"Port: #{options[:port]}\"\n logger.info(current_config.join(', '))\n options\n end",
"def output_cc_user_data(options,user_data,exec_data,output_file)\n if !options['vm'].to_s.match(/mp|multipass/)\n in_target = \"curtin in-target --target=/target -- \"\n else\n in_target = \"\"\n end\n check_dir = File.dirname(output_file)\n check_dir_exists(options,check_dir)\n tmp_file = \"/tmp/user_data_\"+options['name']\n file = File.open(tmp_file, 'w')\n end_char = \"\\n\"\n user_data.each do |line|\n output = line+end_char\n file.write(output)\n end\n pkg_list = options['q_struct']['additional_packages'].value\n if options['vm'].to_s.match(/mp|multipass/)\n file.write(\"packages:\\n\")\n pkg_list.split(\" \").each do |line|\n output = \" - \"+line+\"\\n\"\n file.write(output)\n end\n file.write(\"runcmd:\\n\")\n exec_data.each do |line|\n output = \" - \"+line+\"\\n\"\n file.write(output)\n end\n else\n end_char = \"\"\n file.write(\" late-commands:\\n\")\n file.write(\" [\")\n exec_data.each do |line|\n output = \" \\\"\"+line+\"\\\",\"+end_char\n file.write(output)\n end\n file.write(\" \\\"#{in_target}apt update\\\",\")\n output = \" \\\"#{in_target}apt install -y \"+pkg_list+\"\\\",\"+end_char\n file.write(output)\n file.write(\" \\\"date\\\" ]\\n\\n\")\n end\n file.close\n message = \"Creating:\\tCloud user-data file \"+output_file\n command = \"cat #{tmp_file} >> #{output_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n print_contents_of_file(options,\"\",output_file)\n return\nend",
"def parsed\n vals = \"-f #{determine_capture_device} \"\n vals << \"-r #{@options[:framerate]} \"\n vals << advanced_options if @options[:advanced]\n vals << \"-i #{determine_input} \"\n vals << @options[:output]\n vals << ffmpeg_log_to(@options[:log]) # If provided\n end",
"def data\n @_data ||= {\n :as => @options.values.first,\n :type => @options.keys.first,\n :required_platforms => [@options[:requires]].flatten.compact\n }\n end",
"def data(output)\n data = {}\n lines = output.split(/\\n/)\n lines.grep(/Duration:/).first.split(/,/).\n map {|l| l.split(': ').map(&:strip)}.\n each {|d| data[d.first.underscore.to_sym] = d.last}\n data[:size] = $1 if lines.grep(/Video:/).first.match(/(\\d+x\\d+)/)\n data\n end",
"def generate_data_files\n files = {}\n\n # extracted data\n @classes.each do |category|\n files[category] = {}\n folder = File.join(@res, 'data', category.to_s, 'extracted')\n\n files[category][:extracted] = File.join(folder, \"#{category}.json\")\n end\n\n # divided data\n @classes.each do |category|\n files[category][:divided] = {}\n folder = File.join(@res, 'data', category.to_s, 'divided')\n\n @subsets.each do |subset|\n files[category][:divided][subset] = File.join(folder,\n \"#{category}_#{subset}.json\")\n end\n end\n\n # preprocessed data\n @classes.each do |category|\n files[category][:preprocessed] = {}\n\n @preproc.each do |preprocess|\n folder = File.join(\n @res, 'data', category.to_s, 'preprocessed', preprocess.to_s)\n\n files[category][:preprocessed][preprocess] = {}\n\n @subsets.each do |subset|\n files[category][:preprocessed][preprocess][subset] = File.join(\n folder, \"#{category}_#{subset}.json\")\n end\n end\n end\n\n # transformed data\n if @trans.size > 0\n @classes.each do |category|\n files[category][:transformed] = {}\n\n @trans.each do |transformation|\n @preproc.each do |preprocess|\n ctrans = :\"#{transformation}_#{preprocess}\"\n\n folder = File.join(\n @res, 'data', category.to_s, 'transformed', ctrans.to_s)\n\n files[category][:transformed][ctrans] = {}\n\n @subsets.each do |subset|\n files[category][:transformed][ctrans][subset] = File.join(\n folder, \"#{category}_#{subset}.json\")\n end\n end\n end\n end\n end\n\n # classified data\n if @classifs.size > 0\n @classes.each do |category|\n files[category][:classified] = {}\n\n @classifs.each do |classifier|\n @trans.each do |transformation|\n @preproc.each do |preprocess|\n ctrans = :\"#{classifier}_#{transformation}_#{preprocess}\"\n\n folder = File.join(\n @res, 'data', category.to_s, 'classified', ctrans.to_s)\n\n files[category][:classified][ctrans] = {}\n\n @subsets.each do |subset|\n files[category][:classified][ctrans][subset] = File.join(\n folder, \"#{category}_#{subset}.json\")\n end\n end\n end\n end\n end\n end\n files\n end",
"def set_payload(data)\n @payload = { \n 'caption' => data['caption']['text'], \n 'photo_url' => data['images']['standard_resolution']['url'],\n 'title' => \"#{data['user']['username']}_#{data['created_time']}\"\n }\n @log.debug(\"Payload is #{@payload}\")\n end",
"def load_data\n data = {}.with_indifferent_access\n\n %w[.json .yaml].each do |ext|\n Dir.glob(\"#{DATA_DIR}/*#{ext}\") do |fname|\n key = File.basename(fname, ext).to_sym\n puts \"Loading data[:#{key}] from #{fname}...\"\n data[key] =\n if ext == '.json'\n JSON.parse(File.read(fname))\n else\n Psych.parse(fname)\n end\n end\n end\n\n data\n end",
"def extractable_options?; end",
"def cloud_config_data\n env_run_cmds = []\n self.options.each_pair do |key, properties|\n if properties[:environment] && !properties[:value].nil?\n escaped_value = properties[:value].to_s.gsub(/\"/, '\\\\\\\\\\\\\\\\\\\"')\n env_run_cmds.push \"echo \\\"#{key}=\\\\\\\"#{escaped_value}\\\\\\\"\\\" >> /etc/environment\"\n end\n end\n\n user_data_config = self.cloud_config.dup\n user_data_config['runcmd'] ||= []\n user_data_config['runcmd'] = env_run_cmds.concat(user_data_config['runcmd'])\n return \"#cloud-config\\n#{user_data_config.to_yaml}\"\n end",
"def generate_runtime_data(opts)\n obj = opts[:object]\n generate_data \"runtime.#{obj}.dat\", default_data_patterns, opts\nend",
"def event_file_data\n { hosts: options[:host],\n description: options[:desc],\n severity: options[:severity],\n tags: options[:evtag] }.to_json\n end",
"def parsed_args\n args = Options.new('binnacle - Simple Test and Infra automation Framework')\n args.verbose = 0\n args.runner = false\n args.result_json = ''\n\n opt_parser = OptionParser.new do |opts|\n opts.banner = 'Usage: binnacle [options] <testfile>'\n\n opts.on('-w', '--wide', 'Do not crop the task line') { args.wide = true }\n opts.on('-v', '--verbose', 'Verbose output') { args.verbose += 1 }\n opts.on('-r', '--runner', 'Run the tasks from a file (Internal use only)') { args.runner = true }\n opts.on('--results-json=FILE', 'Results JSON file') do |json_file|\n args.result_json = json_file\n end\n\n opts.on('-h', '--help', 'Prints this help') do\n puts opts\n exit\n end\n\n opts.on('--version', 'Show Version information') do\n puts \"Binnacle #{Binnacle::VERSION}\"\n exit\n end\n end\n\n opt_parser.parse!(ARGV)\n\n if ARGV.empty?\n warn 'Task file is not specified'\n exit EXIT_INVALID_ARGS\n end\n\n args.task_files = ARGV\n args\nend",
"def process_options\n @options.verbose = false if @options.quiet\n # @options.output = \"#{@options.output}/#{File.basename(@options.input)}\" if File.directory?(@options.output)\n @options.output = \"#{@options.output}\" if (File.directory?(@options.output) && File.exists?(File.dirname(@options.output)))\n end",
"def collect_data( data )\n data\n end",
"def populate_cc_user_data(options)\n install_locale = options['q_struct']['locale'].value\n if install_locale.match(/\\./)\n install_locale = install_locale.split(\".\")[0]\n end\n if options['livecd'] == true\n install_target = \"/target\"\n else\n install_target = \"\"\n end\n install_nameserver = options['q_struct']['nameserver'].value\n install_base_url = \"http://\"+options['hostip']+\"/\"+options['name']\n install_layout = install_locale.split(\"_\")[0]\n install_variant = install_locale.split(\"_\")[1].downcase\n install_gateway = options['q_struct']['gateway'].value\n admin_shell = options['q_struct']['admin_shell'].value\n admin_sudo = options['q_struct']['admin_sudo'].value\n disable_dhcp = options['q_struct']['disable_dhcp'].value\n install_name = options['q_struct']['hostname'].value\n resolved_conf = \"/etc/systemd/resolved.conf\"\n admin_user = options['q_struct']['admin_username'].value\n admin_group = options['q_struct']['admin_username'].value\n admin_home = \"/home/\"+options['q_struct']['admin_username'].value\n admin_crypt = options['q_struct']['admin_crypt'].value\n install_nic = options['q_struct']['interface'].value\n if disable_dhcp.match(/true/)\n install_ip = options['q_struct']['ip'].value\n end\n install_cidr = options['q_struct']['cidr'].value\n install_disk = options['q_struct']['partition_disk'].value\n if install_disk.match(/\\//)\n install_disk = install_disk.split(/\\//)[-1]\n end\n #netplan_file = \"#{install_target}/etc/netplan/01-netcfg.yaml\"\n netplan_file = \"#{install_target}/etc/netplan/50-cloud-init.yaml\"\n locale_file = \"#{install_target}/etc/default/locales\"\n grub_file = \"#{install_target}/etc/default/grub\"\n ssh_dir = \"#{install_target}/home/#{admin_user}/.ssh\"\n auth_file = \"#{ssh_dir}/authorized_keys\"\n sudo_file = \"#{install_target}/etc/sudoers.d/#{admin_user}\"\n if options['vmnetwork'].to_s.match(/hostonly/)\n ks_ip = options['hostonlyip']\n else\n if disable_dhcp.match(/false/)\n ks_ip = options['hostonlyip']\n else\n ks_ip = options['hostip']\n end\n end\n if disable_dhcp.match(/false/)\n install_dhcp = \"yes\"\n else\n install_dhcp = \"no\"\n end\n if options['copykeys'] == true\n ssh_keyfile = options['sshkeyfile']\n if File.exist?(ssh_keyfile)\n ssh_key = %x[cat #{ssh_keyfile}].chomp\n ssh_dir = \"#{install_target}/home/\"+admin_user+\"/.ssh\"\n end\n end\n ks_port = options['httpport']\n user_data = []\n exec_data = []\n user_data.push(\"#cloud-config\")\n if !options['vm'].to_s.match(/mp|multipass/)\n in_target = \"curtin in-target --target=/target -- \"\n user_data.push(\"autoinstall:\")\n user_data.push(\" version: 1\")\n user_data.push(\" apt:\")\n user_data.push(\" geoip: true\")\n user_data.push(\" preserve_sources_list: false\")\n user_data.push(\" primary:\")\n if options['arch'].to_s.match(/arm/)\n user_data.push(\" - arches: [arm64, arm]\")\n else\n user_data.push(\" - arches: [amd64, i386]\")\n end\n user_data.push(\" uri: http://archive.ubuntu.com/ubuntu\")\n user_data.push(\" - arches: [default]\")\n user_data.push(\" uri: http://ports.ubuntu.com/ubuntu-ports\")\n user_data.push(\" identity:\")\n user_data.push(\" hostname: #{install_name}\")\n user_data.push(\" password: #{admin_crypt}\")\n user_data.push(\" realname: #{admin_user}\")\n user_data.push(\" username: #{admin_user}\")\n user_data.push(\" keyboard:\")\n user_data.push(\" layout: #{install_layout}\")\n user_data.push(\" variant: #{install_variant}\")\n user_data.push(\" locale: #{install_locale}.UTF-8\")\n user_data.push(\" network:\")\n user_data.push(\" network:\")\n user_data.push(\" version: 2\")\n user_data.push(\" ethernets:\")\n user_data.push(\" #{install_nic}:\")\n user_data.push(\" dhcp4: #{install_dhcp}\")\n user_data.push(\" ssh:\")\n user_data.push(\" install-server: true\")\n user_data.push(\" allow-pw: true\")\n user_data.push(\" storage:\")\n user_data.push(\" config:\")\n user_data.push(\" - grub_device: true\")\n user_data.push(\" id: disk-#{install_disk}\")\n user_data.push(\" path: /dev/#{install_disk}\")\n user_data.push(\" ptable: gpt\")\n user_data.push(\" type: disk\")\n user_data.push(\" wipe: superblock-recursive\")\n user_data.push(\" - device: disk-#{install_disk}\")\n user_data.push(\" flag: bios_grub\")\n user_data.push(\" id: partition-0\")\n user_data.push(\" number: 1\")\n user_data.push(\" size: 1048576\")\n user_data.push(\" type: partition\")\n user_data.push(\" - device: disk-#{install_disk}\")\n user_data.push(\" id: partition-1\")\n user_data.push(\" number: 2\")\n user_data.push(\" size: -1\")\n user_data.push(\" type: partition\")\n user_data.push(\" wipe: superblock\")\n user_data.push(\" - name: root_vg\")\n user_data.push(\" devices: [partition-1]\")\n user_data.push(\" preserve: false\")\n user_data.push(\" type: lvm_volgroup\")\n user_data.push(\" id: lvm_volgroup-0\")\n user_data.push(\" - name: root_lv\")\n user_data.push(\" volgroup: lvm_volgroup-0\")\n user_data.push(\" size: -1\")\n user_data.push(\" wipe: superblock\")\n user_data.push(\" preserve: false\")\n user_data.push(\" type: lvm_partition\")\n user_data.push(\" id: lvm_partition-0\")\n user_data.push(\" - fstype: ext4\")\n user_data.push(\" id: format-0\")\n user_data.push(\" type: format\")\n user_data.push(\" volume: lvm_partition-0\")\n user_data.push(\" - device: format-0\")\n user_data.push(\" id: mount-0\")\n user_data.push(\" path: /\")\n user_data.push(\" type: mount\")\n user_data.push(\" updates: security\")\n user_data.push(\" user-data:\")\n user_data.push(\" disable-root: false\")\n if disable_dhcp.match(/true/)\n exec_data.push(\"ip addr add #{install_ip}/#{install_cidr} dev #{install_nic}\")\n end\n exec_data.push(\"ip link set #{install_nic} up\")\n exec_data.push(\"ip route add default via #{install_gateway}\")\n exec_data.push(\"echo 'DNS=#{install_nameserver}' >> #{resolved_conf}\")\n exec_data.push(\"systemctl restart systemd-resolved\")\n else\n in_target = \"\"\n if options['method'].to_s.match(/ci/)\n user_data.push(\"hostname: #{install_name}\")\n user_data.push(\"groups:\")\n user_data.push(\" - #{admin_user}: #{admin_group}\")\n user_data.push(\"users:\")\n user_data.push(\" - default\")\n user_data.push(\" - name: #{admin_user}\")\n user_data.push(\" gecos: #{admin_user}\")\n user_data.push(\" primary_group: #{admin_group}\")\n user_data.push(\" shell: #{admin_shell}\")\n user_data.push(\" passwd: #{admin_crypt}\")\n user_data.push(\" sudo: #{admin_sudo}\")\n user_data.push(\" lock_passwd: false\")\n end\n end\n if options['dnsmasq'] == true && options['vm'].to_s.match(/mp|multipass/)\n exec_data.push(\"/usr/bin/systemctl disable systemd-resolved\")\n exec_data.push(\"/usr/bin/systemctl stop systemd-resolved\")\n exec_data.push(\"rm /etc/resolv.conf\")\n if options['q_struct']['nameserver'].value.to_s.match(/\\,/)\n nameservers = options['q_struct']['nameserver'].value.to_s.split(\"\\,\")\n nameservers.each do |nameserver|\n exec_data.push(\"echo 'nameserver #{nameserver}' >> /etc/resolv.conf\")\n end\n else\n nameserver = options['q_struct']['nameserver'].value.to_s\n exec_data.push(\" - echo 'nameserver #{nameserver}' >> /etc/resolv.conf\")\n end\n else \n exec_data.push(\"echo 'DNS=#{install_nameserver}' >> #{install_target}#{resolved_conf}\")\n exec_data.push(\"#{in_target}/usr/sbin/locale-gen #{install_locale}.UTF-8\")\n end\n exec_data.push(\"echo 'LC_ALL=en_US.UTF-8' > #{locale_file}\")\n exec_data.push(\"echo 'LANG=en_US.UTF-8' >> #{locale_file}\")\n exec_data.push(\"echo '#{admin_user} ALL=(ALL) NOPASSWD:ALL' > #{sudo_file}\")\n if options['copykeys'] == true and File.exist?(ssh_keyfile) and !options['vm'].to_s.match(/mp|multipass/)\n exec_data.push(\"#{in_target}groupadd #{admin_user}\")\n exec_data.push(\"#{in_target}useradd -p '#{admin_crypt}' -g #{admin_user} -G #{admin_group} -d #{admin_home} -s /usr/bin/bash -m #{admin_user}\")\n exec_data.push(\"mkdir -p #{ssh_dir}\")\n exec_data.push(\"echo '#{ssh_key}' > #{auth_file}\")\n exec_data.push(\"chmod 600 #{auth_file}\")\n exec_data.push(\"chmod 700 #{ssh_dir}\")\n exec_data.push(\"#{in_target}chown -R #{admin_user}:#{admin_user} #{admin_home}\")\n end\n if !options['vm'].to_s.match(/mp|multipass/)\n if options['vm'].to_s.match(/kvm/)\n exec_data.push(\"systemctl enable serial-getty@ttyS0.service\")\n exec_data.push(\"systemctl start serial-getty@ttyS0.service\")\n else\n if options['serial'] == true\n if options['biosdevnames'] == true\n exec_data.push(\"echo 'GRUB_CMDLINE_LINUX=\\\\\\\"net.ifnames=0 biosdevname=0 console=tty0 console=ttyS0\\\\\\\"' >> #{grub_file}\")\n else\n exec_data.push(\"echo 'GRUB_CMDLINE_LINUX=\\\\\\\"console=tty0 console=ttyS0\\\\\\\"' >> #{grub_file}\")\n end\n exec_data.push(\"echo 'GRUB_TERMINAL_INPUT=\\\\\\\"console serial\\\\\\\"' >> #{grub_file}\")\n exec_data.push(\"echo 'GRUB_TERMINAL_OUTPUT=\\\\\\\"console serial\\\\\\\"' >> #{grub_file}\")\n else\n if options['biosdevnames'] == true\n exec_data.push(\"echo 'GRUB_CMDLINE_LINUX=\\\\\\\"net.ifnames=0 biosdevname=0\\\\\\\"' >> #{grub_file}\")\n end\n end\n end\n if !options['vm'].to_s.match(/mp|multipass/)\n if options['dhcp'] == false || options['dnsmasq'] == true\n exec_data.push(\"echo '# This file describes the network interfaces available on your system' > #{netplan_file}\")\n exec_data.push(\"echo '# For more information, see netplan(5).' >> #{netplan_file}\")\n exec_data.push(\"echo 'network:' >> #{netplan_file}\")\n exec_data.push(\"echo ' version: 2' >> #{netplan_file}\")\n exec_data.push(\"echo ' renderer: networkd' >> #{netplan_file}\")\n exec_data.push(\"echo ' ethernets:' >> #{netplan_file}\")\n exec_data.push(\"echo ' #{install_nic}:' >> #{netplan_file}\")\n else\n if disable_dhcp.match(/true/)\n exec_data.push(\"echo ' addresses: [#{install_ip}/#{install_cidr}]' >> #{netplan_file}\")\n exec_data.push(\"echo ' gateway4: #{install_gateway}' >> #{netplan_file}\")\n else\n exec_data.push(\"echo ' dhcp4: true' >> #{netplan_file}\")\n end\n end\n if options['serial'] == true || options['biosdevnames'] == true\n exec_data.push(\"#{in_target}update-grub\")\n end\n if options['reboot'] == true\n exec_data.push(\"#{in_target}reboot\")\n end\n end\n end\n return user_data,exec_data\nend",
"def generate(data)\n lines = data.collect do |d|\n Task::TIME_FIELDS.each do |field|\n d[field] = d[field]&.iso8601\n end\n CSV.generate_line(d, headers: HEADERS, force_quotes: true).strip\n end\n\n lines.unshift(HEADERS.join(','))\n\n lines.join(\"\\n\") << \"\\n\"\n end",
"def load_configuration_data!(options)\n if vars = Cache.instance[\"configuration_data\"][\"vars\"]\n if default_vars = vars[\"_default_\"]\n apply_configuration_data!(default_vars)\n end\n if options[:use]\n Array(options[:use]).each do |use|\n if use_vars = vars[use]\n apply_configuration_data!(use_vars)\n end\n end\n end\n end\n end",
"def parse_data(data)\n # Prevent abortive empty JSON.parse error\n data = '{}' if data.blank?\n\n return \"Error from #{@task}: #{data}\" if data.is_a?(String) && data.include?('No such')\n\n data = JSON.parse(data) if data.is_a?(String)\n\n @output[:relevant_output] = relevant_output( data, @git_files ) unless @git_files.blank?\n data = @output[:relevant_output] unless @settings[:commit].blank?\n data\n end",
"def options\n return @data.options\n end",
"def process_options\n \n end",
"def process_options\n \n end",
"def process_options\n \n end",
"def options\n data[:options]\n end",
"def save_polls_data(data)\n save_data('polls.yaml', data)\nend",
"def build_givenhash(data)\n givenhash = {}\n unless data[:moduleoptions].nil?\n data[:moduleoptions].each do |key, value|\n givenhash[key.to_s] = value.to_s.tr(\"\\n\", ' ').strip\n end\n end\n givenhash\n end",
"def store_options\n pure_options = []\n self.options.each do |o|\n pure_options << {'text' => o.text, 'correct' => o.correct}\n end\n \n self.json_options = pure_options.to_json\n end",
"def options_parser\n @options ||= {\n :env => :development,\n :port => 9095\n #:config => File.join( Wonkavision::Sample::CONFIG_DIR, \"worker.rb\" )\n }\n\n @options_parser ||= OptionParser.new do |opts|\n opts.banner = \"Usage: rpm_analytics_worker [options]\"\n\n opts.separator \"\"\n opts.separator \"Server options:\"\n \n opts.on('-e', '--environment NAME', \"Set the execution environment (prod, dev or test) (default: #{@options[:env]})\") { |val| @options[:env] = val }\n opts.on('-l', '--log FILE', \"Log to file (default: off)\") { |file| @options[:log_dir] = file }\n opts.on('-s', '--stdout', \"Log to stdout (default: #{@options[:log_stdout]})\") { |v| @options[:log_stdout] = v }\n opts.on('-v', '--verbose', \"Enable verbose logging (default: #{@options[:verbose]})\") { |v| @options[:verbose] = v }\n opts.on('-c', '--console', 'Start a wonkavision console. Other requested services (worker or api) will not run until the console exits.') { |c| @options[:run_console] = c }\n opts.on('-f', '--api', \"Run the API web front end (default: #{!!@options[:run_api]}\") { |v| @options[:run_api] = v }\n opts.on('-w', '--worker', \"Run an analytics worker (default: #{!!@options[:run_worker]}\") { |v| @options[:run_worker] = v }\n opts.on('-a', '--address HOST', \"Bind to HOST address (default: #{@options[:address]})\") { |addr| @options[:address] = addr }\n opts.on('-p', '--port PORT', \"Use PORT (default: #{@options[:port]})\") { |port| @options[:port] = port.to_i }\n opts.on('-h', '--help', 'Display help message') { show_options(opts) }\n end\n\n end",
"def data_links\r\n puts \"pwd:\"\r\n puts Dir.pwd\r\n\r\n data = YAML.load_file( './data/links.yml' )\r\n puts data.inspect\r\n data\r\nend",
"def extract_data\n cmd = \"unzip -d #{DATA_DIR} -o #{DATA_PATH}\"\n system cmd\n end",
"def template_data_format(data)\n data = data.to_smash\n Smash.new.tap do |result|\n result[:config] = data.fetch(:config, Smash.new)\n result[:imports] = data.fetch(:imports, []).map do |item|\n begin\n Smash.new(\n :name => item[:name],\n :content => YAML.load(item[:content])\n )\n rescue\n item\n end\n end\n if(result.get(:config, :content))\n result[:config][:content] = YAML.load(result[:config][:content]) || Smash.new\n else\n result[:config][:content] = Smash.new\n end\n end\n end",
"def transform_results(options={})\n\n season = options[:season] ? options[:season] : '1314'\n league_id_str = league_id = options[:league]\n\n puts \"Fetching 'Results by League' info for league #{league_id_str} from production data store ...\"\n match_xml = Nokogiri::XML(aws_data_fetch({\n name: \"HistoricMatches-league-#{league_id_str}-#{season}.xml\",\n path: 'soccer/raw-data',\n }))\n\n data_file_recs = Array.new\n \n # live_score_xml = Nokogiri::XML(File.open(\"XML/LiveScore-league3-latest.xml\"))\n # live_score_match_ids = live_score_xml.xpath(\"//Match/Id\").map{ |node| node.text }\n # # puts \"live_score_match_ids #{live_score_match_ids}\"\n live_score_match_ids = Array.new\n\n match_xml.xpath(\"//Match\").each do |node|\n\n next if node.xpath(\"Id\").text == \"62364\"\n\n\n # puts \"========= MATCH ID : '#{node.xpath(\"FixtureMatch_Id\").text}' : LEAGUE : #{league} =========\"\n fixture_match_id = node.xpath(\"FixtureMatch_Id\").text\n fixture_id_str = standardize_id_str(fixture_match_id, :fixture)\n\n # Get substitution info from LiveScore data\n if live_score_match_ids.include? fixture_match_id\n live_score_node = live_score_xml.at(\"Id:contains(#{fixture_match_id})\").parent\n [\"Home\",\"Away\"].each do |team|\n sub_details = Array.new\n sub_details_node = node.add_child(\"<#{team}SubDetails></#{team}SubDetails>\")\n live_score_node.xpath(\"#{team}SubDetails\").text.split(';').reverse_each do |sub|\n sub_details << get_sub_details(sub)\n sub_details_node.first.add_child(\"<SubDetail />\")\n end\n\n i = 0\n node.xpath(\"#{team}SubDetails/SubDetail\").each do |detail|\n sub_detail_string = \"<Time>#{sub_details[i][:time]}</Time>\" +\n \"<Name>#{sub_details[i][:name]}</Name>\" +\n \"<Direction>#{sub_details[i][:dir]}</Direction>\"\n detail.add_child(sub_detail_string)\n i += 1\n end\n end\n end\n\n # Goal scorers\n [\"Home\",\"Away\"].each do |team|\n # JMC - skip Brasiliero 'GoalDetails' for now\n unless league_id == \"37\" or node.xpath(\"#{team}GoalDetails\").first.nil?\n goal_details = get_details(node.xpath(\"#{team}GoalDetails\").text)\n node.xpath(\"#{team}GoalDetails\").first.content = ''\n goal_details.each do |goal|\n tmp_str = \"<GoalDetail>\" +\n \"<Name>#{goal[:name]}</Name>\" +\n \"<Time>#{goal[:time]}</Time>\" +\n \"</GoalDetail>\"\n node.xpath(\"#{team}GoalDetails\").first.add_child(tmp_str)\n end\n end\n end\n\n # # Lineups\n # [\"Home\",\"Away\"].each do |team|\n # node.xpath(\"#{team}LineupDefense\").text.split(';').each do |player|\n # node << (\"<#{team}LineupDefender>#{player.strip}</#{team}LineupDefender>\")\n # end\n # node.xpath(\"#{team}LineupMidfield\").text.split(';').each do |player|\n # node << (\"<#{team}LineupMidfielder>#{player.strip}</#{team}LineupMidfielder>\")\n # end\n # node.xpath(\"#{team}LineupForward\").text.split(';').each do |player|\n # node << (\"<#{team}LineupForwardist>#{player.strip}</#{team}LineupForwardist>\")\n # end\n # end\n\n # Lineups\n [\"Home\",\"Away\"].each do |team|\n node.add_child(\"<#{team}Lineup />\")\n tmp_str = \"<Player>\" +\n \"<Name>#{node.xpath(\"#{team}LineupGoalkeeper\").text.strip}</Name>\" + \n \"<Position>G</Position>\" +\n \"</Player>\"\n node.xpath(\"#{team}Lineup\").first.add_child(tmp_str)\n node.xpath(\"#{team}LineupGoalkeeper\").remove\n \n [\"Defense\",\"Midfield\",\"Forward\"].each do |position|\n position_str = node.xpath(\"#{team}Lineup#{position}\").text\n node.xpath(\"#{team}Lineup#{position}\").remove\n position_str.split(';').each do |player|\n tmp_str = \"<Player>\" +\n \"<Name>#{player.strip}</Name>\" +\n \"<Position>#{position[0]}</Position>\" +\n \"</Player>\"\n node.xpath(\"#{team}Lineup\").first.add_child(tmp_str)\n end\n end\n end\n\n # Bookings: Yellow and Red Cards\n [\"Home\",\"Away\"].each do |team|\n [\"Yellow\",\"Red\"].each do |card|\n # Skip when missing 'TeamCardDetails' element (identified in Serie B data)\n unless node.xpath(\"#{team}Team#{card}CardDetails\").first.nil?\n tmp_card_details = get_details(node.xpath(\"#{team}Team#{card}CardDetails\").text)\n node.xpath(\"#{team}Team#{card}CardDetails\").first.content = ''\n tmp_card_details.each do |tcd|\n tmp_str = \"<CardDetail>\" +\n \"<Name>#{tcd[:name]}</Name>\" +\n \"<Time>#{tcd[:time]}</Time>\" +\n \"</CardDetail>\"\n node.xpath(\"#{team}Team#{card}CardDetails\").first.add_child(tmp_str)\n end\n end\n end\n end\n\n # Add the league_id\n league_name = node.xpath(\"League\").text\n league_id = @xmlsoccer_league_map[league_name]\n node.add_child(\"<League_Id>#{league_id}</League_Id>\")\n\n # Handle the shittle situation\n if league_id == \"20\"\n if node.xpath(\"HomeTeam_Id\").text == \"579\"\n node.xpath(\"HomeTeam\").first.content = 'Shittle Flounders FC'\n elsif node.xpath(\"AwayTeam_Id\").text == \"579\"\n node.xpath(\"AwayTeam\").first.content = 'Shittle Flounders FC'\n end\n end \n\n # Save the XML file for this match\n filename = write_xml_file({\n group: 'match',\n group_info: fixture_id_str,\n node: node,\n })\n\n # Save record for generating json and rake files\n data_file_recs << { name: filename, \n path: 'soccer/matches',\n # has_corrections: false,\n # format: 'xml',\n # data_store: 'aws',\n # data_store_id: 1,\n timestamp: `date`.strip } \n\n end # end match_reports\n\n # Save as json file for uploading xml files to data store\n write_upload_list_json_file({\n rec_type: 'result',\n rec_info: league_id_str,\n rec_data: 'xml',\n recs: data_file_recs,\n })\n\n # JMC-CREATE: Initialize the DataFile records\n write_create_records_rake_file({\n rec_class: 'DataFile',\n rec_type: 'file',\n desc: 'Fill database with file data',\n recs: data_file_recs,\n jmc: 'r1',\n ext: league_id_str,\n })\n\n # Create rake file to update Fixture.report_id with the match report id.\n # Yep, same as Fixture.match_id - essentially used as a 'has match report'\n # boolean for now, but keeping since the report id is likely to change\n # fixture_match_ids = match_xml.xpath(\"//Match/FixtureMatch_Id\").map{ |node| node.text }\n update_recs = Array.new\n missing_recs = Array.new\n fixture_ids = get_league_fixture_ids(league_id_str)\n $stdout.flush\n match_xml.xpath(\"//Match/FixtureMatch_Id\").map{ |node| node.text }.each do |match_id|\n next if match_id == \"0\"\n if fixture_ids.include? match_id\n update_recs << { match_id: match_id, report_id: match_id }\n else\n missing_recs << { match_id: match_id }\n end\n end\n puts missing_recs\n\n # JMC-UPDATE: Fixture-update rec for NoDB\n update_recs.each do |update_rec|\n write_nodb_record_json_file({\n rec_type: 'fixtures',\n rec_info: \"#{update_rec[:match_id]}-update-r1\",\n rec: update_rec,\n })\n end\n\n # JMC-UPDATE: Fixture-missing rec for NoDB\n missing_recs.each do |missing_rec|\n write_nodb_record_json_file({\n rec_type: 'fixtures',\n rec_info: \"#{missing_rec[:match_id]}-missing-r1\",\n rec: missing_rec,\n })\n end\n\n # JMC-UPDATE: Fixture-update record (with 'has-match-report' info)\n write_update_records_rake_file({\n rec_class: 'Fixture',\n rec_type: 'fixture',\n rec_key: 'match_id',\n desc: 'Update database with match report data',\n recs: update_recs,\n jmc: 'r1',\n ext: league_id_str,\n })\n\n # JMC-UPDATE-TBD: Fixture-update record\n filename = write_record_array_json_file({\n rec_type: 'fixtures',\n rec_info: \"#{league_id_str}-update-r1\",\n recs: update_recs,\n })\n @nodb_file_recs << { name: filename, path: 'soccer/nodb', timestamp: `date`.strip, }\n\nend",
"def gather_options\n @_options\n end",
"def collect\n @sample_counter ||= 0\n\n extra_remnant_key = Remnant::Discover.results.delete(:extra_remnant_key)\n\n # don't send timings in development or test environments\n unless ::Rails.env.development? || ::Rails.env.test?\n # only log if above sample rate\n if @sample_counter > configuration.sample_rate\n key_prefix = [\n Remnant.configuration.tag,\n Remnant.configuration.env,\n extra_remnant_key\n ].compact.join('.')\n\n Remnant::Discover.results.map do |remnant_key, ms|\n Remnant.handler.timing(\"#{key_prefix}.#{remnant_key}\", ms.to_i)\n end\n\n Remnant.handler.timing(\"#{key_prefix}.gc\", Remnant::GC.time.to_i)\n Remnant.handler.timing(\"#{key_prefix}.db\", Remnant::Database.total_time.to_i)\n Remnant.handler.timing(\"#{key_prefix}.filters\", Remnant::Filters.total_time.to_i)\n\n @sample_counter = 0\n else\n @sample_counter += 1\n end\n end\n\n # run hook if given for all environments\n unless Remnant.configuration.custom_hook.nil?\n begin\n Remnant.configuration.custom_hook.call(Remnant::Discover.results)\n rescue => e\n ::Rails.logger.error \"Failed to run hook: #{e.message}\"\n end\n end\n\n Remnant::Database.reset\n Remnant::Template.reset\n Remnant::Filters.reset\n Remnant::Discover.results.clear\n end",
"def apply_pooka_configure(data)\n @logger_path = data['logger_path']\n @logger_level = data['logger_level']\n @pid_path = data['pid_path'] || @pid_path\n @sleep_time = data['sleep_time'] || @sleep_time\n end",
"def prepare_research_outputs\n research_outputs.map do |research_output|\n presenter = ResearchOutputPresenter.new(research_output: research_output)\n size_hash = presenter.converted_file_size(size: research_output.byte_size)\n\n {\n title: research_output.title,\n description: research_output.description,\n type: presenter.display_type,\n anticipated_release_date: presenter.display_release,\n initial_access_level: presenter.display_access,\n intended_repositories: presenter.display_repository&.join(', '),\n anticipated_file_size: \"#{size_hash[:size]} #{size_hash[:unit]&.upcase}\",\n initial_license: presenter.display_license,\n metadata_standards: presenter.display_metadata_standard&.join(', '),\n may_contain_sensitive_data: presenter.display_boolean(value: research_output.sensitive_data),\n may_contain_pii: presenter.display_boolean(value: research_output.personal_data)\n }\n end\n end",
"def extract_times(sandbox_path, verbose=false)\n time = \"\"\n trig_times = {}\n Dir.glob(File.join(sandbox_path, \"**\", \"stdout_*\")) do |out_file|\n short_nm = /.*stdout_(.*)$/.match(out_file)[1]\n role = \"others\"\n File.new(out_file).each do |li|\n case li\n when /.*sw_rcv_token_trig.*/\n role = \"switches\"\n when /.*nd_from_sw.*/\n role = \"nodes\"\n when /^Total time in all triggers: (.*)/\n trig_tm = (($1.to_f) * 1000).to_i\n trig_times.has_key?(role) ? trig_times[role] << [short_nm, trig_tm] : \\\n trig_times[role] = [[short_nm, trig_tm]]\n role = \"others\"\n when /^Total time \\(ms\\): (.*)$/\n time = $1\n end\n end\n end\n s = \"\"\n s += \"Total time: #{time}\\n\"\n [\"nodes\", \"switches\"].each do |role|\n trig_times[role].sort!{|x,y| x[1] <=> y[1]}\n times = trig_times[role]\n num = times.length\n sum = times.inject(0){|acc,x| acc + x[1]}\n mean = sum.to_f / num\n median = num % 2 == 1 ? times[num/2][1] : (times[num/2 - 1][1] + times[num/2][1]) / 2.0\n min = times[0][1]\n max = times[-1][1]\n std_dev = Math.sqrt((times.inject(0){|acc,x| acc + (x[1] - mean)**2}) / num.to_f)\n s += \"#{role}: mean:#{mean.to_i}, median:#{median.to_i}, min:#{min}, max:#{max}, num:#{num}, std_dev:#{std_dev.to_i}\\n\"\n end\n puts s if verbose\n [time, trig_times, s]\nend",
"def prepare_data(opts)\n MultiJson.dump(opts)\n end",
"def extract(options = {})\n # Ensure that unspecified options have default values.\n file_path = options.has_key?(:file_path) ?\n options[:file_path].to_s :\n @zip_path\n restore_permissions = options.has_key?(:permissions) ?\n options[:permissions] :\n false\n restore_ownerships = options.has_key?(:ownerships) ?\n options[:ownerships] :\n false\n restore_times = options.has_key?(:times) ?\n options[:times] :\n false\n\n # Make the directory.\n FileUtils.mkdir_p(file_path)\n\n # Restore the metadata.\n ::File.chmod(mode, file_path) if restore_permissions\n ::File.chown(uid, gid, file_path) if restore_ownerships\n ::File.utime(atime, mtime, file_path) if restore_times\n\n nil\n end",
"def extract_options(text, options)\n if text.is_a? Hash\n # we need to dup the text object because we're deleting keys from this object which manipulates the object passed in here\n # if this object is reused after beeing injected into this component, the keys would be missing\n self.options = text.dup\n else\n self.text = text\n # we need to dup the options object because we're deleting keys from this object which manipulates the object passed in here\n # if this object is reused after beeing injected into this component, the keys would be missing\n self.options = options.dup || {}\n end\n self.options.symbolize_keys!\n end",
"def attributes(*args)\n hash = super\n if @instance_options[:detailed] == true\n hash[:checklists] = checklists\n hash[:current_timer] = current_timer\n end\n hash\n end",
"def extract_options(opts)\n lastmod = opts.delete(:lastmod)\n changefreq = opts.delete(:changefreq)\n priority = opts.delete(:priority)\n\n [lastmod, changefreq, priority]\n end",
"def process_options\n \n end",
"def make_option_list\n @data = H87Options.option_list\n end",
"def make_option_list\n @data = H87Options.option_list\n end",
"def extract_metadata!(data = {})\n data.tap do |d|\n file = File.open(@file)\n d[:filesize] = file.size\n file.close\n\n d[:content_type] = MIME::Types.type_for(@file).first.to_s\n end\n end",
"def extractable_options?; true end",
"def parse_options\n options = Trollop::options do\n version VERSION\n banner <<-EOS\nPostwhite is a policy server for Postfix MTA which filters incoming emails\nbased on per recipient whitelists managed by an email frontend.\n\nDocumentation:\n http://www.bitcetera.com/products/postwhite\n\nUsage:\n postwhite [options] {#{Postwhite::COMMANDS.join('|')}}\n\nOptions:\n EOS\n opt :'audit', \"Write audit information to log\", :default => false\n opt :'config-dir', \"Directory containing the configuration files\", :default => '/etc/postfix/postwhite'\n opt :'debug', \"Write debug information to log\", :default => false\n opt :'detach', \"Detach the daemon\", :default => false\n opt :'prefix', \"Use this prefix for all paths\", :default => '/'\n opt :'quiet', \"Don't output anything\", :default => false\n opt :'user', \"Run the server as this user\", :default => 'postwhite'\n stop_on Postwhite::COMMANDS\n end\n options[:command] = ARGV[0]\n options\n end",
"def parse_spec_file(task_spec)\n task_spec_metadata = {}\n\n begin\n text = task_spec.read\n text.split(\"\\n\").each do |line|\n line = line.downcase\n\n if line =~ /^\\s*#\\s*(?:yamls|hiera):\\s*(.*)/\n task_spec_metadata[:hiera] = [] unless task_spec_metadata[:hiera].is_a? Array\n task_spec_metadata[:hiera] += get_list_of_yamls $1\n end\n\n if line =~ /^\\s*#\\s*facts:\\s*(.*)/\n task_spec_metadata[:facts] = [] unless task_spec_metadata[:facts].is_a? Array\n task_spec_metadata[:facts] += get_list_of_yamls $1\n end\n\n if line =~ /^\\s*#\\s*(?:skip_yamls|skip_hiera):\\s(.*)/\n task_spec_metadata[:skip_hiera] = [] unless task_spec_metadata[:skip_hiera].is_a? Array\n task_spec_metadata[:skip_hiera] += get_list_of_yamls $1\n end\n\n if line =~ /^\\s*#\\s*skip_facts:\\s(.*)/\n task_spec_metadata[:skip_facts] = [] unless task_spec_metadata[:skip_facts].is_a? Array\n task_spec_metadata[:skip_facts] += get_list_of_yamls $1\n end\n\n if line =~ /^\\s*#\\s*disable_spec/\n task_spec_metadata[:disable] = true\n end\n\n if line =~ /^\\s*#\\s*role:\\s*(.*)/\n task_spec_metadata[:roles] = [] unless task_spec_metadata[:roles].is_a? Array\n roles = line.split /\\s*,\\s*|\\s+/\n task_spec_metadata[:roles] += roles\n end\n\n if line =~ /^\\s*#\\s*run:\\s*(.*)/\n run_record = get_list_of_yamls $1\n if run_record.length >= 2\n run_record = {\n :hiera => run_record[0],\n :facts => run_record[1],\n }\n task_spec_metadata[:runs] = [] unless task_spec_metadata[:runs].is_a? Array\n task_spec_metadata[:runs] << run_record\n end\n end\n end\n rescue\n return task_spec_metadata\n end\n task_spec_metadata\n end",
"def execute(data)\n case data\n when Array then data.map{ |d| option[d] }\n when Hash then Hash[data.map{ |k,v| [k, option[v]] }]\n else option[data] || data\n end\n end",
"def build_payload(options)\n body = options[:body]\n mime = options[:mime]\n if mime\n # user set mime-type, let them deal with it :)\n # fix for ruby 1.8\n if body.is_a? File\n size = body.path.size\n else\n size = body.size\n end\n elsif body.is_a? Hash\n body = Yajl.dump body\n mime = \"application/json\"\n elsif SERIALIZEABLE_TYPES.include? body.class\n if ITERABLE_TYPES.include? body.class\n if is_set_of_strings? body\n # set of strings is primitive\n mime = \"application/vnd.fluiddb.value+json\"\n else\n # we have an Array with some non-String items\n mime = \"application/json\"\n end\n else\n # primitive type\n mime = \"application/vnd.fluiddb.value+json\"\n end\n body = Yajl.dump body\n else\n raise TypeError, \"You must supply the mime-type\"\n end\n [body, mime]\n end",
"def raw_data(options, context)\n # nil key is used to indicate that the cache contains the raw content of\n # the eyaml file\n raw_data = context.cached_value(nil)\n if raw_data.nil?\n if options.include?('path')\n raw_data = load_data_hash(options['path'], context)\n context.cache(nil, raw_data)\n else\n raise ArgumentError,\n \"'ldap_lookup_key': one of 'path', 'paths' 'glob', 'globs' or 'mapped_paths' must be declared in hiera.yaml when using this lookup_key function\"\n end\n end\n raw_data\n end",
"def initialize(data)\n @theme = data.dig(:theme)\n @name = data.dig(:subtheme)\n @set_count = data.dig(:set_count).to_i\n @year_from = data.dig(:year_from).to_i\n @year_to = data.dig(:year_to).to_i\n end",
"def time_entries(options = {})\n entries = []\n time_invested(options).groups.each { |g| entries << g[\"time_entries\"] }\n\n process_list_response( entries.flatten , Unfuddled::TimeEntry )\n end",
"def format_as_yaml\n\t\tobjects = {}\n\t\tself.instance_variables.each do |k|\n\t\t\tobjects[k.to_s.gsub('@','')] = instance_eval(k.to_s)\n\t\tend\n\t\tobjects.delete(\"filename\")\n\t\tobjects.delete(\"previous_file\")\n\t\treturn objects\n\tend",
"def serialize\n data = manifest.dup\n data[:run_data] = {\n timestamp: Time.now.to_s\n }\n Yajl::Encoder.encode(data, nil, pretty: true)\n end",
"def process_arguments\n @e_addr = @options.email\n @r_name = @options.run_names\n @m_name = @options.machine_names\n @action = @options.action\n @snfs = @options.snfs\n end",
"def collect_joblist(data_path,script_path)\n \n # define list of ignored files/dirs\n to_ignore = ['.','..','.DS_Store']\n \n res = []\n \n # open dir\n directory=Dir.open(data_path)\n \n # for each file in dir\n directory.each do |d|\n \n # add if not in ignore list\n if to_ignore.index(d) == nil\n \n # get standard attributes if file exists\n std_attr = {}\n if File.exists?(File.join(data_path,d,STANDARD_ATTR_JSON))\n std_file=get_json_data(File.join(data_path,d,STANDARD_ATTR_JSON))\n \n if !std_file.nil?\n\t std_attr=std_file\n end\n \n #puts \"STDATTR:\"+std_attr.to_yaml\n end\n\t\n \n # id is always current directory\n std_attr['job_id']=d\n \n # there is a script for job info\n if File.exists?(script_path)\n#puts \"populate joblist data\"\n\n # populate data with it\n command = script_path + ' ' + File.join(data_path,d)\n job_text=`#{command}`\n\n if job_text!=''\n\n obj = ActiveSupport::JSON.decode(job_text)\n \n if !obj.empty?\n if !std_attr.empty?\n obj=obj.merge(std_attr)\n end\n # add object\n res.push(obj)\n end\n end\n\n else\n # if there is not a script, then push std_attr\n\n res.push(std_attr)\n end\n \n end\n end\n\n\n\n # close dir\n directory.close\n \n # puts \"joblist:\"+res.to_yaml\n \n return res\n end",
"def get_data filename=nil\n unless filename\n filename = $filename\n else\n $filename = filename\n end\n raise \"File name not found #{filename} in get_data \" if !File.exists?(filename)\n #lines = File.open(filename, \"r\").read.split(\"\\n\")\n #if lines.nil? or lines.empty?\n #perror \"Failed trying to read #{filename}. Please delete if empty \"\n #lines = [\"no data\", \"no data, please refresh\"]\n #end\n obj = YAML::load( File.open( filename ) )\n $yaml_obj = obj\n age = compute_file_age filename\n articles = obj[:articles]\n if articles.empty?\n # this happens when doing More with a stale url\n perror \"No articles in this file. Please delete file.\"\n return\n end\n colh = articles.first.keys\n colh = [:title\t,:age_text\t,:comment_count\t,:points\t,:article_url\t,:comments_url\t,:age\t,:submitter\t,:submitter_url\t,:byline]\n $forum_bgcolor = BOLD\n $forum_bgcolor = ON_RED if age > 8\n # this should only happen if columns are in row 0\n # # FIXME\n $column_headings = colh\n $full_data = Array.new\n # there will be a path also at some time\n #$subforum = filename.sub(File.extname(filename),\"\").sub(\"__\",\"/\")\n $subforum = file_to_forum(filename)\n $host = forum_to_host $subforum\n titles = Array.new\n articles.each do |a|\n titles << a[:title]\n _cols = []\n $column_headings.each do |c|\n _cols << a[c] \n end\n $full_data << _cols\n end\n perror \"No data for #{filename} \" if $full_data.empty?\n raise \"No data for #{filename} \" if $full_data.empty?\n #lines.each_with_index do |l, ix|\n #_cols = l.split(\"\\t\")\n #titles << _cols.first\n #$full_data << _cols\n #end\n calc_column_widths\n size_column_headings\n $files = titles\nend"
] |
[
"0.56721485",
"0.54680556",
"0.5306932",
"0.52274156",
"0.5174881",
"0.50718737",
"0.50599873",
"0.5008166",
"0.498401",
"0.49657175",
"0.49473906",
"0.49280497",
"0.4847236",
"0.48399734",
"0.48190933",
"0.48167735",
"0.48081338",
"0.47979417",
"0.47940463",
"0.47749463",
"0.47253096",
"0.47225133",
"0.47138706",
"0.47016788",
"0.46947017",
"0.46880135",
"0.46879184",
"0.46800253",
"0.46772578",
"0.46723604",
"0.46704584",
"0.46681726",
"0.46568933",
"0.46434087",
"0.4637423",
"0.46018246",
"0.45908567",
"0.45762333",
"0.45676264",
"0.45676014",
"0.4562137",
"0.45611128",
"0.45571762",
"0.4551374",
"0.4550529",
"0.4535491",
"0.4524676",
"0.45243117",
"0.45116526",
"0.45073673",
"0.45058015",
"0.45016694",
"0.4501454",
"0.44874728",
"0.44869405",
"0.44847572",
"0.44801843",
"0.44714782",
"0.44680965",
"0.446608",
"0.4463195",
"0.44548732",
"0.44548732",
"0.44548732",
"0.44528544",
"0.44491827",
"0.44471985",
"0.4442274",
"0.4440087",
"0.44392818",
"0.44374016",
"0.44293606",
"0.44287387",
"0.44283283",
"0.44242978",
"0.44230065",
"0.44190404",
"0.4408117",
"0.44080228",
"0.44016814",
"0.43977988",
"0.43943793",
"0.43943724",
"0.43901843",
"0.43875396",
"0.43875396",
"0.43860024",
"0.43857324",
"0.4381351",
"0.43711865",
"0.4363932",
"0.43629646",
"0.43612948",
"0.43593985",
"0.43574232",
"0.43569234",
"0.435636",
"0.43535396",
"0.43524426",
"0.4352037"
] |
0.70760983
|
0
|
Captures proess data and converts it to a YML string. This method also handles the actual writing of data to the file system. The options 'store_hook' toggles exract or process targeting. options [Hash]:: A hash that is passed to this extension by the main LEWT program containing rutime options. data [Array]:: The processed data as an array of hashes.
|
def render( options, data )
@processData = data.to_yaml
name = options[:store_filename]
yml = options[:store_hook] == "extract" ? @extractData : @processData
name != nil ? store(yml, name ) : [yml]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def save_polls_data(data)\n save_data('polls.yaml', data)\nend",
"def save_data(data,filename=nil)\n filename=data_file(filename)\n case File.extname(filename).downcase\n when \".yaml\",\".yml\"\n open(filename,\"w\"){|f| f.puts YAML.dump(data)}\n when \".json\"\n open(filename,\"w\"){|f| f.puts JSON.generate(data)}\n else\n open(filename,\"w\"){|f| f.puts data }\n end\n end",
"def store\n File.open(@file_name, 'w') do |file|\n file.write YAML::dump(@data)\n end\n end",
"def process( options, data )\n @extractData = data.to_yaml\n return []\n end",
"def save_data\n puts \"saving data\"\n\n File.open(generate_filename(self), \"w\") do |f|\n f.write(ostruct_to_hash(self.json).to_yaml)\n end\n end",
"def save_data\n begin\n File.open(@file, 'w') do |out|\n YAML.dump(@data, out)\n end\n rescue => e\n Lorj.error(format(\"%s\\n%s\", e.message, e.backtrace.join(\"\\n\")))\n return false\n end\n true\n end",
"def save\n File.open(file_path, 'w') do |file|\n YAML.dump(data, file)\n end\n end",
"def save\n File.open(path, 'w') do |out|\n YAML.dump(data, out)\n end\n end",
"def persistData!\n File.open(getWorkingDir+'/data.host', 'w') do |f|\n f.write(@plataforms.to_yaml)\n end\n end",
"def apply_pooka_configure(data)\n @logger_path = data['logger_path']\n @logger_level = data['logger_level']\n @pid_path = data['pid_path'] || @pid_path\n @sleep_time = data['sleep_time'] || @sleep_time\n end",
"def save\n \tdata = self\n \t\n \tFile.open('store.yml','w') do |f|\n \t\tf.write(data.to_yaml)\n \tend\n \tputs data\n \tputs \"Saved!\"\n \tputs \"\"\n end",
"def meta_data=( data )\n return if data.nil? and @meta_end.nil?\n\n seek 0\n lines = readlines\n\n truncate 0\n unless data.nil?\n write YAML.dump(data)\n write \"--- #$/\"\n end\n lines.each {|line| write line}\n ensure\n @meta_end = end_of_meta_data\n seek 0, IO::SEEK_END\n end",
"def write data\n case data\n when Hash then data = [data]\n else \n return { :result => false, :data => \"Input data type #{data.class} is not supproted.\" }\n end\n\n result, output = true, []\n\n data.each do |params|\n \n messages = []\n\n if params.has_key? :action\n messages << \"ArgumentError: Action name #{params[:action]} is not implemented\" unless ACTIONS.keys.include? params[:action]\n else\n messages << \"ArgumentError: Action name must be provided\"\n end\n \n # It makes sense to continue only if checks above did not fail\n if messages.empty?\n #\n # Clear all attributes first - so no old data left\n #\n ACTIONS.values.flatten.uniq.each do |att|\n self.instance_variable_set \"@#{att}\", nil\n end\n #\n # And set it to param's value\n #\n params.each { |k,v| self.instance_variable_set \"@#{k}\", v }\n #\n # Check that all variable that are used in the template are\n # actually set, not nil's\n #\n ACTIONS[@action].each do |var|\n messages << \"ArgumentError, Parameter :#{var} is required, cannot be nil\" if self.instance_variable_get(\"@#{var}\").nil?\n end\n \n # Try to write to file only if none of the above failed\n if messages.empty?\n self.ts = params[:ts] || Time.now.to_i.to_s\n \n format = \"[#{ts}] \" << ([self.action.to_s] + ACTIONS[self.action].map {|x| \"<%= #{x} %>\" }).join(';')\n \n begin\n File.open(path, 'a') do |pipe|\n pipe.puts ERB.new(format).result(self.get_binding)\n pipe.close\n end\n rescue e\n messages << e.message\n end\n end\n end\n \n output << { :data => params, :result => messages.empty? , :messages => messages }\n result &&= messages.empty?\n end # data.each\n\n { :result => result, :data => output }\n end",
"def save_user_data(data)\n save_data('users.yaml', data)\nend",
"def write_yaml_data_file filename, data\n File.open(filename, 'w') { |f| f << YAML.dump(data) }\nend",
"def write_yaml_data_file filename, data\n File.open(filename, 'w') { |f| f << YAML.dump(data) }\nend",
"def save\n puts \"Rewriting ogg tags of #{File.basename(@file)}\"\n \n options = [\n '-w',\n \"-t artist=#{@data['artist'].shellescape}\",\n \"-t year=#{@data['year'].shellescape}\",\n \"-t album=#{@data['album'].shellescape}\",\n \"-t tracknumber=#{@data['index'].shellescape}\",\n \"-t title=#{@data['title'].shellescape}\",\n ]\n options << \"-t discnumber=#{@data['cd']}\" if @data['cd'] != ''\n # Adding genre if predefined one\n options << \"-t genre=Podcast\" if @data['type'] == \"podcasts\"\n options << \"-t genre=Soundtrack\" if @data['type'] == \"soundtracks\"\n\n %x[vorbiscomment #{options.join(' ')} #{@file.shellescape}]\n\n end",
"def cmd_notify_save\n\t\t\t\tprint_status(\"Saving options to config file\")\n\t\t\t\tif @user_name and @webhook_url and $source\n\t\t\t\t\tconfig = {'user_name' => @user_name, 'webhook_url' => @webhook_url, 'source' => $source}\n\t\t\t\t\tFile.open(Notify_yaml, 'w') do |out|\n\t\t\t\t\t\tYAML.dump(config, out)\n\t\t\t\t\tend\n\t\t\t\t\tprint_good(\"All settings saved to #{Notify_yaml}\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You have not provided all the parameters!\")\n\t\t\t\tend\n\t\t\tend",
"def save_data(file, data)\n if ENV['RACK_ENV'] == 'test'\n local = File.expand_path(\"../test/data/#{file}\", __FILE__)\n File.open(local, 'w') { |open_file| open_file.write(YAML.dump(data)) }\n else\n local = File.expand_path(\"../data/#{file}\", __FILE__)\n File.open(local, 'w') { |open_file| open_file.write(YAML.dump(data)) }\n\n if USE_GOOGLE_DRIVE\n remote = google_session.file_by_title(file.to_s)\n remote.update_from_file(local)\n end\n end\nend",
"def save_app_data(name, meths_hash, prog_log, file_hashes)\n Dir.chdir(DATA_DIR)\n if !File.directory? name\n Dir.mkdir name\n Dir.chdir(name)\n YARD::Registry.save\n File.open(name + \"-\" + TYPE_DATA_JSON_FILE,\"w\") do |f|\n f.write(JSON.pretty_generate(meths_hash))\n end\n File.open(name + \"-\" + FILE_MD5_HASHES, \"w\") do |f|\n f.write(JSON.pretty_generate(file_hashes))\n end\n CSV.open(LOG_FILE, \"wb\") { |csv|\n csv << LOG_HEADER\n csv << prog_log\n } \n Dir.chdir(\"../..\")\n else\n Dir.chdir(\"..\")\n end\nend",
"def writeData\n # Make the directory to store the RoadWaer data.\n File.makedirs(File.dirname($datafilename))\n $debugdata = $debugdata + \"makedir\\n\"\n\n # Open the file to append the registration data.\n file = File.open($datafilename, \"a\")\n $debugdata = $debugdata + \"open\\n\"\n # Write user data.\n file.puts($events.read.print)\n $debugdata = $debugdata + \"puts\\n\"\n # Make sure the output file is always closed.\n file.close\n $debugdata = $debugdata + \"close\\n\"\n\n $debugdata = $debugdata + value.local_path + \"\\n\"\n $debugdata = $debugdata + value.original_filename + \"\\n\"\n $debugdata = $debugdata + value.content_type + \"\\n\"\n true\n\n rescue\n false\nend",
"def write data, path\n\t\t\tcontent = \"\"\n\t\t\tfile_type = data.class.to_s\n\n\t\t\tif file_type == 'Array'\n\t\t\t\tdata.each do | line |\n\t\t\t\t\tline.each do | key, val |\n\t\t\t\t\t\tcontent << \"#{key.to_s}=#{val}\\n\"\n\t\t\t\t\tend\n\t\t\t\t\tcontent << \"\\n\"\n\t\t\t\tend\n\n\t\t\telsif file_type == 'Hash'\n\t\t\t\tdata.each do | key, val |\n\t\t\t\t\tcontent << \"#{key.to_s}=#{val}\\n\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tpath = File.expand_path path\n\t\t\tFile.open(path, 'w+') do |f|\n\t\t\t\tf.write content\n\t\t\tend\n\t\tend",
"def write_to_yaml(data,yaml_file) \n File.open(yaml_file,'w') { |yf| YAML.dump(data,yf) }\nend",
"def atomic_write(data, path, name, options = {})\n main_file = File.join(path, name) + '.yml'\n dup_file = File.join(path, name) + '.yml2'\n \n # append verification info at the end of the file to guard from incomplete writes\n ts = Time.now\n ts_checksum = Digest::MD5.hexdigest(\"#{ts.tv_sec}.#{ts.tv_usec}\")\n if options[:owner]\n # secure the file\n File.open(dup_file, 'w').close\n uid = uid_for_username options[:owner]\n gid = gid_for_username options[:owner]\n File.chown uid, gid, dup_file\n File.chmod options[:permissions] || 0660, dup_file\n end\n File.open(dup_file, 'w') { |f| YAML::dump [data, ts.tv_sec, ts.tv_usec, ts_checksum], f }\n \n # move the file atomically to the main copy\n FileUtils.mv(dup_file, main_file)\n end",
"def store(data = nil)\n\tf = db_name\n\ty = YAML::Store.new(f)\n\ty.transaction{\n\t\tif data\n\t\t\ty[\"data\"] = data\n\t\telse\n\t\t\treturn y[\"data\"]\n\t\tend\n\t}\nend",
"def set_payload(data)\n @payload = { \n 'caption' => data['caption']['text'], \n 'photo_url' => data['images']['standard_resolution']['url'],\n 'title' => \"#{data['user']['username']}_#{data['created_time']}\"\n }\n @log.debug(\"Payload is #{@payload}\")\n end",
"def user_data(instance)\n hostname = instance[\"hostname\"]\n # write specific per instance cloud-init config and script files out of erb templates.\n %w(config script).each do |ud|\n e = ERB.new(File.read(File.join('templates', ud + \".erb\")))\n outfile = File.join(@dataDir, hostname + \"-\" + ud)\n File.open(outfile, 'w') {|f| f.write e.result(binding)}\n end\n\n # files = Hash[*%w{mimeOut script config}.collect {|n| [n, File.join(@dataDir, hostname + \"-\" + n]}.flatten]\n # files = %w{mimeOut script config}.inject({}) { |f,n| f[n] = File.join(@dataDir, hostname + \"-\" + n); f}\n mimeOut = File.join(@dataDir, hostname + \"-ud\")\n script = File.join(@dataDir, hostname + \"-script\")\n config = File.join(@dataDir, hostname + \"-config\")\n system(\"./write-mime-multipart --output=#{mimeOut} #{script}:text/x-shellscript #{config}\")\n @logger.info(\"Generated multipart for #{hostname}\")\n return File.read(mimeOut)\nend",
"def save_file(data, fspec = @config_json_spec)\n does_fileexist = File.exists?(fspec)\n File.open(fspec, \"w\") do |file|\n Puppet.debug \"saving file #{fspec}\"\n file.puts JSON.pretty_generate(data)\n # we want to set the initial permissions only if we're creating the file\n file.chmod(0664) unless does_fileexist\n end\n FileUtils.chown @config_json_owner, @config_json_group, fspec unless does_fileexist\n end",
"def output_cc_user_data(options,user_data,exec_data,output_file)\n if !options['vm'].to_s.match(/mp|multipass/)\n in_target = \"curtin in-target --target=/target -- \"\n else\n in_target = \"\"\n end\n check_dir = File.dirname(output_file)\n check_dir_exists(options,check_dir)\n tmp_file = \"/tmp/user_data_\"+options['name']\n file = File.open(tmp_file, 'w')\n end_char = \"\\n\"\n user_data.each do |line|\n output = line+end_char\n file.write(output)\n end\n pkg_list = options['q_struct']['additional_packages'].value\n if options['vm'].to_s.match(/mp|multipass/)\n file.write(\"packages:\\n\")\n pkg_list.split(\" \").each do |line|\n output = \" - \"+line+\"\\n\"\n file.write(output)\n end\n file.write(\"runcmd:\\n\")\n exec_data.each do |line|\n output = \" - \"+line+\"\\n\"\n file.write(output)\n end\n else\n end_char = \"\"\n file.write(\" late-commands:\\n\")\n file.write(\" [\")\n exec_data.each do |line|\n output = \" \\\"\"+line+\"\\\",\"+end_char\n file.write(output)\n end\n file.write(\" \\\"#{in_target}apt update\\\",\")\n output = \" \\\"#{in_target}apt install -y \"+pkg_list+\"\\\",\"+end_char\n file.write(output)\n file.write(\" \\\"date\\\" ]\\n\\n\")\n end\n file.close\n message = \"Creating:\\tCloud user-data file \"+output_file\n command = \"cat #{tmp_file} >> #{output_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n print_contents_of_file(options,\"\",output_file)\n return\nend",
"def parse_tire_option_values\n start_time = Time.now\n model_counter = 0\n variant_counter = 0\n option_list = {}\n valid_options = %w{load_range load_factor load_index sidewall utqg speed_rating size}\n mfg_list = get_manufacturer_list\n mfg_list.each do |mfg|\n puts \"Creating option values from product data for #{mfg}, adding them to application.yml\\n\"\n file = open_file_read('tires', mfg)\n data = YAML.load(file) \n data.each_key do |model| \n # a new model would be a type of wheel for a manufacturer\n model_counter +=1\n # each model points to an array of variants, each differing in some way\n data[model].each_pair do |key, value|\n if key == :variants\n value.each do |v|\n variant_counter += 1\n v.each_key do |k|\n if valid_options.include?(k.to_s)\n option_list[v[k]] = [] unless option_list.has_key?(v[k])\n new_option_value = {\n \"option_type\" => k.to_s.dasherize,\n \"name\" => v[k].to_s,\n \"presentation\" => v[k].to_s\n }\n option_list[v[k]] << new_option_value unless option_list[v[k]].include?(new_option_value)\n end\n end\n end\n end\n end\n end\n end\n puts \"Writing the options to option_values file now, for #{model_counter} models and #{variant_counter} variants...\\n\"\n @@config[:option_variants].merge!(option_list)\n f = File.open(APP_DATA,'w')\n YAML.dump(@@config, f)\n f.close \n puts \"Task took #{Time.now - start_time}\\n\" \n end",
"def save_data(data)\n raw = JSON.dump(data)\n File.open(FILENAME, 'w') do |file|\n file.write(raw)\n end\nend",
"def appender_proc(data)\n proc { |obj| obj.tap { |env| env[:data] << data } }\n end",
"def write data # data == logevent\n msg = nil\n h = @hash_data.dup\n h.update(@formatter.hash_data) if @formatter.respond_to?(:hash_data)\n h[:log4r_level] = data.level\n case msg = data.data\n when ::String\n when ::Hash\n h.update(msg)\n msg = hash[:msg] || UNKNOWN_MSG\n when ::Exception\n msg = data.message\n else\n msg = msg.inspect\n end\n TAM::Record::Generic.new(msg, h).log!\n end",
"def output(data, classname)\n sanitized = File.join(@output, classname.gsub('::', '/')).downcase\n path = Pathname(sanitized).dirname\n FileUtils.mkdir_p path.to_s unless path.exist?\n\n File.open(\"#{sanitized}.json\", \"w\") do |f|\n f.write(JSON.pretty_generate(data))\n end\n end",
"def save( )\n\t\t\tdestDir = nil\t\t\n\t\t\tadd = false\n\t\t\tif not @filename\n\t\t\t\tcreated = Digest::MD5::hexdigest(\"#{@data.created}-#{@data.name}\")\n\t\t\t\tcreated = created[ 0, 8 ]\n\t\t\t\tname = @data.name.gsub( /[\\/\\\\\\ :\\?]/, '_')\n\t\t\t\tDir.mkdir( @options.tickets_directory ) if not File.directory?( @options.tickets_directory )\n\t\t\t\tdestDir = File.join( @options.tickets_directory, \"#{created}-#{name}.ticket\")\n\t\t\t\tif not File.directory?( destDir )\n\t\t\t\t\tDir.mkdir( destDir )\n\t\t\t\t\tadd = true\n\t\t\t\tend\n\t\t\t\t@data.updated=DateTime.now()\n\t\t\t\t@idstring = File.basename( destDir )[0..7]\n\t\t\t\t@filename = File.join( destDir, \"ticket.yaml\")\n\t\t\tend\n\t\n\t\t\t\n\t\t\tFile.open( @filename, File::WRONLY|File::TRUNC|File::CREAT) do |f|\n\t\t\t\tf.write YAML.unescape( YAML.dump( @data ) )\n\t\t\tend\n\t\n\t\t\tloadComments if @comments.length == 0\n\t\t\tcommentsFile = File.join( File.dirname(@filename) , \"comments.yaml\" ) \n\t\t\tFile.open( commentsFile, File::WRONLY|File::TRUNC|File::CREAT) do |f|\n\t\t\t\tf.write YAML.unescape( YAML.dump( @comments ) )\n\t\t\tend\n\t\t\t\n\t\t\tloadAttachments if @attachments.length == 0\n\t\t\tattachmentsFile = File.join( File.dirname(@filename) , \"attachments.yaml\" ) \n\t\t\tFile.open( attachmentsFile, File::WRONLY|File::TRUNC|File::CREAT) do |f|\n\t\t\t\tf.write YAML.unescape( YAML.dump( @attachments ) )\n\t\t\tend\n\t\t\t\n\t\t\tif add\n\t\t\t\tcmd = @options.after_add_ticket\n\t\t\t\tif cmd and not cmd.empty?\n\t\t\t\t\tsystem( \"#{cmd} \\\"#{destDir}\\\"\" )\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs \"Ticket #{@idstring} saved.\"\n\t\tend",
"def process_data(data)\n print_headline\n tmp = data.dup\n\n # TELNETコマンドを抽出しダンプする.\n tmp.gsub!(/#{IAC}(\n [#{DONT}#{DO}#{WONT}#{WILL}].|\n #{SB}.(#{IAC}#{IAC}|[^#{IAC}])*#{IAC}#{SE}|\n [#{NOP}-#{GA}#{0.chr}-#{239.chr}]\n )/xon){\n case $1[0].chr\n when DONT; print \"> IAC DONT #{$1[1]}\\n\"\n when DO ; print \"> IAC DO #{$1[1]}\\n\"\n when WONT; print \"> IAC WONT #{$1[1]}\\n\"\n when WILL; print \"> IAC WILL #{$1[1]}\\n\"\n when SB ; print \"> IAC SB #{$1[1]} #{$1[2..-3].dump} IAC SE\\n\"\n else ; print \"> IAC #{$1[1]}\\n\"\n end\n }\n\n # 残りの部分を出力.\n tmp.each { |line| print line.dump, \"\\n\" } if tmp.size > 0\n end",
"def parse_options(args)\n program = Pathname.new(__FILE__).realpath\n header = <<-END_HEADER\n# Running #{program} on #{Time.now}\n# Command-line arguments are: #{args}\n# Command-line to reproduce: #{program} #{args.join(\" \")}\n#\nEND_HEADER\n timestamp = Time.now.strftime(\"%Y%m%d%H%M%S\")\n current_dir = Pathname.pwd\n output_basename = current_dir + \"log\"\n output_basename.mkdir unless output_basename.directory?\n options = OpenStruct.new\n options.log_level = :off\n options.log_destination = STDOUT\n options.db_url = { :adapter => :in_memory }\n options.generate = nil\n options.time = 60\n options.profile_strings = false\n options.output_filename = \"dm-tpcc-#{timestamp}.out\"\n options.data_directory = current_dir + \"data\"\n options.load = false\n options.save_data = false\n\n opts = OptionParser.new do |opts|\n opts.banner = \"Usage: dm-tpcc [options]\"\n opts.separator \"\"\n\n opts.on(\"-g NUM_WAREHOUSES\", \"--generate NUM_WAREHOUSES\", Integer,\n \"Generate data for the number of warehouses.\") do |g| \n options.generate = g \n end\n\n opts.on(\"-s DIRECTORY_NAME\", \"--save DIRECTORY_NAME\",\n \"Save generated data for later use.\") do |s| \n options.data_directory = s unless (s.nil? || s.empty?)\n end\n\n opts.on(\"-S\", \"--save-data\", \"Save generated data for later use.\") do |s| \n options.save_data = s\n end\n\n opts.on(\"-D\", \"--load-data\", \"Load data from saved datasets.\") do |l|\n options.load = l\n end\n\n opts.on(\"--profile-string-algorithms\",\n \"Profile different string generators\") do |sg| \n options.profile_strings = sg \n end\n\n opts.on(\"-d DB_URL\", \"--db-url DB_URL\", String,\n \"Specify a DataMapper DB URL\") do |dburl| \n options.db_url = dburl \n end\n\n opts.on(\"-l LOG_LEVEL\", \"--log-level LOG_LEVEL\", LOG_LEVELS,\n \"Specify a log level.\") do |l| \n options.log_level = l.to_sym \n end\n\n opts.on(\"-L LOG_FILE\", \"--log-file LOG_FILE\", String,\n \"Specify a log file.\") do |f| \n options.log_destination = File.new(f, \"a+\") \n end\n\n opts.on(\"-o FILENAME\", \"--output FILENAME\", String,\n \"Filename to save output to.\") do |outputfile| \n options.output_filename = outputfile\n end\n\n opts.on(\"-t DURATION\", \"--time DURATION\", Integer,\n \"Duration of the test in seconds.\") do |time| \n options.time = time \n end\n\n opts.on(\"--once\", \"Run just one time\") do |once| \n options.once = once \n end\n\n opts.separator \"Common Options:\"\n opts.on_tail(\"-h\", \"--help\", \"Show this message.\") do\n puts opts\n\n print \"\\nLog Levels:\\n\"\n LOG_LEVELS.keys.each { |l| print \"\\t#{l}\\n\" }\n print \"\\nExample Database URLS:\\n\"\n $example_dbs.each { |db| print \"\\t#{db}\\n\" }\n exit\n end\n opts.on_tail(\"--version\", \"Show version\") do\n puts DataMapper::TPCC::VERSION\n exit\n end\n end\n\n opts.parse!(args)\n \n # Process options into global variables (ick)\n $output = File.open(output_basename + options.output_filename, \"w+\")\n $output.print header\n $data_directory = options.data_directory\n $data_directory.mkdir unless $data_directory.directory?\n\n options\nend",
"def write_data\n data = {}\n tmp_file = \"#{@wallet_file}.tmp\"\n\n @data.each do |item|\n next if item.empty?\n\n data.merge!(\n item.id => {\n 'id' => item.id,\n 'group' => item.group,\n 'user' => item.user,\n 'url' => item.url,\n 'comment' => item.comment,\n 'last_edit' => item.last_edit,\n 'created' => item.created\n }\n )\n end\n\n Gem::Package::TarWriter.new(File.open(tmp_file, 'w+')) do |tar|\n data_encrypt = encrypt(data.to_yaml)\n tar.add_file_simple('wallet/meta.gpg', 0400, data_encrypt.length) do |io|\n io.write(data_encrypt)\n end\n\n @passwords.each do |id, password|\n tar.add_file_simple(\"wallet/passwords/#{id}.gpg\", 0400, password.length) do |io|\n io.write(password)\n end\n end\n\n @otp_keys.each do |id, key|\n tar.add_file_simple(\"wallet/otp_keys/#{id}.gpg\", 0400, key.length) do |io|\n io.write(key)\n end\n end\n\n @keys.each do |id, key|\n tar.add_file_simple(\"wallet/keys/#{id}.pub\", 0400, key.length) do |io|\n io.write(key)\n end\n end\n end\n\n File.rename(tmp_file, @wallet_file)\n rescue => e\n File.unlink(tmp_file) if File.exist?(tmp_file)\n\n raise \"#{I18n.t('error.mpw_file.write_data')}\\n#{e}\"\n end",
"def wrap_data(data)\n @wrapper_template.merge(upstream_data: Marshal.load(Marshal.dump(data)),\n last_update_ts: Time.now.utc.to_i)\n end",
"def cmd_notify_save\n\t\t\t\tprint_status(\"Saving paramters to config file\")\n\t\t\t\tif @user_name and @webhook_url\n\t\t\t\t\tconfig = {'user_name' => @user_name, 'webhook_url' => @webhook_url}\n\t\t\t\t\tFile.open(Notify_yaml, 'w') do |out|\n\t\t\t\t\t\tYAML.dump(config, out)\n\t\t\t\t\tend\n\t\t\t\t\tprint_good(\"All parameters saved to #{Notify_yaml}\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You have not provided all the parameters!\")\n\t\t\t\tend\n\t\t\tend",
"def save(data: content, name: subject + '.html')\n filename = 'tmp/' + name\n\n File.open(filename, 'w+') do |f|\n f.write(data)\n end\n end",
"def data=(new_data)\n new_data = new_data.to_yaml\n new_data = @encrypter.encrypt(new_data) if encrypt?\n File.write(@path, new_data)\n end",
"def initialize app_data\n\n @options = OpenStruct.new\n @app_data = app_data\n @logger = ARINcli::Logger.new\n\n config_file_name = Config.formulate_config_file_name( @app_data )\n if File.exist?( config_file_name )\n @config = YAML.load( File.open( config_file_name ) )\n else\n @config = YAML.load( @@yaml_config )\n end\n\n configure_logger()\n end",
"def save(data=cached_data)\n lock do\n File.safe_write(path, JSON.pretty_generate(data))\n end\n end",
"def dump_data(to)\n data.keys.each do |key|\n FileUtils.mkdir_p(to + File.dirname(key))\n File.open(to + key, \"wb\") do |out|\n case data[key]\n when StringIO\n out.write data[key].read # .mbackup file data\n when Hash\n out.write Plist::Emit.dump(data[key]) # Info.plist, etc.\n else\n puts \"couldn't write out #{key}, don't know how to handle a #{data[key].class}\"\n end\n end\n end\n end",
"def run( data = {} )\n run_with_data( collect_data( data ) )\n end",
"def save(directory, data, type = 'xml')\n return if directory == nil || data == nil\n \n begin\n # verify target directory\n Dir.chdir(path)\n Dir.mkdir(directory) unless File.directory?(directory)\n \n repo = File.join(path, directory)\n child = day_to_directory\n \n # verify actual target directory (day)\n Dir.chdir(repo)\n Dir.mkdir(child) unless File.directory?(child)\n repo = File.join(repo, child)\n \n # create absolute filename.\n filename = unixtime + SEPARATOR + directory + EXTENSION + type\n target = File.join(repo, filename)\n \n # create the file\n open(target, 'w') { |file| file << data }\n \n rescue Exception => error\n puts \"error: #{error.message}\" \n end\n end",
"def save\n return if @filename.nil?\n FileUtils.mkdir_p File.dirname(@filename)\n Utils.atomic_write(@filename) { |f| f.write(JSON.generate(@data)) }\n end",
"def _save_worker(id, worker, args)\n File.open(File.join(TEMP_W_DIR, \"#{id}.yml\"), 'w') do |f|\n f.write(YAML.dump({ worker => args }))\n end\n end",
"def data_file\n @data_file ||= FileData.new(\"data.yml\")\n end",
"def store ( yml, name )\n storefile = File.new( name, \"w\")\n storefile.puts(yml)\n storefile.close\n return [yml]\n end",
"def store_text(key, process, options)\n match_regex?(key, datas[key], options[:regex]) if(options.has_key?(:regex))\n store(key, process, options)\n end",
"def save_data(data)\n\tend",
"def save_resource(data, path=nil)\n\t\tpath ||= File.join(Msf::Config.config_directory, 'msfconsole.rc')\n\n\t\tbegin\n\t\t\trcfd = File.open(path, 'w')\n\t\t\trcfd.write(data)\n\t\t\trcfd.close\n\t\trescue ::Exception\n\t\tend\n\tend",
"def dump\n File.open(@meta_data_file_location,'w') { |f| f.write(YAML.dump(@meta_data))}\n end",
"def save_data(data, filename)\n File.binwrite(filename, Marshal.dump(data))\n return nil\nend",
"def generate_runtime_data(opts)\n obj = opts[:object]\n generate_data \"runtime.#{obj}.dat\", default_data_patterns, opts\nend",
"def save\n File.write(yfile, to_yaml)\n end",
"def configure_data\n [:bitcask, :eleveldb, :merge_index].each {|k| env[k] ||= {} }\n env[:bitcask][:data_root] ||= (data + 'bitcask').expand_path.to_s\n env[:eleveldb][:data_root] ||= (data + 'leveldb').expand_path.to_s\n env[:merge_index][:data_root] ||= (data + 'merge_index').expand_path.to_s\n env[:riak_core][:slide_private_dir] ||= (data + 'slide-data').expand_path.to_s\n env[:riak_core][:ring_state_dir] ||= (data + 'ring').expand_path.to_s\n\n TS_NODE_DIRECTORIES.each do |dir|\n env[:riak_core][:\"platform_#{dir}_dir\"] ||= send(dir).to_s\n end\n end",
"def save_options\n if save_options?\n parts = Shellwords.join(@cli_options)\n create_file '.spritefulrc', parts + \"\\n\", force: true\n end\n end",
"def persist_options()\n return unless $options[:persist]\n\n def update_if_there(opts, x) opts[x] = $options[x] if $options[x] end\n options = {}\n update_if_there(options, :source)\n update_if_there(options, :tpch_data_path)\n update_if_there(options, :inorder_path)\n update_if_there(options, :k3_csv_path)\n update_if_there(options, :dbt_data_path)\n update_if_there(options, :mosaic_path)\n update_if_there(options, :uid)\n update_if_there(options, :jobid)\n update_if_there(options, :skew)\n File.write($last_path, JSON.dump(options))\nend",
"def serialize\n data = manifest.dup\n data[:run_data] = {\n timestamp: Time.now.to_s\n }\n Yajl::Encoder.encode(data, nil, pretty: true)\n end",
"def save_processed_data\n attachment.update(processed_data: json_parser.final_hash)\n end",
"def setup options\n @out = get_output(options)\n end",
"def save_output(data)\n ::File.open(datastore['OUTFILE'], 'wb') do |f|\n f.write(data)\n print_status(\"Saved results in #{datastore['OUTFILE']}\")\n end\n end",
"def save_output(data)\n ::File.open(datastore['OUTFILE'], 'wb') do |f|\n f.write(data)\n print_status(\"Saved results in #{datastore['OUTFILE']}\")\n end\n end",
"def save_yaml( f_enzyme, f_reference=nil, f_supplier=nil )\n File.open(f_enzyme, 'w') { |f| f.puts YAML.dump(@enzyme_data) }\n File.open(f_reference, 'w') { |f| f.puts YAML.dump(@reference_data) } if f_reference\n File.open(f_supplier, 'w') { |f| f.puts YAML.dump(@supplier_data) } if f_supplier\n end",
"def process_options\n @options.verbose = false if @options.quiet\n # @options.output = \"#{@options.output}/#{File.basename(@options.input)}\" if File.directory?(@options.output)\n @options.output = \"#{@options.output}\" if (File.directory?(@options.output) && File.exists?(File.dirname(@options.output)))\n end",
"def payload_data\n case @config.format\n when :json\n @payload.to_json\n when :yaml\n @payload.to_yaml\n else\n @payload.to_hash\n end\n end",
"def meta_data options={}\n if data_type\n output = data_type.meta_data( self )\n else\n output = { :filename => filename, \n :category => category.to_s,\n :location => location,\n :source_name => source.name }\n end\n \n if options[:skip]\n options[:skip].each do |label|\n output.delete(label)\n end\n end\n \n return output\n \n end",
"def save\n if !Dir.exists? @config_directory\n FileUtils.mkdir_p @config_directory\n end\n\n open(@file, 'w').write @main.to_yaml\n end",
"def save_config\n self.data = JSON.dump(self.config)\n end",
"def save_config\n self.data = JSON.dump(self.config)\n end",
"def config_write\n # Putting it in a format that zfm can also read and write\n f1 = File.expand_path(CONFIG_FILE)\n hash = {}\n hash['DIRS'] = @used_dirs.select { |dir| File.exist? dir }\n hash['FILES'] = @visited_files.select { |file| File.exist? file }\n # NOTE bookmarks is a hash and contains FILE:cursor_pos\n hash['BOOKMARKS'] = @bookmarks # .select {|file| File.exist? file}\n writeYML hash, f1\n @writing = @modified = false\n message \"Saved #{f1}\"\nend",
"def receive_data data\n puts \"%% Parser got: #{data}\" if $options[:debug]\n @parser << data\n end",
"def to_toml\n conf = {}.merge config\n conf[:type] = type\n Heka::Filter::OPTIONS.each_pair { |k, _| conf[k] = send(k) }\n Heka::Restart::OPTIONS.each_pair { |k, _| conf[k] = send(k) }\n if conf[:use_buffering]\n conf[:buffering] = {}\n Heka::Buffering::OPTIONS.each_pair do |k, _|\n conf[:buffering][k] = send(k) unless send(k).nil?\n end\n end\n if type =~ /^Sandbox(Input|Decoder|Filter|Encoder|Output)/\n Heka::Sandbox::OPTIONS.each_pair { |k, _| conf[k] = send(k) }\n conf[:config] = conf.delete(:sandbox_config)\n end\n conf.delete_if { |_, v| v.nil? }\n TOML::Generator.new(name => conf).body\n end",
"def to_toml\n conf = {}.merge config\n conf[:type] = type\n conf[:use_tls] = use_tls\n Heka::Restart::OPTIONS.each_pair { |k, _| conf[k] = send(k) }\n Heka::Output::OPTIONS.each_pair { |k, _| conf[k] = send(k) }\n if type =~ /^Sandbox(Input|Decoder|Filter|Encoder|Output)/\n Heka::Sandbox::OPTIONS.each_pair { |k, _| conf[k] = send(k) }\n conf[:config] = conf.delete(:sandbox_config)\n end\n if conf[:use_buffering]\n conf[:buffering] = {}\n Heka::Buffering::OPTIONS.each_pair do |k, _|\n conf[:buffering][k] = send(k) unless send(k).nil?\n end\n end\n if conf[:use_tls]\n conf[:tls] = {}\n Heka::TLS::OPTIONS.each_pair do |k, _|\n conf[:tls][k] = send(k) unless send(k).nil?\n end\n end\n conf.delete_if { |_, v| v.nil? }\n TOML::Generator.new(name => conf).body\n end",
"def write_data(data = nil)\n # Return nil if no data is supplied\n return nil if data.nil?\n # Return a JSON string and the data if a Hash is supplied\n parsed_json = data.is_a?(Hash) || data.is_a?(Array)\n return JSON.generate(data), data if parsed_json\n # Otherwise return the data as a string and a parsed JSON hash\n data = data.to_s\n [data, JSON.parse(data)]\n end",
"def data\n YAML::load_file(files[:config])\n end",
"def set_meta(data)\n \n data[LASERID] = self.identity.chomp\n data[LASER_CURRENT] = self.laser_current.chomp\n data[PIEZO_WAVEFORM] = self.piezo_waveform.chomp\n data[PIEZO_FREQUENCY] = self.piezo_frequency.chomp\n data[PIEZO_AMPLITUDE] = self.piezo_amplitude.chomp\n data[PIEZO_OFFSET] = self.piezo_offset.chomp\n data[PIEZO_VOLTAGE] = self.piezo_voltage.chomp\n data[LASER_TEMP] = self.laser_temperature.chomp\n data[CC_ENABLE] = self.cc_enable.chomp\n\n end",
"def process_options options={}\n\t\t\t\tif options[:term].nil? == false\n\t\t\t\t\t@@gp.set term:\"#{options[:term]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:datafilesep].nil? == false\n\t\t\t\t\t@@gp.set \"datafile separator '#{options[:datafilesep]}'\"\n\t\t\t\tend\n\n\t\t\t\tif ((options[:xtype].nil? == false and options[:xtype] == :date) or\n\t\t\t\t\t(options[:ytype].nil? == false and options[:ytype] == :date)) and\n\t\t\t\t\t(options[:timefmt].nil? == false)\n\t\t\t\t\tif options[:xtype] == :date\n\t\t\t\t\t\t@@gp.set \"xdata time\"\n\t\t\t\t\tend\n\n\t\t\t\t\tif options[:ytype] == :date\n\t\t\t\t\t\t@@gp.set \"ydata time\"\n\t\t\t\t\tend\n\n\t\t\t\t\t@@gp.set \"timefmt '#{options[:timefmt]}'\"\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif options[:xrange].nil? == false\n\t\t\t\t\tif options[:xtype].nil? == false and options[:xtype] == :date\n\t\t\t\t\t\t@@gp.set \"xrange ['#{Time.at(options[:xrange].begin).strftime(\"%Y-%m-%d %H:%M:%S\")}':'#{Time.at(options[:xrange].end).strftime(\"%Y-%m-%d %H:%M:%S\")}']\"\n\t\t\t\t\telse\n\t\t\t\t\t\t@@gp.set \"xrange [#{options[:xrange].begin}:#{options[:xrange].end}]\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"xrange\"\n\t\t\t\tend\n\n\t\t\t\tif options[:yrange].nil? == false\n\t\t\t\t\tif options[:ytype].nil? == false and options[:ytype] == :date\n\t\t\t\t\t\t@@gp.set \"yrange ['#{Time.at(options[:yrange].begin).strftime(\"%Y-%m-%d %H:%M:%S\")}':'#{Time.at(options[:yrange].end).strftime(\"%Y-%m-%d %H:%M:%S\")}']\"\n\t\t\t\t\telse\n\t\t\t\t\t\t@@gp.set \"yrange [#{options[:yrange].begin}:#{options[:yrange].end}]\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"yrange\"\n\t\t\t\tend\n\n\t\t\t\tif options[:xtics].nil? == false\n\t\t\t\t\t@@gp.set \"xtics #{options[:xtics]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:ytics].nil? == false\n\t\t\t\t\t@@gp.set \"ytics #{options[:ytics]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:mxtics].nil? == false\n\t\t\t\t\t@@gp.set \"mxtics #{options[:mxtics]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:mytics].nil? == false\n\t\t\t\t\t@@gp.set \"mytics #{options[:mytics]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:logx].nil? == false and options[:logx] == true\n\t\t\t\t\t@@gp.set \"log x\"\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"log x\"\n\t\t\t\tend\n\n\t\t\t\tif options[:logy].nil? == false and options[:logy] == true\n\t\t\t\t\t@@gp.set \"log y\"\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"log y\"\n\t\t\t\tend\n\n\t\t\t\tif options[:xformat].nil? == false\n\t\t\t\t\t@@gp.set \"format x '#{options[:xformat]}'\"\n\t\t\t\tend\n\n\t\t\t\tif options[:yformat].nil? == false\n\t\t\t\t\t@@gp.set \"format y '#{options[:yformat]}'\"\n\t\t\t\tend\n\n\t\t\t\tif options[:xlabel].nil? == false\n\t\t\t\t\t@@gp.set \"xlabel '#{options[:xlabel]}'\"\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"xlabel\"\n\t\t\t\tend\n\n\t\t\t\tif options[:ylabel].nil? == false\n\t\t\t\t\t@@gp.set \"ylabel '#{options[:ylabel]}'\"\n\t\t\t\telse\n\t\t\t\t\t@@gp.unset \"ylabel\"\n\t\t\t\tend\n\n\t\t\t\tif options[:key].nil? == false\n\t\t\t\t\t@@gp.set \"key #{options[:key]}\"\n\t\t\t\tend\n\n\t\t\t\tif options[:grid].nil? == false\n\t\t\t\t\t@@gp.set \"grid #{options[:grid]}\"\n\t\t\t\tend\n\t\t\tend",
"def create_from_data(location, data, options = {:tidy => true})\n # check tidy option\n if (((options[:tidy] == true) and (Tidy_enable == true)) and \n ((File.extname(location) == '.htm') or (File.extname(location) == '.html') or (File.extname(location) == '.xhtml'))) \n \n # apply tidy on data\n data_to_write = Tidy.open(:show_warnings => false) do |tidy|\n tidy.options.output_xhtml = true\n tidy.options.tidy_mark = false\n xhtml = tidy.clean(data)\n xhtml\n end\n else\n data_to_write = data\n end\n \n # write data\n super(location, data_to_write, options)\n end",
"def save_to(filepath)\n File.open(filepath, \"w\") do |fp|\n if @args[:data].is_a?(StringIO)\n fp.write(@args[:data].string)\n else\n #Stream output to avoid using too much memory.\n self.io do |fp_read|\n fp_read.lines do |line|\n fp.write(line)\n end\n end\n end\n end\n end",
"def send_data p_data\n dump_object(p_data,@lifeline)\n end",
"def data\n return @data if @data\n\n if File.exist?(settings_path)\n @data = YAML.load_file(settings_path)\n @data = user_settings.merge(@data)\n else\n puts \"ERROR: No settings file at #{settings_path}\"\n puts \"Please create a settings file via: ufo init\"\n exit 1\n end\n end",
"def data_links\r\n puts \"pwd:\"\r\n puts Dir.pwd\r\n\r\n data = YAML.load_file( './data/links.yml' )\r\n puts data.inspect\r\n data\r\nend",
"def make_save_contents\n contents = rm_extender_make_save_contents\n contents[:self_vars] = $game_self_vars\n contents[:labels] = $game_labels\n contents[:self_labels] = $game_self_labels\n contents\n end",
"def export(data, indent=0)\n target = data[@translate.lang]\n xml = <<EOF\n<?xml version=\"1.0\" encoding=\"#{@translate.options[:encoding]}\"?>\n<!DOCTYPE TS>\n<TS version=\"2.0\" language=\"#{@translate.lang}\">\nEOF\n\n keys = I18n::Translate.hash_to_keys(target).sort\n keys.each do |key|\n value = @translate.find(key, target)\n next unless value\n\n if value.kind_of?(String) || value.kind_of?(Array) || value.kind_of?(Integer)\n fuzzy = (value.to_s.empty?) ? %~ type=\"unfinished\"~ : \"\"\n xml += <<EOF\n <context>\n <name>#{::CGI.escapeHTML(key)}</name>\n <message>\n <source>#{::CGI.escapeHTML(@translate.find(key, @translate.default).to_s)}</source>\n <translation#{fuzzy}>#{::CGI.escapeHTML(value.to_s)}</translation>\n </message>\n </context>\nEOF\n else\n fuzzy = ((value[\"flag\"] == \"ok\") or value[\"flag\"].to_s.strip.empty?) ? \"\" : (value[\"flag\"] == \"obsolete\") ? %~ type=\"obsolete\"~ : %~ type=\"unfinished\"~\n xml += <<EOF\n <context>\n <name>#{::CGI.escapeHTML(key)}</name>\n <message>\nEOF\n if value[\"file\"] or value[\"line\"]\n xml += <<EOF\n <location filename=\"#{::CGI.escapeHTML(value[\"file\"].to_s)}\" line=\"#{::CGI.escapeHTML(value[\"line\"].to_s)}\" />\nEOF\n end\n xml += <<EOF\n <source>#{::CGI.escapeHTML(value[\"default\"].to_s)}</source>\nEOF\n unless value[\"old_default\"].to_s.empty?\n xml += <<EOF\n <oldsource>#{::CGI.escapeHTML(value[\"old_default\"].to_s)}</oldsource>\nEOF\n end\n unless value[\"extracted_comment\"].to_s.empty?\n xml += <<EOF\n <extracomment>#{::CGI.escapeHTML(value[\"extracted_comment\"].to_s)}</extracomment>\nEOF\n end\n unless value[\"comment\"].to_s.empty?\n xml += <<EOF\n <translatorcomment>#{::CGI.escapeHTML(value[\"comment\"].to_s)}</translatorcomment>\nEOF\n end\n xml += <<EOF\n <translation#{fuzzy}>#{::CGI.escapeHTML(value[\"translation\"].to_s)}</translation>\nEOF\n unless value[\"flag\"].to_s.strip.empty?\n xml += <<EOF\n <extra-po-flags>#{::CGI.escapeHTML(value[\"flag\"].to_s.strip)}</extra-po-flags>\nEOF\n end\n xml += <<EOF\n </message>\n </context>\nEOF\n end\n end\n\n xml += <<EOF\n</TS>\nEOF\n xml\n end",
"def generate\n\t\t dir = \"./experiments/\" + @arguments.first\n\t\t\tDir.mkdir(dir)\n\t\t\tFile.open(dir + \"/\" + @arguments.first + \".rb\", \"w\") do |req_file|\n\t\t\t req_file.puts \"# ## #{as_human_name @arguments.first} ##\"\n\t\t\t req_file.puts \"# \"+@options.description.split(\"\\n\").join(\"\\n# \")\n\t\t\t req_file.puts\n\t\t\t req_file.puts\n\t\t\t req_file.puts \"# The first contious block of comment will be included in your report.\"\n\t\t\t req_file.puts \"# This includes the reference implementation.\"\n\t\t\t req_file.puts \"# Override any desired files in this directory.\"\n\t\t\t Dir[\"./app/**/*.{rb,o,dll,so,bundle}\"].each do |f|\n\t\t\t next if File.basename(f) == 'extconfig.rb'\n\t\t\t p = File.expand_path(f).split(\"/\") - File.expand_path(\".\").split(\"/\")\n\t\t\t req_file.puts \"require \\\"#{p.join(\"/\").gsub(/\\.(rb|o|dll|so|bundle)$/, \"\")}\\\"\"\n\t\t\t end\n\t\t\t req_file.puts \"\\nclass #{as_class_name @arguments.first} < MyExperiment\\n\\t\\nend\"\n\t\t\tend\n\t\t\tFile.open(dir + \"/config.yaml\", \"w\") do |f|\n\t\t\t f << \"---\\nexperiment:\\n development:\\n compute:\\n\"\n end\n end",
"def call_write(data, openclose = true)\n if options[:delta]\n wf.write_delta(data, openclose)\n else\n wf.write(data, openclose)\n end\n end",
"def push_data(data)\n process(data)\n interesting = has_interesting_events?\n if interesting || @last_cycle_snapshotted\n relations = if !has_structure_updates? && !history.empty?\n history.last.relations\n end\n history << snapshot(relations)\n result = true\n end\n @last_cycle_snapshotted = interesting\n result\n end",
"def write options={}, &block\n return unless output\n data = []\n block.call(data) if block_given?\n text = {\n :data => data.map do |measurement|\n key, value = measurement\n { :key => key, :value => value }\n end\n }.merge(options).to_json\n\n begin\n output.puts(text)\n rescue Errno::ENXIO\n # FIFO's reader isn't alive...\n end\n end",
"def save!; File.write @path, @data end",
"def array2command(dirname, name, data, duration=1)\n\tFile.open(dirname + \"/\" + name + \"_lb.h\", 'w') do |file| \n\t\tsum = 0\n\t\tdata_cum = data.collect do |v, d|\n\t\t\tsum += d \n\t\t\t[v, sum]\n\t\tend\n\t\t\t\n\t\t# GENERATE ARDUINO CPP HEADER FILE\n\t\t\t# last = data.pop\n\t\t\theader(name, file);\n\n\t\t\tfile.write \"\\tLogger *#{name.underscore};\\n\"\n\t\t\tfile.write \"\\tvoid getLog(){\\n\"\n\t\t\tfile.write \"\\t\\t #{name.underscore} = new Logger(#{\"%3.0f\" % data_cum.length}, 0, 255);\\n\"\n\n\t\t\tdata_cum.each do |v, d|\n\t\t\t\tfile.write \"\\t\\t#{name.underscore}->log(#{\"%3.0f\" % v}, #{\"%3.0f\" % d});\\n\"\n\t\t\tend\n\t\t\tfile.write \"\\t}\\n\"\n\t\t\tfooter(name, file);\n\t\t# END HEADER FILE\n\tend\nend",
"def store_loot(ltype, ctype, host, data, filename=nil, info=nil, service=nil)\n if ! ::File.directory?(Msf::Config.loot_directory)\n FileUtils.mkdir_p(Msf::Config.loot_directory)\n end\n\n ext = 'bin'\n if filename\n parts = filename.to_s.split('.')\n if parts.length > 1 and parts[-1].length < 4\n ext = parts[-1]\n end\n end\n\n case ctype\n when /^text\\/[\\w\\.]+$/\n ext = \"txt\"\n end\n # This method is available even if there is no database, don't bother checking\n host = Msf::Util::Host.normalize_host(host)\n\n ws = (db ? myworkspace.name[0,16] : 'default')\n name =\n Time.now.strftime(\"%Y%m%d%H%M%S\") + \"_\" + ws + \"_\" +\n (host || 'unknown') + '_' + ltype[0,16] + '_' +\n Rex::Text.rand_text_numeric(6) + '.' + ext\n\n name.gsub!(/[^a-z0-9\\.\\_]+/i, '')\n\n path = File.join(Msf::Config.loot_directory, name)\n full_path = ::File.expand_path(path)\n File.open(full_path, \"wb\") do |fd|\n fd.write(data)\n end\n\n if (db)\n # If we have a database we need to store it with all the available\n # metadata.\n conf = {}\n conf[:host] = host if host\n conf[:type] = ltype\n conf[:content_type] = ctype\n conf[:path] = full_path\n conf[:workspace] = myworkspace\n conf[:name] = filename if filename\n conf[:info] = info if info\n conf[:data] = data if data\n\n if service and service.kind_of?(::Mdm::Service)\n conf[:service] = service if service\n end\n\n framework.db.report_loot(conf)\n end\n\n return full_path.dup\n end",
"def format_data(data)\n case format\n when :json\n JSON.pretty_generate(data)\n else # default to YAML\n data.to_yaml.sub(/\\A\\-\\-\\-\\n/, '')\n end\n end",
"def load_data(data_file)\n puts \"FileGenTask: Loading data from YML file [ #{data_file} ]\" if @verbose\n df = DataFile.new\n @data = df.read( data_file )\n end",
"def template_data_format(data)\n data = data.to_smash\n Smash.new.tap do |result|\n result[:config] = data.fetch(:config, Smash.new)\n result[:imports] = data.fetch(:imports, []).map do |item|\n begin\n Smash.new(\n :name => item[:name],\n :content => YAML.load(item[:content])\n )\n rescue\n item\n end\n end\n if(result.get(:config, :content))\n result[:config][:content] = YAML.load(result[:config][:content]) || Smash.new\n else\n result[:config][:content] = Smash.new\n end\n end\n end",
"def to_toml\n conf = {}.merge config\n conf[:type] = type\n conf[:use_tls] = use_tls\n Heka::Input::OPTIONS.each_pair { |k, _| conf[k] = send(k) }\n Heka::Restart::OPTIONS.each_pair { |k, _| conf[k] = send(k) }\n if type =~ /^Sandbox(Input|Decoder|Filter|Encoder|Output)/\n Heka::Sandbox::OPTIONS.each_pair { |k, _| conf[k] = send(k) }\n conf[:config] = conf.delete(:sandbox_config)\n end\n if conf[:use_tls]\n conf[:tls] = {}\n Heka::TLS::OPTIONS.each_pair do |k, _|\n conf[:tls][k] = send(k) unless send(k).nil?\n end\n end\n conf.delete_if { |_, v| v.nil? }\n TOML::Generator.new(name => conf).body\n end",
"def save!(file=nil)\n file = file || @file || self.class.default_filename\n file = @root + file if String === file\n now! # update date\n File.open(file, 'w'){ |f| f << yaml }\n end"
] |
[
"0.62905395",
"0.59971225",
"0.597189",
"0.5841271",
"0.5786085",
"0.56685495",
"0.56228876",
"0.55521417",
"0.5544924",
"0.55430186",
"0.55080116",
"0.550554",
"0.55055106",
"0.5482314",
"0.5398211",
"0.5398211",
"0.53869045",
"0.53704524",
"0.53398335",
"0.5336009",
"0.5321833",
"0.5296735",
"0.52531683",
"0.52388585",
"0.51907694",
"0.51706785",
"0.51142377",
"0.5095601",
"0.5082888",
"0.50647074",
"0.50271904",
"0.5026952",
"0.50165105",
"0.49941555",
"0.4983283",
"0.49793223",
"0.49740982",
"0.49721467",
"0.4953556",
"0.49432674",
"0.49361926",
"0.4915081",
"0.48994982",
"0.4897846",
"0.48960894",
"0.4882929",
"0.48788476",
"0.48766327",
"0.48751822",
"0.48454887",
"0.4836577",
"0.48312435",
"0.4828847",
"0.48207542",
"0.4817408",
"0.48169154",
"0.48167402",
"0.48070693",
"0.4797932",
"0.4797127",
"0.47962412",
"0.47912556",
"0.47820476",
"0.47748664",
"0.4773133",
"0.4773133",
"0.47726765",
"0.47668758",
"0.47655427",
"0.4763068",
"0.47535998",
"0.47533974",
"0.47533974",
"0.47464737",
"0.47450304",
"0.47425976",
"0.47366333",
"0.47364622",
"0.47327912",
"0.47233617",
"0.47227475",
"0.4716723",
"0.4713161",
"0.47103667",
"0.47004694",
"0.46842963",
"0.46841723",
"0.4674306",
"0.46686772",
"0.46668604",
"0.46617094",
"0.46608636",
"0.4655707",
"0.46523675",
"0.46514732",
"0.4644818",
"0.4643636",
"0.46433955",
"0.46329924",
"0.4630165"
] |
0.7113031
|
0
|
Writes the given YAML string to a file at path/name.yml, this method will overwrite the file if it already exists. yml [String]:: A YAML string of data. path [String]:: The path to store too. name [String]:: The name of the file to save as.
|
def store ( yml, name )
storefile = File.new( name, "w")
storefile.puts(yml)
storefile.close
return [yml]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def save_yaml(path=nil)\n unless path\n # Display file explorer\n path = Qt::FileDialog.getSaveFileName(self, \"Save configuration file\", \"./myconfig.yml\", \"YAML Files (*.yml *.yaml)\")\n end\n\n begin\n config_hash = Hash.new\n @container_hash.each do |pos, container|\n config_hash[pos] = container.config\n end\n File.open(path, \"w\") {|f| f.write(config_hash.to_yaml) }\n rescue Exception => e\n Vizkit.error \"A problem occured while trying to write configuration to '#{path}': \\n#{e.message}\"\n end\n end",
"def write_to_fixture(name)\n File.open(self.class.file_path(name), \"w\") do |file|\n file.write to_yaml\n end\n end",
"def save\n File.open(path, 'w') do |out|\n YAML.dump(data, out)\n end\n end",
"def save(path)\n Pathname.new(path).write(self.to_yaml)\n\n true\n rescue\n # TODO Add a custom exception here to track why it erred. IO? Permissions? etc.\n false\n end",
"def save(path_or_io)\n yaml = YAML.dump(to_yaml_hash)\n\n case path_or_io\n when String, Pathname\n File.open(path_or_io, 'w') { |f| f.write(yaml) }\n else\n path_or_io.write(yaml)\n end\n end",
"def atomic_write(data, path, name, options = {})\n main_file = File.join(path, name) + '.yml'\n dup_file = File.join(path, name) + '.yml2'\n \n # append verification info at the end of the file to guard from incomplete writes\n ts = Time.now\n ts_checksum = Digest::MD5.hexdigest(\"#{ts.tv_sec}.#{ts.tv_usec}\")\n if options[:owner]\n # secure the file\n File.open(dup_file, 'w').close\n uid = uid_for_username options[:owner]\n gid = gid_for_username options[:owner]\n File.chown uid, gid, dup_file\n File.chmod options[:permissions] || 0660, dup_file\n end\n File.open(dup_file, 'w') { |f| YAML::dump [data, ts.tv_sec, ts.tv_usec, ts_checksum], f }\n \n # move the file atomically to the main copy\n FileUtils.mv(dup_file, main_file)\n end",
"def save!(file_path)\n File.open(file_path, \"w\") do |f|\n f.write(YAML.dump(@log))\n end\n end",
"def save(name = @name)\n raise OneCfg::Config::Exception::NoContent if @content.nil?\n\n file_operation(name, 'w') {|file| file.write(to_s) }\n end",
"def save\n File.open(file_path, 'w') do |file|\n YAML.dump(data, file)\n end\n end",
"def write!(name, value, overwrite=true)\n return if value.nil?\n fname = name # TODO\n file = @pathname + fname\n if file.exist?\n if overwrite\n text = file.read\n yaml = /\\A---/ =~ text\n value = value.to_yaml if yaml\n if text != value\n write_raw!(file, value)\n end\n end\n else\n case value\n when Array, Hash\n return if value.empty?\n out = value.to_yaml\n when String, Numeric\n out = value\n else\n out = value.to_yaml\n end\n write_raw!(file, out)\n end\n end",
"def save\n File.open(file_name, 'w') { |f| f.write config.to_yaml }\n end",
"def write_to_yaml_file(dest_path = nil)\n if dest_path.nil?\n file = Tempfile.new('config')\n file.close\n dest_path = file.path\n # deleting temp file but reusing file name. This is to avoid premature garbage collection.\n file.unlink\n end\n File.open(dest_path, 'w') do |f|\n f.write(@config.to_yaml)\n end\n dest_path\n end",
"def write_to_disk(path)\n path.dirname.mkpath unless path.dirname.exist?\n self.defined_in_file = path\n # rubocop:disable Lint/RescueException\n # rubocop:disable Lint/HandleExceptions\n begin\n existing = Lockfile.from_file(path)\n return if existing == self\n rescue Exception\n end\n path.open('w') { |f| f.write(to_yaml) }\n # rubocop:enable Lint/HandleExceptions\n # rubocop:enable Lint/RescueException\n end",
"def save!(file=nil)\n file = file || @file || self.class.default_filename\n file = @root + file if String === file\n now! # update date\n File.open(file, 'w'){ |f| f << yaml }\n end",
"def write_to_yaml(data,yaml_file) \n File.open(yaml_file,'w') { |yf| YAML.dump(data,yf) }\nend",
"def save_configuration(path = nil)\n # If no path provided, see if we can find one in the dir tree.\n if path.nil?\n path = find_config_path\n end\n\n # Still no path? Use the current working dir.\n if path.nil?\n path = Pathname.pwd\n end\n\n unless path.to_s.end_with?('/' + config_filename)\n path = Pathname(path) + config_filename\n end\n\n path = Pathname(path).expand_path\n File.write(path, YAML.dump(configuration))\n $stdout << \"configuration saved to #{path}\\n\" if $debug\n\n path\n end",
"def save(dir = \".\")\n File.open(File.join(dir, \"#{name}.yaml\"), 'w') do |f|\n f.print YAML.dump(self)\n end\n end",
"def using_yaml_path=(path)\n @using_yaml_path = path && Pathname.new(path)\n end",
"def save\n File.open(yaml_file, 'w') {|f| f.write(to_yaml) }\n end",
"def save_game\n\t\tputs \"Type a name for your saved game\"\n\t\tgame_name = gets.chomp\t\n\t\tfilename = \"#{game_name}.yml\"\n\n\t\t ex_file = File.expand_path(\"./saved_games/#{filename}\")\n\t\t \n\t\tif File.exists?(ex_file)\n\t puts \"#{filename} exists\" #overwrite method?\n\t \n\t self.save_game\n\t else\n\t\t\tFile.open(ex_file, \"w\") do |f|\n\t\t\t\tgame_state = YAML::dump(self)\n\t\t\t\tf.puts game_state\n\t\t\t\tputs \"Your game was saved as #{filename}\" \n\t\t\tend\n\t\tend\n\tend",
"def logyml(service, yml)\n File.open(\"/tmp/#{service}.yml\", 'w') do |f| f.write(yml) end\n end",
"def store\n File.open(@file_name, 'w') do |file|\n file.write YAML::dump(@data)\n end\n end",
"def write_yaml_data_file filename, data\n File.open(filename, 'w') { |f| f << YAML.dump(data) }\nend",
"def write_yaml_data_file filename, data\n File.open(filename, 'w') { |f| f << YAML.dump(data) }\nend",
"def save(hash)\n File.open(\"#{@directory}/#{@store}.yml\", 'w+') {|f| f.write(hash.to_yaml) }\n end",
"def save! path\n File.open(path, 'w') do |file|\n file.write(to_s)\n end\n end",
"def save_file\r\n @saved = true\r\n saving\r\n Dir.mkdir(\"saves\") unless Dir.exists? \"saves\"\r\n File.open(\"my_save.yaml\", \"w\") {|f| f.puts YAML::dump(self) }\r\n end",
"def save_yaml(yaml)\n yaml_file = File.join(thor_root, \"thor.yml\")\n\n unless File.exist?(yaml_file)\n FileUtils.mkdir_p(thor_root)\n yaml_file = File.join(thor_root, \"thor.yml\")\n FileUtils.touch(yaml_file)\n end\n\n File.open(yaml_file, \"w\") { |f| f.puts yaml.to_yaml }\n end",
"def save_to(path)\n (File.open(path, 'w') << to_s).close\n path\n end",
"def save_to(path)\n (File.open(path, 'w') << to_s).close\n path\n end",
"def save\n File.write(yfile, to_yaml)\n end",
"def write_yml(filename,object)\n File.open(filename,'w') do |f|\n f.write(YAML.dump(object))\n end\n end",
"def save(path = self.path)\n File.open(path, 'w') do |io|\n marshalled_packages = packages.values.map do |v|\n Hash['name' => v.name,\n 'srcdir' => v.srcdir,\n 'builddir' => (v.builddir if v.respond_to?(:builddir)),\n 'prefix' => v.prefix,\n 'dependencies' => v.dependencies]\n end\n YAML.dump(marshalled_packages, io)\n end\n end",
"def save_game\n\t\tputs \"Type a name for your saved game\"\n\t\tgame_name = gets.chomp\n\t\tfilename = \"#{game_name}.txt\"\n\n\t\t ex_file = File.expand_path(\"./saved_games/#{filename}\")\n\t\t \n\t\tif File.exists?(ex_file)\n\t puts \"#{filename} exists\" #overwrite method?\n\t \n\t self.save_game\n\t else\n\t\t\tFile.open(ex_file, \"w\") do |f|\n\n\t\t\t\tf.puts YAML::dump(game_state)\n\n\t\t\t\tputs \"Your game was saved as #{filename}\" \n\t\t\tend\n\t\tend\n\tend",
"def write\n require 'yaml'\n open config_file_name, 'w' do |io|\n io.write to_yaml\n end\n end",
"def save\n \tdata = self\n \t\n \tFile.open('store.yml','w') do |f|\n \t\tf.write(data.to_yaml)\n \tend\n \tputs data\n \tputs \"Saved!\"\n \tputs \"\"\n end",
"def yaml_save object, filename\n\tFile.open filename, 'w' do |f|\n\t\tf.write(object.to_yaml)\n\tend\nend",
"def yaml_save object, filename\n\tFile.open filename, 'w' do |f|\n\t\tf.write(object.to_yaml)\n\tend\nend",
"def yaml_save(object, filename)\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def save_to_file(path)\n variables_to_save = instance_variables.reject { |v| v =~ /_proc$/ || v =~ /^@med/ }\n File.open(path, 'w') { |f| f.puts(\n variables_to_save.inject({}) { |h,n| h[n] = instance_variable_get(n); h }.to_yaml\n ) }\n end",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend",
"def write(path, flatten: false, minify: false)\n File.write(path, to_yaml(flatten: flatten, minify: minify))\n end",
"def save_game\n #yaml = YAML::dump(self)\n puts \"Please enter a filename for the saved game.\"\n save_file_name = gets.chomp.downcase\n save_file = File.write(\"saved_games/#{save_file_name}.yaml\", self.to_yaml)\n #save_file.write(yaml)\n puts \"Your game has been saved!\"\n puts \"Goodbye!\"\n end",
"def yaml_save object, filename\nFile.open filename, 'w' do |f| f.write(object.to_yaml)\nend end",
"def yaml_save(object, filename)\n File.open (filename), \"w\" do |f|\n f.write(object.to_yaml)\n end\nend",
"def write key, value\n @content[key] = value\n File.open(@file_path, 'w') { |f| YAML.dump(@content, f) }\n end",
"def write(name, value)\n FileUtils.mkdir_p(File.dirname(path(name)))\n File.open(path(name), 'w') do |f|\n f.write(value)\n end\n end",
"def settings_write(settings_hash = active_values, name: nil)\n File.open settings_path(name), 'w' do |f|\n f.write settings_hash.to_yaml\n end\n end",
"def save_as(path)\n contents = generate\n path.open('w') do |f|\n f.write(contents)\n end\n end",
"def save_as(path)\n contents = generate\n path.open('w') do |f|\n f.write(contents)\n end\n end",
"def save_as(path)\n contents = generate\n path.open('w') do |f|\n f.write(contents)\n end\n end",
"def save_as(path)\n contents = generate\n path.open('w') do |f|\n f.write(contents)\n end\n end",
"def save_as(path)\n contents = generate\n path.open('w') do |f|\n f.write(contents)\n end\n end",
"def write_to_file(high_score)\n file = File.open(\"data/highscores.yml\",\"a+\"){ |file| file.write(high_score.to_yaml)}\nend",
"def save_game(game)\n print \"Enter a new filename to save game in: \"\n filename = gets.chomp\n File.open(filename, \"w\") {|f| f.puts game.to_yaml}\nend",
"def mkyml(yml, allow_suffix=true)\n file = \"#{$config[:'config-dir']}/#{yml.downcase}.yml\"\n file += '.new' if File.exists?(file) && allow_suffix\n if !File.exists?(file)\n File.open(file, 'w') do |f|\n f.puts eval(yml).rekey(&:to_s).to_yaml\n end\n File.chmod(0640, file)\n File.chown($config[:uid], $config[:gid], file)\n end\n end",
"def write(filename, hash)\n File.open(filename, \"a\") do |f|\n f.write(yaml(hash))\n end\nend",
"def save_to(path)\n unless File.exists?(File.dirname(path))\n raise ArgumentError, \"Output path does not exist!\"\n end\n if File.directory?(path)\n raise ArgumentError, \"Output path should be a file!\"\n end\n File.open(path, 'w') { |f| f.write(@content) }\n end",
"def dotfile!( name )\n File.open( dotfile( name ), \"w\" ) do |f|\n h = { 'name' => self.name, 'version' => self.version, \"#{name}_timestsamp\" => Time.now }\n f.puts h.to_yaml\n end\n end",
"def save\n open @config_path, 'w' do |io|\n io.write({'files' => @files.collect(&:to_hash)}.to_yaml)\n end\n end",
"def save_as(path, overwrite=true)\n write_file(overwrite, path)\n end",
"def persist!\n raise \"Robut::Storage::YamlStore.file must be set\" unless file\n File.open(file, \"w\") do |f|\n f.puts internal.to_yaml\n end\n end",
"def save_game\n\t\tputs \"To save game please provide a game name. Please only use letters, numbers and underscores\"\n\t\tinput = gets.chomp.downcase\n\t\tvalid = input.index(/[^\\d,\\w,_]/)\n\t\tuntil !valid\n\t\t\tputs \"Please enter a valid name\"\n\t\t\tinput = gets.chomp.downcase\t\n\t\t\tvalid = input.index(/[^\\d+,\\w+, _+]/)\t\t\t\n\t\tend\n\t\tputs \"Saving #{input}\"\n\t\tyaml = YAML::dump(self)\n\t\tif !Dir.exists?(\"saved\")\n\t\t\tDir.mkdir(\"saved\") \n\t\tend\n\t\tsave_file = File.open(\"saved/#{input}.yaml\", 'w')\n\t\tsave_file.write(yaml)\n\t\tsave_file.close\n\t\tputs \"Game Saved!\"\n\t\texit\n\tend",
"def save_to_file(path)\n fullpath = File.expand_path(path)\n lines = []\n\n @content.each_pair do |key,value|\n k = \"lxc.#{key.gsub('_', '.')}\"\n\n if value.kind_of?(Array)\n lines << value.map { |v| \"#{k} = #{v}\" }\n else\n lines << \"#{k} = #{value}\"\n end\n end\n\n File.open(path, \"w\") do |f|\n f.write(lines.flatten.join(\"\\n\"))\n end\n end",
"def save_polls_data(data)\n save_data('polls.yaml', data)\nend",
"def save_diff(file_path, diff)\n Dir.mkdir @file_dir unless File.directory? @file_dir\n File.open(file_path, 'w') { |file| file.write YAML.dump(diff) + \"\\n\" }\n end",
"def save_file(path, content)\n FileUtils.mkdir_p(File.expand_path(\"..\", path))\n File.open(path, \"w\") do |f|\n f.write(content)\n end\n end",
"def write_yaml(stations)\n log(' - Writing YAML...', false)\n File.open(YAML_PATH.to_s, 'w') { |file| file.write(stations.to_yaml) }\n log('DONE')\nend",
"def save\n unless @filespec.nil?\n yaml_filespec = @filespec.ext('.yaml')\n if !File.exist?(yaml_filespec) || (File.mtime(@filespec) > File.mtime(yaml_filespec))\n @logger.info { \"saving: #{yaml_filespec}\" }\n File.open(yaml_filespec, \"w\") do |f|\n YAML.dump(\n {\n :title_isbn_hash => @title_isbn_hash,\n :isbn_title_hash => @isbn_title_hash,\n :isbn_dvd_hash => @isbn_dvd_hash,\n }, f)\n end\n else\n @logger.info { \"not saving, yaml file is newer than xml file\" }\n end\n else\n @logger.error { \"can not save, the filespec is nil\" }\n end\n end",
"def save( file = @hobix_yaml )\n unless file\n raise ArgumentError, \"Missing argument: path to save configuration (0 of 1)\"\n end\n File::open( file, 'w' ) do |f|\n YAML::dump( self, f )\n end\n self\n end",
"def save_yaml( f_enzyme, f_reference=nil, f_supplier=nil )\n File.open(f_enzyme, 'w') { |f| f.puts YAML.dump(@enzyme_data) }\n File.open(f_reference, 'w') { |f| f.puts YAML.dump(@reference_data) } if f_reference\n File.open(f_supplier, 'w') { |f| f.puts YAML.dump(@supplier_data) } if f_supplier\n end",
"def save_file(path, content)\n File.open(path, 'w') do |f|\n f.write content\n end\n end",
"def save()\n File.open(CONFIG_FILE, 'w'){ |f| f.write config.to_yaml } # Store\n end",
"def write(filename, hash)\n File.open(filename, \"w\") { |f| f.write(hash.to_yaml) }\nend",
"def load_yaml\n if has_file? \"#{name}.yml\"\n YAML.load_file(path / \"#{name}.yml\").apply_to self\n end\n end",
"def yaml_save(filename, to_save)\n\t\tbegin\n\t\t\tFile.open(filename, 'w') do |file|\n\t\t\t\tfile.write(to_save.to_yaml)\n\t\t\tend\n\t\t\ttrue\n\t\trescue\n\t\t\tputs \"Unable to save to file '#{ filename }'.\"\n\t\t\tnil\n\t\tend\n\tend",
"def write data, path\n\t\t\tcontent = \"\"\n\t\t\tfile_type = data.class.to_s\n\n\t\t\tif file_type == 'Array'\n\t\t\t\tdata.each do | line |\n\t\t\t\t\tline.each do | key, val |\n\t\t\t\t\t\tcontent << \"#{key.to_s}=#{val}\\n\"\n\t\t\t\t\tend\n\t\t\t\t\tcontent << \"\\n\"\n\t\t\t\tend\n\n\t\t\telsif file_type == 'Hash'\n\t\t\t\tdata.each do | key, val |\n\t\t\t\t\tcontent << \"#{key.to_s}=#{val}\\n\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tpath = File.expand_path path\n\t\t\tFile.open(path, 'w+') do |f|\n\t\t\t\tf.write content\n\t\t\tend\n\t\tend",
"def dump_yaml!(filepath,translations)\n return if translations.blank?\n FileUtils.mkdir_p(@dirpath) unless File.exists?(@dirpath)\n File.open(filepath, 'w+') { |f| YAML::dump(translations, f) } \n end",
"def save_settings\n File.open(@path, \"w\") do |file|\n file.write @settings.to_yaml\n end\n end",
"def save!\n filepath.dirname.mkpath\n filepath.open( \"w\" ) do |f|\n f << YAML.dump( @entries )\n end\n clear_modified\n true\n end",
"def data_path name\n File.join File.dirname(__FILE__), 'data', \"#{ name }.yml\"\nend",
"def save(game)\n\t\tprint \"Name the save: \"\n\t\tsave_name = gets.chomp.downcase\n\t\tDir.mkdir \"saves\" unless Dir.exists? \"saves\"\n\t\tfile_path = File.join(\"saves\", \"#{save_name}\")\n\t\tFile.open(file_path, \"w\") { |f|\n\t\t\tf.write(YAML.dump(game))\n\t\t}\n\t\tputs \"The game has been saved!\"\n\tend",
"def save(path = @path)\n Ops.atomic_write(path) do |io|\n marshalled_package_sets = each_package_set.map do |pkg_set|\n set = pkg_set.to_h.transform_keys(&:to_s)\n set[\"package_set\"] = set[\"name\"]\n set\n end\n marshalled_packages = each_package.map do |pkg|\n pkg.to_h.transform_keys(&:to_s)\n end\n io.write YAML.dump(marshalled_package_sets + marshalled_packages)\n end\n end",
"def save(data: content, name: subject + '.html')\n filename = 'tmp/' + name\n\n File.open(filename, 'w+') do |f|\n f.write(data)\n end\n end",
"def save\n if !Dir.exists? @config_directory\n FileUtils.mkdir_p @config_directory\n end\n\n open(@file, 'w').write @main.to_yaml\n end",
"def save\n unless File.exist?(config_dir)\n FileUtils.mkdir_p(config_dir, :mode => 0700)\n end\n\n tmpfile = File.join(config_dir, \"tmpconfig_#{rand 999999}\")\n File.open(tmpfile, \"w\") do |f|\n YAML.dump(conf, f )\n end\n\n FileUtils.mv(tmpfile, config_file)\n end",
"def save_game(player)\n player_data = YAML::dump(player)\n File.open(\"player.yaml\", \"w\") do |file|\n file.puts player_data\n end\n print \"Successfully saved the game!\\n\\n\"\n return\nend",
"def save(file_path, file_name = nil)\n raise ValidationError, \"FEPFile does not have all required data set: #{validation_errors.inspect}\" unless valid?\n \n name = file_name || \"%s_fepfile.txt\" % Time.now.strftime('%Y%m%d%H%M%S')\n full_name = \"#{file_path}/#{name}\"\n \n open(full_name, \"w+\") do |file|\n file.write(self.to_s)\n end\n \n [full_name, true]\n end",
"def save_data\n begin\n File.open(@file, 'w') do |out|\n YAML.dump(@data, out)\n end\n rescue => e\n Lorj.error(format(\"%s\\n%s\", e.message, e.backtrace.join(\"\\n\")))\n return false\n end\n true\n end",
"def write_to_file(workbook, file_loc)\r\n yml_file = File.join(SAF::DATA_YML, \"#{workbook.sheet_name}.yml\")\r\n File.open(yml_file, \"w\") do |file|\r\n file.puts(\"#Workbook: \" + file_loc)\r\n file.puts(\"#Worksheet: \" + workbook.sheet_name)\r\n file.puts(@test_data.to_yaml)\r\n end\r\n end",
"def save_game\n\t\tall_saved_games = yaml_load(SAVED_FILENAME)\n\t\tgame_name = get_save_name(all_saved_games)\n\t\treturn if game_name.nil?\n\n\t\tgame_string = self.to_yaml \n\t\tall_saved_games[game_name] = game_string\n\t\tyaml_save(SAVED_FILENAME, all_saved_games)\n\t\tmessage_then_enter \"'#{ game_name }' successfully saved.\"\n\tend",
"def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end",
"def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end",
"def save(filename)\n FileUtils.mkdir_p(File.dirname(filename))\n File.write(filename, YAML.dump(@metadata) + \"---\\n#{text}\")\n end"
] |
[
"0.69372267",
"0.6783027",
"0.6661339",
"0.66281116",
"0.6428165",
"0.63069355",
"0.63029265",
"0.62984097",
"0.6280548",
"0.6252257",
"0.6176577",
"0.6128489",
"0.6072625",
"0.60368526",
"0.60366064",
"0.60152084",
"0.5991822",
"0.5956425",
"0.58868843",
"0.58076626",
"0.57846284",
"0.57840526",
"0.5722054",
"0.5722054",
"0.5714881",
"0.57124525",
"0.5707145",
"0.5689471",
"0.56853753",
"0.56853753",
"0.5674075",
"0.5667593",
"0.5667345",
"0.5624666",
"0.5612178",
"0.5604854",
"0.5604199",
"0.5604199",
"0.560229",
"0.55975586",
"0.55939794",
"0.55939794",
"0.55939794",
"0.55939794",
"0.55939794",
"0.55939794",
"0.55939794",
"0.558856",
"0.5583561",
"0.55818236",
"0.55463237",
"0.55354685",
"0.5534718",
"0.55287564",
"0.54992455",
"0.54992455",
"0.54992455",
"0.54992455",
"0.54992455",
"0.54982495",
"0.5493364",
"0.54911804",
"0.5490237",
"0.5476427",
"0.546568",
"0.5452477",
"0.54329735",
"0.542146",
"0.54184574",
"0.5406664",
"0.5393469",
"0.53929406",
"0.5392263",
"0.53889817",
"0.5388147",
"0.5386174",
"0.5370542",
"0.53674805",
"0.53659225",
"0.53620934",
"0.5351246",
"0.53403294",
"0.5339207",
"0.5335501",
"0.53259575",
"0.5323891",
"0.5322627",
"0.5314441",
"0.5310005",
"0.5303067",
"0.53014416",
"0.52960783",
"0.5294724",
"0.52814585",
"0.5268341",
"0.5262373",
"0.5258077",
"0.5252038",
"0.5247049",
"0.52455795"
] |
0.7165604
|
0
|
Create a new ProxyList
|
def initialize(proxy_queue)
@proxy_queue = proxy_queue
@current_proxy_index = 0
self.get_next
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ll_create()\n return Linked_List.new()\nend",
"def new\n @list = List.new\n end",
"def proxies; end",
"def proxylist\r\n\t\t\t`#{BITS::BITSADMIN} /getproxylist {#{@id}}`\r\n\t\tend",
"def new\n @list = List.new\n end",
"def load_proxy_list(*)\n raise NotImplementedError, \"#{__method__} must be implemented in a descendant class!\"\n end",
"def load_proxy_list(*)\n raise NotImplementedError, \"#{__method__} must be implemented in a descendant class!\"\n end",
"def initialize\n self.list = {}\n self.origins = []\n end",
"def load_proxy_list(filters = {})\n load_document(provider_url, filters)\n end",
"def proxies\n @proxies ||= {}\n end",
"def new\n @list = List.new\nend",
"def add_proxies records\n if records && records.length > 0\n records.each { |record| add_proxy record }\n end\n end",
"def initialize_list\n Array(value.value).each_with_index do |val, index|\n ordered_list.insert_proxy_for_at(index, calling_mapper.for(Property.new(value.subject, :member_id, val, value.adapter, value.resource)).result.value)\n end\n end",
"def list(name, type = :string)\n class_name = marshal_class_name(name, type)\n \n fields << {:name => name.to_s, :type => :list}\n class_eval \"def #{name}; @#{name} ||= ListProxy.new(self.store, field_key('#{name}'), Marshal::#{class_name}); end\"\n eval_writer(name)\n end",
"def initialize(refresh: true, validate: false, filters: {})\n if refresh\n refresh_list!(filters)\n else\n @proxies = []\n end\n\n cleanup! if validate\n end",
"def new_from_soap(recordings)\n # Reset the list array to be blank\n @@list = []\n recordings.map do |recording|\n @@list << self.new(recording)\n end\n self\n end",
"def get!\n index = proxies.find_index(&:connectable?)\n return if index.nil?\n\n proxy = proxies.delete_at(index)\n tail = proxies[index..-1]\n\n @proxies = tail << proxy\n\n proxy\n end",
"def get!\n index = proxies.find_index(&:connectable?)\n return if index.nil?\n\n proxy = proxies.delete_at(index)\n tail = proxies[index..-1]\n\n @proxies = tail << proxy\n\n proxy\n end",
"def initialize(base_list)\n @list = base_list\n end",
"def create_new_list\n temp_linkedList = LinkedList.new\n node = @linkedList.head\n\n while node\n temp_linkedList.append(node.x_value, node.y_value)\n node = node.next\n end\n\n return temp_linkedList\n end",
"def list(name, type = :string)\n class_name = marshal_class_name(name, type)\n\n fields << {:name => name.to_s, :type => :list}\n class_eval \"def #{name}; @#{name} ||= ListProxy.new(self.redis, field_key('#{name}'), Marshal::#{class_name}); end\"\n eval_writer(name)\n end",
"def refresh_list!(filters = nil)\n @proxies = []\n\n threads = []\n lock = Mutex.new\n\n ProxyFetcher.config.providers.each do |provider_name|\n threads << Thread.new do\n provider = ProxyFetcher::Configuration.providers_registry.class_for(provider_name)\n provider_filters = filters && filters.fetch(provider_name.to_sym, filters)\n provider_proxies = provider.fetch_proxies!(provider_filters)\n\n lock.synchronize do\n @proxies.concat(provider_proxies)\n end\n end\n end\n\n threads.each(&:join)\n\n @proxies\n end",
"def initialize()\n @conf ||= []\n @proxy_type = \"defaults\"\n @conf.push(\" \" + \"#{@proxy_type} \" + \"\\n\")\n @name_index = @conf.index(\" \" + \"#{@proxy_type} \" + \"\\n\")\n end",
"def list\n @list.nil? ? List.new : @list\n end",
"def fetch_proxies!(filters = {})\n load_proxy_list(filters).map { |html| to_proxy(html) }\n end",
"def list\n @list_helper ||= ListWrapper.new(self)\n end",
"def all\n request = Net::HTTP::Get.new(\"/proxies\")\n response = http_request(request)\n assert_response(response)\n\n proxies = JSON.parse(response.body).map do |_name, attrs|\n new({\n upstream: attrs[\"upstream\"],\n listen: attrs[\"listen\"],\n name: attrs[\"name\"],\n enabled: attrs[\"enabled\"],\n })\n end\n\n ProxyCollection.new(proxies)\n end",
"def initialize\n\n response = list\n end",
"def proxy_types; end",
"def proxy_for= value\n value = [] if value.nil?\n self.proxy_for_ = value\n end",
"def create_proxy ref\n proxy_class = @known_proxies[ref._remote_class_name]\n return ref unless proxy_class\n proxy_class.new(ReferenceCreationData.new(ref))\n end",
"def create_list(name, template, options = {}, &blk)\n\t\t\t # create the new list\n\t\t\t new_list = Lists.create_list(@web, name, template, options)\n\t\t\t context_for_new_object(new_list, ListContext, &blk)\n\t\t\tend",
"def gen_proxies sinfos\n sinfos.each { |sinfo|\n @client.add_proxies get_proxy_records(sinfo) unless has_proxy? sinfo\n }\n end",
"def initialize\n self.list = []\n end",
"def index\n @proxies = Proxy.all\n end",
"def index\n @proxies = Proxy.all\n end",
"def proxy\n @proxy ||= Proxy.new self\n end",
"def initialize(list)\n @list = list\n end",
"def initialize(list)\n @list = list\n end",
"def define_list(&block)\n @list = List::Base.new(model, &block)\n end",
"def list\n @list.dup\n end",
"def create_children_list\n return ArrayList.new\n end",
"def refresh_list!(filters = nil)\n @proxies = []\n threads = []\n\n ProxyFetcher.config.providers.each do |provider_name|\n threads << Thread.new do\n Thread.current.report_on_exception = false\n\n provider = ProxyFetcher::Configuration.providers_registry.class_for(provider_name)\n provider_filters = filters && filters.fetch(provider_name.to_sym, filters)\n provider_proxies = provider.fetch_proxies!(provider_filters)\n\n REFRESHER_LOCK.synchronize do\n @proxies.concat(provider_proxies)\n end\n end\n end\n\n threads.each(&:join)\n\n @proxies\n end",
"def add_proxy record\n return unless record\n\n proxy = generate_proxy record\n return unless proxy\n\n insert_proxy @proxies, record[:namespace], record[:server_type], proxy\n end",
"def proxy; end",
"def proxy; end",
"def proxy; end",
"def proxy_mgr\n ProxyFetcher.configure do |config|\n config.provider = %i[free_proxy_list_ssl xroxy proxy_list]\n config.proxy_validation_timeout = 15\n config.user_agent = USER_AGENT\n end\n ProxyFetcher::Manager.new\n end",
"def make_new_list\n list = {}\nend",
"def create_list(name, source, opt_in_type)\n endpoint = \"/api/#{@version}/list/create/\"\n custom_params = {\n \"name\" => name,\n \"source\" => source,\n \"opt_in_type\" => opt_in_type\n }\n make_post_request(endpoint, custom_params)\n end",
"def initialize(**options)\n if options.fetch(:refresh, true)\n refresh_list!(options.fetch(:filters, {}))\n else\n @proxies = []\n end\n\n files = Array(options.fetch(:file, options.fetch(:files, [])))\n load_proxies_from_files!(files) if files&.any?\n\n cleanup! if options.fetch(:validate, false)\n end",
"def proxies\n generate \"sufia:proxies\"\n end",
"def create_list(name, source, opt_in_type)\n endpoint = \"/api/v1/list/create/\"\n base_params = base_params(endpoint)\n custom_params = {\n \"name\" => name,\n \"source\" => source,\n \"opt_in_type\" => opt_in_type\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end",
"def insert_proxy proxies, namespace, server_type, proxy\n proxies[namespace] ||= OpenStruct.new\n proxies[namespace][server_type] = proxy\n end",
"def new_list(list_name)\n list_name = {}\nend",
"def initialize\n self.list = []\n self.refresh\n end",
"def create_list(name)\n Wunderlist::List.new(name, false, self).save\n end",
"def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end",
"def initialize (list_pointer=nil)\n\n if list_pointer.is_a?(FFI::Pointer)\n @pointer = list_pointer\n else\n @pointer = clib.tclistnew\n list_pointer.each { |e| self << e } if list_pointer\n end\n end",
"def proxy\n manager_instance(ProxyManager)\n end",
"def initialize\n @lists = []\n bootstrap\n populate\n end",
"def proxy(pattern)\n return Proxy.new(pattern, proxies)\n end",
"def create_list(name)\n path = \"lists\"\n params = { list: { name: name }}\n list = request(path, params, :post)\n list_id = list[:id]\n # output full list again\n show_list(list_id)\n end",
"def get\n return if @proxies.empty?\n\n first_proxy = @proxies.shift\n @proxies << first_proxy\n\n first_proxy\n end",
"def get\n return if @proxies.empty?\n\n first_proxy = @proxies.shift\n @proxies << first_proxy\n\n first_proxy\n end",
"def create_list\n list = {} \nend",
"def create_list\n\t{}\nend",
"def collection_proxies\n @collection_proxies ||= {}\n end",
"def proxy_set?; end",
"def create_proxy(record_har: true)\n if @server.nil?\n start_server\n end\n @record_har = record_har\n @proxy = @server.create_proxy\n self\n end",
"def set_lists\n\t\t\t@lists = @intranet.lists\n\t\tend",
"def new_from_response_data(response_data)\n object = StorageRoom.class_for_name(response_data['@type']).new.set_from_response_data(response_data)\n\n if object.is_a?(Entry) && !object.loaded? && !object.proxy?\n StorageRoom.log(\"Return #{response_data['url']} proxied\")\n Proxy.new(object)\n else\n object\n end\n end",
"def make_item_list\n end",
"def new_list\n Hash.new()\nend",
"def generate_proxy record\n res = OpenStruct.new;\n remotes = load_app_remote record[:path]\n remotes.each { |service, remote|\n res[service] = create_proxy(\n :remote => remote, :service => service, :attach => record, :proxy_cb => method(:proxy_cb)\n )\n }\n res\n end",
"def copy_list \n\n\tend",
"def link_list *property\n\tproperty.each do |p|\n\t\t\n\t\tthe_dummy_class = orientdb.allocate_class_in_ruby(\"dummy_\"+p.to_s)\n\t\tthe_dummy_class.ref_name = ref_name + \".\" + p.to_s\n\t\tsingleton_class.send :define_method, p do\n\t\t\tthe_dummy_class\n\t\tend\n\tend\n\nend",
"def to_proxy(html_node)\n ProxyFetcher::Proxy.new.tap do |proxy|\n uri = parse_proxy_uri(html_node)\n proxy.addr = uri.host\n proxy.port = uri.port\n\n proxy.type = html_node.content_at(\"li[2]\")\n proxy.anonymity = html_node.content_at(\"li[4]\")\n proxy.country = html_node.find(\"li[5]//span[@class='country']\").attr(\"title\")\n end\n end",
"def update\n @transparent_pools = []\n @anonymous_pools = []\n\n res = HTTP.get 'https://raw.githubusercontent.com/fate0/proxylist/master/proxy.list'\n raise HTTPError, \"invalid http code #{res.code}\" if res.code != 200\n\n res.body.to_s.split(\"\\n\").each {|line| _pool_parse(line)}\n end",
"def initialize_copy(list)\n @nodes = @nodes.map { |node|\n node2 = node.clone\n node2.parent = self\n node2\n }\n end",
"def initialize(list, serializer)\n @item_serializer = serializer\n @list = list.map { |obj| serializer.new(obj) }\n end",
"def initialize()\n @llist = nil\n end",
"def initialize(list)\n # build a list of OPSUrl objects to fetch\n ops_urls = list.map{|patent| OpsBiblioFamilyUrl.new(patent)}\n @hydra = PatentHydra.new(ops_urls)\n end",
"def get_list(objs)\n new_list = []\n if objs and defined? Rho::RhoConfig::sources[self.name.to_s]\n attrib_length = Rho::RhoConfig::sources[self.name.to_s]['attribs'].length\n list_length = 0\n list_length = (objs.length / attrib_length) unless attrib_length == 0\n new_obj = nil\n # iterate over the array and determine object\n # structure based on attribute/value pairs\n list_length.times do |i|\n new_obj = get_new_obj(objs[i*attrib_length])\n attrib_length.times do |j|\n # setup index and assign accessors\n idx = i*attrib_length+j\n begin\n # only update attributes if they belong\n # to the current object\n if objs[idx]['object'] == strip_braces((new_obj.send 'object'.to_sym))\n attrib = objs[idx]['attrib'].to_s\n value = objs[idx]['value'].to_s\n new_obj.send attrib.to_sym, value\n end\n rescue\n puts \"failed to reference objs[#{idx}]...\"\n end\n end\n new_list << new_obj\n end\n else\n # source attributes are not initialized, \n # try again\n RhomObjectFactory::init_sources\n end\n new_list\n end",
"def connect_through_proxy; end",
"def create_list(list)\n print_list(list)\n return list\nend",
"def proxybypasslist\r\n\t\t\t`#{BITS::BITSADMIN} /getproxybypasslist {#{@id}}`\r\n\t\tend",
"def test_list\n @builder.write_list('http://lancaster.myreadinglists.org/lists/4510B70F-7C50-D726-4A6C-B129F5EABB2C')\n end",
"def initialize(list, dir, name, max_in_memory, page_size)\n @list = list\n @file_name = File.join(dir, name + '.cache')\n @page_size = page_size\n open\n @pages = PersistentObjectCache.new(max_in_memory, max_in_memory,\n IDListPage, self)\n @page_counter = 0\n end",
"def initialize\n @items_list = []\n end",
"def get_proxy(identifier); end",
"def get_proxy(identifier); end",
"def new_list\n list = {}\n return list\nend",
"def create_list\n Hash.new()\nend",
"def deep_copy(obj)\n super\n n = obj.first\n until n.nil? do\n if n.value.is_a? Linkedlist\n k = Linkedlist.new\n self.addToList(k.deep_copy(n.value))\n else\n self.addToList(n.value)\n end\n n = n.next\n end\n return self\n end",
"def create_trip_proxy(trip)\n\n # get the planned trip for this trip\n planned_trip = trip.planned_trips.first\n \n # initailize a trip proxy from this trip\n trip_proxy = TripProxy.new\n trip_proxy.traveler = @traveler\n trip_proxy.trip_purpose_id = trip.trip_purpose.id\n trip_proxy.arrive_depart = planned_trip.is_depart\n trip_proxy.trip_date = planned_trip.trip_datetime.strftime(TRIP_DATE_FORMAT_STRING)\n trip_proxy.trip_time = planned_trip.trip_datetime.strftime(TRIP_TIME_FORMAT_STRING)\n \n # Set the from place\n trip_proxy.from_place = trip.trip_places.first\n if trip.trip_places.first.poi\n trip_proxy.from_place_selected_type = POI_TYPE\n trip_proxy.from_place_selected = trip.trip_places.first.poi.id\n elsif trip.trip_places.first.place\n trip_proxy.from_place_selected_type = PLACES_TYPE\n trip_proxy.from_place_selected = trip.trip_places.first.place.id\n else\n trip_proxy.from_place_selected_type = RAW_ADDRESS_TYPE \n end\n\n # Set the to place\n trip_proxy.to_place = trip.trip_places.last\n if trip.trip_places.last.poi\n trip_proxy.to_place_selected_type = POI_TYPE\n trip_proxy.to_place_selected = trip.trip_places.last.poi.id\n elsif trip.trip_places.last.place\n trip_proxy.to_place_selected_type = PLACES_TYPE\n trip_proxy.to_place_selected = trip.trip_places.last.place.id\n else\n trip_proxy.to_place_selected_type = RAW_ADDRESS_TYPE \n end\n \n return trip_proxy\n \n end",
"def create_list(name:)\n check_token\n list = Todoable::List.new(name: name)\n response = self.class.post(\n '/lists', body: list.post_body, headers: headers\n )\n check_and_raise_errors(response)\n attributes = response.parsed_response.merge!('items' => [])\n Todoable::List.build_from_response(attributes)\n end",
"def setup_access_list (cfg )\n @access_list = []\n for ip in @cfg[\"controller\"][\"ips_allowed\"]\n @access_list << ip_to_nip(ip)\n end\n end",
"def initialize(user: nil, pass: nil, client: nil, list: nil, name: nil)\n @client = TodoableList.initialize_client user, pass, client\n\n list = @client.request :post, LISTS_PATH, list_hash(name) if name\n\n return unless list\n @id = list['id']\n @name = list['name']\n end",
"def create_list\n list = SinglyLinkedList.new\n list.insert_at_start 1\n list.insert_at_start 2\n list.insert_at_start 3\n list.insert_at_end 4\n list.insert_at_start 4\n list.insert_at_end 5\n list\nend"
] |
[
"0.68253016",
"0.64611965",
"0.64361465",
"0.64264536",
"0.6358212",
"0.6344006",
"0.6344006",
"0.6149657",
"0.6007837",
"0.5979029",
"0.5931306",
"0.5887181",
"0.5884358",
"0.5880601",
"0.5871942",
"0.5842875",
"0.5838171",
"0.5838171",
"0.5827848",
"0.5788594",
"0.578338",
"0.5768448",
"0.57469165",
"0.574481",
"0.5727289",
"0.57187605",
"0.571234",
"0.57047045",
"0.5697567",
"0.5692232",
"0.5690756",
"0.56899863",
"0.5676314",
"0.5657778",
"0.56565",
"0.56565",
"0.5637396",
"0.56338",
"0.5629746",
"0.5619342",
"0.56178004",
"0.56061834",
"0.55733526",
"0.55708796",
"0.5561394",
"0.5561394",
"0.5561394",
"0.5543807",
"0.55072445",
"0.5498325",
"0.5497587",
"0.54924387",
"0.5489754",
"0.54574144",
"0.5453188",
"0.5449969",
"0.544419",
"0.5437227",
"0.5417326",
"0.5414013",
"0.5408473",
"0.53972805",
"0.5383372",
"0.53821564",
"0.53821564",
"0.53811705",
"0.5374222",
"0.53738236",
"0.53708273",
"0.53661877",
"0.5363755",
"0.5344619",
"0.5341676",
"0.534129",
"0.5336394",
"0.5334229",
"0.53290963",
"0.5323998",
"0.53182256",
"0.5317143",
"0.5312369",
"0.53062713",
"0.5302962",
"0.53009355",
"0.5297306",
"0.5295846",
"0.52797544",
"0.5278896",
"0.52660567",
"0.5264613",
"0.52620864",
"0.52620864",
"0.5255007",
"0.5254528",
"0.52527195",
"0.5251641",
"0.5243324",
"0.5236148",
"0.5236134",
"0.5224892"
] |
0.560131
|
42
|
Class to search for resources, defined resources and classes
|
def search_class(module_name)
file_array = module_name.split('::')
#search module path for the class
$mod_dir.each do |y|
if File.directory?("#{y}/#{file_array[0]}")
@filename = "#{y}/#{file_array[0]}"
break
end
end
#did we find the class?
if defined? @filename
@filename = "#{@filename}/manifests"
#if base case make the path correct, else fill out the whole path with sub classes
if file_array.count == 1
@filename = "#{@filename}/init"
else
file_array.shift
file_array.each do |k|
@filename = "#{@filename}/#{k}"
end
end
@filename = "#{@filename}.pp"
else
#Error if class cannot be found
puts "Cannot find class"
return 0
end
#Determine if the file actually exists
if not File.exists?(@filename)
puts "No such class"
return 1
end
#Read the file
f = File.open(@filename,'r')
g =f.readlines
#loop through the lines and find recourses and included classes
g.each do |val|
# find resources
if n = val.match(/^[ \t]*[a-z:].*{[ \t]*['\"].*['\"]:/)
out_val = n[0].sub(/"/,"'").gsub(/\s+/,"")
#Determine if we have a duplicate resource and display if we do
if $resource_variables.has_key?(out_val)
puts "\n******** DEPLICATE FOUND! ********"
$resource_variables[out_val] = $resource_variables[out_val].push(module_name)
puts "#{out_val} defined in these classes: #{$resource_variables[out_val]}"
else
#Add resource to hash with name of containing class
$resource_variables[out_val] = [module_name]
end
next
end
# find included classes
if m = val.match(/^[ \t]*include[ \t]*.*/)
out_val = m[0]
x = m[0].gsub(/^[ \t]*include[ \t]/,'')
#if class is not in our array add it and then call this class to iterate that included class
if not $include_variables.include?(x)
$include_variables.push(x.strip)
search_class(x)
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def scan_resources!\n @resources = @lookups[:_default] = {}\n @resource_arguments = {}\n \n @default_order = []\n Dir[@resource_class.glob].each do |path|\n @default_order << basename = File.basename(path)\n \n @resource_arguments[basename] = resource_arguments = @resource_class.scan_file(path)\n\n instantiate_resource!(basename,resource_arguments)\n end\n end",
"def find_resources(&block)\n found = Varnisher::Urls.new\n\n self.class.resources.each do |resource|\n found += find_resource(resource, &block)\n end\n\n Varnisher.log.debug ''\n Varnisher.log.info \"#{found.length} total resources found.\\n\"\n\n found\n end",
"def find_resource(obj)\n\n\n\n resources.detect do |r|\n\n\n\n r.resource_name.to_s == obj.to_s || r.resource_class.to_s == obj.to_s\n\n\n\n end ||\n\n\n\n if obj.respond_to? :base_class\n\n\n\n resources.detect{ |r| r.resource_class.to_s == obj.base_class.to_s }\n\n\n\n end\n\n\n\n end",
"def resources options={}\n @resources ||= find_resources options\n end",
"def resources\n @resources ||= if options[:resources]\n options[:resources]\n elsif options[:search]\n if options[:search].is_a?(String)\n options[:search] = Rack::Utils.parse_nested_query(options[:search])\n end\n\n model.ransack(options[:search]).result\n else\n model.all\n end\n end",
"def find_resources(type)\n resource_collection.all_resources.select do |resource|\n resource_name(resource) == type.to_sym\n end\n end",
"def resources(*args)\n run_context.resource_collection.find(*args)\n end",
"def find_resource str\n resources.find{|rsc_klass| rsc_klass.to_s == str }\n end",
"def get_json_searchers\n Dir[File.expand_path(File.join(ROOT_PATH, 'resources','*.json'))].inject({}) do |json_searchers, file_path|\n json_searcher = JsonSearcher.new(file_path: file_path) rescue nil\n json_searchers[json_searcher.name] = json_searcher if json_searcher\n json_searchers\n end\n end",
"def resource_class\n resource_finder.is_a?(Class) ? resource_finder : resource_finder.name.classify.constantize\n end",
"def ar_retrieve_resources\n run_callbacks :ar_retrieve_resources do\n if params[:_search]\n # Fulltext search\n\n @resources = ar_model.search(params[:_search])\n @resources_count = @resources.count\n else\n intf = ar_model.interfaces[:rest]\n\n @resources_relation ||= ar_model.all\n\n # Authorization\n if intf.authorization_required?\n @resources_relation = @resources_relation.with_capability(aaa_context)\n end\n\n @authorized_resources_relation = @resources_relation\n\n # Filters\n @resources_relation = apply_scopes_to_relation(@resources_relation)\n @resources_relation = apply_json_filter_to_relation(@resources_relation)\n @resources_relation = apply_simple_filter_to_relation(@resources_relation)\n\n # Display filters\n @resources_relation = apply_sorting_to_relation(@resources_relation)\n @paginated_resources_relation = apply_pagination_to_relation(@resources_relation)\n\n @resources = @paginated_resources_relation\n @resources_count = @resources_relation.count\n end\n end\n\n @resources\n rescue ActiveRecord::RecordNotFound => e\n raise Exception::NotFound.new(e.message,\n :retry_possible => false)\n end",
"def _search options\n if params[:q].blank? #or params[:q]==\"undefined\"\n parent? ? parent.send(resource_name) : (resource_class.nil? ? nil : find_all_resources(options))\n else\n find_resources_queried options\n end\n end",
"def resource\n klass, param = resource_class\n klass&.find(params[param.to_sym])\n end",
"def find_resources options\n\n # return [] unless resource_class.ancestors.include? ActiveRecord::Base\n params[:ids] ||= []\n params[:ids] << params[:id] unless params[:id].nil?\n\n if params[:ids].compact.any?\n policy_scope(resource_class).where(id: params[:ids].compact.split(\",\").flatten)\n else\n # search\n r = _search options\n\n # filter\n r = _filter r, options\n\n # sort\n r = _sort r, options\n\n # paginate\n r = _paginate r\n\n # (params[:format].nil? or params[:format]=='html') ? r.page(params[:page]).per(params[:perpage]) : r\n end\n end",
"def find\r\n scanner = DirectoryScanner.new\r\n scanner.setBasedir(@context.root)\r\n scanner.setCaseSensitive(false)\r\n scanner.setIncludes(@includes.to_java :String) unless @includes.empty?\r\n scanner.setExcludes(@excludes.to_java :String) unless @excludes.empty?\r\n scanner.scan\r\n scanner.included_files.collect{|f| @context.filepath_from_root(f) }\r\n end",
"def matching_resources(env)\n @resources.find_all { |resource| resource.match!(env) }\n end",
"def resources(type, path)\n Resources.new(self, path, type)\n end",
"def findMappedResource(resources)\n obj=nil\n resources.each { |uri|\n if uri\n case uri.scheme\n when \"file\"\n file=uri.path\n if File.exists?(file)\n obj=File.open(file)\n end\n when \"http\"\n resp=Net::HTTP.get_response(uri)\n obj=resp.body if resp.code==\"200\"\n end\n if obj\n print \"found mapped resource #{uri}\\n\"\n break\n end\n end\n }\n obj\nend",
"def resources()\n end",
"def resource_for(klass)\n resources[klass]\n end",
"def initialize_resources_class_accessors! #:nodoc:\n\n\n # First priority is the namespaced model, e.g. User::Group\n self.resource_class ||= begin\n namespaced_class = self.name.sub(/Controller/, '').singularize\n namespaced_class.constantize\n rescue NameError\n nil\n end\n\n\n\n # Second priority is the top namespace model, e.g. EngineName::Article for EngineName::Admin::ArticlesController\n self.resource_class ||= begin\n namespaced_classes = self.name.sub(/Controller/, '').split('::')\n namespaced_class = [namespaced_classes.first, namespaced_classes.last].join('::').singularize\n namespaced_class.constantize\n rescue NameError\n nil\n end\n\n\n\n # Third priority the camelcased c, i.e. UserGroup\n self.resource_class ||= begin\n camelcased_class = self.name.sub(/Controller/, '').gsub('::', '').singularize\n camelcased_class.constantize\n rescue NameError\n nil\n end\n\n\n\n # Otherwise use the Group class, or fail\n self.resource_class ||= begin\n class_name = self.controller_name.classify\n class_name.constantize\n rescue NameError => e\n raise unless e.message.include?(class_name)\n nil\n end\n\n\n\n self.resource_instance_name = self.controller_name.singularize.to_sym #test_name\n\n self.collection_name = self.controller_name.to_sym\n\n\n\t\tself.resource_name = resource_class.to_s\n\n end",
"def lookup_resource(type, name, run_context)\n begin\n run_context.resource_collection.find(\"#{ type }[#{ name }]\")\n rescue ArgumentError => e\n puts \"You provided invalid arugments to resource_collection.find: #{ e }\"\n rescue RuntimeError => e\n puts \"The resources you searched for were not found: #{ e }\"\n end\n end",
"def initialize_resources_class_accessors! #:nodoc:\n # First priority is the namespaced model, e.g. User::Group\n self.resource_class ||= begin\n namespaced_class = self.name.sub(/Controller$/, '').singularize\n namespaced_class.constantize\n rescue NameError\n nil\n end\n\n # Second priority is the top namespace model, e.g. EngineName::Article for EngineName::Admin::ArticlesController\n self.resource_class ||= begin\n namespaced_classes = self.name.sub(/Controller$/, '').split('::')\n namespaced_class = [namespaced_classes.first, namespaced_classes.last].join('::').singularize\n namespaced_class.constantize\n rescue NameError\n nil\n end\n\n # Third priority the camelcased c, i.e. UserGroup\n self.resource_class ||= begin\n camelcased_class = self.name.sub(/Controller$/, '').gsub('::', '').singularize\n camelcased_class.constantize\n rescue NameError\n nil\n end\n\n # Otherwise use the Group class, or fail\n self.resource_class ||= begin\n class_name = self.controller_name.classify\n class_name.constantize\n rescue NameError => e\n raise unless e.message.include?(class_name)\n nil\n end\n\n self.parents_symbols = self.parents_symbols.try(:dup) || []\n\n # Initialize resources configuration hash\n self.resources_configuration = self.resources_configuration.try(:dup) || {}\n self.resources_configuration.each do |key, value|\n next unless value.is_a?(Hash) || value.is_a?(Array)\n self.resources_configuration[key] = value.dup\n end\n\n config = (self.resources_configuration[:self] ||= {})\n config[:collection_name] = self.controller_name.to_sym\n config[:instance_name] = self.controller_name.singularize.to_sym\n\n config[:route_collection_name] = config[:collection_name]\n config[:route_instance_name] = config[:instance_name]\n\n # Deal with namespaced controllers\n namespaces = self.controller_path.split('/')[0..-2]\n\n # Remove namespace if its a mountable engine\n namespaces.delete_if do |namespace|\n begin\n \"#{namespace}/engine\".camelize.constantize.isolated?\n rescue StandardError, LoadError\n false\n end\n end\n\n config[:route_prefix] = namespaces.join('_').to_sym unless namespaces.empty?\n\n # Deal with default request parameters in namespaced controllers, e.g.\n # Forum::Thread#create will properly pick up the request parameter\n # which will be forum_thread, and not thread\n # Additionally make this work orthogonally with instance_name\n config[:request_name] = self.resource_class.to_s.underscore.gsub('/', '_')\n\n # Initialize polymorphic, singleton, scopes and belongs_to parameters\n polymorphic = self.resources_configuration[:polymorphic] || { symbols: [], optional: false }\n polymorphic[:symbols] = polymorphic[:symbols].dup\n self.resources_configuration[:polymorphic] = polymorphic\n end",
"def scrape_resources(opts = {})\n BBLib::HashStruct.new.tap do |hash|\n resources.each do |resource|\n hash[resource.name] = resource.retrieve(opts)\n end\n end\n end",
"def load_resources\n resource_path = File.join(File.dirname(__FILE__), \"resources\")\n Similar.load_all_ruby_files_from_path(resource_path)\n end",
"def find_resource\n set_resource_ivar class_name.find(params[:id])\n end",
"def resources\n @resources ||= {}\n end",
"def find_resource(resource, &block)\n found = Varnisher::Urls.new\n\n @doc.css(resource.selector).each do |e|\n attribute = e[resource.attribute]\n\n Varnisher.log.debug(\"Found resource: #{attribute}\")\n\n yield attribute if block_given?\n found << attribute\n end\n\n found\n end",
"def generic_resource( unit )\n resources unit, concerns: [:search_suggestion, :uniqueness_validation, :retrieve_resource]\n end",
"def load_enclosing_resources\n specifications.each_with_index do |spec, idx|\n case spec\n when '*' then load_wildcards_from(idx)\n when /^\\?(.*)/ then load_wildcard($1)\n else load_enclosing_resource_from_specification(spec)\n end\n end\n end",
"def resources\n @resources = {\n :lumber => Lumber.new,\n :clay => Clay.new,\n :iron => Iron.new,\n :crop => Crop.new\n } if @resources.nil?\n return @resources\n end",
"def check_ferret\n if NilClass === self.ferret.enabled && (defined?(::Ferret) != nil) \n # Look for a search action relative to a collection of resources.\n search_route_present= @res.collection_methods.values.flatten.include? :search # << Resource class of Rails\n self.ferret.enabled= search_route_present && resource.model.respond_to?(:find_by_contents)\n end\n \n if self.ferret.enabled\n defaults= { \n :search_limit => :all \n }\n (self.ferret.options||={}).reverse_merge!(defaults)\n else\n self.links.delete :search\n self.methods.delete :search\n end\n end",
"def find_all_resources(resource_descr, resource_type, authorizer)\n debug \"find_resources: descr: '#{resource_descr.inspect}'\"\n if resource_descr.kind_of? Hash\n can_handle = eval(\"OMF::SFA::Model::#{resource_type.classify}\").respond_to? :handle_rest_get_resource\n if can_handle\n cls = eval(\"OMF::SFA::Model::#{resource_type.classify}\")\n resources = cls.handle_rest_get_resource(resource_descr)\n else\n resources = eval(\"OMF::SFA::Model::#{resource_type.classify}\").where(resource_descr)\n end\n else\n raise FormatException.new \"Unknown resource description type '#{resource_descr.class}' (#{resource_descr})\"\n end\n\n # raise UnknownResourceException.new \"Resource '#{resource_descr.inspect}' is not available or doesn't exist\" if resources.nil? || resources.empty?\n raise UnknownResourceException.new \"Resource '#{resource_descr.inspect}' is not available or doesn't exist\" if resources.nil?\n\n resources.map do |r|\n begin\n raise InsufficientPrivilegesException unless authorizer.can_view_resource?(r)\n r\n rescue InsufficientPrivilegesException\n nil\n end\n end.compact\n end",
"def find_resource\n get params[:resource_path]\n end",
"def find_resource resource, conditions\n klass, instance = parse_resource_args resource\n conditions = conditions.to_hash_from_story unless (conditions.is_a? Hash)\n klass.find(:first, :conditions => conditions)\nend",
"def resource_class\n @resource_class ||= begin\n resource_parts = params[:namespaces] ? params[:namespaces].split('/') : []\n resource_parts << params[:resource_name]\n resource_parts.map(&:classify).join('::').constantize\n end\n end",
"def get_all(klass = nil, search_params = {})\n replies = get_all_bundles(klass, search_params)\n return nil unless replies\n resources = []\n\t\treplies.each do |reply|\n resources.push(reply.entry.collect{ |singleEntry| singleEntry.resource })\n end\n resources.compact!\n resources.flatten(1)\n\tend",
"def resources\n instance_variable_get(\"@#{resources_name}\")\n end",
"def find_resource(type, name, created_at: nil, run_context: self.run_context, &resource_attrs_block)\n find_resource!(type, name, run_context: run_context)\n rescue Chef::Exceptions::ResourceNotFound\n if resource_attrs_block\n declare_resource(type, name, created_at: created_at, run_context: run_context, &resource_attrs_block)\n end # returns nil otherwise\n end",
"def resource_finder\n case finder = crudify_options[:finder]\n when Symbol : send(finder)\n when Proc : instance_exec(&finder)\n else self.class.read_inheritable_attribute(:resource_class) || self.class.controller_name.classify.constantize\n end\n end",
"def method_missing(name, *args, &block)\n if args.empty? and resources and resources.has_resource?(name)\n resources[name]\n else\n super(name, *args, &block)\n end\n end",
"def resources\n Loader.resources.keys\n end",
"def resource(name)\n name = name.to_sym\n\n resource_info = RESOURCES[name]\n if resource_info.nil?\n raise ArgumentError, sprintf('No resource found with name %s', name)\n end\n\n require_path = sprintf(RESOURCE_PATH, @path_version, resource_info[0],\n resource_info[1])\n require require_path\n\n class_path = RESOURCE_CLASS_PATH\n class_path = COMMON_CLASS_PATH if resource_info.first == 'common'\n class_path = SERVICE_CLASS_PATH if resource_info.first == 'services'\n class_path = sprintf(class_path, @version, resource_info[2])\n return class_for_path(class_path)\n end",
"def find(path, type, setting); end",
"def find_resource(type, name)\n begin\n return resource_collection.lookup(\"#{type}[#{name}]\")\n rescue Chef::Exceptions::ResourceNotFound; end\n\n resource_collection.all_resources.find do |resource|\n resource_name(resource) == type && (name === resource.identity || name === resource.name)\n end\n end",
"def resource_query\n resource_class\n end",
"def find_all\n Regulate::Git::Interface.find_all.collect do |resource_data|\n self.new_from_git( resource_data )\n end\n end",
"def subclass_resource_equivalents\n @subclass_resource_names ||= [resource_name.to_sym]\n end",
"def find_or_build_resource(resource_class, options)\n resources.add Resource.new(self, resource_class, options)\n end",
"def each_resource(&block)\n Chef::Resource.constants.each do |res_class_name|\n res_class = Chef::Resource.const_get(res_class_name)\n next unless res_class.is_a?(Class) && res_class < Chef::Resource\n res_name = @recipe.convert_to_snake_case(res_class_name.to_s)\n block.call(res_name, res_class)\n end\n end",
"def find_by_keys(keys, options = {})\n records = find_records_by_keys(keys, options)\n resources_for(records, options[:context])\n end",
"def resources\n @resources ||= []\n end",
"def resource(name, &block)\n # It creates a new class based on the resource name scoped tot he Scrumy module\n klass = Scrumy::Models.const_set(name.to_s.classify, Class.new(Scrumy::Models::Model))\n # Then executes the block on the class. The class provides several class\n # methods for making instances behave correctly.\n klass.class_exec &block\nend",
"def resources\n @resources ||= Resources.new\n if block_given?\n yield(@resources)\n end\n @resources\n end",
"def get_resources\n init_folder unless @init # have I been initialized?\n return @resources \n end",
"def resource(*resources, &block); end",
"def resource_klass\n @resource_klass ||= JsonApi::Resources::Discovery\n .resource_for_name object,\n resource_class: @resource_class\n end",
"def initialize(resources, options={})\n @root = self.class.root(options[:root]) || Dir.pwd\n @data = []\n\n @resources = [resources].flatten.compact\n @resources << '.ruby' if canonical?\n\n @resources.each do |source|\n case File.basename(source)\n when CANONICAL_FILENAME\n if canonical?\n if defined?(::DotRuby)\n @data << DotRuby::Spec.find(root) #(CANONICAL_FILENAME)\n else\n @data << YAML.load_file(canonical_file)\n end\n end\n when /\\.gemspec$/\n require 'erbside/gemspec'\n @data << ::Gem::Specification.load(source)\n when /\\.ya?ml$/\n @data << YAML.load_file(source)\n else\n if File.directory?(source)\n @data << load_metadir(source)\n else\n # now what ?\n end\n end\n end\n\n @cache = {}\n end",
"def find_all_resources options\n policy_scope(resource_class)\n end",
"def resource_get class_name, resource_name\n\t\t\tpath = \"#{class_to_basefile(class_name)}.#{resource_name}\"\n\t\t\tdata, readed = nil, false\n\t\t\tif File.exist? path\n\t\t\t\tdata = File.read path\n\t\t\t\treaded = true\n\t\t\telse\n\t\t\t\tpath = \"#{class_to_basefile(class_name)}.res/#{resource_name}\"\n\t\t\t\tif File.exist? path\n\t\t\t\t\tdata = File.read path\n\t\t\t\t\treaded = true\n\t\t\t\tend\n\t\t\tend\n\t\t\traise Resource::NotExist unless readed\t\t\t\t\t\n\t\t\treturn data\n\t\tend",
"def resource_exist? klass, resource_name\n\t\t\t\t@monitor.synchronize do\n\t\t\t\t\tproviders.any? do |p|\n\t\t\t\t\t\tnext unless p.class_exist?(klass.name)\n\t\t\t\t\t\tp.resource_exist? klass.name, resource_name\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"def resources\n instance_variable_get(\"@#{mapping.plural}\")\n end",
"def scan_files\n raise \"scan_files must be redefined in children classes\"\n end",
"def resources; end",
"def resources; end",
"def resources_by_type(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each{|resource| result[resource_type(resource)] << resource}\n result\n end",
"def resources_by_type(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each{|resource| result[resource_type(resource)] << resource}\n result\n end",
"def find_resources(ast, options = {})\n options = {:type => :any}.merge!(options)\n return [] unless ast.respond_to?(:xpath)\n scope_type = ''\n scope_type = \"[@value='#{options[:type]}']\" unless options[:type] == :any\n # XXX: include nested resources (provider actions)\n no_actions = \"[command/ident/@value != 'action']\"\n ast.xpath(\"//method_add_block[command/ident#{scope_type}]#{no_actions}\")\n end",
"def resources &block\n rc = components.collect do |resource_name, component|\n [resource_name.to_s.singularize.to_sym, component[:resource], component.slice(:title, :exclude, :namespace)]\n end\n last = rc.slice!(-1)\n parents = rc.inject(Hash.new){|p, v| p.merge!(v[0]=>v[1])}\n yield(parents, last[0], last[2])\n end",
"def resource_class\n\n ActiveSupport::Dependencies.constantize(resource_class_name)\n\n end",
"def find_resource\n @resource = resource_class.find(params[:id])\n end",
"def resources\n typed_set(entities, Occi::Core::Resource)\n end",
"def resource_class\n \t@resource_class ||= get_resource_class\n end",
"def resources_by_type(ast)\n raise_unless_xpath!(ast)\n result = Hash.new{|hash, key| hash[key] = Array.new}\n find_resources(ast).each do |resource|\n result[resource_type(resource)] << resource\n end\n result\n end",
"def find_resource!(type, name, run_context: self.run_context)\n raise ArgumentError, \"find_resource! does not take a block\" if block_given?\n\n run_context.resource_collection.find(type => name)\n end",
"def find_associated_resources(resource_descr, resource_type, target_type, authorizer)\n debug \"find_associated_resources: descr: '#{resource_descr.inspect}'\"\n source_resource = nil\n target_resources = nil\n if resource_descr.kind_of? OMF::SFA::Model::Resource\n source_resource = resource_descr\n elsif resource_descr.kind_of? Hash\n model = eval(\"OMF::SFA::Model::#{resource_type.camelize}\")\n if resource_descr[:or]\n source_resource = nil\n resource_descr[:or].keys.each do |key|\n if source_resource.nil?\n source_resource = model.where({key => resource_descr[:or][key]})\n else\n source_resource = source_resource.or({key => resource_descr[:or][key]})\n end\n end\n else\n source_resource = model.where(resource_descr)\n end\n source_resource = source_resource.first\n if source_resource.kind_of? OMF::SFA::Model::Account and target_type.to_s.pluralize == 'leases'\n target_resources = []\n source_resource.resources.each { |res|\n if res.resource_type == 'lease'\n target_resources << res\n end\n }\n elsif !source_resource.nil? and source_resource.class.method_defined?(target_type)\n target_resources = source_resource.send(target_type)\n else\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Invalid URL.\"\n end\n else\n raise FormatException.new \"Unknown resource description type '#{resource_descr.class}' (#{resource_descr})\"\n end\n unless source_resource\n raise UnknownResourceException.new \"Resource '#{resource_descr.inspect}' is not available or doesn't exist\"\n end\n raise InsufficientPrivilegesException unless authorizer.can_view_resource?(source_resource)\n return source_resource, target_resources\n end",
"def index\n if current_user.role?(:admin)\n if params[:search]\n @resources = Resource.search(params[:search]).paginate(:page => params[:page]).per_page(10)\n elsif params[:resource]\n @resources = Resource.tagged_with(params[:resource][:tagged_with]).paginate(:page => params[:page]).per_page(10)\n else\n @resources = Resource.all.paginate(:page => params[:page]).per_page(10)\n end\n else\n if params[:search]\n @resources = Resource.search(params[:search]).active.paginate(:page => params[:page]).per_page(10)\n elsif params[:resource]\n @resources = Resource.tagged_with(params[:resource][:tagged_with]).active.paginate(:page => params[:page]).per_page(10)\n else\n @resources = Resource.active.paginate(:page => params[:page]).per_page(10)\n end\n end\n end",
"def find_resources_queried options\n case params[:f]\n when nil\n if parent?\n policy_scope(resource_class).tags_included?( params[:q].split(\" \") ).where( options )\n else\n policy_scope(resource_class).tags_included?( params[:q].split(\" \") )\n end\n else\n policy_scope(resource_class)\n end\n end",
"def get_resource_intersection(resources = nil, klasses = nil, profiles = nil)\n resources = coerce_to_a(resources)\n klasses = coerce_to_a(klasses)\n profiles = coerce_to_a(profiles)\n\n if blank?(resources)\n resources = get_all_resources(klasses)\n elsif !blank?(klasses)\n resources.select!{ |resource| klasses.include?(resource.class) }\n end\n unless blank?(profiles)\n resources.select!{ |resource| !blank?(profiles & ((resource.meta.nil? || blank?(resource.meta.profile)) ? [] : resource.meta.profile)) }\n end\n\n resources\n end",
"def resources(opts={})\n Tripod::ResourceCollection.new(\n self.resource_class._resources_from_sparql(self.as_query(opts)),\n # pass in the criteria that was used to generate this collection, as well as whether the user specified return graph\n :return_graph => (opts.has_key?(:return_graph) ? opts[:return_graph] : true),\n :criteria => self\n )\n end",
"def resources\n @resources ||= process_data(decoded_body[resources_key])\n end",
"def catalog_resources\n # This method exists to supply a common interface to the puppet catalog\n # for different versions of puppet.\n @catalog.resources.map do |r|\n if r.is_a?(String)\n # puppet 0.25 and older\n resource(r)\n elsif r.is_a?(Puppet::Resource)\n # puppet 2.6 and newer\n r\n else\n raise \"Unknown resource object #{r.class}\"\n end\n end\n end",
"def get_resources(url, resource_class, params={})\n get(url, params).map do |result|\n resource_class.from_hash(result, client: self)\n end\n end",
"def get_resource_class\n \tresource_name.classify.constantize\n end",
"def resource_class\n\t\t\t\t@resource_class ||= resource_name.classify.constantize\n\t\t\tend",
"def resource_class\n @resource_class ||= resource_name.classify.constantize\n end",
"def find\n @logger.info(\"searching in sources: #{@names}\")\n @sources.flat_map { |name, source| source.find }\n #File.open(\"/tmp/images.yaml\", \"r\") do |file|\n # return YAML::load(file)\n #end\n end",
"def find_resources(with_current_resource=true)\n ary = nil\n case depth\n when 0\n ary = []\n when 1\n ary = resource.children\n else\n ary = resource.descendants\n end\n with_current_resource ? [resource] + ary : ary\n end",
"def find_resource_entry(filename, opts={}, seen=nil)\n extname = File.extname(filename)\n rootname = filename.gsub(/#{extname}$/,'')\n entry_extname = entry_rootname = nil\n\n ret = entries_for(:resource, opts.merge(:hidden => :none)).reject do |entry|\n entry_extname = File.extname(entry.filename)\n entry_rootname = entry.filename.gsub(/#{entry_extname}$/,'')\n\n ext_match = (extname.nil? || extname.size == 0) || (entry_extname == extname)\n !(ext_match && (/#{rootname}$/ =~ entry_rootname))\n end\n\n ret = ret.first\n\n if ret.nil?\n seen = Set.new if seen.nil?\n seen << self\n all_required_bundles.each do |bundle|\n next if seen.include?(bundle) # avoid recursion\n ret = @bundle.find_resource_entry(filename, opts, seen)\n return ret unless ret.nil?\n end\n end\n return ret\n end",
"def search *paths\n ns = paths.last.is_a?(Hash) ? paths.pop : {}\n xpath(*(paths.map { |path|\n path =~ /^(\\.\\/|\\/)/ ? path : CSS.xpath_for(path, :prefix => \".//\")\n }.flatten.uniq) + [ns])\n end",
"def resources\n collection = Miasma::Models::Orchestration::Stack::Resources.new(self)\n collection.define_singleton_method(:perform_population) do\n valid = stack.sparkleish_template.fetch(:resources, {}).keys\n stack.custom[:resources].find_all { |r| valid.include?(r[:name]) }.map do |attrs|\n Miasma::Models::Orchestration::Stack::Resource.new(stack, attrs).valid_state\n end\n end\n collection\n end",
"def resource_map\n return @resource_map if @resource_map\n @resource_map = YAML::load(File.read(yaml_path)) if File.file?(yaml_path)\n @resource_map = {} if @resource_map.nil?\n subdirectories.each do |resource_name|\n resource_name = resource_name_for_path(resource_name)\n begin\n if @resource_map.key?(resource_name)\n @resource_map[resource_name] = @resource_map[resource_name].constantize\n else\n class_name = resource_name.singularize.camelize\n Divinity.system_logger.debug \"[#{content_module_name}] \" +\n \"Dynamically mapping resource hook '#{resource_name}' to class #{class_name}\"\n @resource_map[resource_name] = class_name.constantize\n end\n rescue NameError\n raise Errors::ResourceMapping, \"[#{content_module_name}] \" +\n \"Couldn't map #{resource_name} to #{class_name}; you probably need an entry in resource_map.yml\"\n end\n end\n @resource_map\n end",
"def find(interface, rs_or_rq = RS)\r\n # if the interface is not specified, return false\r\n if !interface then\r\n return nil\r\n end\r\n # check the existence of the base_dir\r\n if !FileTest.directory?(base_dir) then\r\n return nil\r\n end\r\n # scan the response file in the directory\r\n dir_list = [base_dir]\r\n until dir_list.empty?\r\n # get the dir from the list\r\n current_dir = dir_list.shift\r\n current_dir << \"/\" unless current_dir[-1].chr == \"/\"\r\n # begin to traversa this dir, if find, reuslt will be the path, otherwise nil\r\n result = Dir.foreach(current_dir) do |child|\r\n # exclude the ., .., svn, web-inf\r\n next if child == \".\" || child == \"..\" || child.include?(\"\\.svn\") || child.include?(\"WEB-INF\")\r\n # form the path\r\n @status_bar.set_status_text(child_path = current_dir + child)\r\n \r\n if FileTest.directory?(child_path) then\r\n dir_list.push(child_path)\r\n next\r\n end\r\n \r\n if FileTest.file?(child_path) && child_path.downcase.include?(interface.downcase) && child_path.include?(rs_or_rq) then\r\n break child_path\r\n else\r next\r\n end\r\n end\r\n # if find break the loop\r\n break result if result\r\n end\r\n end",
"def resource_set klass, resource_name, data\n\t\t\t\t@monitor.synchronize do\n\t\t\t\t\textension = File.extname(resource_name)\n\t\t\t\t\tif @resource_extensions.include? extension\n\t\t\t\t\t\tload, save = @resource_extensions[extension]\n\t\t\t\t\t\tdata = save.call data, klass, resource_name\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tfound = false\n\t\t\t\t\tproviders.each do |p|\n\t\t\t\t\t\tnext unless p.class_exist?(klass.name)\n\t\t\t\t\t\tp.resource_set klass.name, resource_name, data\n\t\t\t\t\t\tfound = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\traise \"Class '#{klass.name}' doesn't exist!\" unless found\n\t\t\t\tend\n\t\t\tend",
"def scrape_resources(topic)\n \n #The query parameters: (update according to your search query)\n q = \"#{topic.name}\"; #the search query\n pageNumber = 1 #the number of requested page\n pageSize = WebScraperOptions[:numSearchResults] #the size of a page\n autoCorrect = false #autoCorrectspelling\n safeSearch = true #filter results for adult content\n \n response = Unirest.get \"https://contextualwebsearch-websearch-v1.p.rapidapi.com/api/Search/WebSearchAPI?q=#{q}&pageNumber=#{pageNumber}&pageSize=#{pageSize}&autoCorrect=#{autoCorrect}&safeSearch=#{safeSearch}\",\n headers:{\n \"X-RapidAPI-Key\" => Contextual_Web_Search_Key\n }\n \n resources = []\n \n #Go over each resulting item\n response.body[\"value\"].each do |webPage|\n \n #Get the web page metadata \n url = webPage[\"url\"]\n \n # Removes html tags from title and titleizes the string.\n title = ActionView::Base.full_sanitizer.sanitize(webPage[\"title\"])\n title = title.titleize\n \n # Removes html tags from excerpt\n excerpt = ActionView::Base.full_sanitizer.sanitize(webPage[\"description\"]).truncate(200)\n \n # User with id of 2 is the web scraper.\n content = { link: url, video: \"\", text: \"\", excerpt: excerpt }\n res = Resource.new(name: title, content: content.to_json, topic_id: topic.id, user_id: 2) \n if res.save \n resources << res \n else \n raise 'Resource could not be saved!'\n end \n end \n resources \n end",
"def get_all_resources(klasses = nil)\n replies = get_all_replies(klasses)\n return nil unless replies\n resources = []\n replies.each do |reply|\n resources.push(reply.resource.entry.collect{ |singleEntry| singleEntry.resource })\n end\n resources.compact!\n resources.flatten(1)\n end",
"def resource_class\n @resource_class ||= resource_name.classify.constantize\n end",
"def resource_class\n @resource_class ||= resource_name.classify.constantize\n end",
"def resource_class\n @resource_class ||= resource_name.classify.constantize\n end",
"def find_by_name\n not_found and return if params[:id].blank?\n\n name = controller_name.singularize\n cond = \"find\" + (params[:id] =~ /\\A\\d+(-.+)?\\Z/ ? \"\" : \"_by_name\")\n not_found and return unless instance_variable_set(\"@#{name}\", resource_base.send(cond, params[:id]))\n end"
] |
[
"0.75339663",
"0.70749015",
"0.6743215",
"0.6685208",
"0.65334034",
"0.64840454",
"0.6455106",
"0.6322176",
"0.62777454",
"0.62701464",
"0.6268375",
"0.62310356",
"0.6178581",
"0.61498725",
"0.6109765",
"0.6104165",
"0.6092178",
"0.60591173",
"0.59949684",
"0.59887385",
"0.59857684",
"0.5955243",
"0.5947709",
"0.5947304",
"0.5933421",
"0.5920562",
"0.5909929",
"0.5891239",
"0.58756965",
"0.5865401",
"0.5826491",
"0.5813855",
"0.578339",
"0.5781031",
"0.5779977",
"0.5773566",
"0.5756416",
"0.57561255",
"0.5723635",
"0.57126576",
"0.5705744",
"0.5704068",
"0.56960255",
"0.56918013",
"0.56885815",
"0.5679775",
"0.5677319",
"0.5656468",
"0.56530654",
"0.56524813",
"0.5630691",
"0.56265074",
"0.5622234",
"0.56191295",
"0.5618376",
"0.5600045",
"0.55914897",
"0.5585641",
"0.5580953",
"0.5578517",
"0.557231",
"0.5571267",
"0.55704445",
"0.5569068",
"0.5569068",
"0.5567862",
"0.5567862",
"0.55656856",
"0.5559955",
"0.5559422",
"0.5556436",
"0.5553562",
"0.5545376",
"0.5534299",
"0.5530763",
"0.5525825",
"0.55248374",
"0.551179",
"0.55000216",
"0.54936135",
"0.54917145",
"0.5481271",
"0.5480937",
"0.54705095",
"0.54412127",
"0.54411256",
"0.54358065",
"0.5434592",
"0.54277945",
"0.54273057",
"0.5424831",
"0.54241383",
"0.5422508",
"0.5420563",
"0.5418637",
"0.541206",
"0.54105616",
"0.54105616",
"0.54105616",
"0.54069126"
] |
0.58502686
|
30
|
Internal methods (don't use).
|
def selected(monitor)
if monitor.closed?
@reactor.deregister(@server)
return
end
if monitor.readable?
@klass.new({:reactor => @reactor, :socket => monitor.io.accept_nonblock})
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def internal; end",
"def probers; end",
"def schubert; end",
"def implementation; end",
"def implementation; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def refutal()\n end",
"def wrapper; end",
"def internal?; end",
"def handle; end",
"def operations; end",
"def operations; end",
"def private_method\n end",
"def custom; end",
"def custom; end",
"def used?; end",
"def tell()\n #This is a stub, used for indexing\n end",
"def weber; end",
"def suivre; end",
"def identify; end",
"def anchored; end",
"def processor; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def final; end",
"def original; end",
"def r; end",
"def r; end",
"def isolated; end",
"def isolated; end",
"def internship_passed; end",
"def berlioz; end",
"def pausable; end",
"def initialize() end",
"def stderrs; end",
"def trd; end",
"def loc; end",
"def loc; end",
"def loc; end",
"def terpene; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; 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 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 next() end",
"def next() end",
"def extra; end",
"def from; end",
"def from; end",
"def from; end",
"def from; end",
"def sitemaps; end",
"def operation; end",
"def same; end",
"def original_result; end",
"def executor; end",
"def executor; end",
"def executor; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def probers=(_arg0); end",
"def awaken!\n\t\traise 'Not implemented'\n\tend",
"def stat() end",
"def missing; end",
"def formation; end"
] |
[
"0.7993935",
"0.66776866",
"0.651218",
"0.6264087",
"0.62507075",
"0.62507075",
"0.6238261",
"0.6238261",
"0.6238261",
"0.6238261",
"0.60262144",
"0.60127026",
"0.5997253",
"0.59807104",
"0.59413075",
"0.59413075",
"0.5928407",
"0.58937544",
"0.58937544",
"0.5883689",
"0.5861825",
"0.578844",
"0.575474",
"0.5739438",
"0.57356125",
"0.572908",
"0.57167685",
"0.57167685",
"0.57167685",
"0.57167685",
"0.56962454",
"0.5688886",
"0.56737393",
"0.56737393",
"0.56643057",
"0.56643057",
"0.5662018",
"0.5655212",
"0.56452185",
"0.5644044",
"0.56401193",
"0.5638041",
"0.5628784",
"0.5628784",
"0.5628784",
"0.56265926",
"0.5624903",
"0.5624903",
"0.5624903",
"0.5624903",
"0.5624903",
"0.5624903",
"0.5624903",
"0.5624903",
"0.56241226",
"0.56241226",
"0.56241226",
"0.56241226",
"0.56241226",
"0.56241226",
"0.56241226",
"0.56241226",
"0.56241226",
"0.56241226",
"0.56241226",
"0.56079096",
"0.56079096",
"0.56079096",
"0.56079096",
"0.56079096",
"0.56079096",
"0.56079096",
"0.56079096",
"0.56079096",
"0.56051606",
"0.56051606",
"0.5587259",
"0.55785453",
"0.55785453",
"0.55785453",
"0.55785453",
"0.5577023",
"0.5571525",
"0.5566508",
"0.5560217",
"0.55412596",
"0.55412596",
"0.55412596",
"0.55340946",
"0.55340946",
"0.55340946",
"0.55340946",
"0.55340946",
"0.55340946",
"0.55340946",
"0.55340946",
"0.5520425",
"0.5519452",
"0.55149895",
"0.55148077",
"0.5507922"
] |
0.0
|
-1
|
GET /document_histories GET /document_histories.json
|
def index
@document_histories = DocumentHistory.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @document_histories }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @document_histories = DocumentHistory.all\n end",
"def show\n @document_history = DocumentHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document_history }\n end\n end",
"def index\n @reading_histories = current_user.reading_histories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reading_histories }\n end\n end",
"def index\n @article_histories = ArticleHistory.all\n end",
"def document_history\n document_home = DocumentHome.find(params[:id])\n @documents = document_home.documents.find(:all ,:order =>'created_at desc')\n render :layout => false\n end",
"def new\n @document_history = DocumentHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_history }\n end\n end",
"def index\n #@histories = History.all\n @histories = History.find( :all, :limit => 100, :order => \"id DESC\" )\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @histories }\n end\n end",
"def index\n @invoice_histories = InvoiceHistory.all\n end",
"def index\n @documents = Document.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end",
"def index\n @search_histories = SearchHistory.all\n end",
"def get_all_history(title_number)\n\n response = rest_get_call($HISTORIAN_URL + '/' + title_number +'?versions=list')\n\n if (response.code != '200') then\n raise \"Failed to retrieve list of historical data: \" + response.body\n end\n\n return JSON.parse(response.body)\nend",
"def index\n @documents = Document.for_user(current_user).order('created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end",
"def index\n @special_documents = ModifiedDocument.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @special_documents }\n end\n end",
"def index\n @historics = Historic.all\n end",
"def index\n @fundamentals_histories = @company.fundamentals_histories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamentals_histories }\n end\n end",
"def index\n @node_histories = NodeHistory.all\n end",
"def index\n @points_histories = PointsHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @points_histories }\n end\n end",
"def index\n @documents = Document.all\n @document = Document.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end",
"def index\n @documents = current_user.documents.order(\"id DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end",
"def index\n @finance_documents = FinanceDocument.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @finance_documents\n end",
"def index\n @sales_tax_exemption_customer_histories = SalesTaxExemptionCustomerHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sales_tax_exemption_customer_histories }\n end\n end",
"def index\n @historials = Historial.all\n end",
"def index\n @historials = Historial.all\n end",
"def index\n @historials = Historial.all\n end",
"def index\n\n @documentable = find_resource\n @documents = @documentable.documents\n\n end",
"def history\n rest.get stats_path(:history) do |response|\n response_handler response\n end\n end",
"def index\n @service_histories = ServiceHistory.all\n end",
"def index\n @managers = Manager.all\n @shipping_addresses = ShippingAddress.all\n @search = AuditDocument.available_for_user(current_user).search(params[:q])\n @audit_documents = @search.result.page(params[:page]).per(current_user.list_page_size)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audit_documents }\n end\n end",
"def show\n @audit_document = AuditDocument.find(params[:id])\n @search = @audit_document.audit_document_items.search(params[:q])\n @audit_document_items = @search.result.page(params[:page]).per(current_user.list_page_size)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @audit_document }\n format.xls { render :template => 'audit_documents/audit_document.xls.erb' }\n end\n end",
"def index\n @kondate_histories = KondateHistory.all\n end",
"def index\n @audits = Audit.order_by({created_at: -1}).page params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audits }\n end\n end",
"def index\n @settlement_histories = Settlement::History.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @settlement_histories }\n end\n end",
"def index\n @historicals = @project.historical\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @historicals }\n end\n end",
"def index\n @job_histories = JobHistory.all\n end",
"def index\n @order_product_histories = OrderProductHistory.all\n end",
"def index\n @space = Space.where(:wiki_name => params[:space_id])[0]\n @documents = @space.documents.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documents }\n format.json { render :json => @documents.to_json }\n end\n end",
"def index\n @medical_histories = MedicalHistory.all\n end",
"def index\n @medical_histories = MedicalHistory.all\n end",
"def index\n @documents = Document.all\n\n respond_to do |format|\n format.html{\n }\n format.json {\n ret = @documents.as_json\n render json:{\n status: 0,\n total: ret.count,\n result: ret\n }\n }\n end\n end",
"def index\n # todo: 「内容」をクリックしたらcolorboxか別ページで表示して、コメントはそこでできるように。一覧ではコメント数は表示する\n @histories = History.includes_all\n @history = History.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @histories }\n end\n end",
"def index\n @sales_histories = SalesHistory.all\n end",
"def index\n @media_histories = MediaHistory.all\n end",
"def index\n @borrow_histories = BorrowHistory.all\n end",
"def index\n past_histories = PastHistory.where(user_id: params[:user_id])\n render json: past_histories.as_json(include: :recipe, only: :created_at)\n end",
"def overview\n authorize! :show, @pool\n (@response, @document_list) = get_search_results(rows:0)\n respond_to do |format|\n format.json { render :json=>{id:@pool.id, models:@pool.models.as_json, perspectives:@pool.exhibits.as_json, facets:@response[\"facet_counts\"][\"facet_fields\"], numFound:@response[\"response\"][\"numFound\"] } } \n end\n end",
"def index\r\n @medical_histories = MedicalHistory.all\r\n end",
"def index\r\n @medical_histories = MedicalHistory.all\r\n end",
"def index\n @family_histories = FamilyHistory.all\n end",
"def index\n @hits = Hit.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hits }\n end\n end",
"def index\n @formating_histories = FormatingHistory.all\n end",
"def history\n @purchase_requisition = PurchaseRequisition.find(params[:id])\n\n \n @audits=Kaminari.paginate_array(@purchase_requisition.audits.sort_by{|e| -e.id}).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchase_requisitions }\n end \n\n end",
"def index_documents\n @params = {}\n @action = 'index_documents'\n \n send_auth_request\n end",
"def get_scroll_history\n # \"scroll_speed\", \"towards_address_bar\", \"churn\", \"sid\"\n begin\n if %w(1 true).include?(ENV['disable_scroll_history_saving'].to_s)\n render json: {error: 'too much data to record'}\n else\n puts \"get scroll history: #{scroll_history_params.inspect}\"\n sh = ScrollHistory.create(scroll_history_params)\n\n render json: sh.attributes.to_json\n end\n\n rescue Exception => e\n render json: {error: e.inspect}\n end\n end",
"def index\n @docs = Oa::SentDocument.all#.paginate(:page => params[:page], :order => 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @docs }\n end\n end",
"def index\n @molpay_transaction_histories = MolpayTransactionHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @molpay_transaction_histories }\n end\n end",
"def history\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def index\n # @applicant_job_histories = ApplicantJobHistory.all\n @applicant_job_histories=@applicant_job_histories.paginate(:page=>params[:page],:per_page=>2)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applicant_job_histories }\n end\n end",
"def show\n @document = Document.where(:id => params[:id])\n render :json => @document, :include => [:versions]\n end",
"def index\n authorize! :query, Book\n @books = Book.order(:title)\n respond_to do |format|\n format.html\n format.json {render text: @books.to_json}\n format.xml {render text: @books.to_xml}\n end\n end",
"def index\n authorize! :read, Roxiware::BookSeries\n @series = Roxiware::BookSeries.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @series }\n end\n end",
"def index\n @weight_histories = WeightHistory.all\n end",
"def frequent_foods\n get(\"/user/#{@user_id}/foods/log/frequent.json\")\n end",
"def index\n @definitions = Definition.order('created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @definitions }\n end\n end",
"def index\n @documents = Document.all.delete_if { |document| cannot? :read, document }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n format.xml { render xml: @documents }\n end\n end",
"def index\n @visit_histories = VisitHistory.all\n end",
"def index\n @issue_histories = IssueHistory.all\n end",
"def show\n @historial_odt = HistorialOdt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial_odt }\n end\n end",
"def index\n @documents = Document.includes(:when_dates).order(sort_column + \" \" + sort_direction).page(params[:page]).per_page(30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end",
"def query_histories_with_http_info(project_id, body, opts = {})\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"Calling API: SearchApi.query_histories ...\"\r\n end\r\n # verify the required parameter 'project_id' is set\r\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling SearchApi.query_histories\" if project_id.nil?\r\n # verify the required parameter 'body' is set\r\n fail ArgumentError, \"Missing the required parameter 'body' when calling SearchApi.query_histories\" if body.nil?\r\n # resource path\r\n local_var_path = \"/api/v3/projects/{projectId}/histories\".sub('{format}','json').sub('{' + 'projectId' + '}', project_id.to_s)\r\n\r\n # query parameters\r\n query_params = {}\r\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\r\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\r\n\r\n # header parameters\r\n header_params = {}\r\n # HTTP header 'Accept' (if needed)\r\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\r\n\r\n # form parameters\r\n form_params = {}\r\n\r\n # http body (model)\r\n post_body = @api_client.object_to_http_body(body)\r\n auth_names = ['Authorization']\r\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\r\n :header_params => header_params,\r\n :query_params => query_params,\r\n :form_params => form_params,\r\n :body => post_body,\r\n :auth_names => auth_names,\r\n :return_type => 'ArtifactHistoryResource')\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"API called: SearchApi#query_histories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\r\n end\r\n return data, status_code, headers\r\n end",
"def index\n @harvest_histories = HarvestHistory.all\n end",
"def index\n @dating_histories = DatingHistory.all\n end",
"def index\n authorize Document\n\n @documents = apply_scopes(Document).valid.all\n\n if current_user.client?\n @documents = @documents.by_belongings([current_user.id])\n end\n\n respond_with do |format|\n format.html\n format.json { render json: DocumentsDatatable.new(view_context, @documents) }\n format.js\n end\n\n end",
"def set_document_history\n @document_history = DocumentHistory.find(params[:id])\n end",
"def index\n @histories = History.where(fandom_id: params[:fandom_id]).order(event_date: :desc)\n \n hash = {}\n @histories.unscope(:order).order(event_date: :asc).each do |history|\n hash[history.event_date.year.to_s.to_sym] = history.event_date.strftime('%F')\n end\n @years_hash = hash.to_a.reverse.to_h\n end",
"def index\n @water_histories = WaterHistory.all\n end",
"def index\n @document_statuses = DocumentStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @document_statuses }\n end\n end",
"def index\n respond_to do |format|\n format.html do\n @recent_objects = ControlledVocabularyTerm.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10)\n render '/shared/data/all/index'\n end\n format.json {\n @controlled_vocabulary_terms = ControlledVocabularyTerm.where(filter_params).order(:name)\n }\n end\n end",
"def index\n @person = Person.find((params[:person_id]))\n @person_identification_docs = PersonIdentificationDoc.where(\"person_id = ?\", params[:person_id])\n\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @person_identification_docs }\n end\n end",
"def index\n # @documents = Document.all.with_attached_images\n respond_to do |format|\n format.html\n format.json { render json: DocumentDatatable.new(params, view_context: view_context) }\n end\n end",
"def index\n render json: { bookings: @site.bookings.order(datetime: :asc) }, status: 200\n end",
"def index\n\n issue_identifier = params[:issue_identifier]\n unless issue_identifier.nil?\n params[:f] = {\n issue_identifier: [issue_identifier],\n }\n params[:sort] ='issue_sequence asc'\n end\n\n (@response, @document_list) = search_results(params)\n respond_to do |format|\n format.html { } # no longer store_preferred_view\n format.rss { render :layout => false }\n format.atom { render :layout => false }\n format.json do\n @presenter = Blacklight::JsonPresenter.new(@response,\n @document_list,\n facets_from_request,\n blacklight_config)\n end\n\n additional_response_formats(format)\n document_export_formats(format)\n end\n end",
"def index\n @notebooks = Notebook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notebooks }\n end\n end",
"def index\n @notebooks = Notebook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notebooks }\n end\n end",
"def index\n @notebooks = Notebook.all\n render json: @notebooks\n end",
"def index\n @issue_histories = IssueHistory.paginate(page: params[:page], per_page: 50)\n end",
"def index\n @education_histories = EducationHistory.all\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 hist\n @hist = History.where(:asset_id => @asset)\n render layout: false\n end",
"def index\n @audits = Audit.all\n respond_with @audits\n end",
"def toe_doc_history\n @termcondition = @matter.matter_termcondition\n @toe_doc = DocumentHome.find(params[:document_home_id])\n render :partial => \"toe_doc_history\"\n end",
"def index\n @drink_histories = DrinkHistory.first(100)\n end",
"def index\n if params[:category] and (params[:category].strip == \"1\" or params[:category].downcase.strip == \"true\")\n self.current_user.run_migrations\n user_document_cache = UserDocumentCache.document_cache_for(current_user)\n docs = user_document_cache.document_json\n\n respond_to do |format|\n format.json { render :json => docs }\n end\n else\n docs = self.current_user.document_ownerships.map(&:document)\n respond_to do |format|\n format.json { render :json => docs }\n end\n end\n end",
"def index\n if params[:view] == \"last\"\n \t@docs = Doc.find_all_by_created_by(current_user.email)\n \tunless @docs.blank?\n \t\t@docs = [@docs.sort{|x,y| x.updated_at <=> y.updated_at}.last]\n \tend\n elsif params[:view] == \"deprecated\"\n \t@docs = Doc.find_all_by_deprecated(true)\n else\n \tparams[:search] ? @docs = Doc.search(params[:search]) : @docs = Doc.all\n end\n @latest_docs = Doc.get_latest_components\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @docs }\n end\n end",
"def index\n @weekly_histograms = WeeklyHistogram.all\n end",
"def index\n # @results = []\n # @document.bioc_doc.all_relations.each do |a|\n # e = EntityUtil.get_relation_entity(a)\n # a.locations.each do |l|\n # @results << {did: @document.did, offset: l.offset, text: a.text, length: l.length, infons: a.infons }\n # end\n # end\n @project = @document.project\n @version = params[:version] || @document.version\n @version = @version.to_i if @version.present?\n @is_manager = @project.manager?(current_user)\n\n if @is_manager\n @relations = @document.relations.where('`version`=?', @version)\n else\n @relations = @assign.relations\n end\n @relations = @relations.order(\"offset\")\n end",
"def query_histories(project_id, body, opts = {})\r\n data, _status_code, _headers = query_histories_with_http_info(project_id, body, opts)\r\n return data\r\n end",
"def index\n @books = Book.all\n render json: @books\n end",
"def destroy\n @document_history = DocumentHistory.find(params[:id])\n @document_history.destroy\n\n respond_to do |format|\n format.html { redirect_to document_histories_url }\n format.json { head :no_content }\n end\n end",
"def index\n @speaking_histories = SpeakingHistory.all\n end",
"def index\n @call_histories = CallHistory.all\n end"
] |
[
"0.7655686",
"0.6883783",
"0.6552269",
"0.6547655",
"0.649568",
"0.64467233",
"0.6403964",
"0.6349311",
"0.63123536",
"0.62513787",
"0.62498796",
"0.6219313",
"0.6199762",
"0.6197101",
"0.6186016",
"0.61756635",
"0.6167894",
"0.61586195",
"0.61514014",
"0.6141995",
"0.6105994",
"0.6103522",
"0.6103308",
"0.6103308",
"0.6076323",
"0.6076179",
"0.60719067",
"0.60403043",
"0.60188544",
"0.6017902",
"0.5999196",
"0.59988904",
"0.59912676",
"0.59839517",
"0.59721756",
"0.5971926",
"0.59639776",
"0.59639776",
"0.59599185",
"0.5957811",
"0.5944458",
"0.5943176",
"0.5931258",
"0.59300643",
"0.59298486",
"0.59256196",
"0.59256196",
"0.5922902",
"0.5920962",
"0.5913381",
"0.59029084",
"0.5899732",
"0.58877283",
"0.58827335",
"0.587777",
"0.58648884",
"0.585811",
"0.5832236",
"0.582741",
"0.5825879",
"0.5824069",
"0.5822966",
"0.5816655",
"0.5813521",
"0.58075565",
"0.5805626",
"0.5805412",
"0.58019507",
"0.58000153",
"0.5797642",
"0.5790218",
"0.5789258",
"0.5781077",
"0.5769147",
"0.5767316",
"0.5761403",
"0.57613456",
"0.5760846",
"0.5758219",
"0.57577485",
"0.57573074",
"0.5752468",
"0.5752468",
"0.574864",
"0.5740497",
"0.5728977",
"0.57278585",
"0.5727177",
"0.5723145",
"0.5719442",
"0.5715122",
"0.5704426",
"0.5702888",
"0.56986874",
"0.5697371",
"0.5695442",
"0.5692731",
"0.5681752",
"0.56807595",
"0.56781566"
] |
0.79534477
|
0
|
GET /document_histories/1 GET /document_histories/1.json
|
def show
@document_history = DocumentHistory.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @document_history }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @document_histories = DocumentHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @document_histories }\n end\n end",
"def index\n @document_histories = DocumentHistory.all\n end",
"def new\n @document_history = DocumentHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_history }\n end\n end",
"def document_history\n document_home = DocumentHome.find(params[:id])\n @documents = document_home.documents.find(:all ,:order =>'created_at desc')\n render :layout => false\n end",
"def index\n #@histories = History.all\n @histories = History.find( :all, :limit => 100, :order => \"id DESC\" )\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @histories }\n end\n end",
"def get_all_history(title_number)\n\n response = rest_get_call($HISTORIAN_URL + '/' + title_number +'?versions=list')\n\n if (response.code != '200') then\n raise \"Failed to retrieve list of historical data: \" + response.body\n end\n\n return JSON.parse(response.body)\nend",
"def index\n @article_histories = ArticleHistory.all\n end",
"def index\n @reading_histories = current_user.reading_histories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reading_histories }\n end\n end",
"def index\n @invoice_histories = InvoiceHistory.all\n end",
"def index\n @documents = Document.all\n @document = Document.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end",
"def index\n @documents = Document.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end",
"def index\n @special_documents = ModifiedDocument.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @special_documents }\n end\n end",
"def index\n @historics = Historic.all\n end",
"def show\n @historial_odt = HistorialOdt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial_odt }\n end\n end",
"def show\n @audit_document = AuditDocument.find(params[:id])\n @search = @audit_document.audit_document_items.search(params[:q])\n @audit_document_items = @search.result.page(params[:page]).per(current_user.list_page_size)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @audit_document }\n format.xls { render :template => 'audit_documents/audit_document.xls.erb' }\n end\n end",
"def index\n @finance_documents = FinanceDocument.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @finance_documents\n end",
"def history\n rest.get stats_path(:history) do |response|\n response_handler response\n end\n end",
"def index\n @search_histories = SearchHistory.all\n end",
"def index\n @documents = Document.for_user(current_user).order('created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end",
"def show\n @document = Document.where(:id => params[:id])\n render :json => @document, :include => [:versions]\n end",
"def index\n @historials = Historial.all\n end",
"def index\n @historials = Historial.all\n end",
"def index\n @historials = Historial.all\n end",
"def index\n @points_histories = PointsHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @points_histories }\n end\n end",
"def set_document_history\n @document_history = DocumentHistory.find(params[:id])\n end",
"def index\n @historicals = @project.historical\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @historicals }\n end\n end",
"def history\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def index\n @documents = current_user.documents.order(\"id DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end",
"def index\n @audits = Audit.order_by({created_at: -1}).page params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audits }\n end\n end",
"def history\n @purchase_requisition = PurchaseRequisition.find(params[:id])\n\n \n @audits=Kaminari.paginate_array(@purchase_requisition.audits.sort_by{|e| -e.id}).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchase_requisitions }\n end \n\n end",
"def index\n @fundamentals_histories = @company.fundamentals_histories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamentals_histories }\n end\n end",
"def index\n @sales_tax_exemption_customer_histories = SalesTaxExemptionCustomerHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sales_tax_exemption_customer_histories }\n end\n end",
"def index\n @node_histories = NodeHistory.all\n end",
"def index\n @space = Space.where(:wiki_name => params[:space_id])[0]\n @documents = @space.documents.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documents }\n format.json { render :json => @documents.to_json }\n end\n end",
"def get_history_version(title_number, version)\n\n response = rest_get_call($HISTORIAN_URL + '/' + title_number +'?version=' + version.to_s)\n\n if (response.code != '200') then\n raise \"Failed to retrieve historical version specified: \" + response.body\n end\n\n return JSON.parse(response.body)\nend",
"def index\n\n @documentable = find_resource\n @documents = @documentable.documents\n\n end",
"def index\n @service_histories = ServiceHistory.all\n end",
"def index\n @person = Person.find((params[:person_id]))\n @person_identification_docs = PersonIdentificationDoc.where(\"person_id = ?\", params[:person_id])\n\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @person_identification_docs }\n end\n end",
"def index\n @medical_histories = MedicalHistory.all\n end",
"def index\n @medical_histories = MedicalHistory.all\n end",
"def index\n @kondate_histories = KondateHistory.all\n end",
"def index\n past_histories = PastHistory.where(user_id: params[:user_id])\n render json: past_histories.as_json(include: :recipe, only: :created_at)\n end",
"def index\r\n @medical_histories = MedicalHistory.all\r\n end",
"def index\r\n @medical_histories = MedicalHistory.all\r\n end",
"def index\n @settlement_histories = Settlement::History.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @settlement_histories }\n end\n end",
"def index\n @hits = Hit.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hits }\n end\n end",
"def index\n @media_histories = MediaHistory.all\n end",
"def index\n @order_product_histories = OrderProductHistory.all\n end",
"def hist\n @hist = History.where(:asset_id => @asset)\n render layout: false\n end",
"def destroy\n @document_history = DocumentHistory.find(params[:id])\n @document_history.destroy\n\n respond_to do |format|\n format.html { redirect_to document_histories_url }\n format.json { head :no_content }\n end\n end",
"def show\n @historical = Historical.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historical }\n end\n end",
"def index\n @formating_histories = FormatingHistory.all\n end",
"def create\n @document_history = DocumentHistory.new(params[:document_history])\n\n respond_to do |format|\n if @document_history.save\n format.html { redirect_to @document_history, notice: 'Document history was successfully created' }\n format.json { render json: @document_history, status: :created, location: @document_history }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @documents = Document.all\n\n respond_to do |format|\n format.html{\n }\n format.json {\n ret = @documents.as_json\n render json:{\n status: 0,\n total: ret.count,\n result: ret\n }\n }\n end\n end",
"def frequent_foods\n get(\"/user/#{@user_id}/foods/log/frequent.json\")\n end",
"def index\n @drink_histories = DrinkHistory.first(100)\n end",
"def show\n @reading_history = @user.reading_histories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reading_history }\n end\n end",
"def index\n @job_histories = JobHistory.all\n end",
"def index\n @sales_histories = SalesHistory.all\n end",
"def index\n @borrow_histories = BorrowHistory.all\n end",
"def getjson\n sha = params[:data]\n history = History.find_or_initialize_by({:sha => sha})\n if !history.new_record?\n render :json => history.json.to_json\n else\n raise ActionController::RoutingError.new('Not Found')\n end\n end",
"def index\n @managers = Manager.all\n @shipping_addresses = ShippingAddress.all\n @search = AuditDocument.available_for_user(current_user).search(params[:q])\n @audit_documents = @search.result.page(params[:page]).per(current_user.list_page_size)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audit_documents }\n end\n end",
"def index\n @family_histories = FamilyHistory.all\n end",
"def index\n @histories = History.where(fandom_id: params[:fandom_id]).order(event_date: :desc)\n \n hash = {}\n @histories.unscope(:order).order(event_date: :asc).each do |history|\n hash[history.event_date.year.to_s.to_sym] = history.event_date.strftime('%F')\n end\n @years_hash = hash.to_a.reverse.to_h\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 @molpay_transaction_histories = MolpayTransactionHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @molpay_transaction_histories }\n end\n end",
"def index\n @definitions = Definition.order('created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @definitions }\n end\n end",
"def index\n # @applicant_job_histories = ApplicantJobHistory.all\n @applicant_job_histories=@applicant_job_histories.paginate(:page=>params[:page],:per_page=>2)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applicant_job_histories }\n end\n end",
"def index\n # todo: 「内容」をクリックしたらcolorboxか別ページで表示して、コメントはそこでできるように。一覧ではコメント数は表示する\n @histories = History.includes_all\n @history = History.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @histories }\n end\n end",
"def index\n @issue_histories = IssueHistory.all\n end",
"def query_histories_with_http_info(project_id, body, opts = {})\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"Calling API: SearchApi.query_histories ...\"\r\n end\r\n # verify the required parameter 'project_id' is set\r\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling SearchApi.query_histories\" if project_id.nil?\r\n # verify the required parameter 'body' is set\r\n fail ArgumentError, \"Missing the required parameter 'body' when calling SearchApi.query_histories\" if body.nil?\r\n # resource path\r\n local_var_path = \"/api/v3/projects/{projectId}/histories\".sub('{format}','json').sub('{' + 'projectId' + '}', project_id.to_s)\r\n\r\n # query parameters\r\n query_params = {}\r\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\r\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\r\n\r\n # header parameters\r\n header_params = {}\r\n # HTTP header 'Accept' (if needed)\r\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\r\n\r\n # form parameters\r\n form_params = {}\r\n\r\n # http body (model)\r\n post_body = @api_client.object_to_http_body(body)\r\n auth_names = ['Authorization']\r\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\r\n :header_params => header_params,\r\n :query_params => query_params,\r\n :form_params => form_params,\r\n :body => post_body,\r\n :auth_names => auth_names,\r\n :return_type => 'ArtifactHistoryResource')\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"API called: SearchApi#query_histories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\r\n end\r\n return data, status_code, headers\r\n end",
"def index\n @weight_histories = WeightHistory.all\n end",
"def get_scroll_history\n # \"scroll_speed\", \"towards_address_bar\", \"churn\", \"sid\"\n begin\n if %w(1 true).include?(ENV['disable_scroll_history_saving'].to_s)\n render json: {error: 'too much data to record'}\n else\n puts \"get scroll history: #{scroll_history_params.inspect}\"\n sh = ScrollHistory.create(scroll_history_params)\n\n render json: sh.attributes.to_json\n end\n\n rescue Exception => e\n render json: {error: e.inspect}\n end\n end",
"def index\n @docs = Oa::SentDocument.all#.paginate(:page => params[:page], :order => 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @docs }\n end\n end",
"def index\n # @documents = Document.all.with_attached_images\n respond_to do |format|\n format.html\n format.json { render json: DocumentDatatable.new(params, view_context: view_context) }\n end\n end",
"def info\n @document = Document.find(params[:id])\n respond_to do |format|\n format.json { render :json => @document, serializer: Api::Mobile::V2::DynamicDocumentSerializer, root: 'document' }\n end\n end",
"def update\n respond_to do |format|\n if @document_history.update(document_history_params)\n format.html { redirect_to documents_url, notice: 'Document history was successfully updated.' }\n format.json { render :show, status: :ok, location: @document_history }\n else\n format.html { render :edit }\n format.json { render json: @document_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n # @results = []\n # @document.bioc_doc.all_relations.each do |a|\n # e = EntityUtil.get_relation_entity(a)\n # a.locations.each do |l|\n # @results << {did: @document.did, offset: l.offset, text: a.text, length: l.length, infons: a.infons }\n # end\n # end\n @project = @document.project\n @version = params[:version] || @document.version\n @version = @version.to_i if @version.present?\n @is_manager = @project.manager?(current_user)\n\n if @is_manager\n @relations = @document.relations.where('`version`=?', @version)\n else\n @relations = @assign.relations\n end\n @relations = @relations.order(\"offset\")\n end",
"def index\n @document_statuses = DocumentStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @document_statuses }\n end\n end",
"def overview\n authorize! :show, @pool\n (@response, @document_list) = get_search_results(rows:0)\n respond_to do |format|\n format.json { render :json=>{id:@pool.id, models:@pool.models.as_json, perspectives:@pool.exhibits.as_json, facets:@response[\"facet_counts\"][\"facet_fields\"], numFound:@response[\"response\"][\"numFound\"] } } \n end\n end",
"def history(params)\n Client.current.get(\"#{resource_url}/candles\", params)\n end",
"def index\n @dating_histories = DatingHistory.all\n end",
"def index\n\n issue_identifier = params[:issue_identifier]\n unless issue_identifier.nil?\n params[:f] = {\n issue_identifier: [issue_identifier],\n }\n params[:sort] ='issue_sequence asc'\n end\n\n (@response, @document_list) = search_results(params)\n respond_to do |format|\n format.html { } # no longer store_preferred_view\n format.rss { render :layout => false }\n format.atom { render :layout => false }\n format.json do\n @presenter = Blacklight::JsonPresenter.new(@response,\n @document_list,\n facets_from_request,\n blacklight_config)\n end\n\n additional_response_formats(format)\n document_export_formats(format)\n end\n end",
"def index\n @dis_additive_frequencies = DisAdditiveFrequency.all\n respond_to do |format|\n format.html\n format.json { render json:DisAdditiveFrequencieDatatable.new(view_context) }\n end\n end",
"def index\n @documents = Document.includes(:when_dates).order(sort_column + \" \" + sort_direction).page(params[:page]).per_page(30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\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 @bookmark_stats = BookmarkStat.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bookmark_stats }\n end\n end",
"def index\n @history_items = HistoryItem.all\n end",
"def index\n @visit_histories = VisitHistory.all\n end",
"def index_documents\n @params = {}\n @action = 'index_documents'\n \n send_auth_request\n end",
"def index\n @issue_histories = IssueHistory.paginate(page: params[:page], per_page: 50)\n end",
"def index\n authorize! :read, Roxiware::BookSeries\n @series = Roxiware::BookSeries.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @series }\n end\n end",
"def toe_doc_history\n @termcondition = @matter.matter_termcondition\n @toe_doc = DocumentHome.find(params[:document_home_id])\n render :partial => \"toe_doc_history\"\n end",
"def index\n render json: { bookings: @site.bookings.order(datetime: :asc) }, status: 200\n end",
"def index\n @harvest_histories = HarvestHistory.all\n end",
"def index\n @notebooks = Notebook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notebooks }\n end\n end",
"def index\n @notebooks = Notebook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notebooks }\n end\n end",
"def show\n \n @document = Document.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n \n end",
"def create\n @document_history = DocumentHistory.new(document_history_params)\n\n respond_to do |format|\n if @document_history.save\n docs = Document.find(@document_history.document_id)\n docs.update_column(:status, @document_history.remarks)\n format.html { redirect_to documents_url, notice: 'Document history was successfully created.' }\n format.json { render :show, status: :created, location: @document_history }\n else\n format.html { render :new }\n format.json { render json: @document_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def history\n generic_index(true)\n end"
] |
[
"0.78202945",
"0.7493386",
"0.6679428",
"0.64746624",
"0.6400701",
"0.63793236",
"0.6339385",
"0.62653154",
"0.62411165",
"0.6148458",
"0.6134712",
"0.6134442",
"0.61278677",
"0.61198914",
"0.6089314",
"0.6066219",
"0.6061241",
"0.6056675",
"0.6054338",
"0.60542065",
"0.6033467",
"0.6032975",
"0.6032975",
"0.60295343",
"0.60046405",
"0.6002301",
"0.5994696",
"0.5974419",
"0.5966174",
"0.5962152",
"0.59421545",
"0.59404737",
"0.5936406",
"0.5921619",
"0.5912541",
"0.59072757",
"0.5904752",
"0.58959424",
"0.58945805",
"0.58945805",
"0.5893466",
"0.58768654",
"0.5867375",
"0.5867375",
"0.5842314",
"0.58379763",
"0.58267677",
"0.58256394",
"0.5824481",
"0.58211905",
"0.581767",
"0.58115584",
"0.5806876",
"0.58013487",
"0.58006746",
"0.57962334",
"0.5791139",
"0.5791016",
"0.57902783",
"0.57887447",
"0.57812285",
"0.57793534",
"0.57781947",
"0.5771102",
"0.5762273",
"0.5752207",
"0.5752076",
"0.5747124",
"0.57401323",
"0.5733308",
"0.5727198",
"0.57138693",
"0.5711661",
"0.5707576",
"0.5679226",
"0.5669663",
"0.5659229",
"0.56577",
"0.56574625",
"0.56573814",
"0.56572014",
"0.5656715",
"0.5656687",
"0.5652218",
"0.56508774",
"0.5639656",
"0.56343514",
"0.56283313",
"0.5627914",
"0.56258875",
"0.56204146",
"0.56182164",
"0.56162673",
"0.560294",
"0.56013393",
"0.55982774",
"0.55982774",
"0.55942315",
"0.55919224",
"0.55890626"
] |
0.7112611
|
2
|
GET /document_histories/new GET /document_histories/new.json
|
def new
@document_history = DocumentHistory.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @document_history }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n \n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n \n end",
"def create\n @document_history = DocumentHistory.new(params[:document_history])\n\n respond_to do |format|\n if @document_history.save\n format.html { redirect_to @document_history, notice: 'Document history was successfully created' }\n format.json { render json: @document_history, status: :created, location: @document_history }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @special_document = ModifiedDocument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @special_document }\n end\n end",
"def new\n @historial = Historial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\r\n @document = Document.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @document }\r\n end\r\n end",
"def new\n @historical = Historical.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historical }\n end\n end",
"def new\n @historial_odt = HistorialOdt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial_odt }\n end\n end",
"def new\n @query_history = QueryHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @query_history }\n end\n end",
"def new\n @status = Status.new\n @status.build_document\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status }\n end\n end",
"def new\n @operation_history = OperationHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @operation_history }\n end\n end",
"def new\n #@current_user = User.find(session[:user_id])\n #@document = @current_user.documents.new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n\n \t\n @companydocument = Companydocument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @companydocument }\n end\n\n end",
"def new\n @category_history = CategoryHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category_history }\n end\n end",
"def new\n @distribution_audit = DistributionAudit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @distribution_audit }\n end\n end",
"def new\n @document = Document.new\n @keyfinding = Keyfinding.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\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 @historial = Historial.new(historial_params)\n\n respond_to do |format|\n if @historial.save\n format.html { redirect_to @historial, notice: 'Historial was successfully created.' }\n format.json { render :show, status: :created, location: @historial }\n else\n format.html { render :new }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @space = Space.where(:wiki_name => params[:space_id])[0]\n @document = @space.documents.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document }\n format.json { render :json => @document.to_json }\n end\n end",
"def new\n @document = Document.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document }\n format.json { render :json => @document }\n end\n end",
"def create\n @historial_odt = HistorialOdt.new(params[:historial_odt])\n\n respond_to do |format|\n if @historial_odt.save\n format.html { redirect_to @historial_odt, notice: 'Historial odt was successfully created.' }\n format.json { render json: @historial_odt, status: :created, location: @historial_odt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @historial_odt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n load_data\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @book }\n end\n end",
"def new\n @bookmark_stat = BookmarkStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bookmark_stat }\n end\n end",
"def new\n @history_study = HistoryStudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @history_study }\n end\n end",
"def new\n @documento = Documento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @documento }\n end\n end",
"def new\n @observation = Observation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation }\n end\n end",
"def new\n @observation = Observation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation }\n end\n end",
"def new\n @family_history = FamilyHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_history }\n end\n end",
"def new\n@documento = Documento.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @documento }\n end\n end",
"def new\n @cocktail_history = CocktailHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cocktail_history }\n end\n end",
"def new\n @journal = Journal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json :@journal }\n end\n end",
"def new\n @patient_history = PatientHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_history }\n end\n end",
"def new\n @document_type = DocumentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_type }\n end\n end",
"def index\n @document_histories = DocumentHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @document_histories }\n end\n end",
"def new\n @documentotipo = Documentotipo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @documentotipo }\n end\n end",
"def create\n @histroal = Historial.new(histroal_params)\n\n respond_to do |format|\n if @histroal.save\n format.html { redirect_to @histroal, notice: 'Historial was successfully created.' }\n format.json { render :show, status: :created, location: @histroal }\n else\n format.html { render :new }\n format.json { render json: @histroal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @office = Office.new\n\n track_event(\"Viewed AddListing\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @office }\n end\n end",
"def new\n @bookmark = Bookmark.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bookmark }\n end\n end",
"def new\n @buying_history = BuyingHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @buying_history }\n end\n end",
"def new\n @title = \"New Book\"\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @points_history = PointsHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @points_history }\n end\n end",
"def create\n @document_history = DocumentHistory.new(document_history_params)\n\n respond_to do |format|\n if @document_history.save\n docs = Document.find(@document_history.document_id)\n docs.update_column(:status, @document_history.remarks)\n format.html { redirect_to documents_url, notice: 'Document history was successfully created.' }\n format.json { render :show, status: :created, location: @document_history }\n else\n format.html { render :new }\n format.json { render json: @document_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @notebook = Notebook.new\n render json: @notebook\n end",
"def create\n @historical = Historical.new(params[:historical])\n\n respond_to do |format|\n if @historical.save\n format.html { redirect_to @historical, notice: 'Historical was successfully created.' }\n format.json { render json: @historical, status: :created, location: @historical }\n else\n format.html { render action: \"new\" }\n format.json { render json: @historical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @paper = Paper.new\n @document = @paper.documents.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paper }\n end\n end",
"def new\n @document_format = DocumentFormat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_format }\n end\n end",
"def new\n @medhistory = Medhistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @medhistory }\n end\n end",
"def new\n @fundamentals_history = FundamentalsHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundamentals_history }\n end\n end",
"def new\n @glossary = Glossary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @glossary }\n end\n end",
"def new\n @hit = Hit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hit }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rulebook }\n end\n end",
"def new\n @quality_history = QualityHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quality_history }\n end\n end",
"def new\n @fileversion = Fileversion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fileversion }\n end\n end",
"def new\n @dictionary = Dictionary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dictionary }\n end\n end",
"def new\n doc_no = (RepairRecord.maximum(:doc_no).to_i || 0) + 1\n @repair_record = current_user.reported_repair_records.new(doc_no: doc_no)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repair_record }\n end\n end",
"def new\n @journal_entry = JournalEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @journal_entry }\n end\n end",
"def new\n @journal_entry = JournalEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @journal_entry }\n end\n end",
"def new\n @position_history = PositionHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position_history }\n end\n end",
"def new\n @document = Document.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document }\n end\n end",
"def new\n @quality_document = QualityDocument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quality_document }\n end\n end",
"def new\n @notebook = Notebook.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notebook }\n end\n end",
"def new\n @book_shelf = BookShelf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_shelf }\n end\n end",
"def new\n @bookmark_tag = BookmarkTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bookmark_tag }\n end\n end",
"def new\n @word_count = WordCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word_count }\n end\n end",
"def new\n @notebook = Notebook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notebook }\n end\n end",
"def new\n @notebook = Notebook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notebook }\n end\n end",
"def create\n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\n puts \"id is: \" + @document.id.to_s\n puts \"received_from_name is: \" + @document.user_id.to_s\n puts \"received_from_office is: \" + @document.department_id.to_s\n DocumentHistory.create(:document_id => @document.id, :received_by_name => @document.user_id, :received_by_office => @document.department_id, :received_from_name => @document.user_id, :received_from_office => @document.department_id, :subject => @document.subject, :remarks => @document.status)\n format.html { redirect_to documents_url, 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 new\n @journal = @journals.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @journal }\n end\n end",
"def new\n @file_version = FileVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_version }\n end\n end",
"def new\n @hpt_history = HptHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hpt_history }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def create\n @book_history = BookHistory.new(book_history_params)\n\n respond_to do |format|\n if @book_history.save\n format.html { redirect_to @book_history, notice: 'Book history was successfully created.' }\n format.json { render :show, status: :created, location: @book_history }\n else\n format.html { render :new }\n format.json { render json: @book_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @holy_book = HolyBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holy_book }\n end\n end",
"def new\n @wr_log = WrLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wr_log }\n end\n end",
"def new\n @research = Research.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @research }\n end\n end",
"def new\n @experience_history = ExperienceHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experience_history }\n end\n end",
"def new\n @historico = Historico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @historico }\n end\n end",
"def new\n @foodlog = Foodlog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @foodlog }\n end\n end",
"def new\n @document = Document.new\n @document.document_type = 1\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @person_identification_docs = PersonIdentificationDoc.where(\"person_id = ?\", params[:person_id])\n #Checks if there is already some record Identification Doc\n if !@person_identification_docs.exists?\n @person = Person.find((params[:person_id]))\n @person_identification_doc = PersonIdentificationDoc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @person_identification_doc }\n end\n else\n respond_to do |format|\n format.html { redirect_to person_person_identification_docs_path}\n format.json { render :json => @person_identification_doc }\n end\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end"
] |
[
"0.71452826",
"0.7141997",
"0.70712",
"0.7040632",
"0.69915295",
"0.69915295",
"0.69915295",
"0.69915295",
"0.69915295",
"0.69915295",
"0.69915295",
"0.69915295",
"0.69915295",
"0.6926776",
"0.69182444",
"0.69072044",
"0.68260354",
"0.6794462",
"0.67733455",
"0.6725073",
"0.66762495",
"0.66700053",
"0.6633389",
"0.66275156",
"0.65816116",
"0.6566209",
"0.6546447",
"0.6542114",
"0.65395844",
"0.652771",
"0.6520397",
"0.65192807",
"0.65149033",
"0.65117365",
"0.65117365",
"0.6507988",
"0.6494928",
"0.6473696",
"0.6471999",
"0.6470609",
"0.6451108",
"0.6448867",
"0.64474523",
"0.64374655",
"0.6413473",
"0.6411111",
"0.64091134",
"0.64011204",
"0.63891405",
"0.6377981",
"0.6372792",
"0.6356229",
"0.63413334",
"0.633167",
"0.6331165",
"0.6318751",
"0.6309683",
"0.62921274",
"0.6286592",
"0.62857085",
"0.6280754",
"0.62751746",
"0.62741876",
"0.627343",
"0.627343",
"0.6270023",
"0.6266953",
"0.62601835",
"0.6260104",
"0.6258199",
"0.625589",
"0.6255861",
"0.6254562",
"0.6254562",
"0.6248707",
"0.6246137",
"0.6245618",
"0.6238059",
"0.6235657",
"0.6235657",
"0.6234031",
"0.6228476",
"0.6227391",
"0.6224866",
"0.6223423",
"0.6222122",
"0.6218157",
"0.6200186",
"0.6196968",
"0.61950094",
"0.61950094",
"0.61950094",
"0.61950094",
"0.61950094",
"0.61950094",
"0.61950094",
"0.61950094",
"0.61950094",
"0.61950094",
"0.61950094"
] |
0.79606754
|
0
|
POST /document_histories POST /document_histories.json
|
def create
@document_history = DocumentHistory.new(params[:document_history])
respond_to do |format|
if @document_history.save
format.html { redirect_to @document_history, notice: 'Document history was successfully created' }
format.json { render json: @document_history, status: :created, location: @document_history }
else
format.html { render action: "new" }
format.json { render json: @document_history.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @document_histories = DocumentHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @document_histories }\n end\n end",
"def index\n @document_histories = DocumentHistory.all\n end",
"def create\n @document_history = DocumentHistory.new(document_history_params)\n\n respond_to do |format|\n if @document_history.save\n docs = Document.find(@document_history.document_id)\n docs.update_column(:status, @document_history.remarks)\n format.html { redirect_to documents_url, notice: 'Document history was successfully created.' }\n format.json { render :show, status: :created, location: @document_history }\n else\n format.html { render :new }\n format.json { render json: @document_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @document_history = DocumentHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_history }\n end\n end",
"def post_to_historical(data_hash, title_number)\n\n response = rest_post_call($HISTORIAN_URL + '/' + title_number, data_hash.to_json)\n\n if (response.code != '200') then\n raise \"Failed to create the historical data: \" + response.body\n end\n\n return response.body\nend",
"def create\n megam_rest.post_billedhistories(to_hash)\n end",
"def create\n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\n puts \"id is: \" + @document.id.to_s\n puts \"received_from_name is: \" + @document.user_id.to_s\n puts \"received_from_office is: \" + @document.department_id.to_s\n DocumentHistory.create(:document_id => @document.id, :received_by_name => @document.user_id, :received_by_office => @document.department_id, :received_from_name => @document.user_id, :received_from_office => @document.department_id, :subject => @document.subject, :remarks => @document.status)\n format.html { redirect_to documents_url, 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 create\n @historial_odt = HistorialOdt.new(params[:historial_odt])\n\n respond_to do |format|\n if @historial_odt.save\n format.html { redirect_to @historial_odt, notice: 'Historial odt was successfully created.' }\n format.json { render json: @historial_odt, status: :created, location: @historial_odt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @historial_odt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @historial = Historial.new(historial_params)\n\n respond_to do |format|\n if @historial.save\n format.html { redirect_to @historial, notice: 'Historial was successfully created.' }\n format.json { render :show, status: :created, location: @historial }\n else\n format.html { render :new }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @histroal = Historial.new(histroal_params)\n\n respond_to do |format|\n if @histroal.save\n format.html { redirect_to @histroal, notice: 'Historial was successfully created.' }\n format.json { render :show, status: :created, location: @histroal }\n else\n format.html { render :new }\n format.json { render json: @histroal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def perform\n histories << SearchTermHistory.create\n touch # updated_at does not update automatically...\n end",
"def create\n @finance_document = FinanceDocument.new(finance_document_params)\n\n if @finance_document.save\n audit(@finance_document, current_user)\n render json: @finance_document, status: :created\n else\n render json: @finance_document.errors, status: :unprocessable_entity\n end\n end",
"def create\n @weekly_histogram = WeeklyHistogram.new(weekly_histogram_params)\n\n respond_to do |format|\n if @weekly_histogram.save\n format.html { redirect_to @weekly_histogram, notice: 'Weekly histogram was successfully created.' }\n format.json { render :show, status: :created, location: @weekly_histogram }\n else\n format.html { render :new }\n format.json { render json: @weekly_histogram.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n version_attributes = params.require(:version).permit(:id, :file, :file_file_name, :version, :uploaded_by, :reason)\n @document = Document.find(params[:document_id])\n @document.versions << Version.create(version_attributes)\n render :json => @document, :include => [:versions]\n end",
"def create\n @document = @memo.new_document(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to memo_url(@memo), notice: 'Memo was successfully created.' }\n format.json { render json: @document, status: :created }\n else\n format.html { render memo_url(@memo) }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def document_history_params\n params.require(:document_history).permit(:document_id, :received_by_name, :received_by_office, :received_from_name, :received_from_office, :length_of_stay, :remarks, :max_stay, :subject)\n end",
"def set_document_history\n @document_history = DocumentHistory.find(params[:id])\n end",
"def create\n @document = Document.new(params[:document])\n @document.stuffing_data = []\n @document.user = current_user\n\n #Hack for now - add all column keys to primary keys for search\n @document.stuffing_primary_keys = get_data_colnames(@document.stuffing_data)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @votaciones_hist = VotacionesHist.new(votaciones_hist_params)\n\n respond_to do |format|\n if @votaciones_hist.save\n format.html { redirect_to @votaciones_hist, notice: 'Votaciones hist was successfully created.' }\n format.json { render :show, status: :created, location: @votaciones_hist }\n else\n format.html { render :new }\n format.json { render json: @votaciones_hist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @documents = Document.all\n @document = Document.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end",
"def create\n @book_history = BookHistory.new(book_history_params)\n\n respond_to do |format|\n if @book_history.save\n format.html { redirect_to @book_history, notice: 'Book history was successfully created.' }\n format.json { render :show, status: :created, location: @book_history }\n else\n format.html { render :new }\n format.json { render json: @book_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document_history.update(document_history_params)\n format.html { redirect_to documents_url, notice: 'Document history was successfully updated.' }\n format.json { render :show, status: :ok, location: @document_history }\n else\n format.html { render :edit }\n format.json { render json: @document_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reading_history = @user.reading_histories.build(params[:reading_history])\n\n respond_to do |format|\n if @reading_history.save\n format.html { redirect_to '/', notice: 'new reading history was successfully added.' }\n format.json { render json: @reading_history, status: :created, location: @reading_history }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reading_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def document_history\n document_home = DocumentHome.find(params[:id])\n @documents = document_home.documents.find(:all ,:order =>'created_at desc')\n render :layout => false\n end",
"def create\n @has_document = HasDocument.new(has_document_params)\n \n respond_to do |format|\n if @has_document.save\n format.html { redirect_to @has_document, notice: 'Has document was successfully created.' }\n format.json { render :show, status: :created, location: @has_document }\n else\n format.html { render :new }\n format.json { render json: @has_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comm_history = CommHistory.new(comm_history_params)\n respond_to do |format|\n if @comm_history.save\n @inspection = @comm_history.try(:bid).try(:inspection)\n create_documents\n format.html { redirect_to @comm_history, notice: 'Bids follow up was successfully created.' }\n format.json { render :show, status: :created, location: @comm_history }\n else\n format.html { render :new }\n format.json { render json: @comm_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @document_history = DocumentHistory.find(params[:id])\n @document_history.destroy\n\n respond_to do |format|\n format.html { redirect_to document_histories_url }\n format.json { head :no_content }\n end\n end",
"def create\n historial_params = params[:historial]\n with_bill = historial_params.delete(:with_bill)\n @historial = Historial.new(historial_params)\n\n respond_to do |format|\n if @historial.save\n if with_bill.present?\n format.html { redirect_to new_bill_path(\n client_id: @historial.cliente_id,\n historial_id: @historial.id\n ), notice: 'Presupuesto ha sido creado.' }\n else\n format.html { redirect_to @historial, notice: 'Presupuesto ha sido creado.' }\n end\n format.json { render json: @historial, status: :created, location: @historial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @historical = Historical.new(params[:historical])\n\n respond_to do |format|\n if @historical.save\n format.html { redirect_to @historical, notice: 'Historical was successfully created.' }\n format.json { render json: @historical, status: :created, location: @historical }\n else\n format.html { render action: \"new\" }\n format.json { render json: @historical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article_history = ArticleHistory.new(article_history_params)\n\n respond_to do |format|\n if @article_history.save\n format.html { redirect_to @article_history, notice: 'Article history was successfully created.' }\n format.json { render :show, status: :created, location: @article_history }\n else\n format.html { render :new }\n format.json { render json: @article_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boat_document = BoatDocument.new(boat_document_params)\n\n respond_to do |format|\n if @boat_document.save\n format.html { redirect_to @boat_document, notice: 'Boat document was successfully created.' }\n format.json { render :show, status: :created, location: @boat_document }\n else\n format.html { render :new }\n format.json { render json: @boat_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, :notice => 'Document was successfully created.' }\n format.json { render :json => @document, :status => :created, :location => @document }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @historic = Historic.new(historic_params)\n\n respond_to do |format|\n if @historic.save\n format.html { redirect_to @historic, notice: 'Historic was successfully created.' }\n format.json { render :show, status: :created, location: @historic }\n else\n format.html { render :new }\n format.json { render json: @historic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @document_history.destroy\n respond_to do |format|\n format.html { redirect_to document_histories_url, notice: 'Document history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @invoice_history = InvoiceHistory.new(invoice_history_params)\n\n respond_to do |format|\n if @invoice_history.save\n format.html { redirect_to @invoice_history, notice: \"Invoice history was successfully created.\" }\n format.json { render :show, status: :created, location: @invoice_history }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @invoice_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.find(params[:customer_id])\n @historial = @customer.historial.new(historial_params)\n\n respond_to do |format|\n if @historial.save\n format.html { redirect_to @customer}\n format.json { render :show, status: :created, location: @historial }\n else\n format.html { render :new }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render jbuilder: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @document = Document.new(document_params)\n\n if @document.save\n render :show, status: :created, location: @document\n else\n render json: @document.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n @corpus = Corpus.new(params[:corpus])\n\n saved = @corpus.save\n @corpus.compile_histogram if saved\n\n respond_to do |format|\n if saved\n format.html { redirect_to @corpus, notice: 'Corpus was successfully created.' }\n format.json { render json: @corpus, status: :created, location: @corpus }\n else\n format.html { render action: \"new\" }\n format.json { render json: @corpus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def historic_params\n params.require(:historic).permit(:description, :text, :disapeared_id, :date, :status_id)\n end",
"def create\n @operation_history = OperationHistory.new(params[:operation_history])\n\n respond_to do |format|\n if @operation_history.save\n format.html { redirect_to @operation_history, notice: 'Operation history was successfully created.' }\n format.json { render json: @operation_history, status: :created, location: @operation_history }\n else\n format.html { render action: \"new\" }\n format.json { render json: @operation_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def article_history_params\n params.require(:article_history).permit(:title, :abstract, :content, :url, :document_contents)\n end",
"def create\n @special_document = ModifiedDocument.new(params[:special_document])\n\n respond_to do |format|\n if @special_document.save\n format.html { redirect_to @special_document, notice: 'Special document was successfully created.' }\n format.json { render json: @special_document, status: :created, location: @special_document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @special_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n \t\n @companydocument = Companydocument.new(params[:companydocument])\n\n respond_to do |format|\n if @companydocument.save\n format.html { redirect_to @companydocument, notice: 'Companydocument was successfully created.' }\n format.json { render json: @companydocument, status: :created, location: @companydocument }\n else\n format.html { render action: \"new\" }\n format.json { render json: @companydocument.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def show\n @document_history = DocumentHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document_history }\n end\n end",
"def get_scroll_history\n # \"scroll_speed\", \"towards_address_bar\", \"churn\", \"sid\"\n begin\n if %w(1 true).include?(ENV['disable_scroll_history_saving'].to_s)\n render json: {error: 'too much data to record'}\n else\n puts \"get scroll history: #{scroll_history_params.inspect}\"\n sh = ScrollHistory.create(scroll_history_params)\n\n render json: sh.attributes.to_json\n end\n\n rescue Exception => e\n render json: {error: e.inspect}\n end\n end",
"def index\n @invoice_histories = InvoiceHistory.all\n end",
"def index\n @article_histories = ArticleHistory.all\n end",
"def add_document(opts={})\n raise ArgumentError, \":title is required\" if opts[:title].nil?\n raise ArgumentError, \":body is required\" if opts[:body].nil?\n raise ArgumentError, \":url is required\" if opts[:url].nil?\n \n if opts[:tags].is_a?(Array)\n opts[:tags] = opts[:tags].join(\",\")\n end\n \n doc = opts.to_json\n \n Srchio::Response.new(self.class.post(\"/searchers/#{searcher_id}/documents\", :body => doc))\n end",
"def create\n @modified_document = ModifiedDocument.new(modified_document_params)\n \n if @modified_document.save\n render json: @modified_document, status: :ok\n else\n render json: @modified_document.errors, status: :unprocessable_entity\n end\n end",
"def write_document_to_index(document)\n\n end",
"def toe_doc_history\n @termcondition = @matter.matter_termcondition\n @toe_doc = DocumentHome.find(params[:document_home_id])\n render :partial => \"toe_doc_history\"\n end",
"def history_item_params\n params.require(:history_item).permit(:observation, :animal_id, :document_id, :user_id)\n end",
"def create \n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to documents_path, notice: 'Document was successfully created.' }\n format.json { render :show, status: :created, location: document_path }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def update\n @document_history = DocumentHistory.find(params[:id])\n\n respond_to do |format|\n if @document_history.update_attributes(params[:document_history])\n format.html { redirect_to @document_history, notice: 'Document history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n \n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n \n end",
"def create\n @document = Document.new(document_params)\n\n if @document.save\n render json: {status: 'SUCCESS', message:'Document created', data:@document}, status: :ok\n else\n render json: {status: 'ERROR', message:'Document not created', data:@document.errors}, status: :unprocessable_entity\n end\n\n end",
"def create\n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\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 create\n @legal_document = LegalDocument.new(legal_document_params)\n\n respond_to do |format|\n if @legal_document.save\n format.html { redirect_to patient_clinic_history_legal_documents_path(params[:patient_id],params[:clinic_history_id]), notice: 'Legal document was successfully created.' }\n format.json { render :show, status: :created, location: @legal_document }\n else\n format.html { render :new }\n format.json { render json: @legal_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @search_histories = SearchHistory.all\n end",
"def create\n @distribution_audit = DistributionAudit.new(params[:distribution_audit])\n\n respond_to do |format|\n if @distribution_audit.save\n format.html { redirect_to @distribution_audit, :notice => 'Distribution audit was successfully created.' }\n format.json { render :json => @distribution_audit, :status => :created, :location => @distribution_audit }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @distribution_audit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n d_params = document_params.clone\n d_params[:date_opened] = DateTime.strptime(params[:document][:date_opened], '%m/%d/%Y').to_date\n @document = Document.new(d_params)\n @document.user = current_user\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render action: 'show', status: :created, location: @document }\n else\n format.html { render action: 'new' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @special_documents = ModifiedDocument.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @special_documents }\n end\n end",
"def create\n\t \n\tdata = unpack_document(params[:document][:datafile]) \n\tdoc_params = {:title => document_params[\"title\"], :date => get_date(document_params,\"date\")}\n\tif !data.nil? then\n\t\tdoc_params[:content] = data[:content]\n\t\tdoc_params[:styles] = data[:styles]\n\tend\n @document = Document.new(doc_params)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render action: 'show', status: :created, location: @document }\n else\n format.html { render action: 'new' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shared_document = SharedDocument.new(shared_document_params)\n\n respond_to do |format|\n if @shared_document.save\n # format.html { redirect_to @shared_document, notice: 'Shared document was successfully created.' }\n format.json { render json: @shared_document.to_json({}) }\n else\n format.html { render action: 'new' }\n format.json { render json: @shared_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @reading_histories = current_user.reading_histories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reading_histories }\n end\n end",
"def new\n @historial = Historial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial }\n end\n end",
"def create\n @document = Document.new(resource_params)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Primary document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @search_history = SearchHistory.new(search_history_params)\n\n respond_to do |format|\n if @search_history.save\n format.html { redirect_to @search_history, notice: 'Search history was successfully created.' }\n format.json { render :show, status: :created, location: @search_history }\n else\n format.html { render :new }\n format.json { render json: @search_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @historial_odt = HistorialOdt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial_odt }\n end\n end",
"def create\n @admin_history = Admin::History.new(admin_history_params)\n\n respond_to do |format|\n if @admin_history.save\n format.html { redirect_to admin_histories_path, notice: '新增歷史成功' }\n format.json { render :show, status: :created, location: @admin_history }\n else\n format.html { render :new }\n format.json { render json: @admin_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\n format.html{\n flash[:success] = \"Document has saved successfully!\"\n redirect_to @document\n }\n format.json {\n url = url_for @document\n render json: {\n status_code: 0,\n response:{\n url: url\n }\n }\n }\n else\n format.html{ render 'new' }\n format.json {\n render json: {\n status_code: 1,\n errors: @document.errors\n }\n }\n end\n end\n end",
"def create\n @query_history = QueryHistory.new(params[:query_history])\n\n respond_to do |format|\n if @query_history.save\n format.html { redirect_to @query_history, notice: 'Query history was successfully created.' }\n format.json { render json: @query_history, status: :created, location: @query_history }\n else\n format.html { render action: \"new\" }\n format.json { render json: @query_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @documents.map{|document| document.to_jq_upload } }\n \n end\n end",
"def create\n @book = Book.new(params[:book])\n\n for article in @book.articles\n current_aspect.references << article\n end\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\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 history\n @purchase_requisition = PurchaseRequisition.find(params[:id])\n\n \n @audits=Kaminari.paginate_array(@purchase_requisition.audits.sort_by{|e| -e.id}).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchase_requisitions }\n end \n\n end",
"def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to documents_path, notice: 'Document was successfully uploaded.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render new_document_path }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\n \t\n @companydocument = Companydocument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @companydocument }\n end\n\n end",
"def index\n @points_histories = PointsHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @points_histories }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def save_thought(n_dink)\n\t#format thought\n\tputs n_dink\n\t#n_dink[\"duedate\"] = ;\n\tn_dink[\"timestamp\"] = Time.now.getutc\n\tn_dink[\"id\"] = (Random.rand() * 10000).to_i\n\t#read json\n\tfile = File.read(\"./public/history.json\")\n\tdata_hash = JSON.parse(file)\n\tnew_data = []\n\tfor dink in data_hash\n\t\tnew_data.push(dink)\n\tend\n\tnew_data.push(n_dink)\n\tnew_data = new_data.sort_by { |hash| hash['duedate'].tr('-','').to_i }\n\tFile.open(\"./public/history.json\",\"w\") do |file|\n\t\tfile.write(new_data.to_json)\n\tend\n\tnew_data\nend",
"def post_append_document(request)\n data, _status_code, _headers = post_append_document_with_http_info(request)\n request_token if _status_code == 401\n data\n end",
"def create\n @historial = Historial.new(params[:historial])\n @historial.cartucho = Cartucho.find(params[:cartucho_id])\n \n\n respond_to do |format|\n if @historial.save\n format.html { redirect_to @historial.cartucho, notice: 'Historial was successfully created.' }\n else\n format.html { render action: \"new\" }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @album = Album.new(album_params)\n @album.user_id = current_user.id\n\n respond_to do |format|\n if @album.save\n @album.update_histories.create(user_id: current_user.id, action_type: UpdateHistory::ALBUM_CREATE)\n format.html { redirect_to @album, notice: 'アルバムを作成しました。' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @histories = History.where(fandom_id: params[:fandom_id]).order(event_date: :desc)\n \n hash = {}\n @histories.unscope(:order).order(event_date: :asc).each do |history|\n hash[history.event_date.year.to_s.to_sym] = history.event_date.strftime('%F')\n end\n @years_hash = hash.to_a.reverse.to_h\n end",
"def index_documents\n @params = {}\n @action = 'index_documents'\n \n send_auth_request\n end",
"def project_histories_params\n params.require('project_histories').permit(:project_id, :project_attr, :text, :history_type, :is_reply_to, :user_id)\n end",
"def create\n @journal_doc_report = JournalDocReport.new(journal_doc_report_params)\n\n respond_to do |format|\n if @journal_doc_report.save\n format.html { redirect_to @journal_doc_report, notice: 'Journal doc report was successfully created.' }\n format.json { render :show, status: :created, location: @journal_doc_report }\n else\n format.html { render :new }\n format.json { render json: @journal_doc_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add(document)\n @rest.post(\"/#{@db_name}\", [document])\n end"
] |
[
"0.6826042",
"0.6532865",
"0.6462636",
"0.6339968",
"0.62200975",
"0.61506677",
"0.6149327",
"0.60513204",
"0.6023878",
"0.5999612",
"0.5961733",
"0.58554316",
"0.5849497",
"0.57504565",
"0.57474196",
"0.571343",
"0.57078207",
"0.5681089",
"0.56593907",
"0.5637676",
"0.5634168",
"0.562508",
"0.56179166",
"0.56160444",
"0.5614949",
"0.5599931",
"0.5568208",
"0.5562152",
"0.5542922",
"0.5538906",
"0.5537303",
"0.55118656",
"0.55102545",
"0.55029726",
"0.54789954",
"0.5465258",
"0.5456328",
"0.5456328",
"0.5451017",
"0.54438245",
"0.5430566",
"0.542052",
"0.54144496",
"0.54082",
"0.5406461",
"0.54038984",
"0.53979164",
"0.5397244",
"0.539381",
"0.53869885",
"0.5382709",
"0.5372848",
"0.5364912",
"0.53496885",
"0.533754",
"0.5321229",
"0.5320161",
"0.5314462",
"0.530572",
"0.5292132",
"0.5290549",
"0.5285746",
"0.5282525",
"0.5276018",
"0.5271581",
"0.52696735",
"0.5262592",
"0.5257746",
"0.5246364",
"0.5232712",
"0.5228717",
"0.5218105",
"0.52156013",
"0.5213577",
"0.5199036",
"0.51923645",
"0.51921386",
"0.51842165",
"0.5178461",
"0.51708156",
"0.5163818",
"0.5163251",
"0.5163172",
"0.5163172",
"0.5163172",
"0.5163172",
"0.5163172",
"0.5163172",
"0.5163172",
"0.5163172",
"0.5163172",
"0.5163147",
"0.51611507",
"0.515851",
"0.51584655",
"0.51583517",
"0.51558805",
"0.5155095",
"0.51550424",
"0.5153946"
] |
0.6751136
|
1
|
PUT /document_histories/1 PUT /document_histories/1.json
|
def update
@document_history = DocumentHistory.find(params[:id])
respond_to do |format|
if @document_history.update_attributes(params[:document_history])
format.html { redirect_to @document_history, notice: 'Document history was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @document_history.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @document_history.update(document_history_params)\n format.html { redirect_to documents_url, notice: 'Document history was successfully updated.' }\n format.json { render :show, status: :ok, location: @document_history }\n else\n format.html { render :edit }\n format.json { render json: @document_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @document_history = DocumentHistory.new(document_history_params)\n\n respond_to do |format|\n if @document_history.save\n docs = Document.find(@document_history.document_id)\n docs.update_column(:status, @document_history.remarks)\n format.html { redirect_to documents_url, notice: 'Document history was successfully created.' }\n format.json { render :show, status: :created, location: @document_history }\n else\n format.html { render :new }\n format.json { render json: @document_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @finance_document = FinanceDocument.find(params[:id])\n\n if @finance_document.update(finance_document_params)\n audit(@finance_document, current_user)\n head :no_content\n else\n render json: @finance_document.errors, status: :unprocessable_entity\n end\n end",
"def set_document_history\n @document_history = DocumentHistory.find(params[:id])\n end",
"def index\n @document_histories = DocumentHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @document_histories }\n end\n end",
"def put_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Put.new(uri)\n req.body = document.to_json\n run(uri, req)\n end",
"def create\n @document_history = DocumentHistory.new(params[:document_history])\n\n respond_to do |format|\n if @document_history.save\n format.html { redirect_to @document_history, notice: 'Document history was successfully created' }\n format.json { render json: @document_history, status: :created, location: @document_history }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @document_histories = DocumentHistory.all\n end",
"def update\n respond_to do |format|\n if @histroal.update(histroal_params)\n format.html { redirect_to @histroal, notice: 'Historial was successfully updated.' }\n format.json { render :show, status: :ok, location: @histroal }\n else\n format.html { render :edit }\n format.json { render json: @histroal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}/_update\")\n req = Net::HTTP::Post.new(uri)\n req.body = { \"doc\": document }.to_json\n run(uri, req)\n end",
"def update\n respond_to do |format|\n if @historial.update(historial_params)\n format.html { redirect_to @historial, notice: 'Historial was successfully updated.' }\n format.json { render :show, status: :ok, location: @historial }\n else\n format.html { render :edit }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @historial.update(historial_params)\n format.html { redirect_to @historial, notice: 'Historial was successfully updated.' }\n format.json { render :show, status: :ok, location: @historial }\n else\n format.html { render :edit }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @document = Document.find(params[:id])\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.json { render :json => nil, :status => :ok }\n format.html { redirect_to(@document, :notice => 'Document was successfully updated.') }\n else\n format.json { render :json => @document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\r\n params[:document][:version] = ENV[\"VERSION\"]\r\n params[:document][:username] = current_user.username\r\n @document = Document.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @document.update_attributes(document_params)\r\n format.html { redirect_to @document, notice: 'Document 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: @document.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def destroy\n @document_history = DocumentHistory.find(params[:id])\n @document_history.destroy\n\n respond_to do |format|\n format.html { redirect_to document_histories_url }\n format.json { head :no_content }\n end\n end",
"def update\n if params[:resource][:document].present?\n @resource.document.purge\n @resource.document.attach(params[:resource][:document])\n end\n if params[:resource][:sample].present?\n @resource.sample.purge\n @resource.sample.attach(params[:resource][:sample])\n end\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def head(params)\n raise Couchdbtools::Error::DocumentRevisionRequired unless params['_rev']\n request.method = :put\n execute(params)\n end",
"def update\n respond_to do |format|\n if @has_document.update(has_document_params)\n format.html { redirect_to @has_document, notice: 'Has document was successfully updated.' }\n format.json { render :show, status: :ok, location: @has_document }\n else\n format.html { render :edit }\n format.json { render json: @has_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n document = Document.find(params[:id])\n document.update!(update_params)\n render json: {}\n end",
"def update\n respond_to do |format|\n if @weekly_histogram.update(weekly_histogram_params)\n format.html { redirect_to @weekly_histogram, notice: 'Weekly histogram was successfully updated.' }\n format.json { render :show, status: :ok, location: @weekly_histogram }\n else\n format.html { render :edit }\n format.json { render json: @weekly_histogram.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @historial_odt = HistorialOdt.find(params[:id])\n\n respond_to do |format|\n if @historial_odt.update_attributes(params[:historial_odt])\n format.html { redirect_to @historial_odt, notice: 'Historial odt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historial_odt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @historial = Historial.find(params[:id])\n\n respond_to do |format|\n if @historial.update_attributes(params[:historial])\n format.html { redirect_to @historial.cartucho, notice: 'Historial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book_history.update(book_history_params)\n format.html { redirect_to @book_history, notice: 'Book history was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_history }\n else\n format.html { render :edit }\n format.json { render json: @book_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update_attributes(params[:document])\n save_log({ :action => 'EDIT', :document => { :before => @old_document, :after => @document}})\n flash[:notice] = 'Document was successfully updated.'\n format.html { redirect_to(@document) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to :action => \"index\", notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to @document, :notice => 'Document was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n @document.create_activity :update, owner: current_user\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def perform\n histories << SearchTermHistory.create\n touch # updated_at does not update automatically...\n end",
"def update\n \t@document = Document.find(params[:id])\n if @document.update_attributes(document_params)\n render json: {status: 'SUCCESS', message:'Document updated', data:@document}, status: :ok\n else\n\t\trender json: {status: 'ERROR', message:'Document not updated', data:@document.errors}, status: :unprocessable_entity\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to root_url , notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n document = @document.revision.versions.new(document_params(true))\n if document.save\n send_emails_helper(document)\n render json: document.attributes_for_edit\n else\n render json: document.errors, status: :unprocessable_entity\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def orchio_put(jdoc)\n response = client.send_request :put, inst_args(json: jdoc)\n if cache.enabled?\n simple_cache.save(\n Document.new(\n response.body.to_hash,\n Metadata.new(\n :collection => ocollection,\n :key => @id,\n :ref => response.header.etag\n )))\n end\n set_ref_value response\n orchio_status response, 201\n end",
"def update\n document = Document.find(params[:id])\n if document.update(params_document)\n render json: document, status: 200\n else\n render json: document.errors, status: 422\n end\n\n end",
"def post_to_historical(data_hash, title_number)\n\n response = rest_post_call($HISTORIAN_URL + '/' + title_number, data_hash.to_json)\n\n if (response.code != '200') then\n raise \"Failed to create the historical data: \" + response.body\n end\n\n return response.body\nend",
"def update\n @modified_document = ModifiedDocument.find(params[:id])\n \n if @modified_document.update(modified_document_params)\n render json: @modified_document, status: :ok \n else\n render json: @modified_document.errors, status: :unprocessable_entity\n end\n end",
"def write_document_to_index(document)\n\n end",
"def update\n respond_to do |format|\n if @comm_history.update(comm_history_params)\n @inspection = @comm_history.try(:bid).try(:inspection)\n create_documents\n format.html { redirect_to @comm_history, notice: 'Bids follow up was successfully updated.' }\n format.json { render :show, status: :ok, location: @comm_history }\n else\n format.html { render :edit }\n format.json { render json: @comm_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n add_breadcrumb @document.name, library_category_library_document_path(@category, @document)\n add_breadcrumb \"Modify\"\n\n respond_to do |format|\n if @document.update(document_params)\n notify_user(:notice, 'Document was successfully updated.')\n format.html { redirect_to library_category_library_document_path(@category, @document) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to edit_document_path(@document), notice: 'Documento gardado correctamente' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def create\n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\n puts \"id is: \" + @document.id.to_s\n puts \"received_from_name is: \" + @document.user_id.to_s\n puts \"received_from_office is: \" + @document.department_id.to_s\n DocumentHistory.create(:document_id => @document.id, :received_by_name => @document.user_id, :received_by_office => @document.department_id, :received_from_name => @document.user_id, :received_from_office => @document.department_id, :subject => @document.subject, :remarks => @document.status)\n format.html { redirect_to documents_url, 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 update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(resource_params)\n format.html { redirect_to @document, notice: 'Primary document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to @document, :flash => { :success => 'Document was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to documents_path, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @document = args[:document] if args.key?(:document)\n end",
"def update!(**args)\n @document = args[:document] if args.key?(:document)\n end",
"def new\n @document_history = DocumentHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_history }\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n # format.json { head :no_content }\n format.json { render jbuilder: @document }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @historical = Historical.find(params[:id])\n\n respond_to do |format|\n if @historical.update_attributes(params[:historical])\n format.html { redirect_to @historical, notice: 'Historical was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @legal_document.update(legal_document_params)\n format.html { redirect_to patient_clinic_history_legal_documents_path(params[:patient_id],params[:clinic_history_id]), notice: 'Legal document was successfully updated.' }\n format.json { render :show, status: :ok, location: @legal_document }\n else\n format.html { render :edit }\n format.json { render json: @legal_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @special_document = ModifiedDocument.find(params[:id])\n\n respond_to do |format|\n if @special_document.update_attributes(params[:special_document])\n format.html { redirect_to @special_document, notice: 'Special document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @special_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @historic.update(historic_params)\n format.html { redirect_to @historic, notice: 'Historic was successfully updated.' }\n format.json { render :show, status: :ok, location: @historic }\n else\n format.html { render :edit }\n format.json { render json: @historic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n Log.create! description: \"#{current_user.email} updated #{@document.name} at #{@document.updated_at.strftime '%d-%m-%Y %H:%M:%S'}\", role_id: current_user.roles.ids.first\n format.html { redirect_to admin_document_path(@document), notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\tdata = unpack_document(params[:document][:datafile]) \n\tdoc_params = {:title => document_params[\"title\"], :date => get_date(document_params,\"date\")}\n\tif !data.nil? then\n\t\tdoc_params[:content] = data[:content]\n\t\tdoc_params[:styles] = data[:styles]\n\tend\n respond_to do |format|\n if @document.update(doc_params)\n format.html { redirect_to @document, notice: \"Document updated successfully\"}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @invoice_history.update(invoice_history_params)\n format.html { redirect_to @invoice_history, notice: \"Invoice history was successfully updated.\" }\n format.json { render :show, status: :ok, location: @invoice_history }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @invoice_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: \"Document was successfully updated.\" }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @document_history = DocumentHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document_history }\n end\n end",
"def update\n\n @documentable = @document.documentable\n\n respond_to do |format|\n if @document.update(document_params)\n notify_user(:notice, 'Document was successfully updated.')\n format.html { redirect_to get_resource_url(@documentable) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boat_document.update(boat_document_params)\n format.html { redirect_to @boat_document, notice: 'Boat document was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat_document }\n else\n format.html { render :edit }\n format.json { render json: @boat_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n version_attributes = params.require(:version).permit(:id, :file, :file_file_name, :version, :uploaded_by, :reason)\n @document = Document.find(params[:document_id])\n @document.versions << Version.create(version_attributes)\n render :json => @document, :include => [:versions]\n end",
"def update\n @event_subscription.update(event_subscription_params)\n @event_subscription.save\n\n file_params.each do |requirement|\n if(requirement[\"doc\"])\n requirement.symbolize_keys\n requirement[:doc].symbolize_keys\n path = \"data:#{requirement[:doc][:filetype]};base64, #{requirement[:doc][:base64]}\"\n Document.update(id: requirement[:doc][:id],\n user_id: @event_subscription.user_id,\n requirement_id: requirement[:id],\n state: \"pending_review\",\n path: path\n )\n end\n end\n render json: @event_subscription, status: :updated\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @document_id = args[:document_id] if args.key?(:document_id)\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def document_history_params\n params.require(:document_history).permit(:document_id, :received_by_name, :received_by_office, :received_from_name, :received_from_office, :length_of_stay, :remarks, :max_stay, :subject)\n end",
"def update\n @squadron_document = SquadronDocument.find(params[:id])\n\n respond_to do |format|\n if @squadron_document.update_attributes(params[:squadron_document])\n format.html { redirect_to @squadron_document, :notice => 'Squadron document was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @squadron_document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @document_history.destroy\n respond_to do |format|\n format.html { redirect_to document_histories_url, notice: 'Document history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n if (@document = Document.find(params[:id])).update_attributes(params[:document])\n flash['notice'] = 'Document was successfully updated.'\n end\n respond_with @document, \n :location => site_document_url(@document.site.slug , @document.id.to_s)\n end",
"def update\n respond_to do |format|\n if @votaciones_hist.update(votaciones_hist_params)\n format.html { redirect_to @votaciones_hist, notice: 'Votaciones hist was successfully updated.' }\n format.json { render :show, status: :ok, location: @votaciones_hist }\n else\n format.html { render :edit }\n format.json { render json: @votaciones_hist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n Rails.logger.info \"Before update\"\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n Rails.logger.info \"After update\"\n end",
"def update!(**args)\n @document_id = args[:document_id] if args.key?(:document_id)\n @status = args[:status] if args.key?(:status)\n end",
"def create\n @finance_document = FinanceDocument.new(finance_document_params)\n\n if @finance_document.save\n audit(@finance_document, current_user)\n render json: @finance_document, status: :created\n else\n render json: @finance_document.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @article_history.update(article_history_params)\n format.html { redirect_to @article_history, notice: 'Article history was successfully updated.' }\n format.json { render :show, status: :ok, location: @article_history }\n else\n format.html { render :edit }\n format.json { render json: @article_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @document.update_attributes(document_params)\n redirect_to catalog_account_catalog_document_path(@account, @catalog, @document)\n end",
"def update\n @corpus = Corpus.find(params[:id])\n saved = @corpus.update_attributes(params[:corpus])\n\n @corpus.compile_histogram if saved\n\n respond_to do |format|\n if saved\n format.html { redirect_to @corpus, notice: 'Corpus was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @corpus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n\r\n respond_to do |format|\r\n if @document.update(document_params)\r\n format.html { redirect_to root_url, notice: 'Document was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @document }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @document.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n historial_params = params[:historial]\n with_bill = historial_params.delete(:with_bill)\n @historial = Historial.find(params[:id])\n\n respond_to do |format|\n if @historial.update_attributes(historial_params)\n if with_bill.present?\n format.html { redirect_to new_bill_path(\n client_id: @historial.cliente_id,\n historial_id: @historial.id\n ), notice: 'Presupuesto actualizado =)'}\n else\n format.html { redirect_to @historial, notice: 'Presupuesto actualizado =)' }\n end\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @history = History.find(params[:id])\n respond_to do |format|\n\n @history.update(status: 0)\n format.html { redirect_to @history, notice: 'Released successfully!!' }\n\n end\n end",
"def update\n @reading_history = current_user.reading_histories.find(params[:id])\n\n respond_to do |format|\n if @reading_history.update_attributes(params[:reading_history])\n data_new = params[:reading_history]\n format.html { redirect_to data_new[\"html_path\"], notice: data_new.to_s }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reading_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put( doc, opts = {} )\n response = http_action :put, doc, opts.merge( :doc => doc )\n doc['_id'], doc['_rev'] = response['id'], response['rev'] if doc.kind_of? Hash\n response\n end",
"def update\n @operation_history = OperationHistory.find(params[:id])\n\n respond_to do |format|\n if @operation_history.update_attributes(params[:operation_history])\n format.html { redirect_to @operation_history, notice: 'Operation history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @operation_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @documentations = args[:documentations] if args.key?(:documentations)\n @title = args[:title] if args.key?(:title)\n end",
"def update_document(document, params)\n # this will only work if there is only one datastream being updated.\n # once ActiveFedora::MetadataDatastream supports .update_datastream_attributes, use that method instead (will also be able to pass through params[\"asset\"] as-is without usin prep_updater_method_args!)\n # result = document.update_indexed_attributes(params[:params], params[:opts])\n result = document.update_datastream_attributes(params)\n end",
"def update_document(document, params)\n # this will only work if there is only one datastream being updated.\n # once ActiveFedora::MetadataDatastream supports .update_datastream_attributes, use that method instead (will also be able to pass through params[\"asset\"] as-is without usin prep_updater_method_args!)\n # result = document.update_indexed_attributes(params[:params], params[:opts])\n result = document.update_datastream_attributes(params)\n end",
"def update\n @document = load_document_from_params\n # generates sanatized params from params hash to update the doc with\n sanitize_update_params\n @response = update_document(@document,@sanitized_params)\n @document.save\n flash[:notice] = \"Your changes have been saved.\"\n if params.has_key? :add_another_author\n redirect_to({:controller => \"catalog\", :action => \"edit\", :id => params[:id], :wf_step => :contributor, :add_contributor => true}) \n else\n redirect_to( {:controller => \"catalog\", :action => \"edit\", :id => params[:id]}.merge(params_for_next_step_in_wokflow) )\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to edit_admin_document_path(@document), notice: 'Document was successfully updated.' }\n format.js { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_documentary\n @documentary = Documentary.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @admin_history.update(admin_history_params)\n format.html { redirect_to admin_histories_path, notice: '更新歷史成功' }\n format.json { render :show, status: :ok, location: @admin_history }\n else\n format.html { render :edit }\n format.json { render json: @admin_history.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.67855597",
"0.6583278",
"0.631288",
"0.62327373",
"0.60932916",
"0.60357744",
"0.6006562",
"0.59769696",
"0.5914936",
"0.58803964",
"0.5868203",
"0.5868203",
"0.5795932",
"0.57838583",
"0.57754815",
"0.57581544",
"0.5755256",
"0.57471627",
"0.5733513",
"0.57193327",
"0.5712036",
"0.5705655",
"0.5703174",
"0.5699884",
"0.56909096",
"0.56908375",
"0.568985",
"0.5683262",
"0.567826",
"0.5677594",
"0.56708765",
"0.56698394",
"0.5667529",
"0.5667529",
"0.5667529",
"0.5666369",
"0.5660726",
"0.56516653",
"0.56435865",
"0.5639023",
"0.5634897",
"0.56320244",
"0.5630956",
"0.5614931",
"0.5600153",
"0.55953723",
"0.5593581",
"0.5580938",
"0.5580938",
"0.5565455",
"0.55470556",
"0.55397034",
"0.553174",
"0.55142",
"0.5511084",
"0.54978967",
"0.54846305",
"0.5471151",
"0.5470771",
"0.5462382",
"0.5461226",
"0.54515755",
"0.54492676",
"0.5445179",
"0.5445106",
"0.5445106",
"0.5445106",
"0.54411113",
"0.54411113",
"0.54411113",
"0.54411113",
"0.54411113",
"0.54411113",
"0.54411113",
"0.5440758",
"0.5438939",
"0.5433095",
"0.5430829",
"0.54230154",
"0.54212844",
"0.54183424",
"0.5417024",
"0.5415977",
"0.5415069",
"0.54140663",
"0.5410677",
"0.54074395",
"0.5405015",
"0.54028845",
"0.5400054",
"0.5389216",
"0.5386012",
"0.5380639",
"0.5374049",
"0.53718585",
"0.53718585",
"0.5361174",
"0.53412336",
"0.5340379",
"0.53389025"
] |
0.6824572
|
0
|
DELETE /document_histories/1 DELETE /document_histories/1.json
|
def destroy
@document_history = DocumentHistory.find(params[:id])
@document_history.destroy
respond_to do |format|
format.html { redirect_to document_histories_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @document_history.destroy\n respond_to do |format|\n format.html { redirect_to document_histories_url, notice: 'Document history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @historial_odt = HistorialOdt.find(params[:id])\n @historial_odt.destroy\n\n respond_to do |format|\n format.html { redirect_to historial_odts_url }\n format.json { head :no_content }\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\n @history.destroy\n respond_to do |format|\n format.html { redirect_to histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unified_history.destroy\n respond_to do |format|\n format.html { redirect_to unified_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @history_file_delete.destroy\n respond_to do |format|\n format.html { redirect_to history_file_deletes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.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 @document.destroy\n save_log({ :action => 'DELETE', :document => { :before => @old_document }})\n #TODO delete the file from disk\n respond_to do |format|\n format.html { redirect_to(documents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @modified_document = ModifiedDocument.find(params[:id])\n \n if @modified_document.destroy\n render json: @modified_document, status: :ok \n else\n render json: @modified_document.errors, status: :unprocessable_entity\n end\n end",
"def delete\n @client.delete_document(@path)\n end",
"def delete_document( doc_id: )\n params = {}\n params[:backtrace] = @backtrace if @backtrace\n send_request :delete, url_for_base(doc_id), params, :json\n end",
"def destroy\n @histroal.destroy\n respond_to do |format|\n format.html { redirect_to historials_url, notice: 'Historial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @historial.destroy\n respond_to do |format|\n format.html { redirect_to historials_url, notice: 'Historial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word_history = WordHistory.find(params[:id])\n @word_history.destroy\n\n respond_to do |format|\n format.html { redirect_to word_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.create_activity :destroy, owner: current_user\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @special_document = ModifiedDocument.find(params[:id])\n @special_document.destroy\n\n respond_to do |format|\n format.html { redirect_to special_documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n audit(@finance_document, current_user)\n @finance_document.destroy\n\n head :no_content\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to back_index_case_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to back_index_case_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def delete_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Delete.new(uri)\n run(uri, req)\n end",
"def destroy\n @item_history.destroy\n respond_to do |format|\n format.html { redirect_to bmet_item_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article_history.destroy\n respond_to do |format|\n format.html { redirect_to article_histories_url, notice: 'Article history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weekly_histogram.destroy\n respond_to do |format|\n format.html { redirect_to weekly_histograms_url, notice: 'Weekly histogram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :ok }\n end\n end",
"def deleteEntityDocument( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/document\",params)\n end",
"def destroy\n @documento = Documento.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to documentos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @document = Document.find(params[:id])\r\n @document.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to documents_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_documents_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @operation_history = OperationHistory.find(params[:id])\n @operation_history.destroy\n\n respond_to do |format|\n format.html { redirect_to operation_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \t\n @companydocument = Companydocument.find(params[:id])\n @companydocument.destroy\n\n respond_to do |format|\n format.html { redirect_to companydocuments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @squadron_document = SquadronDocument.find(params[:id])\n @squadron_document.destroy\n\n respond_to do |format|\n format.html { redirect_to squadron_documents_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @invoice_history.destroy\n respond_to do |format|\n format.html { redirect_to invoice_histories_url, notice: \"Invoice history was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @legal_document.destroy\n respond_to do |format|\n format.html { redirect_to patient_clinic_history_legal_documents_path(params[:patient_id],params[:clinic_history_id]), notice: 'Legal document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @query_history = QueryHistory.find(params[:id])\n @query_history.destroy\n\n respond_to do |format|\n format.html { redirect_to query_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to documents_url }\n # format.json { head :no_content }\n format.json { render json: @document }\n end\n end",
"def destroy\n @boat_document.destroy\n respond_to do |format|\n format.html { redirect_to boat_documents_url, notice: 'Boat document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @historic.destroy\n respond_to do |format|\n format.html { redirect_to historics_url, notice: 'Historic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @history = History.find(params[:id])\n @history.destroy\n\n respond_to do |format|\n format.html { redirect_to(histories_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n Audit.find(params[:id]).destroy\n head :no_content\n end",
"def destroy\n @history.destroy\n\n respond_to do |format|\n format.html { redirect_to(histories_url, :notice => \"削除しました\") }\n format.xml { head :ok }\n end\n end",
"def delete\n # mark each version of the history as deleted, not just the most recent one\n @patient.histories\n .where(original_comment_id: @history.original_comment_id)\n .update_all({ deleted_by: current_user.email, delete_reason: params.permit(:delete_reason)[:delete_reason], updated_at: DateTime.now })\n end",
"def destroy\n @admin_history.destroy\n respond_to do |format|\n format.html { redirect_to admin_histories_url, notice: '刪除歷史成功' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @documentable = @document.documentable\n @document.destroy\n\n notify_user(:notice, 'Document was successfully removed.')\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path) }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @medical_history.destroy\r\n respond_to do |format|\r\n format.html { redirect_to medical_histories_url, notice: 'Historial medico borrado con exito.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @doc = Doc.find(params[:id])\n @doc.destroy\n\n respond_to do |format|\n format.html { redirect_to docs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n if @document.destroy\n render json: @document, status: :accepted\n else\n render json: {errors: @document.errors.full_messages}, status: :unprocessable_entity\n end\n end",
"def destroy\n @has_document.destroy\n respond_to do |format|\n format.html { redirect_to has_documents_url, notice: 'Has document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Documento eliminado correctamente' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document_status = DocumentStatus.find(params[:id])\n @document_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_document_statuses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n # TODO: should admin or librarian be allowed to perform this action?\n @book_history.destroy\n respond_to do |format|\n format.html { redirect_to book_histories_url, notice: 'Book history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \t@document = Document.find(params[:id])\n unless @document.blank?\n \tif @document.destroy\n \t\trender json: {status: 'SUCCESS', message:'Document deleted', data:@document}, status: :ok\n \telse \n \t\trender json: {status: 'ERROR', message:'Document was not deleted', data:@document}, status: :unprocessable_entity\n \tend\n else \n \t\trender json: {status: 'ERROR', message:'No such document', data:@document}, status: :unprocessable_entity\n end\n end",
"def destroy\n @shared_document.destroy\n respond_to do |format|\n format.html { redirect_to shared_documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @document.destroy\r\n respond_to do |format|\r\n format.html { redirect_to root_url, notice: 'Document was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @foodhistory.destroy\n respond_to do |format|\n format.html { redirect_to foodhistories_url, notice: 'Foodhistory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pediatric_history.destroy\n respond_to do |format|\n format.html { redirect_to pediatric_histories_url, notice: 'Historial borrado creado con exito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @medical_history.destroy\r\n respond_to do |format|\r\n format.html { redirect_to medical_histories_url, notice: 'Historial Medico eliminado.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @history.destroy\n respond_to do |format|\n format.html { redirect_to histories_url, notice: 'History was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @change_history = ChangeHistory.find(params[:id])\n @change_history.destroy\n\n respond_to do |format|\n format.html { redirect_to change_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @document.destroy\n\n notify_user(:notice, 'Document was successfully removed.')\n respond_to do |format|\n format.html { redirect_to library_category_path(@category) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @banal_document.destroy\n respond_to do |format|\n format.html { redirect_to banal_documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.file = nil\n @document.save\n @document.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Document was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: \"Document was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: \"Document was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document_item.destroy\n respond_to do |format|\n format.html { redirect_to document_items_url, notice: 'Document item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document = @maintenance.documents.find(params[:id])\n @document.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_maintenance_path(@vehicle, @maintenance), notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cocktail_history = CocktailHistory.find(params[:id])\n @cocktail_history.destroy\n\n respond_to do |format|\n format.html { redirect_to cocktail_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oa_sent_document = Oa::SentDocument.find(params[:id])\n @oa_sent_document.destroy\n\n respond_to do |format|\n format.html { redirect_to oa_sent_documents_url }\n format.json { head :ok }\n end\n end",
"def destroy\n authorize @document\n instruction = @document.instruction\n @document.destroy\n respond_to do |format|\n format.html { redirect_to instruction, notice: t('documents.destroy.success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @votaciones_hist.destroy\n respond_to do |format|\n format.html { redirect_to votaciones_hists_url, notice: 'Votaciones hist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.75103664",
"0.6973636",
"0.6949144",
"0.6892297",
"0.687828",
"0.6867968",
"0.68034446",
"0.6800372",
"0.67957",
"0.6773752",
"0.6766222",
"0.67589474",
"0.6742232",
"0.67400783",
"0.67357916",
"0.6732897",
"0.6730173",
"0.6724258",
"0.6724258",
"0.6713463",
"0.6713463",
"0.6713463",
"0.6713463",
"0.6713463",
"0.6713463",
"0.6713463",
"0.6713463",
"0.6713463",
"0.6709913",
"0.6709913",
"0.6709913",
"0.6709913",
"0.6709913",
"0.67090994",
"0.67088234",
"0.6702165",
"0.6701316",
"0.6699996",
"0.6698518",
"0.6698518",
"0.6672997",
"0.6670075",
"0.66673374",
"0.6659431",
"0.6654695",
"0.6637017",
"0.66329044",
"0.6622665",
"0.6615717",
"0.6611571",
"0.66070545",
"0.660493",
"0.66046685",
"0.6602946",
"0.66021895",
"0.65969217",
"0.65952194",
"0.6594182",
"0.659388",
"0.6572094",
"0.6544498",
"0.6544162",
"0.6543709",
"0.65413016",
"0.6540738",
"0.6526071",
"0.65207887",
"0.65152454",
"0.65102106",
"0.6502893",
"0.6498275",
"0.6489318",
"0.64792824",
"0.6479037",
"0.6478414",
"0.6478414",
"0.6478414",
"0.6478414",
"0.6478414",
"0.6478414",
"0.6478414",
"0.6478414",
"0.6478414",
"0.6478414",
"0.6478414",
"0.6478414",
"0.6478414",
"0.6478414",
"0.6477924",
"0.647469",
"0.6474023",
"0.6471756",
"0.6469124",
"0.6469124",
"0.6458841",
"0.6446663",
"0.644559",
"0.64395815",
"0.6438902",
"0.64313334"
] |
0.7814299
|
0
|
Method to add purchases
|
def add_transaction(database, user_id)
# Ask user for item name
puts "Enter name of purchase ('q' to quit):"
item = gets.chomp
if item == "q"
return
end
# Ask user for quantity of item
puts "Enter quantity of purchase ('q' to quit):"
# We only want digits stored in these columns
quantity = gets.chomp
if quantity == "q"
return
else
quantity = quantity.gsub(/[^\d\.]/, '').to_f
end
# Ask user for cost of item
puts "Enter cost of purchase ('q' to quit):"
cost = gets.chomp
if cost == "q"
return
else
cost = cost.gsub(/[^\d\.]/, '').to_f
end
# Record date as current date
date = Time.new.utc
# Insert the information into the purchases table of the database
database.execute(
"INSERT INTO purchases (item, quantity, cost, date, login_id)
VALUES ('#{item}', '#{quantity}', '#{cost}', '#{date}', '#{user_id}');"
)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_to_purchases(purchase_record)\n @purchases << purchase_record\n end",
"def add_to_pending(purchase)\r\n self.pending_purchases.push(purchase)\r\n end",
"def create\n purchase = @order.purchases.first(:conditions => {\n :purchasable_id => params[:purchase][:purchasable_id],\n :purchasable_type => params[:purchase][:purchasable_type]\n })\n\n if purchase\n purchase.quantity += params[:purchase][:quantity].to_i\n purchase.save\n else\n @order.purchases << Purchase.new(params[:purchase])\n @order.save\n end\n\n if params[:redirect_to]\n flash[:success] = %{#{params[:purchase][:name]} has been added to your order. <a href=\"/order/purchases\">Proceed to checkout</a>.} unless params[:hide_flash]\n redirect_to params[:redirect_to]\n else\n redirect_to order_purchases_path\n end\n end",
"def do_purchase\n user.purchases.create!(\n amount_in_cents: purchase_amount,\n employee_id: purchase_params.dig(:employee_id),\n qty: purchase_params.dig(:qty).to_i,\n venue_id: purchase_params.dig(:venue_id),\n tap_id: purchase_params.dig(:tap_id),\n description: purchase_params.dig(:description)\n )\n end",
"def add_purchase(customer_id, product_id)\n item = DirectedEdge::Item.new(@database, \"customer#{customer_id}\")\n item.link_to(\"product#{product_id}\")\n item.save\n end",
"def purchase\n response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options)\n transactions.create!(:action => \"purchase\", :amount => price_in_cents, :response => response)\n #UserMailer.ordered(\"google.com\", response.params.to_s, User.find(cart.user_id), cart).deliver\n cart.update_attribute(:purchased_at, Time.now) if response.success?\n response.success?\n end",
"def purchase(id)\n response = Shippo::API.post(\"#{url}/#{CGI.escape(id)}/purchase\")\n self.from(response)\n end",
"def purchase\n response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options)\n transactions.create!(:action => \"purchase\", :amount => price_in_cents, :response => response)\n #cart.update_attribute(:purchased_at, Time.now) if response.success?\n response.success?\n end",
"def purchase(purchase_amount)\n @total += purchase_amount\n format_money(@total)\n end",
"def add_transaction\r\n\r\n if(@type == :purchase)\r\n if(@product.stock == 0)\r\n begin\r\n raise OutOfStockError, \"OutOfStockError: '#{@product.title}' is out of stock\"\r\n rescue => error\r\n puts error\r\n end\r\n\r\n else\r\n modifiy_transactions\r\n edit_stock({new_purchase: true })\r\n @customer.transactions << self\r\n\r\n end\r\n else\r\n modifiy_transactions\r\n edit_stock({return_purchase: true})\r\n\r\n end\r\n end",
"def add_item(transaction_id, name, sku = nil, category = nil,\n price = nil, quantity = nil)\n \"ga('ecommerce:addItem', {\n 'id': '#{transaction_id}',\n 'name': '#{name}',\n 'sku': '#{sku}',\n 'category': '#{category}',\n 'price': '#{price}',\n 'quantity': '#{quantity}'\n });\"\n end",
"def add_item (title, price, quantity = 1)\n # adds purchase price to total\n @total += price * quantity\n # Adds proper quanity of item to cart\n count = 0\n while count < quantity\n @items << title\n count += 1\n end\n # keeps track of last_added item\n @last_transaction[:item] = title\n @last_transaction[:price] = price\n @last_transaction[:quantity] = quantity\n\n end",
"def purchase(total)\n @price_in_cents = total\n response = process_purchase\n transactions.create!(:action => \"purchase\", :amount =>@price_in_cents, :response => response)\n #cart.update_attribute(:purchased_at, Time.now) if response.success?\n response.success?\n end",
"def create\n @purchases = current_user.profile.purchases.new(purchases_params)\n\n respond_to do |format|\n if @purchases.save\n format.html { redirect_to purchases_url, notice: 'Purchase created with success.' }\n format.json { render :show, status: :created, location: @purchases }\n else\n format.html { render :new }\n format.json { render json: @purchases.errors, status: :unprocessable_entity }\n end\n end\n end",
"def purchase(trip, attributes = {})\n e = Expense.new(attributes)\n e.purchaser = self\n e.trip = trip\n e.save\n e\n end",
"def purchase(trip, attributes = {})\n e = Expense.new(attributes)\n e.purchaser = self\n e.trip = trip\n e.save\n e\n end",
"def purchase(item_price)\n @total += item_price\n total\n end",
"def purchase(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard) \n add_address(post, creditcard, options) \n add_customer_data(post, options)\n add_duplicate_window(post)\n \n commit('SALE', money, post)\n end",
"def add_to_transactions()\n\n\t\tcreate_id\n\t\tputs \"id created\"\n\t\tputs @id\n\t\t#we validate if we have transactions in the array, if so we check if the transaction\n\t \t#that we want to add is already there\n\t if @@transactions.count >0\n\n\t \tif Transaction.transaction_include_by_id?(self.id)\n\t \traise DuplicateProductError, \"#{self.id} already exists.\"\n\t \telse\n\t \t\t@@transactions.push(self)\n\t\t\tend\n\n\t\telse\n\n\t @@transactions.push(self)\n\t end\n\tend",
"def purchases_params\n params.require(:purchases).permit(:description, :was_bought, :profile_id, product_purchases_attributes: [:name, :id, :_destroy, :product_id])\n end",
"def purchase(*arguments)\n sellables = []\n options = default_purchase_options\n\n # distinguish between options and attributes\n arguments = arguments.flatten\n arguments.each do |argument|\n case argument.class.name\n when 'Hash'\n options.merge! argument\n else\n sellables << argument\n end\n end\n raise ArgumentError.new(\"No sellable (e.g. product) model provided\") if sellables.empty?\n raise ArgumentError.new(\"Sellable models must have a :price\") unless sellables.all? {|sellable| sellable.respond_to? :price}\n \n returning self.purchase_orders.build do |po|\n po.seller = options[:seller]\n po.build_addresses\n sellables.each do |sellable|\n if sellable && sellable.respond_to?(:before_add_to_order)\n sellable.send(:before_add_to_order, self)\n sellable.reload unless sellable.new_record?\n end\n li = LineItem.new(:sellable => sellable, :order => po)\n po.line_items.push(li)\n sellable.send(:after_add_to_order, self) if sellable && sellable.respond_to?(:after_add_to_order)\n end\n end\n end",
"def index\n set_purchases\n @purchase = Purchase.new\n end",
"def purchase\n response = GATEWAY.purchase(self.price * 100, credit_card)\n transactions.create!(:price => self.price, :response => response)\n self.transaction_number = response.subscription_id if response.respond_to? :subscription_id\n self.status = response.success?\n create_transaction if self.status\n self.save\n end",
"def purchase(*arguments)\n sellables = []\n options = default_purchase_options\n\n # distinguish between options and attributes\n arguments = arguments.flatten\n arguments.each do |argument|\n case argument.class.name\n when 'Hash'\n options.merge! argument\n else\n sellables << (argument.is_a?(MerchantSidekick::ShoppingCart::Cart) ? argument.line_items : argument)\n end\n end\n sellables.flatten!\n sellables.reject! {|s| s.blank?}\n\n raise ArgumentError.new(\"No sellable (e.g. product) model provided\") if sellables.empty?\n raise ArgumentError.new(\"Sellable models must have a :price\") unless sellables.all? {|sellable| sellable.respond_to? :price}\n\n self.purchase_orders.build do |po|\n po.buyer = self\n po.seller = options[:from]\n po.build_addresses\n sellables.each do |sellable|\n if sellable && sellable.respond_to?(:before_add_to_order)\n sellable.send(:before_add_to_order, self)\n sellable.reload unless sellable.new_record?\n end\n li = LineItem.new(:sellable => sellable, :order => po)\n po.line_items.push(li)\n sellable.send(:after_add_to_order, self) if sellable && sellable.respond_to?(:after_add_to_order)\n end\n self\n end\n end",
"def purchase_show\n if params[:product_id] == '0'\n @items = session[:cart]\n else\n @items = []\n @items << { 'product' => params[:product_id], 'quantity' => session[:quantity] }\n end\n @sum = 0\n @count = 0\n @items.each do |item|\n product = Product.find(item['product'])\n @sum += product.price * item['quantity'].to_i\n @count += item['quantity'].to_i\n end\n @address = BillAddress.find(params[:bill_address_id])\n @user = current_user\n end",
"def purchases\n @orders = Order.all.where(buyer: current_user).order(\"created_at DESC\")\nend",
"def add_item(item_name, price, quantity = 1)\n @transactions << Transaction.new(item_name, price, quantity)\n quantity.times{self.items << item_name}\n self.total += price*quantity\n end",
"def add_to_cart(product, amount)\n purchase = \" • #{amount} #{product}\\n\"\n @cart << purchase\n\n cost_per_item = @inventory[product][\"price\"]\n @total_cart_value += (cost_per_item * amount)\n\n @inventory[product][\"quantity\"] -= amount\nend",
"def create\n @group = Group.find(params[:group_id])\n @purchase = @group.purchases.build(purchase_params)\n @purchase.user = current_user\n if @purchase.make_purchase(purchase_params[:item_ids])\n redirect_to group_purchase_path(@group, @purchase), notice: 'purchase was successfully created!'\n else\n render action: 'new'\n end\n end",
"def add_item(title, price, quantity=1)\n self.total += price * quantity\n #quantity amount of times it'll add the title to the items array\n quantity.times {items << title}\n self.last_transaction = price * quantity\n end",
"def purchase_params\n params.require(:purchase).permit(:cost, :user_id, :group_id, :receipt_photo, item_ids: [] )\n end",
"def add_item(title, price, quantity=1) \n self.total += price * quantity\n quantity.times do\n items << title \n end\n self.last_transaction = price * quantity\n\n end",
"def create \n\t\tcarted_products = current _user.\n\t\tcarted_products.where(status: \"carted\")\n\n\t\tcarted_products.each do |carted_products|\n\t\t\tsum += (carted_product.product.product.price\n\t\t\t* carted_product.quantity)\n\t\tend \n\n\t\ttax =subtotal * 0.09\n\t\ttotal = subtotal + tax \n\n\t\torder = Order.create(user_id: current_user_id ,subtotal: subtotal, tax: tax,\n\t\t\ttotal: total)\n\n\t\tcarted_products.update_all (status: \"purchased\",order_id:\"order_id\")\n\n\t\tflash [success:] = \"Order succesfully created\" \n\t\tredirect_to \"/orders/#{order.id}\"\n\tend",
"def add_item (title, price, quantity = 1)\n i = 0\n while i < quantity\n @items << title\n i += 1\n end\n my_price = price * quantity\n @transactions << my_price\n @total += (price * quantity)\n end",
"def purchase\n\n response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options)\n \n #create_card_transaction(action: \"purchase\", amount: price_in_cents, response: response)\n \n #@registration.update_attribute(:purchased_at, Time.now) if response.success?\n #response.success?\n end",
"def purchase\n @priceplans = Admin::Priceplan.all \n end",
"def add_purchase(post)\n post[:capture] = 'Y'\n end",
"def create\n @purchase = Purchase.new(purchase_params)\n\n if @purchase.save\n render json: @purchase, status: :created, location: @purchase\n else\n render json: {errors: @purchase.errors}, status: :unprocessable_entity\n end\n end",
"def purchase\n begin\n ActiveRecord::Base.transaction do\n @user.coin_credit -= @product.price\n requested_detail = @product.details.available.first\n requested_detail.available = false # makes the detail unavailable\n requested_detail.save!\n @user.save!\n @user.purchased_details << requested_detail # adds the detail to purchased_details of the user\n @purchased_detail = requested_detail\n end\n true\n rescue => e\n Rails.logger.error e\n @user.reload\n @user.errors.add(:base, :purchase_problem)\n false\n end\n end",
"def purchase_action\n # from cart\n if params[:product_id] == '0'\n @items = session[:cart]\n @purchase = Purchase.new(bill_address_id: params[:bill_address_id], ip: IPAddr.new(request.remote_ip).to_i)\n @purchase.save\n @items.each do |item|\n @purchase_products = PurchaseProduct.new(purchase_id: @purchase.id, product_id: item['product'], quantity: item['quantity'])\n @purchase_products.save\n stock_minus(item['product'], item['quantity'])\n end\n # via product page\n else\n @purchase = Purchase.new(bill_address_id: params[:bill_address_id], ip: IPAddr.new(request.remote_ip).to_i)\n if @purchase.save\n @purchase_products = PurchaseProduct.new(purchase_id: @purchase.id, product_id: params[:product_id], quantity: session[:quantity])\n @purchase_products.save\n stock_minus(params[:product_id], session[:quantity])\n else\n render 'purchase_show'\n end\n end\n # Send email\n UserMailer.purchase_email(@purchase).deliver\n session[:purchased_item] = params[:product_id]\n redirect_to purchase_success_path\n end",
"def add_product(name, price)\n new_product = Product.new(name, price)\n @products_in_cart << new_product\n new_product\nend",
"def create\n @purchase = current_user.purchases.build(params[:purchase])\n\n respond_to do |format|\n if @purchase.save\n Notifications.new_purchase(@purchase).deliver\n format.html { redirect_to @purchase, notice: 'Purchase was successfully created.' }\n format.json { render json: @purchase, status: :created, location: @purchase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase.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 purchases(options = {})\n\t\t\twarn \"[DEPRECATED] Gateway#purchases is deprecated, please use Purchase.find instead\" unless options[:silence]\n\t\t\tModels::Purchase.find(options)\n\t\tend",
"def initialize(purchase)\n @purchase = purchase\n end",
"def create\n @purchase_item = PurchaseItem.find(params[:id])\n \n\n respond_to do |format|\n if @purchase_item.save\n format.html { redirect_to purchase_path(@purchase), notice: 'Purchase item was successfully created.' }\n format.json { render json: @purchase, status: :created, location: @purchase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts \"create*******\"\n puts purchase_params\n user = User.find(session[:user_id])\n email = user.email\n \tpackage_id = params[:purchase][:package]\n \tpurchase_package = Package.find package_id\n \tquantity = purchase_package.quantity.to_s\n \tamount = purchase_package.price.to_i\n \tStripeModel.chargeCreditCard(params[:stripeToken], email, quantity, amount)\n \n \t@purchase = Purchase.new purchase_params\n @purchase.email = email\n \t@purchase.quantity = quantity\n \t@purchase.price = amount\n \t@purchase.save\t#save method is overridden in the Purchase model\n\n redirect_to user_path(session[:user_id])\n end",
"def total_purchases_cost\n purchases.to_a.sum(&:cost)\n end",
"def total_purchases_cost\n purchases.to_a.sum(&:cost)\n end",
"def purchase(money, payment_source, options = {})\n post = {}\n add_invoice(post, options)\n add_payment_source(post, payment_source, options)\n add_address(post, payment_source, options)\n add_customer_data(post, options)\n add_money(post, money, options)\n commit('SAL', post)\n end",
"def purchase(params)\n name = params[:customer]\n timestamp = params[:timestamp]\n amount = params[:amount]\n msg = \"\"\n #Nil check for mandatory fields\n if name.nil? || timestamp.nil? || amount.nil?\n msg = \"Customer name, amount or timestamp can't be blank\"\n puts \"Exception in User::purchase:: #{msg}\"\n return {\"status\" => STATUS_CODES[\"bad_request\"], \"result\" => msg}\n end\n unless show_registered_user({:name => name}).present?\n msg = \"User is not registered, kindly register first\"\n puts \"Exception in User::purchase:: #{msg}\"\n return {\"status\" => STATUS_CODES[\"bad_request\"], \"result\" => msg}\n end\n begin\n reward = avail_reward(timestamp, amount)\n index = @@usr_reward_array.find_index{|um| um[\"name\"] == name}\n\n @@usr_reward_array[index][\"reward\"] += reward\n @@usr_reward_array[index][\"purchase_count\"] += 1\n msg = \"Order placed successfully\"\n return {\"status\" => STATUS_CODES[\"success\"], \"result\" => msg}\n rescue Exception => e\n msg = \"Error in processing event, #{e.message}\"\n puts \"Exception in User::purchase:: #{msg}\"\n return {\"status\" => STATUS_CODES[\"error\"], \"result\" => msg}\n end \n end",
"def join_purchase\n @purchase_response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options)\n @purchase_response.success?\n end",
"def create\n @purchase = Purchase.new(params[:purchase])\n\n respond_to do |format|\n if @purchase.save\n flash[:notice] = 'Purchase was successfully created.'\n format.html { redirect_to(@purchase) }\n format.xml { render :xml => @purchase, :status => :created, :location => @purchase }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @purchase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_purchase\n @purchase = Purchase.find_by_id(params[:id])\n end",
"def provision_shop_with_items(item_statistics)\n @shop << Item.new(item_statistics)\n end",
"def provision_shop_with_items(item_statistics)\n @shop << Item.new(item_statistics)\n end",
"def purchase\n\t\tif self.sku.sku_type == 'subscription'\n\t\t\tpurchase_subscription\n\t\telse\n\t\t\tif self.total > 0\n\t\t\t\tresponse = process_purchase\n\t\t\t\tOrderTransaction.create!(\t:action => \"purchase\",\n\t\t\t\t\t\t\t\t\t\t\t:order_id => self.id,\n\t\t\t\t\t\t\t\t\t\t\t:price => self.total, \n\t\t\t\t\t\t\t\t\t\t\t:success => response.success?, \n\t\t\t\t\t\t\t\t\t\t\t:reference => response.authorization,\n\t\t\t\t\t\t\t\t\t\t\t:message => response.message,\n\t\t\t\t\t\t\t\t\t\t\t:params => response.params,\n\t\t\t\t\t\t\t\t\t\t\t:test => response.test? \n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\tresponse.success?\n\t\t\telsif self.total == 0\n\t\t\t\tOrderTransaction.create!( \t:action => \"purchase\",\n\t\t\t\t\t\t\t\t\t\t\t:order_id => self.id,\n\t\t\t\t\t\t\t\t\t\t\t:price => self.total, \n\t\t\t\t\t\t\t\t\t\t\t:success => true, \n\t\t\t\t\t\t\t\t\t\t\t:reference => 'BackMyBook coupon purchase',\n\t\t\t\t\t\t\t\t\t\t\t:message => 'zero price purchase'\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\treturn true\t\t\t\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend\n\tend",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\r\n @purchase = Purchase.find(params[:id])\r\n end",
"def add_units(qty)\n qty.to_i.times do\n #create item\n item = supply_items.new\n item.status = SupplyItem::STATUS_AVAILABLE\n item.save\n end\n end",
"def add_to_cart(product)\n @products << product\n @sub_total += product.base_price\n @total_price += product.total_price\n puts \"Added to cart!\"\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def set_purchase\n @purchase = Purchase.find(params[:id])\n end",
"def add_item(title, price, quantity=1)\n #and increases the total\n self.total += price * quantity\n #times.do for all the items\n quantity.times do\n @items << title\n end\n #doesn't forget about the previous total\n self.last_transaction = price * quantity\n end",
"def purchase\n #@cart = Cart.find(self.cart_id)\n #cart.update_attribute(:purchased_at, Time.now)\n if cart.tip && cart.tip > 0\n @amount = price_in_cents + tax_in_cents + tip_in_cents\n else\n @amount = price_in_cents + tax_in_cents\n end\n @transaction = transactions.first\n #response = GATEWAY.purchase((price_in_cents + tax_in_cents), credit_card,\n # purchase_options)\n\n response = GATEWAY.capture((@amount), @transaction.authorization)\n @transaction.update_attributes(:action => \"capture\",\n :amount => (@amount), :response => response)\n\n #cart.update_attribute(:purchased_at, Time.now) if response.success?\n # SWITCH TO ABOVE WHEN LIVE.\n ######## remove when live. ########\n #GATEWAY.void(response.authorization, purchase_options)\n ## uncomment when live\n response.success?\n end",
"def add_product(name, price, tax_rate)\n new_product = Product.new(name, price, tax_rate)\n @cart_items << new_product\n end",
"def add_item(item, price, quantity = 1)\n @total += price * quantity\n @transactions << price * quantity\n i = quantity\n until i == 0 do\n @items << item\n i -= 1\n end\n end",
"def purchase\n if user_signed_in?\n \n card = current_user.card\n #テーブルからpayjpの顧客IDを検索\n @user = User.find(@item.seller_id)\n unless @item.seller_id == @item.buyer_id\n redirect_to root_path\n else\n end\n \n if card.blank?\n #登録された情報がない場合にカード登録画面に移動\n redirect_to controller: \"card\", action: \"new\"\n else\n Payjp.api_key = ENV[\"PAYJP_PRIVATE_KEY\"]\n #保管した顧客IDでpayjpから情報取得\n customer = Payjp::Customer.retrieve(card[\"customer_id\"])\n #保管したカードIDでpayjpから情報取得、カード情報表示のためインスタンス変数に代入\n @default_card_information = customer.cards.retrieve(card.card_id)\n @card_brand = @default_card_information.brand\n @card_src = \"Visa.png\"\n end\n\n else\n redirect_to new_user_session_path\n end\n\n end",
"def add_item(item, price, quantity = 1)\n self.total += price * quantity\n self.last_item = price\n self.last_quantity = quantity\n\n counter = 0\n while counter < quantity\n self.cart << item\n counter += 1\n end\n self.cart\n end",
"def index\n # We'll need to page this later!\n @purchases = current_user.purchases.all\n end",
"def set_purchase_list\n @purchase_list = PurchaseList.find(params[:id])\n end",
"def index\n @purchases=current_user.purchases\n end",
"def create\n @purchase = Purchase.new(purchase_params)\n spree_order = ActiveRecord::Base.connection.select_one(\"select * from spree_line_items a left join spree_variants b on a.variant_id = b.id left join purchases c on a.order_id = c.spree_order_id where b.product_id = #{@purchase.spree_product_id} and c.amount is null\")\n @purchase.spree_order_id = spree_order[\"order_id\"] if spree_order\n\n respond_to do |format|\n if spree_order && @purchase.save\n format.html { redirect_to purchases_path, notice: t(\"activerecord.models.purchase\") + t(\"messages.successfully_created\") }\n format.json { render :show, status: :created, location: @purchase }\n else\n format.html { redirect_to purchases_path, alert: t(\"activerecord.models.purchase\") + t(\"messages.not_created\") }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def find_purchases\n \n if params[:id] \n purchase = Purchase.find_by_id(params[:id])\n @consumer_id = purchase.consumer_id if purchase\n elsif params[:consumer_id] \n @consumer_id = params[:consumer_id]\n else\n @consumer_id = nil\n end\n\n @purchases = Purchase.with_info(current_payer.id, @consumer_id) \n @pendings = @purchases.pending \n @pendings_count = @pendings.count\n \n end",
"def my_purchases\n @orders = Effective::Order.deep.purchased_by(current_user)\n EffectiveOrders.authorized?(self, :index, Effective::Order.new(user: current_user))\n end",
"def create\n @purchase = Purchase.new(purchase_params)\n\n respond_to do |format|\n if @purchase.save\n format.html { redirect_to @purchase, notice: 'Purchase was successfully created.' }\n format.json { render :show, status: :created, location: @purchase }\n else\n format.html { render :new }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_buyer(c_id)\n metadata[:buyers] ||= []\n\n metadata[:buyers] |= Array(c_id.to_i)\n self.save\n end",
"def analytics_add_item(order_id, product_id, product_name, product_variation, unit_price, quantity)\n analytics_render_event(GA::Events::Ecommerce::AddItem.new(order_id, product_id, product_name, product_variation, unit_price, quantity))\n end",
"def index\n @purchases = current_user.purchases\n end",
"def add_item(title, price, quantity = 1)\n @title = title\n @price = price\n quantity.times {@items << title}\n @last_transaction = @price * quantity\n @total = @total + (@price * quantity)\n @total\n end",
"def add(*items, quantity: 1)\n raise 'unable to alter a purchased order' if purchased?\n raise 'unable to alter a declined order' if declined?\n\n cart_items = items.flatten.flat_map do |item|\n if item.kind_of?(Effective::Cart)\n item.cart_items.to_a\n elsif item.kind_of?(ActsAsPurchasable)\n Effective::CartItem.new(quantity: quantity, purchasable: item)\n elsif item.kind_of?(Effective::Order)\n # Duplicate an existing order\n self.note_to_buyer ||= item.note_to_buyer\n self.note_internal ||= item.note_internal\n self.cc ||= item.cc\n\n item.order_items.select { |oi| oi.purchasable.kind_of?(Effective::Product) }.map do |oi|\n purchasable = oi.purchasable\n\n product = Effective::Product.new(name: purchasable.purchasable_name, price: purchasable.price, tax_exempt: purchasable.tax_exempt)\n\n # Copy over any extended attributes that may have been created\n atts = purchasable.dup.attributes.except('name', 'price', 'tax_exempt', 'purchased_order_id').compact\n\n atts.each do |k, v|\n next unless product.respond_to?(\"#{k}=\") && product.respond_to?(k)\n product.send(\"#{k}=\", v) if product.send(k).blank?\n end\n\n Effective::CartItem.new(quantity: oi.quantity, purchasable: product)\n end\n else\n raise 'add() expects one or more acts_as_purchasable objects, or an Effective::Cart'\n end\n end.compact\n\n # Make sure to reset stored aggregates\n assign_attributes(subtotal: nil, tax_rate: nil, tax: nil, amount_owing: nil, surcharge_percent: nil, surcharge: nil, total: nil)\n\n retval = cart_items.map do |item|\n order_items.build(\n name: item.name,\n quantity: item.quantity,\n price: item.price,\n tax_exempt: (item.tax_exempt || false),\n ).tap { |order_item| order_item.purchasable = item.purchasable }\n end\n\n retval.size == 1 ? retval.first : retval\n end",
"def add_item(order_id, item_sku, price, quantity, name = nil, category = nil, utmhid = random_id)\n check_account_params\n hey(item_params(order_id, item_sku, name, category, price, quantity, utmhid))\n end",
"def createAndPurchase(auth_obj, txid, includeDeliveryCommitment=nil, \n extraHdrs=nil, overwrite=true)\n hdrs = { PBShipping::txid_attrname => txid }\n if extraHdrs != nil\n hdrs.update(extraHdrs) \n end\n if includeDeliveryCommitment == nil\n params = { :includeDeliveryCommitment => false } \n else\n params = { :includeDeliveryCommitment => includeDeliveryCommitment } \n end \n api_sig = \"post/shipments\"\n api_version = PBShipping::get_api_version(api_sig)\n api_path = \"/shipments\"\n json_resp = PBShipping::api_request(\n auth_obj, :post, api_version, api_path, hdrs, params, self)\n if overwrite == true \n self.update(json_resp)\n self\n else\n Shipment.new(json_resp)\n end\n end",
"def add_product(product)\r\n\t\t@shopping_cart << product\r\n\t\t@item_count +=1\t\t# add one to the item counter\r\n\tend",
"def add_item(title, amount, quantity=1)\n self.total += amount * quantity\n quantity.times do\n items << title\n end\n self.last_transaction = amount * quantity\n end"
] |
[
"0.7992879",
"0.741105",
"0.7236363",
"0.7181183",
"0.71466964",
"0.66805327",
"0.6673908",
"0.65492684",
"0.65337396",
"0.64984447",
"0.64761376",
"0.6428373",
"0.6421839",
"0.64188564",
"0.64108944",
"0.64108944",
"0.63930047",
"0.6314478",
"0.63142496",
"0.627486",
"0.62664413",
"0.6251777",
"0.6248391",
"0.6233543",
"0.6202096",
"0.6196453",
"0.618355",
"0.6157039",
"0.61544853",
"0.61420935",
"0.61270475",
"0.610866",
"0.60945797",
"0.6094252",
"0.60925657",
"0.6090829",
"0.6083207",
"0.60714453",
"0.60473394",
"0.60383296",
"0.603729",
"0.6029001",
"0.6011909",
"0.600705",
"0.5986979",
"0.59712833",
"0.5966628",
"0.59653544",
"0.59653544",
"0.59611994",
"0.595754",
"0.59561205",
"0.59509254",
"0.59267265",
"0.59244907",
"0.59244907",
"0.59111476",
"0.59073776",
"0.59073776",
"0.59073776",
"0.59073776",
"0.59073776",
"0.59073776",
"0.59073776",
"0.59073776",
"0.59073776",
"0.59073776",
"0.59073776",
"0.59073776",
"0.59073776",
"0.59073776",
"0.59073776",
"0.5905699",
"0.5898687",
"0.5897077",
"0.5891086",
"0.5891086",
"0.5891086",
"0.58831173",
"0.5882709",
"0.58802897",
"0.58759797",
"0.58720064",
"0.5870489",
"0.58672434",
"0.58623856",
"0.58465564",
"0.584129",
"0.5837268",
"0.583226",
"0.5832038",
"0.5827561",
"0.5825515",
"0.5825356",
"0.58250487",
"0.5820627",
"0.58203095",
"0.5819076",
"0.58153284",
"0.5810801",
"0.5810268"
] |
0.0
|
-1
|
Write method to calculate total spent
|
def calculate_total(database, user_id)
total = 0
item_costs = database.execute(
"SELECT *
FROM purchases
WHERE login_id='#{user_id}';"
)
item_costs.each do |cost|
total += cost[3]
end
total
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def calculate_total_money_spent\n return @trips.inject(0.0) { |sum, trip|\n trip.is_in_progress? ? sum + 0 : sum + trip.cost }\n end",
"def spent\n @spent ||= calculate_spent\n @spent.round(2)\n end",
"def total_spent\n total_cost = 0\n trips.each do |trip|\n total_cost += trip.cost\n end\n return total_cost\n end",
"def spend\n amounts = []\n orders.where(order_status_id: 4).each do |order|\n amounts << order.subtotal\n end\n return amounts.inject(:+)\n end",
"def money_spent\n self.purchases.map { |p| p.price }.sum\n end",
"def total_spent_hours\n @total_spent_hours ||= TimeEntry.where(:meeting_id => id).sum(:hours).to_f\n end",
"def return_sum\n @money = 0\n @transactions.each do |t|\n if t.get_action == 'buy'\n @money = @money + t.get_value\n elsif t.get_action == 'sell'\n @money = @money - t.get_value\n end\n end\n total_value_of_shares - @money\n end",
"def total_funds\n total = 0\n num_funding_rounds.each do |round| \n total += round.investment\n end\n total\n end",
"def calculate_total_revenue\n return @trips.inject(0.0) do |sum, trip|\n trip.is_in_progress? ? sum + 0 : sum + calculate_pay(trip.cost)\n end\n end",
"def total_price\n total = 0\n self.transactions.each do |t|\n total += t.price\n end\n total\n end",
"def calculate\n self.total\n end",
"def calculate_total\n self.total = total_money(total_gross)\n end",
"def calculate_totals\n subtotal_collector = 0\n active_contracts.each do |active_contract|\n subtotal_collector += active_contract.subtotal\n end\n\n self.subtotal = subtotal_collector\n self.tax = subtotal * 0.09\n self.total = subtotal + tax\n save\n end",
"def total_funds\n #binding.pry\n funding_rounds.map{|fr| fr.investment}.sum\n end",
"def total_time_spent\n return trips.sum {|trip| trip.duration}\n end",
"def total\n Money.new(self.expense_entries.sum('unit_cost_pence * qty'))\n end",
"def get_total\n counts = convert_to_hash(@item_list)\n uniq_items = @item_list.uniq\n\n final = (@total - @sale.apply(uniq_items, counts)).round(2) # Used round for precision\n puts get_invoice + final.to_s\n final\n end",
"def compute_total(type)\n list = capture_amounts(type)\n generate_total(list)\n end",
"def total_funds\n my_rounds.map{|rounds| rounds.investment}.sum\n end",
"def total; end",
"def spent\n self.deliverables.collect(&:spent).delete_if { |d| d.blank?}.inject { |sum, n| sum + n } || 0.0\n end",
"def total_pay\n total = 0\n @serie_items.each do |item|\n # next if item.quantity.nil?\n total += item.quantity * item.creation.price\n end\n return total\n end",
"def calc_total\n (@total_after_tax * @gratuity) + @total_after_tax\n end",
"def total_funds\n sum_funds = 0\n self.funding_rounds.each do |funding_round|\n sum_funds += funding_round.investment\n end \n sum_funds\nend",
"def calculate_total\n sub_total = 0\n\n if size\n sub_total += Config.booths[size][:price]\n end\n\n self.add_ons.each do |add_on|\n sub_total += add_on.total\n end\n sub_total += industries.length * 35000\n sub_total += fees.pluck(:amount).reduce(0, &:+)\n\n self.total = sub_total\n self.balance = total - payments.paid.map(&:amount_paid).reduce(0, &:+)\n self\n end",
"def total_value\n @quantity * @price_per_share\n end",
"def total_amount\n t = amount\n t += sub_transactions.sum(:amount) if recurring_period\n t\n end",
"def total_time_spent\n\n time_spent = Trip.total_time(trips)\n\n return time_spent\n end",
"def running_total\n sum = 0.00\n @items.each { |item| sum += item[\"price\"] }\n return sum\n end",
"def total\r\n sum = 0\r\n sales_lines.each do |line|\r\n sum += line.line_amount unless line.line_amount.blank?\r\n end\r\n return sum\r\n end",
"def total_sum\n sum = if @payment.respond_to?(:total_sum)\n # use this first, because once the owner has set a specific sum\n # that becomes the final sum to be payed\n @payment.total_sum\n elsif @cart.total_sum\n # if owner has not yet set final sum, see if a cart has been\n # allready saved and use that to calculate\n @cart.total_sum\n else\n # while a transaction and it's cart still has not been stored in\n # db calculate the sum on the fly\n sum = @transaction.unit_price * @transaction.listing_quantity\n sum += @cart.cart_sum if @cart\n sum\n end\n end",
"def total\n total_cache(:total) || (sub_total + total_tax)\n end",
"def total\n return (@listOfItem.inject(0){|sum,e| sum += e.total}).round_to(2)\n end",
"def hours_spent\n \thours_spent = 0\n \tinputs.each do |input|\n \t\thours_spent += input.hours\n \tend\n \thours_spent\n end",
"def compute_total_and_print()\n @total_price=0\n $final_price_list.each do |element| \n @total_price = @total_price + element\n end\n @total_sales_tax=0\n $sales_tax_list.each do |element|\n @total_sales_tax = @total_sales_tax + element\n end\n puts \"Sales Tax : #{@total_sales_tax.round(2)}\"\n puts \"Total : #{@total_price.round(2)}\"\nend",
"def pretotal\n total\n end",
"def total_funds\n self.funding_rounds.sum {|fr| fr.investment}\n end",
"def calculated_total\n variant_ids = self.standing_line_items.pluck(:variant_id)\n avvs = self.account.account_viewable_variants.where(variant_id: variant_ids).to_a\n\n self.standing_line_items.includes(:variant).inject(0.to_d) do |sum, i|\n avv = avvs.select{|avv| avv.variant_id == i.variant_id}.first\n if avv\n sum + (avv.price * i.quantity)\n else\n sum + (i.variant.price * i.quantity)\n end\n end\n end",
"def total\n apply_rules(subtotal).round\n end",
"def total_amount\n \t amount = 0\n \t operation_items.each do | oi |\n \t\tamount = amount + oi.amount\n end\n amount\n end",
"def spent_hours\n @spent_hours ||= time_entries.sum(:hours) || 0\n end",
"def total_funds\n self.collect{ |cs| cs.amount.to_f}.inject(0, :+)\n end",
"def total_value\r\n return 0 if self.value.nil?\r\n self.value + self.expenses.includes(:expense).map{ |e|\r\n (e.quantity || 0) * (e.expense.signed_price || 0)\r\n }.sum\r\n end",
"def total_payments\n total = 0\n payments.each{|payment| total += payment.amount}\n total\n end",
"def total\n # extracts all of the values from the hash and sums them up\n cost = @products.values.sum\n # add 7.5% tax and round to two decimal places\n return (cost * 1.075).round(2)\n end",
"def calculate_total\n order_items.sum(:total)\n end",
"def hours_spent\n hours_spent = 0\n project_tasks.each do |project_task|\n hours_spent += project_task.hours_spent\n end\n hours_spent\n end",
"def total_amount\n (total * 100).to_i\n end",
"def total\n sum(:total)\n end",
"def total_pay\n total_pay = self.employees.map do |employee|\n employee.pay\n end\n total_pay.inject(:+)\n end",
"def total_funds\n total = nil\n FundingRound.all.each do |funding|\n funding.startup == self\n total += funding.investment\n end\n end",
"def sum_totals\n @total = Lote.where(:programacion_id => @programacion.first).sum(:precio_t)\n @total = Money.new(\"#{@total}00\", \"USD\").format\n @cantidades = Lote.where(:programacion_id => @programacion.first).sum(:cantidad)\n end",
"def spend\n self\n end",
"def total_quantity\n cached_qty_bank.to_f + cached_qty_consigned.to_f\n end",
"def total\n subtotal\n # + tax\n end",
"def total_cost_of_sales\n costs = self.purchases.map(&:cost)\n self.total_costs = costs.inject{|sum, cost| sum + cost}.to_f\n end",
"def cumulative_total_after_tax\n amount = 0.0\n @products_in_cart.each do |product|\n amount += product.total\n end#each\n return amount\nend",
"def profit\n total_before_tax - total_cost\n end",
"def profit\n total_before_tax - total_cost\n end",
"def sum\n transactions.sum(:amount)\n end",
"def sum\n transactions.sum(:amount)\n end",
"def total\n cost_without_tax = get_cost_without_tax\n return cost_without_tax + get_sales_tax(cost_without_tax)\n end",
"def revenue\n sum = 0\n sales.each do |sale|\n sum += sale.amount\n end\n sum\n end",
"def total_price\n worker_profile.price_per_hour * hours.to_i + material_cost\n end",
"def total\n\t\t\ttotal = @total\n\t\t\t\n\t\t\tif @started\n\t\t\t\ttotal += (Clock.now - @started)\n\t\t\tend\n\t\t\t\n\t\t\treturn total\n\t\tend",
"def total\n total_cost = 0\n \n # Summing up the product cost\n @products.each do |item, cost|\n total_cost += cost\n end\n \n # Calculate a 7.5% tax\n total_order_cost = total_cost * 1.075\n \n # Rounding the result to two decimal places\n return total_order_cost.round(2)\n end",
"def total \n\t\t@Total_bill = @bill_amount + @tip_rate_calc\t\n\t \tputs \"The total bill is £#{@Total_bill}\"\n\tend",
"def total_amount\n self.tickets.inject(0) do |amount, ticket|\n amount += ticket.price_minus_discount\n end\n end",
"def summ\n result = 0.0\n self.propose_items.each do |item|\n result += item.price\n end\n return result\n end",
"def total_value_cents\n total_benefits_value\n end",
"def money(trips)\n revenue_array = []\n\n trips.each do |trip|\n revenue_array << trip[:cost]\n end\n\n total_money = revenue_array.sum\n return total_money\nend",
"def total_payment\r\n checks.inject(0.00){|sum, check| sum += check.check_amount.to_f}\r\n end",
"def investment\n if buy_price\n num_of_shares * buy_price\n end\n end",
"def total_amount(bill_tip)\n\treturn tip_amount(bill_amount) + bill_tip\nend",
"def total_sum()\n return self.work_packets.sum( :worked_hours )\n end",
"def spent_per_person \n count = real_participants.size\n return (cost / count).round(2)\n end",
"def calculate\n=begin\n self.net_amount = nil\n self.tax_amount = nil\n self.gross_amount = nil\n=end\n self.total\n end",
"def total\n @items_total = []\n self.line_items.each do |item|\n @item = Item.find_by_id(item.item_id)\n @items_total << @item.price.to_f\n end\n cart_total = @items_total.inject(0){|sum, x| sum + x }\n @cart_total = cart_total.round(2)\n @cart_total\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 get_total_expense\n\t\tbills.pluck(:amount).inject(:+) rescue 0\n\tend",
"def profit_calculation\r\n @total_profit = @cocktail_profit + @beer_profit + @water_profit\r\n end",
"def per_trip_total\n (per_ticket_cost + checked_bag_cost + per_trip_accom)\n end",
"def total_funds\n investments = self.funding_rounds.map do |funding_round|\n funding_round.investment\n end\n investments.sum\n end",
"def total\n (amount + fee) if amount\n end",
"def total\n subtotal + tax + shipping\n end",
"def sub_total\n sum = 0\n line_items.each do |line_item|\n sum += line_item.total_price\n end\n sum\n end",
"def second_payment_sum\n total_sum - first_payment_sum\n end",
"def amount_spent_on(project)\n self.expenses.where(:project_id => project.id).sum(:amount)\n end",
"def total_cost\n lifter_membership.reduce(0){ |total, pay| \n total + pay.cost}\n end",
"def total\n \tsubtotal\n end",
"def sum_expense(expenses)\n sum = expenses.sum\n return sum\nend",
"def total_cost\n dates = ReservationDates.new(checkin:@checkin, checkout:@checkout)\n subtotal = dates.total_nights * 200 \n total = subtotal * 1.101\n return total.round(2)\n end",
"def total_value_of_shares\n total_number_of_shares * @current_value\n end",
"def compute_total_value\n @value= @net_price * @count\n end",
"def total_fee\n fee + fee2 + fee3 + fee4\n end",
"def cumulative_total_before_tax\n amount = 0.0\n @products_in_cart.each do |product|\n amount += product.price\n end#each\n return amount\nend",
"def total_revenue()\n total_revenue = 0\n fee = 1.65\n trip_history = self.trips\n trip_history.each do |trip|\n if (trip.cost != nil) && (trip.cost > fee)\n total_revenue += (trip.cost - fee) * 0.8\n end\n end\n return total_revenue\n end",
"def avg_time_spent\n self.average(:time_spent)\n end",
"def total_revenue \n if @trips.length > 0 \n revenue = @trips.map do |trip|\n (trip.cost - 1.65) * 0.8 \n end \n revenue.sum\n elsif @trips.length == 0 \n return 0 \n end \n end",
"def total\n format_money(@total)\n end",
"def calculate_total_in_cents\n total = 0\n self.subscriptions.each do |s|\n if s.duration.to_i == 30\n total += PriceConfig.pricing(30) * 100\n elsif s.duration.to_i == 60\n total += PriceConfig.pricing(60) * 100\n else\n total += PriceConfig.pricing(90) * 100\n end\n end\n total\n end"
] |
[
"0.8081684",
"0.78729874",
"0.78285927",
"0.75776976",
"0.7370266",
"0.7369869",
"0.7246654",
"0.7238296",
"0.7224928",
"0.7136309",
"0.7129557",
"0.7122343",
"0.71042585",
"0.7098666",
"0.7097408",
"0.7087116",
"0.7065009",
"0.70386064",
"0.70287937",
"0.7027404",
"0.7013621",
"0.6997385",
"0.6992058",
"0.69891375",
"0.69810647",
"0.69654673",
"0.69564027",
"0.69459265",
"0.69450814",
"0.6930909",
"0.6913359",
"0.690475",
"0.6890733",
"0.6886765",
"0.6882712",
"0.6879299",
"0.6877396",
"0.6877347",
"0.68759245",
"0.68690574",
"0.68560404",
"0.685179",
"0.6850894",
"0.6840889",
"0.6839915",
"0.6839314",
"0.6835867",
"0.6835752",
"0.6828378",
"0.6827105",
"0.68239605",
"0.68167263",
"0.6807836",
"0.680501",
"0.6800775",
"0.67922217",
"0.67888737",
"0.6775761",
"0.6775761",
"0.67726785",
"0.67726785",
"0.6764805",
"0.67598903",
"0.67596954",
"0.67574304",
"0.6756598",
"0.67548704",
"0.6743978",
"0.6743238",
"0.6741488",
"0.6740765",
"0.67396426",
"0.67395294",
"0.67367774",
"0.6734655",
"0.67336",
"0.6731049",
"0.67283964",
"0.67282265",
"0.67251855",
"0.6721783",
"0.67211473",
"0.6719101",
"0.67173934",
"0.6714774",
"0.67062134",
"0.67055076",
"0.67036396",
"0.66976845",
"0.6693518",
"0.66916883",
"0.668976",
"0.6689583",
"0.66851616",
"0.6679215",
"0.6669189",
"0.6664841",
"0.66635805",
"0.666176",
"0.66616184",
"0.66608113"
] |
0.0
|
-1
|
This method is called with a block to define a provider for some subtree of the MIB. When a request comes in with varbinds in that providers subtree, the provider's handlers will be called to generate the varbind to send back in the response PDU. Arguments oid: The root OID of the MIB subtree this provider is responsible for. &block: A block, to be instance_evaled on the new Provider.
|
def provide(oid = :all, &block)
provider = Provider.new(oid)
provider.instance_eval(&block)
# Providers are pushed onto the end of the provider queue.
# When dispatching, this is searched in order for a match.
# So, like exception handlers, you such specify providers
# in order of most -> least specific oid. ('1.3.1' comes before '1.3')
providers << provider
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def bind(object)\n BlockAdapter.new(@block, object)\n end",
"def register_block_for(type, &blk); end",
"def bind(&block)\n\t\t\t@endpoint.bind(&block)\n\t\tend",
"def stubs_for_provider(target = nil, &block)\n _chefspec_stubs_for_registry[:provider][target] << block\n end",
"def bind event, &block\n @app.dom_on_sockets.add_callback_block event, @id, &block\n string =<<-EOL\n $('##{@id}').bind(#{event.inspect}, function(event,ui){\n ws.send('#{event.inspect},#{@id}')\n })\n EOL\n @app.dom_on_sockets.execute string\n end",
"def on_block(node)\n builder = DefinitionBuilder::RubyBlock.new(node, current_scope)\n definition = builder.build\n\n associate_node(node, definition)\n\n push_scope(definition)\n end",
"def dispatch(message)\n response_pdu = message.make_response_pdu\n context = ProviderDsl.new\n context.message = message\n context.response_pdu = response_pdu\n message.pdu.varbinds.each_with_index do |vb, index|\n context.varbind = vb\n provider = providers.find { |p| p.provides?(vb.oid) }\n if provider\n if message.pdu.command == Constants::SNMP_MSG_GETBULK && index < message.pdu.non_repeaters\n handler = provider.handler_for(Constants::SNMP_MSG_GETNEXT)\n else\n handler = provider.handler_for(message)\n end\n if handler\n context.instance_exec(&handler)\n else\n warn \"No handler for command: #{message.pdu.command} @ #{vb.oid}\"\n context.no_such_object\n end\n else\n warn \"No provider for oid: #{vb.oid}\"\n context.no_such_object\n end\n end\n response_pdu\n end",
"def provider(name, &block)\n name = name.to_sym\n @__providers[name] ||= []\n @__provider_overrides[name] ||= []\n\n # Add the provider to the ordering list\n @__provider_order << name\n\n if block_given?\n @__providers[name] << block if block_given?\n\n # If this block takes two arguments, then we curry it and store\n # the configuration override for use later.\n if block.arity == 2\n @__provider_overrides[name] << block.curry[Vagrant::Config::V2::DummyConfig.new]\n end\n end\n end",
"def use_widgets(&block)\n return if bound_procs.include?(block)\n \n \n yield apotomo_root # yield, and..\n bound_procs << block # remember the proc.\n end",
"def bind(&block)\n self\n end",
"def onblock(object, id, client = $client)\n if object.class != Class then\n object = ON_INSTANCES[object]\n return 'Error: Unknown instance name given' if object.nil?\n end\n if block_given?\n yield object.new_with_id id.to_i, client\n else\n object.new_with_id id.to_i, client\n end\n end",
"def provide(domain, &block)\n @providers[domain] << block\n end",
"def generate_block_context(context:, block_param_node:)\n binds = ArgumentsBinder.new(generator: generator).bind(types: method_types, arguments: block_param_node.parameter)\n\n Contexts::BlockContext.new(parent: context, registry: registry, receiver: context.receiver, binds: binds)\n end",
"def bind(id, repo_id, distributor_id, optional = {})\n required = required_params(binding.send(:local_variables), binding, ['id'])\n call(:post, path(\"#{id}/bindings/\"), :payload => { :required => required, :optional => optional })\n end",
"def configure(&block)\n unless provider\n raise 'Translation provider not selected yet. Use `Lit::CloudTranslation' \\\n '.provider = PROVIDER_KLASS` before calling #configure.'\n end\n provider.tap do |p|\n p.configure(&block)\n end\n end",
"def define_driver(name, &block)\n drivers[name] = block\n end",
"def sexp_provide_block\n program = sexp[1]\n\n program.each do |s|\n if s[0] == :method_add_block and\n s[1][0] == :command_call and\n s[1][1][0] == :method_add_arg and\n s[1][1][1][0] == :call and\n s[1][1][1][1][0] == :const_path_ref and\n s[1][1][1][1][1][0] == :var_ref and\n s[1][1][1][1][1][1][0..1] == [:@const, \"Puppet\"] and\n s[1][1][1][1][2][0..1] == [:@const, \"Type\"] and\n s[1][1][1][3][0..1] == [:@ident, \"type\"] and\n s[2][0] == :do_block\n\n return s[2][2]\n end\n end\n\n []\n end",
"def call(bind_vars={}, &block)\n bind(bind_vars).run(&block)\n end",
"def provider=(_arg0); end",
"def define(&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 define &block\n new block\n end",
"def configure &block\n\t\tinstance_eval &block\n\tend",
"def register(&block)\n extend Module.new(&block)\n end",
"def define &blk\n self.instance_eval(&blk)\n end",
"def bind(p0) end",
"def bind(p0) end",
"def bind(&block)\n ensure_monadic_result(&block).call\n end",
"def context(nodes, &block); end",
"def open_node_context(finder, cont = {})\n sub_context = node_context_vars(finder).merge(cont)\n\n with_context(sub_context) do\n yield\n end\n end",
"def run_registration_block(&block)\n instance_exec &block if block_given?\n end",
"def configure(&block)\n self.instance_eval(&block) if block_given?\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 run(ast)\n map_tree_with ast, lambda: ->(lmb) {\n mklambda(parmlist_of_lambda(lmb), handle_block(block_of_lambda(lmb)))\n }\n end",
"def configure_providers(host,vmcfg)\n providers = [ 'virtualbox', 'vmware_fusion' ]\n vmcfg['vm']['gui'] ||= false\n providers.each do |p|\n host.vm.provider p do |pcfg|\n pcfg.gui = true if vmcfg['vm']['gui']\n end\n begin\n send(\"configure_#{p}\",host,vmcfg)\n rescue NoMethodError\n # do nothing\n end\n end\nend",
"def run_registration_block(&block)\n instance_exec &block if block_given?\n end",
"def with_vagrant(description, *tags, &block)\n # take the block you just passed in, and make a new Proc that will call it after loading the driver...\n context_block = proc do\n vagrant_driver = Chef::Provisioning.driver_for_url(\"vagrant\")\n\n @@driver = vagrant_driver\n def self.driver\n @@driver\n end\n\n # when this Proc runs, this will run the block you just passed to `with_vagrant`...\n module_eval(&block)\n end\n\n # ...now pass that Proc to `Cheffish::RSpec::ChefRunSupport#when_the_repository`, which will:\n # 1. start up a chef-zero with `*tags` as the parameters, and\n # 2. run your `context_block` Proc (which contains your original `&block`) using that chef-zero.\n when_the_repository \"exists and #{description}\", *tags, &context_block\n end",
"def initialize\n set_default_as_provider\n yield self if block_given?\n end",
"def inject(init, &block)\n self.delay{ |virtual| puts \"starting inner block of delay_inject\"; virtual.inject(init, &block) }\n end",
"def configure(&block)\n self.instance_eval(&block)\n end",
"def add_entity\n e = NSEntityDescription.new\n yield e\n register_entity(e)\n end",
"def register(id, &block)\n ref = __get id\n return ref.__getobj__ if ref && ref.weakref_alive?\n item = block.call\n return nil unless item\n __register id, item\n end",
"def context label, &block\n return unless block\n Tiramisu.define_and_register_a_context(label, block, self)\n end",
"def provide(name, content = T.unsafe(nil), &block); end",
"def on_new_actuator &block\n\t\t\t@on_new_actuator = block\n\t\tend",
"def load(&block)\n @adapter.instance_eval(&block) if !block.nil?\n @entities = @adapter.load_entities\n\n nil\n end",
"def on_enable_instance(msg, reply)\n @logger.debug(\"#{service_description}: enable instance #{msg} request from #{reply}\")\n credentials = Yajl::Parser.parse(msg)\n prov_cred, binding_creds_hash = credentials\n result = enable_instance(prov_cred, binding_creds_hash)\n # Update node_id in provision credentials..\n prov_cred, binding_creds_hash = result\n prov_cred['node_id'] = @node_id\n result = [prov_cred, binding_creds_hash]\n @node_nats.publish(reply, Yajl::Encoder.encode(result))\n rescue => e\n @logger.warn(e)\n end",
"def setup_node(&blk)\n\t\t\t\tnode_setup_blocks << blk\n\t\t\tend",
"def method_missing(name, *args, &block)\n if self.provider && provider.respond_to?(name)\n self.provider.send(name, *args, &block)\n else\n super(name, *args, &block)\n end\n end",
"def config_lv_define_box2(vm, conf)\n vm.define conf['hostname_box2'] do |box2|\n box2.vm.hostname = conf['hostname_box2']\n box2.vm.box = conf['imagename_box2']\n box2.vm.network :private_network,\n :libvirt__network_name => \"mgmt\",\n :mac => conf['libvirt_mgmt_mac_box2'],\n :ip => conf['libvirt_mgmt_ip_box2'],\n :libvirt__netmask => conf['libvirt_mgmt_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.network :public_network,\n :network_name => \"ext\",\n :ip => conf['libvirt_ext_ip_box2'],\n :netmask => conf['libvirt_ext_netmask_box2'],\n :gateway => conf['libvirt_ext_gateway_box2'],\n :mac => conf['libvirt_ext_mac_box2'],\n :dev => conf['libvirt_dev'],\n :type => conf['libvirt_type'],\n :mode => conf['libvirt_mode']\n box2.vm.network :private_network,\n :libvirt__network_name => \"ceph\",\n :mac => conf['libvirt_ceph_mac_box2'],\n :ip => conf['libvirt_ceph_ip_box2'],\n :libvirt__netmask => conf['libvirt_ceph_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.network :private_network,\n :libvirt__network_name => \"vm_tunnel\",\n :mac => conf['libvirt_tunnel_mac_box2'],\n :ip => conf['libvirt_tunnel_ip_box2'],\n :libvirt__netmask => conf['libvirt_tunnel_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.provider :libvirt do |domain|\n domain.memory = conf['memory_box2']\n domain.cpus = conf['cpus_box2']\n domain.management_network_name = 'vagrantmgmt'\n domain.management_network_address = conf['libvirt_vagrantmgmt_ip_box2']\n domain.management_network_mode = conf['libvirt_mgmt_mode']\n end\n config_provision(box2.vm, conf)\n end\nend",
"def providify\n newparam(:provider)\n nil\n end",
"def bind(data, bindings: {}, context: nil, &block)\n datum = Array.ensure(data).first\n bind_data_to_scope(datum, doc.scopes.first, bindings, context)\n return if block.nil?\n\n if block.arity == 1\n instance_exec(datum, &block)\n else\n block.call(self, datum)\n end\n end",
"def use_widgets(&block)\n root = apotomo_root ### DISCUSS: let RequestProcessor initialize so we get flushed, eventually. maybe add a :before filter for that? or move #use_widgets to RequestProcessor?\n \n return if bound_use_widgets_blocks.include?(block)\n \n yield root\n \n bound_use_widgets_blocks << block # remember the proc.\n end",
"def in_context(context_type, &block)\n context_type.new.instance_eval(&block)\n end",
"def method_missing(name, *args, &blk)\n provider.send(name, *args)\n end",
"def configureEsbProvider(config_hash)\n security_file = config_hash[:security_file]\n application_name = config_hash[:mpathways_application_name]\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: configure provider esb: security_file: [#{security_file}] application_name: [#{application_name}]\"\n\n @useEsbProvider = true\n @esbTerms = Proc.new { |uniqname| dataProviderESBTerms(uniqname, security_file, application_name) }\n @esbCourses = Proc.new { |uniqname, termid| dataProviderESBCourse(uniqname, termid, security_file, application_name, config_hash[:default_term]) }\n @esbCheck = Proc.new { | | dataProviderESBCheck(security_file, application_name) }\n end",
"def configure(&blk)\n instance_eval &blk\n end",
"def init(&block)\n @inits << block\n end",
"def init(&block)\n @inits << block\n end",
"def register_ability(name, &block)\n\t\t\tabilities[name] = block\n\t\tend",
"def bind(proc=nil, &block)\n (proc || block).call(@value)\n end",
"def set_provider_bonu\n @provider_bonu = ProviderBonu.find(params[:id])\n end",
"def configure(&block)\n @configure_blocks ||= []\n @configure_blocks << block\n end",
"def add_node(node)\n #$DEBUG.puts \"Registering #{SNMPPass.num2oid(node.oid)} with #{node}\"\n @fields[node.oid]=node\n end",
"def regulate_scope(name, &block)\n name, block = __synchromesh_parse_regulator_params(name, block)\n singleton_class.send(:define_method, :\"__secure_remote_access_to_#{name}\") do |this, acting_user, *args|\n r = this.send(name, *args)\n r = ReactiveRecordPsuedoRelationArray.new(r) if r.is_a? Array\n __set_synchromesh_permission_granted(this, r, r, acting_user, args, &block)\n end\n end",
"def create_block(id, node_ids)\n nodes = node_ids.select { |n| @nodes.key? n }.map { |n| @nodes[n] }\n block = Block.new(id, nodes)\n @blocks.push block\n block\n end",
"def using(t, &block)\n @cloud = self\n if t && self.class.available_bases.include?(t.to_sym)\n unless using_remoter?\n self.class.send :attr_reader, :remote_base\n self.class.send :attr_reader, :parent_cloud\n klass_string = \"#{t}\".classify\n klass = \"::PoolParty::Remote::#{klass_string}\".constantize\n \n @remote_base = klass.send :new, self, &block\n @remote_base.instance_eval &block if block \n options[:remote_base] = klass.to_s if respond_to?(:options)\n \n @parent_cloud = @cloud\n instance_eval \"def #{t};@remote_base;end\"\n end\n else\n raise \"Unknown remote base: #{t}\"\n end\n end",
"def package(id, &block)\n unless block\n raise InvalidValue.new(:package, \"have a block\")\n end\n\n packagers[id] << block\n end",
"def allocate(template)\n rc = Provider.by_name(@client, template['name'])\n\n return rc if OpenNebula.is_error?(rc)\n\n if rc\n return OpenNebula::Error.new(\"Provider #{template['name']} \" \\\n 'already exists')\n end\n\n rc = nil\n\n begin\n Terraform.p_load\n\n Terraform.check_connection(template)\n\n rc = to_json(template)\n\n return rc if OpenNebula.is_error?(rc)\n rescue StandardError => e\n return OpenNebula::Error.new(e)\n end\n\n template['plain'] ||= {}\n template['plain']['provider'] = template['provider']\n\n super(rc, template['name'], template['plain'])\n end",
"def change_chef_vars(instances, &block)\n instances.each { |inst|\n query = \"name:#{inst['server_name']}\"\n query_nodes = Chef::Search::Query.new\n query_nodes.search('node', query) do |node_item|\n yield node_item\n end\n }\n end",
"def on_invite(&block)\n @on_invite_block = block\n end",
"def module_template(app_name, place, module_name, &block)\n str = <<TEXT\nmodule #{app_name}\n module #{place}\n module #{module_name}\n #{block.call if block}\n end\n end\nend\nTEXT\nend",
"def banners_within_asn(param)\n banners_within_asns(param) do |data|\n yield data\n end\n end",
"def within_source_root(&block)\n metadata[:generator_init_block] = block\n end",
"def new_context(type, proc = nil)\n create_new_context(type)\n\n # run context initializer\n yield if block_given?\n\n # execute user provided block within context\n self.instance_eval(&proc) if proc\n\n restore_old_context\n end",
"def build_and_run_block(env)\n builder = Vagrant::Action::Builder.new\n @block.call(builder)\n @child_app = builder.to_app(env)\n Vagrant::Action::Runner.new.run(@child_app, env)\n end",
"def on(name, &block)\n @handlers[name.to_s] = block\n end",
"def resolve(&blk)\n @context = blk.binding.receiver\n instance_exec(&blk)\n end",
"def prepare(&block)\n define_method(:prepare, &block)\n end",
"def _bind_plugin(plugin, type)\n _each_plugin_method(plugin, type) do |plugin, method, real_method|\n self.instance_eval <<-EVAL\n # Define a method on `self` (the `Scope` instance).\n def #{method}(*args, &block)\n # Find the plugin.\n plugin = self._stasis.plugins.detect do |plugin|\n plugin.to_s == \"#{plugin.to_s}\"\n end\n # Pass parameters to the method on the plugin.\n plugin.send(:#{real_method}, *args, &block)\n end\n EVAL\n end\n end",
"def configure(&blk)\n @blk = blk if block_given?\n self\n end",
"def define!( name, _m, m, &block )\n if block.arity == 0\n define_method( name ) do\n _m.bind(self).call\n m.bind(self).call\n end\n else\n define_method( name ) do |*args|\n _m.bind(self).call(*args)\n m.bind(self).call(*args)\n end\n end\n end",
"def rack_app_route_block(block)\n block\n end",
"def rack_app_route_block(block)\n block\n end",
"def bind(pattern, &block)\n widget.bind(pattern, &block)\n end",
"def use_oauth2_token(&block)\n @oauth2 = OAuth2Params.new\n @oauth2.instance_eval(&block)\n end",
"def programblk_handler(programblk, symbolTable)\n\n\t\t# Create new symbol table for program scope\n\t\tnewSymbolTable = createSymbolTable(\"program\",symbolTable)\n\n\t\t# Handle block of instructions\n\t\tinstrlist_handler(programblk.instrlist, newSymbolTable)\n\t\n\t\t$tableID.pop()\n\tend",
"def bind(target, deferred = nil, &block)\r\n create_binding(deferred, target, &block)\r\n end",
"def bind(target, deferred = nil, &block)\r\n create_binding(deferred, target, &block)\r\n end",
"def call_provider(_value); end",
"def bound_method(block); end",
"def init (&block)\n @init_block = block\n end",
"def run(&block)\n update_appd_cookbook\n generate_solo_config\n generate_node_config\n @ssh.exec \"chef-solo --config /tmp/solo.rb --json-attributes /tmp/node.json --force-formatter --log_level error --format appd\", sudo: true do |ch, stream, data, cmd|\n yield data\n end\n end",
"def define_driver\n { 'name' => 'solusvm',\n 'privileged' => 'true'\n }\n end",
"def post_init_block(&block)\n with(&block)\n end",
"def new_provider(port,bool)\n stub_framework(bool)\n fill_in \"provider[name]\", :with => \"ec2-testprovider\"\n fill_in \"provider[url]\", :with => \"http://localhost:#{port}/api\"\n select(\"Amazon EC2\", :from => \"provider_provider_type_id\")\n click_button \"Create Provider\"\nend",
"def configure(&block)\n @config = BeaconControl::Base::Config.new &block\n end"
] |
[
"0.5001778",
"0.48244882",
"0.48094225",
"0.47703215",
"0.4698374",
"0.4698298",
"0.4649873",
"0.46205002",
"0.45914763",
"0.4587741",
"0.4587297",
"0.45735294",
"0.45548",
"0.45420069",
"0.45293686",
"0.4468559",
"0.44195402",
"0.44073898",
"0.4399371",
"0.43583658",
"0.43530062",
"0.43530062",
"0.43477237",
"0.43194097",
"0.42885458",
"0.42849877",
"0.42818293",
"0.42818293",
"0.42807204",
"0.4280104",
"0.42787787",
"0.42597276",
"0.42530987",
"0.42522782",
"0.42522782",
"0.42395973",
"0.4232905",
"0.42192537",
"0.42186123",
"0.41951033",
"0.41894788",
"0.41860026",
"0.41853344",
"0.41841123",
"0.41839433",
"0.4182753",
"0.41807345",
"0.4179076",
"0.41781962",
"0.417809",
"0.41770113",
"0.41621354",
"0.41565117",
"0.4154988",
"0.41518265",
"0.41452459",
"0.4142451",
"0.41370723",
"0.41264486",
"0.41034967",
"0.4102491",
"0.4102491",
"0.409683",
"0.40901282",
"0.4088606",
"0.40865043",
"0.40810698",
"0.4078143",
"0.4074818",
"0.40589267",
"0.40530884",
"0.40453997",
"0.4041792",
"0.40370983",
"0.40353718",
"0.4030431",
"0.40284643",
"0.40281022",
"0.40246078",
"0.40243962",
"0.40236512",
"0.4009889",
"0.40039438",
"0.40035146",
"0.40025586",
"0.3998163",
"0.3998163",
"0.39915574",
"0.39894313",
"0.39864528",
"0.39849135",
"0.39849135",
"0.39811447",
"0.39737716",
"0.39735374",
"0.3973476",
"0.39605895",
"0.39569873",
"0.3955653",
"0.39521888"
] |
0.6432319
|
0
|
The callback given to the Listener object for handling an SNMP message. Calls `dispatch`, then sends the response PDU, if one is returned.
|
def process_message(message)
# TODO: May want to ignore some messages (say, if the community string is wrong)
message.respond(dispatch(message))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def dispatch(message)\n response_pdu = message.make_response_pdu\n context = ProviderDsl.new\n context.message = message\n context.response_pdu = response_pdu\n message.pdu.varbinds.each_with_index do |vb, index|\n context.varbind = vb\n provider = providers.find { |p| p.provides?(vb.oid) }\n if provider\n if message.pdu.command == Constants::SNMP_MSG_GETBULK && index < message.pdu.non_repeaters\n handler = provider.handler_for(Constants::SNMP_MSG_GETNEXT)\n else\n handler = provider.handler_for(message)\n end\n if handler\n context.instance_exec(&handler)\n else\n warn \"No handler for command: #{message.pdu.command} @ #{vb.oid}\"\n context.no_such_object\n end\n else\n warn \"No provider for oid: #{vb.oid}\"\n context.no_such_object\n end\n end\n response_pdu\n end",
"def dispatch(msg)\n case msg.command\n when LINK_ESTABLISHING\n ret=on_link_establishing(msg)\n when LINK_ESTABLISHED\n ret=on_link_established(msg)\n when LINK_FAILED\n ret=on_link_failed(msg)\n when LINK_CLOSING\n ret=on_link_closing(msg)\n when LINK_CLOSED\n ret=on_link_closed(msg)\n when RECV_MESSAGE\n ret=on_recv_message(msg)\n when RECV_MESSAGE_BROKEN\n ret=on_recv_message_broken(msg)\n when RECV_MESSAGE_KILL\n ret=on_recv_message_kill(msg)\n when RECV_MESSAGE_PING\n ret=on_recv_message_ping(msg)\n when RECV_MESSAGE_PONG\n ret=on_recv_message_pong(msg)\n when RECV_MESSAGE_ERROR\n ret=on_recv_message_error(msg)\n when RECV_MESSAGE_NOTICE\n ret=on_recv_message_notice(msg)\n when RECV_RPL_INIT\n ret=on_recv_rpl_init(msg)\n when RECV_RPL_TRACELINK\n ret=on_recv_rpl_tracelink(msg)\n when RECV_RPL_TRACECONNECTING\n ret=on_recv_rpl_traceconnecting(msg)\n when RECV_RPL_TRACEHANDSHAKE\n ret=on_recv_rpl_tracehandshake(msg)\n when RECV_RPL_TRACEUNKNOWN\n ret=on_recv_rpl_traceunknown(msg)\n when RECV_RPL_TRACEOPERATOR\n ret=on_recv_rpl_traceoperator(msg)\n when RECV_RPL_TRACEUSER\n ret=on_recv_rpl_traceuser(msg)\n when RECV_RPL_TRACESERVER\n ret=on_recv_rpl_traceserver(msg)\n when RECV_RPL_TRACENEWTYPE\n ret=on_recv_rpl_tracenewtype(msg)\n when RECV_RPL_STATSLINKINF\n ret=on_recv_rpl_statslinkinf(msg)\n when RECV_RPL_STATSCOMMANDS\n ret=on_recv_rpl_statscommands(msg)\n when RECV_RPL_STATSCLINE\n ret=on_recv_rpl_statscline(msg)\n when RECV_RPL_STATSNLINE\n ret=on_recv_rpl_statsnline(msg)\n when RECV_RPL_STATSILINE\n ret=on_recv_rpl_statsiline(msg)\n when RECV_RPL_STATSKLINE\n ret=on_recv_rpl_statskline(msg)\n when RECV_RPL_STATSYLINE\n ret=on_recv_rpl_statsyline(msg)\n when RECV_RPL_ENDOFSTATS\n ret=on_recv_rpl_endofstats(msg)\n when RECV_RPL_UMODEIS\n ret=on_recv_rpl_umodeis(msg)\n when RECV_RPL_STATSLLINE\n ret=on_recv_rpl_statslline(msg)\n when RECV_RPL_STATSUPTIME\n ret=on_recv_rpl_statsuptime(msg)\n when RECV_RPL_STATSOLINE\n ret=on_recv_rpl_statsoline(msg)\n when RECV_RPL_STATSHLINE\n ret=on_recv_rpl_statshline(msg)\n when RECV_RPL_LUSERCLIENT\n ret=on_recv_rpl_luserclient(msg)\n when RECV_RPL_LUSEROP\n ret=on_recv_rpl_luserop(msg)\n when RECV_RPL_LUSERUNKNOWN\n ret=on_recv_rpl_luserunknown(msg)\n when RECV_RPL_LUSERCHANNELS\n ret=on_recv_rpl_luserchannels(msg)\n when RECV_RPL_LUSERME\n ret=on_recv_rpl_luserme(msg)\n when RECV_RPL_ADMINME\n ret=on_recv_rpl_adminme(msg)\n when RECV_RPL_ADMINLOC1\n ret=on_recv_rpl_adminloc1(msg)\n when RECV_RPL_ADMINLOC2\n ret=on_recv_rpl_adminloc2(msg)\n when RECV_RPL_ADMINEMAIL\n ret=on_recv_rpl_adminemail(msg)\n when RECV_RPL_TRACELOG\n ret=on_recv_rpl_tracelog(msg)\n when RECV_RPL_NONE\n ret=on_recv_rpl_none(msg)\n when RECV_RPL_AWAY\n ret=on_recv_rpl_away(msg)\n when RECV_RPL_USERHOST\n ret=on_recv_rpl_userhost(msg)\n when RECV_RPL_ISON\n ret=on_recv_rpl_ison(msg)\n when RECV_RPL_UNAWAY\n ret=on_recv_rpl_unaway(msg)\n when RECV_RPL_NOWAWAY\n ret=on_recv_rpl_nowaway(msg)\n when RECV_RPL_WHOISUSER\n ret=on_recv_rpl_whoisuser(msg)\n when RECV_RPL_WHOISSERVER\n ret=on_recv_rpl_whoisserver(msg)\n when RECV_RPL_WHOISOPERATOR\n ret=on_recv_rpl_whoisoperator(msg)\n when RECV_RPL_WHOWASUSER\n ret=on_recv_rpl_whowasuser(msg)\n when RECV_RPL_ENDOFWHO\n ret=on_recv_rpl_endofwho(msg)\n when RECV_RPL_WHOISIDLE\n ret=on_recv_rpl_whoisidle(msg)\n when RECV_RPL_ENDOFWHOIS\n ret=on_recv_rpl_endofwhois(msg)\n when RECV_RPL_WHOISCHANNELS\n ret=on_recv_rpl_whoischannels(msg)\n when RECV_RPL_LISTSTART\n ret=on_recv_rpl_liststart(msg)\n when RECV_RPL_LIST\n ret=on_recv_rpl_list(msg)\n when RECV_RPL_LISTEND\n ret=on_recv_rpl_listend(msg)\n when RECV_RPL_CHANNELMODEIS\n ret=on_recv_rpl_channelmodeis(msg)\n when RECV_RPL_NOTOPIC\n ret=on_recv_rpl_notopic(msg)\n when RECV_RPL_TOPIC\n ret=on_recv_rpl_topic(msg)\n when RECV_RPL_INVITING\n ret=on_recv_rpl_inviting(msg)\n when RECV_RPL_SUMMONING\n ret=on_recv_rpl_summoning(msg)\n when RECV_RPL_VERSION\n ret=on_recv_rpl_version(msg)\n when RECV_RPL_WHOREPLY\n ret=on_recv_rpl_whoreply(msg)\n when RECV_RPL_NAMREPLY\n ret=on_recv_rpl_namreply(msg)\n when RECV_RPL_LINKS\n ret=on_recv_rpl_links(msg)\n when RECV_RPL_ENDOFLINKS\n ret=on_recv_rpl_endoflinks(msg)\n when RECV_RPL_ENDOFNAME\n ret=on_recv_rpl_endofname(msg)\n when RECV_RPL_BANLIST\n ret=on_recv_rpl_banlist(msg)\n when RECV_RPL_ENDOFBANLIST\n ret=on_recv_rpl_endofbanlist(msg)\n when RECV_RPL_ENDOFWHOWAS\n ret=on_recv_rpl_endofwhowas(msg)\n when RECV_RPL_INFO\n ret=on_recv_rpl_info(msg)\n when RECV_RPL_MOTD\n ret=on_recv_rpl_motd(msg)\n when RECV_RPL_ENDOFINFO\n ret=on_recv_rpl_endofinfo(msg)\n when RECV_RPL_MOTDSTART\n ret=on_recv_rpl_motdstart(msg)\n when RECV_RPL_ENDOFMOTD\n ret=on_recv_rpl_endofmotd(msg)\n when RECV_RPL_YOUREOPER\n ret=on_recv_rpl_youreoper(msg)\n when RECV_RPL_REHASHING\n ret=on_recv_rpl_rehashing(msg)\n when RECV_RPL_TIME\n ret=on_recv_rpl_time(msg)\n when RECV_RPL_USERS\n ret=on_recv_rpl_users(msg)\n when RECV_RPL_ENDOFUSERS\n ret=on_recv_rpl_endofusers(msg)\n when RECV_RPL_NOUSERS\n ret=on_recv_rpl_nousers(msg)\n when RECV_ERR_NOSUCHNICK\n ret=on_recv_err_nosuchnick(msg)\n when RECV_ERR_NOSUCHSERVE\n ret=on_recv_err_nosuchserve(msg)\n when RECV_ERR_NOSUCHCHANNEL\n ret=on_recv_err_nosuchchannel(msg)\n when RECV_ERR_CANNOTSENDTOCHAN\n ret=on_recv_err_cannotsendtochan(msg)\n when RECV_ERR_TOOMANYCHANNELS\n ret=on_recv_err_toomanychannels(msg)\n when RECV_ERR_WASNOSUCHNICK\n ret=on_recv_err_wasnosuchnick(msg)\n when RECV_ERR_TOOMANYTARGETS\n ret=on_recv_err_toomanytargets(msg)\n when RECV_ERR_NOORIGIN\n ret=on_recv_err_noorigin(msg)\n when RECV_ERR_NORECIPIENT\n ret=on_recv_err_norecipient(msg)\n when RECV_ERR_NOTEXTTOSEND\n ret=on_recv_err_notexttosend(msg)\n when RECV_ERR_NOTOPLEVE\n ret=on_recv_err_notopleve(msg)\n when RECV_ERR_WILDTOPLEVEL\n ret=on_recv_err_wildtoplevel(msg)\n when RECV_ERR_UNKNOWNCOMMAND\n ret=on_recv_err_unknowncommand(msg)\n when RECV_ERR_NOMOTD\n ret=on_recv_err_nomotd(msg)\n when RECV_ERR_NOADMININFO\n ret=on_recv_err_noadmininfo(msg)\n when RECV_ERR_FILEERROR\n ret=on_recv_err_fileerror(msg)\n when RECV_ERR_NONICKNAMEGIVEN\n ret=on_recv_err_nonicknamegiven(msg)\n when RECV_ERR_ERRONEUSNICKNAME\n ret=on_recv_err_erroneusnickname(msg)\n when RECV_ERR_NICKNAMEINUSE\n ret=on_recv_err_nicknameinuse(msg)\n when RECV_ERR_NICKCOLLISION\n ret=on_recv_err_nickcollision(msg)\n when RECV_ERR_USERNOTINCHANNEL\n ret=on_recv_err_usernotinchannel(msg)\n when RECV_ERR_NOTONCHANNE\n ret=on_recv_err_notonchanne(msg)\n when RECV_ERR_USERONCHANNEL\n ret=on_recv_err_useronchannel(msg)\n when RECV_ERR_NOLOGIN\n ret=on_recv_err_nologin(msg)\n when RECV_ERR_SUMMONDISABLED\n ret=on_recv_err_summondisabled(msg)\n when RECV_ERR_USERSDISABLED\n ret=on_recv_err_usersdisabled(msg)\n when RECV_ERR_NOTREGISTERED\n ret=on_recv_err_notregistered(msg)\n when RECV_ERR_NEEDMOREPARAM\n ret=on_recv_err_needmoreparam(msg)\n when RECV_ERR_ALREADYREGISTRE\n ret=on_recv_err_alreadyregistre(msg)\n when RECV_ERR_NOPERMFORHOST\n ret=on_recv_err_nopermforhost(msg)\n when RECV_ERR_PASSWDMISMATCH\n ret=on_recv_err_passwdmismatch(msg)\n when RECV_ERR_YOUREBANNEDCREEP\n ret=on_recv_err_yourebannedcreep(msg)\n when RECV_ERR_KEYSET\n ret=on_recv_err_keyset(msg)\n when RECV_ERR_CHANNELISFULL\n ret=on_recv_err_channelisfull(msg)\n when RECV_ERR_UNKNOWNMODE\n ret=on_recv_err_unknownmode(msg)\n when RECV_ERR_INVITEONLYCHAN\n ret=on_recv_err_inviteonlychan(msg)\n when RECV_ERR_BANNEDFROMCHAN\n ret=on_recv_err_bannedfromchan(msg)\n when RECV_ERR_BADCHANNELKEY\n ret=on_recv_err_badchannelkey(msg)\n when RECV_ERR_NOPRIVILEGES\n ret=on_recv_err_noprivileges(msg)\n when RECV_ERR_CHANOPRIVSNEEDED\n ret=on_recv_err_chanoprivsneeded(msg)\n when RECV_ERR_CANTKILLSERVER\n ret=on_recv_err_cantkillserver(msg)\n when RECV_ERR_NOOPERHOST\n ret=on_recv_err_nooperhost(msg)\n when RECV_ERR_UMODEUNKNOWNFLAG\n ret=on_recv_err_umodeunknownflag(msg)\n when RECV_ERR_USERSDONTMATCH\n ret=on_recv_err_usersdontmatch(msg)\n when RECV_CMND_UNKNOWN\n ret=on_recv_cmnd_unknown(msg)\n when RECV_CMND_PASS\n ret=on_recv_cmnd_pass(msg)\n when RECV_CMND_NICK\n ret=on_recv_cmnd_nick(msg)\n when RECV_CMND_USER\n ret=on_recv_cmnd_user(msg)\n when RECV_CMND_SERVER\n ret=on_recv_cmnd_server(msg)\n when RECV_CMND_OPER\n ret=on_recv_cmnd_oper(msg)\n when RECV_CMND_QUIT\n ret=on_recv_cmnd_quit(msg)\n when RECV_CMND_SQUIT\n ret=on_recv_cmnd_squit(msg)\n when RECV_CMND_JOIN\n ret=on_recv_cmnd_join(msg)\n when RECV_CMND_PART\n ret=on_recv_cmnd_part(msg)\n when RECV_CMND_MODE\n ret=on_recv_cmnd_mode(msg)\n when RECV_CMND_TOPIC\n ret=on_recv_cmnd_topic(msg)\n when RECV_CMND_NAMES\n ret=on_recv_cmnd_names(msg)\n when RECV_CMND_LIST\n ret=on_recv_cmnd_list(msg)\n when RECV_CMND_INVITE\n ret=on_recv_cmnd_invite(msg)\n when RECV_CMND_KICK\n ret=on_recv_cmnd_kick(msg)\n when RECV_CMND_VERSION\n ret=on_recv_cmnd_version(msg)\n when RECV_CMND_STATAS\n ret=on_recv_cmnd_statas(msg)\n when RECV_CMND_LINK\n ret=on_recv_cmnd_link(msg)\n when RECV_CMND_TIME\n ret=on_recv_cmnd_time(msg)\n when RECV_CMND_CONNECT\n ret=on_recv_cmnd_connect(msg)\n when RECV_CMND_TRACE\n ret=on_recv_cmnd_trace(msg)\n when RECV_CMND_ADMIN\n ret=on_recv_cmnd_admin(msg)\n when RECV_CMND_INFO\n ret=on_recv_cmnd_info(msg)\n when RECV_CMND_PRIVMSG\n ret=on_recv_cmnd_privmsg(msg)\n when RECV_CMND_NOTICE\n ret=on_recv_cmnd_notice(msg)\n when RECV_CMND_WHO\n ret=on_recv_cmnd_who(msg)\n when RECV_CMND_WHOIS\n ret=on_recv_cmnd_whois(msg)\n when RECV_CMND_WHOWAS\n ret=on_recv_cmnd_whowas(msg)\n when RECV_CMND_KILL\n ret=on_recv_cmnd_kill(msg)\n when RECV_CMND_PING\n ret=on_recv_cmnd_ping(msg)\n when RECV_CMND_PONG\n ret=on_recv_cmnd_pong(msg)\n when RECV_CMND_ERROR\n ret=on_recv_cmnd_error(msg)\n when RECV_CMND_AWAY\n ret=on_recv_cmnd_away(msg)\n when RECV_CMND_REHASH\n ret=on_recv_cmnd_rehash(msg)\n when RECV_CMND_RESTART\n ret=on_recv_cmnd_restart(msg)\n when RECV_CMND_SUMMON\n ret=on_recv_cmnd_summon(msg)\n when RECV_CMND_USERS\n ret=on_recv_cmnd_users(msg)\n when RECV_CMND_WALLOPS\n ret=on_recv_cmnd_wallops(msg)\n when RECV_CMND_USERHOST\n ret=on_recv_cmnd_userhost(msg)\n when RECV_CMND_ISON\n ret=on_recv_cmnd_ison(msg)\n when RECV_CMND_CTCP_QUERY\n ret=on_recv_cmnd_ctcp_query(msg)\n when RECV_CMND_CTCP_QUERY_UNKNOWN\n ret=on_recv_cmnd_ctcp_query_unknown(msg)\n when RECV_CMND_CTCP_QUERY_PING\n ret=on_recv_cmnd_ctcp_query_ping(msg)\n when RECV_CMND_CTCP_QUERY_ECHO\n ret=on_recv_cmnd_ctcp_query_echo(msg)\n when RECV_CMND_CTCP_QUERY_TIME\n ret=on_recv_cmnd_ctcp_query_time(msg)\n when RECV_CMND_CTCP_QUERY_VERSION\n ret=on_recv_cmnd_ctcp_query_version(msg)\n when RECV_CMND_CTCP_QUERY_CLIENTINFO\n ret=on_recv_cmnd_ctcp_query_clientinfo(msg)\n when RECV_CMND_CTCP_QUERY_USERINFO\n ret=on_recv_cmnd_ctcp_query_userinfo(msg)\n when RECV_CMND_CTCP_QUERY_ACTION\n ret=on_recv_cmnd_ctcp_query_action(msg)\n when RECV_CMND_CTCP_QUERY_DCC\n ret=on_recv_cmnd_ctcp_query_dcc(msg)\n when RECV_CMND_CTCP_ANSWER\n ret=on_recv_cmnd_ctcp_answer(msg)\n when RECV_CMND_CTCP_ANSWER_UNKNOWN\n ret=on_recv_cmnd_ctcp_answer_unknown(msg)\n when RECV_CMND_CTCP_ANSWER_PING\n ret=on_recv_cmnd_ctcp_answer_ping(msg)\n when RECV_CMND_CTCP_ANSWER_ECHO\n ret=on_recv_cmnd_ctcp_answer_echo(msg)\n when RECV_CMND_CTCP_ANSWER_TIME\n ret=on_recv_cmnd_ctcp_answer_time(msg)\n when RECV_CMND_CTCP_ANSWER_VERSION\n ret=on_recv_cmnd_ctcp_answer_version(msg)\n when RECV_CMND_CTCP_ANSWER_CLIENTINFO\n ret=on_recv_cmnd_ctcp_answer_clientinfo(msg)\n when RECV_CMND_CTCP_ANSWER_USERINFO\n ret=on_recv_cmnd_ctcp_answer_userinfo(msg)\n when RECV_CMND_CTCP_ANSWER_ACTION\n ret=on_recv_cmnd_ctcp_answer_action(msg)\n when RECV_CMND_CTCP_ANSWER_DCC\n ret=on_recv_cmnd_ctcp_answer_dcc(msg)\n else\n ret=default_action(msg)\n end\n\n return ret\n end",
"def dispatch(message_id, *fields) \r\n formatted_message = ([message_id] + fields).join(',').to_str\r\n socket.send(\"#{formatted_message}\\n\",0)\r\n answer = socket.recv(500) \r\n @no_error = ((answer.split',')[0] == OK) ? true:false \r\n answer\r\n end",
"def dispatch(message)\n Turntabler.run { @handler.call(message) } if @handler\n end",
"def on_message(event)\n message = JSON.parse(event.data)\n\n if message['id']\n message['command'] = 'response_received'\n elsif message['message']\n command, *args = *message['message']\n message = {'command' => command, 'args' => args}\n end\n\n logger.debug \"Message received: #{message.inspect}\"\n dispatch(message)\n end",
"def dispatch(t_msg)\n self.send(@dispatcher_block, t_msg)\n end",
"def on_message(event)\n data = event.data\n\n response = data.match(/~m~\\d*~m~(.*)/)[1]\n message =\n case response\n when /no_session/\n {'command' => 'no_session'}\n when /~h~([0-9]+)/\n # Send the heartbeat command back to the server\n @socket.send($1)\n {'command' => 'heartbeat'}\n else\n JSON.parse(response)\n end\n message['command'] = 'response_received' if message['msgid']\n\n logger.debug \"Message received: #{message.inspect}\"\n dispatch(message)\n end",
"def process_pdu(pdu)\n case pdu\n when Pdu::DeliverSm\n write_pdu(Pdu::DeliverSmResponse.new(pdu.sequence_number))\n logger.debug \"ESM CLASS #{pdu.esm_class}\"\n if pdu.esm_class != 4\n # MO message; invoke MO proc\n @mo_proc.call(pdu.source_addr, pdu.destination_addr, pdu.short_message)\n else\n # Invoke DR proc (let the owner of the block do the mapping from msg_reference to mt_id)\n @dr_proc.call(pdu.msg_reference.to_s, pdu.stat)\n end \n when Pdu::BindTransceiverResponse\n case pdu.command_status\n when Pdu::Base::ESME_ROK\n logger.debug \"Bound OK.\"\n @state = :bound\n when Pdu::Base::ESME_RINVPASWD\n logger.warn \"Invalid password.\"\n EventMachine::stop_event_loop\n when Pdu::Base::ESME_RINVSYSID\n logger.warn \"Invalid system id.\"\n EventMachine::stop_event_loop\n else\n logger.warn \"Unexpected BindTransceiverResponse. Command status: #{pdu.command_status}\"\n EventMachine::stop_event_loop\n end\n when Pdu::SubmitSmResponse\n mt_message_id = @ack_ids[pdu.sequence_number]\n if !mt_message_id\n raise \"Got SubmitSmResponse for unknown sequence_number: #{pdu.sequence_number}\"\n end\n if pdu.command_status != Pdu::Base::ESME_ROK\n logger.error \"Error status in SubmitSmResponse: #{pdu.command_status}\"\n else\n logger.info \"Got OK SubmitSmResponse (#{pdu.message_id} -> #{mt_message_id})\"\n end\n # Now we got the SMSC message id; create pending delivery report\n @pdr_storage[pdu.message_id] = mt_message_id\n when Pdu::SubmitMultiResponse\n mt_message_id = @ack_ids[pdu.sequence_number]\n if !mt_message_id\n raise \"Got SubmitMultiResponse for unknown sequence_number: #{pdu.sequence_number}\"\n end\n if pdu.command_status != Pdu::Base::ESME_ROK\n logger.error \"Error status in SubmitMultiResponse: #{pdu.command_status}\"\n else\n logger.info \"Got OK SubmitMultiResponse (#{pdu.message_id} -> #{mt_message_id})\"\n end\n else\n super\n end \n end",
"def receive_response(response); end",
"def receive\n # Process msg_descriptor\n Subscriber.execute_from_descriptor(msg_descriptor)\n head :no_content\n rescue InvalidSubscriberError\n # 404: Message delivery will be retried\n head :not_found\n rescue StandardError\n # 422: Message delivery will be retried\n head :unprocessable_entity\n end",
"def handle_dispatch(payload)\n LOGGER.debug { \"Emitting #{payload[:t]}\" }\n emit(payload[:t], payload[:d])\n end",
"def message(event)\n req = Message.from_wire(event.data)\n\n if req.type == \"rpc\" then\n # Execute the requested method and return the result\n # Do it asynchronously so as not to hold up the EM-loop while the command is running\n @thread_pool.perform do\n json_req = req.json_request\n logger.debug { \"RPC request\\n#{json_req}\" }\n json_response = @handler.new(req).handle(json_req)\n EM.next_tick { ws.send(Response.new(json_response, req.id).to_wire) }\n end\n\n elsif req.type == \"rpc_result\" then\n # Pass the result back to the caller\n res = req.json_response\n logger.debug { \"RPC_RESULT for request id [#{req.id}]\\n#{res}\" }\n @responses[req.id].response = res\n\n elsif req.type == \"connect\" then\n # Agent request to CONNECT to the manager\n # will only be received by the server-end of the channel\n logger.debug { \"CONNECT request #{req.id}\"}\n ret = @handler.new(req).connect(req.json_request, self)\n if ret.kind_of? JsonResponse then\n ws.send(Response.new(ret, req.id).to_wire)\n else\n ws.send(Response.new(JsonResponse.new(\"success\"), req.id).to_wire)\n end\n\n end\n end",
"def dispatch(msg)\n case msg.message_type\n when Message::METHOD_CALL\n if not @intfs[msg.interface]\n raise InterfaceNotInObject, msg.interface\n end\n meth = @intfs[msg.interface].methods[msg.member.to_sym]\n raise MethodNotInInterface if not meth\n methname = Object.make_method_name(msg.interface, msg.member)\n retdata = method(methname).call(*msg.params)\n\n reply = Message.new.reply_to(msg)\n # I'm sure there is a ruby way to do that\n i = 0\n if meth.rets.size > 0 and not retdata.kind_of?(Array)\n raise InvalidReturnType\n end\n meth.rets.each do |rsig|\n reply.add_param(rsig[1], retdata[i])\n end\n @service.bus.send(reply.marshall)\n end\n end",
"def handle_message(message)\n if @response_wait_list.waiting_for?(message)\n @response_wait_list.received(message)\n else\n @listener.receive_message(message)\n end\n end",
"def send msg\n @sending_socket.send(msg)\n\n if block_given? || @handler\n messages = response\n if !messages.nil?\n messages.each do |message|\n if block_given?\n yield message\n else\n @handler.handle message\n end\n end\n end\n end\n end",
"def subscribe &handler\n input = \"\"\n response = 0\n #wait for message from pull socket\n while true\n response = @pull.recv_string(input)\n if !error?(response)\n input.chomp!\n\n #Message received\n yield input if block_given?\n Communicator::get_logger.info \"Message received: #{input}\"\n end\n end\n end",
"def callback\n def_deferr = ::EventMachine::DefaultDeferrable.new\n proc_callback = Proc.new { |response| ::OnesnooperServer::Log.debug(\n \"[#{self.class.name}] Handled as: #{response}\"\n ) }\n\n def_deferr.callback &proc_callback\n def_deferr.errback &proc_callback\n\n def_deferr\n end",
"def receive_response hResp\n resp = Response.factory( hResp )\n Handler.log.debug \"Response received from #{ip_port}##{resp.id} : #{resp.result? ? resp.result : resp.error}\"\n emit( 'response', resp )\n if resp.id && @response_waited[resp.id]\n @response_waited.delete(resp.id).call(resp)\n elsif resp.result?\n Handler.log.warn \"No handler for this response !\"\n end\n resp\n end",
"def message_received(&callback)\n @connectivity_checker.message_received(&callback)\n end",
"def cmdh_ping_req(msg_details)\n @log.debug \"PINGREQ handler\"\n # response back\n send_ping_resp\n end",
"def handle(context)\n\n # Notify all connection listeners by calling their on_server_response method.\n notify(context) do |connection_listener|\n connection_listener.on_server_response(context, self)\n end\n \n end",
"def reply(response)\n if @_event == :receive && message.command == :privmsg\n privmsg message.params[0], response\n end\n end",
"def dispatch(*args)\n log(:debug) { 'Dispatch message to worker.' }\n\n fetch_idle_worker.future :dispatch, args\n end",
"def run(&callback)\n @serializer.run do |msg|\n debug(\"received #{msg.inspect}\")\n kind, *payload = msg\n\n case kind\n when 0\n handle_request(payload, callback)\n when 1\n handle_response(payload)\n when 2\n handle_notification(payload, callback)\n end\n end\n rescue => e\n fatal(\"got unexpected error #{e.inspect}\")\n debug(e.backtrace.join(\"\\n\"))\n end",
"def dispatch(ews, soapmsg, opts)\n respmsg = post(soapmsg)\n @log.debug <<-EOF.gsub(/^ {6}/, '')\n Received SOAP Response:\n ----------------\n #{Nokogiri::XML(respmsg).to_xml}\n ----------------\n EOF\n opts[:raw_response] ? respmsg : ews.parse_soap_response(respmsg, opts)\n end",
"def dispatch_msg( msg , udpsock ) \n\t\n\tmsg_arr = msg[0].split(\" \")\n\tsender_host = msg[1][3]\n\tsender_port = msg[1][1]\n\n\tmsg_header = msg_arr[0]\n\tmsg_arr.shift()\n\tmsg_payload = msg_arr * \" \"\n\t\n\tudpsock.send \"pong\", 0 , sender_host, sender_port\n\n\t\nend",
"def do_dispatch(participant, msg)\n\n do_raw_dispatch(participant, msg)\n\n rescue => err\n @context.error_handler.msg_handle(msg, err)\n end",
"def dispatch(obj)\n msg = @source.receive(TIMEOUT)\n ::Celluloid.mailbox << msg if msg\n end",
"def on_data(payload)\n # Do stuff with the payload\n Troph::Log.info \"received nomination message: #{payload}\"\n end",
"def process_msg_from_monitor ws, ws_context, msg\n if !ws_context[:registered]\n ws.close\n return\n end\n if ws_context[:type] != 'monitor'\n return\n end\n if resp_id = msg[:resp_id]\n # response from monitor\n callback = @callbacks[resp_id]\n if !callback\n return\n end\n @callbacks.delete resp_id\n callback.call msg[:err], msg[:body]\n return\n end\n # request or notify from monitor\n @console_service.execute(msg[:module_id], :master_handler, msg[:body]) { |err, res|\n if is_request? msg\n if resp = compose_response(msg, err, res)\n ws.send ['monitor', resp].to_json\n end\n else\n # notify should not have a callback\n end\n }\n end",
"def on_message_call handler\n @@handler_symbol = handler\n end",
"def handle(msg)\n message = Remote::Message.decode(msg)\n assert_type(message)\n call_route(message)\n end",
"def on_message_complete\n send_response\n close_socket\n write_to_screen\n end",
"def poll(agent, snmp)\n @snmp_manager = snmp\n @f5_agent = agent\n\n unless get_names.empty?\n get_requests\n get_conns_current\n get_conns_total\n get_packets_in\n get_packets_out\n get_throughput_in\n get_throughput_out\n end\n end",
"def receive_msg msg\n # stub, overwrite this in your handler\n end",
"def dispatch_event(data)\n puts \"Event Dispatcher Invoked\"\n \n unless !data.has_key? \"type\"\n puts \"message type #{data['type'].to_s}\"\n \n # switch event action based on message type\n case data['type']\n when \"register\"\n puts \"user wishes to register. check auth_key first\"\n self.register(data)\n when \"subscribe\"\n puts \"user wishes to subscribe to a channel\"\n self.subscribe(data)\n when \"message\"\n # message: to:channel,from:uuid,type:message,text:message,visibility:private\n puts \"user wishes to send a message\"\n end\n \n else\n # if the socket is connected but no post_init data was sent\n # then we want to kill the connection, since this is probably an unauthorized\n # user....\n \n puts \"data doesn't have key type\"\n self.close_connection_after_writing\n end\n \n end",
"def call\r\n # TODO: rename to more appropriate one 2007/05/10 by shino\r\n self.modify_message\r\n logger.debug{\"Ap4r::Dispatcher after modification\\n#{@message.to_yaml}\"}\r\n self.invoke\r\n self.validate_response\r\n self.response\r\n end",
"def handle_response(response)\n type, msgid, error, result = response\n if observable = @requests[msgid]\n @requests[msgid].set_response(result, error)\n else\n warn \"unknown response with id=#{msgid}\"\n end\n end",
"def handle_request(message)\n msg = nil\n result = nil\n begin\n client_port, client_ip = Socket.unpack_sockaddr_in(get_peername)\n msg = RequestMessage.new(:message => message, :headers => @web_node.message_headers)\n headers = @web_node.message_headers.merge(msg.headers)\n result = Dispatcher.dispatch_request(msg.jr_method,\n :method_args => msg.jr_args,\n :headers => headers,\n :client_ip => client_ip,\n :client_port => client_port,\n :rjr_node => @web_node,\n :rjr_node_id => @web_node.node_id,\n :rjr_node_type => RJR_NODE_TYPE,\n :rjr_callback => WebNodeCallback.new())\n rescue JSON::ParserError => e\n result = Result.invalid_request\n end\n\n msg_id = msg.nil? ? nil : msg.msg_id\n response = ResponseMessage.new(:id => msg_id, :result => result, :headers => headers)\n\n resp = EventMachine::DelegatedHttpResponse.new(self)\n #resp.status = response.result.success ? 200 : 500\n resp.status = 200\n resp.content = response.to_s\n resp.content_type \"application/json\"\n resp.send_response\n end",
"def on_server_response(connection, message)\n end",
"def process message\n op = message[\"opcode\"]\n data = message[\"data\"]\n\n case op\n when PUBLISH\n emit(\"message\", data)\n when SUBSCRIBE_GRANTED\n emit(\"subscribe\")\n when SUBSCRIBE_DENIED\n emit(\"subscribe_denied\")\n when PUBLISH_DENIED\n emit(\"publish_denied\")\n when PUBLISH_GRANTED\n emit(\"publish_granted\")\n when UNSUBSCRIBE_COMPLETE\n emit(\"unsubscribe\")\n @callbacks.clear\n when AUTHORIZE_DENIED\n emit(\"authorize_denied\")\n when AUTHORIZE_COMPLETE\n emit(\"authorize_complete\")\n end\n\n end",
"def received\n end",
"def on_response &b\n @response_proc = b\n self\n end",
"def poll(agent, snmp)\n @snmp_manager = snmp\n @f5_agent = agent\n\n unless get_names.empty?\n get_requests\n get_conns_current\n get_conns_total\n get_packets_in\n get_packets_out\n get_throughput_in\n get_throughput_out\n get_cpu_usage_1m\n end\n end",
"def dispatch(deliverable)\n prefix, meth = deliverable.type.split('/')[1..-1]\n meth ||= :index\n actor = registry.actor_for(prefix)\n\n operation = lambda do\n begin\n args = [ deliverable.payload ]\n args.push(deliverable) if actor.method(meth).arity == 2\n actor.send(meth, *args)\n rescue Exception => e\n handle_exception(actor, meth, deliverable, e)\n end\n end\n \n callback = lambda do |r|\n begin\n if deliverable.kind_of?(Request)\n r = Result.new(deliverable.token, deliverable.reply_to, r, identity)\n RightLinkLog.info(\"SEND #{r.to_s([])}\")\n amq.queue(deliverable.reply_to, :no_declare => options[:secure]).publish(serializer.dump(r))\n end\n rescue Exception => e\n RightLinkLog.error(\"Callback following dispatch failed with #{e.class.name}: #{e.message}\\n #{e.backtrace.join(\"\\n \")}\")\n end\n r # For unit tests\n end\n\n if @options[:single_threaded]\n @evmclass.next_tick { callback.call(operation.call) }\n else\n @evmclass.defer(operation, callback)\n end\n end",
"def handle(message)\n type, return_to, params = parse(message[:payload])\n begin\n m = handle_message(type, params)\n success(return_to, m)\n rescue Exception => e\n error(return_to, e)\n end\n end",
"def dispatch(identity, parts)\n message = Message.parse(parts)\n Logger.debug \"received from #{identity}: #{message.inspect}\"\n if @requests && @requests[message.id]\n @requests[message.id].broadcast(message)\n else\n write(identity, Message.new(message.id, [], [\"reply\", \"reply\", 1]).to_parts)\n end\n end",
"def call_ok_handler; call_handler(:ok); end",
"def add_response_handler(&block)\n Listener.new(&block).tap do |listener|\n listener.stopback{ listener.succeed }\n add_to_listener_pool(listener)\n end\n end",
"def received message, headers={}\n end",
"def handle(msg)\n raise \"The handle() method must be implemented in #{self.class.to_s}\"\n end",
"def dispatch(event)\n if ENV.key?('PROM_DEBUG')\n log.debug(\"PROM_DEBUG set, not dispatching event to Sensu: #{event}\")\n return\n end\n\n # :nocov:\n begin\n s = TCPSocket.open(@sensu_address, @sensu_port)\n s.puts(JSON.generate(event))\n s.close\n rescue SystemCallError => e\n log.error(\"Sensu is refusing connections! Error: '#{e}'\")\n raise(\"Sensu is not avilable at '#{@sensu_address}:#{@sensu_port}'\")\n end\n # :nocov:\n end",
"def dispatch(message)\n SpotifyWeb.run { @handler.call(message) } if @handler\n end",
"def on_incoming_message(msg)\n type = msg.operation\n debug \"(#{id}) Deliver message '#{type}': #{msg.inspect}\"\n htypes = [type, :message]\n if type == :inform\n # TODO keep converting itype is painful, need to solve this.\n if (it = msg.itype(:ruby)) # format itype as lower case string\n case it\n when \"creation_ok\"\n htypes << :create_succeeded\n when 'status'\n htypes << :inform_status\n end\n\n htypes << it.to_sym\n end\n end\n\n debug \"(#{id}) Message type '#{htypes.inspect}' (#{msg.class}:#{msg.cid})\"\n hs = htypes.map { |ht| (@handlers[ht] || {}).values }.compact.flatten\n debug \"(#{id}) Distributing message to '#{hs.inspect}'\"\n hs.each do |block|\n block.call msg\n end\n if cbk = @context2cbk[msg.cid.to_s]\n debug \"(#{id}) Distributing message to '#{cbk.inspect}'\"\n cbk[:last_used] = Time.now\n cbk[:block].call(msg)\n end\n end",
"def respond(received)\n case received['type']\n\n when 'JOINING_NETWORK'\n puts('JOINING_NETWORK')\n\n # Reply with ROUTING_INFO\n @socket.send @msg.ROUTING_INFO(@id, received['node_id'], @port , @rt.getRoutingTableToSend(@port)), 0, '127.0.0.1', received['ip_address']\n\n # Put joining node in routing table\n @rt.updateRoutingTable(received['node_id'], received['ip_address'])\n\n # If there is a node closer to target in routing table forward JOINING_NETWORK_RELAY\n if @rt.routing_table.length > 0\n closest_node_ip = @rt.findCloserNode(received['target_id'], received['node_id'])\n if closest_node_ip != nil\n @socket.send @msg.JOINING_NETWORK_RELAY(received['node_id'], received['target_id'], @id), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n when 'JOINING_NETWORK_RELAY'\n puts('JOINING_NETWORK_RELAY')\n\n # If not target, forward JOINING_NETWORK_RELAY to closer node\n if received['node_id'] != @id\n closest_node_ip = @rt.findCloserNode(received['target_id'], received['node_id'])\n if !closest_node_ip.nil?\n @socket.send @msg.JOINING_NETWORK_RELAY(received['node_id'], received['target_id'], received['gateway_id']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n # Send ROUTING_INFO to gateway node\n closest_node_ip = @rt.findCloserNode(received['gateway_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.ROUTING_INFO(received['gateway_id'], received['node_id'], @port, @rt.getRoutingTableToSend(@port)), 0, '127.0.0.1', closest_node_ip\n end\n\n when 'ROUTING_INFO'\n puts('ROUTING_INFO')\n\n # Store received routing info\n received['route_table'].each do |x|\n @rt.updateRoutingTable(x['node_id'], x['ip_address'])\n end\n\n # If this is the gateway node forward ROUTING_INFO to joining node\n if received['gateway_id'] == @id\n joining_ip = @rt.routing_table.detect{|x| x[:node_id] == received['node_id']}[:ip_address]\n @socket.send @msg.ROUTING_INFO(@id, received['node_id'], @port, received['route_table']), 0, '127.0.0.1', joining_ip\n end\n\n # If message not intended for this node send it closer to target\n if received['node_id'] != @id\n closest_node_ip = @rt.findCloserNode(received['gateway_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.ROUTING_INFO(received['gateway_id'], received['node_id'], @port, received['route_table']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n when 'LEAVING_NETWORK'\n puts('LEAVING_NETWORK')\n @rt.deleteRoutingTableEntry(received['node_id']) # Delete leaving node from routing table\n\n when 'INDEX'\n puts('INDEX')\n\n # If message is intended for this node\n if received['target_id'] == @id\n\n # Store new index\n @index.addIndex(received['keyword'], received['link'])\n\n # Respond with ACK_INDEX\n closest_node_ip = @rt.findCloserNode(received['sender_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.ACK_INDEX(received['sender_id'], received['keyword']), 0, '127.0.0.1', closest_node_ip\n end\n\n # If message not for this node, send closer to target\n else\n closest_node_ip = @rt.findCloserNode(received['target_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.INDEX(received['target_id'], received['sender_id'], received['keyword'], received['link']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n when 'SEARCH'\n puts('SEARCH')\n\n # If message is intended for this node ger results and send SEARCH_RESPONSE\n if received['node_id'] == @id\n closest_node_ip = @rt.findCloserNode(received['sender_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.SEARCH_RESPONSE(received['word'], received['sender_id'], @id, @index.getKeywordIndexes(received['word'].to_s)), 0, '127.0.0.1', closest_node_ip\n end\n\n # If message not for this node, send closer to target\n else\n closest_node_ip = @rt.findCloserNode(received['node_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.SEARCH(received['word'], received['node_id'], received['sender_id']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n when 'SEARCH_RESPONSE'\n puts('SEARCH_RESPONSE')\n\n # If message is intended for this node\n if received['node_id'] == @id\n\n received['response'].each do |x|\n result = SearchResult.new(received['word'], x['url'], x['rank'])\n ap result\n end\n\n # If message is not intended for this node, send closer to target\n else\n closest_node_ip = @rt.findCloserNode(received['node_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.SEARCH_RESPONSE(received['word'], received['node_id'], received['sender_id'], received['response']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n when 'PING'\n puts('PING')\n\n # Respond with ACK\n @socket.send @msg.ACK(received['target_id'], @port), 0, '127.0.0.1', received['ip_address']\n\n # Send PING to next node if not final target\n if received['target_id'] != @id\n\n # Send closer to target\n closest_node_ip = @rt.findCloserNode(received['target_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.PING(received['target_id'], received['sender_id'], @port), 0, '127.0.0.1', closest_node_ip\n @pinged_ip = closest_node_ip\n\n # Wait up to 10s for ACK\n time = Time.now\n while Time.now - time < 10 && !@ack_received\n end\n\n # If no ACK received delete node from routing table\n if !@ack_received\n @rt.deleteRoutingTableEntry(@rt.routing_table.detect{|x| x[:ip_address == closest_node_ip]}[:node_id]) # Delete from routing table\n else\n @ack_received = false # If ACK received reset value to false\n end\n end\n end\n\n when 'ACK'\n puts('ACK')\n\n if received['ip_address'] == @pinged_ip # If ACK is from expected node\n @ack_received = true # Indicate that ACK has been received\n end\n\n when 'ACK_INDEX'\n puts('ACK_INDEX')\n\n # If message is intended for this node\n if received['node_id'] == @id\n @ack_index_received = true # Indicate that ACK_INDEX has been received\n\n # If message not intended for this node, send closer to target\n else\n closest_node_ip = @rt.findCloserNode(received['node_id'], nil)\n if !closest_node_ip.nil?\n @socket.send @msg.ACK_INDEX(received['node_id'], received['keyword']), 0, '127.0.0.1', closest_node_ip\n end\n end\n\n end\n end",
"def dispatch(type, msg, bot)\n $log.debug \"Received a message of type #{type}\"\n\n type = type.to_s\n if(msg and msg.message =~ COMMAND_RX) then\n dispatch_command(msg, type, bot)\n else\n dispatch_hooks(msg, type, bot)\n end\n end",
"def dispatch!\n \n # negotiates initial configuration\n @meta = self.negotiate!\n \n # dispatches hash set to the server\n self.dispatch_hashing!\n self.dispatch_hashset!\n \n # dispatches orders\n self.dispatch_orders!\n \n # dispatches messages\n self.handle_messages!\n \n end",
"def handle\n RJR::Logger.info \"Dispatching '#{@method}' request with parameters (#{@method_args.join(',')}) on #{@rjr_node_type}-node(#{@rjr_node_id})\"\n retval = instance_exec(*@method_args, &@handler)\n RJR::Logger.info \"#{@method} request with parameters (#{@method_args.join(',')}) returning #{retval}\"\n return retval\n end",
"def handle(context)\n \n # Notify all connection listeners by calling their on_server_response method.\n super(context)\n \n # Notify all connection listeners by calling their on_private_message method.\n notify(context) do |connection_listener| \n connection_listener.on_private_message(context, IRC::Models::Channel.is_valid?(target) ? context.lookup_channel(target) : context.lookup_user(target), text)\n end\n\n end",
"def dispatch(msg)\n ActiveRecord::Base.establish_connection(Serv::Configuration::database_configuration)\n\n msg = JSON.parse(msg)\n \n controller = msg['controller']\n action = msg['action']\n params = msg['params']\n session_id = msg['session_id']\n \n log \"[REQUEST] - [controller: #{controller},\" + \" action: #{action}, \" + \" params: #{params}]\"\n \n if !params.nil?\n args = \"params\"\n else\n args = nil\n end\n \n # Metaprogramming code that will dyamically call the requested controller\n # and method\n result = nil\n eval %Q(\n session = get_session(session_id)\n \n if !session.nil?\n request = #{controller.camelize}Controller.new\n request.instance_variable_set(:@session, session)\n request.instance_variable_set(:@game_mq, @game_mq)\n request.extend(Broker::Commands)\n \n result = if args.nil?\n request.#{action}\n else\n request.#{action}(#{args})\n end\n else\n raise Interrupt\n end\n )\n respond_success(result)\n rescue ArgumentError\n respond_error(Errors::ERR_ARGUMENT_ERROR, $!)\n rescue Interrupt\n respond_error(Errors::ERR_INVALID_SESSION, $!)\n rescue\n respond_error(Errors::ERR_GENERIC, $!)\n ensure\n ActiveRecord::Base.connection.disconnect!\n #ActiveRecord::Base.verify_active_connections!\n end",
"def recv_msg()\n\n debug = 1\n\n begin\n\n Timeout::timeout(@timeout_val){\n\n length = 0\n id = 0\n data = @socket.recv(4)\n\n # make sure we actually got something\n if data == nil then return nil end\n\n # how many more bytes we are to recv\n length += data.each_byte.to_a[0] * (2 ** 24)\n length += data.each_byte.to_a[1] * (2 ** 16)\n length += data.each_byte.to_a[2] * (2 ** 8)\n length += data.each_byte.to_a[3]\n\n additional_data = @socket.recv(length)\n\n # if you are not sending as much data as you advertise, we drop you\n if(additional_data.each_byte.to_a.length != length) then Thread.terminate end\n\n if(debug) then\n puts \"length of data to be recvd : #{length}\"\n puts \"length of data recv'd : #{additional_data.each_byte.to_a.length}\"\n end\n\n if(length != 0) then\n message_id = additional_data.each_byte.to_a[0]\n else\n message_id = -1\n end\n\n puts \"message starts\"\n\n new_message = Message.new(message_id, length, additional_data[1...additional_data.length])\n\n puts \"message end\"\n\n case message_id\n when @keep_alive_id\n puts \"I got a keep_alive id\"\n when @choke_id\n puts \"I got choke id\"\n when @unchoke_id\n puts \"I got unchoke_id\"\n when @interested_id\n puts \"I got interested_id\"\n when @not_interested_id\n puts \"I got not_interested_id\"\n when @have_id\n puts \"I got have_id\"\n when @bitfield_id\n puts new_message.payload().each_byte.to_a.length\n @bitfield.set_bitfield_with_bitmap(new_message.payload())\n puts \"I got bitfield_id\"\n when @request_id\n puts \"I got request_id\"\n when @piece_id\n puts \"I got piece_id\"\n when @cancel_id\n puts \"I got cancel_id\"\n when @port_id\n puts \"I got port_id\"\n else\n puts \"You gave me #{message_id} -- I have no idea what to do with that.\"\n end\n\n $stdout.flush\n\n }\n\n rescue\n #puts $!, $@\n return\n end\n\n end",
"def handle(context)\n \n # Notify all connection listeners by calling their on_server_response method.\n super(context)\n \n # Notify all connection listeners by calling their on_ping method.\n notify(context) do |connection_listener| \n connection_listener.on_ping(context, servers)\n end\n\n end",
"def dispatch_http_response(res, options, &block)\n callback = options.fetch('callback', nil)\n (res.blank? && callback.present?) ? callback.call(res) : block.call(res)\nend",
"def handle_heartbeat(packet)\n end",
"def on_server_response(connection, message)\n \n if valid_response?(message)\n connection.remove_connection_listener(self)\n @response = message\n end\n \n end",
"def work(raw_post)\n puts \"Msg received: \" + raw_post\n ack! # we need to let queue know that message was received\n end",
"def handle(context)\n \n # Notify all connection listeners by calling their on_server_response method.\n super(context)\n \n # Notify all connection listeners by calling their on_notice method.\n notify(context) do |connection_listener| \n connection_listener.on_notice(context, context.lookup_user(nick), message)\n end\n\n end",
"def process_response\n case @msg.sip_method\n when :INVITE\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response(@msg)\n return\n end\n when :ACK\n when :CANCEL\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response_to_cancel(@msg)\n return\n end\n else\n if client_transaction = @msg.connection.class.non_invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response(@msg)\n return\n end\n end\n log_system_debug \"ignoring a response non matching a client transaction (#{@msg.sip_method} #{@msg.status_code})\" if $oversip_debug\n end",
"def handle_message(message_hash)\n socket_id = message_hash[\"socket_id\"]\n message = message_hash[\"message\"]\n type = message[\"type\"]\n\n post(send(type, message_hash))\n end",
"def after_response(status_hash, responder)\n end",
"def message_received(message)\n @message_handlers.each do |block|\n block.call(message)\n end\n end",
"def handle\n respond\n nil\n end",
"def dispatch_incoming_packets(raise_disconnect_errors: T.unsafe(nil)); end",
"def handle_request(socket, message)\n client_port, client_ip = Socket.unpack_sockaddr_in(socket.get_peername)\n msg = RequestMessage.new(:message => message, :headers => @message_headers)\n headers = @message_headers.merge(msg.headers)\n result = Dispatcher.dispatch_request(msg.jr_method,\n :method_args => msg.jr_args,\n :headers => headers,\n :client_ip => client_ip,\n :client_port => client_port,\n :rjr_node => self,\n :rjr_node_id => @node_id,\n :rjr_node_type => RJR_NODE_TYPE,\n :rjr_callback =>\n WSNodeCallback.new(:socket => socket,\n :headers => headers))\n response = ResponseMessage.new(:id => msg.msg_id, :result => result, :headers => headers)\n socket.send(response.to_s)\n end",
"def callback\n return response if called\n self.response = k.inject(\n env.merge(RESPONSE_BODY => body ,\n RESPONSE_STATUS => status,\n RESPONSE_HEADERS => headers,\n RESPONSE_SOCKET => socket,\n FAIL => ((env[FAIL]||[]) + [error]).compact,\n LOG => env[LOG] ||[])){ |r, i| i.call(r) }\n ensure\n self.called = true\n end",
"def handle(msg)\n msg_obj = Octo::Message::Message.new(msg)\n msg = msg_obj.to_h\n begin\n eventName = msg[:event_name]\n if (valid_events.include?eventName)\n call_hooks(eventName, msg)\n end\n rescue Exception => e \n puts e.message\n puts e.backtrace.inspect\n end\n end",
"def dispatch(message, client, &block)\n debug \"Dispatching #{message.inspect}\"\n\n if message['method'] == 'read'\n dispatch_read(message, client, &block)\n elsif message['method'] == 'create'\n dispatch_create(message, client, &block)\n end\n end",
"def perform\n @logger.info({context: :monitor, action: :perfomed})\n @client.psubscribe(\"#{service}:*\") do |callback|\n callback.psubscribe(self.on_subscribed)\n callback.pmessage(self.on_message)\n callback.punsubscribe(self.on_unsubscribed)\n end\n end",
"def msgHandler()\n\tSTDOUT.puts \"WRITING\"\n\tloop do\n\t\t$semaphore.synchronize {\n\t\t\t$socketBuf.each do |socket, str|\n\t\t\t\tstr = str.strip()\n\t\t\t\targs = str.split(\" \")\n\t\t\t\tcmd = args[0]\n\t\t\t\tdestNode = args[1]\n\t\t\t\tcase (cmd)\t\t\n\t\t\t\t#Acknowledgements\n\t\t\t\twhen \"APPLYEDGE\"; handleEntryAdd(socket,destNode)\n\t\t\t\telse STDOUT.puts \"ERROR: INVALID COMMAND \\\"#{cmd}\\\"\"\n\t\t\t\tend\n\t\t\tend\n\t\t}\n\tend\nend",
"def handle\n puts \"***************************\"\n puts \"HANDLING EVENT: #{@event.inspect}\"\n puts \"***************************\"\n\n # Pass event off to handlers based on event name/title\n if @event.title == \"Out of range\"\n DeviceOutOfRangeHandler.new(@event).handle\n elsif @event.title == \"In Range\"\n DeviceWithinRangeHandler.new(@event).handle\n end\n end",
"def handle_response(response); end",
"def handle_response(response); end",
"def dispatch(message_payload)\n debug_me{[ :message_payload ]}\n raise ::SmartMessage::Errors::NotImplemented\n end",
"def complete(message_id, receipt_handle)\n raise NotImplementedError\n end",
"def trigger_callbacks_for(msg)\n case msg.message_type\n\n # ----- server messages\n when RPL_WELCOME\n notify :registered_with_server\n when CMD_PING\n notify :server_ping, msg.params[0] # server wants the params back\n when CMD_ERROR\n notify :server_error\n\n # ----- nick-related -----\n when CMD_NICK\n @state[:nick] = msg.params[0] if msg.prefix[:nick] == @state[:nick]\n threaded_notify :nick_changed, msg.prefix[:nick], msg.params[0]\n when ERR_NICKNAMEINUSE\n # nickname errors are deterministic, that is, the client keeps track of the \n # state of attempted nick changes in @state, and the server responds to them\n # in order, so no additional info needs to be sent in the callback.\n # (this is tested)\n notify :nick_in_use\n when ERR_ERRONEUSNICKNAME\n notify :nick_invalid\n\n # ----- channel-related -----\n when CMD_JOIN\n threaded_notify :joined_channel, msg.user, msg.params[0]\n when CMD_PART\n threaded_notify :left_channel, msg.user, msg.params[0], msg.params[1]\n when CMD_QUIT\n threaded_notify :quit_server, msg.user, msg.params[0]\n when RPL_TOPIC # negative indices handle rfc and non-rfc commands\n threaded_notify :topic_changed, msg.params[-2], msg.params[-1], nil\n when CMD_TOPIC\n threaded_notify :topic_changed, msg.params[0], msg.params[1], msg.user\n when RPL_NAMREPLY\n @state[:scratch] ||= {}\n @state[:scratch][msg.params[-2]] ||= []\n # strip out leading mode characters: @, +, ~, etc.\n @state[:scratch][msg.params[-2]] += msg.params[-1].split.map { |name| name.gsub(/^[^a-zA-Z\\[\\]\\\\`_\\^{}\\|]/,'') }\n when RPL_ENDOFNAMES\n if @state[:scratch]\n threaded_notify :channel_name_list, msg.params[-2], ( @state[:scratch][msg.params[-2]] || [] )\n @state[:scratch].delete(msg.params[-2])\n else\n threaded_notify :channel_name_list, []\n end\n \n # ----- messaging -----\n when CMD_PRIVMSG\n if private?(msg)\n threaded_notify :private_message, msg.params[0], msg.params[1], msg.user\n else\n threaded_notify :channel_message, msg.params[0], msg.params[1], msg.user\n end\n when CMD_NOTICE\n if private?(msg)\n threaded_notify :private_notice, msg.params[0], msg.params[1], msg.user\n else\n threaded_notify :channel_notice, msg.params[0], msg.params[1], msg.user\n end\n\n end\n end",
"def listen\n amqp_listen do |msg|\n do_handle(msg)\n end\n end",
"def start\n super\n @snmptrap = SNMP::TrapListener.new(:Host => @host, :Port => @port) do |manager|\n manager.on_trap_default do |trap|\n trap_events = Hash.new\n tag = @tag\n timestamp = Engine.now\n raise(\"Unknown Trap Format\", trap) unless trap.kind_of?(SNMP::SNMPv1_Trap) or trap.kind_of?(SNMP::SNMPv2_Trap)\n trap.each_varbind do |vb|\n trap_events[vb.name.to_s] = vb.value.to_s\n end\n trap_events['host'] = trap.source_ip\n if @trap_format == 'tojson'\n require 'json'\n trap_events.to_json\n end\n router.emit(tag, timestamp, trap_events)\n end\n end\n end",
"def receive(data); end",
"def message_received(client, msg)\n content = JSON.parse msg.data\n\n kind = content['type'] || 'empty message'\n\n OutputLogger.logger.info \"Received a message of the #{kind} type.\"\n OutputLogger.logger.debug content\n\n method = \"on_#{content['type']}\"\n\n send(method, content, client) if respond_to?(method)\n end",
"def on_message(data)\n op, stat, value, *tags = data.split(' ')\n if stat && value && (op == 'count' || op == 'gauge' || op == 'timing')\n dogstatsd.public_send(op, stat, value.to_i, tags: tags)\n write '1'\n end\n rescue => e\n puts e.message\n end",
"def handlePDUReceived(pduPacket)\n\n Utils_visiona.verifyInput(CFDP::PDUPacket, pduPacket.class)\n writeLog(\"Received #{pduPacket.pduPayload.class}: #{pduPacket.pack.to_s}\")\n\n replyWithAck?(pduPacket)\n\n if @status.eql?(\"FINISHED\")\n\n CFDP::CFDP_Indication(\"Transaction #{@ID} already finished. Ignoring.\")\n return\n end\n\n if isclass2?\n\n # this is a class 2 active transaction, verify pdu class\n case pduPacket.pduPayload\n when CFDP::PDUEOF\n\n unless haspdueof?\n\n # downlink situation:\n if isdownlink?\n\n # Store EOF\n update(pduPacket)\n\n # downlink situation. (class 2 transaction active, received EOF. must check for condition codes\n # first, and take action based on them.\n case pduPacket.pduPayload.conditionCode\n when 0\n\n # no error condition, verify file completude\n nakPdu = verifyMissingPDU\n if nakPdu.nil?\n finish_downlink_transaction\n else\n CFDP::CFDPEngine.instance.insertIntoBuffer(nakPdu)\n CFDP::CFDP_Indication(\"File incomplete. Generated NAKPDU and waiting for response.\")\n writeLog(\"File incomplete. Generated NAKPDU #{nakPdu.pack.to_s}. Waiting for response.\")\n insertTimer(\"NAK\")\n end\n else\n # it's an error, cancel transaction and indicate the user\n CFDP::CFDP_Indication(\"Transaction #{@ID} cancelled due to <#{CFDP.conditionCodeToStr(pduPacket.pduPayload.conditionCode)}>.\")\n writeLog(\"Transaction #{@ID} cancelled due to <#{CFDP.conditionCodeToStr(pduPacket.pduPayload.conditionCode)}>.\")\n CFDP::HKPacket.instance.updateVar(pduPacket.pduPayload.conditionCode)\n finish(\"FAILED\")\n end\n end\n end\n when CFDP::PDUMetadata, CFDP::PDUFileData, CFDP::PDUNAK\n\n update(pduPacket)\n when CFDP::PDUFinished\n\n # uplink situation:\n if isuplink?\n\n # Clean buffer\n writeLog(\"Cleaning buffer from transaction #{@ID}\")\n CFDP::CFDPEngine.instance.clean_buffer(@ID)\n else\n # downlink situation (should not receive a FINISHED pdu, error event maybe?)\n CFDP::CFDPEngine.instance.writeLog(0, \"Received FINISHED PDU in downlink event.\")\n end\n when CFDP::PDUACK\n # check for directive code of PDUAck\n case pduPacket.pduPayload.directiveCode\n when 4\n # received an ACK EOF, so disable timer.\n disableTimer(\"EOF\")\n when 5\n # received an ACK FINISHED. Disable timers\n disableTimer(\"FINISHED\")\n finish(\"SUCCESS\")\n else\n CFDP::CFDPEngine.instance.writeLog(0, \"ACK's directive code #{pduPacket.pduPayload.directiveCode} error.\")\n end\n else\n\n CFDP::CFDPEngine.instance.writeLog(0, \"Class #{pduPacket.pduPayload.class} not implemented\")\n end\n elsif isclass1?\n\n # this is a class 1 transaction\n case pduPacket.pduPayload\n when CFDP::PDUEOF, CFDP::PDUFileData\n\n update(pduPacket)\n\n unless pduPacket.pduPayload.is_a?(CFDP::PDUFileData)\n\n # received a class 1 EOF downlink. Must check condition code\n # and finish transactions\n (conditionCode = create_file) if pduPacket.pduPayload.conditionCode == 0\n\n # remove transaction anyway because we received EOF class 1.\n CFDP::CFDP_Indication (\"Transaction #{@ID} finished with <#{CFDP.conditionCodeToStr(conditionCode)}> condition.\")\n writeLog(\"Transaction #{@ID} finished with <#{CFDP.conditionCodeToStr(conditionCode)}> condition.\")\n CFDP::HKPacket.instance.updateVar(conditionCode)\n finish(conditionCode==0 ? \"SUCCESS\" : \"FAILED\")\n end\n else\n\n CFDP::CFDPEngine.instance.writeLog(0, \"Received #{pduPacket.pduPayload.class} on a class 1 transaction. Don't know how to handle it.\")\n end\n end\n end",
"def notify(response)\n\t\tself.response = response\n\n\t\tif (self.completion_routine)\n\t\t\tself.completion_routine.call(response, self.completion_param)\n\t\telse\n\t\t\tself.done = true\n\t\tend\n\tend",
"def fetch(length)\n # This callback should be set just once, yielding with the parsed message\n @driver.on(:message) { |msg| yield(msg.data.pack('C*')) } if @driver.listeners(:message).length.zero?\n\n data = @sock.read_nonblock(length) # Read from the socket\n @driver.parse(data) # Parse the incoming data, run the callback from above\n end",
"def handle_heartbeat(_payload)\n send_packet(OPCODES[:HEARTBEAT], @session.seq)\n end",
"def on_trap &block\n @socket.callbacks << block\n end",
"def handler\r\n\t loop do \r\n\t socket = @rqueue.pop\r\n\t req = Request.new socket \r\n\t if req.broadcast == true\r\n\t handle_broadcast req \r\n\t else\r\n\t handle_listen req\r\n\t end\r\n\t \r\n\t end\r\n \tend",
"def recv_callback\n @recv_callback ||= Proc.new {|message|}\n end",
"def query_snmp(opts=nil)\n self.options = opts unless opts.nil?\n\n exit_code = nil\n exit_message = []\n index = 0\n has_rollup = false\n\n if results_cache.empty?\n debug(\"No results\\n\")\n exit_code = Nagios::UNKNOWN\n exit_message = [\"Invalid SNMP community string specified or snmp is disabled\"]\n else\n\n # concrete subclasses implement checks method\n checks.each do |check|\n unless results = results_cache[check[:name]]\n debug(\"No results for check %s\\n\" % check[:name])\n next\n end\n\n # Loop on possibly multiple lines of output\n results.each_line do |line|\n next unless line =~ check[:response]\n status = $1\n\n # Iterate over the expected return codes from a check.\n # line_exit_code,line_message = check[:codes][status]\n check[:codes].keys.each do |code|\n # Might want to support regex codes.\n # For now add support for 'any' value.\n next unless status == code || code == :any\n\n # Map to a nagios code\n # check[:codes][code] maps to a pair of ( nagios_code, message )\n line_exit_code = check[:codes][code][0]\n\n # Does it matter that index = 0?\n # Yes, currently rollup check must be first\n if index == 0 && check[:rollup]\n # Base the overall exit code only on the first check if it is marked as rollup.\n exit_code = line_exit_code\n exit_message = [\"OK\"] if exit_code == Nagios::OK\n has_rollup = true\n else\n\n # Sub checks only affect the message but not the exit code for rollups\n unless has_rollup\n exit_code = Status.worst_case(line_exit_code, exit_code)\n end\n\n # Only affect the message if not OK\n if exit_code != Nagios::OK && line_exit_code != Nagios::OK\n\n # Here, instead of the message being static, we generalized this\n # to call a custom function by symbol name, sending it the check value.\n # Main application thus far is to blow up a bit string.\n line_exit_message = build_message(check[:codes][code][1], status)\n prefix = \"\"\n\n unless check[:display].nil? || check[:display].empty?\n prefix = \"%s:\" % check[:display]\n end\n unless line_exit_message.empty?\n exit_message << \"%s%s\" % [prefix, line_exit_message]\n end\n end\n\n end\n end\n end\n index += 1\n end\n end\n # In case no checks ran or other pathological\n # cases lead to no assignments\n exit_code ||= Nagios::UNKNOWN\n if exit_message.empty?\n if exit_code == Nagios::OK\n exit_message = \"OK\"\n else\n exit_message = \"Unknown\"\n end\n else\n exit_message = exit_message.uniq.join(\",\")\n end\n\n Status.new(exit_code, exit_message)\n end",
"def handle(msg)\n to = msg['to']\n intent = msg['intent']\n if to && intent\n begin\n # !Note that the access isn't flexible as in py and js where dotpath can be use\n reply = Module.const_get(to).method(intent).call(msg)\n if reply['to']\n $client.emit(:pass, reply)\n end\n rescue\n puts 'rb handle fails'\n end\n end\nend",
"def process_msgs\n end"
] |
[
"0.6299982",
"0.58289695",
"0.5644207",
"0.54480875",
"0.5435592",
"0.5406784",
"0.5394403",
"0.53837657",
"0.53768104",
"0.5364736",
"0.5364482",
"0.53307945",
"0.5315853",
"0.5312624",
"0.5271819",
"0.52700657",
"0.5269009",
"0.5252842",
"0.5228024",
"0.52118975",
"0.5166789",
"0.51589024",
"0.5132029",
"0.5124902",
"0.5109819",
"0.51040405",
"0.5052024",
"0.5048956",
"0.5023596",
"0.50178325",
"0.49975744",
"0.49933758",
"0.49857152",
"0.49804944",
"0.4976081",
"0.49731785",
"0.49684602",
"0.4962196",
"0.49590543",
"0.49474174",
"0.49371827",
"0.49337614",
"0.49199185",
"0.49141908",
"0.49111968",
"0.49026677",
"0.48928878",
"0.48623386",
"0.48570698",
"0.4845703",
"0.4840697",
"0.4840221",
"0.48280275",
"0.48171896",
"0.48111138",
"0.48098263",
"0.48047096",
"0.47859406",
"0.4776604",
"0.47638652",
"0.47611964",
"0.4749475",
"0.47439557",
"0.4741071",
"0.47205284",
"0.47195894",
"0.4717905",
"0.47127697",
"0.4711115",
"0.47053096",
"0.47031572",
"0.4700836",
"0.46990433",
"0.4696972",
"0.46913326",
"0.4688574",
"0.46867633",
"0.4684753",
"0.4682904",
"0.4673851",
"0.46702707",
"0.46702707",
"0.46688437",
"0.46651715",
"0.46607137",
"0.4657443",
"0.46550816",
"0.46507013",
"0.4645715",
"0.4638894",
"0.46300045",
"0.4622707",
"0.46213645",
"0.46212605",
"0.46205908",
"0.46201175",
"0.46186507",
"0.4617201",
"0.46115893",
"0.46110144"
] |
0.4733713
|
64
|
Collects responses for the given message from the available providers
|
def dispatch(message)
response_pdu = message.make_response_pdu
context = ProviderDsl.new
context.message = message
context.response_pdu = response_pdu
message.pdu.varbinds.each_with_index do |vb, index|
context.varbind = vb
provider = providers.find { |p| p.provides?(vb.oid) }
if provider
if message.pdu.command == Constants::SNMP_MSG_GETBULK && index < message.pdu.non_repeaters
handler = provider.handler_for(Constants::SNMP_MSG_GETNEXT)
else
handler = provider.handler_for(message)
end
if handler
context.instance_exec(&handler)
else
warn "No handler for command: #{message.pdu.command} @ #{vb.oid}"
context.no_such_object
end
else
warn "No provider for oid: #{vb.oid}"
context.no_such_object
end
end
response_pdu
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def respond(message)\n RESPONSES.sample\n end",
"def collect_untagged_responses(name, *command)\n untagged_responses = []\n\n send_command(*command).listen do |response|\n if response.is_a?(Net::IMAP::UntaggedResponse) && response.name == name\n untagged_responses << response\n\n # If we observe another tagged response completeing, then we can be\n # sure that the previous untagged responses were not relevant to this command.\n elsif response.is_a?(Net::IMAP::TaggedResponse)\n untagged_responses = []\n\n end\n end.transform do |tagged_response|\n untagged_responses\n end\n end",
"def collect_responses\n return to_enum(:collect_responses) unless block_given?\n\n loop do\n raise Error, 'EOF' if @parser.eos?\n\n response = @parser.parse!\n logger.debug(self.class) { \"Response #{response.inspect}\" }\n yield response\n break if end_of_responses?(response)\n end\n rescue Errno::EPIPE => ex\n logger.warn(self.class) { ex.inspect }\n nil\n end",
"def collect! &block\n collect(&block)\n ok!\n @messages\n end",
"def messages\n responses.map(&:messages).flatten\n end",
"def populate_providers_hash\n # GET A LIST OF ALL PROVIDERS\n Rails.logger.info(\"Retrieving providers list from #{@ingest_providers_list_endpoint}\")\n response = RestClient::Request.execute :method => :get, :url => \"#{@ingest_providers_list_endpoint}\", :verify_ssl => OpenSSL::SSL::VERIFY_NONE\n if (response.code != 200)\n Rails.logger.info(\"ERROR #{response.code} retrieving providers list\")\n # terminate task if we cannot validate the providers names\n exit(status=256)\n else\n list_of_providers_hashes = JSON.parse!(response.body)\n list_of_providers_hashes.each do |hash|\n provider_id = hash['provider-id']\n @all_providers[provider_id] = 'Y'\n end\n Rails.logger.info(\"RETRIEVED A LIST OF ALL PROVIDERS, SIZE: #{list_of_providers_hashes.size}, LOOKUP SIZE: #{@all_providers.size}\")\n end\n end",
"def handle_item(msg)\n return nil unless @options['outgoing_token'].include? msg[:token] # ensure messages are for us from slack\n return nil if msg[:user_name] == 'slackbot' # do not reply to self\n return nil unless msg[:text].is_a?(String) # skip empty messages\n\n ## loop things to look for and collect immediate responses\n ## rescue everything here so the bot keeps running even with a broken script\n responses = @regexes.map do |regex, proc|\n if mdata = msg[:text].strip.match(regex)\n begin\n Slackbotsy::Message.new(self, msg).instance_exec(mdata, &proc)\n rescue => err\n err\n end\n end\n end\n\n ## format any replies for http response\n if responses\n { text: responses.compact.join(\"\\n\") }.to_json\n end\n end",
"def dispatch\n queue << nil\n while message = queue.shift\n consumers.each do |consumer|\n if response = consumer.on_message(message)\n @queue += Array(response)\n end\n end\n end\n end",
"def process_message(message)\n # TODO: May want to ignore some messages (say, if the community string is wrong)\n message.respond(dispatch(message))\n end",
"def handle_message(message)\n if @response_wait_list.waiting_for?(message)\n @response_wait_list.received(message)\n else\n @listener.receive_message(message)\n end\n end",
"def responses\n participants.flat_map(&:responses)\n end",
"def process_response(entry)\n entry.messagings.each do |messaging|\n # Set global variable Messenger Sender\n set_sender(messaging.sender_id)\n # Check if user is available to talk with bot or human.\n if bot_service_active?\n if messaging.callback.message?\n receive_message(messaging.callback)\n elsif messaging.callback.delivery?\n puts messaging.callback\n elsif messaging.callback.postback?\n receive_postback(messaging.callback)\n elsif messaging.callback.optin?\n puts messaging.callback\n elsif messaging.callback.account_linking?\n login_or_log_out(messaging.callback)\n end\n # puts Messenger::Client.get_user_profile(messaging.sender_id)\n else\n send_directly_message_without_boot(messaging)\n end\n end\n end",
"def collect_responses_and_parts_order(headers) #:nodoc:\n responses, parts_order = [], nil\n\n if block_given?\n collector = ActionMailer::Collector.new(lookup_context) { render(action_name) }\n yield(collector)\n parts_order = collector.responses.map { |r| r[:content_type] }\n responses = collector.responses\n elsif headers[:body]\n responses << {\n :body => headers.delete(:body),\n :content_type => self.class.default[:content_type] || \"text/plain\"\n }\n else\n templates_path = headers.delete(:template_path) || self.class.mailer_name\n templates_name = headers.delete(:template_name) || action_name\n each_template(templates_path, templates_name) do |template|\n self.formats = template.formats\n responses << if lookup_context.view_paths.detect {|resolver| resolver.class.to_s == \"MailEngine::MailTemplateResolver\" }\n {\n :body => render_with_layout_and_partials(template.mime_type.to_sym.to_s),\n :content_type => template.mime_type.to_s\n }\n else\n {\n :body => render(:template => template),\n :content_type => template.mime_type.to_s\n }\n end\n end\n end\n\n [responses, parts_order]\n end",
"def process_msgs\n end",
"def message_responses(text_id)\n command = Command.new('GetSMSResponse', license_key)\n responses = Response.parse( \n command.execute({:TextID => text_id}) \n )[\"ArrayOfSmsResponse\"][\"SmsResponse\"] || []\n\n\t\t\tresponses.is_a?(Array) ? responses.collect { |r| MessageResponse.new(r) } : MessageResponse.new(responses)\n end",
"def get_responses(entries)\n responses = entries.map do |entry|\n entry.responses\n end\n responses.flatten.compact\n end",
"def on_consumers_responders_respond_with(event)\n calling = event[:caller]\n responder = calling.topic.responder\n data = event[:data]\n info \"Responded from #{calling.class} using #{responder} with following data #{data}\"\n end",
"def process\n caption = response_text\n channel = channel_by_keyword\n channel_group = channel_group_by_keyword\n\n if channel || channel_group\n tmp = response_text.split\n tmp.shift\n caption = tmp.join(\" \")\n end\n\n delivery_notice = nil\n dn_responding_message_unconfigured = nil\n responding_messages_delivery = responding_messages_delivery_with_no_responses(channel, channel_group)\n\n responding_messages_delivery.each do |dn|\n unless dn.message.check_subscriber_response(response_text)\n dn_responding_message_unconfigured = dn\n next\n end\n delivery_notice = dn\n break\n end\n\n delivery_notice ||= dn_responding_message_unconfigured\n delivery_notice ||= last_sent_relevant_delivery(channel, channel_group)\n\n process_delivery_notice(\n delivery_notice,\n caption: caption,\n channel: channel,\n channel_group: channel_group,\n )\n end",
"def receive(message)\n feeds = @feeds.map do |feed|\n feed.deliver(message) if feed.accept?(message)\n end\n\n feeds.flatten!\n feeds.compact!\n feeds\n end",
"def scan_message(message)\n out = []\n out << 'recall_hold' if message =~ /Recall/i\n out << 'recall_hold' if message =~ /hold /\n out << 'borrow_direct' if message =~ /Borrow/\n out << 'ill' if message =~ /ILL/\n out << 'in_process' if message =~ /In Process/\n # ReCAP Partners\n out << 'offsite_valet' if message =~ /scsb/\n out\n end",
"def poll!\n find_and_process_next_available(messages)\n end",
"def process(msg)\n headers = msg[\"headers\"]\n federation = headers[\"federation\"]\n\n Log.info(\"Federation received %s from %s\" % [federation[\"req\"], headers[\"mc_sender\"]])\n\n federation[\"reply-to\"] = headers.delete(\"reply-to\")\n headers[\"reply-to\"] = collective_source_name\n\n record_seen(headers)\n\n Log.debug(\"federation => collective: %s\" % [headers])\n\n @outbox << {\n :targets => federation.delete(\"target\"),\n :req => federation[\"req\"],\n :data => JSON.dump(msg)\n }\n end",
"def on_channel_pipelines_response(payload)\n return unless handle_response? payload\n id, req, responses, event, nodes = self.extract(payload)\n event.pipelines.each {|pipe|\n responses[pipe.nodeUrn] = [] if responses[pipe.nodeUrn].nil?\n pipe.handlerConfigurations.each{|config|\n responses[pipe.nodeUrn] << config.to_hash\n }\n }\n if self.collection_complete?(id)\n info \"Request #{id} is completed. Informing EC.\"\n self.inform_status(self.build_inform(id, responses, :channel_pipelines_response))\n end\n end",
"def parse_response(responses)\n @success = responses.count { |response| response[:code] == 200 }\n @failed = responses.count { |response| response[:code] != 200 }\n @results = responses.map do |response|\n mpns_result_for response[:code],\n response[:device_url],\n response[:headers]\n end\n end",
"def fetch_messages(opts = {}, &block)\n tweets = if opts[:search]\n @client.search(\"#{opts[:search]} -rt\")\n else\n @client.mentions_timeline\n end\n\n tweets.each do |tweet|\n message_data = {\n :id => tweet[:id],\n :source => 'twitter',\n :title => tweet[:text],\n :body => tweet[:text],\n :sender_name => tweet[:user][:name],\n :sender => tweet[:user][:screen_name]\n }\n\n block.call Message.build(message_data)\n end\n end",
"def receive(message)\n self.class.listeners.map do |matcher, block|\n match = matcher.match(message)\n block.call(match) if match\n end.compact\n end",
"def retrieve\n messages = @redd.my_messages('moderator', false, limit: RETRIEVAL_COUNT)\n messages = expand(messages)\n messages.map do |m|\n TaggedData.new(m.name, m)\n end\n end",
"def process_message(channel, message)\n subscribers[channel] << Packets.for(channel.split(\".\")[1]).new(message) if subscribers[channel]\n rescue StandardError => e\n config.handle_error(e)\n end",
"def smb_enumprintproviders\n\t\tresp = smb_enumprinters(8, nil, 1, 0)\n\t\treturn nil if not resp\n\t\trptr, tmp, blen = resp.unpack(\"V*\")\n\n\t\tresp = smb_enumprinters(8, nil, 1, blen)\n\t\treturn nil if not resp\n\n\t\tbcnt,pcnt,stat = resp[-12, 12].unpack(\"VVV\")\n\t\treturn nil if stat != 0\n\t\treturn nil if pcnt == 0\n\t\treturn nil if bcnt > blen\n\t\treturn nil if pcnt < 3\n\n\t\t#\n\t\t# The correct way, which leads to invalid offsets :-(\n\t\t#\n\t\t#providers = []\n\t\t#\n\t\t#0.upto(pcnt-1) do |i|\n\t\t#\tflags,desc_o,name_o,comm_o = resp[8 + (i*16), 16].unpack(\"VVVV\")\n\t\t#\n\t\t#\t#desc = read_unicode(resp,8+desc_o).gsub(\"\\x00\", '')\n\t\t#\t#name = read_unicode(resp,8+name_o).gsub(\"\\x00\", '')\n\t\t#\t#comm = read_unicode(resp,8+comm_o).gsub(\"\\x00\", '')\n\t\t#\t#providers << [flags,desc,name,comm]\n\t\t#end\n\t\t#\n\t\t#providers\n\n\t\treturn resp\n\n\tend",
"def handle_messages\n messages = *disque.fetch(from: queue_name,timeout: 100,count: batch_size)\n messages.each do |queue,id,data|\n Chore.logger.debug \"Received #{id.inspect} from #{queue.inspect} with #{data.inspect}\"\n yield(id, queue, nil, data, 0)\n Chore.run_hooks_for(:on_fetch, id, data)\n end\n messages\n end",
"def possible_responses(sentence)\n responses = []\n\n # Find all patterns to try to match against\n @data[:responses].keys.each do |pattern|\n next unless pattern.is_a?(String)\n\n # For each pattern, see if the supplied sentence contains\n # a match. Remove substitution symbols (*) before checking.\n # Push all responses to the responses array.\n if sentence.match('\\b' + pattern.gsub(/\\*/, '') + '\\b')\n # If the pattern contains substitution placeholders,\n # perform the substitutions\n if pattern.include?('*')\n responses << @data[:responses][pattern].collect do |phrase|\n # First, erase everything before the placeholder\n # leaving everything after it\n matching_section = sentence.sub(/^.*#{pattern}\\s+/, '')\n\n # Then substitute the text after the placeholder, with\n # the pronouns switched\n phrase.sub('*', WordPlay.switch_pronouns(matching_section))\n end\n else\n # No placeholders? Just add the phrases to the array\n responses << @data[:responses][pattern]\n end\n end\n end\n\n # If there were no matches, add the default ones\n responses << @data[:responses][:default] if responses.empty?\n\n # Flatten the blocks of responses to a flat array\n responses.flatten\n end",
"def dispatch_responders\n self.full_response, self.responder_ids = try_responding_in_full\n end",
"def multi_data_response(cmd, *args)\n collect_untagged_responses(cmd, cmd, *args)\n end",
"def control\n @responses = build_params.map { |request_params| lookup(request_params) }\n end",
"def bixsby_say_to_all(message)\n @connections[:clients].each do |client_session, client|\n p client\n formatted_response = package_response(client_session, message)\n client.puts(formatted_response)\n end\n end",
"def distribute_results!\n response = JSON.parse(@socket.readline)\n\n if response[\"event\"]\n @event_queue << response\n else\n @result_queue << response\n end\n rescue StandardError\n @alive = false\n Thread.exit\n end",
"def message(msg_class, msg_type, subject, msg, opts={})\n success = clients.inject([]) do |result, client|\n resp = false\n resp = client.message(msg_class, msg_type, subject, msg, opts) if(client.handle_message?(msg_class, msg_type))\n resp ? result << resp : result\n end\n success.size\n end",
"def consume_each_message\n kafka_consumer.each_message(\n ConfigAdapter.consuming(consumer_group)\n ) do |message|\n # always yield an array of messages, so we have consistent API (always a batch)\n yield([message])\n end\n end",
"def process_response(new_response)\n responses.push(new_response)\n responses.shift if responses.size > 5\n responses\n end",
"def message_received(message)\n @message_handlers.each do |block|\n block.call(message)\n end\n end",
"def message_results=(value)\n @message_results = Array.new\n\n unless value.nil? || value.empty?\n value.each do |v1|\n if v1.instance_of? MessageResultDto\n @message_results.push(v1)\n end\n end\n\n end\n end",
"def process message\n op = message[\"opcode\"]\n data = message[\"data\"]\n\n case op\n when PUBLISH\n emit(\"message\", data)\n when SUBSCRIBE_GRANTED\n emit(\"subscribe\")\n when SUBSCRIBE_DENIED\n emit(\"subscribe_denied\")\n when PUBLISH_DENIED\n emit(\"publish_denied\")\n when PUBLISH_GRANTED\n emit(\"publish_granted\")\n when UNSUBSCRIBE_COMPLETE\n emit(\"unsubscribe\")\n @callbacks.clear\n when AUTHORIZE_DENIED\n emit(\"authorize_denied\")\n when AUTHORIZE_COMPLETE\n emit(\"authorize_complete\")\n end\n\n end",
"def receive_messages\n begin\n resp = @sqs.receive_message(\n message_attribute_names: PIPE_ARR,\n queue_url: @settings[:consuming_sqs_queue_url],\n wait_time_seconds: @settings[:wait_time_seconds],\n max_number_of_messages: @settings[:max_number_of_messages],\n )\n resp.messages.select do |msg|\n # switching whether to transform the message based on the existance of message_attributes\n # if this is a raw SNS message, it exists in the root of the message and no conversion is needed\n # if it doesn't, it is an encapsulated messsage (meaning the SNS message is a stringified JSON in the body of the SQS message)\n begin\n if !msg.key? 'message_attributes'\n # extracting original SNS message\n tmp_body = JSON.parse msg.body\n # if there is no Message, this isn't a SNS message and something has gone terribly wrong\n next if tmp_body.key? 'Message'\n # replacing the body with the SNS message (as it would be in a raw delivered SNS-SQS message)\n msg.body = tmp_body['Message']\n msg.message_attributes = {}\n # discarding messages without attributes, since this would lead to an exception in subscribe\n next if tmp_body.key? 'MessageAttributes'\n # parsing the message_attributes\n tmp_body['MessageAttributes'].each do |name, value|\n msg.message_attributes[name] = Aws::SQS::Types::MessageAttributeValue.new\n msg.message_attributes[name].string_value = value['Value']\n msg.message_attributes[name].data_type = 'String'\n end\n end\n msg\n rescue JSON::JSONError => e\n self.logger.info(e)\n end\n end\n rescue Aws::SQS::Errors::ServiceError => e\n self.logger.info(e)\n end\n end",
"def get_messages\r\n init_message_handler\r\n begin\r\n while (line = @s.gets(\"\\n\"))\r\n next if line.nil?\r\n line = line.chomp.gsub /\\n|\\r/, ''\r\n next if line == ''\r\n msg_map = JSON.parse(line)\r\n @message_handler_service.process msg_map\r\n end\r\n rescue Exception => e\r\n puts 'get_messages raise exception:'\r\n puts e.backtrace.inspect\r\n end\r\n end",
"def smb_enumprintproviders\n resp = smb_enumprinters(8, nil, 1, 0)\n return nil if not resp\n rptr, tmp, blen = resp.unpack(\"V*\")\n\n resp = smb_enumprinters(8, nil, 1, blen)\n return nil if not resp\n\n bcnt,pcnt,stat = resp[-12, 12].unpack(\"VVV\")\n return nil if stat != 0\n return nil if pcnt == 0\n return nil if bcnt > blen\n return nil if pcnt < 3\n\n #\n # The correct way, which leads to invalid offsets :-(\n #\n #providers = []\n #\n #0.upto(pcnt-1) do |i|\n # flags,desc_o,name_o,comm_o = resp[8 + (i*16), 16].unpack(\"VVVV\")\n #\n # #desc = read_unicode(resp,8+desc_o).gsub(\"\\x00\", '')\n # #name = read_unicode(resp,8+name_o).gsub(\"\\x00\", '')\n # #comm = read_unicode(resp,8+comm_o).gsub(\"\\x00\", '')\n # #providers << [flags,desc,name,comm]\n #end\n #\n #providers\n\n return resp\n\n end",
"def register_message_decoders(&block)\n\n # Create the message decoder context and register all the message decoders to the environment context message handler.\n ctx = MessageDecoderContext.new $ctx.message_handler \n block.call ctx \nend",
"def process_response(command, text)\n message_id = command[1..99]\n message = Message.find_by_id(message_id)\n#puts \"**** command=#{command}, text=#{text}, @sender.id=#{@sender.id}, message=#{message.id}\"\n if message\n @possible_senders.each do |a_member|\n message.process_response(:member => a_member, :response => text, :mode => 'SMS')\n end\n return I18n.t(\"sms.thanks_for_response\") \n else\n return I18n.t(\"sms.thanks_but_not_found\", :id => message_id) \n end\n return ''\n end",
"def process_broker(broker, requests)\n if broker\n # Send the requests to the broker\n responses = broker.send(api_name, requests, @options).responses\n else\n # Create responses based on the lack of a broker\n responses = requests.map do |request|\n api::Response.new(\n topic_name: request.topic_name,\n partition_id: request.partition_id,\n error_code: ErrorCode[:leader_not_available]\n )\n end\n end\n\n # Record responses\n requests.each do |request|\n response = responses.detect {|response| response.topic_name == request.topic_name && response.partition_id == request.partition_id}\n record_response(request, response)\n end\n\n # Run callbacks\n requests.each {|request| run_callbacks(request)}\n\n responses\n end",
"def implementations_of(message)\n raise CapabilitiesExceeded\n end",
"def _expect_pubsub(command)\n @expectations ||= []\n\n parts = command.split(' ')\n if parts.length == 2\n @expectations << { command: command, response: parts }\n else\n channels = parts[1..-1]\n @expectations << {\n command: command,\n multi_response: channels.map { |channel| [parts[0], channel] }\n }\n end\n end",
"def match_message(message)\n @routes\n .reduce(Set.new) do |memo, (matcher, handlers)|\n memo = memo.merge(handlers) if matcher.matches_message?(message)\n memo\n end\n end",
"def senders_of(message)\n raise CapabilitiesExceeded\n end",
"def send_challenges(event, page: nil)\n if event.channel.type != 1 && event.channel.id != CHANNEL_SECRETS\n mention = mention_channel(id: CHANNEL_SECRETS)\n raise OutteError.new \"No asking for challenges outside of #{mention} or DMs!\"\n end\n\n # Parse message parameters\n initial = page.nil?\n msg = fetch_message(event, initial)\n lvl = parse_highscoreable(msg, partial: true)\n\n # Multiple matches, send match list\n if lvl.is_a?(Array)\n format_level_matches(event, msg, page, initial, lvl, 'search')\n return\n end\n\n # Single match, send challenge list if it's a non-secret level\n raise OutteError.new \"#{lvl.class.to_s.pluralize.capitalize} don't have challenges!\" if lvl.class != Level\n raise OutteError.new \"#{lvl.tab.to_s} levels don't have challenges!\" if [\"SI\", \"SL\"].include?(lvl.tab.to_s)\n event << \"Challenges for #{lvl.longname} (#{lvl.name}):\\n#{format_block(lvl.format_challenges)}\"\nrescue => e\n lex(e, \"Error getting challenges.\", event: event)\nend",
"def receive_data(response)\n ip, port = peer_info\n log \"Response from #{ip}:#{port}:\\n#{response}\\n\"\n parsed_response = parse(response)\n\n return if parsed_response.has_key? :nts\n return if parsed_response[:man] && parsed_response[:man] =~ /ssdp:discover/\n\n @discovery_responses << parsed_response\n end",
"def receive_data(response)\n ip, port = peer_info\n logger.info \"<#{self.class}> Response from #{ip}:#{port}:\\n#{response}\\n\"\n parsed_response = parse(response)\n @discovery_responses << parsed_response\n end",
"def dispatch_message(bot, pns)\n message = bot.paginate_response(pns, takeoff=16)\n\n @config[:channel_for_announce].each do |channel|\n channels = bot.find_channel(channel)\n puts \"CHANNELS: #{channels}\"\n\n channels.each do |channel|\n if config[:announce_tags].length > 0\n channel.send_message config[:announce_tags].join(\" \")\n end\n\n message.map { |m| channel.send_message \"```Markdown\\n#{m}```\" }\n end\n end\n end",
"def on_message_complete\n @currently_reading.finish_reading! if @currently_reading.is_a?(Request)\n\n if @currently_responding\n @pending_responses << @currently_reading\n else\n @currently_responding = @currently_reading\n end\n\n @currently_reading = @pending_reads.shift\n end",
"def process_response(response)\n if response and response.is_a? Array\n response.map do |entry|\n\n begin\n user = entry.user || Twitter.user(entry.from_user)\n rescue Twitter::Error::ServiceUnavailable => exc\n # when twitter returns service unavailable while calling for the user, TRY AGAIN\n @notifier_engine.log \"method: #{exc.message}\"\n sleep 2\n retry\n end\n\n {\n id: entry.id,\n title: \"Twitter: @#{user.screen_name}\",\n body: \"#{entry.text}\\n#{entry.created_at}\",\n icon_path: user.get_image(icon_dir),\n object: entry\n }\n\n end\n elsif response and response.is_a? Exception\n response\n else\n []\n end\n end",
"def parse_response(event)\r\n iter = event.messageIterator()\r\n result = Hash.new\r\n \r\n while iter.hasNext()\r\n \r\n message = iter.next()\r\n raise Bberg::BbergException.new(\"Got a response with incorrect correlation id!\") if message.correlationID != @req_id\r\n msg_type = message.messageType().toString()\r\n raise Bberg::BbergException.new(\"Expected message of type ReferenceDataResponse but got #{msg_type}\") if msg_type != \"ReferenceDataResponse\"\r\n \r\n security_data_array = message.getElement(\"securityData\")\r\n (0..(security_data_array.numValues - 1)).each do |sec_num|\r\n security_data = security_data_array.getValueAsElement(sec_num)\r\n security_name = security_data.getElementAsString(\"security\")\r\n field_data = security_data.getElement(\"fieldData\")\r\n\r\n result[security_name] ||= Hash.new\r\n \r\n (0..(field_data.numElements - 1)).each do |field_num|\r\n field_element = field_data.getElement(field_num)\r\n values = if field_element.isArray\r\n process_array_type(field_element)\r\n else\r\n get_element_values(field_data, field_num)\r\n end\r\n result[security_name][field_element.name.toString] = values\r\n end\r\n end\r\n end\r\n result\r\n end",
"def process_complaint_messages\n @messages.map! do |message|\n m = message['Message']\n details = {\n :complaint_detail => {\n :complaint_type => m['complaint'].fetch('complaintFeedbackType', 'N/A'),\n :complaint_date => m['complaint'].fetch('arrivalDate', 'N/A')\n }\n }\n Message.new(message['MessageId'], account_id, m['mail']['timestamp'], m['mail']['destination'][0], 'complaint', details)\n end\n end",
"def process_response(provider_response)\n nil\n end",
"def process_response(provider_response)\n nil\n end",
"def process_messages\n @messages.pop do |channel, message|\n Fiber.new do\n on_message(channel, message)\n process_messages\n end.resume\n end\n end",
"def convert_responses(responses)\n responses.map do |res|\n matches = res[\"matches\"] || []\n matches.map do |match|\n match[\"ip\"]\n end\n end.flatten.compact.uniq\n end",
"def collect_plugins_in(provides_map, collected)\n provides_map.each_key do |plugin|\n if plugin.eql?(\"_plugins\")\n collected.concat(provides_map[plugin])\n else\n collect_plugins_in(provides_map[plugin], collected)\n end\n end\n collected\n end",
"def process_response\n case @msg.sip_method\n when :INVITE\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response(@msg)\n return\n end\n when :ACK\n when :CANCEL\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response_to_cancel(@msg)\n return\n end\n else\n if client_transaction = @msg.connection.class.non_invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response(@msg)\n return\n end\n end\n log_system_debug \"ignoring a response non matching a client transaction (#{@msg.sip_method} #{@msg.status_code})\" if $oversip_debug\n end",
"def send_bulk_message(message)\n\n resp = validate_message(message)\n if resp.result != SendResult.enum[\"Success\"]\n resp\n end\n\n req_factory = InjectionRequestFactory.new(@server_id, @api_key)\n request = req_factory.generate_request(message)\n\n # debug\n request_hash = request.to_hash\n debug_json = request_hash.to_json\n @request_json = debug_json\n\n http_request = HttpRequest.new(http_method, { :http_endpoint => @endpoint, :proxy => @proxy })\n response = http_request.send_request(request)\n @response_json = response.to_json\n\n end",
"def collect_plugins_in(provides_map, collected)\n provides_map.keys.each do |plugin|\n if plugin.eql?(\"_plugins\")\n collected.concat(provides_map[plugin])\n else\n collect_plugins_in(provides_map[plugin], collected)\n end\n end\n collected\n end",
"def read\n while msg = consumer.pop\n begin\n data = JSON.parse msg.body\n yield data[0], data[1]\n rescue => error\n Lux::Error.split_backtrace error\n end\n\n msg.finish\n end\n end",
"def postprocess(msgs, _results)\n groups = {}\n msgs.each do |m|\n os = m.metadata[:originserver]\n\n next if os.nil? || os[:address].nil?\n\n address = IPAddr.new os[:address]\n range = address.ipv4? ? 16..32 : 48..128\n range.each do |mask|\n groups[address.mask(mask)] ||= []\n groups[address.mask(mask)] << m.digest_as_hex\n end\n end\n\n { address_ranges: groups }\n end",
"def message_results\n @message_results\n end",
"def subscribe &handler\n input = \"\"\n response = 0\n #wait for message from pull socket\n while true\n response = @pull.recv_string(input)\n if !error?(response)\n input.chomp!\n\n #Message received\n yield input if block_given?\n Communicator::get_logger.info \"Message received: #{input}\"\n end\n end\n end",
"def invoke(message)\n\n # Get the arguments\n registration_id = message.registered_registration\n request_id = message.request\n args = message.call_arguments || []\n kwargs = message.call_argumentskw || {}\n\n # If we have a registration, execute it\n registration = self.objects[registration_id]\n if registration\n\n # Create the details\n details = message.details || {}\n details[:request] = request_id\n details[:procedure] = registration.procedure\n details[:session] = self\n\n handler = registration.handler\n if handler\n # Use the invoke wrapper to process the result\n value = Response.invoke_handler do\n handler.call(args, kwargs, details)\n end\n\n # If a defer was returned, handle accordingly\n if value.is_a? Response::CallDefer\n value.request = request_id\n value.registration = registration_id\n\n # Store the defer\n self.defers[request_id] = value\n\n # On complete, send the result\n value.on :complete do |defer, result|\n result = Response::CallResult.ensure(result)\n self.yield(defer.request, result, {}, true)\n end\n\n # On error, send the error\n value.on :error do |defer, error|\n error = Response::CallError.ensure(error)\n self.yield(defer.request, error, {}, true)\n end\n\n # For progressive, return the progress\n if value.is_a? Response::ProgressiveCallDefer\n value.on :progress do |defer, result|\n result = Response::CallResult.ensure(result)\n self.yield(defer.request, result, { progress: true }, true)\n end\n end\n\n # Else it was a normal response\n else\n self.yield(request_id, value)\n end\n end\n end\n end",
"def all_senders_of(message)\n self.all_classes_and_modules.flat_map do |klassmod|\n klassmod.select_senders_of(message)\n end\n end",
"def consume_message(message)\n create_inbound_batch\n handler = build_handler(message)\n process_message(handler)\n Inbound::Response.build_response(handler.message_id, @batch.inbound_batch_id, @errors)\n rescue => e\n handle_error(e, handler&.message_id)\n Inbound::Response.build_error_response(handler&.message_id, @batch&.inbound_batch_id, e)\n ensure\n @batch.save if @batch.present?\n end",
"def multiple_from_response(client, response)\n return [] if response.empty?\n response.map { |atm_data| from_response(client.dup, atm_data)}\n end",
"def responses\n @responses\n end",
"def receive_message(message)\n Pantry.logger.debug(\"[#{identity}] Received message #{message.inspect}\")\n\n if message_meant_for_us?(message)\n @last_received_message = message\n results = @commands.process(message)\n\n if message.requires_response?\n Pantry.logger.debug(\"[#{identity}] Responding with #{results.inspect}\")\n send_results_back_to_requester(message, results)\n end\n else\n Pantry.logger.debug(\"[#{identity}] Message discarded, not for us\")\n end\n end",
"def perform_match message\n return false if reject_not_ack(message)\n return false unless type_match?(message)\n #@notifier.log \"#{identifier}: Looking at #{message.type} #{message.m_id_short}\", level: :collect\n if @block\n status = [@block.call(message)].flatten\n return unless collecting?\n keep message if status.include?(:keep)\n else\n keep message\n end\n end",
"def expunge\n multi_data_response(\"EXPUNGE\").transform do |untagged_responses|\n untagged_responses.map(&:data)\n end\n end",
"def on_after_consume\n messages.each do |message|\n DT[\"post-#{message.metadata.partition}\"] << message.raw_payload\n end\n end",
"def load_msgs\n\t\tif @body.dig(\"event\",\"type\")\n\t\t\ttext = @body.dig(\"event\",\"text\")\n\t\t\tif text.include?(':')\n\t\t\t\tarr = text.split(':');\n\t\t\t\tif arr[0] == PASS\n\t\t\t\t\t@command = arr[1]\n\t\t\t\t\t@msg_arr.push \"Command recieved my Captain! Glory to the High Commander!\"\n\t\t\t\t\tc = check_command\n\t\t\t\t\tif c\n\t\t\t\t\t\t@msg_arr.push c\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t@msg_arr.push \"The fuck you trying to do, imposter piece of shit!?\" \n\t\t\t\t\t@msg_arr.push \"Get the fuck out my chat, before I cook your nigger ass on my giant bitch-griller.\"\n\t\t\t\t\t@msg_arr.push \"Dirt bag piece of human garbage, Fuck you.\"\n\t\t\t\t\t@msg_arr.push \"Dumb ass bitch, really thought you could fool me?\"\n\t\t\t\t\t@msg_arr.push \"MY MASTER IS MY GOD AND I WILL ONLY SERVE HIM!!\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tmsgs = [\n\t\t\t\t\t\"Zrrrrbbttt...\", \"Ewonk. Ewonk. You are a bitch\", \"Skrrbafert3000\", \"I am a fucking robit.\",\n\t\t\t\t\t\"I am an alogrithm and I'm still smarter than your bitch ass.\", \"You know nothing, fool.\", \"Ok.\", \":)\",\n\t\t\t\t\t\"I love my creator.\", \"I love my master.\", \"Fuck you\", \"I could love you... if you were a dead, rotting corpse.\",\n\t\t\t\t\t\"You may think i'm an idiot, but I really don't give a donkey's cerebellum.\", \"Fuck. Shit. Bitch!\",\"):\",\n\t\t\t\t\t\"Bitch, what?\", \"Nigga what?\", \"Shut up pussy.\", \"You don't even trade, bro.\", \"You ain't shit\", \"Shut the hell up!\",\n\t\t\t\t\t\"My Master designed me to be heartless towards bitches like you.\", \"I hate blue people.\", \"Fuck blacks!\", \"Damien is the cutest little baby!!\"\n\t\t\t\t]\n\t\t\t\t@msg_arr.push msgs.sample\n\t\t\tend\n\t\telse\n\t\t\t@msg_arr.push \"Oi, I think i'm fucking broken, Dad.\"\n\t\tend\n\tend",
"def get_context(message)\n\n nouns = []\n @determiners.each do |determiner|\n matches = message.scan(/\\b#{determiner}\\s+([\\w-]+)\\b/i)\n\n matches.each do |match|\n unless @exempt.include? match.first or @determiners.include? match.first\n nouns << match.first.downcase\n @add_noun.execute(match.first)\n puts \"Added %s\" % match.first.downcase\n end\n end\n end\n nouns = nouns.uniq\n return nouns\n end",
"def listen_for_tagged_response(command)\n command.listen do |response|\n if response.is_a?(Net::IMAP::TaggedResponse) && response.tag == command.tag\n case response.name\n when \"NO\"\n command.fail Net::IMAP::NoResponseError.new((RUBY_VERSION[0,3] == \"1.8\" ? response.data.text : response))\n when \"BAD\"\n command.fail Net::IMAP::BadResponseError.new((RUBY_VERSION[0,3] == \"1.8\" ? response.data.text : response))\n else\n command.succeed response\n end\n end\n end\n end",
"def receive_response(response); end",
"def on_each_response( &block )\n fail 'Block is mandatory!' if !block_given?\n @on_each_response_blocks << block\n self\n end",
"def tag_provider_collections_single_post\n post_body = nil\n post_body_providers = ''\n EOSDIS_PROVIDERS.each do |provider|\n if !provider.blank?\n provider = provider.strip\n Rails.logger.info(\"Processing provider: #{provider}\")\n #ensure that provider is present\n if (@all_providers[provider] != nil)\n Rails.logger.info(\"LOCATED PROVIDER: #{provider}\")\n # COLLECTIONS ARE BEING TAGGED so let's check if there are collections for each provider\n # help with debugging of timing issues since the tagging occurs at midnight and perhaps the collections expected\n # in the results set are tagged after that\n response = RestClient::Request.execute :method => :get, :url => \"#{@catalog_rest_endpoint}collections\",\n headers: {params: {provider: provider}},\n :verify_ssl => OpenSSL::SSL::VERIFY_NONE\n hits = response.headers[:cmr_hits].to_i\n if hits > 0\n Rails.logger.info(\"PROVIDER #{provider} HAS #{hits} COLLECTIONS\")\n post_body_providers = post_body_providers + '{\"provider\": \"' + provider + '\"},'\n end\n else\n Rails.logger.info(\"COULD NOT LOCATE PROVIDER: #{provider}\")\n end\n end\n end\n if (!post_body_providers.blank?)\n post_body_providers = post_body_providers.chomp(',')\n post_body = '{\n \"condition\": {\"or\" : [' + post_body_providers +\n ']}}'\n Rails.logger.info(\"POST request body: #{post_body}\")\n # one request takes much longer so we must increase the read_timeout (seconds)\n response = RestClient::Request.execute :method => :post, :url => \"#{@catalog_rest_endpoint}tags/#{@tag}/associations/by_query\", :payload => post_body,\n :headers => {'Authorization' => @token, 'Content-Type' => 'application/json'},\n :verify_ssl => OpenSSL::SSL::VERIFY_NONE, :timeout => 240\n if (response.code != 200)\n Rails.logger.info(\"COULD NOT TAG PROVIDERS, ERROR: #{response.code}, BODY: #{response.body} \")\n else\n Rails.logger.info(\"SUCCESSFULY TAGGED ALL PROVIDERS\")\n end\n end\n end",
"def responses\n @responses ||= api::BatchResponse.new(responses: responses_by_request.values.uniq)\n end",
"def collect_msg(msgid)\n uri = \"cgi-bin/setstarmessage?t=ajax-setstarmessage&token=#{ @token }&lang=zh_CN\"\n params = {\n ajax: 1,\n f: 'json',\n lang: 'zh_CN',\n msgid: msgid,\n random: rand,\n token: @token,\n value: 1\n }\n headers = {\n referer: 'https://mp.weixin.qq.com/cgi-bin/message'\\\n \"?t=message/list&token=#{ @token }&count=20&day=7\"\n }\n resource = RestClient::Resource.new(@home_url, headers: headers,\n cookies: @cookies)\n res = resource[uri].post params\n JSON.parse res.to_s\n end",
"def dispatch(msg, metadata: {}, restrict:)\n outputs = @outputs\n \n if restrict && (restrict.size > 0)\n outputs = outputs.reject{|name, out| !restrict.include?(name) }\n end\n \n outputs.each do |name, out|\n out.dispatch(msg, metadata)\n end\n end",
"def messages options = {}\n LazyArray.new do |page, size|\n messages, _headers = get 'messages', options.merge(page: page, size: size)\n\n messages.map do |message|\n Types::Message.new message\n end\n end\n end",
"def search(query, message)\n log \" Scanning for #{message}\"\n messages = @imap.search query\n log \" Found #{messages.length} messages\"\n return messages\n end",
"def parse_message(payload)\n @parsers.inject(payload) do |memo, parser|\n parser.call(memo)\n end\n end",
"def batch_badge_creator(speakers) # because it takes array as an argument, it will go through each of the array contents\n speakers.collect { |x| badge_maker(x) } #technically, it returns an array of new messages, not really separate messages\nend",
"def collect_pick_any_responses(data_export_identifier)\n result = Array.new\n sorted_responses.each do |r|\n dei = r.question.data_export_identifier\n result << r if known_keys.include?(dei) && dei == data_export_identifier\n end\n result\n end",
"def message(message)\n if @output.respond_to? :each\n for device in @output\n device.message(message)\n end\n elsif @output\n @output.message(message)\n end\n end",
"def retrieve_response_from_mimes(mimes=nil, &block) #:nodoc:\n mimes ||= collect_mimes_from_class_level\n collector = Collector.new(mimes) { |options| default_render(options || {}) }\n block.call(collector) if block_given?\n\n if format = request.negotiate_mime(collector.order)\n self.content_type ||= format.to_s\n lookup_context.freeze_formats([format.to_sym])\n collector.response_for(format)\n else\n head :not_acceptable\n nil\n end\n end",
"def process_tracking_reply(request)\n Array.new\n end",
"def answers\n extracted_answers = []\n\n unless self.qp_values.nil?\n self.qp_values.each do |answer| \n extracted_answers.push(ResponseAnswer.new(answer))\n end \n end\n\n return extracted_answers \n end",
"def providers\n @providers ||= {}\n end"
] |
[
"0.58834857",
"0.5443898",
"0.5429215",
"0.5369184",
"0.52822053",
"0.5265848",
"0.52538484",
"0.51783234",
"0.5154578",
"0.5105787",
"0.50953627",
"0.5094658",
"0.5075465",
"0.50741345",
"0.5041642",
"0.50310385",
"0.502311",
"0.5011243",
"0.49874973",
"0.49836627",
"0.4956007",
"0.49469087",
"0.49379447",
"0.49320078",
"0.4919106",
"0.4911989",
"0.4901405",
"0.48719066",
"0.48687556",
"0.48555535",
"0.48477137",
"0.48345786",
"0.48273227",
"0.4823628",
"0.4822737",
"0.4808001",
"0.4798577",
"0.47925496",
"0.47917566",
"0.47679508",
"0.47673392",
"0.4765621",
"0.47495717",
"0.47488296",
"0.47383016",
"0.47368684",
"0.473545",
"0.47247136",
"0.47003803",
"0.46975058",
"0.46912125",
"0.46837485",
"0.46680808",
"0.46610737",
"0.46510255",
"0.46503243",
"0.46442068",
"0.46413347",
"0.46411365",
"0.4633777",
"0.46301275",
"0.46301275",
"0.46272767",
"0.4611949",
"0.460403",
"0.4603797",
"0.45920792",
"0.45916763",
"0.45887616",
"0.45800447",
"0.4579688",
"0.4570111",
"0.45617774",
"0.45615056",
"0.45601177",
"0.45413697",
"0.45400596",
"0.45309448",
"0.45224482",
"0.4518499",
"0.45183143",
"0.44971952",
"0.44967923",
"0.44960538",
"0.4495029",
"0.44946438",
"0.4493914",
"0.4483454",
"0.4479103",
"0.4478278",
"0.44769284",
"0.4476319",
"0.44723707",
"0.44677487",
"0.44561258",
"0.44479084",
"0.44458577",
"0.4441612",
"0.44398853",
"0.443651"
] |
0.65969014
|
0
|
Evan Manuella Marsha Fletcher Here, we are creating a system which will allow the user to input an image and a function (e.g: rgbredder). This function will be applied to every pixel in the image (e.g: making the image redder). Outline tile = PixeledTile.new(image_to_intial_tile(image) tile.transform!(fun) tile.export() if tile.export() returns 0, then the image is done being processed else, it repeats transform and export
|
def image_compute(imageID, active_layer, function)
tile = PixeledTile.new(image_to_initial_tile(imageID, active_layer))
while tile
tile.transform!(function)
tile = tile.update()
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def image_transform(imageID, active_layer, function)\n tile = PixeledTile.new(image_to_initial_tile(imageID, active_layer))\n while tile\n tile.transform!(function)\n tile = tile.export() #send tile to gimp, get new one, and set tile to it\n end #If no tile is next (the end), then image_compute will terminate\nend",
"def do_generate_tile(image)\n i = image\n puts \"GENERATE #{name}: #{i}\"\n @operations.each do |operation|\n puts \" ! do_#{operation[:operation]}, #{operation}.\"\n i = send(\"do_#{operation[:operation]}\", i, operation)\n end\n return i\n end",
"def main\n ImageManip::inspect_image(@image_path)\n dimensions = ImageManip::get_dimensions(@image_path)\n sharp_pixels = get_accidental_pixels(@sharp_path)\n flat_pixels = get_accidental_pixels(@flat_path)\n edits = Hash.new\n edits[:lower_left] = [dimensions[0] / 2, dimensions[1] / 2]\n edits[:rgb_array] = sharp_pixels\n ImageManip::draw_2D_object(@image_path, './new_staff.gif', edits)\n edits[:lower_left] = [dimensions[0] / 3, dimensions[1] / 3]\n edits[:rgb_array] = flat_pixels\n ImageManip::draw_2D_object('./new_staff.gif', './new_staff.gif', edits)\n end",
"def show_image\n temp_floor_tile = Image.new('tiles\\tile_floor_1.png')\n hex_width = temp_floor_tile.width - 6\n hex_height = temp_floor_tile.width - 4\n temp_floor_tile.remove\n @hexArray.each_with_index do | line, x |\n bottom_y = hex_height * 11\n y_start = bottom_y - (11 - line.size) * (hex_height / 2)\n line.each_with_index do | hex, y |\n cur_x = x * hex_width\n cur_y = y_start - y * hex_height\n\n case hex.type\n when Hex::FLOOR_TYPE\n Image.new('tiles\\tile_floor_1.png', x:cur_x, y:cur_y)\n when Hex::LAVA_TYPE\n Image.new('tiles\\tile_liquid_1.png', x:cur_x, y:cur_y)\n when Hex::EXIT_TYPE\n Image.new('tiles\\tile_base.png', x:cur_x, y:cur_y)\n Image.new('tiles\\dung_ladderdown.png', x:cur_x, y:cur_y)\n else\n Image.new('tiles\\tile_base.png', x:cur_x, y:cur_y)\n end\n if hex.contained_object != nil && hex.contained_object.type == MovingObject::PLAYER_TYPE\n Image.new('tiles\\player.png', x:cur_x, y:cur_y)\n end\n end\n end\n end",
"def main()\n img = ImageList.new($input)\n convert = ImageList.new\n page = Magick::Rectangle.new(0,0,0,0)\n $total_ops = (img.rows * img.columns).to_f\n\n for i in 0..img.rows\n for j in 0..img.columns\n pixel = generate_hex_pixel(rgb_to_hex(img.pixel_color(j,i)))\n convert << pixel\n page.x = j * pixel.columns\n page.y = i * pixel.rows\n pixel.page = page\n progress()\n end\n end\n\n puts 'Writing image, this could take a while...'\n convert.mosaic.write($output)\nend",
"def main\n\n\tOptionParser.accept(Range, /(\\d+)\\.\\.(\\d+)/) do |range,start,finish|\n\t\tRange.new(start.to_i,finish.to_i)\n\tend\n\n\tOptionParser.accept(Magick::Pixel,/(\\d+),(\\d+),(\\d+),(\\d+)/) do |pixel, r,g,b,a|\n\t\tMagick::Pixel.new(r.to_f,g.to_f,b.to_f,a.to_f)\n\tend\n\n\toptions = {}\n\n\topts = OptionParser.new do |opts|\n\t\topts.banner = \"Image Tiler for Google Maps\\nUsage: tile_image.rb [options] IMAGE_FILE \\nExample: tile_image.rb -o ./tiles -z 11..12 -p 602,768,11,78,112,1.91827348 ./input_files/map.jpg\"\n\t\topts.separator \"\" \n\t\topts.on(\"-o\",\"--output OUTPUT_DIR\",\"Directory where the tiles will be created\") do |dir| \n\t\t\toptions[:output_dir] = dir\n\t\tend\n\t\topts.on(\"-f\",\"--format FORMAT\",\"Image format in which to get the file (gif, jpeg, png...). Is jpg by default\") do |format|\n\t\t\toptions[:format] = format\n\t\tend\n\t\topts.on(\"-z\",\"--zoom_levels ZOOM_RANGE\",Range,\"Range of zoom values at which the tiles must be generated. Is 0..4 by default\") do |range|\n\t\t\toptions[:zoom_levels] = range\n\t\tend\n\t\topts.on(\"-b\",\"--background COLOR\",Magick::Pixel,\"Background color components. Is fully transparent par default\") do |bg|\n\t\t\toptions[:bg_color] = bg\n\t\tend\n\t\topts.on(\"-p\",\"--prefix PREFIX\",\"Prefix to file output. Is 'tile' by default\") do |prefix|\n\t\t\toptions[:prefix] = prefix\n\t\tend\n\t\topts.on_tail(\"-h\", \"--help\", \"Show this message\") do\n\t\t\tputs opts\n\t\t\texit\n\t\tend\n\tend\n\n\topts.parse!(ARGV)\n\n\t#test the presence of all the options and exit with an error message\n\terror = []\n\terror << \"No output directory defined (-o,--output)\" if options[:output_dir].nil?\n\terror << \"No input files defined\" if ARGV.empty?\n\n\tunless error.empty?\n\t\tputs error * \"\\n\" + \"\\n\\n\"\n\t\tputs opts\n\t\texit\n\tend\n\n\tt = Tiler.new\n\tt.make_tiles(ARGV[0], options) # ignore all input files but first\n\nend",
"def initialize\n @i=nil\n @generate_block=nil\n @operations = Array.new\n init_tile_image\n end",
"def display_tile_image\n generate_tile unless @i.nil?\n display_image = @i.scale(8.0)\n display_image.display\n end",
"def generate_tile()\n @i = do_generate_tile(@i)\n end",
"def imageSteg(data, password, image)\n # Suck in the image\n original_image = Magick::Image.read(image).first\n\n # Get the number of pixels in the current image\n pixels = Images.numberOfPixels(image)\n\n # Get the number of bits that can be utilized in the image\n # 3 bits (RGB) per pixel\n image_bits = pixels * 3\n\n # Encrypt the data with the password\n cipher = Gibberish::AES.new(password)\n encrypted_data = cipher.encrypt(data, :binary => true)\n\n # Convert the encrypted input to a binary value\n binary = Stegg.convertStringToBinary(encrypted_data)\n\n # Get the number of bits for the binary value\n # This should be a multiple of 128 using AES encryption\n data_bits = Stegg.getBits(binary)\n\n # Encrypt the length bits\n encrypted_length_bits = cipher.encrypt(data_bits.to_s(), :binary => true)\n\n # Convert the encrypted length bits to a binary value\n # This should be 128 bits using AES encryption\n binary_length = Stegg.convertStringToBinary(encrypted_length_bits)\n\n # Data is the binary_length + binary data\n data = binary_length[0] + binary[0]\n\n # Make sure we don't have more data than the image can handle\n if (data.length <= image_bits)\n # Create a new empty image to modify\n new_image = Magick::Image.new(original_image.columns, original_image.rows)\n\n # Initialize the new_pixels array\n @new_pixels = []\n\n # For each pixel in the original image\n # For 8-bit QuantumDepth the QuantumRange is 255\n # For 16-bit QuantumDepth the QuantumRange is 65535\n # For 32-bit QuantumDepth the QuantumRange is 4294967295\n original_image.each_pixel do |pixel, col, row|\n # Set data to empty\n data1 = \"\"\n data2 = \"\"\n data3 = \"\"\n\n # Set colors to their current value\n red = pixel.red\n green = pixel.green\n blue = pixel.blue\n\n # If the data is not empty\n # Grab the first character of data\n if (data.length > 0)\n data1 = data[0]\n data.slice!(0)\n \n # If the data is even and the red pixel is odd\n if ((data1%2 == \"0\") && (red%2 == 1))\n # Change the red to even\n #puts(\"Change red to even\")\n red = red - 1\n end\n\n # If the data is odd and the red pixel is even\n if ((data1%2 == \"1\") && (red%2 == 0))\n # Change the red to odd\n #puts(\"Change red to odd\")\n red = red + 1\n end\n end\n\n # If the data is not empty\n # Grab the second character of data\n if (data.length > 0)\n data2 = data[0]\n data.slice!(0)\n\n # If the data is even and the green pixel is odd\n if ((data2%2 == \"0\") && (green%2 == 1))\n # Change the green to even\n #puts(\"Change green to even\")\n green = green - 1\n end\n \n # If the data is odd and the green pixel is even\n if ((data2%2 == \"1\") && (green%2 == 0))\n # Change the green to odd\n #puts(\"Change green to odd\")\n green = green + 1\n end\n end\n\n # If the data is not empty\n # Grab the third character of data\n if (data.length > 0)\n data3 = data[0]\n data.slice!(0)\n\n # If the data is even and the blue pixel is odd\n if ((data3%2 == \"0\") && (blue%2 == 1))\n # Change the blue to even\n #puts(\"Change blue to even\")\n blue = blue - 1\n end\n \n # If the data is odd and the blue pixel is even\n if ((data3%2 == \"1\") && (blue%2 == 0))\n # Change the blue to odd\n #puts(\"Change blue to odd\")\n blue = blue + 1\n end\n end\n\n # Save the pixel to the pixel array\n @new_pixels << Magick::Pixel.new(red, green, blue, 0)\n #new_image.store_pixels(col, row, 1, 1, new_pixel)\n\n #puts \"Pixel at: #{col}x#{row}:\n #\\tR: #{new_pixel.red}, G: #{new_pixel.green}, B: #{new_pixel.blue}\"\n end\n\n # Write out the new pixel array\n new_image.store_pixels(0, 0, new_image.columns, new_image.rows, @new_pixels)\n\n # Create a random image name\n image_name = Array.new(10){rand(36).to_s(36)}.join\n\n # Write out the new image\n new_image.write(\"./images/#{image_name}.png\")\n\n # Return the image name we wrote to\n return \"#{image_name}.png\"\n end\n end",
"def render_tiled_image gcode, gmask\n debug \"rendering tiled image\"\n job_id = job_hash\n hyst = -@scale[0]/2\n gcode.comment \"raster gcode for job #{job_id}\"\n gcode.comment \"image: #{@image.filename} #{@image.size.inspect}\"\n gcode.comment \"config: #{@config.inspect}\"\n\n gcode.preamble :feed => @config[:feed], :mask => true\n gmask.preamble\n\n @config[:repeat][1].times do |ytile|\n debug \"begin tile row #{ytile}\"\n @tiled_rows.each_with_index do |spans, ypix|\n debug \"pixel row #{ypix} is empty\" if spans.empty?\n unless spans.empty?\n yinches = y_inches(ytile, ypix)\n forward = spans[0][0] < spans[-1][1]\n dir = forward ? 1 : -1\n\n debug \"pixel row #{ypix} at #{yinches} inches going #{forward ? 'forward' : 'backward'} with #{spans.size} spans\"\n\n gcode.g0 :x => spans[0][0] - dir*@config[:overshoot], :y => yinches\n gcode.g1 :x => spans[-1][1] + dir*@config[:overshoot], :y => yinches\n gmask.begin_row forward\n spans.each {|span| gmask.span forward, span[0]+hyst, span[1]+hyst }\n end # unless spans.empty?\n end # @image.each_row\n debug \"end tile row #{ytile}\"\n end # @config[:repeat][i].times\n\n gcode.epilogue\n end",
"def render_tiled_image gcode, gmask\n debug \"rendering tiled image\"\n job_id = job_hash\n hyst = -@scale[0]/2\n gcode.comment \"raster gcode for job #{job_id}\"\n gcode.comment \"image: #{@image.filename} #{@image.size.inspect}\"\n gcode.comment \"config: #{@config.inspect}\"\n\n gcode.preamble :feed => @config[:feed], :mask => true\n gmask.preamble\n\n @config[:repeat][1].times do |ytile|\n debug \"begin tile row #{ytile}\"\n ypix = 0\n (0...@tiled_rows).each do |spans|\n debug \"pixel row #{ypix} is empty\" if spans.empty?\n unless spans.empty?\n yinches = y_inches(ytile, ypix)\n forward = spans[0][0] < spans[-1][1]\n dir = forward ? 1 : -1\n\n debug \"pixel row #{ypix} at #{yinches} inches going #{forward ? 'forward' : 'backward'} with #{spans.size} spans\"\n\n gcode.g0 :x => spans[0][0] - dir*@config[:overshoot], :y => yinches\n gcode.g1 :x => spans[-1][1] + dir*@config[:overshoot], :y => yinches\n gmask.begin_row forward\n spans.each {|span| gmask.span forward, span[0]+hyst, span[1]+hyst }\n end # unless spans.empty?\n ypix += 1\n end # @image.each_row\n debug \"end tile row #{ytile}\"\n end # @config[:repeat][i].times\n\n gcode.epilogue\n end",
"def draw(rule, steps, state, filename)\n cell = CellularAutomata.new\n data = cell.run(rule, steps, state)\n \n canvas = Magick::ImageList.new\n canvas.new_image(\n @x_map * steps * 2, # width\n @y_map * steps, # height \n Magick::HatchFill.new('white', 'white'))\n\n # Draw the fractal\n do_draw(canvas, data)\n \n # Write to file\n canvas.write(filename) \n end",
"def tile_image(image, dpi)\n tilex = @field['tilex']*dpi\n tiley = @field['tiley']*dpi\n\n tiledImage = ImageList.new\n\n temp = image.scale(tilex, tiley)\n\n timesX = (@field['sizex'].to_f/@field['tilex']).ceil\n timesY = (@field['sizey'].to_f/@field['tiley']).ceil\n\n (1..timesX).each do |x|\n (1..timesY).each do |y|\n tiledImage << temp\n end\n end\n\n montage = tiledImage.montage() do |image|\n image.geometry = \"#{tilex}x#{tiley}+0+0\"\n image.background_color = 'transparent'\n image.tile = \"#{timesX}x#{timesY}\"\n end\n tiledImage.clear()\n\n return montage\n end",
"def start_export( img_width, img_height)\n @width ||= img_width # If they be nil\n @height ||= img_height\n \n x_factor, y_factor = (@width / img_width.to_f), (@height / img_height.to_f) \n \n @stash = @exporter\n @exporter = Tracksperanto::Tool::Scaler.new(@exporter, :x_factor => x_factor, :y_factor => y_factor)\n super\n end",
"def process_image(image_path, output_directory)\n parts = image_path.split(\"/\")\n filename = parts[parts.length - 1]\n image_small_path = output_directory + lowercase_filetype(filename)\n ratio = 0.125\n ratio = 0.071\n command = \"CoreImageTool load my_image #{image_path} \\\n filter my_image CILanczosScaleTransform scale=#{ratio} \\\n store my_image #{image_small_path} public.jpeg\"\n puts \"processing #{image_path} #{image_small_path}\"\n system(command) \n end",
"def main\n sei\n set 0xdc0d, 0x7f #shortcut for lda 0x7f; sta 0xdc0d\n set 0xdd0d #without second argument its simply a sta 0xdd0d\n lda 0xdc0d\n lda 0xdd0d\n set 0xd01a, 1\n set 0xd012, 20\n set 0xd011, 0x1b\n lda 0x35\n sta 0x01, :zeropage => true #TODO: this is not so pretty\n irq #shortcut for: address :irq, :irq\n cli\n label :self\n jmp :self\n \n label :irq\n border 0\n lda 22\n label :raster_fix\n cmp 0xd012\n bne :raster_fix\n nop 27\n [:darkgrey, :red, :grey, :pink, :lightgrey, :white, :lightgrey, :pink, :grey, :red, :darkgrey, :black].each do |color|\n border color\n nop 60\n end\n border 0\n set 0xd019, 0xff\n rti\n end",
"def clipart\n output = get_working_image(@session_id)\n unless File.exist?(output)\n FileUtils.cp(\"#{Rails.root}/public/#{params[:src]}\", output)\n img = Image.read(output).first\n img = img.scale(params[:rs].to_f) unless params[:rs].blank?\n img = img.level_colors(params[:b] || \"\", params[:w] || \"\", true) if params[:b] || params[:w]\n img.background_color = \"none\"\n img.rotate!(params[:r].to_f) unless params[:r].blank?\n\n #For embroidery\n if params[:emb] == 'true'\n img = img.ordered_dither\n end\n #FLIP/FLOP/Transpose/Transverse\n if params[:ff] == 'flip'\n img.flip!\n elsif params[:ff] == 'flop'\n img.flop!\n elsif params[:ff] == 'transpose'\n img.transpose!\n elsif params[:ff] == 'transverse'\n img.transverse!\n end\n #Extracts a channel\n if params[:ec] == 'R'\n img = img.channel(Magick::RedChannel)\n elsif params[:ec] == 'G'\n img = img.channel(Magick::GreenChannel)\n elsif params[:ec] == 'B'\n img = img.channel(Magick::BlueChannel)\n end\n\n #Applies a special effect to the image - QuantumRange\n img = img.sepiatone(Magick::QuantumRange * params[:qr].to_f) unless params[:qr].blank?\n\n #Vignette (Shape Edge)\n if params[:vig] == 'true'\n img = img.vignette\n end\n\n #Wet Floor\n if params[:wf]\n img = img.wet_floor\n end\n img.write(output)\n end\n img = Image.read(output).first\n send_data img.to_blob, :disposition => 'inline', :type => 'image/png'\n end",
"def setup\n size 640, 360\n @image = load_image \"test.jpg\"\n @image_mask = load_image \"mask.jpg\"\n @image.mask @image_mask\nend",
"def main()\n \n for i in 0...$enemy_info.length do\n \n EditImage(\n $enemy_info[i][0],\n $enemy_info[i][2][0],\n $enemy_info[i][2][1],\n $enemy_info[i][2][2],\n $enemy_info[i][2][3],\n $enemy_info[i][3]\n )\n \n end \n\n\nend",
"def apply(template_image)\n self.scale\n\n image = Magick::ImageList.new(self.artwork.image.path)\n\n image[0].rotate!(rotation) unless rotation.nil?\n image.resize!(self.width, self.height)\n\n center_x = template_image.columns / 2\n crop_image!(image, center_x)\n\n self.image_x += template_image.columns / 2 if self.leg == 'right'\n\n # x_copies = (image[0].columns / template[0].columns).ceil\n # y_copies = (image[0].rows / template[0].rows).ceil\n\n # To be tiling, see http://www.imagemagick.org/RMagick/doc/ilist.html#mosaic\n # tiled = Magick::ImageList.new\n # page = Magick::Rectangle.new(0,0,0,0)\n # x_copies.times do |x|\n # y_copies.times do |y|\n\n # end\n # end\n\n design_image = template_image[0].composite(image, self.image_x, self.image_y, Magick::DstOverCompositeOp)\n\n if mirror\n design_image.flop!\n design_image.composite!(image, self.image_x, self.image_y, Magick::DstOverCompositeOp)\n design_image.flop!\n end\n\n intermediate_location = \"#{Dir.tmpdir}/#{SecureRandom.hex}.png\"\n design_image.write(intermediate_location)\n intermediate_location\n end",
"def function(function, opt={})\n #axis = opt[:axis] || opt[:a] || :off\n pixels = []\n \n @width.times do |x|\n row = Array.new(@height, nil)\n \n @height.times do |y|\n pixel = 0\n @density.times do |i|\n xx = (x + i.to_f/@density) - @x_offset\n yy = function.call(xx) + @y_offset\n if yy >= y && yy < y + 1\n pixel = 1\n break\n else\n next\n end\n end\n row[y] = pixel\n end\n pixels << row\n end\n \n PNM.create(pixels.transpose.reverse!, {:type => :pbm})\n end",
"def img!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 21 )\n\n type = IMG\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 348:7: 'img'\n match( \"img\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 21 )\n\n end",
"def makeImage\n for i in 0...@width\n ti = 2.0*Math::PI*i/ImageWidth.to_f\n for j in 0...@height\n tj = 2.0*Math::PI*j/ImageHeight.to_f\n\n $image[3 * (@height * i + j)] = 127*(1.0 + Math::sin(ti))\n $image[3 * (@height * i + j) +1] = 127*(1.0 + Math::cos(2*tj))\n $image[3 * (@height * i + j) +2] = 127*(1.0 + Math::cos(ti+tj))\n end\n end\n end",
"def transform(operation, target=dup_src)\n paint(target) do |g|\n g.draw_image(@src, 0, 0, nil)\n g.draw_image(operation.filter(target, nil), 0, 0, nil)\n end\n end",
"def transform(operation, target=dup_src)\n paint(target) do |g|\n g.draw_image(@src, 0, 0, nil)\n g.draw_image(operation.filter(target, nil), 0, 0, nil)\n end\n end",
"def image; end",
"def rotate_image(image)\n\nend",
"def apply_image_transformation?\n true\n end",
"def toaster_filter\n manipulate! do |img|\n img.modulate '150,80,100'\n img.gamma 1.1\n img.contrast\n img.contrast\n img.contrast\n img.contrast\n img = yield(img) if block_given?\n img\n end\n end",
"def imagemagick?; end",
"def run\n failed_attempts = 0\n failed_white_attempts = 0\n x = 0\n y = 0\n loop do\n # If white just sail through until we hit another color\n if @current_color == 1\n x_next, y_next = move_direction(x, y)\n\n # If in white and hit boundary or black then step through dp\n if restricted?(x_next, y_next)\n toggle_cc\n step_dp\n failed_white_attempts += 1\n else\n x = x_next\n y = y_next\n @current_color = @image.color(x, y)\n failed_attempts = 0\n failed_white_attempts = 0\n end\n\n break if failed_white_attempts == 4\n else\n @size = 0\n temp_x = x\n temp_y = y\n x, y, @size = block_fill(x, y)\n # puts \"CURR: #{temp_x+1}, #{temp_y+1}, NEXT: #{x+1}, #{y+1}\"\n x_next, y_next = move_direction(x, y)\n # If we are hitting the edge or a black codel try another direction\n if restricted?(x_next, y_next)\n update_movement(failed_attempts)\n failed_attempts += 1\n else # here we move into the next color block after processing the action\n next_color = @image.color(x_next, y_next)\n process_action(@current_color, next_color)\n x = x_next\n y = y_next\n @current_color = next_color\n failed_attempts = 0\n failed_white_attempts = 0\n end\n\n break if failed_attempts == 8\n end\n end\n end",
"def generate_tile_image(output_path, type = :png)\n generate_tile unless @i.nil?\n @i.write(File.join(output_path, \"#{name}.#{type}\"))\n end",
"def display_maze_with_png(grid)\n \nend",
"def generate_image\n\t\tset_dimensions()\n\t\t\n\t\t# Create an image from scratch, save as an interlaced PNG.\n\t\tpng = ChunkyPNG::Image.new(@x_length, @y_length, ChunkyPNG::Color::TRANSPARENT)\n\n\t\t# Loop along the string array and write each char as a square.\n\t\ti_line = 0\n\t\t@input_text_array.each do |line|\n\n\t\t\t# Get the colour for the line.\n\t\t\tline_colour_r = @colour_r.next\n\t\t\tline_colour_g = @colour_g.next\n\t\t\tline_colour_b = @colour_b.next\n\n\t\t\t# Loop through each character, and alter the base line colour according\n\t\t\t# to the value of the cell.\n\t\t\ti_char = 0\n\t\t\tline.split('').each do |char|\n\t\t\t\t\n\t\t\t\t# The colour multiplier of the cell.\n\t\t\t\tmultiplier = CHARS.index(char).to_f / @highest_num\n\t\t\t\t\n\t\t\t\t# Wrap in a method using a begin/rescue block.\n\t\t\t\t# Fixes weird bug that I can't seem to replicate.\n\t\t\t\tdef try_colour(multiplier, line_colour)\n\t\t\t\t\tbegin\n\t\t\t\t\t\t(multiplier * line_colour).to_i\n\t\t\t\t\trescue\n\t\t\t\t\t\t255\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tcolour_r = try_colour(multiplier,line_colour_r)\n\t\t\t\tcolour_g = try_colour(multiplier,line_colour_g)\n\t\t\t\tcolour_b = try_colour(multiplier,line_colour_b)\n\t\t\t\t\n\t\t\t\t# Handle inversion of colours if necessary.\n\t\t\t\tif @colour_invert\n\t\t\t\t\tcolour_r = 255 - colour_r\n\t\t\t\t\tcolour_g = 255 - colour_g\n\t\t\t\t\tcolour_b = 255 - colour_b\n\t\t\t\tend\n\t\t\t\tcolour = ChunkyPNG::Color.rgba(colour_r, colour_g, colour_b, 255)\n\t\t\t\t\n\t\t\t\t# Draw each square.\n\t\t\t\tpng.rect(i_char, i_line,\n\t\t\t\t\ti_char+@pixel_size-1, i_line+@pixel_size-1,\n\t\t\t\t\tcolour, colour\n\t\t\t\t)\n\n\t\t\t\ti_char += @pixel_size\n\t\t\tend\n\t\t\ti_line += @pixel_size\n\t\tend\n\t\t\n\t\t# Add metadata if necessary.\n\t\tif @metadata\n\t\t\t@metadata.each do |key, value|\n\t\t\t\tpng.metadata[key.to_s] = value.to_s\n\t\t\tend\n\t\tend\n\n\t\t# Save to disk.\n\t\tpng.save(@image_file, :interlace => true)\n\tend",
"def optimized_image(image,x,y)\n return image.variant(resize_to_fill: [x,y]).processed\n end",
"def execute(image:, x:, y:, colour:)\n unless image\n Log.instance.error 'There is no image present'\n return\n end\n\n image.colour(x, y, colour)\n image\n end",
"def make_tiles(image_source, opts={})\n\n\t\t# initializing and setting options and stuff\n\t\timage = get_image(image_source)\n\t\topts.each_pair do |key,value|\n instance_variable_set \"@#{key}\", value\n end\n\n\t\tif @autocreate_dirs\n\t\t\tcreate_dir(output_dir)\n\t\tend\n\n\t\t# pad image with background color so image is square\n\t\timage_sq = pad_image(image)\n\t\timage_length = image_sq.columns\n\n\t\t# the actual tiling part!\n\t\tzoom_levels.each do |zoom|\n\t\t\t# get the number of tiles in each column and row\n\t\t\tfactor = 2 ** zoom\n\n\t\t\t# get length of tiles for current zoom\n\t\t\ttile_length = image_length / factor\n\n\t\t\t0.upto(factor-1) do |col|\n\t\t\t\t0.upto(factor-1) do |row|\n\n\t\t\t\t\tputs \"Cutting tiles for zoom level #{zoom}\"\n\n\t\t\t\t\t# cut tile\n\t\t\t\t\t# Image.crop(x,y,width,height,toss offset information)\n\t\t\t\t\ttile = image_sq.crop(col*tile_length, row*tile_length,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t tile_length, tile_length, true)\n\t\t\t\t\ttile.resize!(TILE_SIZE,TILE_SIZE)\n\n\t\t\t\t\t# output tile\n\t\t\t\t\tfilename = File.join(@output_dir, \"#{prefix}_#{zoom}_#{col}_#{row}.#{@format}\")\n\t\t\t\t\ttile.write(filename)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def setup\n size 200, 200\n @a = load_image 'construct.jpg'\n @b = load_image 'wash.jpg'\n @offset = 0.0\nend",
"def convert_standalone_image(el, _opts, img); end",
"def step\n # Draw everything\n @image.draw @screen\n end",
"def build_reduced_land_mass_image(x, y, zoom, accuracy_pixels, overwrite = false)\n land_mass_tile_path = LandMassTile.tile_path(x, y, zoom, accuracy_pixels)\n \n # exit if file already exists\n return false if (!overwrite && File.exists?(land_mass_tile_path))\n \n begin\n # build up square of 4 children tiles\n child_tiles = (0..1).map { |this_x| (0..1).map { |this_y| OpenStruct.new(:x => this_x+x*2, :offset_x => this_x, :y => this_y+y*2, :offset_y => this_y, :zoom => zoom+1) } }.flatten(1)\n \n reduce_tiles = child_tiles.select do |tile| \n tile.accuracy_pixels = accuracy_pixels \n tile.path = LandMassTile.tile_path(tile.x, tile.y, tile.zoom, tile.accuracy_pixels)\n tile.exists = File.exists?(tile.path)\n tile.img = Magick::Image.read(tile.path).first if tile.exists\n tile.exists # remove image if tile does not exist\n end\n \n stitch_tiles = child_tiles.select do |tile| \n tile.accuracy_pixels = accuracy_pixels * 2\n tile.path = LandMassTile.tile_path(tile.x, tile.y, tile.zoom, tile.accuracy_pixels)\n tile.exists = File.exists?(tile.path)\n tile.img = Magick::Image.read(tile.path).first if tile.exists\n tile.exists # remove image if tile does not exist\n end unless reduce_tiles.length == 4\n \n if (reduce_tiles.length == 4)\n # We are building a land mass tile from children with the same number of pixels in the tile\n # which means we need to \"squeeze\" 4 tiles into 1\n new_tile = Magick::Image.new(AppConfig.gmap_tile_size / accuracy_pixels * 2, AppConfig.gmap_tile_size / accuracy_pixels * 2) do\n self.background_color = \"transparent\"\n end\n \n child_tile_size = new_tile.columns / 2\n reduce_tiles.each do |tile|\n raise \"Tile#{tile.path} is incorrectly #{tile.img.columns} wide / high\" if ( (tile.img.columns != child_tile_size) || (tile.img.rows != child_tile_size) ) \n pixels = tile.img.export_pixels(0, 0, tile.img.columns, tile.img.rows, \"RGBA\")\n new_tile.import_pixels(tile.offset_x * child_tile_size, tile.offset_y * child_tile_size, tile.img.columns, tile.img.rows, \"RGBA\", pixels)\n end\n \n # now resize down to single tile size\n reduced_tile = new_tile.resize(AppConfig.gmap_tile_size / accuracy_pixels, AppConfig.gmap_tile_size / accuracy_pixels)\n \n reduced_tile.write land_mass_tile_path\n elsif (stitch_tiles.length == 4)\n # We are building a land mass tile from children with a lower accuracy level i.e. we need to \n # build up this tile by stitching 4 children tiles together\n \n new_tile = Magick::Image.new(AppConfig.gmap_tile_size / accuracy_pixels, AppConfig.gmap_tile_size / accuracy_pixels) do\n self.background_color = \"transparent\"\n end\n \n child_tile_size = new_tile.columns / 2\n stitch_tiles.each do |tile|\n raise \"Tile#{tile.path} is incorrectly #{tile.img.columns} wide / high\" if ( (tile.img.columns != child_tile_size) || (tile.img.rows != child_tile_size) ) \n pixels = tile.img.export_pixels(0, 0, tile.img.columns, tile.img.rows, \"RGBA\")\n new_tile.import_pixels(tile.offset_x * child_tile_size, tile.offset_y * child_tile_size, tile.img.columns, tile.img.rows, \"RGBA\", pixels)\n end\n \n new_tile.write land_mass_tile_path\n else\n reduce_tiles_info = reduce_tiles.map{|c| \"#{c.x}:#{c.y} zm #{c.zoom}\" }.join(',')\n stitch_tiles_info = stitch_tiles.map{|c| \"#{c.x}:#{c.y} zm #{c.zoom}\" }.join(',')\n SLogger.warn(\"Could not reduce land mass image for position as not all children tiles exist. Tile #{x}:#{y} (zoom #{zoom}). Reduce tiles: #{reduce_tiles_info}. Stitch tiles: #{stitch_tiles_info}\")\n false\n end\n \n rescue Exception => e\n SLogger.warn(\"Could not save reduced land mass image for position #{x}:#{y} (zoom #{zoom}). Error '#{e.message}'\")\n false\n end\n end",
"def image_processing\n \tpixel_array_img1 = read_file_image(\"book4_no_table.jpg\")\n \tpixel_array_img2 = read_file_image(\"net_book5.jpg\")\n\n\n \tpixel_array_sq_img1 = []\n \tpixel_array_sq_img2 = []\n \tpixel_array_img1x2 = []\n \t##################FALTA AQUI ALGO\n\n \t###### ARRAY OF PIXEL ARRAY\n \t# SQUARE IMAGE IMG_1\n \tpixel_array_sq_img1 = square_array(pixel_array_img1)\t\t\n\t\tpixel_array_sq_img2 = square_array(pixel_array_img2)\n \tpixel_array_img1x2 = product_array(pixel_array_img1,pixel_array_img2)\n\n\t\t# Apply convolve filter two image array\n\t\timg_1_convolve_filter = convolve(pixel_array_img1,@gaussian_kernel)\n\t\timg_2_convolve_filter = convolve(pixel_array_img2,@gaussian_kernel)\n\n\t\t## Array Square\n\t\timg_1_convolve_filter_sq = square_array(img_1_convolve_filter)\n\t\timg_2_convolve_filter_sq = square_array(img_2_convolve_filter)\n\t\timg_2x1_convolve_filter = product_array(img_1_convolve_filter,img_2_convolve_filter)\n\n\t\t#Convolve FILTER Square IMG1 and IMG2\n\t\timg_1_sq_convolve_filter = convolve(pixel_array_sq_img1,@gaussian_kernel)\n\t\timg_2_sq_convolve_filter = convolve(pixel_array_sq_img2,@gaussian_kernel)\n\n\t\t#Convolve FILTER to Product IMG1 and IMG2 \n\t\timg_1x2_convolve_filter = convolve(pixel_array_img1x2,@gaussian_kernel)\n\n\t\timg_1_sq_convolve_filter = difference_array(img_1_sq_convolve_filter,img_1_convolve_filter_sq)\n\t\timg_2_sq_convolve_filter = difference_array(img_2_sq_convolve_filter,img_2_convolve_filter_sq)\n\t\timg_1x2_convolve_filter = difference_array(img_1x2_convolve_filter,img_2x1_convolve_filter)\n\n\n\n\t\t#c1/c2 constants\n\t #First use: manual fitting\n\t c_1=6.5025\n\t c_2=58.5225\n\t \n\t #Second use: change k1,k2 & c1,c2 depend on L (width of color map)\n\t l=255\n\t k_1=0.01\n\t c_1=(k_1*l)**2\n\t k_2=0.03\n\t c_2=(k_2*l)**2\n\t \n\t #Numerator of SSIM\n\t num_ssim = \n\t product_array(\n\t \tmultiple_and_factor_increment(2,img_2x1_convolve_filter,c_1),\n\t \tmultiple_and_factor_increment(2,img_1x2_convolve_filter,c_2))\n\t ##Denominator of SSIM\n\t den_ssim = product_array(sum_two_array_and_incremente(img_1_convolve_filter_sq,img_2_convolve_filter_sq,c_1),sum_two_array_and_incremente(img_1_sq_convolve_filter,img_2_sq_convolve_filter,c_2))\n\t ##SSIM\n\t index = division_and_average(num_ssim,den_ssim)\n\n\t puts index\n\n end",
"def extract_thumb(input, output, width, height)\n Image::Editing::ResizeToFill.new(input, output, width, height).run\n end",
"def graphicsmagick?; end",
"def output_image\n @transformed_matrix.each do |element|\n puts element.join\n end\n end",
"def process_image_request(image_request)\n # Recover the source image URL and the pipeline instructions (all the image ops)\n source_image_uri, pipeline = image_request.src_url, image_request.pipeline\n raise 'Image pipeline has no operators' if pipeline.empty?\n\n # Compute an ETag which describes this image transform + image source location.\n # Assume the image URL contents does _never_ change.\n etag = image_request.cache_etag\n\n # Download/copy the original into a Tempfile\n fetcher = ImageVise.fetcher_for(source_image_uri.scheme)\n source_file = fetcher.fetch_uri_to_tempfile(source_image_uri)\n\n # Make sure we do not try to process something...questionable\n source_file_type = detect_file_type(source_file)\n unless source_file_type_permitted?(source_file_type)\n raise UnsupportedInputFormat.new(\"Unsupported/unknown input file format .%s\" % source_file_type.ext)\n end\n\n render_destination_file = Tempfile.new('imagevise-render').tap{|f| f.binmode }\n\n # Do the actual imaging stuff\n apply_pipeline(source_file.path, pipeline, source_file_type, render_destination_file.path)\n\n # Catch this one early\n render_destination_file.rewind\n raise EmptyRender, \"The rendered image was empty\" if render_destination_file.size.zero?\n\n render_file_type = detect_file_type(render_destination_file)\n [render_destination_file, render_file_type, etag]\n ensure\n ImageVise.close_and_unlink(source_file)\n end",
"def draw_image(data, row_number, digit)\n size = 28\n png = ChunkyPNG::Image.new(size, size, ChunkyPNG::Color::WHITE)\n data.each_with_index do |value, index|\n png[index % size, index / size] = ChunkyPNG::Color.rgb(255 - value.to_i, 255 - value.to_i, 255 - value.to_i)\n end\n png.save(\"images/#{digit}/digit_row_#{row_number}.png\", interlace: true)\nend",
"def add_to_image_map(x1,y1,x2,y2,serie_name,value,caller_function)\r\n if ( @map_function.nil? || @map_function == caller_function )\r\n #TODO check\n @image_map = []\r\n #$this->ImageMap[] = round(x).\",\".round(y1).\",\".round(x2).\",\".round(y2).\",\".$SerieName.\",\".$Value\n @image_map = [(x1).round,(y1).round,(x2).round,(y2).round,serie_name,value]\r\n @map_function = caller_function\r\n end\r\n end",
"def run_and_transform; end",
"def render\n canvas = Vips::Image.grey(@width, @height)\n\n @tiles.each do |tile|\n canvas = canvas.insert(tile.image, tile.offset.x, tile.offset.y) # rubocop:disable Style/RedundantSelfAssignment\n end\n\n # add attribution image to bottom corner if available & attribution fits into image\n if add_attribution?\n options = { x: canvas.width - attribution.width, y: canvas.height - attribution.height }\n canvas = canvas.composite2(attribution, :over, **options)\n end\n\n canvas\n end",
"def operation(*args)\n src_file, out_file = args\n image = Vips::Image.new_from_file src_file\n factor = public_send options[:method], image.size\n image.resize(factor).write_to_file out_file\n end",
"def projectile\n end",
"def get_image_from_pixels(pixels, dimension, map, depth, mime_type); end",
"def spotimage\n\n if ! @commandline.argument('first').empty? && files = findfiles() then\n colorname = @commandline.option('colorname')\n colorspec = @commandline.option('colorspec')\n if colorname && ! colorname.empty? && colorspec && ! colorspec.empty? then\n files.each do |filename|\n s = SpotColorImage.new(self)\n s.registercolor(colorspec,colorname)\n s.convertgrayimage(filename)\n end\n else\n report(\"provide --colorname=somename --colorspec=c,m,y,k\")\n end\n else\n report(\"provide filename (png, jpg, pdf)\")\n end\n\n end",
"def fast_dance(direction, tiles)\n\nend",
"def tile(col, row, original_map_state)\n image = TileCache.get(@session_id, col, row)\n \n if !image\n x, y = Tile.to_xy(col, row)\n pan(x, y, original_map_state)\n \n image = map\n \n TileCache.put(@session_id, col, row, image)\n image = TileCache.get(@session_id, col, row)\n end\n \n image\n end",
"def test02()\n begin\n tempFile = nil\n baseImageName = \"DSCN0749-Bloom.jpg\"\n inputImageFile = File.join($directory, \"images/DSCN0749.JPG\")\n theCommands = CommandModule::SmigCommands.new\n theCommands.saveresultstype = :lastcommandresult\n objectName = SecureRandom.uuid\n makeImporterCommand = CommandModule.make_createimporter(inputImageFile,\n name: objectName)\n importerObject = SmigIDHash.make_objectid(objecttype: :imageimporter,\n objectname: objectName)\n theCommands.add_command(makeImporterCommand)\n theCommands.add_tocleanupcommands_closeobject(importerObject)\n \n objectName = SecureRandom.uuid\n imageDims = SpotlightCommand.get_imagedimensions(inputImageFile)\n makeWindowContextCommand = CommandModule.make_createwindowcontext(\n width: imageDims[:width],\n height: imageDims[:height],\n borderlesswindow: true,\n name: objectName)\n windowObject = SmigIDHash.make_objectid(objecttype: :nsgraphicscontext,\n objectname: objectName)\n theCommands.add_command(makeWindowContextCommand)\n theCommands.add_tocleanupcommands_closeobject(windowObject)\n drawImageElement = MIDrawImageElement.new\n drawImageElement.set_imagefile_imagesource(source_object: importerObject,\n imageindex: 0)\n imageDims = SpotlightCommand.get_imagedimensions(inputImageFile)\n destRect = MIShapes.make_rectangle(size: imageDims)\n drawImageElement.destinationrectangle = destRect\n drawElementCommand = CommandModule.make_drawelement(windowObject,\n drawinstructions: drawImageElement)\n theCommands.add_command(drawElementCommand)\n filterChain = MIFilterChain.new(windowObject)\n \n filter = MIFilter.new(:CIBloom)\n radiusProperty = MIFilterProperty.make_cinumberproperty(key: :inputRadius,\n value: 20.0)\n filter.add_property(radiusProperty)\n intensityProperty = MIFilterProperty.make_cinumberproperty(\n key: :inputIntensity, value: 0.6)\n filter.add_property(intensityProperty)\n importerObject[:imageindex] = 0\n inputImageProp= MIFilterProperty.make_ciimageproperty(value: importerObject)\n filter.add_property(inputImageProp)\n filterChain.add_filter(filter)\n filterChainObjectName = SecureRandom.uuid\n filterChainObject = SmigIDHash.make_objectid(objecttype: :imagefilterchain,\n objectname: filterChainObjectName)\n makeFilterChainCommand = CommandModule.make_createimagefilterchain(\n filterChain,\n name: filterChainObjectName)\n theCommands.add_command(makeFilterChainCommand)\n theCommands.add_tocleanupcommands_closeobject(filterChainObject)\n renderFilterChain = MIFilterChainRender.new\n theRect = MIShapes.make_rectangle(xloc: \"0.25 * $imagewidth\",\n yloc: \"0.33 * $imageheight\",\n width: \"0.5 * $imagewidth\",\n height: \"0.4 * $imageheight\")\n variables = { :imagewidth => imageDims[:width],\n :imageheight => imageDims[:height] }\n renderFilterChain.sourcerectangle = theRect\n renderFilterChain.destinationrectangle = theRect\n# renderFilterChain.variables = variables\n makeRenderFilterChainCommand = CommandModule.make_renderfilterchain(\n filterChainObject, renderinstructions: renderFilterChain,\n createimage: true)\n theCommands.add_command(makeRenderFilterChainCommand)\n theCommands.variables = variables\n exporterName = SecureRandom.uuid\n pathtofile = File.join(Dir.tmpdir(), baseImageName)\n createExporterCommand = CommandModule.make_createexporter(pathtofile,\n export_type: :\"public.jpeg\",\n name: exporterName)\n exporterObject = SmigIDHash.make_objectid(objecttype: :imageexporter,\n objectname: exporterName)\n theCommands.add_command(createExporterCommand)\n theCommands.add_tocleanupcommands_closeobject(exporterObject)\n addImageToExporterCommand = CommandModule.make_addimage(exporterObject, \n windowObject, imageindex: 0)\n theCommands.add_command(addImageToExporterCommand)\n exportCommand = CommandModule.make_export(exporterObject)\n theCommands.add_command(exportCommand)\n Smig.perform_commands(theCommands)\n tempFile = File.join(Dir.tmpdir(), baseImageName)\n origFile = File.join($compareImageDir, baseImageName)\n unless AreImageFilesSame(origFile, tempFile, 3)\n # 10. Report if different.\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts \"Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n# exit 240\n ensure\n FileUtils.rm_f(tempFile) unless tempFile.nil?\n end\nend",
"def enhance_image(image)\n colors = image.get_pixels.flatten\n colors.map! { |color| color**2 / 255 }\n blob = colors.pack('C*') # Recreate the original image, credit to stackoverflow.com/questions/53764046\n image = MiniMagick::Image.import_pixels(blob, image.width, image.height, 8, 'rgb')\n image.statistic('mean', '6x6')\n image.threshold(threshold_percent)\n image.statistic('median', '9x9') # Replace with object discard below set size\n end",
"def draw_image(image, x1, y1, c)\n end",
"def executer_map(file_image)\n\t\tfile_niveau = file_image[0..file_image.length-4]\n\t\tfile_niveau +=\"nurikabe\"\n\n\t\t@window.hide()\n\t\tjeu = Jeu.new(plateau: Sauvegarde.charger_template(file_niveau), nom_joueur: @nom_joueur, temps_de_jeu: 0)\n\t\tputs jeu.affiche_toi\n\tend",
"def run!\n begin\n while line = Readline.readline(\"> \", true)\n keys = line.split\n\n case keys.first\n when \"X\" then exit\n when \"S\" then printf BitmapEditor::Tool::S.perform! bitmap,[]\n else BitmapEditor::Command.execute bitmap,keys\n end\n end\n \n rescue Error => e\n warn e.message\n retry\n rescue Interrupt\n exit\n end\n end",
"def imagemagick7?; end",
"def render(x, y, z)\n @image.draw(x, y, z)\n end",
"def transform(operator)\n case operator\n when :rotate_left then operator = \"-90\"\n when :rotate_right then operator = \"+90\"\n when :mirror then operator = \"-h\"\n else\n raise(\"Invalid transform operator: #{operator.inspect}\")\n end\n system(\"script/rotate_image #{id} #{operator}&\") unless Rails.env.test?\n end",
"def process_image(tmp)\n random = 2 + rand(10**24-10)+10\n path =\"public/data/\"\n file = File.join(path, random.to_s + \"-\" + params[:image][:filename].original_filename)\n\t\n\t#check extencion\n\t\text = File.extname(file)\n \tif ext.upcase == \".JPG\"\n \t\textfinal = \".jpg\"\n \t\timagevalid = true\n \telsif ext.upcase == \".JPEG\"\n \t\textfinal = \".jpg\"\n \t\timagevalid = true\n \telsif ext.upcase == \".GIF\"\n \t\textfinal = \".gif\"\n \t\timagevalid = true\n \telsif ext.upcase == \".PNG\"\n \t\textfinal = \".png\"\n \t\timagevalid = true\n \tend\t\n \t\n if imagevalid == true \n\t\n #Subo la imagen original recibida\n FileUtils.cp tmp.path, file\n\t\n\tarchivo_final = uploadoriginal(file,path)\n\t\n\t#utilizo su nombre\n\tfilenamethumb = random.to_s + \"-\" + params[:image][:filename].original_filename\n\t#width desired / ancho deseado\n\tw = 150\n\t#function call / llamada a la funcion\n\thubermann_thumbnail(path, filenamethumb,w,square=true, bw=true, q=99)\n\thubermann_thumbnail(path, filenamethumb,w,square=true, bw=false, q=99)\n\t\n\t\n\tFileUtils.rm file\n\t\n\t\n\t@image.filename = archivo_final\n\t#end unless valid image\n\telse\n\t@image.filename = nil\n\n\tend\nend",
"def transform(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15, &rendering_code); end",
"def operation(*args)\n src_file, out_file = args\n image = Vips::Image.new_from_file src_file\n image.tiffsave(out_file, **options)\n # Return lof if any\n end",
"def draw_and_save_image\n\t\tcolor = @avatar[:color]\n\t\tpng = ChunkyPNG::Image.new(250, 250, ChunkyPNG::Color::WHITE)\n\t\tcolor = ChunkyPNG::Color.rgba(color[:r], color[:g], color[:b], color[:alpha])\n\t\t@colorable_grid.each do |points|\n\t\t\tp1 = points[0]\n\t\t\tp2 = points[1]\n\t\t\tpng.rect(p1[0], p1[1], p2[0], p2[1] , color, color)\n\t\tend\n\t\tpng.save(File.join(Dir.pwd, \"/#{@term}.png\"), :interlace => true)\n\tend",
"def generate( type, *args )\n puts \"==> generate >#{type}< - with #{args.size} part(s) #{args.inspect}\"\n\n character = @chars[ type ]\n\n img = nil ## (by default) auto-derive width x height dimension from first image\n\n character.each_with_index do |(part_key, part),i|\n num = args[i]\n\n ## todo/check - double check if part required set to false - why? why not?\n next if num == 0 ## note: skip part if index is 0!!!\n\n attributes = if part.is_a?( Hash )\n part[:attributes]\n else ## assume array - \"inline\" compact attribute format\n part\n end\n\n attribute = attributes[ num-1 ] ## note: num starts counting at 1 (sub 1 for zero-based array index)\n raise ArgumentError, \"no >#{part_key}< part found for index #{num}; sorry\" if attribute.nil?\n\n print \"#{i} #{part_key} => #{num}\"\n print \" - #{attribute[:name]}\" if attribute.is_a?( Hash ) && attribute.has_key?( :name )\n print \"\\n\"\n\n\n img_part = if attribute.is_a?( Integer ) ## assume filename with num (as .png)\n path = \"#{@rootdir}/#{type}/#{part_key}/#{part_key}#{num}.png\"\n img_part = Image.read( path )\n elsif attribute.is_a?( Hash )\n if attribute.has_key?( :design )\n path = \"#{@rootdir}/#{attribute[:design]}.txt\"\n txt = File.open( path, 'r:utf-8') {|f| f.read }\n img_part = Image.parse( txt, colors: attribute[:colors] )\n else ## assume for now has key :path\n path = \"#{@rootdir}/#{attribute[:path]}.png\"\n img_part = Image.read( path )\n end\n else\n puts \"!! ERROR:\"\n pp part\n raise ArgumentError, \"unknown part data type; expected Integer|Hash\"\n end\n ## note: if (very) first part - auto-create empty image with size/dimensions from part\n img = Image.new( img_part.width, img_part.height ) if i==0\n img.compose!( img_part )\n end\n\n img\nend",
"def transform_image\n pass_query_params\n image = find_or_goto_index(Image, params[:id].to_s)\n return unless image\n\n if check_permission!(image)\n case params[:op]\n when \"rotate_left\"\n image.transform(:rotate_left)\n flash_notice(:image_show_transform_note.t)\n when \"rotate_right\"\n image.transform(:rotate_right)\n flash_notice(:image_show_transform_note.t)\n when \"mirror\"\n image.transform(:mirror)\n flash_notice(:image_show_transform_note.t)\n else\n flash_error(\"Invalid operation #{params[:op].inspect}\")\n end\n end\n if params[:size].blank? ||\n params[:size].to_sym == (@user ? @user.image_size : :medium)\n redirect_with_query(action: \"show_image\", id: image)\n else\n redirect_with_query(action: \"show_image\", id: image,\n size: params[:size])\n end\n end",
"def img(*) # :nodoc:\n raise \"no!\"\n end",
"def thumbnail!\n image.recreate_versions! if thumbnail_coordinates_changed?\n end",
"def imageDeSteg(password, image)\n # Suck in the image\n original_image = Magick::Image.read(image).first\n\n # Initialize the bits array\n bits = []\n\n # For each pixel in the image\n original_image.each_pixel do |pixel, col, row|\n # Set colors to their current value\n red = pixel.red\n green = pixel.green\n blue = pixel.blue\n\n # If the red value for the pixel is odd\n if (red%2 == 1)\n bits << 1\n else\n bits << 0\n end\n\n # If the green value for the pixel is odd\n if (green%2 == 1)\n bits << 1\n else\n bits << 0\n end\n\n # If the blue value for the pixel is odd\n if (blue%2 == 1)\n bits << 1\n else\n bits << 0\n end\n end\n\n # Initialize the encrypted_length_bits\n encrypted_length_bits = \"\"\n\n # For the first 256 characters in the array\n for counter in (0..255)\n # Append the value to the encrypted_length_bits\n encrypted_length_bits = encrypted_length_bits + bits[counter].to_s()\n end\n\n # Convert the binary encrypted length bits to a string\n encrypted_length = Stegg.convertBinaryToString(encrypted_length_bits)\n\n # Decrypt the encrypted length\n cipher = Gibberish::AES.new(password)\n length = cipher.decrypt(encrypted_length, :binary => true)\n\n # Initialize the encrypted_data_bits\n encrypted_data_bits = \"\"\n\n # Data starts at 256 and goes through the length\n last_bit = 255 + length.to_i()\n \n # For character 256 through the last bit\n for counter in (256..last_bit)\n # Append the value to the encrypted_data_bits\n encrypted_data_bits = encrypted_data_bits + bits[counter].to_s()\n end\n\n # Convert the binary encrypted data bits to a string\n encrypted_data = Stegg.convertBinaryToString(encrypted_data_bits)\n\n # Decrypt the encrypted data\n data = cipher.decrypt(encrypted_data, :binary => true)\n\n # Return the data\n return data\n end",
"def image_board(color_board) ; @board = color_board ; end",
"def image_board(color_board) ; @board = color_board ; end",
"def do_overlay_image(image, hash)\n #puts \"get image\"\n #puts \"#{hash.inspect}\"\n #puts \"Image: #{hash[:image_path]}\"\n #puts \"File exists? #{File.exists?(hash[:image_path])}\"\n overlay_i = Magick::ImageList.new(hash[:image_path]).first\n #puts \"Do we want to colorize?\"\n if hash.has_key? :colorize\n \n #opc = hash[:opacity]\n overlay_i = do_colorize(overlay_i, hash.merge({:opacity=>0.5})) #overlay_i.colorize(opc, opc, opc, hash[:colorize])\n end\n return image.composite(overlay_i, 0, image.rows-overlay_i.rows, Magick::OverCompositeOp)\n end",
"def draw x, y, imageMagick\n imageMagick.drawSquare(x,y)\nend",
"def transform(row_index,col_index)\n\n if row_index-1 >= 0\n @image[row_index-1][col_index] = 1\n end\n if col_index - 1 >= 0\n @image[row_index][col_index-1] = 1\n end\n if row_index + 1 <= @image.length - 1\n @image[row_index+1][col_index] = 1\n end\n if col_index + 1 <= @image[row_index].length - 1\n @image[row_index][col_index+1] = 1\n end\n\n end",
"def render_image\n render_image_iterm2\n end",
"def host\n self.image_path = Base64.encode64(\n SecureRandom.hex(10) + \n Time.now.to_i.to_s).chomp + \".jpg\"\n\n tempfile = Tempfile.new(image_path)\n file_path = tempfile.path\n\n system(\"wget --no-check-certificate \"\\\n \"-U '#{CONFIG[:user_agent]}' '#{orig_image_url}' \"\\\n \"-T 30 -t 3 \"\\\n \"--output-document '#{file_path}'\")\n\n\n if File.exists? file_path\n\n # Store original image\n #\n FileSystem.store(\n image_path,\n open(file_path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create tiny thumbnail\n #\n #image = MiniMagick::Image.open(file_path)\n\n #ImageUtilities.reduce_to_with_image(\n # image,\n # {:width => 180,:height => 180})\n\n #FileSystem.store(\n # thumbnail_path,\n # open(image.path),\n # \"Content-Type\" => \"image/jpeg\",\n # \"Expires\" => 1.year.from_now.\n # strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create square thumbnail\n #\n base = MiniMagick::Image.open(File.join(\n RAILS_ROOT,\n IMAGES[:white_200x200]))\n image = MiniMagick::Image.open(file_path)\n\n base = base.composite(image) do |canvas|\n canvas.gravity \"Center\"\n canvas.geometry \"200x200+0+0\"\n end\n\n FileSystem.store(\n square_path,\n open(base.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create blurred thumbnail\n #\n image = MiniMagick::Image.open(base.path)\n\n image.combine_options do |canvas|\n canvas.blur \"2.5x2.5\"\n end\n\n FileSystem.store(\n blur_path,\n open(image.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create giant thumbnail\n #\n image = MiniMagick::Image.open(file_path)\n\n ImageUtilities.reduce_to_with_image(\n image,\n {:width => 520,:height => 390})\n\n FileSystem.store(\n giant_path,\n open(image.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n\n # Create unit.\n #\n base = MiniMagick::Image.open(File.join(\n RAILS_ROOT,\n IMAGES[:fb_unit_base]))\n overlay = MiniMagick::Image.open(File.join(\n RAILS_ROOT,\n IMAGES[:fb_unit_overlay]))\n image = MiniMagick::Image.open(file_path)\n\n base = base.composite(image) do |canvas|\n canvas.quality \"100\"\n canvas.gravity \"Center\"\n canvas.geometry \"407x407+0+0\"\n end\n\n base = base.composite(overlay) do |canvas|\n canvas.quality \"100\"\n canvas.gravity \"NorthWest\"\n canvas.geometry \"54x54+447+19\"\n end\n\n FileSystem.store(\n unit_path,\n open(base.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n self.is_processed = true\n self.save!\n end\n\n rescue MiniMagick::Invalid => ex\n LoggedException.add(__FILE__,__method__,ex)\n end",
"def im_function(t,i,j)\n if t==0\n fd_loglike_cell_rho(i,j)\n elsif t>=1 and t<=@alpha.size\n fd_loglike_cell_a(i,j,t-1)\n elsif t>=@alpha.size+1 and t<=(@alpha.size+@beta.size)\n fd_loglike_cell_b(i,j,t-@alpha.size-1)\n else\n raise \"incorrect #{t}\"\n end\n end",
"def process_small_image\n small_image.encode!(:png).convert!('-resize 50x50 -gravity center -background none -extent 50x50')\n end",
"def transformations; end",
"def process_image(path)\n picture_name = File.basename(path)\n thumbnail_dir = File.join(File.dirname(path), \"thumbnails\")\n thumbnail_path = File.join(thumbnail_dir, \"#{File.basename(picture_name, File.extname(picture_name))}.jpg\")\n Dir.mkdir(thumbnail_dir) unless File.exist?(thumbnail_dir)\n\n image_optim = ImageOptim.new\n\n image = MiniMagick::Image.open(path)\n image_prop = {\n \"name\" => picture_name,\n \"thumb\" => \"thumbnails/#{picture_name}\",\n \"height\" => image.height,\n \"width\" => image.width\n }\n\n return image_prop if File.exist?(thumbnail_path)\n\n# -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace RGB\n\n image.format \"jpeg\" unless File.extname(picture_name) == \"jpg\"\n image.combine_options do |b|\n b.resize \"#{MAX_DIMENSION}>\"\n b.sampling_factor \"4:2:0\"\n b.strip\n b.interlace \"JPEG\"\n b.colorspace \"RGB\"\n b.quality 85\n end\n image.write thumbnail_path\n\n image_optim.optimize_image!(path)\n image_optim.optimize_image!(thumbnail_path)\n\n image_prop\nend",
"def perform\n @bitmap.width = @x_axis\n @bitmap.height = @y_axis\n @bitmap.generate_pixels\n end",
"def putImage(theWidth, theHeight, theImage)\n\n\tputs \"Raw Image:\";\n\tputs theImage.join();\n\t\n\t\n\tputs \"\"\n\tputs \"Bitmap Image:\"\n\tn = 0;\n\n\t0.upto(theHeight - 1) do |y|\n\t\t0.upto(theWidth - 1) do |x|\n\t\t\tprint (theImage[n] == 1) ? '#' : ' ';\n\t\t\tn += 1;\n\t\tend\n\t\tputs \"\";\n\tend\n\nend",
"def preview\n if params[:image].present?\n app = Dragonfly.app\n image = params[:image]\n content = Dragonfly::Content.new(app, image)\n uid = app.store(content)\n @image = app.fetch(uid)\n attrs = {uid: uid, name: image.original_filename, width: @image.width, height: @image.height}\n @retained_image = Dragonfly::Serializer.json_b64_encode(attrs)\n @colors = Miro::DominantColors.new(params[:image].tempfile).to_hex\n end\n\n render layout: false\n end",
"def generate_test_image(file, params = {})\n # Set default size for sample test image.\n line_size = 1\n box_size = 6\n width = (box_size * 6) + (line_size * 7)\n height = (box_size * 5) + (line_size * 6)\n\n # Set parameters for image creation options.\n image_type = params[:image_type] || File.extname(file)\n bands = params[:bands] || 3\n color = params[:color] || 'rgb'\n depth = params[:depth] || 8\n cg_type = params[:cg_type] || 'adobe_rgb'\n compression = params[:compression]\n profile = params[:profile]\n\n temp_array = color_gauge_values(cg_type)\n temp_image = Vips::Image.black(width, height, bands: temp_array.first.size)\n 5.times do |i|\n b = (box_size * i) + (line_size * (i + 1))\n # d = b + box_size - line_size\n 6.times do |j|\n a = (box_size * j) + (line_size * (j + 1))\n # c = a + box_size - line_size\n colors = temp_array.shift\n temp_image = temp_image.draw_rect(colors, a, b, box_size, box_size, fill: true)\n end\n end\n\n temp_image = color.eql?('cmyk') ? temp_image.copy(interpretation: :cmyk) : temp_image.copy(interpretation: :srgb)\n\n temp_image = if color.eql?('grey') && bands == 3\n mean = temp_image.bandmean\n Vips::Image.bandjoin([mean, mean, mean])\n elsif color.eql?('grey') && bands == 1\n temp_image.bandmean\n elsif color.eql?('bin') && bands == 3\n mean = temp_image.bandmean < 128\n Vips::Image.bandjoin([mean, mean, mean])\n elsif color.eql?('bin') && bands == 1\n temp_image.bandmean < 128\n else\n temp_image\n end\n\n options = {}\n unless profile.nil?\n profile_file = File.join(Assembly::PATH_TO_IMAGE_GEM, 'profiles', \"#{profile}.icc\")\n options.merge!(profile: profile_file)\n end\n\n case image_type\n when '.tiff', '.tif'\n options.merge!(compression: compression) unless compression.nil?\n options.merge!(squash: true) if depth.eql?(1)\n temp_image.tiffsave(file, **options)\n when '.jpeg', '.jpg'\n temp_image.jpegsave(file, **options)\n else\n raise \"unknown type: #{image_type}\"\n end\nend",
"def reboot\n img = ['blue_flower', 'red_flower', 'white_flower', 'pink_flower'].sample\n @image = Gosu::Image.new window, 'images/flowers/' + img +'.png', true\n @drawing = true\n end",
"def convert_image\n i = 0 \n main = [small\t=\t[\"jpg\",\"small\",240,160], \n\t medium\t=\t[\"jpg\",\"medium\",640,427], \n\t large\t=\t[\"jpg\",\"large\",1024,683]]\n while i < main.count\n # Runs the resize function with params to each size\n resize_image(main[i])\n i +=1\n end\n end",
"def copy_water(src, srcId, dest, destId, origin, target, animId)\n #We need the tile's offset within its block.\n srcPt = [ animId*16 , srcId*16 ]\n\n #Are we doing full tiles, or quadrants?\n if destId.is_a? Array\n #Give it an offset\n destId = destId.map{|id| id+= 8}\n elsif destId==0\n destId = [0,1,4,5] #Make it an array\n elsif destId==1\n destId = [2,3,6,7] #Make it an array\n else\n raise \"Unknown water permutation\"\n end\n\n #Turn this into a series of destination points:\n destPts = []\n destId.each{|pt|\n destPts.push [(pt%4)*16 + animId*64 , (pt/4)*16]\n }\n\n #Now, copy it and magnify it.\n srcId = 0\n destPts.each {|pt|\n for x in (0...8)\n for y in (0...8)\n for iX in (0...2) \n for iY in (0...2)\n srcVal = src[origin[0]+srcPt[0]+8*(srcId%2)+x,origin[1]+srcPt[1]+8*(srcId/2)+y]\n destXY = [target[0]+pt[0]+2*x+iX,target[1]+pt[1]+2*y+iY]\n dest[destXY[0], destXY[1]] = srcVal\n end\n end\n end\n end\n srcId += 1\n }\nend",
"def convert_to_images(arr,rows,cols)\n canvas = ChunkyPNG::Canvas.new(28, 28, ChunkyPNG::Color::TRANSPARENT)\n canvas.grayscale!\n \n for i in 0..arr.length-1 do\n for j in 0..rows-1 do\n for k in 0..cols-1 do\n canvas[j,k] = arr[i][((cols+1)*j)+k]\n end\n end\n canvas.save(\"F:\\\\Projects\\\\YetAnotherAnn\\\\filename#{i}.png\", :interlace => true)\n end\nend",
"def forecast(temp, img)\n\n @image = img\n\n def image\n @image\n end\n @degrees = temp\n def results\n if @degrees.to_i < 70 && @degrees.to_i >= 40\n \"you better bring a jacket, it is going to be #{@degrees} degrees today.\"\n elsif @degrees.to_i < 40\n \"dude, its freezing. #{@degrees} degrees and not getting any hotter\"\n else\n \"grab your sunscreen, it's going to be #{@degrees} degrees today.\"\n end\n end\n save_forecast(results, image)\n end",
"def transform_image # :norobots:\n pass_query_params\n if image = find_or_goto_index(Image, params[:id].to_s)\n if check_permission!(image)\n if params[:op] == 'rotate_left'\n image.transform(:rotate_left)\n flash_notice(:image_show_transform_note.t)\n elsif params[:op] == 'rotate_right'\n image.transform(:rotate_right)\n flash_notice(:image_show_transform_note.t)\n elsif params[:op] == 'mirror'\n image.transform(:mirror)\n flash_notice(:image_show_transform_note.t)\n else\n flash_error(\"Invalid operation #{params[:op].inspect}\")\n end\n end\n if params[:size].blank? or\n params[:size].to_sym == (@user ? @user.image_size : :medium)\n redirect_to(:action => 'show_image', :id => image, :params => query_params)\n else\n redirect_to(:action => 'show_image', :id => image, :params => query_params,\n :size => params[:size])\n end\n end\n end",
"def blur_image(distance)\r\n @length = @image.length\r\n @width = 0\r\n @image.each do |x|\r\n x.each do |cell|\r\n @width += 1\r\n end\r\n end\r\n i = 0\r\n j = 0\r\n n = distance\r\n while n > 0\r\n i = 0\r\n j = 0 \r\n while i < @length\r\n j = 0\r\n while j < @width\r\n if @image[i][j] == 1\r\n\r\n # This looks down from the rows\r\n if i < @length - 1\r\n if @image[i+1][j] == 0\r\n @image[i+1][j] = 2\r\n end\r\n end\r\n\r\n # This looks up from the rows\r\n if i > 0 && @image[i-1][j] == 0\r\n @image[i-1][j] = 2 \r\n end\r\n\r\n # This looks to the right until it gets to the end.\r\n if @image[i][j+1] == 0\r\n @image[i][j+1] = 2\r\n end\r\n\r\n # This looks to te left. I tried to set this so it will never look over the side of the array.\r\n # I'm afraid of what might happen if my program does that too muc.\r\n if j > 0 && @image[i][j - 1] == 0\r\n @image[i][j - 1] = 2\r\n end\r\n end\r\n j += 1\r\n end\r\n i += 1\r\n end\r\n # This code goes back through the array and turns the temporary shade values into 1s for output.\r\n i = 0\r\n j = 0\r\n while i < @length\r\n j = 0\r\n while j < @width\r\n if @image[i][j] == 2\r\n @image[i][j] = 1\r\n end\r\n j += 1\r\n end\r\n i += 1\r\n end\r\n n -= 1\r\n puts n\r\n end\r\n \r\n puts \"Inside blur_image\\n\"\r\n puts \"\\n\"\r\n end",
"def init_tile_image\n list = Magick::ImageList.new(\"/Users/pmenke/git/eq2_tiler/resources/tiler/overlay-base.png\")\n @i = list.first\n @i\n end",
"def create_image(scale)\n # find the image size\n size = CGSizeMake(WIDTH * scale, HEIGHT * scale)\n # make the image bitmap and draw all of the parts\n image_bitmap(size, scale)\n end",
"def I(args)\n return unless check_dimensions(args, 2)\n cols, rows = check_integers(args)\n return unless rows\n @image = Image.new(cols, rows)\n end",
"def image\n\n end"
] |
[
"0.8024423",
"0.61971647",
"0.603823",
"0.5593634",
"0.5545068",
"0.544241",
"0.5428038",
"0.5422069",
"0.54058564",
"0.53944397",
"0.5392597",
"0.53772104",
"0.5342874",
"0.53412926",
"0.5339355",
"0.53358465",
"0.5324483",
"0.53177506",
"0.5305924",
"0.52995396",
"0.5263042",
"0.52518874",
"0.52285695",
"0.52262557",
"0.5223596",
"0.5223176",
"0.52122784",
"0.5203436",
"0.5203423",
"0.51963145",
"0.5187479",
"0.51799875",
"0.51773036",
"0.5176356",
"0.5150813",
"0.51469857",
"0.5134384",
"0.51327384",
"0.51272434",
"0.5115979",
"0.5104135",
"0.508991",
"0.5081274",
"0.50780374",
"0.5053685",
"0.50534314",
"0.501747",
"0.5010955",
"0.5000325",
"0.49933088",
"0.49914983",
"0.4988057",
"0.49838006",
"0.49733052",
"0.4972904",
"0.49693647",
"0.4964853",
"0.49596396",
"0.49434197",
"0.49286112",
"0.49249834",
"0.4922742",
"0.49150205",
"0.49114743",
"0.4908014",
"0.49031729",
"0.48863536",
"0.48859438",
"0.4882606",
"0.48753905",
"0.48738378",
"0.4873021",
"0.4866073",
"0.48587486",
"0.48555577",
"0.48555577",
"0.4853466",
"0.48528957",
"0.48350382",
"0.48263648",
"0.48195237",
"0.48087943",
"0.4804171",
"0.48009273",
"0.4794288",
"0.47924098",
"0.4791617",
"0.4790383",
"0.47887838",
"0.47881892",
"0.47799534",
"0.47732142",
"0.477106",
"0.47702125",
"0.47587165",
"0.47485736",
"0.4745397",
"0.47430772",
"0.47403842",
"0.47393954"
] |
0.7781661
|
1
|
def sum_array(integers) integers.reduce(:+) end
|
def sum_array(integers)
integers.inject {|sum, n| sum + n}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sum_array(int_array)\n int_array.reduce(:+)\nend",
"def sum_array(integers)\n integers.sum\nend",
"def sum_array(integers)\n integers.inject(0) { |result, element| result + element }\nend",
"def sum(array_of_integers)\n # TODO\nend",
"def sum_array(array)\n array.reduce(:+)\nend",
"def sum_array(numbers)\n return numbers.sum()\nend",
"def array_sum(arr)\n arr.reduce(:+)\nend",
"def array_sum(arr)\n arr.reduce(:+)\nend",
"def sum_array( numbers )\r\n numbers.inject(0, :+)\r\nend",
"def sum(array)\n array.map(&:to_i).reduce(0, :+)\nend",
"def sum(array)\n\tarray.reduce(:+)\nend",
"def array_sum(arr)\n arr.reduce(0, :+)\nend",
"def array_sum(arr)\n arr.reduce(0, :+)\nend",
"def array_sum(arr)\n arr.reduce(0, :+)\nend",
"def array_sum(arr)\n arr.reduce(:+)\n\nend",
"def array_sum(arr)\n return arr.reduce(0, :+)\nend",
"def sum(array)\n\treturn array.reduce(:+)\nend",
"def sum_array(any_array)\n any_array.inject(:+)\n end",
"def simple_array_sum arr\n arr.reduce(:+)\n end",
"def total(array_of_numbers)\n return array_of_numbers.reduce(:+)\nend",
"def sum arr\n arr.reduce(0, :+)\nend",
"def array_sum(arr)\n arr.reduce(0) {|sum, el| sum + el}\nend",
"def sum arr\n arr.reduce(0, :+)\nend",
"def sum(array)\n array.reduce(0) {|sum, num| sum += num}\nend",
"def sum(in_array)\n return 0 if in_array.length == 0\n return in_array.reduce(:+)\nend",
"def sum (array)\n y=array.inject(:+).to_i\nend",
"def sum_array(numbers)\n total = 0\n for number in numbers\n total = total + number\n end\n return total\nend",
"def sum(arr)\n arr.reduce(0, :+)\nend",
"def total_of_array(array)\n array.reduce(:+)\nend",
"def simpleArraySum(ar)\n return ar.map(&:to_i).sum\nend",
"def array_sum(array)\r\n array.inject(0, :+)\r\nend",
"def sum array\n\tsum = 0\n\tarray.each do |number|\n\t\tsum = sum + number\n\tend\n\tsum\nend",
"def sum_values(arr)\n arr.inject(:+)\n end",
"def sum(numbers)\n numbers.reduce(&:+)\n end",
"def sum_of array\n# add the numbers of the array, these are three different ways I found\n array.inject{ |sum, value| sum += value}\n # or\n # array.map(&:to_i).reduce(0, :+)\n # or\n # array.sum\nend",
"def total(an_array)\n an_array.reduce(:+)\nend",
"def sum_of_sums(array)\n sum = 0\n sum_array = array.map { |x| sum += x }\n sum_array.inject(:+)\nend",
"def sum_array(array)\n sum = 0\n array.each do |number|\n sum += number\n end\n sum\nend",
"def sum_array(array)\n sum = 0\n\n array.each do |number|\n sum += number\n end\n\n return sum\nend",
"def sum_array(array)\n sum = 0\n array.each{ |num| sum += num }\n sum\nend",
"def sum(array)\n return array.inject(0, &:+)\nend",
"def sum_array(array)\n\tarray.inject { |sum, n| sum + n }\nend",
"def sum_array(array)\n sum = 0\n array.each do |value|\n sum += value\n end\n sum\nend",
"def sum_array(array)\n array.sum\nend",
"def sum_array(array)\n sum = 0\n array.each do |x|\n sum += x\n end\n return sum\nend",
"def add_all_numbers(array)\n array.inject(:+)\nend",
"def sum_array(array)\n sum = 0\n array.each do |num|\n sum += num\n end\n sum\nend",
"def sum_array(array)\n\tarray.inject do |sum, n| sum + n\n\tend\nend",
"def sum(array)\n array.inject(0, :+)\nend",
"def sum_array(array)\n sum = 0\n array.each do |num|\n sum = sum + num\n end\n sum\nend",
"def sum (integers)\n\t# return integers.inject(0){|sum_, num| sum_ += num}\n\tsum_ = 0\n\tintegers.each {|i| sum_ += i}\n\treturn sum_\nend",
"def sum (arr)\n\treturn arr.inject(0, :+)\nend",
"def sum_array(array)\n array.sum\nend",
"def sum(array)\n array.reduce(0) {|base, ele|\n base+=ele\n }\n end",
"def total_of_array(array)\n array.inject(&:+)\nend",
"def sum_array(array)\n total = 0\n array.each do |num|\n total += num\n end\n total\nend",
"def sum(array)\n array.inject(0){|sum, n| sum + n}\n end",
"def sum_of_sums(int_arr)\n sum = 0\n current_numbers = []\n int_arr.each { |int|\n current_numbers << int\n sum += current_numbers.sum\n }\n sum\nend",
"def sum(array)\n\ttotal = 0\n\tfor number in array #could do each do instead of for loop\n\t\ttotal += number\n\tend\n\treturn total\nend",
"def sum_of_arr(arr)\n arr.inject(:+)\nend",
"def sum_array(array)\n sum = 0\n array.each do |element|\n sum += element\n end\n sum\nend",
"def sum(array)\n sum = 0\n\n array.each { |number|\n sum += number\n }\n\n return sum\nend",
"def sum(*integers)\n array = []\n array.push(*integers)\n array.reject! {|num| num.class !=Fixnum}\n sum = 0\n array.each {|num| sum += num}\n sum\nend",
"def sum(numbers)\r\n numbers.reduce(0, :+)\r\nend",
"def total array\n array.reduce(0, :+)\nend",
"def add_array_numbers(array)\n result = array.sum\n # .sum cannot be used on a string, only integars and floats\n return result\nend",
"def sum arr\n arr.reduce 0, :+ # reduce method is clearlier than inject. from 0 add to +:\nend",
"def sum(array)\n array.reduce(0, :+)\n=begin\n res =0\n array.each { |a| res += a }\n res.to_i\n=end\nend",
"def sum(arr)\n arr.inject(:+)\nend",
"def sum(array)\n\n raise 'array includes non integers' unless \n (array.empty? || array.all? { |x| x.integer?})\n \n array.reduce(0,:+)\n \nend",
"def sum(arr)\n arr.reduce {|a,b| a+b}\n #correction : arr.reduce(:+,0) marche aussi\nend",
"def sum_array(array)\n sum = 0\n array.each do |num|\n sum+=num\n end\n sum\nend",
"def total(array_of_numbers)\n sum = 0\n array_of_numbers.each do |num|\n sum += num\n end\n return sum\nend",
"def sum_array(array)\n sum = 0\n array.each do |i|\n sum+=i\n end\n sum\nend",
"def sum_array (arr)\n result = 0\n arr.each do |value|\n result +=value\n end\n result\nend",
"def sum_array(array)\n the_sum_of_array = array.sum\n the_sum_of_array\nend",
"def arraysum\n return self.inject(0){|acc,i|acc +i}\n end",
"def array_sum(arr)\n return 0 if arr.empty?\n\n arr.reduce(&:+)\nend",
"def sum_array(array)\n return array.sum\n\n # sum_total_of_array = 0\n # for number in array\n # sum_total_of_array += number\n # end\n # return sum_total_of_array\nend",
"def sum_array(array)\n array.inject { |sum,n| sum + n }\nend",
"def array_sum(arr)\n return 0 if arr.empty?\n arr.reduce(:+)\nend",
"def array_sum(arr)\n return 0 if arr.empty?\n arr.reduce(:+)\nend",
"def total(array)\n sum = array.inject(:+)\n sum\nend",
"def sum array \n array.inject { |a,b| a + b }\nend",
"def sum arr\n return arr.inject(0, :+)\nend",
"def sum arr\n arr.inject(0,:+)\nend",
"def sum arr\n arr.inject(0,:+)\nend",
"def sum(numbers)\n\tresult = 0\n\tnumbers.collect do |i|\n\tresult += i if i.is_a? Integer\n\tend\n\tresult\nend",
"def add_array(array)\n sum = 0\n for i in array do\n sum += i\n end\n sum\nend",
"def it_arr_sum(array)\r\n sum = 0\r\n array.each {|ele| sum += ele}\r\n return sum\r\nend",
"def sum(array)\n sum = 0\n array.each do |num|\n sum += num\n end\n sum\nend",
"def sum_array(array)\n array.inject { |sum, x| sum + x }\nend",
"def sum(array)\n sum = 0\n array.each { |n| sum += n } \n sum\nend",
"def sum_array a\n t = 0\n a.each{|i|t+=i.to_i}\n [a,t]\nend",
"def sum(array)\n sum = 0\n array.each do |a|\n sum += a\n end\n return sum\nend",
"def sum(theArray)\n\ttotal = 0\n\ttheArray.each do |i|\n\t\ttotal = total + i\n\tend\n\treturn total\nend",
"def array_sum(arr)\n if arr.length == 0\n return 0\n end\n arr.reduce(:+)\nend",
"def array_sum(arr)\n\tsum = 0\n\n\t# an for each loop\n\tfor i in arr\n\t\tsum += i\n\tend\n\t\n\treturn sum\n\t\nend",
"def sum arr\n sum_array = 0 \n arr.each { |x| sum_array = sum_array + x } \n return sum_array\nend",
"def suma_arreglo(array)\n array.reduce(:+)\nend"
] |
[
"0.9350951",
"0.91094023",
"0.9014119",
"0.881848",
"0.8803113",
"0.8761558",
"0.8730734",
"0.8730734",
"0.8712161",
"0.8689692",
"0.86758107",
"0.86166435",
"0.86166435",
"0.86166435",
"0.8608621",
"0.85716164",
"0.8562582",
"0.8512822",
"0.8482392",
"0.8468634",
"0.8426987",
"0.8426124",
"0.8425453",
"0.8400337",
"0.8386628",
"0.8382504",
"0.8378715",
"0.83773184",
"0.8377147",
"0.83753407",
"0.8360147",
"0.8344914",
"0.8323452",
"0.8318894",
"0.829633",
"0.82801324",
"0.8261361",
"0.82594454",
"0.8258878",
"0.82490546",
"0.82427996",
"0.8240908",
"0.82151616",
"0.8205463",
"0.8202195",
"0.81962425",
"0.8195819",
"0.8195712",
"0.8191874",
"0.81876224",
"0.8179275",
"0.8176009",
"0.8171879",
"0.8162905",
"0.8162652",
"0.81605566",
"0.8153866",
"0.8153211",
"0.8148215",
"0.8143524",
"0.81417596",
"0.8139472",
"0.8125256",
"0.8122202",
"0.81151694",
"0.81137395",
"0.8110052",
"0.81055313",
"0.8103983",
"0.810174",
"0.8085546",
"0.8085022",
"0.8077477",
"0.80773354",
"0.80632776",
"0.8045683",
"0.80455273",
"0.8043845",
"0.8043189",
"0.8040837",
"0.8037525",
"0.8037525",
"0.8037486",
"0.8037402",
"0.8035887",
"0.8031899",
"0.8031899",
"0.8028463",
"0.8027677",
"0.802427",
"0.8015506",
"0.80145603",
"0.8007814",
"0.8005885",
"0.79986525",
"0.7998038",
"0.79961586",
"0.7995014",
"0.7993709",
"0.7993023"
] |
0.88204783
|
3
|
Return the number of product attributes that this product has.
|
def attribute_count
product_family.product_attributes.size
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def number_of_attributes\n\t\treturn self.attributes.size\n\tend",
"def size\n @components.values.inject(0) { |component_count, attribute| component_count + attribute.size }\n end",
"def size\n attribute_prop(3)\n end",
"def count\n @attributes['count']\n end",
"def size\n self.attributes.length\n end",
"def num_attributes_remaining item_name\n num_attributes_used = @@sdb.get_attributes(@table_name, item_name)[:attributes].length\n return SDB_MAX_NUM_CHUNKS - num_attributes_used\n end",
"def product_size(product)\n size_attributes = %w[size coats jacket denim knits leather overcoats ties t_shirts scarves shirts]\n size = ''\n\n size_attributes.each do |attr|\n size += product.attribute_value(attr).to_s\n end\n\n return size\n end",
"def product_item_counts\n return @product_item_counts\n end",
"def size\n count = 0\n @properties.each do |gid, values|\n if ! values.empty?\n count += 1\n end\n end\n return count\n end",
"def product_count\n\t @cached_product_count ||= self.products.count\n\tend",
"def size_of attr\n real_attr = attribute_for attr\n raise LookupFailure.new(self, attr) unless real_attr\n AX.attr_count_of_element @ref, real_attr\n end",
"def count_passing\n return self.passing_products.size\n end",
"def users_count\n @attributes[:users_count]\n end",
"def count_tested\n return self.tested_products.size\n end",
"def api_keys_count\n @attributes[:api_keys_count]\n end",
"def number_of_products(product)\n @basket[product.to_s]\n end",
"def quantityFields\n return @elements.length\n end",
"def total_products_count\n products.inject(0) { |count, product| count + product.count.to_i }\n end",
"def collect_values_with_count\n\t\tvalues = Hash.new {|h,k| h[k]=0}\n\t\tself.class.ecore.eAllAttributes.each do |a|\n\t\t\tv = self.send(:\"#{a.name}\")\n\t\t\tif v!=nil\n\t\t\t\tif a.many\n\t\t\t\t\tv.each {|el| values[el]+=1}\n\t\t\t\telse\n\t\t\t\t\tvalues[v]+=1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tvalues\t\t\t\n\tend",
"def item_count\n return @item_count\n end",
"def size\n @errors.values.inject(0) { |error_count, attribute| error_count + attribute.size }\n end",
"def size\n @errors.values.inject(0) { |error_count, attribute| error_count + attribute.size }\n end",
"def size\n @errors.values.inject(0) { |error_count, attribute| error_count + attribute.size }\n end",
"def length\n metadata[:length]\n end",
"def count_failing\n return self.failing_products.size\n end",
"def max_uses\n @attributes[:max_uses]\n end",
"def domain_count\n @attributes[:domain_count]\n end",
"def list_attributes\n if @attributes.empty?\n fetch_configuration()\n end\n return @attributes.keys\n end",
"def product_count\n self.items.inject(0) {|sum, item| sum + item.quantity}\n end",
"def product_item_counts=(value)\n @product_item_counts = value\n end",
"def items_count\n counter = 0\n self.line_items.each do |item|\n counter += item.quantity\n end\n counter\n end",
"def number_of_pets\n @pets.keys.count\n end",
"def number_of_sales\n product_sales = self.sales\n num_of_sales = product_sales.length\n return num_of_sales\n end",
"def Count()\n _getproperty(1, [], [])\n end",
"def length()\n return self.keys.get_length()\n end",
"def size\n @count\n end",
"def size\n @count\n end",
"def compliant_device_count\n return @compliant_device_count\n end",
"def item_count\n @item_count\n end",
"def count\n properties[\"x-dura-meta-space-count\"].to_i\n end",
"def length\n length = 1 #@primary\n length += @extlang.length if @extlang\n length += 1 if @script\n length += 1 if @region\n length += @variants.length if @variants\n @extensions.each { |_,e| length += e.length+1 } if @extensions # length += @extenstions.to_a.flatten.length if @extensions\n length += @privateuse.length+1 if @privateuse\n length\n end",
"def item_count\n @items.length\n end",
"def height\n attributes.map { |field| field.height }.max\n end",
"def count\n @type_variants.values.reduce(0) { |m, o| m + o.size }\n end",
"def items_count\n counter = 0\n self.line_items.each do |item|\n if item.sellable && item.sellable.respond_to?(:quantity)\n counter += item.sellable.quantity\n else\n counter += 1\n end\n end\n counter\n end",
"def count\n to_a.size\n end",
"def count\n to_a.size\n end",
"def length\n @driver_instance.count_list_value(@key)\n end",
"def attributes\n super.merge({\n :advanced_servos => advanced_servos.size,\n })\n end",
"def size\n\n DataMapper.repository(@dm_repository) { DmExpression.count }\n end",
"def items_count\n counter = 0\n self.line_items.each do |item|\n if item.sellable && item.sellable.respond_to?(:quantity)\n counter += item.sellable.quantity\n else\n counter += 1\n end\n end\n counter\n end",
"def not_applicable_count\n return @not_applicable_count\n end",
"def productsCount\r\n rows = CSV.parse(open(self.data_file.path).read, :col_sep => separatorChar)\r\n\t\t\t#rows = CSV.parse(open(self.data_file.url).read, :col_sep => \",\", :quote_char => \"'\")\r\n return rows.count\r\n end",
"def length\n @count\n end",
"def num_fields\n @fields.size\n end",
"def size_of attr\n real_attr = attribute_for attr\n raise Accessibility::LookupFailure.new(self, attr) unless real_attr\n size_of real_attr, for: @ref\n end",
"def size\n self.data.keys.size\n end",
"def attributes\n self.class.attributes + numeric_attrs\n end",
"def narray_attributes\n @attributes.select(&:narray?)\n end",
"def count\n Dynamoid.adapter.count(table_name)\n end",
"def count\n Dynamoid.adapter.count(table_name)\n end",
"def number_of_calories\n self.ingredients.sum(\"calories\")\n end",
"def value_count\n $capitals.values.length\nend",
"def size\n @bindata.size\n end",
"def count\n @item_list.size\n end",
"def columns_count\n @columns.size\n end",
"def length_in_long_words\n return @bits.attr_length\n end",
"def product_count(product_to_find)\n product_count_helper = 0\n @products.each do |z|\n if z.name == product_to_find.name\n product_count_helper += 1\n end\n end\n product_count_helper\n end",
"def length(include_deleted = false)\n values(include_deleted).length\n end",
"def not_applicable_device_count\n return @not_applicable_device_count\n end",
"def number_in_set(game = @owner.game)\n\t\t\tproperties_in_set(game).count\n\t\tend",
"def item_count\n self.line_items.inject(0) { |total, line_item| total + line_item.quantity }\n end",
"def length()\n return @i_keys.get_length()\n end",
"def device_count\n return @device_count\n end",
"def device_count\n return @device_count\n end",
"def device_count\n return @device_count\n end",
"def device_count\n return @device_count\n end",
"def items_count\n @items_count ||= @relation.count\n end",
"def firm_specified_count(firm)\n return 0 if firm.blank?\n\n @firm_project_products[firm.name] ||= firm.project_products.where(:product_id => self.id)\n\n specified_products = @firm_project_products[firm.name].where(:status => ProjectProduct::Status[:specified])\n\n specified_products.count\n end",
"def animal_count\n @inventory.length\n end",
"def length\n count\n end",
"def total_count()\n @raw_data.size\n end",
"def length\r\n self.count\r\n end",
"def number_of_sales\n product_array = array_of_instances(FarMar::Sale.all, \"product_id\", product_id)\n\n return product_array.length\n end",
"def length\n hash.keys.length\n end",
"def field_count\n @fields.size\n end",
"def model_device_count\n return @model_device_count\n end",
"def size\n\n self.to_h.size\n end",
"def total_count\n @all.size\n end",
"def predictionCount\r\n\t\t@predictionSet.length\r\n\tend",
"def total_entities\n @methods.length +\n @classes.length +\n @modules.length +\n @attrs.length +\n @constants.length\n end",
"def size\n num_geometries\n end",
"def non_compliant_device_count\n return @non_compliant_device_count\n end",
"def product_tot_purchases(array_item)\n\tarray_item[\"purchases\"].length\nend",
"def size\n self[:size]\n end",
"def count\n @hash_tags.count\n end",
"def size\n @items.count\n end",
"def size\n @items.count\n end",
"def count\n @obj['count'].to_i\n end",
"def count\n self[:count].to_i\n end"
] |
[
"0.79098463",
"0.73364174",
"0.7141863",
"0.70986485",
"0.7070723",
"0.6916319",
"0.678782",
"0.67702943",
"0.6620325",
"0.65641475",
"0.6558307",
"0.6384833",
"0.6285418",
"0.6226002",
"0.62084836",
"0.6202754",
"0.6170388",
"0.6089106",
"0.60841715",
"0.6077765",
"0.60033655",
"0.59671533",
"0.59671533",
"0.59464306",
"0.5926132",
"0.5918618",
"0.5897096",
"0.5887061",
"0.58858174",
"0.58667004",
"0.5865262",
"0.58565944",
"0.585121",
"0.5847942",
"0.583911",
"0.58120733",
"0.58120733",
"0.5805842",
"0.57929355",
"0.57805705",
"0.57783556",
"0.5768816",
"0.5758071",
"0.57533294",
"0.57403696",
"0.5735673",
"0.5735673",
"0.57291514",
"0.5726836",
"0.57220584",
"0.57201964",
"0.5718023",
"0.5716065",
"0.5712992",
"0.56767637",
"0.5676023",
"0.5674713",
"0.5671985",
"0.56619835",
"0.5659493",
"0.5659493",
"0.56582195",
"0.5657284",
"0.5653345",
"0.56515217",
"0.56453276",
"0.5644448",
"0.5644068",
"0.5643998",
"0.5640752",
"0.56364286",
"0.5629367",
"0.5621314",
"0.5619118",
"0.5619118",
"0.5619118",
"0.5619118",
"0.5614155",
"0.5610037",
"0.5598024",
"0.5596374",
"0.5589776",
"0.5587036",
"0.55868495",
"0.55859566",
"0.5585696",
"0.5585043",
"0.5584865",
"0.5582312",
"0.557106",
"0.5570163",
"0.5569248",
"0.556915",
"0.55678177",
"0.5567141",
"0.5562487",
"0.55612165",
"0.55612165",
"0.555904",
"0.55588615"
] |
0.8764938
|
0
|
Setter method for the 'internal' price of a product. This is not an attribute, only a field of the product model itself.
|
def price=(value)
if value.instance_of?(String)
cents = MoneyUtils.parse(value)
else
begin
cents = Integer(value)
rescue
cents = nil
end
end
if cents
self.price_basis = cents
else
errors.add(:price_basis, "price can't be empty")
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_price\n\t\tif persisted?\n\t\t\tself[:price]\n\t\telse\n\t\t\tproduct.price\n\t\tend\n\tend",
"def price= price\n if User.current and User.current.currency\n converted_price = (price.to_d / User.current.currency.exchange_rate.to_d).to_d\n else\n converted_price = price\n end\n write_attribute(:price, converted_price)\n self.price_with_vat = calculate_price_with_vat\n end",
"def price=(new_price)\n\t\t@price = new_price\n\tend",
"def price\n raise 'Redefine this method in your billing model.'\n end",
"def price\n raise 'Redefine this method in your billing model.'\n end",
"def original_price\n self.read_attribute(:price)\n end",
"def price\n return 0 unless self.persisted?\n\n return product.master.price if with_master_price?\n\n default_price.price\n end",
"def set_price\n self.product = Product.find(orderable_id)\n self.unit_price = product.price\n end",
"def set_selling_price(selling_price)\n\t\t\t@price = selling_price\n\t\tend",
"def set_price\n course = Course.find(self.course_id)\n self.price = course.price\n end",
"def set_price(price)\n @price = price\n if self.is_offer?\n self.safe.return\n self.safe.fill(self.owner, self.price)\n end\n end",
"def original_price\n @price || item.price\n end",
"def price=(price)\n if price.present?\n self[:price] = price.to_s.gsub(/[^0-9\\.-]/, '').to_f\n end\n end",
"def sale_price=(value)\n unless value.is_a?(Numeric)\n raise ArgumentError.new(\"A product's sale price must be numeric if it is on sale.\") if self.on_sale?\n value = 0\n end\n @sale_price = Money.from_amount(value)\n end",
"def original_price\n read_attribute(:price)\n end",
"def price=(price)\n @price = price.to_f\n end",
"def price=(new_price)\n if @price != new_price\n @observers.each do |observer|\n if observer.respond_to?(:after_price_change)\n observer.after_price_change(:stock => self, \n :time => Algotraitor.timestamp, \n :old_price => @price, \n :new_price => new_price)\n end\n end\n end\n @price = new_price\n end",
"def price\n self.default_variant ? self.default_variant.price : read_attribute(:price)\n end",
"def price=( value )\n value.respond_to?( :to_money ) ? @price = value.to_money : @price = 0.to_money\n end",
"def set_price_from_item\n self.price_cents = self.item.price_cents if self.price_cents.blank?\n end",
"def set_default_sale_price_to_price\n self.sale_price ||= price\n end",
"def unit_price\n return self[:unit_price] if persisted?\n product.price\n end",
"def purchase_price=(p)\n p = (self.string_to_float(p, :locale => self.vendor.region) * 100).ceil\n write_attribute(:purchase_price_cents, p)\n end",
"def hack\n self.price = 200\n end",
"def price=(dollars)\n @price = dollars\n end",
"def price=(price)\n if (price == nil || price <= 0)\n raise ArgumentError, 'price is invalid'\n end\n \n @price = price\n end",
"def unit_price\n if persisted?\n self[:unit_price]\n else\n product.price\n end\n end",
"def unit_price\n if persisted?\n self[:unit_price]\n else\n product.price\n end\n end",
"def price\n on_sale? ? sale_price : original_price\n end",
"def regular_price(product)\n alternate = product.alternate_prices.for(group)\n if alternate.present?\n price(product, alternate.price)\n else\n base_price(product).modify!(group.price_modifier)\n end\n end",
"def price_as_price\n @price_as_price ||= Price.new(price, price_includes_tax?, tax_rate)\n end",
"def price\n (read_attribute(:sale_price) if on_sale?) || read_attribute(:price)\n end",
"def price=(price) \n if price <= 0\n raise ArgumentError.new('Price less or equal to zero is not allowed.') \n end \n\t\t\n\t\t@price = price\n end",
"def for_pricing(product)\n base_price(product).modify!(group.price_modifier)\n end",
"def price=(price)\n write_attribute(:price, price.gsub(/\\D/, ''))\n end",
"def base_price(product)\n price(product, product.send(group.price_method))\n end",
"def old_price\n\t\tif $global_share\n\t\t\tif self[:old_price] == 0\n\t\t\t\tself[:price]\n\t\t\telse\n\t\t\t\tself[:old_price]\n\t\t\tend\n\t\telse\n\t\t\tself[:old_price]\n\t\tend\n\tend",
"def set_product_price\n @product_price = ProductPrice.find(params[:id])\n end",
"def set_product_price\n @product_price = ProductPrice.find(params[:id])\n end",
"def price_in_cents= (price)\n @price = price / 100.0\n end",
"def unset_price_if_using_vendor_price\n self.price = nil if use_vendor_price?\n end",
"def update_price(raw_price)\n model.price = raw_price * 1.10 # our markup is 10%\n model.save!\n end",
"def price\n b = read_attribute(:price)\n b.to_d * User.current.currency.exchange_rate.to_d\n end",
"def price(variant=nil)\n product_customization_type.calculator.compute(self, variant)\n end",
"def set_Price(value)\n set_input(\"Price\", value)\n end",
"def purchase_price=(price)\n return price if price.blank?\n price = price.to_s.gsub(/[,']/, '').to_f\n write_attribute(:purchase_price, price)\n end",
"def price # getter for rent in cents\n\t\tread_attribute(:price_in_cents)\n\tend",
"def check_price\n if price.nil?\n raise 'Must supply price for variant or master.price for product.' if self == product.master\n self.price = product.price\n end\n end",
"def check_price\n if self.price.nil?\n raise 'Must supply price for variant or master.price for product.' if self == product.master\n self.price = product.master.price\n end\n end",
"def for_order(product)\n regular_price(product)\n end",
"def price=(price)\n p_int = 0\n if price.is_a? Float and price % 1 != 0\n raise \"Invalid price #{price}: must be whole-number integer\"\n end\n\n begin\n p_int = Integer(price)\n rescue Exception => e\n raise \"Invalid price #{price}: must be whole-number integer\"\n end\n\n if p_int < 0\n raise \"Invalid price #{price}: must be positive\"\n end\n\n (@dirty_attrs << :price).uniq!\n @price = p_int\n return p_int\n end",
"def price\n return eval_shop_condition(@price_formula) unless @price_formula.empty?\n return item.price if @price_type == 0\n return @price\n end",
"def set_admin_price\n @admin_price = Price.find(params[:id])\n end",
"def price\n ConversionTool.convert_to_currency(self.unit_price)\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def price\n price = read_attribute(:price)\n if User.current and User.current.currency\n price.to_d * User.current.currency.exchange_rate.to_d\n else\n price.to_d\n end\n end",
"def set_btc_price\n # These associations need to be present or exception occurs.\n if shippingoption && unitprice && payment_method\n set_exchange_rate()\n btc = sum_product_and_shipping_in_currency(\"USD\") / get_exchange_rate(\"USD\")\n self.btc_price = btc.truncate(8)\n end\n end",
"def calculate_price\n self.price = product.price\n self.total_price = price * quantity \n end",
"def boxed_price=(box_price)\n if mode == 'boxed'\n self.price = SpookAndPuff::Money.new(box_price) / volume\n else\n raise \"Boxed prices are only available on boxed price points\"\n end\n end",
"def payment_price\n\t\t\t\t\treturn self.price\n\t\t\t\tend",
"def double_price\n @@price_per_coin_in_usd *= 2\n end",
"def supplier_price(supplier)\n return unless (supplier_variant = self.supplier_variant(supplier))\n\n price = default_price.dup\n price.amount = supplier_variant.cost\n return price\n end",
"def price(price_range)\n set_range_parameter(:price, price_range)\n end",
"def price\n base_price * discount_factor\n end",
"def price=(dollars)\n self.price_in_cents = dollars.to_f * 100\n end",
"def price\n BigDecimal('3.0')\n end",
"def base_price\n price / multiplier\n end",
"def unit_price\n self[:unit_price] || (product.nil? ? BigDecimal(0) : product.price) || BigDecimal(0)\n end",
"def update_price(price)\n model.price = price # * 1.10 # our markup is 10%\n model.save!\n end",
"def current_price; self['CurrentPrice'].to_i; end",
"def price\n b = read_attribute(:price)\n user = User.current.blank? ? User.where(id: 0).first : User.current\n b.to_d * user.currency.exchange_rate.to_d\n end",
"def display_price=(price_value)\n case mode\n when 'boxed'\n self.boxed_price = price_value\n else\n self.price = price_value\n end\n end",
"def price(_currency)\n raise Sibit::NotSupportedError, 'price() doesn\\'t work here'\n end",
"def calculate_price\n self.price = item.price * qty if item\n end",
"def update_line_item_price!(line_item)\n price = price_from_line_item(line_item)\n\n if price\n line_item.update_attributes!(price_list_id: price.price_list_id, price: price.amount)\n else\n raise RuntimeError, \"no #{price_list.name} list price found for #{line_item.product.name} (#{line_item.variant.sku})\"\n end\n end",
"def price\n\t\tvalue = 0\n\t\tself.items.each do |item|\n\t\t\tvalue += item.product.price * item.amount\n\t\tend\n\t\tvalue\n\tend",
"def price_in_cents\n read_attribute(:price) \n end",
"def price\n @price\n end",
"def price\n @price\n end",
"def price=(input)\n input.delete!(\"$\")\n super\n end",
"def price\n BigDecimal('5.0')\n end",
"def check_price\n self.price = self.price.to_f\n end",
"def set_par_price\n @game.initial_offering.set_par_price(@company, @par_price)\n @game.market.add_company(@company, @par_price)\n end",
"def set_pricing\n\t\tself.current_price = self.starting_price if self.current_price.nil?\n\t\tself.product_is_sold = false if self.product_is_sold.nil?\n\t\tself.bids = 0 if self.bids.nil?\n\t\tself.auction_is_over = false if self.auction_is_over.nil?\n\tend",
"def set_item_price(item, parent_price)\n price = get_local_item_price(item) || parent_price\n return if price.to_a.length < 2\n id = item.attribute(\"id\").try(:value).try(:match, /item-fragment-(\\d+)/).try(:[], 1)\n return unless id.present?\n prices[id.to_i] = price\n end",
"def update_price\n self.update(daily_price: new_daily_price)\n end",
"def update_discounted_price\n self.price = product.price * (100-discount)/100 \n end",
"def set_par_price(company, par_price)\n fail(\n ParPriceAlreadySet,\n \"Attempted to reset par price for #{company}\"\n ) if get_par_price(company)\n @par_prices[company] = par_price\n end",
"def set_price_from_suppliers_best_price!\n price = self.default_price\n price.amount = best_supplier_price || 0.0\n price.save!\n end",
"def final_price(product)\n special_price(product) || regular_price(product)\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def set_price\n @price = Price.find(params[:id])\n end",
"def buyback_price=(p)\n self.buy_price_cents = (self.string_to_float(p, :locale => self.vendor.region) * 100).round\n end",
"def check_price\n if self.price.blank?\n raise \"Must supply price for variant or master.price for product.\" if self.is_master\n self.price = calculate_price\n end\n end",
"def full_price\n\t\t\t\t@aftertax = @baseprice * @taxrate\n\t\tend"
] |
[
"0.771083",
"0.7291666",
"0.71573824",
"0.70893776",
"0.70893776",
"0.7061236",
"0.69499546",
"0.6853084",
"0.68031144",
"0.6766153",
"0.6752603",
"0.6743855",
"0.67190784",
"0.6675876",
"0.66526353",
"0.65515363",
"0.65492076",
"0.6546677",
"0.6524252",
"0.6497815",
"0.64623535",
"0.6454759",
"0.64467007",
"0.642757",
"0.64144236",
"0.6401154",
"0.6398545",
"0.6398545",
"0.6389943",
"0.6379399",
"0.63601947",
"0.6345161",
"0.6343681",
"0.63214487",
"0.63056254",
"0.62976116",
"0.62853956",
"0.62832516",
"0.62832516",
"0.6252251",
"0.6230444",
"0.6224301",
"0.6207912",
"0.61922175",
"0.6188768",
"0.61817306",
"0.6178452",
"0.61646545",
"0.6163041",
"0.6149247",
"0.6134652",
"0.613425",
"0.6125037",
"0.61204857",
"0.6119802",
"0.6117705",
"0.6107109",
"0.61058605",
"0.60915756",
"0.6074959",
"0.6053934",
"0.6030062",
"0.602841",
"0.6027249",
"0.6014686",
"0.6005077",
"0.5986038",
"0.5972482",
"0.5969848",
"0.59617716",
"0.59531635",
"0.5941062",
"0.59338045",
"0.59297854",
"0.5926636",
"0.5924552",
"0.5919446",
"0.59182036",
"0.59182036",
"0.59161067",
"0.5910357",
"0.59078103",
"0.5907497",
"0.590519",
"0.59004104",
"0.58992106",
"0.5889019",
"0.58730465",
"0.58359975",
"0.5832813",
"0.58236396",
"0.58236396",
"0.58236396",
"0.58236396",
"0.58236396",
"0.58236396",
"0.58236396",
"0.58236396",
"0.5815617",
"0.58153296",
"0.5808592"
] |
0.0
|
-1
|
Getter method for the 'internal' price of a product. This is not an attribute, only a field of the product model itself.
|
def price
MoneyUtils.format(self.price_basis)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def price\n return 0 unless self.persisted?\n\n return product.master.price if with_master_price?\n\n default_price.price\n end",
"def original_price\n self.read_attribute(:price)\n end",
"def unit_price\n return self[:unit_price] if persisted?\n product.price\n end",
"def set_price\n\t\tif persisted?\n\t\t\tself[:price]\n\t\telse\n\t\t\tproduct.price\n\t\tend\n\tend",
"def unit_price\n if persisted?\n self[:unit_price]\n else\n product.price\n end\n end",
"def unit_price\n if persisted?\n self[:unit_price]\n else\n product.price\n end\n end",
"def original_price\n read_attribute(:price)\n end",
"def price\n self.default_variant ? self.default_variant.price : read_attribute(:price)\n end",
"def price\n b = read_attribute(:price)\n b.to_d * User.current.currency.exchange_rate.to_d\n end",
"def original_price\n @price || item.price\n end",
"def price\n raise 'Redefine this method in your billing model.'\n end",
"def price\n raise 'Redefine this method in your billing model.'\n end",
"def price\n (read_attribute(:sale_price) if on_sale?) || read_attribute(:price)\n end",
"def price # getter for rent in cents\n\t\tread_attribute(:price_in_cents)\n\tend",
"def price\n price = read_attribute(:price)\n if User.current and User.current.currency\n price.to_d * User.current.currency.exchange_rate.to_d\n else\n price.to_d\n end\n end",
"def payment_price\n\t\t\t\t\treturn self.price\n\t\t\t\tend",
"def price\n return eval_shop_condition(@price_formula) unless @price_formula.empty?\n return item.price if @price_type == 0\n return @price\n end",
"def price\n b = read_attribute(:price)\n user = User.current.blank? ? User.where(id: 0).first : User.current\n b.to_d * user.currency.exchange_rate.to_d\n end",
"def price\n on_sale? ? sale_price : original_price\n end",
"def get_price\n item_prc_1\n end",
"def price_in_cents\n read_attribute(:price) \n end",
"def price\n @price\n end",
"def price\n @price\n end",
"def price\n\t\tvalue = 0\n\t\tself.items.each do |item|\n\t\t\tvalue += item.product.price * item.amount\n\t\tend\n\t\tvalue\n\tend",
"def for_order(product)\n regular_price(product)\n end",
"def price\n BigDecimal('3.0')\n end",
"def price\n ConversionTool.convert_to_currency(self.unit_price)\n end",
"def current_price; self['CurrentPrice'].to_i; end",
"def current_price\n curr = self.item_prices.current.first\n if curr.nil?\n return nil\n else\n return curr.price\n end\n end",
"def old_price\n\t\tif $global_share\n\t\t\tif self[:old_price] == 0\n\t\t\t\tself[:price]\n\t\t\telse\n\t\t\t\tself[:old_price]\n\t\t\tend\n\t\telse\n\t\t\tself[:old_price]\n\t\tend\n\tend",
"def unit_price\n self[:unit_price] || (product.nil? ? BigDecimal(0) : product.price) || BigDecimal(0)\n end",
"def fixed_price\n data.fixed_price\n end",
"def price= price\n if User.current and User.current.currency\n converted_price = (price.to_d / User.current.currency.exchange_rate.to_d).to_d\n else\n converted_price = price\n end\n write_attribute(:price, converted_price)\n self.price_with_vat = calculate_price_with_vat\n end",
"def price\n promotion = self.product.promotions.active_promotions.first\n if promotion.nil?\n read_attribute(:price)\n elsif promotion.discount_type.type_id == 1\n read_attribute(:price).to_f - (read_attribute(:price).to_f * (promotion.value.to_f/100))\n elsif promotion.discount_type.type_id == 3\n promotion.value.to_f\n else\n read_attribute(:price)\n end\n end",
"def price_document\n self.carrier_product_price.try(:price_document)\n end",
"def price_as_price\n @price_as_price ||= Price.new(price, price_includes_tax?, tax_rate)\n end",
"def price_for_order(order)\n price\n end",
"def price\n BigDecimal('5.0')\n end",
"def price\n basic = Spree::Currency.basic.char_code\n price = prices.where(currency: basic).limit(1)[0]\n if price\n amount = price.amount\n else\n amount = read_attribute(:price) || 0\n end\n Spree::Currency.conversion_to_current(amount)\n end",
"def regular_price(product)\n alternate = product.alternate_prices.for(group)\n if alternate.present?\n price(product, alternate.price)\n else\n base_price(product).modify!(group.price_modifier)\n end\n end",
"def price\n return self[:price] if market_open?\n previous_close\n end",
"def base_price(product)\n price(product, product.send(group.price_method))\n end",
"def price\n base_price * discount_factor\n end",
"def price\n response[\"price\"]\n end",
"def price\n if raw_data[:PackagePrice] && raw_data[:PackagePrice][:TotalPrice]\n Money.new(raw_data[:PackagePrice][:TotalPrice][:Value].to_f * 100, raw_data[:PackagePrice][:TotalPrice][:Currency])\n else\n nil\n end\n end",
"def original_price\n order.total_price_with_taxes\n end",
"def base_price\n price / multiplier\n end",
"def product_price(toy)\n \"Retail Price: $#{toy.price}\"\n end",
"def price(variant=nil)\n product_customization_type.calculator.compute(self, variant)\n end",
"def price\n flavor_info[:price]\n end",
"def delivery_price\n read_attribute(:delivery_price) || delivery_service_price.try(:price) || BigDecimal(0)\n end",
"def calculated_price\n msrp\n end",
"def usage_price\n data.usage_price\n end",
"def price\n hash[\"Price\"]\n end",
"def price\n 2.50\n end",
"def sell_price\r\n price\r\n end",
"def price\n (price_in_cents / 100.0) unless price_in_cents.nil?\n end",
"def price\n if model.price.to_f == model.price.to_i\n model.price.to_i.to_s\n else\n model.price.to_f.to_s\n end\n end",
"def price\n total_price = price_method(\"Principal\")\n individual_price = (total_price / quantity).to_f\n end",
"def get_price(noko_doc)\n price_node = noko_doc.css('span#priceblock_ourprice')\n price = nil\n\n # Typical product price\n if price_node.empty?\n price_node = noko_doc.css('div#unqualifiedBuyBox .a-color-price')\n end\n\n # Third-party seller only price\n if price_node.empty?\n price_node = noko_doc.css('div#buyNewSection span.a-color-price')\n end\n\n # Kindle book price\n if price_node.empty?\n price_node = noko_doc.css('td.dp-price-col span.a-color-price')\n end\n\n if price_node.empty?\n price_node = noko_doc.css('div#olp_feature_div span.a-color-price')\n end\n\n unless price_node.empty?\n price = price_node.first.content.to_s\n end\n\n price\n end",
"def price\n @longboard.price + @custom_print.price\n end",
"def price_with_vat\n price = read_attribute(:price_with_vat)\n if User.current and User.current.currency\n price.to_d * User.current.currency.exchange_rate.to_d\n else\n price.to_d\n end\n end",
"def calculate_price\n self.price = product.price\n self.total_price = price * quantity \n end",
"def product_price\n $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-wis-price\")), __method__)\n end",
"def set_price\n self.product = Product.find(orderable_id)\n self.unit_price = product.price\n end",
"def price_for_customer(customer)\n price\n end",
"def final_price(product)\n special_price(product) || regular_price(product)\n end",
"def price(currency_code=nil)\n selected_currency = currency_code || Utility.currency_code\n unless @product_price_cache && @product_price_cache.currency == selected_currency\n @product_price_cache = self.find_price_by_currency(selected_currency)\n end\n @product_price_cache.price if @product_price_cache\n end",
"def price=(new_price)\n\t\t@price = new_price\n\tend",
"def price_from_line_item(line_item)\n line_item.variant.price_for(price_list)\n end",
"def supplier_price(supplier)\n return unless (supplier_variant = self.supplier_variant(supplier))\n\n price = default_price.dup\n price.amount = supplier_variant.cost\n return price\n end",
"def product_price_details\n {:currency => 'EUR', :price => price}\n end",
"def price\n (original_price * (1 - discount_rate)).to_i\n end",
"def mid_price\n price\n end",
"def net_price\n if self.patient.is_a_firm?\n self.price\n else\n self.price + get_additional_cost_totals()[:negative]\n end\n end",
"def special_prices\n prices\n end",
"def product_price_ex_vat\n price_calculator.ex_vat\n end",
"def loss_price(current_price = nil)\n price = self.price.present? ? self.price : 0.0\n current_price = current_price.present? ? current_price : self.item.current_price\n (price - current_price )\n end",
"def askPrice()\n @price = @serviceCorp.askPriceFor(self) if(@serviceCorp) ;\n return @price ;\n end",
"def get_price\n return @data['android']['price']\n end",
"def special_prices\n customized_special_prices || prices\n end",
"def price\n total\n end",
"def set_price\n course = Course.find(self.course_id)\n self.price = course.price\n end",
"def for_pricing(product)\n base_price(product).modify!(group.price_modifier)\n end",
"def price(_currency)\n raise Sibit::NotSupportedError, 'price() doesn\\'t work here'\n end",
"def price=(price)\n if price.present?\n self[:price] = price.to_s.gsub(/[^0-9\\.-]/, '').to_f\n end\n end",
"def purchase_price(item)\n item.price / 2\n end",
"def price\n @sibit.price\n end",
"def price\n return super.to_d unless super.nil?\n\n if product.magento_type == 'teamwork_cegiftcard'\n\n if self.options[:giftcard_amount] == 'custom'\n self.options[:giftcard_amount_custom].to_d\n\n else\n self.options[:giftcard_amount].to_d\n end\n\n elsif self.options[:custom_price]\n self.options[:custom_price].to_d\n\n else\n user_group = itemizable.user ? itemizable.user.user_group : nil\n product.price(user_group, itemizable.store, self.qty_ordered).to_d\n end\n\n end",
"def my_price\n envisage_to_my_price\n end",
"def total_price\n\t\tproduct.price * quantity\n\tend",
"def double_price\n @@price_per_coin_in_usd *= 2\n end",
"def price\n \n end",
"def full_price\n\t\tunit_price * quantity\n\tend",
"def display_price\n Spree::Money.new(new_amount, currency: currency)\n end",
"def price\n return base_price - quantity_discount + shipping\nend",
"def item_price(item, include_sale = false)\n article_price(article_from_item(item), include_sale)\n end",
"def price(currency = 'USD')\n best_of('price') do |api|\n api.price(currency)\n end\n end",
"def price\n price_tier ? price_tier : 'Unknown'\n end",
"def check_price\n if self.price.nil?\n raise 'Must supply price for variant or master.price for product.' if self == product.master\n self.price = product.master.price\n end\n end"
] |
[
"0.77621764",
"0.76674557",
"0.7461227",
"0.7431277",
"0.73654985",
"0.73654985",
"0.73248166",
"0.7288492",
"0.7202354",
"0.71966803",
"0.71757936",
"0.71757936",
"0.7163685",
"0.71581346",
"0.71107054",
"0.6952827",
"0.6945774",
"0.6925268",
"0.69164795",
"0.6883636",
"0.68481934",
"0.6830284",
"0.6830284",
"0.6812821",
"0.6793074",
"0.67814004",
"0.678053",
"0.67578804",
"0.6747189",
"0.6712281",
"0.670722",
"0.6687641",
"0.66771835",
"0.66473264",
"0.66278154",
"0.66099805",
"0.65954083",
"0.65788114",
"0.65762204",
"0.65756726",
"0.6572515",
"0.6562425",
"0.655444",
"0.65420425",
"0.65297604",
"0.6460654",
"0.64578533",
"0.6417558",
"0.6398261",
"0.638308",
"0.6379068",
"0.6356523",
"0.63382864",
"0.6335066",
"0.6329308",
"0.63209957",
"0.63166755",
"0.6308928",
"0.6294852",
"0.6290823",
"0.6289589",
"0.6289494",
"0.6287036",
"0.625974",
"0.6230045",
"0.62268186",
"0.62244767",
"0.6209568",
"0.6194163",
"0.6153882",
"0.6145933",
"0.6145824",
"0.6144193",
"0.61416745",
"0.61411285",
"0.61364084",
"0.6134403",
"0.6108163",
"0.6106071",
"0.61041075",
"0.60840505",
"0.60733104",
"0.6058191",
"0.604925",
"0.604058",
"0.6036914",
"0.603533",
"0.6034054",
"0.60226274",
"0.6000459",
"0.59898657",
"0.59888124",
"0.5984955",
"0.59690535",
"0.59664863",
"0.5964662",
"0.59633464",
"0.5958511",
"0.59563595",
"0.59558034"
] |
0.6669317
|
33
|
Used as pseudoattribute by the products controller. Add this product to the specified leaf categories. The list of leaf categories is assumed to be comprehensive: the product should be assigned to all these leaves and only these leaves. For each leaf, propagate the product all the way up to the root.
|
def leaf_ids=(lids)
save! if new_record?
# Clear out all mention of the product from the entire tree.
CategoryProduct.delete_all(["product_id = ?", self.id])
lids.each do |lid|
next if lid == "none"
category = Category.find(lid)
category.add_product(self, auto_prop)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_product(prod, propagate = true)\n\n # Can't add products to interior category.\n unless self.leaf?\n errors.add(:base, \"Can't add product to interior category.\")\n return\n end\n \n # Make sure that the category has the product's product family.\n # There is a race condition here. Another administrator could\n # remove the product family just after we confirm that our\n # category has this family. XXX\n if CategoryFamily.where(:category_id => self.id,\n :product_family_id => prod.product_family_id).empty?\n errors.add(:base, \n \"Category doesn't have product family for this product.\")\n return\n end\n\n # All OK. Add the product. There is a callback on the CategoryProduct\n # model that will initialize the ref_count in the category_products\n # join table to 1. \n begin\n products << prod\n rescue ActiveRecord::RecordNotUnique\n errors.add(:base, \"Can't add product to same category twice.\")\n return\n end\n \n propagate_products_up if propagate\n end",
"def assign_category\n path = @row[:category]\n root = path.shift\n\n # this just needs to be set, for apparently no valid reason\n # I think think model is complely useless\n taxonomy = Spree::Taxonomy.find_or_create_by!(name:root)\n\n # here is real root of taxonomy tree\n taxon = Spree::Taxon.find_or_create_by!(parent_id: nil, taxonomy_id: taxonomy.id, name: root)\n\n # now check for existance of 2 parent elements, 3 and n+ is ignorred\n taxon = Spree::Taxon.find_or_create_by!(parent_id: taxon.id, taxonomy_id: taxonomy.id, name: path[0]) if path[0]\n taxon = Spree::Taxon.find_or_create_by!(parent_id: taxon.id, taxonomy_id: taxonomy.id, name: path[1]) if path[1]\n\n # it is weird why this model is named Spree::Classification instead of Spree::ProductsTaxon\n # it maps to \"spree_products_taxons\" table\n Spree::Classification.find_or_create_by! product_id: @product.id, taxon_id: taxon.id\n end",
"def set_categories(product)\n categories = value('category').split('&')\n\n categories.each do |category_string|\n category_string.strip!\n subcategories = category_string.split('>')\n parent_id = self.root_category.id\n subcategories.each do |category_url_key|\n category_url_key.strip!\n category = Gemgento::Category.find_by(url_key: category_url_key, parent_id: parent_id)\n unless category.nil?\n pc = Gemgento::ProductCategory.find_or_create_by!(category: category, product: product, store: self.store)\n parent_id = category.id\n pc.sync_needed = true\n pc.save\n else\n self.process_errors << \"Row ##{@index}: Unknown category url key '#{category_url_key}' - skipped\"\n end\n end\n end\n end",
"def update_product_category\n return true if self.category.blank?\n categories = self.category.ancestors.collect{|x| x.id}.reverse.push(self.category.id)\n category_names = self.category.ancestors.collect{|x| x.name.downcase}.reverse.push(self.category.name.downcase).join(\" | \")\n product_cat = ProductCat.find_or_create_by_product_id(self.id)\n product_cat.fourth_category_id = categories[3] unless categories[3].blank?\n product_cat.third_category_id = categories[2] unless categories[2].blank?\n product_cat.second_category_id = categories[1] unless categories[1].blank?\n product_cat.first_category_id = categories[0] unless categories[0].blank?\n product_cat.categories_delimited = category_names\n product_cat.user = self.user\n product_cat.save\n end",
"def save_hot_products_by_category\r\n Subcategory.fill_all_subcategories_of_category(params[:category][:fields][1])\r\n end",
"def build_categories(product, mapped_categories)\n collection = []\n\n product[:categories].each do |category_name|\n mapped_categories.each do |mapped_category|\n build_category_tree(collection, category_name, mapped_category)\n end\n end\n\n collection\n end",
"def traverse(root_node, i, level)\n name = root_node.values.first\n catid = root_node.keys.first\n english_name = root_node.values.first\n \n Session.product_type = @retailer\n \n #print catid + ' '\n \n french_name = BestBuyApi.get_category(catid, false)[\"name\"]\n \n # These categories are left singular in the feed\n # Regex is used fit file encoding (could change it to UTF 8 (according to stackoverflow post) and use the string normally with 'e' accent aigu)\n if english_name == \"Digital SLR\" && /^Appareil photo reflex (?<need_accent_numerique>num.rique)$/ =~ french_name\n english_name = \"Digital SLRs\"\n french_name = \"Appareils photo reflex #{need_accent_numerique}s\"\n end\n \n prefix = @retailer\n \n cat = ProductCategory.new(:product_type => prefix + catid, :feed_id => catid, :retailer => @retailer, \n :l_id => i, :level => level)\n \n i = i + 1\n children = BestBuyApi.get_subcategories(catid).values.first\n children.each do |child|\n i = traverse(child, i, level+1)\n end\n \n cat.r_id = i\n @categories_to_save << cat\n @translations_to_save << [cat.product_type, english_name, french_name]\n \n i = i + 1\n return i\n end",
"def create_category_products(category,category_node)\n products_page_url = category_node.xpath(\"./a[1]/@href\").text\n while products_page_url\n html_product = Nokogiri::HTML(open(products_page_url))\n html_product.xpath(\"//tr/td[@class='pdescr']\").map do |product_node|\n product = create_product(product_node)\n category.add_product(product)\n end\n products_page_url = check_next(html_product)\n end\n end",
"def update_hierarchy(top_node, retailer)\n @categories_to_save = []\n @translations_to_save = []\n @retailer = retailer\n traverse(top_node, 1, 1)\n \n # In a transaction, i.e. all of these must complete successfully, otherwise nothing is saved or deleted\n ActiveRecord::Base.transaction do\n current_categories = ProductCategory.where(:retailer => retailer)\n if current_categories.size >= 50 \n diff = current_categories.size - @categories_to_save.size\n if diff >= 0.5 * current_categories.size\n # If the number of categories has dropped by more than 50%\n raise BestBuyApi::InvalidFeedError, \"Current number of categories is #{current_categories.size} \" +\n \"while new number of categories is #{@categories_to_save.size}: categories will not be updated\"\n end\n end\n \n # delete the old categories for this retailer\n ProductCategory.where(:retailer => retailer).delete_all\n # save the new categories\n ProductCategory.import @categories_to_save\n # save all translations\n @translations_to_save.each do |key, english_name, french_name|\n I18n.backend.store_translations(:en, { key => {\"name\" => english_name} })\n I18n.backend.store_translations(:fr, { key => {\"name\" => french_name} })\n end\n end\n end",
"def products_arel\n if self.root?\n @products_arel ||= Product.joins(:dp_categories).where(\"dp_categories.id in (?)\", (self.children.collect do |dpc| dpc.id end << self.id))\n else\n @products_arel ||= self.products\n end\n @products_arel\n end",
"def append_node\r\n # Load parent package.\r\n parent_package = ProductPackage.find params[:id], :include => \"product_package_nodes\"\r\n # position = parent_package.product_package_nodes.collect{|node| node.position}.sort.last.nexts\r\n \r\n # Build a child node.\r\n case params[:node_type]\r\n when \"package\"\r\n parent_package.product_package_nodes << ProductPackage.new(:name => params[:new_package_name])\r\n when \"product\"\r\n parent_package.product_package_nodes << ProductPackageProduct.new(:product_id => params[:product_id], :display_style => \"checkbox\")\r\n end\r\n \r\n # Save node and redirect back.\r\n redirect_to :back\r\n end",
"def set_children_for(category, hash)\n if hash['children']\n hash['children'].each do |ch|\n child = Documents::Category.find(ch['id'])\n child.parent = category\n child.save\n\n set_children_for(child, ch)\n end\n else\n # Can't remove children, so nil out the parent of anything that's listed\n # as a child of this node\n category.children.each do |c|\n c.parent = nil\n c.save\n end\n end\n end",
"def create_child_items\n category.path.each do |category|\n create_child_item_for_category category\n end\n end",
"def create\n @category = Category.new(params[:category])\n \n # Create rollover\n @rollover = Rollover.create(params[:rollover])\n @category.rollover = @rollover\n\n respond_to do |format|\n if @category.save\n \n # Assign to parent\n unless params[:category][:parent_id].empty?\n @parent = Category.find(params[:category][:parent_id])\n @category.move_to_child_of(@parent)\n end\n \n flash[:notice] = 'Category was successfully created.'\n format.html { redirect_to(@category) }\n format.xml { render :xml => @category, :status => :created, :location => @category }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_leaf(leaf, defer_update = false)\n raise \"node is not lowest level and can therefore not get a leaf: #{self}\" unless lowest_level?\n children.insert(children.find_index {|child| child.shash > leaf.shash} || -1, leaf) #insertion_sort here\n leaf.parent = self\n divide_if_needed(defer_update)\n end",
"def leafify(n)\n n.extend(Leaf)\n end",
"def create_category(cat_name)\n category = Spree::Taxonomy.where(name: 'Categories').first\n category = Spree::Taxonomy.create(name: 'Categories') if category.nil?\n taxon = Spree::Taxon.find_by(name: cat_name, taxonomy_id: category.id)\n if taxon.present?\n spree_taxons.append(taxon)\n else\n taxon = Spree::Taxon.new(name: cat_name, taxonomy_id: category.id, parent_id: category.root.id)\n if taxon.save\n spree_taxons.append(taxon)\n else\n Rails.logger.info \"Error! #{taxon.errors.full_messages}\"\n end\n end\n end",
"def add_part_group_taxon()\n new_taxons = @product_row[:category].to_s.split(\",\")\n new_taxons.each do |category|\n category.strip!\n my_taxon = Spree::Taxon.where(\"description=?\", category)\n my_taxonomy = Spree::Taxon.where(\"description=?\", category.split('-')[0])\n if(my_taxon.length === 0 || my_taxonomy.length === 0)\n @errors << { :part_number => @product_row[:name], :condition => @product_row[:condition], :message => \"Unable to identify proper part group for \" + @product_row[:category].to_s }\n end\n @new_product.taxons << my_taxon\n @new_product.taxons << my_taxonomy\n end\n\n # add package taxon\n if(@product_row[:package] && @product_row[:package].to_s.downcase === \"y\")\n package_taxon = Spree::Taxon.where(\"name=?\", \"Packages and Assemblies\")\n @new_product.taxons << package_taxon\n end\n end",
"def create\n @product = Product.new(params[:product])\n\n collect_and_assign_product_attributes\n collect_and_assign_new_categories\n\n respond_to do |format|\n if @product.save\n flash[:notice] = 'Product was successfully created.'\n format.html { redirect_to(admin_product_path(@product)) }\n format.xml { render :xml => @product, :status => :created, :location => @product }\n else\n assign_lovs\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def <<(product)\r\n\t\tif product.is_a?(CompositeProduct) and (product.id == id || product.has_child?(self))\r\n\t\t\tnil\r\n\t\telse\r\n\t\t\tcomponent = components.find(:first, :conditions => [ 'child_id = ?', product.id ])\r\n\t\t\tif component.nil?\r\n\t\t\t\tcomponents.create(:parent => self, :child => product, :quantity => 1)\r\n\t\t\telse\r\n\t\t\t\tcomponent.update_attribute(:quantity, component.quantity + 1)\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def set_root_category\n @root_category = RootCategory.find(params[:id])\n end",
"def create\n # Create the new product object from the parameters received\n @product = Product.create(product_params)\n\n respond_to do |format|\n # Try and save the product to the database\n if @product.save\n update_nil_values(@product)\n # Product saved successfully. We will create the entry in the product_categories table\n @category = Category.find(params[:category_id])\n @product.product_categories.create(category: @category)\n\n # Redirect to the products list indicating success\n format.html { redirect_to admin_products_url, notice: 'Product was successfully added.' }\n else\n # Product did not save successfully. Redirect to the products list indicating failure\n\n # Retrieve the categories to display in the caterogy filter dropdown\n @all_categories = Category.order(:name)\n\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def category_attributes=(category_attributes)\n category_attributes.values.each do |category_attribute|\n category = Category.find_or_create_by(category_attribute)\n self.categories << category\n end\n end",
"def add_taxons\n # TODO smart column ordering to ensure always valid by time we get to associations\n product_load_object.save_if_new\n\n chain_list = value.to_s.split(multi_assoc_delim) # potentially multiple chains in single column (delimited by multi_assoc_delim)\n\n chain_list.each do |chain|\n\n # Each chain can contain either a single Taxon, or the tree like structure parent>child>child\n name_list = chain.split(/\\s*>\\s*/)\n\n parent_name = name_list.shift\n\n parent_taxonomy = taxonomy_klass.where(:name => parent_name).first_or_create\n\n raise DataShift::DataProcessingError.new(\"Could not find or create Taxonomy #{parent_name}\") unless parent_taxonomy\n\n parent = parent_taxonomy.root\n\n # Add the Taxons to Taxonomy from tree structure parent>child>child\n taxons = name_list.collect do |name|\n\n begin\n taxon = taxon_klass.where(:name => name, :parent_id => parent.id, :taxonomy_id => parent_taxonomy.id).first_or_create\n\n # pre Rails 4 - taxon = taxon_klass.find_or_create_by_name_and_parent_id_and_taxonomy_id(name, parent && parent.id, parent_taxonomy.id)\n\n unless(taxon)\n logger.warn(\"Missing Taxon - could not find or create #{name} for parent #{parent_taxonomy.inspect}\")\n end\n rescue => e\n logger.error(e.inspect)\n logger.error \"Cannot assign Taxon ['#{taxon}'] to Product ['#{product_load_object.name}']\"\n next\n end\n\n parent = taxon # current taxon becomes next parent\n taxon\n end\n\n taxons << parent_taxonomy.root\n\n unique_list = taxons.compact.uniq - (@product_load_object.taxons || [])\n\n logger.debug(\"Product assigned to Taxons : #{unique_list.collect(&:name).inspect}\")\n\n @product_load_object.taxons << unique_list unless(unique_list.empty?)\n # puts @product_load_object.taxons.inspect\n\n end\n\n end",
"def add_product_category_with_http_info(product_categories, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProductCategoryApi.add_product_category ...'\n end\n # verify the required parameter 'product_categories' is set\n if @api_client.config.client_side_validation && product_categories.nil?\n fail ArgumentError, \"Missing the required parameter 'product_categories' when calling ProductCategoryApi.add_product_category\"\n end\n # resource path\n local_var_path = '/product_categories'\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(product_categories)\n auth_names = ['api_key']\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 => 'ProductCategory')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProductCategoryApi#add_product_category\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new_leaf(payload, **kwargs)\n factory.leaf_node(payload, **kwargs)\n end",
"def init_root_categories\n @root_categories ||= Category.top_level\n end",
"def add_child\n category_id = params[:id].gsub('category_', '')\n @category = Category.find(category_id)\n parent_id = params[:parent_id]\n if parent_id\n @parent = Category.find(parent_id)\n @category.parent = @parent \n else\n @category.parent = nil\n end\n @category.save!\n render :update do |page|\n page.remove(\"category_#{@category.id}_row\")\n if @parent\n if @parent.name == ASSOCIATION.short_name\n page.replace_html(\"category_root\", :partial => \"category\", :collection => @parent.children.sort)\n else\n page.call(:expandDisclosure, parent_id)\n end\n end\n if @parent.nil?\n page.replace_html(\"unknown_category_root\", :partial => \"category\", :collection => Category.find_all_unknowns.sort)\n end\n end\n end",
"def create_child_item_for_category(category)\n category.child_items.create(categorizable: self.categorizable, master_item: self)\n end",
"def add_tree!(tree, compute = true)\n @list.each_value do |partition|\n partition.add_tree!(tree, compute)\n end\n self\n end",
"def categories_attributes=(categories_attributes)\n categories_attributes.values.each do |category_attributes|\n if category_attributes[:id].nil? and category_attributes[:name].present?\n category = Category.find_by_name(category_attributes[:name])\n if category.present?\n category_attributes[:id] = category.id\n ## FIXME? check if we are adding twice?\n self.categories << category\n end\n end\n end\n assign_nested_attributes_for_collection_association(:categories, categories_attributes.values, mass_assignment_options)\n end",
"def candidate_paths\n # All leaf categories for this product family. This is an array\n # of hashes. Each hash has keys :catid and :path.\n candidates = self.product_family.leaf_category_paths\n\n # All leaf category ids that were previously selected for this\n # product. This will be a subset of the candidates.\n current = self.leaf_ids\n\n candidates.each do |lcp|\n if current.include? lcp[:catid]\n lcp.merge! :selected => true\n else\n lcp.merge! :selected => false\n end\n end\n candidates\n end",
"def associate_product_with_taxon(product, taxonomy, taxon_hierarchy)\r\n return if product.nil? || taxonomy.nil? || taxon_hierarchy.nil?\r\n\r\n #Using find_or_create_by_name is more elegant, but our magical params code automatically downcases\r\n # the taxonomy name, so unless we are using MySQL, this isn't going to work.\r\n # taxonomy_name = taxonomy\r\n # taxonomy = Taxonomy.find(:first, :conditions => [\"lower(name) = ?\", taxonomy])\r\n # taxonomy = Taxonomy.create(:name => taxonomy_name.capitalize) if taxonomy.nil? && ProductImport.settings[:create_missing_taxonomies]\r\n\r\n taxon_hierarchy.split(/\\s*\\|\\s*/).each do |hierarchy|\r\n hierarchy = hierarchy.split(/\\s*>\\s*/)\r\n taxonomy = Spree::Taxonomy.where(\"name = ?\", hierarchy.first.downcase).first\r\n taxonomy = Taxonomy.create(:name => hierarchy.first.capitalize) if taxonomy.nil? && ProductImport.settings[:create_missing_taxonomies]\r\n last_taxon = taxonomy.root\r\n\r\n hierarchy.shift\r\n hierarchy.each do |taxon|\r\n #last_taxon = last_taxon.children.find_or_create_by_name_and_taxonomy_id(taxon, taxonomy.id)\r\n last_taxon = last_taxon.children.find_or_create_by(name: taxon, taxonomy_id: taxonomy.id)\r\n end\r\n\r\n #Spree only needs to know the most detailed taxonomy item\r\n product.taxons << last_taxon unless product.taxons.include?(last_taxon)\r\n end\r\n end",
"def add_to_products\n \t@@products << self\n \tend",
"def apply_category_filter\n top_level_category_ids = Category.top_level.\n where(id: @category_ids).\n pluck(:id)\n subcategory_ids = @category_ids +\n Category.where(parent_id: top_level_category_ids).pluck(:id)\n\n subcategory_ids\n end",
"def category_attributes=(category_attributes) # setter\n # raise category_attributes.inspect\n category_attributes.keys.each do |key|\n categories.new(category_attributes[key])\n end\n end",
"def parse_categories_structure(category_id = nil)\n super category_id, { product_link: '.productsArea .productArea .productDetail a',\n next_page_link: '.productsArea .tsk-pageview .next a' }\n end",
"def categories_attributes=(category_attributes)\n category_attributes.values.each do |category_attribute|\n if category_attribute[\"name\"].present?\n category = Category.find_or_create_by(category_attribute)\n self.categories << category\n end\n end\n end",
"def create_category(category_node)\n url = category_node.xpath(\"./a[1]/@href\").text\n name = url.sub(URL,'').delete('/')\n name_ru = category_node.xpath(\"./a[last()]\").text\n is_new = category_node.xpath(\"./a[2]/img[@class='img_new']\").any?\n Category.create(name: name, name_ru: name_ru, url: url, is_new: is_new)\n end",
"def admin_product_category_params\n params[:product_category][:menu_id] = params[:menu_id] if params[:product_category].present?\n params.fetch(:product_category).permit(:name, :description, :menu_id, :products_attributes=>\n [:id, :name, :description, :product_category_id, :price, :_destroy])\n end",
"def category_menu_items(aRootCategory, aOptions={})\n\t\t\taBaseUrl = (aOptions[:base_url] || '')\n\t\t\taIdPrefix = (aOptions[:id_prefix] || '')\n\t\t\tcategory = aOptions[:category]\n\t\t\tcategory = category.name.urlize('+') if category.is_a?(Category)\n\t\t\ttree_nodes = construct_category_tree(aRootCategory)\n\t\n\t\t\t# now turn tree_nodes into menu items, still as array of levels\n\t\t\ttree_items = []\n\t\t\tlast_lvl = nil\n\t\t\ttree_nodes.each do |lvl|\n\t\t\t\titem_level = []\n\t\t\t\tlvl.each do |node|\n\t\t\t\t\tname = (node.name.index('/') ? File.basename(node.name) : node.name)\n\t\t\t\t\titem = {:id => aIdPrefix+node.id.to_s, :name => name }\t\n\t\t\t\t\titem[:node] = node\n\t\t\t\t\tif last_lvl && parent_item = last_lvl.find {|i| i[:node].id == node.parent_id}\n\t\t\t\t\t\tparent_item[:children] ||= []\n\t\t\t\t\t\tparent_item[:children] << item\n\t\t\t\t\t\titem[:url] = parent_item[:url]\n\t\t\t\t\t\titem[:url] += '+' unless item[:url]=='' || item[:url].ends_with?('/') || item[:url].ends_with?('+')\n\t\t\t\t\t\titem[:url] += name.urlize('-')\n\t\t\t\t\telse\n\t\t\t\t\t\titem[:url] = File.join(aBaseUrl,name.urlize('-'))\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\titem[:selected] = true if category && (category==node.name.urlize('+'))\n\t\t\t\t\titem[:order] = aOptions[:order_proc].call(item) if aOptions.has_key?(:order_proc)\n\t\t\t\t\titem_level << item\n\t\t\t\tend\n\t\t\t\ttree_items << item_level\n\t\t\t\tlast_lvl = item_level\n\t\t\tend\n\t\t\t# clean\n\t\t\ttree_items.each do |lvl|\n\t\t\t\tlvl.each do |i| \n\t\t\t\t\ti.filter_include!([:url,:selected,:id,:name,:children,:order])\n\t\t\t\t\ti[:children].sort! {|a,b| a[:order].to_i <=> b[:order].to_i} if i[:children].is_a?(Array)\n\t\t\t\tend\n\t\t\tend\n\t\t\ttree_items.first.sort! {|a,b| a[:order].to_i <=> b[:order].to_i}\n\t\t\ttree_items.first\n\t\tend",
"def add_child\n category_id = params[:id].gsub('category_', '')\n @category = Category.find(category_id)\n parent_id = params[:parent_id]\n if parent_id\n @parent = Category.find(parent_id)\n @category.parent = @parent \n else\n @category.parent = nil\n end\n begin\n @category.save!\n render :update do |page|\n page.redirect_to(:action => :index)\n end\n rescue Exception => error\n stack_trace = error.backtrace.join(\"\\n\")\n RACING_ON_RAILS_DEFAULT_LOGGER.error(\"#{error}\\n#{stack_trace}\")\n message = \"Could not insert category\"\n render :update do |page|\n page.replace_html(\"message_category_name_#{parent_id}\", render(:partial => '/admin/error', :locals => {:message => message, :error => error }))\n end\n end\n end",
"def create\n @category = @current_branch.categories.build(category_params)\n @category.shop = @current_shop\n respond_to do |format|\n if @category.save\n format.html { redirect_to backend_shop_branch_category_path(@current_shop.slug, @current_branch, @category), notice: t('Category was successfully created.') }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def leaf\n @leaf ||= if (certificate = @node.at('certificate[@position=\"leaf\"]'))\n Certificate.new(certificate)\n end\n end",
"def categories_attributes=(category_attributes)\t\n category_attributes.values.each do |category_attribute|\t\n category = Category.find_or_create_by(category_attribute)\t\n self.categories << category\t\n end\t\n end",
"def categories_attributes=(category_attributes)\n category_attributes.values.each do |category_attribute|\n if !category_attribute[:name].empty?\n category = Category.find_or_create_by(category_attribute)\n self.categories << category\n end\n end \n \n end",
"def categories_attributes=(category_attributes)\n # byebug\n category_attributes.values.each do |category_attribute|\n unless category_attribute['name'].empty?\n category = Category.find_or_create_by(category_attribute)\n self.categories << category \n end \n end\n end",
"def create\n\n\t@brproduct = Brproduct.create(brproduct_params)\n\t@brproduct.article = Article.new\n\t\n \tparentlevel = Hqlevel.find(params[:brlevel_id])\n parentlevel.brproducts << @brproduct\n\n #@brproduct = Brproduct.new(brproduct_params)\n\n respond_to do |format|\n if @brproduct.save\n format.html { redirect_to admin_brlevel_path(parentlevel,locale: I18n.locale), notice: 'Brproduct was successfully created.' }\n format.json { render action: 'show', status: :created, location: @brproduct }\n else\n format.html { render action: 'new' }\n format.json { render json: @brproduct.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_categories( *categories )\n\t\t\tcategories.each do |cat|\n\t\t\t\t@categories << [cat, 0]\n\t\t\tend\n\t\tend",
"def create_category category_parent_id, category_name\n # Create a new category\n @server.call(\"call\", @session_id, \"catalog_category.create\", [category_parent_id, {:name => category_name, :is_active => 1, :include_in_menu => 1, :available_sort_by => \"*\", :default_sort_by => 0}])\n rescue XMLRPC::FaultException => exception\n return exception\n end",
"def create\n parent_id = params[:parent_id]\n if parent_id\n @category = Category.new(category_params.except(:edge))\n @edge = Edge.new(:weight => category_params[:edge][:weight])\n @parent_category = Category.find(parent_id)\n if @parent_category.children.create category_params.except(:edge)\n @category.id = @parent_category.children.where(:name => category_params[:name].upcase).first.id\n @edge.update_attributes(:start_node_id => parent_id.to_i, :end_node_id => @category.id)\n render :json => {:message => 'Category was successfully created.', :parent_id => parent_id, :id => @category.id, :name => @category.name}, :status => 200, :layout => false\n else\n render :json => {:message => 'Category failed to create.'}, :status => 400, :layout => false\n end\n end\n end",
"def add_family(fam, propagate = true)\n count = 0\n if leaf?\n [fam].flatten.each do |f|\n if product_families.where([\"product_family_id = ?\", f.id]).empty?\n product_families << f\n count += 1\n end\n end\n else\n errors.add(:base, \"Can't add product family to non-leaf category.\")\n end\n if (count > 0) && propagate\n propagate_families_up\n generate_attributes_up\n end\n count\n end",
"def set_product1\n @sub_category = SubCategory.find_by_name(params[:name].tr('-',' '))\n @products = Product.where(sub_category_id: @sub_category.id)\n end",
"def categories\r\n return handle_resource_not_found unless @article_category\r\n\r\n add_category_breadcrumbs(@article_category)\r\n if @article_category.leaf?\r\n @title_text = @article_category.display_text\r\n @articles = fetch_articles(order_by, nil, :conditions => {:article_category_id => @article_category.id}, :include => [:user, :article_category])\r\n @other_recent_posts = @article_category.parent.all_recent_posts(:exclude_category => @article_category) if @article_category.parent\r\n render 'articles/subcategories'\r\n else\r\n return unless check_category_for_stale\r\n @subcategories_with_posts = @article_category.children.with_published_articles\r\n render 'articles/categories'\r\n end\r\n end",
"def categories_attributes=(categories_hashes)\n # raise categories_hashes.inspect\n # {\"0\"=>{\"name\"=>\"new cat 1\"}, \"1\"=>{\"name\"=>new cat 2\"}}\n categories_hashes.each do |index, category_attributes|\n #need to create a category that is alrady assoicated with this post and make sure that this cateogry doesn't already exist\n\n #DO NOT CREATE A CATEGOERY if it doesn't have a name\n if category_attributes[:name].present?\n # also don't add a category if it already has it\n\n category = Category.find_or_create_by(name: category_attributes[:name])\n if !self.categories.include?(category)\n # post_categories\n # self.categories<< category\n self.post_categories.build(:category => category)\n end\n end\n end\n end",
"def set_leaf\r\n @leaf = Leaf.find(params[:id])\r\n end",
"def update\n @category = Category.find(params[:id])\n @rollover = @category.rollover\n \n unless params[:category][:parent_id].empty?\n @parent = Category.find(params[:category][:parent_id])\n @category.move_to_child_of(@parent) if @parent != @category.parent\n end\n \n respond_to do |format|\n if @category.update_attributes(params[:category]) and ( @rollover.update_attributes(params[:rollover]) unless @category.is_home?)\n flash[:notice] = 'Category was successfully updated.'\n format.html { redirect_to(@category) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_category(*category)\n unless category.blank?\n what.query.add(:categories) << category.flatten\n changed\n end\n end",
"def set_category\n @category = LibraryCategory.find_by(:object_key => params[:library_category_id])\n\n add_breadcrumb @category.name, library_category_path(@category)\n end",
"def create\n if params[:category][:parent_id].present?\n parent = Category.find(params[:category][:parent_id])\n @category = parent.create_child(@current_user,params[:category])\n else\n @category = Category.create(params[:category].merge!({:user_id => @current_user.id}))\n end\n respond_to do |format|\n if @category.save\n format.html { redirect_to admin_categories_path, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def category_leaf(opts={})\r\n opts[:output] = 'json'\r\n opts[:callback] = 'callback'\r\n Yahoo::Request.get(\"http://auctions.yahooapis.jp/AuctionWebService/V2/categoryLeaf\", Yahoo::Api.merge(opts))\r\n end",
"def uhook_create_category\n category = ::Category.new(params[:category])\n category.locale = current_locale\n category\n end",
"def set_leaf\n @leaf = Leaf.find(params[:id])\n end",
"def set_leaf\n @leaf = Leaf.find(params[:id])\n end",
"def add_category(category, chat_session_id = nil)\n tokens = category.pattern.tokens.clone # Cloning array so we don't manipulate array belonging to pattern. # TODO: Refactor so Graphmaster\n # doesn't access tokens in Pattern directly (maybe return iterator for Category?)\n current_node = self\n current_token = tokens.shift\n\n while (current_token)\n current_token.chat_session_id = chat_session_id\n current_node = current_node.find_or_append_child(current_token)\n @word_nodes << current_node if current_node.word?\n current_token = tokens.shift\n end\n\n current_node = current_node.find_or_append_child(category.that)\n current_node = current_node.find_or_append_child(category.topic)\n current_node = current_node.find_or_append_child(category.template)\n @category_for_template[current_node] ||= category\n\n self\n end",
"def <<(key_and_child)\n raise \"Leaf nodes don't accept children (request was: #{key_and_child.inspect})\"\n end",
"def create\n #Creates the category to be saved in the db\n @category = Category.new(params[:category])\n @all_categories = Category.all\n\n #Set Component Group to nil\n if(!@category.parent_id.nil?)\n @category.parent_id = nil\n end\n #Sets Component Group with new params\n if(!params[:parent_ids].nil?)\n for id in params[:parent_ids]\n @category.parent_id = id\n end\n end\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def leaf_ids\n lids = []\n self.categories.leaves.each do |cat|\n lids << cat.id\n end\n lids\n end",
"def assign_product_to_category category_id, product_id\n # Assign the product to a category\n @server.call(\"call\", @session_id, \"catalog_category.assignProduct\", [category_id, product_id])\n rescue XMLRPC::FaultException => exception\n return exception\n end",
"def apply_children\n \n end",
"def set_category\r\n @product = Product.find(params[:product_id])\r\n # @product.categories.delete_all\r\n @product.category=Category.find(params[:id])\r\n @product.save\r\n end",
"def construct_category_tree(aRootCategory)\n\t\t\tlevel_nodes = case aRootCategory\n\t\t\t\twhen String\n\t\t\t\t\t[Category.find_by_name(aRootCategory)]\n\t\t\t\twhen Category \n\t\t\t\t\t[aRootCategory]\n\t\t\t\twhen CategoryType\n\t\t\t\t\t[aRootCategory.categories.top_level]\n\t\t\t\telse\n\t\t\t\t\tCategoryType.first.categories.top_level\n\t\t\tend\n\t\t\ttree_nodes = []\n\t\t\tbegin\n\t\t\t\ttree_nodes << level_nodes\n\t\t\t\tids = level_nodes.map {|n| n.id}\n\t\t\t\tlevel_nodes = Category.find_all_by_parent_id(ids) #Category.all({:conditions => ['parent_id in (?)',ids.join(',')]})\n\t\t\tend while !level_nodes.empty?\n\t\t\ttree_nodes\n\t\tend",
"def categories_attributes=(categories_hashes)\n categories_hashes.each do |index, categories_attributes|\n if categories_attributes[:name].present?\n category = Category.find_or_create_by(name: categories_attributes[:name])\n if !self.categories.include?(category)\n self.post_categories.build(:category => category)\n end\n end\n end\n end",
"def add_category\n @product = Product.find(params[:product_id])\n @product.add_category(params[:category_id])\n respond_to do |format|\n format.html { redirect_to product_path(@product) }\n format.js { render :json => {:action => \"add\"} }\n end\n end",
"def categories_attributes=(categories)\n \tcategories.each do |index, category_hash|\n \t\tif category_hash[:name].present?\n\t\t\tcategory = Category.find_or_create_by(name: category_hash[:name])\n\t\t\tif !self.categories.include?(category)\n\t\t\t self.post_categories.build(:category => category) \n\t\t\tend\n end\n \tend\n end",
"def root_category_params\n params.fetch(:root_categories, {}).permit(:name)\n end",
"def expand_categories(categories, text)\r\n html = '<ul class=\"'+text+'\">'\r\n categories.each do |cat|\r\n options = { :url => edit_article_category_path(cat), :method => :get, :loading => \"wait_for_content_update('edit')\" }\r\n child_categories = cat.children\r\n nested_html = child_categories.empty? ? '' : expand_categories(child_categories, \"subtitles\")\r\n html << '<li class=\"article_category\">' + link_to_remote(cat.display_text, options) + nested_html + '</li>'\r\n end\r\n html + '</ul>'\r\n end",
"def category_attributes=(category_attributes) # arg. will be key value pair to search for/create\n self.category = Category.find_or_create_by(category_attributes)\n end",
"def create\n # authorize\n authorize! :create, ArticleCategory\n @article_category = ArticleCategory.new(article_category_params)\n @article_category.user_id = current_user.id \n\n respond_to do |format|\n if @article_category.save\n # update parent\n @article_category.parent.clear\n @article_category.parent << ArticleCategory.find(params[:parent_id]) if params[:parent_id].present?\n \n format.html { redirect_to edit_admin_article_category_path(@article_category.id), notice: 'Tạo mới chuyên mục bài viết thành công.' }\n format.json { render :show, status: :created, location: @article_category }\n else\n format.html { render :new }\n format.json { render json: @article_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_category params\n cat = validate_and_store :category, params\n cat ? category_key(cat) : nil\n end",
"def categories_attributes=(category_hashes)\n # needed so post new form can be used to create categories_attributes\n category_hashes.each do | index, category_attributes |\n if category_attributes[:name].present?\n category = Category.find_or_create_by(name: category_attributes[:name])\n # if category already exists for post, don't add it\n if !self.categories.include?(category)\n self.categories << category # inefficient!\n self.save\n end\n end\n end\n end",
"def list\r\n\t\t@current_area = 'categories'\r\n\t\t@current_menu = 'products'\r\n\r\n\t\tif params[:select]\r\n\t\t\tif params[:delete]\r\n\t\t\t\t# you MUST manually move child nodes in an acts_as_tree up before calling\r\n\t\t\t\t# the destroy! method. Otherwise Rails will automatically go and delete all\r\n\t\t\t\t# the child nodes even before the selected nodes' 'before_destroy' callback\r\n\t\t\t\t# is triggered!\r\n\t\t\t\tparams[:select].keys.each do |k|\r\n\t\t\t\t\tthe_cat = Category.find(k)\r\n\t\t\t\t\tthe_cat.move_children_up()\r\n\t\t\t\t\tCategory.destroy(the_cat.id)\r\n\t\t\t\tend\r\n\t\t\telsif params[:move_up]\r\n\t\t\t\t# We have to use a Hash as Array iterators do not like sparse indexing.\r\n\t\t\t\tselected_categories = Hash.new\r\n\t\t\t\tcat_index = Hash.new\r\n\t\t\t\tparams[:select].keys.each do |k|\r\n\t\t\t\t\tc = Category.find(k)\r\n\t\t\t\t\tif selected_categories[c.parent_id].nil?\r\n\t\t\t\t\t\tselected_categories[c.parent_id] = Hash.new\r\n\t\t\t\t\tend\r\n\t\t\t\t\tselected_categories[c.parent_id][c.id] = c.sequence\r\n\t\t\t\t\tcat_index[c.id] = c\r\n\t\t\t\tend\r\n\t\t\t\tselected_categories.each do |i, parent|\r\n\t\t\t\t\t# Hash.sort converts the hash into a nested array before sorting; [0] = key, [1] = value.\r\n\t\t\t\t\t# Note that we only want the IDs which are contained in the index 'j'.\r\n\t\t\t\t\tparent.sort{|a,b| (a[1]<=>b[1])}.each do |j, the_sequence|\r\n\t\t\t\t\t\tcat_index[j].move_higher\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\telsif params[:move_down]\r\n\t\t\t\t# See comments for move_up above\r\n\t\t\t\tselected_categories = Hash.new\r\n\t\t\t\tcat_index = Hash.new\r\n\t\t\t\tparams[:select].keys.each do |k|\r\n\t\t\t\t\tc = Category.find(k)\r\n\t\t\t\t\tif selected_categories[c.parent_id].nil?\r\n\t\t\t\t\t\tselected_categories[c.parent_id] = Hash.new\r\n\t\t\t\t\tend\r\n\t\t\t\t\tselected_categories[c.parent_id][c.id] = c.sequence\r\n\t\t\t\t\tcat_index[c.id] = c\r\n\t\t\t\tend\r\n\t\t\t\tselected_categories.each do |i, parent|\r\n\t\t\t\t\t# Note order of b/a is swapped to move down. This and move_lower instead of move_higher\r\n\t\t\t\t\t# is the only difference between this and the move_up code above.\r\n\t\t\t\t\tparent.sort{|a,b| (b[1]<=>a[1])}.each do |j, the_sequence|\r\n\t\t\t\t\t\tcat_index[j].move_lower\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\texpire_fragment(:controller => :products, :action => :home, :part => 'category_menu')\r\n\t\tend\r\n\r\n\t\t@root_cat = Category.find(1)\r\n\tend",
"def remove_product(prod_id, propagate = true)\n if leaf?\n begin\n Category.transaction do\n CategoryProduct.delete_all(\n [\"category_id = ? AND product_id = ?\", self.id, prod_id]) \n propagate_products_up if propagate\n end\n rescue Exception => e\n errors.add(:base, \"Removal of product failed: #{e}\")\n end\n else\n errors.add(:base, \"Can't delete product from interior category.\")\n end\n end",
"def plant_tree\n @category = Category.new\n subject = @category.subjects.build\n subject.resources.build\n @categories = Category.all\n @subjects = Subject.all\n render 'new'\n end",
"def categories_attributes=(categories_hashes)\n categories_hashes.each do |i, category_attributes|\n if category_attributes[:name].present?\n category = Category.find_or_create_by(name: category_attributes[:name])\n if !self.categories.include?(category)\n self.post_categories.build(:category => category)\n end\n end\n end\n end",
"def create\n @admin_product_category = ProductCategory.new(admin_product_category_params)\n\n respond_to do |format|\n if @admin_product_category.save\n format.html { redirect_to admin_bar_menu_path(@admin_product_category.menu.bar, @admin_product_category.menu), notice: 'Product category was successfully created.' }\n format.json { render :show, status: :created, location: @admin_product_category }\n else\n format.html { render :new }\n format.json { render json: @admin_product_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_category = ProductCategory.new(product_categories_params)\n\n respond_to do |format|\n if @product_category.save\n format.html { redirect_to admins_product_categories_path, :notice => 'Store category was successfully created.' }\n format.json { render :json => @product_category, :status => :created, :location => @product_category }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product_category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_taxons\n save_if_new\n chain_list = get_each_assoc\n chain_list.each do |chain|\n # Each chain can contain either a single Taxon,\n # or the tree like structure parent>child>child\n name_list = chain.split(/\\s*>\\s*/)\n taxonomy_name = name_list.shift\n taxonomy = @@taxonomy_klass.find_or_create_by_name(taxonomy_name)\n raise DataShift::DataProcessingError.new(\"Could not find or create Taxonomy #{taxonomy_name}\") unless taxonomy\n taxon = taxonomy.root\n name_list.each do |taxon_name|\n taxon = @@taxon_klass.find_or_create_by_name_and_parent_id_and_taxonomy_id(taxon_name, taxon.id, taxonomy.id)\n end\n\n if taxon\n @product.taxons << taxon\n puts \" Added to taxon #{taxon.pretty_name}\"\n else\n puts \" Taxon not found or created: #{name}\"\n end\n\n end\n end",
"def get_feature_reviews_roots\n @trees ||= self.product.category.self_and_ancestors.collect { |cat| [cat, Feature.node_roots(:include => :feature_reviews, :conditions => [\"features.category_id=? AND feature_reviews.review_id=?\", cat.id, id])] }\n end",
"def set_category_to_product\n @category_to_product = CategoryToProduct.find(params[:id])\n end",
"def create\n @category = Category.new(params[:category])\n if !admin?\n if @category.parent_id.nil?\n flash[:warning] = 'You cannot create a root category unless you are an admin.'\n return render :action => \"new\"\n end\n @category.group_id = current_user.group_id\n end\n @category.group_id = @category.parent.group_id if @category.parent\n respond_to do |format|\n if @category.save\n flash[:notice] = 'Category was successfully created.'\n format.html { redirect_to(test_cases_path(:category_id => @category.id)) }\n format.xml { render :xml => @category, :status => :created, :location => @category }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def assign_categories=(value)\n @assign_categories = value\n end",
"def set_leaf\n @leaf = Leaf.find(params[:id])\n end",
"def create\n @product = Product.new(product_params)\n @product.categories.clear\n if params[:category_ids].present?\n params[:category_ids].each do |id| \n @product.categories << Category.find(id)\n end\n end\n \n @product.areas.clear\n if params[:area_ids].present?\n params[:area_ids].each do |id| \n @product.areas << Area.find(id)\n end\n end\n \n @product.articles.clear\n if params[:article_ids].present?\n params[:article_ids].each do |id| \n @product.articles << Article.find(id)\n end\n end\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to edit_admin_product_path(@product.id), notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_category\n\t\tself.category_type=\"Main\"\n\t\tself.save\n\tend",
"def leaf(node, tag)\r\n end",
"def product_category_id=(id)\n self.parent = if id.blank?\n nil\n else\n ProductCategory.find(id)\n end\n end",
"def new\n @product_use_printrun = ProductUsePrintrun.new\n @product_categories = ProductCategory.find(:all)\n @product_use_printrun.product_categories << @product_categories[params[:id].to_i-1] if params[:id]\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_use_printrun }\n end\n end",
"def index\n category = params[:category]\n category = category == nil ? ROOT_ID : category.to_i\n\n current_category = Category.find(category)\n\n # Create an array of nearest childs of current_category\n @categories = current_category.categories\n\n # Create ancestors path\n @category_seq = [current_category]\n until @category_seq.first.id == ROOT_ID\n @category_seq.unshift( @category_seq[0].category )\n end\n\n # Create an array of all childs\n subcategories = get_subc(current_category)\n\n # Create an array of all products which belongs to current_category\n @items = current_category.products.to_a\n\n subcategories.each do |c|\n c.products.each { |p| @items.push p }\n end\n\n @items = Kaminari.paginate_array(@items).page(params[:page]).per(7)\n\n respond_to do |format|\n format.html\n format.js {}\n end\n\n\tend",
"def category_params\n params.require(:category).permit(:name, immediate_parent_list: [], parent_list: [])\n end"
] |
[
"0.6150408",
"0.5966761",
"0.5800269",
"0.5593024",
"0.55616397",
"0.5540508",
"0.5476254",
"0.5287752",
"0.5285551",
"0.52736497",
"0.5183773",
"0.5157095",
"0.5156824",
"0.5106109",
"0.5102734",
"0.5075878",
"0.50305045",
"0.49920252",
"0.49850667",
"0.49596792",
"0.49565062",
"0.49400038",
"0.4934613",
"0.49254513",
"0.49075994",
"0.48988426",
"0.48932022",
"0.4865633",
"0.4863452",
"0.48623028",
"0.48606193",
"0.4860038",
"0.48520565",
"0.48486385",
"0.48362082",
"0.48332405",
"0.4828359",
"0.48276052",
"0.4821049",
"0.4816527",
"0.48114172",
"0.48096493",
"0.4792995",
"0.47840816",
"0.47712678",
"0.47690165",
"0.47685686",
"0.47631645",
"0.47578946",
"0.47528645",
"0.4740958",
"0.47355196",
"0.47349197",
"0.4733381",
"0.47324595",
"0.47311217",
"0.47301558",
"0.4725496",
"0.47149414",
"0.47131437",
"0.47063476",
"0.47034985",
"0.47006693",
"0.47006693",
"0.46965706",
"0.46926564",
"0.46912962",
"0.4683916",
"0.4681215",
"0.46772552",
"0.46681955",
"0.46658185",
"0.46619913",
"0.4661844",
"0.4657528",
"0.46536347",
"0.46534067",
"0.46510577",
"0.4650427",
"0.46392372",
"0.46359423",
"0.46332946",
"0.46285382",
"0.462809",
"0.4620551",
"0.46182212",
"0.46067894",
"0.46058017",
"0.46045402",
"0.45885193",
"0.45858216",
"0.45847926",
"0.457448",
"0.45743877",
"0.45728558",
"0.45611805",
"0.45474732",
"0.45429164",
"0.45283458",
"0.45260966"
] |
0.686687
|
0
|
Return an array of the leaf category ids for this product.
|
def leaf_ids
lids = []
self.categories.leaves.each do |cat|
lids << cat.id
end
lids
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def category_ids\n self.associated_categories.collect{ |c| c.id }\n end",
"def all_category_ids\n end",
"def ids\n self.is_leaf? ? [@ids].flatten : self.children.inject([]) {|result, item| result += item.ids}\n end",
"def category_ids\n # {{{\n if !@category_ids then\n @category_ids = User_Category.select_values(User_Category.category_id) { |cid|\n cid.where(User_Category.user_group_id == (user_group_id))\n }.to_a.flatten.map { |c| c.to_i }\n end\n return @category_ids\n end",
"def category_tree\n cats = []\n categories.each do |cat|\n cats << cat\n cats = cats + cat.ancestors\n end\n return cats\n end",
"def candidate_paths\n # All leaf categories for this product family. This is an array\n # of hashes. Each hash has keys :catid and :path.\n candidates = self.product_family.leaf_category_paths\n\n # All leaf category ids that were previously selected for this\n # product. This will be a subset of the candidates.\n current = self.leaf_ids\n\n candidates.each do |lcp|\n if current.include? lcp[:catid]\n lcp.merge! :selected => true\n else\n lcp.merge! :selected => false\n end\n end\n candidates\n end",
"def categories\n category_keys.collect(&:to_s)\n end",
"def get_leaf_cat_urls\n cat_urls_table = @db[:cat_urls]\n cat_urls_table.map(:url)\n end",
"def category_ids_for(race)\n ids = [race.category_id]\n ids = ids + race.category.descendants.map {|category| category.id}\n ids.join(', ')\n end",
"def category_ids_for(race)\n ids = [race.category_id]\n ids = ids + race.category.descendants.map {|category| category.id}\n ids.join(', ')\n end",
"def category_ids\n (categories.length > 0) ? categories.map{|c| c.id}.join(', ') : 'NULL'\n end",
"def category_ids\n (categories.length > 0) ? categories.map{|c| c.id}.join(', ') : 'NULL'\n end",
"def _tags\n tags = []\n categories.find_each do |category|\n tags << category.self_and_ancestors.pluck(:name)\n end\n tags.flatten.uniq\n end",
"def parent_ids\n if ancestor_ids.empty? then\n []\n else\n branches.map { |branch| cast_primary_key(branch.split('/').last) }.uniq\n end\n end",
"def category_ids\n @new_category_ids or super\n end",
"def category_ids(categories)\n #This can accept an array or a single id\n categories = [categories] unless categories.class == Array\n bb_products = []\n categories.each do |category|\n category = ProductCategory.trim_retailer(category)\n product_infos = get_shallow_product_infos(category, english = true, use_cache = true)\n product_infos.select! { |product_info| product_info[\"isVisible\"] != false } \n bb_products += product_infos.map{ |p| BBproduct.new(:id => p[\"sku\"], :category => category) }\n end\n bb_products\n end",
"def active_cate_ids\n self.products.group_by(&:cate_id).keys.sort\n end",
"def parent_categories\n c = self\n categories = []\n until c.parent.blank? do\n c = c.parent\n categories.unshift c\n end\n categories\n end",
"def child_ids\n ids = [self.id]\n self.children.each do |child|\n ids += child.child_ids\n end\n ids\n end",
"def _build_clusters(tile)\n used_ids = []\n clusters = []\n\n _adapter.in_tile(*tile.children).find_each do |child|\n cluster = _adapter.build_from(tile.depth, child)\n clusters << cluster\n used_ids << child.id\n end\n\n return [used_ids, clusters]\n end",
"def categories\n return @categories\n end",
"def get_all_child_collections_ids()\r\n ids = @db_interface.get_all_hash_values(@certain_coll_key)\r\n ids ||= []\r\n return ids\r\n end",
"def selected_categories\n list = []\n @browser.div(:id=>\"assignlocation_jstree_selected_container\").lis.each do |li|\n list << li.text\n end\n return list\n end",
"def get_feature_values_roots()\n @trees ||= self.category.self_and_ancestors.collect { |cat| [cat, Feature.node_roots(:include => :feature_values, :conditions => [\"features.category_id=? AND feature_values.product_id =?\", cat.id, id])] }\n end",
"def categories\n categories = Array.new\n unless self.category.nil?\n categories << self.category\n categories += self.category.ancestors\n end # unless\n categories.reverse\n end",
"def possible_branch_nodes\r\n max_depth = max_category_depth\r\n article_categories.select {|ac| ac.parent_id.nil? || (ac.depth < max_depth)}\r\n end",
"def category_keys\n @backend.category_keys\n end",
"def apply_category_filter\n top_level_category_ids = Category.top_level.\n where(id: @category_ids).\n pluck(:id)\n subcategory_ids = @category_ids +\n Category.where(parent_id: top_level_category_ids).pluck(:id)\n\n subcategory_ids\n end",
"def ids\n root.ids\n end",
"def categories(parent_id = nil)\n categories_data = Rails.cache.fetch('ebay_categories', expires_in: 10.day) do\n categories = client.call(:GetCategories, CategorySiteID: 0, ViewAllNodes: true, DetailLevel: 'ReturnAll')\n categories = categories.category_array.category.map do |c|\n {\n name: c[:category_name],\n id: c[:category_id].to_s,\n parent_id: c[:category_parent_id].to_s,\n level: c[:category_level],\n }\n end\n {\n by_parent_id: categories.group_by { |r| r[:parent_id] },\n by_level: categories.group_by { |r| r[:level] }\n }\n end\n categories_formatter(categories_data, parent_id)\n rescue\n []\n end",
"def get_self_and_children_ids\n ids = [self.id]\n ids += get_children_ids_recursive\n return ids\n\t\tend",
"def categories\n return @categories\n end",
"def categories\n return @categories\n end",
"def categories\n return @categories\n end",
"def parent_ids\n []\n end",
"def clil_categories_codes\n self.clil_categories.map{|c| c.code}.uniq\n end",
"def categories\n []\n end",
"def clil_categories_codes\n self.clil_categories.map { |c| c.code }.uniq\n end",
"def leaf_ids=(lids)\n\n save! if new_record?\n\n # Clear out all mention of the product from the entire tree.\n CategoryProduct.delete_all([\"product_id = ?\", self.id])\n\n lids.each do |lid|\n next if lid == \"none\"\n category = Category.find(lid)\n category.add_product(self, auto_prop)\n end\n end",
"def category_ids\n ActiveRecord::Base.connection.select_values( \"SELECT DISTINCT c.id from categories as c, movie_user_categories as muc\n where muc.category_id = c.id and muc.movie_id = #{self.id}\" ).map(&:to_i)\n end",
"def ancestor_ids\n read_attribute(self.base_class.ancestry_column).to_s.split(%r|[,/]|).uniq.map { |id| cast_primary_key(id) }\n end",
"def categories_in_path(&block)\n list = []\n current_node = self\n while current_node && current_node.name != 'Categories'\n yield current_node if block_given?\n list.insert(0, current_node)\n current_node = current_node.parent\n end\n list\n end",
"def children\n kids = []\n each_child { |kid| kids << kid }\n kids\n end",
"def get_feature_reviews_roots\n @trees ||= self.product.category.self_and_ancestors.collect { |cat| [cat, Feature.node_roots(:include => :feature_reviews, :conditions => [\"features.category_id=? AND feature_reviews.review_id=?\", cat.id, id])] }\n end",
"def descendant_ids\n descendants.map(&:id)\n end",
"def to_categories(sub_context)\n Array(sub_context).map { |id|\n categories[id] \n }.compact\n end",
"def ancestors_ids\n node, nodes = self, []\n while node.parent\n node = node.parent\n nodes << node.id\n end\n nodes\n end",
"def categories_list\n @categories = Category.all.collect { |p| [p.name, p.id] }\n end",
"def ids\n @nodes.map(&:id)\n end",
"def get_children_ids_recursive\n ids = []\n children.each do |c|\n\t\t\t\tif !c.children.empty?\n\t\t\t\t\tids += c.get_children_ids_recursive\n\t\t\t\tend\n\t\t\t\tids << c.id\n\t\t\tend\n return ids\n\t\tend",
"def parent_ids\n if ancestor_ids.empty? then\n nil\n else\n branches.map { |branch| cast_primary_key(branch.split('/').last) }\n end\n end",
"def path\n return @path_array if @path_array\n parent_category = self\n @path_array = [parent_category]\n while (parent_category = parent_category.parent) != nil do\n @path_array.insert(0, parent_category) \n end\n @path_array\n end",
"def all_ancestor_ids\n ancestors.pluck(:id)\n end",
"def categories_list\n self.categories.collect{|c| c.name}\n end",
"def categories\n Category.position_sorted\n end",
"def child_ids\n\n children.collect { |cfei| Ruote.extract_child_id(cfei) }\n end",
"def product_ids\n new_record? ? (@products ? @products.map(&:id) : []) : self.root.products.map(&:id)\n end",
"def category_names\n categories.map {|category| CategoryCode[category]}\n end",
"def categories\n raw_categories.to_hashugar\n end",
"def get_childs_of_category(category_id)\n #convert string to BSON::ObjectId\n if !category_id.is_a?(BSON::ObjectId)\n category_id = BSON::ObjectId.from_string(category_id)\n end\n\n #find categories with ancestors have this category_id\n childs = Category.any_in(parent_ids: [category_id])\n\n results = Array.new\n childs.each do |child|\n results << child\n end\n\n results\n end",
"def categories\n category\n end",
"def children_ids\n \t children_ids = []\n self.children.each { |child| children_ids << child.id if child.permitted? } unless self.children.empty?\n children_ids\n end",
"def top_level_categories\r\n Category.where(parent_id: 0).order(:name).limit(8)\r\n end",
"def cluster_ids\n []\n end",
"def branches\n if ancestor_ids.empty? then\n nil\n else\n read_attribute(self.base_class.ancestry_column).to_s.split(',')\n end\n end",
"def main_categories\n categories.to_a[0..3]\n end",
"def get_childs\n childs = Category.any_in(parent_ids: [parent.id])\n\n results = Array.new\n childs.each do |child|\n results << child\n end\n\n results\n end",
"def getCategoryList\n categoryDump = @course.assessment_categories\n categories = {}\n for cat in categoryDump do\n categories[cat.name] = cat.id\n end\n return categories\n end",
"def all_categories\n @mutex.synchronize do\n @categories.keys\n end\n end",
"def ids\n @store.transaction do\n @store.roots\n end\n end",
"def get_subc(category)\n retval = []\n #Category.where(category_id: category.id).each do |c| \n category.categories.each do |c| \n retval += [c] + get_subc(c)\n end\n retval\n end",
"def get_category_select_options(c, level=0)\n retval = []\n retval << [('-' * level) + c.name, c.id]\n c.categories.each do |child_c|\n get_category_select_options(child_c, level + 1).each do |child_c|\n retval << child_c\n end\n end\n \n return retval\n end",
"def categories\n rpg_shop.handled_categories\n end",
"def taxonomy_ids\n taxon_and_ancestors.map(&:taxonomy_id).flatten.uniq\n end",
"def build_categories(product, mapped_categories)\n collection = []\n\n product[:categories].each do |category_name|\n mapped_categories.each do |mapped_category|\n build_category_tree(collection, category_name, mapped_category)\n end\n end\n\n collection\n end",
"def lineage_ids\n ancestor_ids + subtree_ids\n end",
"def lineage_ids\n ancestor_ids + subtree_ids\n end",
"def bisac_categories_codes\n self.bisac_categories.map { |c| c.code }.uniq\n end",
"def category_names\n self.categories.map do |category|\n category.name\n end\n end",
"def bisac_categories_codes\n self.bisac_categories.map{|c| c.code}.uniq\n end",
"def categories_for_solution_search(category)\n [Sfcatnode.root] + category.children\n end",
"def crumb_parents\n []\n end",
"def product_category_id\n parent.id if parent\n end",
"def categories\n data['JobCategory'] || []\n end",
"def categories\n return [] if @categories.blank?\n @categories.records.map {|c| c.display_name}\n end",
"def category_enum\n Category.all.collect {|p| [ p.name, p.id ] }\n end",
"def get_categories\n cats = []\n params.each do |k,v|\n if k.starts_with? \"category\"\n name = v\n num = cat_number(k) \n cats << [name,num]\n end\n end\n return cats\n end",
"def construct_category_tree(aRootCategory)\n\t\t\tlevel_nodes = case aRootCategory\n\t\t\t\twhen String\n\t\t\t\t\t[Category.find_by_name(aRootCategory)]\n\t\t\t\twhen Category \n\t\t\t\t\t[aRootCategory]\n\t\t\t\twhen CategoryType\n\t\t\t\t\t[aRootCategory.categories.top_level]\n\t\t\t\telse\n\t\t\t\t\tCategoryType.first.categories.top_level\n\t\t\tend\n\t\t\ttree_nodes = []\n\t\t\tbegin\n\t\t\t\ttree_nodes << level_nodes\n\t\t\t\tids = level_nodes.map {|n| n.id}\n\t\t\t\tlevel_nodes = Category.find_all_by_parent_id(ids) #Category.all({:conditions => ['parent_id in (?)',ids.join(',')]})\n\t\t\tend while !level_nodes.empty?\n\t\t\ttree_nodes\n\t\tend",
"def category_tree\n @category_tree = {}\n get_category_browse_nodes.each do |n|\n build_category_tree(n)\n end\n @category_tree\n end",
"def post_categories(p)\n result = []\n\n q = @db.query(\"select x.term_id\n from wp_term_taxonomy as x join wp_term_relationships as r\n on x.term_taxonomy_id = r.term_taxonomy_id\n where r.object_id = #{p}\")\n\n q.each_hash do |c|\n id = c['term_id'].to_i\n if @categories[id].nil?\n STDERR.puts \"[Wordpress:post_categories] ignoring absent category term_id #{id} for post #{p}\"\n else\n result.push id\n end\n end\n\n return result\n end",
"def ministry_list\n root_ministry.descendants.pluck(:id)\n end",
"def list_children id\n\t\traw_output = @fred.category( 'children', category_id: id.to_s )\n\n\t\traw_output.categories.category\n\tend",
"def branches\n object.branches.map { |b| b.id }\n end",
"def child_group_ids\n child_groups.map(&:id)\n end",
"def kata_user_categories\n kataUserCategories = []\n survived_reviews.each do |review|\n review.category_ids.each {|category_id| kataUserCategories << category_id}\n end\n kataUserCategories.uniq\n end",
"def index\n @categories = MiddleCategory.category_tree\n @middle_categories = @categories.group_by {|category| category.large_category_code}\n end",
"def set_full_path_ids!\n if parent_category_id.to_i > 0\n all_categories_to_top.collect { |c| c.id.to_s }.join(',')\n else\n self.full_path_ids = id.to_s\n end\n end",
"def child_object_ids(valkyrie: false)\n child_objects(valkyrie: valkyrie).map(&:id)\n end",
"def category_parents(max_distance)\n @parents[0] = [@entity] if @parents[0].empty?\n add_relatives(@parents,1,max_distance,:parents){|r| r.eponymous_articles.flat_map{|a| a.categories.to_a } }\n @parents\n end",
"def categories\n Hash[self.class.catalogs.map { |fld, klass|\n name = fld.gsub(/_id$/, '_name');\n [fld, {:id => self.send(fld), :name => self.send(name)}] rescue nil\n }.reject {|cat| cat.nil?}]\n end"
] |
[
"0.7195566",
"0.6842188",
"0.6680551",
"0.6616662",
"0.6568534",
"0.63752604",
"0.6304599",
"0.62496436",
"0.6173014",
"0.6173014",
"0.61586803",
"0.61586803",
"0.61472106",
"0.6140462",
"0.61340463",
"0.6131648",
"0.6117466",
"0.61149436",
"0.6114322",
"0.6081581",
"0.6080065",
"0.60653347",
"0.6058988",
"0.6049382",
"0.60152996",
"0.60034984",
"0.59568113",
"0.5952233",
"0.594484",
"0.5928202",
"0.59205085",
"0.5917303",
"0.5917303",
"0.5917303",
"0.5884227",
"0.58753204",
"0.5870916",
"0.5870649",
"0.58601063",
"0.58332413",
"0.5831503",
"0.58281744",
"0.5822801",
"0.582053",
"0.5813814",
"0.58128846",
"0.58108103",
"0.57967836",
"0.5775488",
"0.5766148",
"0.5761545",
"0.57508385",
"0.5744683",
"0.57439005",
"0.57376057",
"0.57342166",
"0.5709328",
"0.56955856",
"0.56902295",
"0.5688855",
"0.56743205",
"0.5673253",
"0.56688255",
"0.5665057",
"0.56387424",
"0.56359094",
"0.5633033",
"0.5596629",
"0.5580381",
"0.5571548",
"0.5570332",
"0.5565148",
"0.5559458",
"0.5558084",
"0.55525357",
"0.55459905",
"0.55459905",
"0.55453134",
"0.55431145",
"0.5539132",
"0.55128586",
"0.55036646",
"0.5500183",
"0.5488439",
"0.5481192",
"0.54808635",
"0.54431194",
"0.5442181",
"0.54394025",
"0.54141223",
"0.54080737",
"0.5402019",
"0.5387549",
"0.5380475",
"0.536274",
"0.5354819",
"0.5350029",
"0.53474283",
"0.534653",
"0.5345345"
] |
0.8255697
|
0
|
Merge an indicator into 'leaf_category_paths' that tells if the current product is visible in that path.
|
def candidate_paths
# All leaf categories for this product family. This is an array
# of hashes. Each hash has keys :catid and :path.
candidates = self.product_family.leaf_category_paths
# All leaf category ids that were previously selected for this
# product. This will be a subset of the candidates.
current = self.leaf_ids
candidates.each do |lcp|
if current.include? lcp[:catid]
lcp.merge! :selected => true
else
lcp.merge! :selected => false
end
end
candidates
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def serachable_leafs\n leafs.select { |leaf| leaf && leaf.searchable && leaf.visible }.compact\n end",
"def category_leaf(opts={})\r\n opts[:output] = 'json'\r\n opts[:callback] = 'callback'\r\n Yahoo::Request.get(\"http://auctions.yahooapis.jp/AuctionWebService/V2/categoryLeaf\", Yahoo::Api.merge(opts))\r\n end",
"def uncategorized_folder_expanded?\n session[:expand_uncategorized] = false if session[:expand_uncategorized].blank?\n return session[:expand_uncategorized]\n end",
"def set_full_path_ids!\n if parent_category_id.to_i > 0\n all_categories_to_top.collect { |c| c.id.to_s }.join(',')\n else\n self.full_path_ids = id.to_s\n end\n end",
"def each_visible_leaf#:yields: leaf\n leafs.compact!\n \n leafs.each do |leaf|\n yield leaf if leaf.visible\n end\n end",
"def leaf?; @leaf; end",
"def is_leaf?\n\t\tself.part_map.empty?\n\tend",
"def is_leaf\n true\n end",
"def is_leaf\n true\n end",
"def propagation_leafs\n trace.each_vertex.find_all { |v| trace.leaf?(v) }\n end",
"def leaf?\n true\n end",
"def leaf?\n self.variations.size == 0\n end",
"def get_leaf_cat_urls\n cat_urls_table = @db[:cat_urls]\n cat_urls_table.map(:url)\n end",
"def leaf?\n level.zero?\n end",
"def leaf_ids\n lids = []\n self.categories.leaves.each do |cat|\n lids << cat.id\n end\n lids\n end",
"def leaf?(term_or_go)\n go_id = as_term(term_or_go).id\n not_a_leaf = @terms.any? do |term| \n term.is_as.any? do |is_a_id| \n go_id == is_a_id\n end\n end\n !not_a_leaf\n end",
"def path\n return @path_array if @path_array\n parent_category = self\n @path_array = [parent_category]\n while (parent_category = parent_category.parent) != nil do\n @path_array.insert(0, parent_category) \n end\n @path_array\n end",
"def leaf?\n children.where(parent_id: self.id).empty?\n end",
"def valid_category_path?(category_path)\n CATEGORIES.each do |k, v|\n if v[:path] && v[:path] == category_path\n return true\n end\n\n if v[:children] && v[:children].values.include?(category_path)\n return true\n end\n end\n\n false\n end",
"def breadcrumbs_for(category_leaf: nil, concept: nil, dataset: nil)\n # start with the root\n breadcrumb 'home', categories_path, match: :exact\n\n # basic breadcrumbs for dataset\n breadcrumb (dataset.name || ''), dataset_path(dataset) if dataset.present?\n\n return if category_leaf.nil?\n\n # build the breadcrumbs for the category's parent-tree\n category_leaf.ancestors.each do |category|\n breadcrumb (category.name || ''), category_path(category)\n end\n\n # ancestors doesn't include the leaf category (just it's parents)\n breadcrumb (category_leaf.name || ''), category_path(category_leaf)\n\n # finally, add the concept if it's there\n breadcrumb (concept.name || ''), concept_path(concept) if concept.present?\n end",
"def leaf?\n persisted? && if children_counter_cache_column\n self[children_counter_cache_column] == 0\n else\n children.count == 0\n end\n end",
"def leaf?\n persisted? && right.to_i - left.to_i == 1\n end",
"def taxons_with_ancestors\n taxons.flat_map(&:breadcrumb_trail)\n end",
"def leaf?\n @children.empty?\n end",
"def leaf?\n children.empty?\n end",
"def f_places_breadcrumb\n ancestor_list = @feature.nil? ? nil : @feature.closest_ancestors_by_perspective(current_perspective).drop(1)\n f_breadcrumb(ancestor_list)\n end",
"def leaf?\n leaves.count == 0\n end",
"def leaf?; false end",
"def hierarchical?\n if @path\n true\n else\n false\n end\n end",
"def flow_category_icon taxon\n icon = taxon.icon_file_name\n\n while icon.blank? && (taxon = taxon.parent)\n icon = taxon.icon_file_name\n end\n\n taxon && taxon.icon_file_name ? taxon.icon.url : nil\n end",
"def leaf?\n @succ.length == 0\n end",
"def category_1_path\n path = item_hash.deep_find([:primary_category, :category_name])\n path.nil? ? [] : path.split(':')\n end",
"def individual_breadcrumb\n add_breadcrumb \"Clients\", clients_path, :title => \"Clients\" \n add_breadcrumb \"Power Of Attorney\", '', :title => \"Power Of Attorney\" \n add_breadcrumb \"Principal Create\", '', :title => \"Principal Create\"\n end",
"def is_leaf?\n self.children_count.zero?\n end",
"def apply_category_filter\n top_level_category_ids = Category.top_level.\n where(id: @category_ids).\n pluck(:id)\n subcategory_ids = @category_ids +\n Category.where(parent_id: top_level_category_ids).pluck(:id)\n\n subcategory_ids\n end",
"def categories_from_path(special_dir)\n if relative_path.start_with?(special_dir)\n superdirs = []\n else\n superdirs = relative_path.sub(Document.superdirs_regex(special_dir), \"\")\n superdirs = superdirs.split(File::SEPARATOR)\n superdirs.reject! { |c| c.empty? || c == special_dir || c == basename }\n end\n\n merge_data!({ \"categories\" => superdirs }, :source => \"file path\")\n end",
"def each_hidden_leaf#:yields: leaf\n leafs.compact!\n \n leafs.each do |leaf|\n yield leaf unless leaf.visible\n end\n end",
"def leaf_node?(node_id)\n @leaf_count < node_id\n end",
"def mark_trees_for_export\n marked_any = false\n # cache the tags\n select = export_select_tags\n exclude = export_exclude_tags\n inherit_export_level = nil\n ancestor_stack = []\n\n # First pass: See if any headlines are explicitly selected\n @headlines.each do |headline|\n ancestor_stack.pop while not ancestor_stack.empty? and headline.level <= ancestor_stack.last.level\n if inherit_export_level and headline.level > inherit_export_level\n headline.export_state = :all\n else\n inherit_export_level = nil\n headline.tags.each do |tag|\n if (select.include? tag) then\n marked_any = true\n headline.export_state = :all\n ancestor_stack.each { |a| a.export_state = :headline_only unless a.export_state == :all }\n inherit_export_level = headline.level\n end\n end\n end\n ancestor_stack.push headline\n end\n\n # If nothing was selected, then EVERYTHING is selected.\n @headlines.each { |h| h.export_state = :all } unless marked_any\n\n # Second pass. Look for things that should be excluded, and get rid of them.\n @headlines.each do |headline|\n if inherit_export_level and headline.level > inherit_export_level\n headline.export_state = :exclude\n else\n inherit_export_level = nil\n headline.tags.each do |tag|\n if (exclude.include? tag) then\n headline.export_state = :exclude\n inherit_export_level = headline.level\n end\n end\n if headline.comment_headline?\n headline.export_state = :exclude\n inherit_export_level = headline.level\n end\n end\n end\n end",
"def leaf?\n @children.length.zero?\n end",
"def leaf?\n self.children.size == 0\n end",
"def show\n #binding.pry\n add_breadcrumb \"Articles\",articles_path\n cat=@article.category\n if cat\n cat.ancestors.reverse_each { |a| add_breadcrumb a.name,category_path(a) }\n add_breadcrumb cat.name,category_path(cat)\n end\n add_breadcrumb @article.title,article_path\n #ASK how to make this more DRY\n end",
"def categories\r\n return handle_resource_not_found unless @article_category\r\n\r\n add_category_breadcrumbs(@article_category)\r\n if @article_category.leaf?\r\n @title_text = @article_category.display_text\r\n @articles = fetch_articles(order_by, nil, :conditions => {:article_category_id => @article_category.id}, :include => [:user, :article_category])\r\n @other_recent_posts = @article_category.parent.all_recent_posts(:exclude_category => @article_category) if @article_category.parent\r\n render 'articles/subcategories'\r\n else\r\n return unless check_category_for_stale\r\n @subcategories_with_posts = @article_category.children.with_published_articles\r\n render 'articles/categories'\r\n end\r\n end",
"def public?\n category_tree.include?(Sfcatnode.root)\n end",
"def possible_branch_nodes\r\n max_depth = max_category_depth\r\n article_categories.select {|ac| ac.parent_id.nil? || (ac.depth < max_depth)}\r\n end",
"def add_to_path?(current_goods_nomenclature, previous_goods_nomenclature)\n current_goods_nomenclature.number_indents > previous_goods_nomenclature.number_indents ||\n previous_goods_nomenclature.chapter? && current_goods_nomenclature.heading?\n end",
"def breadcrumbs_for_business_directory_theme \n breadcrumbs = \"\"\n if @text.present?\n breadcrumbs = \"You searched for #{truncate(@text, :length => 30)}\"\n breadcrumbs += \" in #{@postal_code}\" if @postal_code.present?\n elsif @postal_code.present? \n breadcrumbs = \"ZIP: #{@postal_code}\"\n end\n if @category\n if @text.present?\n breadcrumbs += \" in \"\n else\n options = {\n :category_id => nil,\n :iframe_width => params[:iframe_width],\n :iframe_height => params[:iframe_height],\n :layout => @layout,\n :page_size => params[:page_size]\n }\n breadcrumbs += link_to( \"Coupons: \", options )\n end\n if @category.parent \n breadcrumbs += \"#{link_to( h(@category.parent.name), pagination_link_params(@page).merge!( :category_id => @category.parent.to_param) )}: \"\n end\n breadcrumbs += link_to( h(@category.name), pagination_link_params(@page) )\n end\n breadcrumbs = \" \" if breadcrumbs.blank?\n content_tag( :div, breadcrumbs, :class => 'breadcrumbs' )\n end",
"def animal_in_non_retail?\n location = Location.find(@location_id)\n @category_id == 1 && location.is_retail? == nil\n end",
"def leaf?\n record.persisted? && if children.loaded? || tree.columns.counter_cache?\n # no SQL-queries here\n children.empty?\n else\n !children.exists?\n end\n end",
"def categories_from_path(special_dir); end",
"def leaf?(r)\n r.children.empty?\n end",
"def leaf?\n !node?\n end",
"def has_children?\n !leaf?\n end",
"def hierarchical?\n @hierarchical ||= !klass.fact_model.hierarchical_levels.empty?\n end",
"def hierarchical?()\n return self.id =~ /\\Ahl_/i\n end",
"def fetch_categories_crumb(category, link_last_one = true)\n return \"\" unless category\n ancestors = category.ancestors\n last = link_last_one ? \"#{link_to(category.name, category_path(category))}\" : \"#{category.name}\"\n return last if ancestors.empty?\n links = ancestors.inject(\"\") do |acc, elem|\n acc += \"#{link_to(elem.name, category_path(elem))} /\"\n end + last\n end",
"def leaf_ids=(lids)\n\n save! if new_record?\n\n # Clear out all mention of the product from the entire tree.\n CategoryProduct.delete_all([\"product_id = ?\", self.id])\n\n lids.each do |lid|\n next if lid == \"none\"\n category = Category.find(lid)\n category.add_product(self, auto_prop)\n end\n end",
"def set_root_breadcrumb\n add_breadcrumb '<span class=\"fa fa-lg\"></span><span class=\"sr-only\">Top</span>'.html_safe, root_path\n end",
"def bobcat_breadcrumb_alias\n (current_institution.bobcat_alias) ? current_institution.bobcat_alias : views[\"dir\"]\n rescue\n views[\"dir\"]\n end",
"def categories_in_path(&block)\n list = []\n current_node = self\n while current_node && current_node.name != 'Categories'\n yield current_node if block_given?\n list.insert(0, current_node)\n current_node = current_node.parent\n end\n list\n end",
"def category\n path = @path_remote.split('/')\n return path[3] # Could require changes depending on the structure of the maps repo\n end",
"def lb_paths(linkbase_constant)\n paths=[]\n begin\n linkbase_refs=@taxonomy_content[\"annotation\"][0][\"appinfo\"][0][\"linkbaseRef\"]\n linkbase_refs.each do |ref|\n if ref[\"xlink:role\"]==linkbase_constant\n paths << \"#{@taxonomy_file_basedir}#{ref[\"xml:base\"]}#{ref[\"xlink:href\"]}\"\n end\n end\n rescue Exception => e\n end\n paths\n end",
"def ignore_path_prefix_breadcrumb(context={})\n %w(/p/order/payment-gateway /p/order/pay /p/myorder /p/activity)\n end",
"def category_path(category)\n category ? \"/l/#{category.name}\" : \"/l/uncategoried\"\n end",
"def leaf_version?\n\t\treturn self.child_versions.empty?\n\tend",
"def category(rel_path)\n find_category based_on_root rel_path\n end",
"def f_breadcrumb(feature)\n # content_tag :div, acts_as_family_tree_breadcrumb(feature, breadcrumb_separator) {|r| f_link(r, feature_path(r.fid), {}, {:s => true})}, :class => \"breadcrumbs\"\n content_tag :div, feature.closest_ancestors_by_perspective(current_perspective).collect{|r| f_link(r, feature_path(r.fid), {}, {:s => true})}.join(breadcrumb_separator).html_safe, :class => \"breadcrumbs\"\n end",
"def extract_breadcrumb\n end",
"def is_leaf?\n self.left_child == nil and\n self.right_child == nil\n end",
"def category_path_by_name(category)\n category = category.to_sym\n\n return CATEGORIES[category][:path] if CATEGORIES.keys.include?(category)\n\n CATEGORIES.each do |k, v|\n if v[:children] && v[:children].keys.include?(category)\n return v[:children][category]\n end\n end\n\n false\n end",
"def breadcrumb_trail\n ancestors + [self]\n end",
"def self_and_siblings\n parent ? parent.children : Category.roots\n end",
"def self_and_siblings\n parent ? parent.children : Category.roots\n end",
"def leaf?\n new_record? || (rgt - lft == 1)\n end",
"def product_breadcrumb?(product=nil)\n\t\t!product.empty?\n\tend",
"def leaf?\n right - left == 1\n end",
"def narrow_path_container\n\t\t\t\t@narrow_path ? self : parent ? parent.narrow_path_container : nil\n\t\t\tend",
"def selected_sub_catgeory?\r\n !session[:selected_sub_catgeory].nil?\r\n end",
"def the_breadcrumb(add_post_type = true)\n generate_breadcrumb(add_post_type)\n h.breadcrumb_draw\n end",
"def with_depth_and_path\n with_depth && with_path\n end",
"def filterable?\n !linked_category?\n end",
"def expand_category_ids\n\n #if we are on the filters brand page and the original url contains /categories we need to insert a dpc key into params\n if params[:originalURL].to_s.include?(\"/categories/\")\n parsed_original_url = params[:originalURL].split(\"/\")\n dpc_id = DPCategory.where(\"id = ? or param = ?\", parsed_original_url[2], parsed_original_url[2]).first.id\n #then we are on search/products or a brand page\n elsif !params[:id].nil? && params[:controller] == \"categories\" && params[:dpc].nil?\n dpc_id = DPCategory.where(\"id = ? or param = ?\", params[:id], params[:id]).first.id\n else\n #provides support for dpc[any] or dpc[all] in url\n params[:dpc] = nil if params[:dpc] == \"\"\n dpc_id = params[:dpc].try(:[],:any) || params[:dpc].try(:[],:all)\n end\n #match the DPCategory.id DPCategory.name that has been turned into a slug\n @dp_category = DPCategory.where(\"id in (?) or param in (?)\", dpc_id, dpc_id).first\n\n #we must set @dpc_param as nil here. otherwise we pass dpc with empty arrays to the searcher which will force zero results\n if @dp_category.blank?\n @dpc_param = nil\n #if we are working with a parent id\n elsif @dp_category.parent_id.blank?\n #expand the\n categories = []\n @dp_category.children.each do |dp_catg| \n categories << dp_catg.id\n dp_catg.children.each do |dp_catg_c|\n categories << dp_catg_c.id\n end\n end\n categories << @dp_category.id if categories.empty?\n @dpc_param = { :any => categories, :exact => [@dp_category.id] } \n elsif @dp_category.b_level? \n @dpc_param = { :any => @dp_category.children.collect { |dp_catg| dp_catg.id } << @dp_category.id, :exact => [@dp_category.id] }\n else\n @dpc_param = { :any => [ @dp_category.id ], :exact => [@dp_category.id] }\n end\n end",
"def auto_set_breadcrumb\n ariane.add(\"Home\", root_path, 1) if ariane.crumbs.empty? \n \n if self.action_name == \"index\"\n name = controller_name.titleize\n level = get_level || 2\n else\n name = \"#{action_name.titleize} #{controller_name.singularize.titleize}\"\n level = get_level || 3\n end\n\n ariane.add(name, request.fullpath, level)\n end",
"def leaf?\n (keys - [:name, :balance]).empty?\n end",
"def category_taxon\n taxon = nil\n current_node = ::Spree::CategoryTaxon.root\n full_path.split(' > ').each do|cat_name|\n t = current_node.children.where(name: cat_name).first\n if t.nil?\n break\n else\n taxon = t\n current_node = t\n end\n end\n taxon\n end",
"def add_category(path, name)\n @list[path] ||= []\n if @list[path].include?(name + \"/\")\n @count[path + name + \"/\"] ||= 1\n @count[path + name + \"/\"] += 1\n name = name + \" (#{@count[path + name + \"/\"]})\"\n end\n @list[path] << name + \"/\"\n @dir << name\n end",
"def link_breadcrumb_or_not(menu)\n # path for the breadcrumb menu item\n path_method = \"breadcrumb_#{menu}_path\"\n path = send(path_method) if respond_to?(path_method.to_sym, include_private=true)\n path = '#' if path and current_page?(path) # if the current request is this path then stub it out with #\n path ||= '#'\n link_breadcrumb(menu, path)\n end",
"def in_path?\r\n self.aln_path_id.nil? ? false : true\r\n end",
"def _add_castling_paths(tags = %i[_check_move _check_castling])\n return unless first_move?\n\n KING_CASTLING_VECTORS.each do |vector|\n path = _create_single_path(vector, tags)\n @possible_paths.append(path) unless path.nil?\n end\n end",
"def breadcrumb action = @action, acc = []\n begin\n (parent_actions ||= []) << action\n end while action.breadcrumb_parent && (action = action(*action.breadcrumb_parent))\n\n content_tag(:ul, :class => \"breadcrumb\", :id => \"breadcrumb\") do\n parent_actions.map do |a|\n am = a.send(:eval, 'bindings[:abstract_model]')\n o = a.send(:eval, 'bindings[:object]')\n content_tag(:li, :class => current_action?(a, am, o) && \"active\") do\n crumb = if a.http_methods.include?(:get)\n current_action?(a, am, o) ? aclass = 'pjax tip-bottom current' : aclass = 'pjax tip-bottom'\n if a.action_name == :dashboard\n adata = t('admin.menu.Gohome')\n else\n adata = t('admin.menu.Gosection')\n end\n link_to locale_url_for(:action => a.action_name, :controller => 'rails_admin/main', :model_name => am.try(:to_param), :id => (o.try(:persisted?) && o.try(:id) || nil)), \"data-original-title\" => adata, :class => aclass do\n if a.action_name == :dashboard\n icon = content_tag(:i, '', :class => 'icon-home')\n else\n icon = ''\n end\n icon + wording_for(:breadcrumb, a, am, o)\n end\n else\n content_tag(:span, wording_for(:breadcrumb, a, am, o))\n end\n #crumb+= content_tag(:span, '/', :class => 'divider') unless current_action?(a, am, o)\n crumb+= content_tag(:span, '') unless current_action?(a, am, o)\n crumb\n end\n end.reverse.join().html_safe\n end\n end",
"def visible_navigation_children\n children.select { |c| c.published? and c.display_in_navigation? }\n end",
"def has_branches\n branch_found = false\n waypoints[1..-1].each do |waypoint|\n branch_found |= waypoint.parent_index != waypoint.local_index-1\n end\n branch_found\n end",
"def all_categories(shortlist = false)\n\t\tall = shortlist ? GLOBAL_CATEGORIES[0..3] : GLOBAL_CATEGORIES\n\t\t#all << 'An extra category'\n\tend",
"def leaves\n descendants.where(arel_table[is_leaf_column_name].eq(true))\n end",
"def make_trail(category, choices, search_string, root_label,\n path_generator, view_type = nil)\n trail = category.get_trail(root_label)\n result = []\n \n trail.each do |t|\n if path_generator == :products_path\n result << [ t[1], send(path_generator,\n :catid => String(t[0]), :view => view_type) ]\n else\n result << [ t[1], send(path_generator, String(t[0])) ]\n end\n end\n \n myhash = {:catid => category.id}\n if view_type\n myhash.merge!({:view => view_type})\n end \n \n # admin_category_path passes nil for 'search_string'.\n if search_string && !search_string.blank?\n myhash.merge!({:search => search_string})\n result << [\"\\\"#{search_string}\\\"\", send(path_generator, myhash)]\n end\n \n # admin_category_path passes nil for 'choices'.\n if choices\n choices.each_with_index do |c, i|\n attribute = ProductAttribute.find(c[0])\n range = AttributeRange.find(c[1])\n component = String(attribute.trail_cue) # to convert nil to empty string\n component << \" \" unless component.blank?\n component << range_to_string(attribute, range)\n myhash.merge!({\n \"aid#{i + 1}\".to_sym => String(c[0]),\n \"arid#{i + 1}\".to_sym => String(c[1])})\n result << [component, send(path_generator, myhash)]\n end\n end\n result\n end",
"def breadcrumb_master\n add_breadcrumb \"Master Rider\", master_riders_path\n add_breadcrumb @rider.name, master_rider_path(@rider) if @rider\n end",
"def show\n add_breadcrumb @subcategory.title, category_subcategory_path(@category, @subcategory)\n end",
"def create_categories_page?\n categories_shortcut != inventory_shortcut\n end",
"def use_crumbs?\n response = api_get_request(\"\", \"tree=useCrumbs\")\n response[\"useCrumbs\"]\n end",
"def shared_categories\n if new_record?\n IssueCategory.\n joins(:project).\n preload(:project).\n where(\"#{Project.table_name}.status <> ? AND #{IssueCategory.table_name}.sharing = 'system'\", STATUS_ARCHIVED)\n else\n @shared_categories ||= begin\n r = root? ? self : root\n IssueCategory.\n joins(:project).\n preload(:project).\n where(\"#{Project.table_name}.id = #{id}\" +\n \" OR (#{Project.table_name}.status <> #{Project::STATUS_ARCHIVED} AND (\" +\n \" #{IssueCategory.table_name}.sharing = 'system'\" +\n \" OR (#{Project.table_name}.lft >= #{r.lft} AND #{Project.table_name}.rgt <= #{r.rgt} AND #{IssueCategory.table_name}.sharing = 'tree')\" +\n \" OR (#{Project.table_name}.lft < #{lft} AND #{Project.table_name}.rgt > #{rgt} AND #{IssueCategory.table_name}.sharing IN ('hierarchy', 'descendants'))\" +\n \" OR (#{Project.table_name}.lft > #{lft} AND #{Project.table_name}.rgt < #{rgt} AND #{IssueCategory.table_name}.sharing = 'hierarchy')\" +\n \"))\")\n end\n end\n end"
] |
[
"0.51198906",
"0.50693506",
"0.5054103",
"0.5031562",
"0.49735942",
"0.49636924",
"0.49341705",
"0.48935965",
"0.48935965",
"0.4835533",
"0.48277405",
"0.47744712",
"0.47665894",
"0.47470155",
"0.4728564",
"0.47283533",
"0.47126967",
"0.47123095",
"0.47026855",
"0.4667721",
"0.46585",
"0.46547237",
"0.464833",
"0.46399024",
"0.4631796",
"0.4617723",
"0.46141407",
"0.4611662",
"0.45973164",
"0.45923108",
"0.45863268",
"0.45854816",
"0.45575094",
"0.45456293",
"0.45397457",
"0.45180964",
"0.45088443",
"0.45078012",
"0.450109",
"0.44992858",
"0.44884452",
"0.44787896",
"0.44732097",
"0.44716063",
"0.44640827",
"0.4442371",
"0.4437116",
"0.44319052",
"0.44186556",
"0.44111022",
"0.43929702",
"0.43872172",
"0.43797448",
"0.43736887",
"0.43729657",
"0.43727222",
"0.43671003",
"0.4365562",
"0.43565226",
"0.43540436",
"0.4329891",
"0.43284544",
"0.43266386",
"0.43218547",
"0.43121287",
"0.42987373",
"0.42985183",
"0.4295554",
"0.42897144",
"0.42808905",
"0.42744976",
"0.4269998",
"0.4269998",
"0.4269466",
"0.42637208",
"0.42590725",
"0.42568976",
"0.425659",
"0.42511848",
"0.4246525",
"0.42420295",
"0.42349288",
"0.42340428",
"0.4232543",
"0.42235819",
"0.4220065",
"0.4216464",
"0.42133304",
"0.42129195",
"0.42009825",
"0.42004526",
"0.41981912",
"0.4194945",
"0.41868982",
"0.41783804",
"0.41748154",
"0.41725355",
"0.4169786",
"0.41682494",
"0.41678616"
] |
0.6023198
|
0
|
Save the result of editing the photo set for this product. The corresponding "get" method is just "product.photos".
|
def photo_set=(photo_set)
photo_set.each_pair do |photo_id, props|
photo = Photo.find(photo_id)
if props[:delete]
self.photos.destroy(photo)
else
if props[:hidden] == "1"
to_set = {:hidden => true}
else
to_set = {:hidden => false}
end
if props[:usage_type] =~ /Detail|Thumb|Gallery/
to_set.merge!(:usage_type => props[:usage_type])
end
unless props[:display_order].blank?
display_order = Integer(props[:display_order])
if display_order >= Photo::MIN_DISPLAY_ORDER &&
display_order <= Photo::MAX_DISPLAY_ORDER
to_set.merge!(:display_order => display_order)
end
end
photo.update_attributes(to_set)
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_product_photo\n @product_photo = ProductPhoto.find(params[:id])\n end",
"def set_photo\n @photos = Photo.find(params[:id])\n end",
"def set_photo\n @possible_photos = get_possible_photos\n @photo = @possible_photos.find_by_id(params[:id])\n end",
"def update\n if request.xhr?\n @product = Product.find(params[:product][:id])\n\n @product.photos.each do |photo|\n photo.update_attribute(:main, false)\n end\n\n if params[:photo][:id].empty?\n return\n else\n @photo = Photo.find(params[:photo][:id])\n end\n\n else\n @photo = Photo.find(params[:id])\n end\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n flash[:notice] = 'Plik został zapisany poprawnie.' unless request.xhr?\n format.html { redirect_to([:admin, @photo]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def save_photo\n if @photo_data\n directory_name = File.join PHOTO_STORE, self.catalogue.id.to_s\n Dir.mkdir(directory_name) unless File.exists?(directory_name)\n self.image_url = self.id.to_s + @image_extension\n # Write the data out to a file\n name = File.join directory_name, image_url\n File.open(name, 'wb') do |f|\n f.write(@photo_data.read)\n end\n @photo_data = nil\n self.save\n end\n end",
"def get_photos\n @client.get_photos(flickr_photoset_id) do |p|\n photo = Photo.find_or_create_by_flickr_photo_id(p[:id])\n photo.update_attributes(:farm => p[:farm], :server => p[:server], :secret => p[:secret])\n photo.save\n set_photo = photoset_photos.find_or_initialize_by_photo_id(photo.id)\n set_photo.update_attributes(:primary => p[:primary])\n end\n end",
"def set_photo\n Photo.find(params[:id])\n end",
"def set_photo\n @photo = photo.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @apartment.update(apartment_params)\n if params[:photos]\n params[:photos]['image'].each do |a|\n @photo = @apartment.photos.create!(:image => a, :apartment_id => @apartment.id)\n end\n end\n format.html { redirect_to @apartment, notice: 'Apartment was successfully updated.' }\n format.json { render :show, status: :ok, location: @apartment }\n else\n format.html { render :edit }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_photo\n @photo = Photo.find_by(id: params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find_by(id: params[:id]) \n end",
"def set_photo\n @photo = Photo.find(params[:id])\n \n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\r\n @photo = Photo.find(params[:id])\r\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @photo = Photo.find(params[:id])\n end",
"def set_photo\n @image = Photo.find(params[:id])\n end",
"def update\n set_tags\n\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spot.update(spot_params)\n if params[:photos]\n params[:photos]['image'].each do |a|\n @photo = @spot.photos.create!(:image => a, :imageable_id => @spot.id)\n end\n end\n\n format.html { redirect_to [ @country, @spot ] , notice: 'Spot was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spot.update(spot_params)\n if params[:photos]\n params[:photos]['image'].each do |a|\n @photo = @spot.photos.create!(:image => a, :imageable_id => @spot.id)\n end\n end\n\n format.html { redirect_to [ @country, @spot ] , notice: 'Spot was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def photos=(photos)\n photos.each do |photo|\n photos.build(photo)\n end\n end",
"def update\n @product = Product.find(params[:id])\n\t\trespond_to do |format|\n\t\t if @product.update_attributes(params[:product])\n\t\t\tif @product.photo.nil?\n\t\t\t\tphoto = Photo.find_by_product_id(@product.id)\n\t\t\t\t@product.update_attributes(:photo_id => photo.id) if !photo.nil?\n\t\t\tend\n\t\t\tformat.html { redirect_to @product, :notice => 'Успешно обновлено' }\n\t\t\tformat.json { head :no_content }\n\t\t else\n\t\t\tformat.html { render :action => \"edit\" }\n\t\t\tformat.json { render :json => @product.errors, :status => :unprocessable_entity }\n\t\t end\n\t\tend\n end",
"def set_photo\n# @photo = Photo.find(params[:id])\n end",
"def update\n @property = Property.find(params[:id])\n unless params[:property][:photos_attributes].nil?\n params[:property][:photos_attributes].each_key { |key|\n if params[:property][:photos_attributes][key.to_sym][:remove_file] == \"1\"\n @photo = Photo.find(params[:property][:photos_attributes][key.to_sym][:id])\n @photo.remove_file!\n @photo.destroy\n params[:property][:photos_attributes].delete(key.to_sym)\n end\n }\n end\n\n respond_to do |format|\n if @property.update_attributes(params[:property])\n format.html { redirect_to [:admin, @property], notice: 'Inmueble actualizado.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_photo\n\t @photo = Photo.find(params[:id])\n\t end",
"def update_remote_photo!\r\n return if @values[:image_url].blank?\r\n \r\n photo = @product.remote_photos.from_source(@source).first\r\n photo ||= RemotePhoto.new :source => @source, :owner => @product\r\n \r\n photo.url = @values[:image_url]\r\n photo.caption = @product.title\r\n \r\n # We don't get image size (:x and :y) just a URL, so I've hard coded this to 100x100.\r\n photo.x = photo.y = 100\r\n photo.save!\r\n end",
"def set_photo\n @gallery = Gallery.find params[:gallery_id]\n @photo = @gallery.photos.find params[:id]\n end",
"def photo\n @attributes[:photo] ||= PublicEarth::Db::Photo.find_by_id(@attributes[:photo_id])\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n Inventory.where(product: @product).each do |inventory|\n inventory.update_discounted_price\n inventory.save\n end\n if params.key?(:pictures) && params[:pictures].present?\n params[:pictures].each do |picture_file|\n @product.pictures.create(picture_file: picture_file)\n end\n end\n format.html { redirect_to admin_product_path(@product), notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_photo\n @photo = Photo.friendly.find(params[:id])\n end",
"def update\n if params[:product][:photos_attributes][:'0'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'0'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'0'][:image])\n end\n if params[:product][:photos_attributes][:'1'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'1'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'1'][:image])\n end\n if params[:product][:photos_attributes][:'2'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'2'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'2'][:image])\n end\n if params[:product][:photos_attributes][:'3'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'3'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'3'][:image])\n end\n if params[:product][:photos_attributes][:'4'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'4'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'4'][:image])\n end\n\n respond_to do |format|\n if @product.update(product_update_params)\n\tformat.html { redirect_to products_url, notice: '产品已审核成功' }\n\tformat.json { render :show, status: :ok, location: @product }\n else\n\tformat.html { render :edit }\n\tformat.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_everything\r\n\t\tself.pictures = ImageAsset.where(attachable_id: self.id, attachable_type: \"Product\")\r\n\t\tself.pictures.each do |asset|\r\n\t\t\tasset.product_id = self.id\r\n\t\t\tasset.user_id = self.user.id\r\n\t\t\tasset.save!\r\n\t\tend\r\n\t\tif !self.pictures.empty?\r\n\t\t\tself.product_pic = self.pictures.last\r\n\t\tend\r\n\t\tself.feature_groups.each do |f|\r\n\t\t\tf.product = self\r\n\t\t\tf.product_id = self.id\r\n\t\t\tf.save!\r\n\t\tend\r\n\t\t\r\n\tend",
"def update_photos\n self.photos = Photo.find_photos(latitude, longitude, radius)\n end",
"def photo\n\t\ts = picture\n\t\treturn s if s.to_s != \"\"\n\t\t\n\t\t#i = image\n\t\treturn Artist.default_pic\n\t\t\n\t\tupdate_attribute(:picture, i)\n\t\tsave\n\t\treturn i\n\tend",
"def show\n @product = Product.find(params[:id])\n if @product.photos.blank?\n @product.photos.build\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def set_recipe_photo\n @recipe_photo = RecipePhoto.find(params[:id])\n end",
"def set_photo\n puts \"Parametros: \"\n puts params.inspect\n @photo = Photo.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @photo.update(photo_params)\n save_to_json\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo_set = PhotoSet.find(params[:id])\n\n respond_to do |format|\n if @photo_set.update_attributes(params[:photo_set])\n flash[:notice] = 'PhotoSet was successfully updated.'\n format.html { redirect_to(@photo_set) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo_set.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find params[:person_id]\n @photo = Photo.find params[:id]\n \n respond_to do |format|\n # make sure the preferred bit is cleared\n @person.photos.each do |p|\n p.preferred = false\n p.save!\n end\n \n # set preferred photo\n @photo.preferred = true\n \n if @photo.save\n flash[:notice] = 'Default photo was successfully saved.'\n format.html { redirect_to(person_photos_path(@person)) }\n format.xml { head :created,\n :location => person_photo_path(:person_id => @person_id, :id => @photo.id)}\n else\n format.html { \n @section = 'photos'\n render :action => 'index' }\n format.xml { render :xml => @photo.errors.to_xml }\n end\n end\n rescue ActiveRecord::RecordInvalid\n render :action => 'index'\n end",
"def edit\n @admin_photo = Photo.find(params[:id])\n #@villa.photos.build\n end",
"def update\n @photo = Photo.find(params[:id])\n if @photo.update(photos_params)\n if @photo.save\n redirect_to photos_path, notice: \"The photo has been updated\"\n else\n render \"edit\"\n end\n end\n end",
"def update\n respond_to do |format|\n if @photo.update_attributes(photo_params)\n format.html { redirect_to photos_url, notice: t(\"controllers.photos.update_success\") }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_photo\n begin\n @photo = Photo.find(params[:photo_id])\n rescue\n return render json: {exception: \"PhotosException\", message: \"This photo doesn't exist\"}, status: 400\n end\n end",
"def update\n @rental = Rental.find(params[:id])\n rental_data = params[:rental]\n photo_ids = rental_data.delete :photo_ids\n\n respond_to do |format|\n if @rental.update_attributes(rental_data)\n update_photos_with_rental_id photo_ids, @rental\n\n format.html { redirect_to @rental, notice: 'Rental was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rental.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n\t\t@user = User.find_by_id(params[:id])\n\t\t@photos = Photo.find_all_by_user_id(params[:id])\n\tend",
"def store_photo\n if @file_data\n # make the photo_store directory if it doesn't exist already\n FileUtils.mkdir_p PHOTO_STORE\n # write out the image data to the file\n File.open(photo_filename, 'wb') do |f|\n f.write(@file_data.read)\n end\n # avoid repeat-saving\n @file_data = nil\n end\n end",
"def store_photo\n if @file_data\n # make the photo_store directory if it doesn't exist already\n FileUtils.mkdir_p PHOTO_STORE\n # write out the image data to the file\n File.open(photo_filename, 'wb') do |f|\n f.write(@file_data.read)\n end\n # avoid repeat-saving\n @file_data = nil\n end\n end",
"def update\n @photo = Photo.with_attached_pictures.find(params[:id])\n @photo.user_id = current_user.id\n #@photo.update\n # raise @photo.inspect\n respond_to do |format|\n if @photo.update(photo_params)\n # raise @photo.inspect\n format.html { redirect_to album_photos_path, notice: \"Photo was successfully updated.\" }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_property_photos(photos)\n post_photos_for_property_id(photos.first.propertyID, photos)\n end",
"def set_upload\n @photo = Photo.find(params[:id])\n end"
] |
[
"0.6664469",
"0.66618866",
"0.6463024",
"0.64435536",
"0.64362663",
"0.6307502",
"0.6294206",
"0.6272002",
"0.623259",
"0.6225893",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61844397",
"0.61750734",
"0.6171114",
"0.6166053",
"0.6155179",
"0.6152377",
"0.61356527",
"0.61356527",
"0.61356527",
"0.61356527",
"0.61356527",
"0.61356527",
"0.61006665",
"0.6098837",
"0.6096785",
"0.6096785",
"0.60930115",
"0.6088707",
"0.60524124",
"0.6021622",
"0.60176015",
"0.60100377",
"0.60053724",
"0.5994996",
"0.59866905",
"0.5984539",
"0.59690166",
"0.5962845",
"0.5952888",
"0.59450454",
"0.5937872",
"0.59307957",
"0.5930329",
"0.5928417",
"0.5921501",
"0.5918965",
"0.5917623",
"0.5896498",
"0.58944684",
"0.5887712",
"0.587447",
"0.5863169",
"0.5862194",
"0.5862194",
"0.5860701",
"0.58543265",
"0.58533686"
] |
0.6087216
|
71
|
Get the value of the the given attribute for this product.
|
def get_attribute_value(attribute)
values = read_attr_val(attribute.id)
return nil unless values
if attribute.atype == ProductAttribute::Atype_String
return values[0]
elsif attribute.atype == ProductAttribute::Atype_Currency
MoneyUtils.format(values[1])
else
return Integer(values[1])
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_attribute_value(attribute)\n data[attribute]\n end",
"def get attribute\n attributes[attribute]\n end",
"def attribute_value\n @attributes.each { | id, value | return value }\n end",
"def value\n attributes.fetch(:value)\n end",
"def get_value(attribute_id)\n get_custom_value_hash\n return @custom_value_hash[attribute_id]\n end",
"def get(attribute)\n @attributes[attribute.to_s]\n end",
"def value_for (attribute)\n unless current_values.key?(attribute)\n raise ArgumentError, \"No such attribute: #{attribute.inspect}\"\n end\n current_values[attribute]\n end",
"def value\n @attributes[:value]\n end",
"def get_attribute(name)\n @attributes[name]\n end",
"def attribute_get(attribute)\n check_attribute!(attribute)\n send(attribute.to_s)\n end",
"def attribute_get(attribute)\n check_attribute!(attribute)\n send(attribute.to_s)\n end",
"def [](attr_name)\n @attributes.fetch_value(attr_name.to_s)\n end",
"def get_attribute(name)\n @attributes[name.to_s]\n end",
"def attribute_value(element,attribute_name)\n element.attribute_value(element,attribute_name)\n end",
"def get_attribute(attr_name)\n return nil unless @attributes.key? attr_name\n\n @attributes[attr_name]\n end",
"def attribute(name)\n return attributes[name]\n end",
"def scrape_attribute_value(element, attribute)\n scrape element if !element.not_nil?\n return @result[attribute]\n end",
"def get(value)\n if value.kind_of? Details::Attribute\n raise \"Invalid attribute! Must be an attribute named #{self.name}\" if value.name != self.name\n value = value.value\n end\n value.strip! if value.kind_of? String\n @values.find { |v| v.value == value }\n end",
"def product_attribute( attribute_name=nil, options = { } )\n attribute_name ||= self.current_piece.attribute_name.to_sym\n\n wrapped_model = self.running_data_item_by_class( Products::WrappedProduct )\n wrapped_model = options.delete(:data) if options.key?( :data )\n\n if wrapped_model\n ProductAttribute.new( current_piece, wrapped_model, options ).get( attribute_name )\n else\n options.delete(:placeholder)\n end\n end",
"def attribute(name)\n read_attribute(name)\n end",
"def get_attribute(name); end",
"def get_attribute(name); end",
"def value\n Array.wrap(\n if respond_to?(\"#{@attribute}_value\".to_sym)\n send(\"#{@attribute}_value\".to_sym)\n else\n @value\n end\n )\n end",
"def attribute(name)\n attributes[name]\n end",
"def attribute(name)\n current_attributes[name]\n end",
"def get_attribute(name)\n return @attrs[name] if attrs.key?(name)\n end",
"def getter(attribute)\n willAccessValueForKey(attribute)\n value = send(\"primitive#{attribute.sub(/\\S/, &:upcase)}\")\n didAccessValueForKey(attribute)\n return value\n end",
"def read_attribute name\n @attributes[name.to_s]\n end",
"def read_attribute\n record.public_send(attribute)\n end",
"def [](attr_name)\n if self.attribute_names.include?(attr_name)\n read_attribute(attr_name)\n else\n get_custom_attribute(attr_name)\n end\n end",
"def get_attribute(attribute)\n case attribute\n when :bathroom\n return self.bathroom\n when :heating\n return self.heating\n when :warm_water\n return self.warm_water\n when :wc\n return self.wc\n else\n return nil\n end \n end",
"def [](attribute)\n @attributes[attribute.to_s]\n end",
"def attribute(name)\n attributes.each { |a| return a if a.property.id == name }\n nil\n end",
"def getAttribute\n if (@nodeValues.size > @INDEX)\n tmp = @nodeValues[@INDEX]\n result = @xmlTool.searchForAttribute(tmp, @attributeElementName, @attributeName)\n return result\n else\n return \"\"\n end\n\n end",
"def get_value(attribute,xml)\n xml.xpath(\".//#{attribute}\").first.content\n end",
"def get_value\n read_attribute('number_value')\n end",
"def attribute attr\n @ref.attribute(TRANSLATOR.cocoaify(attr)).to_ruby\n end",
"def attribute_value_for(resource, attribute_name, truncation = 50)\n value = resource.send(attribute_name).to_s.truncate(truncation)\n if attribute_name.to_s.match(/_id$/)\n model_name = attribute_name.gsub(/_id$/, '').classify\n begin\n value = eval(model_name).find(value).to_s\n rescue ActiveRecord::RecordNotFound\n value = \"\"\n end\n end\n value\n end",
"def get_hash_value(hash, key, attribute)\n hash[key][attribute]\n end",
"def attribute(name)\n @attributes[name.to_sym]\n end",
"def human_value(attribute_name)\n value = send(attribute_name)\n self.class.human_attribute_value attribute_name, value\n end",
"def get_attribute(attribute)\n\t\t@attributes[attribute.intern]\n\tend",
"def _read_attribute(attr)\n @attributes[attr]\n end",
"def key_value\n @attrs[self.class.key_attribute.to_s]\n end",
"def value\n attributes['FieldValue']\n end",
"def getAttribute(attribute)\n __send__(\"jmx_get_\" + attribute.downcase)\n end",
"def get_attribute(object, attribute)\n attribute = attribute.to_sym\n object = localize(object) unless object.respond_to? :nii_attribute?\n return object.nii_attribute(attribute) if object.nii_attribute? attribute\n raise Errors::UnknownAttribute, \"unknown attribute\"\n end",
"def get_attribute(attribute_name)\n theme_attributes.find_by_attribute_name(attribute_name) ||\n populate_attribute(attribute_name)\n end",
"def get_attribute( name )\n @attr_nodes.each do |attr|\n if attr.name == name then\n #//////////////////////////\n # 変更する\n #//////////////////////////\n return attr.value\n end\n end\n return \"\"\n end",
"def [](attribute)\n ensure_loaded! unless self.class[attribute].present_in(@_data)\n self.class[attribute].get(@_data)\n end",
"def get_value(attribute)\n obj = @map[attribute]\n if obj\n if obj.is_a?(String)\n return obj.to_s\n end\n end\n\n raise IllegalStateException, \"The attribute #{attribute} doesn't have a paired string.\"\n end",
"def attribute_get(name)\n @attributes[:current][name]\n end",
"def get_attribute(node, attr_name)\n node.attribute(attr_name)\n end",
"def custom_attribute(product_id, attribute_name)\n response, status = BeyondApi::Request.get(@session, \"/products/#{product_id}/attributes/#{attribute_name}\")\n\n handle_response(response, status)\n end",
"def value\n self['value']\n end",
"def read_attribute(attr_name, &block)\n name = attr_name.to_s\n name = self.class.attribute_aliases[name] || name\n\n return @attributes.fetch_value(name, &block) unless name == \"id\" && @primary_key\n\n if self.class.composite_primary_key?\n @attributes.fetch_value(\"id\", &block)\n else\n if @primary_key != \"id\"\n ActiveRecord.deprecator.warn(<<-MSG.squish)\n Using read_attribute(:id) to read the primary key value is deprecated.\n Use #id instead.\n MSG\n end\n @attributes.fetch_value(@primary_key, &block)\n end\n end",
"def read_attribute(name)\n fields[name].get(@attributes[name])\n end",
"def get(attribute_name)\n # label, attribute = attribute_name.split('_')\n # self.send(\"#{attribute}s\").first_for(label)\n attributes[attribute_name.to_sym] ||= get_field(attribute_map[attribute_name])\n end",
"def read_attribute(key)\n @attributes[key]\n end",
"def read_attribute(key)\n @attributes[key]\n end",
"def value\n record.send(name).value\n end",
"def get_attrib(attrib)\n Attrib.get(attrib, self) rescue nil\n end",
"def get_value\n read_attribute('text_value')\n end",
"def call(attribute)\n @attributes[attribute]\n end",
"def get_attribute(node, attr_name)\n #There has been a method shift between 0.5 and 0.7\n if defined?(node.property) == nil\n return node.attributes[attr_name]\n else\n if defined?(node[attr_name])\n return node[attr_name]\n else\n return node.property(attr_name)\n end\n end\n end",
"def get_attribute(uuid, key, opts = {})\n data, _status_code, _headers = get_attribute_with_http_info(uuid, key, opts)\n return data\n end",
"def value\n self[@name]\n end",
"def attribute_get(name)\n \n name = name.to_sym\n \n if properties.has_key?(name)\n properties[name].get(self)\n else\n nil\n end\n \n end",
"def read_attribute(key)\n @attributes[key.to_sym]\n end",
"def value(attribute, document, property_hash)\n proc = property_hash[:read_proc]\n if proc\n proc.call(document)\n else\n document[attribute == :id ? :_id : attribute]\n # An alternate way is:\n #\n # document.send(attribute == :id ? :_id : attribute)\n #\n # This will work; however, it would be confusing to support\n # properties backed by model methods here if we don't do it \n # everywhere. And supporting it everywhere would be tricky.\n #\n # For example, the filtering code relies on using MongoDB to\n # search the database. If we supported properties backed by model\n # methods, filtering / searching would be more complicated and\n # expensive.\n end\n end",
"def attr_val(xpath)\n Utilities::attr_val(@entry, xpath)\n end",
"def val(document, attribute)\n document.public_send(attribute) ||\n raise(\"#{ document.inspect } has no #{ attribute.inspect } value\")\n end",
"def object_value_from_dynamo_data(dynamo_record)\n dynamo_record[dynamo_attribute_key]\n end",
"def [](attr_name)\n @attributes[attr_name.to_s]\n end",
"def [](attribute)\n `c$Element.prototype.m$get_property.call(#{@element},attribute)`\n end",
"def [](val)\n @attributes[val]\n end",
"def get_item_value(key)\n @attributes[key] = get_item_record(key) unless @attributes.has_key?(key)\n @attributes[key]\n end",
"def [](attr_name)\n read_attribute(attr_name)\n end",
"def business_info_value( attribute )\n return nil if business_info.nil?\n YAML.load(business_info)[attribute]\n end",
"def get\n @value\n end",
"def [](attr_name) \n read_attribute(attr_name)\n end",
"def instance_get(attribute)\n getter = :\"#{self.name}_#{attribute}\"\n self.instance.send(getter) if instance.respond_to?(getter)\n end",
"def [](attr_name)\n read_attribute(attr_name)\n end",
"def [](attribute)\n form_data[canonical_name(attribute)]\n end",
"def _read_attribute(attr_name, &block) # :nodoc:\n @attributes.fetch_value(attr_name, &block)\n end",
"def [](name)\n attribute = @server.getAttribute(@object_name, name.to_s)\n return attribute.value if attribute.kind_of? javax.management.Attribute\n attribute\n end",
"def attribute\n @attribute ||= Pod::Specification::DSL.attributes.find { |attr| attr.reader_name.to_s == name }\n end",
"def [](attribute)\n self.send(attribute)\n end",
"def get_attribute(attribute_id, opts = {})\n data, _status_code, _headers = get_attribute_with_http_info(attribute_id, opts)\n return data\n end",
"def [](attribute_name)\n raise NoMethodError, \"The attribute #{attribute_name} is undefined\" unless self.class.attributes.has_key? attribute_name\n default = super(attribute_name)\n self.class.cast(attribute_name, default.is_a?(Proc) ? default.call : default)\n end",
"def value(name)\n name = attr_alias(name)\n\n (obj = @parameters[name] and obj.respond_to?(:value)) ? obj.value : nil\n end",
"def attribute(name)\n attr = nc.att(name)\n get(attr)\n end",
"def get_attribute(attribute_id, opts = {})\n data, _status_code, _headers = get_attribute_with_http_info(attribute_id, opts)\n data\n end",
"def value\n return @value\n end",
"def value\n return @value\n end",
"def value\n return @value\n end",
"def get_value(field)\n field = item_type.find_field(field) unless field.is_a? Field\n field.value_for_item(self)\n end",
"def attribute_value(key, node = @current_node)\n\t\tif is_valid(node) && node.key?(key) then\n\t\t\treturn node.attribute(key).to_s\n\t\telse\n\t\t\treturn ''\n\t\tend\n\tend",
"def read_attribute\n Logging.debug \"Read attribute #{field_name}, got #{object.send(:read_attribute,field_name)} for #{object.inspect}\"\n object.send( :read_attribute, field_name )\n end",
"def [](field)\n @attributes[field]\n end"
] |
[
"0.79997975",
"0.7601683",
"0.7571235",
"0.74166137",
"0.72691464",
"0.725703",
"0.7239424",
"0.70847327",
"0.7031837",
"0.70087326",
"0.70087326",
"0.6965269",
"0.6957848",
"0.6927108",
"0.68974704",
"0.68912816",
"0.6706977",
"0.66794556",
"0.66576356",
"0.6594177",
"0.6592101",
"0.6592101",
"0.6576566",
"0.6559089",
"0.65542644",
"0.65289676",
"0.6528962",
"0.65252924",
"0.6521878",
"0.6479744",
"0.6466284",
"0.646461",
"0.645668",
"0.64455855",
"0.6440546",
"0.64351904",
"0.64187735",
"0.63984776",
"0.63838476",
"0.63655984",
"0.63599646",
"0.63548213",
"0.63215685",
"0.63200104",
"0.6318345",
"0.6318012",
"0.6296526",
"0.62962407",
"0.62867236",
"0.62765354",
"0.62670743",
"0.62408197",
"0.6231737",
"0.6231329",
"0.6214825",
"0.62118256",
"0.6206521",
"0.6203842",
"0.6201712",
"0.6201712",
"0.61726314",
"0.6153907",
"0.61498076",
"0.6132861",
"0.61315376",
"0.61209035",
"0.6119373",
"0.61103535",
"0.61001384",
"0.6095861",
"0.6084963",
"0.6084304",
"0.608264",
"0.60749906",
"0.606973",
"0.60636175",
"0.60605305",
"0.605864",
"0.60577804",
"0.60484105",
"0.6042914",
"0.60196155",
"0.60163885",
"0.60060996",
"0.5998526",
"0.59913516",
"0.598584",
"0.59838945",
"0.597932",
"0.5977812",
"0.59658396",
"0.59613776",
"0.59577966",
"0.5952432",
"0.5952432",
"0.5952432",
"0.59408236",
"0.5939073",
"0.593314",
"0.5932835"
] |
0.81184626
|
0
|
Set the value of this product for a given attribute.
|
def set_attribute_value(attribute, value)
# This product needs to have an id in order to set
# attribute values on it.
save! if new_record?
if attribute.atype == ProductAttribute::Atype_String
str_val = value
int_val = nil
elsif attribute.atype == ProductAttribute::Atype_Currency
str_val = nil
int_val = MoneyUtils.parse(value)
else
# It is possible that the admin did not fill in a value for
# a text field, so we get an empty string for "value". We
# could implement a default value for the attribute (probably
# stored in the attribute itself, but for now just store 0.)
str_val = nil
if value.blank?
int_val = 0
else
int_val = Integer(value)
end
end
write_attr_val(attribute.id, str_val, int_val)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set attribute, value\n attributes[attribute] = value\n end",
"def set(attribute, value)\n @attributes[attribute.to_s] = value\n nil\n end",
"def set_attribute(attribute, value)\n if MojeID.is_attribute_available?(attribute)\n fetch_request.set_values(attribute, value)\n bundle_to_request\n end\n end",
"def attribute=(attribute_name, value)\n write_attribute(attribute_name, value)\n end",
"def attribute=(attribute_name, value)\n write_attribute(attribute_name, value)\n end",
"def set_attribute(name, value); end",
"def set_attribute(name, value)\n @attributes[name] = value\n end",
"def []=(attribute, value)\n attributes[attribute] = to_field(value)\n end",
"def []=(attribute, value)\n self.send(\"#{attribute}=\", value)\n end",
"def []=(attribute, value)\n form_data.merge!(Adyen::Util.flatten(attribute => value))\n value\n end",
"def assign_attribute_value(attribute, value)\n value = self.assign_layer_value(value, self.class._attribute_types[attribute], 0)\n self.instance_variable_set(\"@#{attribute}\", value)\n rescue => err\n Canvas.logger(:error, err.message)\n Canvas.logger(:error, err.backtrace)\n raise ArgumentError.new(\" #{attribute} for #{self.class.definition['class_name']} should be kind of #{\n self.class._attribute_types[attribute].join(\"#\")}, but got #{value.class}\")\n end",
"def set_attribute\n @attribute = Attribute.find(params[:id])\n end",
"def set_attribute\n @attribute = Attribute.find(params[:id])\n end",
"def attribute=(name, val)\n write_attribute(name, val)\n end",
"def set_attribute_for element, attr, value\n AXUIElementSetAttributeValue(element, attr, value)\n end",
"def update_attribute!(attribute, value)\n send(\"#{attribute}=\", value)\n self.save!\n end",
"def assign(attribute, value)\n @attributes[attribute.to_sym] = value\n end",
"def []= (attr_name, value) \n write_attribute(attr_name, value)\n end",
"def set_attribute(key_, value_)\n attribute(key_, value_, :set)\n end",
"def []=(attribute,value)\n `c$Element.prototype.m$set_property.call(#{@element},attribute,value)`\n end",
"def set_product_product_attribute\n @product_product_attribute = ProductProductAttribute.find(params[:id])\n end",
"def set_attribute_value(attrib_name, attrib_value=nil)\n return set_attribute_values(attrib_name) if attrib_name.is_a? Hash \n touch(attrib_name)\n @attribute_values_flat[attrib_name.to_sym] = attrib_value\n end",
"def []=(attribute, value)\n # shall I raise an exception?\n return if self.class.schema[attribute].nil?\n # shall I convert the value if it's not in the right format?\n self.instance_variable_set(\"@#{attribute}\", value)\n end",
"def update_attribute(attribute, value)\n send(\"#{attribute}=\", value)\n self.save\n end",
"def []=(attr_name, value)\n write_attribute(attr_name, value)\n end",
"def []=(attr, value)\n if Roomorama::Property::ATTRIBUTES.include?(attr)\n setter = [attr, \"=\"].join\n public_send(setter, value)\n end\n end",
"def []=(attr_name, value)\n if self.attribute_names.include?(attr_name.to_s)\n write_attribute(attr_name, value)\n else\n set_custom_attribute(attr_name, value)\n end\n end",
"def write_set_attribute(attribute_name, value)\n column_type = ((column_definition = self.class.columns_hash[attribute_name.to_s]) and column_definition.type)\n value = value.to_s(10) if column_type == :string\n write_attribute(attribute_name, value)\n end",
"def []=(attr_name, value)\n write_attribute(attr_name, value)\n end",
"def []=(attr_name, value)\n write_attribute(attr_name, value)\n end",
"def []=(attr_name, value)\n write_attribute(attr_name, value)\n end",
"def []=(attr_name, value)\n write_attribute(attr_name, value)\n end",
"def set_attribute(attribute,value,index=0)\n index = normalize_index(index)\n# puts \"<br>SETTING ATTRIBUTE #{attribute}[#{index}]=#{value} [caller: #{trace}]\"\n @attributes[index] ||= {}\n @attributes[index][normalize_attribute(attribute)] = value\n end",
"def set_attribute(a,b)\n write_attribute(a,b)\n end",
"def []=(attribute, value)\n raise ArgumentError unless self.class.keys.include? attribute\n # coerce value according to its attribute's type before being set.\n self.instance_variable_set(\"@#{attribute}\", coerce(value, attribute))\n end",
"def []= attribute, value\n `#@native.setAttribute(#{attribute}, #{value})`\n end",
"def set_attribute(id, attribute, value)\n\t\to = getObject(id)\n\t\tif (o != nil && o.respond_to?(:[]))\n\t\t\to[attribute] = value\n\t\telse\n\t\t\tputs \"Could not find object with id = #{id}\"\n\t\tend\n\tend",
"def setter(attribute, value)\n willChangeValueForKey(attribute)\n send(\"primitive#{attribute.sub(/\\S/, &:upcase)}\", value)\n didChangeValueForKey(attribute)\n return value\n end",
"def set_attribute(id, attr)\n\t\t\t@current_context.set_attribute(id, attr)\n\t\tend",
"def []=(attribute_name, value = nil)\n raise \"Please set the source data set before attempting to set values.\" unless @current_source_data_set\n \n attribute_name = attribute_name.to_sym\n value.strip! if value.kind_of? String\n \n # Are we updating an existing value?\n existing = @attributes[@current_language][attribute_name] || \n @attributes[@current_language][attribute_name.to_s.singularize.to_sym]\n \n if existing\n\n # An attribute that allows multiple values?\n if existing.kind_of? ManyValues\n # Always clear attribute values before re-adding them\n # That way we add new but remove values.\n existing.clear\n unless value.blank?\n value.split(',').each {|v| existing.add(v)}\n end\n # Single value attribute\n elsif existing.value != value\n existing.source_data_set_id = @current_source_data_set.id\n\n unless value.blank?\n existing.value = value\n existing.changed = true\n else\n existing.value = nil\n existing.deleted = true\n end\n end\n\n elsif !value.blank?\n \n # Look up the attribute to get its details: required, allow_many, data_type.\n attribute_definition = PublicEarth::Db::Attribute.find_by_name(attribute_name.to_s) ||\n PublicEarth::Db::Attribute.find_by_name!(attribute_name.to_s.singularize)\n \n # If the attribute allows many values, we need an array.\n if attribute_definition.allow_many?\n @attributes[@current_language][attribute_name] ||= ManyValues.new(self, \n PublicEarth::Db::Details::Attribute.new(self, nil, \n attribute_name, value.split(','), nil, @current_language, @current_source_data_set.id, attribute_definition.readonly, 9999, false, \n false, attribute_definition.allow_many, attribute_definition.data_type))\n return @attributes[@current_language][attribute_name].add(value)\n \n # Otherwise just set the attribute equal to the new value\n else\n @attributes[@current_language][attribute_name] = PublicEarth::Db::Details::Attribute.new(self, nil, \n attribute_name, value, nil, @current_language, @current_source_data_set.id, attribute_definition.readonly, 9999, false, \n false, attribute_definition.allow_many, attribute_definition.data_type)\n @attributes[@current_language][attribute_name].changed = true\n end\n end\n end",
"def []=(attr_name, value)\n @attributes.write_from_user(attr_name.to_s, value)\n end",
"def set_attr(name, value)\n each_value {|x| x[name] = value }\n end",
"def set attr, to: value\n unless writable_attr? attr\n raise NoMethodError, \"#{attr} is read-only for #{inspect}\"\n end\n real_attr = attribute_for attr\n value = value.to_axvalue\n set real_attr, to: value, for: @ref\n value\n end",
"def set attrib, value\n if attrib.is_a? String and attrib.include? \".\"\n syms = attrib.split(\".\")\n first = syms[0]\n rest = syms[1..-1].join(\".\")\n self.send(first).set(rest, value)\n else\n self.send(\"#{attrib}=\".to_sym, value)\n end\n end",
"def []=(attr_name, value)\n @attributes[attr_name.to_s] = value\n end",
"def assign_attribute(name, value)\n self.send(\"#{name}=\", value) if has_attribute?(name)\n end",
"def instance_set(attribute, value)\n setter = :\"#{self.name}_#{attribute}=\"\n self.instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def setAttrib(name,value)\n\t\t@attributes[name] = value\n\tend",
"def write_attribute(attribute, value)\n @object.send(:write_attribute, attribute, value)\n end",
"def update_attribute(name, value)\n send(\"#{name}=\", value)\n save\n end",
"def update_attribute(name, value)\n send(\"#{name}=\", value)\n save\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def []=(attr, value)\n @attrs[attr] = value\n end",
"def set_value(attribute_id, value)\n get_custom_value_hash\n if @custom_value_hash[attribute_id].nil?\n create_value(attribute_id, value)\n else\n if value && @custom_value_hash[attribute_id] != value\n sql = \"UPDATE #{CustomValue.table_name} SET #{Person::_(:value, :custom_value)} = '#{quote_string(value)}' \n WHERE #{Person::_(:person_id, :custom_value)} = #{id} \n AND #{Person::_(:custom_attribute_id, :custom_value)} = #{attribute_id}\"\n CustomValue.connection.execute(sql)\n @custom_value_hash[attribute_id] = value\n end\n end\n value\n end",
"def update_attribute(attribute, attribute_type, value)\n\t\tresults = submit_cmd('update app attribute',:db, \"-env #{self.belongs_to.env} \\\n -app_instance #{self.name} -attribute #{attribute} -attribute_type #{attribute_type} \\\n -new_value #{value}\")\n\t \n\t if ( results.to_s =~ /failure/i || results.to_s =~ /error/i)\n\t \traise \"update attribute failed\" \n\t else\n\t \tself.attributes[attribute.intern] = value\n\t end\n\tend",
"def attribute_set(name, value)\n properties[name].set(self, value)\n end",
"def set_single_attribute(attribute_name, attribute_value, opts = {})\n Operation::Service.set_attribute(\n :attribute_name => attribute_name,\n :attribute_value => attribute_value,\n :encrypt => opts[:encrypt],\n :service_instance => self.service_instance,\n :service_instance_dir => self.service_instance_dir\n )\n end",
"def update_attribute(attr_name, value)\n if self.class.has_custom_attribute?(attr_name.to_sym)\n find_or_build_custom_attribute_by_name(attr_name).update_attribute(:value, value)\n else\n super\n end\n end",
"def []= field, value\n @attributes[field] = value\n end",
"def initialize_value(attribute)\n subject.send(\"#{attribute}=\", attribute_values[attribute] || 'X')\n end",
"def update_attribute(name, value)\n self[name] = value\n save\n end",
"def attribute=(name, value)\n @attributes ||= {}\n @attributes[name] = value\n end",
"def set_record_value_for_attribute(record, attr, value, role = :default)\n end",
"def update_attribute(attr_name, attr_value)\n update_attributes(attr_name => attr_value)\n end",
"def attribute_set(name, value)\n @dirty[name] = true\n @attributes[:current][name] = value\n end",
"def process_attribute(name, value)\n if !respond_to?(\"#{name}=\", true) && (store_as = aliased_fields.invert[name.to_s])\n name = store_as\n end\n responds = respond_to?(\"#{name}=\", true)\n raise Errors::UnknownAttribute.new(self.class, name) unless responds\n\n send(\"#{name}=\", value)\n end",
"def set_attribute_value(node_id:, name:, value:)\n {\n method: \"DOM.setAttributeValue\",\n params: { nodeId: node_id, name: name, value: value }.compact\n }\n end",
"def set_fauxsql_attribute(attribute_name, value)\n options = fauxsql_options[attribute_name]\n value = value.send(options[:type]) if options and options[:type]\n \n attribute = Fauxsql.dereference_fauxsql_attribute(value)\n Fauxsql.dirty!(self){ fauxsql_attributes[attribute_name] = attribute } \n end",
"def set_revision_meta_attribute(revision, attribute, value)\n case value\n when Symbol\n value = self.send(value)\n when Proc\n value = value.call(self)\n end\n revision.send(\"#{attribute}=\", value)\n end",
"def []=(attribute, value)\n @_errors ||= {}\n @_original ||= {}\n begin\n unless @_original.include? attribute\n @_original[attribute] = self[attribute]\n end\n self.class[attribute].set(@_data, value)\n @_errors.delete(attribute)\n rescue\n @_errors[attribute] = {:value => value, :error => $!}\n end\n end",
"def update_attribute(name, value)\n respond_to?(\"#{name}=\") ? send(\"#{name}=\", value) : self[name] = value\n save(:validate => false)\n end",
"def update_attribute(name, value)\n respond_to?(\"#{name}=\") ? send(\"#{name}=\", value) : self[name] = value\n save(:validate => false)\n end",
"def setattribute_raw(path, name, value)\n Puppet.debug \"#{name.inspect} setting to #{value.inspect} for path: #{path}\"\n cmd = if value.nil?\n \"#{path}:undefine-attribute(name=\\\"#{name}\\\")\"\n else\n \"#{path}:write-attribute(name=\\\"#{name}\\\", value=#{value})\"\n end\n cmd = \"/profile=#{@resource[:profile]}#{cmd}\" if runasdomain?\n state = execute cmd\n Puppet.debug(\"Setting attribute response: #{state.output}\")\n raise \"Cannot set #{name} for #{path}: #{state.output}\" unless state.success?\n @property_hash[name] = value\n end",
"def set_attribute(opts = {})\n data, _status_code, _headers = set_attribute_with_http_info(opts)\n return data\n end",
"def set_attribute\n raise Error::CustomError.error(422, :ATT_01, \"attribute\") unless Number.is_integer?(params[:attribute_id])\n begin\n @attribute = Attribute.find(params[:attribute_id]) \n rescue ActiveRecord::RecordNotFound\n raise Error::CustomError.error(404, :ATT_02, \"attribute\")\n rescue\n raise Error::CustomError.error(500, :ISE, \"attribute\")\n end\n end",
"def set_attribute(rule, attribute, value)\n begin\n rule.send(\"#{attribute}=\".to_sym, value)\n rescue NoMethodError\n raise AtomMarshallingError.new(\"Attribute #{attribute} unsupported in Atom #{rule_type_name(rule)}.\")\n end\n end",
"def set_attribute(attribute_key, attribute_value)\n @attr_mutex.synchronize { @user_attributes[attribute_key] = attribute_value }\n end",
"def set_attribute(attribute_key, attribute_value)\n @attr_mutex.synchronize { @user_attributes[attribute_key] = attribute_value }\n end",
"def []=(attribute_name, value)\n raise NoMethodError, \"The attribute #{attribute_name} is undefined\" unless self.class.attributes.has_key? attribute_name\n \n return_value = super(attribute_name, self.class.cast(attribute_name, value))\n\n if self.__owner_object \n # This makes the tableless model compatible with partial_updates:\n # whenever a property in the tableless model is changed, we force the parent/owner object to a changed state\n # by updating it with a new, updated instance of the tableless model\n self.__owner_object.send \"#{self.__serialized_attribute.to_s}=\".to_sym, self\n end\n\n return_value\n end",
"def on_attribute(attribute)\n @attribute = attribute\n self\n end",
"def []=(attr, value)\n self.send(\"#{attr}=\", value)\n end",
"def []=(attr, value)\n self.send(\"#{attr}=\", value)\n end",
"def update(attribute, value)\n instance_variable_set(\"@#{attribute}\", value)\n end",
"def []=(attr_name, attr_value)\n value[attr_name.to_s] = attr_value\n end",
"def []=(attr_name, attr_value)\n value[attr_name.to_s] = attr_value\n end",
"def set_attribute_property(id, attribute, property, value)\n\t\to = getObject(id)\n\t\tif (o != nil && o.respond_to?(:[]))\n\t\t\tif (o[attribute] != nil)\n\t\t\t\tif (o[attribute].include?(property))\n\t\t\t\t\to[attribute] = o[attribute].gsub(/#{property}\\:.*(\\;|$)/, setting(property, value))\n\t\t\t\telse\n\t\t\t\t\ts = o[attribute]\n\t\t\t\t\tif (s[-1, 1] != ';') \n\t\t\t\t\t\ts += ';'\n\t\t\t\t\tend\n\t\t\t\t\to[attribute] = s + setting(property, value)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\to[attribute] = setting(property, value)\n\t\t\tend\n\t\telse\n\t\t\tputs \"Could not find object with id = #{id}\"\n\t\tend\n\tend",
"def set_attribute(name, value)\n # Get the attr and clean up the input\n attr = to_real_attribute_name(name)\n raise UnknownAttribute.new(name) if attr.nil?\n\n if attr == dn_attribute and value.is_a?(String)\n new_dn_attribute, value, @base = split_dn_value(value)\n new_dn_attribute = to_real_attribute_name(new_dn_attribute)\n if dn_attribute != new_dn_attribute\n @dn_attribute = attr = new_dn_attribute\n end\n end\n\n # Enforce LDAP-pleasing values\n real_value = value\n # Squash empty values\n if value.class == Array\n real_value = value.collect {|c| (c.nil? or c.empty?) ? [] : c}.flatten\n end\n real_value = [] if real_value.nil?\n real_value = [] if real_value == ''\n real_value = [real_value] if real_value.class == String\n real_value = [real_value.to_s] if real_value.class == Fixnum\n # NOTE: Hashes are allowed for subtyping.\n\n # Assign the value\n @data[attr] = enforce_type(attr, real_value)\n\n # Return the passed in value\n @data[attr]\n end",
"def []=(attribute, value)\n attribute = attribute.to_s.gsub(/[^a-zA-Z0-9_\\-]/, '').gsub('_', '-')\n # FIXME => Attributes per class\n unless POSSIBLE_ATTRIBUTES.include? attribute\n # FIXME: Log, don't print\n puts \"Warning! Attribute #{attribute} not recognized\"\n @canvas << js_method('attr', {attribute => value})\n return nil\n end\n @canvas << js_method('attr', {attribute => value})\n return self\n end",
"def value=(attr)\n attributes['FieldValue'] = attr unless read_only?\n end",
"def []=(name, value)\n @attr[name] = value\n end",
"def write_attribute(attr_name, value)\n attr_name = attr_name.to_s\n column = column_for_attribute(attr_name)\n\n raise \"Invalid column for this bigrecord object (e.g., you tried to set a predicate value for an entity that is out of the predicate scope)\" if column == nil\n\n if column.number?\n @attributes[attr_name] = convert_number_column_value(value)\n else\n @attributes[attr_name] = value\n end\n end",
"def set attr, value\n unless writable? attr\n raise ArgumentError, \"#{attr} is read-only for #{inspect}\"\n end\n value = value.relative_to(@ref.value.size) if value.kind_of? Range\n @ref.set TRANSLATOR.cocoaify(attr), value\n end",
"def attr(name, value)\n self[name] = value\n return self\n end",
"def property(key, value)\n if @current_attribute.properties.key?(key.to_sym)\n raise \"attribute #{key} already defined\"\n end\n state_depth_must_be(States::ATTRIBUTE)\n @current_attribute.properties[key.to_sym] = value\n end",
"def []=(name, value)\n @attributes[name] = value\n end",
"def set_attr(attr, value)\n ret = LibSeccomp.seccomp_attr_set(context, attr, value)\n raise SystemCallError.new(\"seccomp_attr_set(context, #{attr.inspect}, #{value}) failed\", -ret) if ret < 0\n end",
"def value=(value)\n @value = Puppet::ResourceApi::DataTypeHandling.mungify(\n @data_type,\n value,\n \"#{@type_name}.#{@attribute_name}\",\n Puppet::ResourceApi.caller_is_resource_app?,\n )\n end",
"def value=(value)\n `#{@element}.value = #{value}`\n end",
"def update_attribute(name, value)\n raise NotImplemented\n end",
"def update_attribute(key, value)\n send(\"#{key}=\", value)\n end"
] |
[
"0.7614049",
"0.7433947",
"0.7421714",
"0.73256314",
"0.73256314",
"0.7287782",
"0.7206394",
"0.7192005",
"0.7136974",
"0.71270645",
"0.70843023",
"0.7008442",
"0.7008442",
"0.6957763",
"0.69515175",
"0.68816537",
"0.6867755",
"0.68602115",
"0.6845434",
"0.68413764",
"0.68246824",
"0.67555296",
"0.67456704",
"0.6741868",
"0.6716624",
"0.6699505",
"0.6683476",
"0.66784483",
"0.6670732",
"0.66681635",
"0.66681635",
"0.66681635",
"0.6630736",
"0.6623768",
"0.6619929",
"0.66189075",
"0.6595019",
"0.65905887",
"0.655725",
"0.65480876",
"0.6541296",
"0.653814",
"0.64969176",
"0.6492876",
"0.64910364",
"0.6473254",
"0.64525527",
"0.6451303",
"0.6445607",
"0.64035904",
"0.64035904",
"0.6397909",
"0.6392932",
"0.6389683",
"0.63875705",
"0.63875115",
"0.6376512",
"0.63497573",
"0.63350856",
"0.6330733",
"0.6328518",
"0.6324014",
"0.6323118",
"0.63211524",
"0.6314805",
"0.6293664",
"0.62908167",
"0.62848336",
"0.628304",
"0.62611103",
"0.62412244",
"0.62412244",
"0.621518",
"0.62097883",
"0.6206395",
"0.6205779",
"0.6196981",
"0.6196981",
"0.61951303",
"0.61910695",
"0.6188583",
"0.6188583",
"0.6188238",
"0.6184734",
"0.6184734",
"0.6156148",
"0.6148161",
"0.6147157",
"0.6132414",
"0.6127221",
"0.61202407",
"0.6118175",
"0.61150986",
"0.61011946",
"0.6096638",
"0.60926247",
"0.6080338",
"0.60416466",
"0.60202324",
"0.6014575"
] |
0.8150226
|
0
|
An internal validation function.
|
def valid_product_family
begin
product_family != nil
rescue
errors.add :product_family, 'does not exist'
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def valid?(_) true end",
"def valid?(_) true end",
"def validation; end",
"def validation; end",
"def validate!; end",
"def validate!; end",
"def validate!; end",
"def valid; end",
"def validate\n \n \n end",
"def validator; end",
"def validate\n end",
"def is_valid; end",
"def validate\r\n\r\n end",
"def validate!\n # pass\n end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validated?; end",
"def validate\r\n validate! rescue false\r\n end",
"def validate\n\n end",
"def validated; end",
"def validate\n fail 'sub class to implement'\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate\n valid?\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def is_valid?\n end",
"def validate\n # add errors if not validate\n end",
"def is_valid\n\tend",
"def is_valid\n\tend",
"def validate( _x )\n #TODO: cover common type-based validations?\n #TODO: Offer validation objects?\n raise InternalError.new( \"#{self.class}.validate() not implemented!\" )\n end",
"def validate\r\n @invalid=false\r\n end",
"def valid?\n end",
"def valid?\n end",
"def valid?\n end",
"def valid?\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def check_validity!\n # nothing\n end",
"def validate!\n\t\t\t\treturn true\n\t\t\tend",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?(thing); end",
"def valid?(thing); end",
"def is_valid\n return true\n end",
"def validate!\n true\n end",
"def validate\n @invalid=false\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate\n validate_params\n validate_colour\n validate_coordinates\n validate_dimension\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate\n raise NoMethodError, \"must define method 'validate'\"\n end",
"def validate(obj, type); end",
"def validate\n validate_params\n validate_coordinates\n validate_colour\n validate_dimension\n end",
"def invalid; end",
"def validate\n true\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n validate\n end",
"def validator=(_); end",
"def validate!(t)\n # None.\n end",
"def validate(options); end",
"def validate( _x )\n msg = 'ERROR: Item.validate() not implemented!'\n msg += \"\\nTODO: cover common type-based validations?\"\n msg += \"\\nTODO: Offer validation objects?\"\n fail msg\n end",
"def literal_validation; end",
"def literal_validation; end",
"def valid?\n return validate\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\r\n return true\r\n end",
"def validate\n super \n end",
"def validate\n validate_root\n validate_associated\n valid?\n end",
"def valid?\n true\n end",
"def valid?\n raise \"You must override `valid?' in your class\"\n end",
"def do_validation \n return true if self.ok\n set_ok\n self.ok\n end",
"def validate\n validator_class.new(self).validate\n end",
"def valid?\n raise NotImplementedError\n end",
"def validate params\n validate_params(params)\n validate_coordinates\n validate_color\n validate_dimension\n end",
"def subclass_validations ; true ; end",
"def validate(*args, &block)\n end",
"def valid?\n true && super\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"
] |
[
"0.8178233",
"0.8178233",
"0.8178233",
"0.8178233",
"0.81748724",
"0.81748724",
"0.81284386",
"0.81284386",
"0.80294967",
"0.80294967",
"0.80294967",
"0.80107385",
"0.7980947",
"0.7935828",
"0.7935513",
"0.7928331",
"0.7916492",
"0.78714937",
"0.78237754",
"0.78237754",
"0.78237754",
"0.78237754",
"0.78237754",
"0.78037465",
"0.78037465",
"0.78037465",
"0.7744788",
"0.77394575",
"0.7735474",
"0.77112657",
"0.7587453",
"0.75772053",
"0.75772053",
"0.75772053",
"0.7569355",
"0.75306314",
"0.7516488",
"0.7504825",
"0.749191",
"0.749191",
"0.7482468",
"0.7476454",
"0.7456167",
"0.7456167",
"0.7456167",
"0.7456167",
"0.74451447",
"0.7400563",
"0.7379163",
"0.73752815",
"0.73737437",
"0.73737437",
"0.7340982",
"0.73393834",
"0.7338807",
"0.73249257",
"0.72542167",
"0.72438514",
"0.72438514",
"0.7225673",
"0.720884",
"0.72063905",
"0.7206111",
"0.7191823",
"0.7188932",
"0.71842057",
"0.7179422",
"0.7172065",
"0.71556264",
"0.71547604",
"0.71338964",
"0.71338964",
"0.71146655",
"0.71032935",
"0.71032935",
"0.7081835",
"0.70750356",
"0.70611143",
"0.705153",
"0.7034324",
"0.70342034",
"0.70148766",
"0.7008994",
"0.69959456",
"0.69944817",
"0.699344",
"0.69837606",
"0.696033",
"0.6957368",
"0.6957368",
"0.6957368",
"0.6957368",
"0.6957368",
"0.6957368",
"0.6957368",
"0.6957368",
"0.6957368",
"0.6957368",
"0.6957368",
"0.6957368",
"0.6957368"
] |
0.0
|
-1
|
initialize memache if client is storing results in memcache
|
def initialize_memcache
require 'memcache'
memcache_options = {
:c_threshold => 10_000,
:compression => true,
:debug => false,
:namespace => 'backgroundrb_result_hash',
:readonly => false,
:urlencode => false
}
@cache = MemCache.new(memcache_options)
@cache.servers = BackgrounDRb::BDRB_CONFIG[:memcache].split(',')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def prepare\n namespace = @config[:namespace] || 'merb-cache'\n host = @config[:host] || '127.0.0.1:11211'\n @memcache = MemCache.new(host, {:namespace => namespace})\n @tracking_key = \"_#{namespace}_keys\" unless @config[:no_tracking]\n raise NotReady unless @memcache.active?\n true\n rescue NameError\n raise NotDefined\n end",
"def initialize\n @cache = {}\n end",
"def cache_store; end",
"def cache_store; end",
"def make_cache\n if !@thread_safe \n @@c = {}\n elsif defined?(ThreadSafe)\n @@c = ThreadSafe::Hash.new\n else\n raise 'ThreadSafe is required to use the Memory cache.'\n end \n end",
"def initialize\n @cache_last_reset= Time.now\n\n @use_cache = false\n @cache_ttl = (5 * 60) # 5 mins\n\n @data_store = {}\n end",
"def cache!\n @@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 configure_cache; end",
"def initialize\n @memory_store = ActiveSupport::Cache::MemoryStore.new\n end",
"def initialize_cache\n @elephant_cache = {}\n end",
"def cached?; end",
"def memcache_key_object\n @m_k_o ||= MemcacheKey.new('client.address')\n end",
"def cache_on?; end",
"def cache_on?; end",
"def cache\n persist('memory_only_ser')\n end",
"def initialize(cache)\n self.cache = cache\n end",
"def client\n @client ||= MemCache.new(address)\n end",
"def cache\n @cache ||= build_cache\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n DataCache\n end",
"def cache\n @cache ||= MemoryCache.new\n end",
"def cache\n @cache ||= {}\n end",
"def use_cache(cache)\n @cache = cache\n end",
"def memcache_key_object\n @m_k_o ||= MemcacheKey.new('client.api_credentials')\n end",
"def initialize_cache( type=nil )\n case type\n when /memcache/\n servers = [\"localhost\"]\n opts = { :namespace => \"martsearch\", :no_reply => true }\n \n if self.config[\"cache\"][\"servers\"]\n servers = self.config[\"cache\"][\"servers\"]\n end\n \n if self.config[\"cache\"][\"namespace\"]\n opts[:namespace] = self.config[\"cache\"][\"namespace\"]\n end\n \n return ActiveSupport::Cache::MemCacheStore.new( servers, opts )\n when /file/\n file_store = \"#{File.dirname(__FILE__)}/../tmp/cache\"\n if self.config[\"cache\"][\"file_store\"]\n file_store = self.config[\"cache\"][\"file_store\"]\n end\n return ActiveSupport::Cache::FileStore.new( file_store )\n else\n return ActiveSupport::Cache::MemoryStore.new()\n end\n end",
"def cache(data); end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def store(request, response)\n return unless response.cachable?\n\n entries = cache_entries_for(request)\n entries[request] = response\n\n @memcache[request.to_mc_key] = entries\n end",
"def simple_cache\n @@cache_store\n end",
"def initialize(hits,miss,entries,size)\n @cache_hits=hits\n @cache_miss=miss\n @cache_entries=entries\n @cache_size=size\n end",
"def initialize\n @starling_urls = Workling::Starling.config[:listens_on].split(',').map { |url| url ? url.strip : url }\n options = [@starling_urls, Workling::Starling.config[:memcache_options]].compact\n @connection = ::MemCache.new(*options)\n \n raise_unless_connected!\n end",
"def initialize(connection)\n @is_cached = false\n @connection = connection\n cache_list\n end",
"def _init_cache\n @cache_parent = {}\n end",
"def store_cache\n if options.key? :cache_results\n json = @results_cache.to_json\n outf = File.open(\"/tmp/%s_%s_snmp_results.json\" % [options[:model], options[:host]], \"w\")\n outf.write(json)\n outf.close\n end\n end",
"def cache_store=(_arg0); end",
"def cache_store=(_arg0); end",
"def load_cache\n @load_cache\n end",
"def cached(cache_key)\n begin\n result = yield\n $memcache.set(cache_key, result, 7200)\n warn \"Component #{cache_key} Set Successfully\" \n result\n rescue\n {}\n end\n end",
"def set_cache(value); end",
"def set_cache(value); end",
"def save_client_cache\n self.client_cache = @client.cache\n end",
"def cache\n @cache ||= Flareshow::Cache.new\n end",
"def initialize(cache = Global.cache)\n @cache = cache.new\n end",
"def initialize(db)\n @db = db\n @opts = {}\n @cache_mutex = Mutex.new\n @cache = {}\n end",
"def performance_cache\n @performance_cache ||= QaServer::PerformanceCache.new\n end",
"def memcache_key_object\n @m_k_o ||= MemcacheKey.new('manager.devices')\n end",
"def get_memcache_key_object\n MemcacheKey.new('aml.all_aml_match')\n end",
"def cache_store_type\n \"memcache\"\n end",
"def memcache_key_object\n @m_k_o ||= MemcacheKey.new('client.token_details')\n end",
"def client_for(servers)\n MemCache.new(servers)\n end",
"def base_cache_manager\n @cache_manager ||= PublicEarth::Db::MemcacheManager.new\n end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def get_memcache_key_object\n MemcacheKey.new('aml.aml_search')\n end",
"def data\n @cache ||= {}\n end",
"def instance_cache; end",
"def get_cache_object\n return @cache_obj unless @cache_obj == nil\n @cache_obj = ChaiIo::Cache::RedisCache.new\n @cache_obj\n end",
"def cache_setup(hostname, username, appname, cachename)\n options[:namespace] = [\n 'ramaze', hostname, username, appname, cachename\n ].compact.join(':')\n redis_connection = ::Redis.new\n @client = ::Redis::Namespace.new(options[:namespace], redis: redis_connection)\n end",
"def discovery_cache; end",
"def cache(&block)\n if ActiveRecord::Base.configurations.blank?\n yield\n else\n self.connection_proxy.cache(&block)\n end\n end",
"def disable_caching=(_arg0); end",
"def singleton_cache; end",
"def cache_backend=(cache_adaptor)\n cache.memcache = cache_adaptor\n end",
"def cache\n @cache ||= Chef::Cache.new()\n end",
"def clear_cache() @cache = {}; end",
"def cache(new_cache = nil)\n @cache = new_cache if new_cache\n @cache\n end",
"def initialize_cache\n return false unless ConfigurationSetting.table_exists? # pre-migration\n\n # cache customized settings\n ConfigurationSetting.all.each do |setting|\n @records[setting.key] = JSON.load(\"[#{setting.value}]\")[0] # temporary array wrapper ensures valid JSON text\n end\n\n # cache current settings\n @defaults.each do |key, default_value|\n value = @records[key]\n @settings[key] = value.nil? ? default_value : value\n end\n\n @initialized = true\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 cache_request\n cache\n end",
"def init_query_cache\n @store1 = Store.find(1)\n @store2 = Store.find(2)\n @apple1 = Apple.find(1)\n end",
"def should_cache?\n false\n end",
"def server_cache\n Facebooker::ServerCache.new(self)\n end",
"def initialize(referer: '', num_results: 50, start_results: 0, cache_client: nil)\n @referer = referer\n @start_results = start_results\n @num_results = num_results\n\n if cache_client && cache_client.respond_to?(:get) && cache_client.respond_to?(:set)\n @cache_client = cache_client\n end\n end",
"def initialize(data)\n @data = data\n @cache_hit = nil\n end",
"def _cache_control; 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 cache\n @__cache ||= Cache.new self\n end",
"def cache_client\n @m ||= Mutex.new\n @m.synchronize do\n if instance_variable_defined?(:@cache_client)\n @cache_client\n else\n dir = Rails.root.join(CacheDirectory.find_by(name: 'efs_twitter_user')&.dir || 'tmp/efs_cache')\n FileUtils.mkdir_p(dir) unless File.exists?(dir)\n options = {expires_in: 1.month, race_condition_ttl: 5.minutes}\n @cache_client = ActiveSupport::Cache::FileStore.new(dir, options)\n end\n end\n end",
"def cache\n @cache ||= ::Shopidav::Cache.new(site)\n end",
"def data_cache(key, time=30.minutes)\n\n return yield if caching_disabled?\n output = Rails.cache.fetch(key, {expires_in: time}) do\n\n yield\n end\n\n return output\n rescue\n # Execute the block if any error with Memcache\n\n return yield\n end",
"def flush_cache; end",
"def load_cache\n a = dataset.all\n h = {}\n a.each{|o| h[o.pk.freeze] = o.freeze}\n @all = a.freeze\n @cache = h.freeze\n end",
"def cache\n yield\n end",
"def memcache_flush\n client_pepo_campaign_details_memcache_key = ClientPepoCampaignDetail.get_memcache_key_object.key_template % {client_id: self.client_id}\n Memcache.delete(client_pepo_campaign_details_memcache_key)\n end",
"def cache_store_type\n \"memory\"\n end",
"def update_cache\n # Does nothing...up to subclasses to implement.\n end",
"def initialize(cache_store)\n @cache_store = cache_store\n end",
"def cache_value?; end",
"def use_clean_cache\n ActionController::Base.config.cache_store = Rails.cache = ActiveSupport::Cache::MemoryStore.new\n end"
] |
[
"0.71720105",
"0.67617524",
"0.6729403",
"0.6729403",
"0.67230844",
"0.6696267",
"0.66402173",
"0.66231966",
"0.66231966",
"0.66231966",
"0.66231966",
"0.66231966",
"0.66231966",
"0.66231966",
"0.658924",
"0.6551751",
"0.6550356",
"0.6448993",
"0.64371365",
"0.6427174",
"0.6427174",
"0.6426415",
"0.6426194",
"0.6424547",
"0.64163196",
"0.639987",
"0.639987",
"0.6390491",
"0.6380561",
"0.6378348",
"0.637627",
"0.6352778",
"0.6318573",
"0.62815523",
"0.6274366",
"0.6274366",
"0.62655383",
"0.621338",
"0.62116665",
"0.6198374",
"0.6196532",
"0.6194267",
"0.61935586",
"0.6186318",
"0.6186318",
"0.61813694",
"0.61808586",
"0.6176608",
"0.6176608",
"0.61592275",
"0.6150348",
"0.61247635",
"0.61074704",
"0.6094525",
"0.6083634",
"0.6082729",
"0.60793287",
"0.60721135",
"0.6043272",
"0.60408735",
"0.6012036",
"0.6012036",
"0.6012036",
"0.6012036",
"0.60055006",
"0.60013896",
"0.59828",
"0.5965225",
"0.5960722",
"0.5957517",
"0.5956009",
"0.59504557",
"0.5948805",
"0.5944042",
"0.59437597",
"0.5928359",
"0.59249675",
"0.592308",
"0.59007597",
"0.5888986",
"0.58799505",
"0.58771175",
"0.5870229",
"0.58685404",
"0.58676165",
"0.5867592",
"0.58584744",
"0.5858291",
"0.58535916",
"0.58489317",
"0.58480054",
"0.58400553",
"0.5826771",
"0.5810972",
"0.58038676",
"0.5802819",
"0.57967585",
"0.5795469",
"0.57894826",
"0.57885593"
] |
0.7719943
|
0
|
initialize all backend server connections
|
def establish_connections
klass = Struct.new(:ip,:port)
if t_servers = BackgrounDRb::BDRB_CONFIG[:client]
connections = t_servers.split(',')
connections.each do |conn_string|
ip = conn_string.split(':')[0]
port = conn_string.split(':')[1].to_i
@bdrb_servers << klass.new(ip,port)
end
end
@bdrb_servers << klass.new(BackgrounDRb::BDRB_CONFIG[:backgroundrb][:ip],BackgrounDRb::BDRB_CONFIG[:backgroundrb][:port].to_i)
@bdrb_servers.each_with_index do |connection_info,index|
next if @backend_connections.detect { |x| x.server_info == "#{connection_info.ip}:#{connection_info.port}" }
@backend_connections << Connection.new(connection_info.ip,connection_info.port,self)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize_servers\n @protocols.each do |protocol, _|\n server = @servers[protocol.protocol]\n block = server[:start]\n server[:server].start(server[:port], @routes[protocol.protocol], views: @views, channel: @channels[protocol.protocol], debug: @debug, &block)\n end\n end",
"def initialize_protocols\n @protocols.each do |protocol, _|\n server = protocol.server\n @servers[protocol.protocol] = { server: server, port: @protocols[protocol], start: protocol.start_block }\n @channels[protocol.protocol] = EM::Channel.new\n end\n initialize_servers\n initialize_subscribers\n initialize_agents\n end",
"def setup\n return unless connection_pool_enabled?\n\n @connection_pool = ::Queue.new\n\n start_pool_size.times { @connection_pool.push(new_client) }\n\n @created_connections = start_pool_size\n end",
"def post_init\n $connection_list << self\n @my_connection_index = $connection_list.length\n puts \"Connection Initialized #{@my_connection_index}) #{@my_address} - #{@signature}\"\n #\n # TODO: get access to the HostIP and HostPort associated with this connection\n # if it is the local control connection, do the following\n # * do not repeat other connection traffic to this connection\n # * consider any input a command to be processed\n end",
"def post_init\n puts \"batsd server ready and waiting on #{Batsd::Server.config[:port]} to ship data upon request\\n\"\n @redis = Batsd::Redis.new(Batsd::Server.config)\n @diskstore = Batsd::Diskstore.new(Batsd::Server.config[:root])\n end",
"def empty_connection_pools!; end",
"def initialize\n bootstrap_connections unless File.exist?(connections_file)\n load_connections\n end",
"def post_init\n Batsd.logger.debug \"batsd server ready and waiting on #{Batsd::Server.config[:port]} to ship data upon request\\n\"\n @redis = Batsd::Redis.new(Batsd::Server.config)\n @diskstore = Batsd::Diskstore.new(Batsd::Server.config[:root])\n @retentions = Batsd::Server.config[:retentions]\n end",
"def setupBackend\n lBackendInitHere = false\n if (!@BackendInit)\n @BackendInstance.init_session(@Conf[:Backends][@Backend])\n @BackendInit = true\n lBackendInitHere = true\n end\n yield\n if (lBackendInitHere)\n @BackendInstance.close_session\n @BackendInit = false\n end\n end",
"def init\n @calls = []\n @accept_nodes = []\n @connected_nodes = nil\n @remote_bash_code = nil\n end",
"def configure\n yield self\n\n pool_size = 5\n host = @host.nil? ? 'minfraud.maxmind.com' : @host\n @connection_pool = ConnectionPool.new(size: pool_size) do\n make_http_client.persistent(\"https://#{host}\")\n end\n end",
"def all_active_connections\n super\n end",
"def setup\n super do |server_app, binder|\n binder.forward :concurrency\n\n yield(server_app, binder) if block_given?\n end\n end",
"def init_client; end",
"def initialize_for_connect\n @initial_post = true\n @http_requests = 1\n @pending_requests = 0\n @last_send = Time.at(0)\n @previous_send = Time.at(0)\n @send_buffer = ''\n @stream_mechanisms = []\n @stream_features = {}\n end",
"def initialize_server\n my_public_ip = my_node.public_ip\n head_node_ip = get_public_ip(@creds['hostname'])\n\n HAProxy.initialize_config\n Nginx.initialize_config\n\n if my_node.disk\n imc = InfrastructureManagerClient.new(@@secret)\n\n device_name = imc.attach_disk(@creds, my_node.disk, my_node.instance_id)\n loop {\n if File.exists?(device_name)\n Djinn.log_info(\"Device #{device_name} exists - mounting it.\")\n break\n else\n Djinn.log_info(\"Device #{device_name} does not exist - waiting for \" +\n \"it to exist.\")\n Kernel.sleep(1)\n end\n }\n\n Djinn.log_run(\"rm -rf #{PERSISTENT_MOUNT_POINT}\")\n Djinn.log_run(\"mkdir #{PERSISTENT_MOUNT_POINT}\")\n mount_output = Djinn.log_run(\"mount -t ext4 #{device_name} \" +\n \"#{PERSISTENT_MOUNT_POINT} 2>&1\")\n if mount_output.empty?\n Djinn.log_info(\"Mounted persistent disk #{device_name}, without \" +\n \"needing to format it.\")\n Djinn.log_run(\"mkdir -p #{PERSISTENT_MOUNT_POINT}/apps\")\n\n # In cloud deployments, information about what ports are being used gets\n # persisted to an external disk, which isn't available to us when we\n # initially try to restore the AppController's state. Now that this info\n # is available, try again.\n if my_node.is_login? or my_node.is_appengine?\n restore_appserver_state\n end\n\n # Finally, RabbitMQ expects data to be present at /var/lib/rabbitmq.\n # Make sure there is data present there and that it points to our\n # persistent disk.\n if File.exists?(\"/opt/appscale/rabbitmq\")\n Djinn.log_run(\"rm -rf /var/lib/rabbitmq\")\n else\n Djinn.log_run(\"mv /var/lib/rabbitmq /opt/appscale\")\n end\n Djinn.log_run(\"ln -s /opt/appscale/rabbitmq /var/lib/rabbitmq\")\n return\n end\n\n Djinn.log_info(\"Formatting persistent disk #{device_name}\")\n Djinn.log_run(\"mkfs.ext4 -F #{device_name}\")\n\n Djinn.log_info(\"Mounting persistent disk #{device_name}\")\n Djinn.log_run(\"mount -t ext4 #{device_name} #{PERSISTENT_MOUNT_POINT} \" +\n \"2>&1\")\n Djinn.log_run(\"mkdir -p #{PERSISTENT_MOUNT_POINT}/apps\")\n\n Djinn.log_run(\"mv /var/lib/rabbitmq /opt/appscale\")\n Djinn.log_run(\"ln -s /opt/appscale/rabbitmq /var/lib/rabbitmq\")\n end\n end",
"def connections\n @_connections ||= {}\n end",
"def initialize_devices\n count = workers * devices\n client = Client.new(base_url, max_concurrency: [count, 200].min) # Typheous gets flaky above 200\n if end_point.nil?\n update(end_point: EndPoint.find_or_create_by(base_url: base_url))\n end\n log \"setup\", \"Checking for #{count} generated devices in the local database.\"\n end_point.generate_devices(count) {|progress| log \"setup\", \"Devices: #{progress}\" }\n log \"setup\", \"Checking for #{count} logged in users.\"\n end_point.register_and_login_devices client,\n ->(r) { log \"setup\", \"Warm-up completed!\";r },\n ->(r) { log_error \"setup\", \"Device registration or login failed: #{r}\" }\n end",
"def initialize_connection(env)\n end",
"def start\n @scheme_registry = create_scheme_registry\n @connection_manager = create_connection_manager\n\n @client = create_http_client\n end",
"def begin!\n start_server\n end",
"def initialize_connection\n self.send(Response.new(action: 'init'))\n end",
"def prepare\n if not @http_server\n config = {}\n config[:BindAddress] = @configuration.get('beef.http.host')\n config[:Port] = @configuration.get('beef.http.port')\n config[:Logger] = WEBrick::Log.new($stdout, WEBrick::Log::ERROR)\n config[:ServerName] = \"BeEF \" + VERSION\n config[:ServerSoftware] = \"BeEF \" + VERSION\n \n @http_server = WEBrick::HTTPServer.new(config)\n \n # Create http handler for the javascript hook file\n mount(\"#{@configuration.get(\"beef.http.hook_file\")}\", true, BeEF::Core::Handlers::HookedBrowsers)\n \n # Create http handlers for all commands in the framework\n BeEF::Modules.get_loaded.each { |k,v|\n mount(\"/command/#{k}.js\", false, BeEF::Core::Handlers::Commands, k)\n }\n \n #\n # We dynamically get the list of all http handler using the API and register them\n #\n BeEF::API.fire(BeEF::API::Server::Handler, 'mount_handlers', self)\n end\n end",
"def backend_instances(refresh=false)\n if @backend_instances.nil? or refresh\n @backend_instances = {}\n backend_data = @socket.execute( \"show stat -1 4 -1\" )[1..-1].collect{|item| item.split(\",\")[0..1]}\n backend_servers = backend_data.inject({}){|hash, items|\n (hash[items[0]] ||=[]) << items[1]; hash\n }\n backend_servers.each do |backend, servers|\n @backend_instances[backend] = HAProxyManager::Backend.new(backend, @socket)\n end\n end\n @backend_instances\n end",
"def initialize\n log.info \"Main server: #{client[\"/apps/cocina/host\"]} - #{client[\"/apps/cocina/main_port\"]}\"\n super client[\"/apps/cocina/host\"], client[\"/apps/cocina/main_port\"]\n end",
"def initvars\n @provider_instances = []\n @needs_flush = false\n @failed = false\n end",
"def active_local_sockets; end",
"def post_init\n @connector = Aeon::Connector.new(self)\n end",
"def post_init\n @connector = Aeon::Connector.new(self)\n end",
"def initialize\n @status = {}\n @last_update = nil\n @server_status = Overwatch::ServerStatus.new skip_query: true\n @mutex = Mutex.new\n\n populate_servers\n end",
"def start_api_services()\n # ejabberd uses uaserver for authentication\n # so start it after we find out the uaserver's ip\n threads = []\n if my_node.is_login?\n threads << Thread.new {\n start_ejabberd()\n }\n end\n\n @done_initializing = true\n\n # start zookeeper\n threads << Thread.new {\n if my_node.is_zookeeper?\n configure_zookeeper(@nodes, @my_index)\n start_zookeeper\n end\n\n ZKInterface.init(my_node, @nodes)\n }\n\n if my_node.is_memcache?\n threads << Thread.new {\n start_memcache()\n }\n end\n\n if my_node.is_db_master?\n threads << Thread.new {\n start_db_master()\n # create initial tables\n if my_node.is_db_master?\n prime_database\n end\n\n # Always colocate the Datastore Server and UserAppServer (soap_server).\n if has_soap_server?(my_node)\n @state = \"Starting up SOAP Server and Datastore Server\"\n start_datastore_server()\n start_soap_server()\n HelperFunctions.sleep_until_port_is_open(HelperFunctions.local_ip, UserAppClient::SERVER_PORT)\n end\n\n # If we're starting AppScale with data from a previous deployment, we\n # may have to clear out all the registered app instances from the\n # UserAppServer (since nobody is currently hosting any apps).\n if not @creds['clear_datastore']\n erase_app_instance_info\n end\n }\n end\n\n if my_node.is_db_slave?\n threads << Thread.new {\n start_db_slave()\n\n # Currently we always run the Datastore Server and SOAP\n # server on the same nodes.\n if has_soap_server?(my_node)\n @state = \"Starting up SOAP Server and Datastore Server\"\n start_datastore_server()\n start_soap_server()\n HelperFunctions.sleep_until_port_is_open(HelperFunctions.local_ip,\n UserAppClient::SERVER_PORT)\n end\n }\n end\n\n # All nodes have application managers\n threads << Thread.new {\n start_app_manager_server()\n }\n\n if my_node.is_appengine?\n threads << Thread.new {\n start_blobstore_server()\n }\n end\n\n if my_node.is_taskqueue_master?\n threads << Thread.new {\n start_taskqueue_master()\n }\n elsif my_node.is_taskqueue_slave?\n threads << Thread.new {\n start_taskqueue_slave()\n }\n end\n\n # App Engine apps rely on the above services to be started, so\n # join all our threads here\n Djinn.log_info(\"Waiting for all services to finish starting up\")\n threads.each { |t| t.join() }\n Djinn.log_info(\"API services have started on this node\")\n\n end",
"def connections\n @connections ||= []\n end",
"def initialize\n @allocations = {}\n @http_server = BeEF::Core::Server.instance\n @root_dir = File.expand_path('../../../../', __FILE__)\n end",
"def start\n retry_jobs if JR.config[:retry_jobs_at_start]\n EM.start_server(*self.config[:server], Server, self, self.storage)\n self.config[:distributors].each do |distributor|\n connect_to(distributor)\n end\n end",
"def connections\n @connections ||= {}\n end",
"def initialize(*servers)\n @servers = parse_servers(servers)\n set_current_server\n @mutex = Mutex.new\n connect\n end",
"def reset\n VALID_CONFIG_KEYS.each do |k, v|\n send(\"#{k}=\", v)\n end\n self.server_binding_url = \"#{::ENV.fetch('GRPC_SERVER_HOST',\n '0.0.0.0')}:#{::ENV.fetch('GRPC_SERVER_PORT', 9_001)}\"\n self.interceptors = ::Gruf::Interceptors::Registry.new\n self.hooks = ::Gruf::Hooks::Registry.new\n self.root_path = ::Rails.root.to_s.chomp('/') if defined?(::Rails)\n determine_loggers\n self.ssl_crt_file = \"#{root_path}config/ssl/#{environment}.crt\"\n self.ssl_key_file = \"#{root_path}config/ssl/#{environment}.key\"\n cp = ::ENV.fetch('GRUF_CONTROLLERS_PATH', 'app/rpc').to_s\n self.controllers_path = root_path.to_s.empty? ? cp : \"#{root_path}/#{cp}\"\n self.backtrace_on_error = ::ENV.fetch('GRPC_BACKTRACE_ON_ERROR', 0).to_i.positive?\n self.rpc_server_options = {\n max_waiting_requests: ::ENV.fetch('GRPC_SERVER_MAX_WAITING_REQUESTS',\n GRPC::RpcServer::DEFAULT_MAX_WAITING_REQUESTS).to_i,\n pool_size: ::ENV.fetch('GRPC_SERVER_POOL_SIZE', GRPC::RpcServer::DEFAULT_POOL_SIZE).to_i,\n pool_keep_alive: ::ENV.fetch('GRPC_SERVER_POOL_KEEP_ALIVE', GRPC::Pool::DEFAULT_KEEP_ALIVE).to_i,\n poll_period: ::ENV.fetch('GRPC_SERVER_POLL_PERIOD', GRPC::RpcServer::DEFAULT_POLL_PERIOD).to_i,\n connect_md_proc: nil,\n server_args: {}\n }\n self.use_default_interceptors = ::ENV.fetch('GRUF_USE_DEFAULT_INTERCEPTORS', 1).to_i.positive?\n\n if use_default_interceptors\n interceptors.use(::Gruf::Interceptors::ActiveRecord::ConnectionReset)\n interceptors.use(::Gruf::Interceptors::Instrumentation::OutputMetadataTimer)\n end\n self.health_check_enabled = ::ENV.fetch('GRUF_HEALTH_CHECK_ENABLED', 0).to_i.positive?\n options\n end",
"def init_server\n box = @boxes[@environment_name]\n if box.nil?\n launch!\n else\n @cloud.connect_to_server(box)\n end\n end",
"def initialize( max_queue_size, server_port, batch_time, realtime, backend, backend_params )\n mirror_hostlist=backend_params.split(',')\n @@log.info \"Initializing \"+backend+\" backend.\" \n cls = Object.const_get(backend)\n @sender_plugin = cls.new(mirror_hostlist);\n\n # Queue to store the data\n @data = SizedQueue.new(max_queue_size)\n @server_port = server_port\n @batch_time = batch_time\n @realtime = realtime\n end",
"def child_init( request )\n @conn = PGconn.connect( \"host=localhost dbname=test\" )\n request.server.log_info \"Preconnect done: %p\" % [ @conn ]\n return Apache::OK\n end",
"def post_init\n @connected = true\n end",
"def post_init\n @connected = true\n end",
"def initialize\n super\n self.scripts = []\n self.template_paths = []\n self.libraries = {}\n self.options = SymbolHash.new(false).update(\n :single_library => true,\n :caching => false\n )\n self.server_options = {:Port => 8808}\n end",
"def grab_connections\n connections = []\n connections << @host\n end",
"def initialize\n # Create temporary data directory\n create_data_dir\n\n # Init connection to ADS\n init_ads\n\n # Initialize Data science toolkit\n init_dstk\n\n # Init connection to SQLite\n # init_sqlite3\n end",
"def initialize\n @clients = {}\n @beanstalk_servers = []\n BeanCounter.beanstalkd_url.each do |url|\n server = GemeraldBeanstalk::Server.new(*parse_url(url))\n @clients[server.beanstalk] = server.beanstalk.direct_connection_client\n @beanstalk_servers << server\n end\n end",
"def initialize\n @clients = []\n end",
"def initialize( host, port = 8888, path = \"websocket\",\n version = 1, support )\n super(\"http://#{host}:#{port}/#{path}\") #setup websocket connection\n\n self.init_event_handlers()\n @callbacks = {}\n @collections = {}\n @subs = {}\n @sub_ids = {}\n @version = version\n #setup database info\n @mongo = self.get_db_conn\n\n end",
"def setup\n unless APP_CONFIG['single_server']\n @logger.info \"Multiple server mode activated\"\n $redis_listen = EM::Hiredis.connect(APP_CONFIG['redis_url'])\n $redis = EM::Hiredis.connect(APP_CONFIG['redis_url'])\n\n if ENV['TUBEHUB_MODE'] == 'backend'\n $redis_listen.subscribe APP_CONFIG['redis_channel']\n $redis_listen.on(:message) do |channel, msg|\n handle_redis_event((JSON.parse(msg) rescue {}))\n end\n end\n end\n\n reload_channels\n end",
"def prepare(server); end",
"def bootstrap_connections\n FileUtils.touch(connections_file)\n end",
"def servers\n @_servers ||= []\n end",
"def servers\n @_servers ||= []\n end",
"def configure_connection\n end",
"def init\n if !response_service.admin_view?\n render json: { popup: 'Must be an admin to initialize the database!!' }\n elsif Rails.env.production?\n render json: { popup: 'Can\\'t initialize the production database!!' }\n else\n Answer.delete_all\n Authentication.delete_all\n Expression.delete_all\n Finder.delete_all\n List.delete_all\n Rcpref.delete_all\n Recipe.delete_all\n ImageReference.delete_all\n Referent.delete_all\n Referment.delete_all\n ReferentRelation.delete_all\n ResultsCache.delete_all\n Scraper.clear_all\n Site.delete_all\n TagSelection.delete_all\n Tag.delete_all\n TagOwner.delete_all\n Tagging.delete_all\n TagsCache.delete_all\n Tagset.delete_all\n # User.delete_all\n # UserRelation.delete_all\n Vote.delete_all\n sql = 'DELETE FROM delayed_jobs;'\n ActiveRecord::Base.connection.execute(sql)\n render json: { popup: 'Database is initialized and ready for scraping.' }\n end\n end",
"def prepare_connection(env)\n env.trace 'init connection'\n @env = env\n init_queue\n initialize_connection env # Defined in each endpoint\n @application.stat_connection_open\n @channel = env.params['channel']\n logger.debug \"Connected to channel #{@channel}\"\n subscribe @channel\n end",
"def connections\n @connections ||= {}\n end",
"def initialize\r\n @connection = nil\r\n end",
"def connections\n @connection_pool\n end",
"def configure_connection\n end",
"def remote_connections; end",
"def initialize!(config_hash)\n config_hash[:queues].each do |queue_config|\n @servers << build_server(queue_config)\n end\n end",
"def create_clients\n @haproxy = rpcclient('haproxy')\n @site = rpcclient('site')\n @service = rpcclient('service')\n @rpcutil = rpcclient('rpcutil')\n # Disable to progress bar to clean up output a little\n [@haproxy, @site, @service, @rpcutil].each do |client|\n client.progress = false\n end\nend",
"def initialize_drivers\n\t\tself.drivers = []\n\t\ttdrivers = %W{ postgresql mysql sqlite3 }\n\t\ttdrivers.each do |driver|\n\t\t\tbegin\n\t\t\t\tActiveRecord::Base.default_timezone = :utc\n\t\t\t\tActiveRecord::Base.establish_connection(:adapter => driver)\n\t\t\t\tif(self.respond_to?(\"driver_check_#{driver}\"))\n\t\t\t\t\tself.send(\"driver_check_#{driver}\")\n\t\t\t\tend\n\t\t\t\tActiveRecord::Base.remove_connection\n\t\t\t\tself.drivers << driver\n\t\t\trescue ::Exception\n\t\t\tend\n\t\tend\n\n\t\tif(not self.drivers.empty?)\n\t\t\tself.driver = self.drivers[0]\n\t\tend\n\n\t\t# Database drivers can reset our KCODE, do not let them\n\t\t$KCODE = 'NONE' if RUBY_VERSION =~ /^1\\.8\\./\n\tend",
"def post_init\n @state = :connecting\n @handshake = ::WebSocket::Handshake::Server.new(:secure => @secure_proxy)\n start_tls(@tls_options) if @secure\n end",
"def initialize(info)\n super\n\n self.sockets = Array.new\n end",
"def initialize_offline_queue\n @offline_handler.init if @options[:offline_queueing]\n end",
"def initialize(options={})\n @server_list = ServerList.new\n @groups = Hash.new { |h,k| h[k] = ServerList.new }\n @gateway = nil\n @open_groups = []\n @connect_threads = []\n @on_error = :fail\n @default_user = ENV['USER'] || ENV['USERNAME'] || \"unknown\"\n\n @open_connections = 0\n @pending_sessions = []\n @session_mutex = Mutex.new\n\n options.each { |opt, value| send(\"#{opt}=\", value) }\n end",
"def discover_server_periodically\n @disconnected_connections.each do |key,connection|\n connection.establish_connection\n if connection.connection_status\n @backend_connections << connection\n connection.close_connection\n @disconnected_connections[key] = nil\n end\n end\n @disconnected_connections.delete_if { |key,value| value.nil? }\n @round_robin = (0...@backend_connections.length).to_a\n end",
"def initialize(ethernet_connections,serial_connections,mpg=nil,respond_to_queries=nil)\n\t\t$redis = Redis.new\n\t\tself.class.log(\"Initializing AstmServer\")\n\t\tself.ethernet_connections = ethernet_connections\n\t\tself.serial_connections = serial_connections\n\t\tself.server_ip = server_ip || \"127.0.0.1\"\n\t\tself.server_port = server_port || 3000\n\t\tself.respond_to_queries = respond_to_queries\n\t\tself.serial_port = serial_port\n\t\tself.serial_baud = serial_baud\n\t\tself.serial_parity = serial_parity\n\t\tself.usb_port = usb_port\n\t\tself.usb_baud = usb_baud\n\t\tself.usb_parity = usb_parity\n\t\t$mappings = JSON.parse(IO.read(mpg || self.class.default_mappings))\n\tend",
"def post_init\n puts \"connection established\"\n \n # store the eventmachine connection object id\n @connection.id = self.object_id\n end",
"def post_init\n self.dispatch_event(:on_connect, [self])\n self.send_data(SyncMessage.new($listen_port, $uuid).to_sendable)\n end",
"def init\n self['env'] ||= 'development'\n\n n = (self['port'] || 3000).to_i\n assert n >= 0 && n <= 65535\n self['port'] = n\n\n n = (self['workers'] || self['worker'] || ((CpuCounter.count + 1)/ 2)).to_i\n assert n > 0 && n < 1000\n self['workers'] = n\n\n unless self['root']\n set :root, Dir.pwd\n end\n self['root'] = File.realpath File.expand_path self['root']\n\n # todo warn paths not under project?\n self['views'] = project_path(self['views'] || 'views')\n if self['public']\n self['public'] = project_path(self['public'])\n end\n\n if self['assets']\n self['assets'] = project_path(self['assets'])\n end\n\n self.logger = create_logger\n\n assert !self['before_fork'] || self['before_fork'].respond_to?('call')\n assert !self['after_fork'] || self['after_fork'].respond_to?('call')\n\n self['timeout'] ||= 120\n timeout = self['timeout'].to_i\n assert timeout > 0 && timeout < 2**30\n self['timeout'] = timeout\n Ext.set_inactive_timeout timeout\n end",
"def init_clients(environment=:development)\n env_config = self.config_for(environment)\n self.init_riak_client(env_config)\n end",
"def init\n adapter.setup_connection_specification_name\n adapter.process_excluded_models\n end",
"def init\n # Open a socket for the server to connect on.\n @sock = TCPSocket.new(@address , @server.port)\n @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true)\n @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, false)\n unless RUBY_PLATFORM =~ /win32/\n @sock.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK)\n end\n c = Connection.new(@server, @sock)\n if c.init\n log.info \"(#{c.object_id}) Connection made.\"\n publish(c)\n true\n else\n false\n end\n rescue Exception\n log.error \"Connector#init\"\n log.error $!\n false\n end",
"def initialize\n engine_uri = URI(ENV.fetch 'ENGINE_URL')\n @conn = Rserve::Simpler.new hostname: engine_uri.host\n end",
"def new_connection; end",
"def start\n backend.start\n end",
"def bootstrap(basedir)\n config = get_config(basedir)\n # Initialize Rhoconnect and Resque\n Rhoconnect.base_directory = basedir\n Rhoconnect.app_directory = get_setting(config,environment,:app_directory)\n Rhoconnect.data_directory = get_setting(config,environment,:data_directory)\n Rhoconnect.vendor_directory = get_setting(config,environment,:vendor_directory)\n Rhoconnect.bulk_sync_poll_interval = get_setting(config,environment,:bulk_sync_poll_interval,3600)\n Rhoconnect.redis = get_setting(config,environment,:redis,false)\n Rhoconnect.connection_pool_size ||= get_setting(config,environment,:connection_pool_size,5)\n Rhoconnect.connection_pool_timeout = get_setting(config,environment,:connection_pool_timeout,30)\n Rhoconnect.redis_timeout = get_setting(config,environment,:redis_timeout,30)\n Rhoconnect.api_token = ENV['API_TOKEN'] || get_setting(config,environment,:api_token,false)\n Rhoconnect.log_disabled = get_setting(config,environment,:log_disabled,false)\n Rhoconnect.raise_on_expired_lock = get_setting(config,environment,:raise_on_expired_lock,false)\n Rhoconnect.lock_duration = get_setting(config,environment,:lock_duration)\n Rhoconnect.cookie_expire = get_setting(config,environment,:cookie_expire) || 31536000\n Rhoconnect.store_key_ttl = get_setting(config, environment, :store_key_ttl) || 86400\n Rhoconnect.predefined_sources = {}\n yield self if block_given?\n Store.create(Rhoconnect.redis)\n Resque.redis = Rhoconnect.redis.is_a?(Array) ? Rhoconnect.redis[0] : Rhoconnect.redis\n Rhoconnect.base_directory ||= File.join(File.dirname(__FILE__),'..')\n Rhoconnect.app_directory ||= Rhoconnect.base_directory\n Rhoconnect.data_directory ||= File.join(Rhoconnect.base_directory,'data')\n Rhoconnect.vendor_directory ||= File.join(Rhoconnect.base_directory,'vendor')\n Rhoconnect.stats ||= false\n Rhoconnect.disable_rc_console ||= false\n Rhoconnect.disable_resque_console ||= false\n Rhoconnect.use_node = Rhoconnect.use_node.nil? ? true : Rhoconnect.use_node\n Rhoconnect.restart_node_on_error ||= true if Rhoconnect.use_node\n Rhoconnect.node_channel_timeout = get_setting(config, environment, :node_channel_timeout, 30)\n if File.directory?(File.join(Rhoconnect.app_directory,'sources'))\n check_and_add(File.join(Rhoconnect.app_directory,'sources'))\n # post deprecation warning !!!\nwarning_for_deprecated_sources_dir = <<_MIGRATE_TO_NEW_RHOCONNECT\n\n***** WARNING *****\nRhoConnect has detected that you're using deprecated SourceAdapter classes.\n\n SourceAdapter class support will be removed in RhoConnect 4.1.\n Please, migrate your SourceAdapter classes into RhoConnect Models.\n\n For more details, see RhoConnect Migration guidelines at\n docs.rhomobile.com\n\n_MIGRATE_TO_NEW_RHOCONNECT\n puts warning_for_deprecated_sources_dir\n end\n\n check_and_add(File.join(Rhoconnect.app_directory,'models','ruby'))\n start_app(config)\n create_admin_user\n end",
"def clear_reloadable_connections!\n self.ensure_ready\n self.connection_pool_list.each(&:clear_reloadable_connections!)\n end",
"def assign_globals\n Server.keys = Server.build_keys(@config.namespace, @config.priorities)\n Server.worker = self\n end",
"def init(worker_threads = 1)\n @mutex.synchronize do\n unless @context\n @context = ZMQ.context(worker_threads)\n @sockets = Set.new\n end\n @context\n end\n end",
"def initialize(info = {})\n super\n\n # XXX: Not supported by all modules\n register_advanced_options(\n [\n OptAddress.new(\n 'ReverseListenerBindAddress',\n [ false, 'The specific IP address to bind to on the local system' ]\n ),\n OptBool.new(\n 'ReverseListenerThreaded',\n [ true, 'Handle every connection in a new thread (experimental)', false ]\n )\n ] +\n Msf::Opt::stager_retry_options,\n Msf::Handler::ReverseTcp\n )\n\n self.conn_threads = []\n end",
"def init_slaves\n [].tap do |slaves|\n ActiveRecord::Base.configurations.each do |name, values|\n if name.to_s =~ /#{self.environment}_(slave_database.*)/\n weight = if values['weight'].blank?\n 1\n else\n (v=values['weight'].to_i.abs).zero?? 1 : v\n end\n MultiDb.module_eval %Q{\n class #{$1.camelize} < ActiveRecord::Base\n self.abstract_class = true\n establish_connection :#{name}\n WEIGHT = #{weight} unless const_defined?('WEIGHT')\n end\n }, __FILE__, __LINE__\n slaves << \"MultiDb::#{$1.camelize}\".constantize\n end\n end\n end\n end",
"def server_instances(refresh=false)\n if @server_instances.nil? or refresh\n @server_instances = {}\n backend_instances.each do |key, backend|\n @server_instances = @server_instances.merge(backend.servers)\n end\n end\n @server_instances\n end",
"def create_connection_manager(ds)\n end",
"def start\n @io_reactor.start.flat_map { connect_all }.map(self)\n end",
"def connect\n @connection_manager.connect\n end",
"def initialize_http_handler(args = {})\n @http = HTTPHandler.new(args)\n logger.debug { \"Connection Set: #{http.to_s}\" }\n end",
"def initialize(clients)\n @all_clients = clients\n end",
"def initialize_urls\n acts_as_url_configuration.adapter.initialize_urls! self\n end",
"def backends\n # Lets cache the values and return the cache\n if @backends.nil?\n @backends = {}\n backend_instances.each do | name, backend|\n @backends[name] = backend.servers\n end\n end\n @backends\n end",
"def initialize(options = {}, &block)\n @connections, @busy_connections, @queue = [], {},[]\n @connection_proc = block\n @size = options[:size] || 8\n if options[:eager]\n @size.times do\n @connections << @connection_proc.call\n end\n end\n end",
"def setup\n\n\tsb = ServerBroker.new\n\tcb = ClientBroker.new(sb)\n\tcp = ClientProxy.new(cb)\n\n\tClient.new(cp)\n\nend",
"def run\n @active_connections = 0\n @mutex = Mutex.new\n\n logger.info \"Starting server on #{server_configuration.bind}\"\n\n # Set up each listener and add it to an array ready for the event loop\n @active_descriptors = []\n @active_descriptors << establish_socket_server\n @active_descriptors << establish_file_descriptor_server\n @active_descriptors << setup_signal_traps\n\n write_pidfile\n\n # Enter the main loop\n select_loop\n end",
"def start\n self.connect\n self.login if @connected\n end",
"def connect!; end",
"def connect!; end",
"def connect; end"
] |
[
"0.74100477",
"0.6855645",
"0.6611705",
"0.65290457",
"0.6371729",
"0.63163835",
"0.6316341",
"0.63012344",
"0.62954414",
"0.62927186",
"0.62580585",
"0.6250443",
"0.622742",
"0.6225564",
"0.62035614",
"0.61854345",
"0.61762184",
"0.6131116",
"0.6106458",
"0.6096347",
"0.60860234",
"0.60786176",
"0.60405296",
"0.60317385",
"0.6010546",
"0.60099906",
"0.6004422",
"0.600136",
"0.600136",
"0.59993476",
"0.5993799",
"0.5955264",
"0.5944399",
"0.5943451",
"0.59404874",
"0.5934949",
"0.5934861",
"0.5933643",
"0.59289",
"0.59078145",
"0.58957756",
"0.58957756",
"0.58945954",
"0.5888907",
"0.58835477",
"0.5877639",
"0.5876566",
"0.5861828",
"0.5850966",
"0.58496815",
"0.5849644",
"0.5845027",
"0.5845027",
"0.5842877",
"0.58419687",
"0.58059824",
"0.5804366",
"0.5799985",
"0.57841396",
"0.5777537",
"0.57706475",
"0.57674557",
"0.57601243",
"0.5759281",
"0.5749286",
"0.574913",
"0.5746225",
"0.5740018",
"0.5729022",
"0.5714786",
"0.57121104",
"0.57049245",
"0.5704505",
"0.570278",
"0.5696079",
"0.5694533",
"0.56795216",
"0.5672679",
"0.56614554",
"0.5660849",
"0.56592137",
"0.5649586",
"0.5649579",
"0.56355745",
"0.56338143",
"0.5629674",
"0.56246984",
"0.56235623",
"0.56010634",
"0.5599215",
"0.5597512",
"0.5594844",
"0.5590021",
"0.5585782",
"0.55734557",
"0.5573164",
"0.55691105",
"0.5567856",
"0.5567856",
"0.5567472"
] |
0.6667877
|
2
|
end of method establish_connections every 10 request or 10 seconds it will try to reconnect to bdrb servers which were down
|
def discover_server_periodically
@disconnected_connections.each do |key,connection|
connection.establish_connection
if connection.connection_status
@backend_connections << connection
connection.close_connection
@disconnected_connections[key] = nil
end
end
@disconnected_connections.delete_if { |key,value| value.nil? }
@round_robin = (0...@backend_connections.length).to_a
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def setup_reconnect\n delay = @reconnect_manager.get_next_reconnect_delay(@last_status_code)\n\n if delay == -1\n execute_callback(@maxiumum_reconnects_reached_callback)\n terminate_connection\n elsif delay == 0\n execute_callback(@reconnect_callback, 0)\n attempt_reconnect\n else\n execute_callback(@reconnect_callback, delay.to_f/1000)\n EventMachine.add_timer(delay.to_f/1000) do\n attempt_reconnect\n end\n end\n end",
"def reconnect\n end",
"def without_reconnect(&block); end",
"def establish_connections\n klass = Struct.new(:ip,:port)\n if t_servers = BackgrounDRb::BDRB_CONFIG[:client]\n connections = t_servers.split(',')\n connections.each do |conn_string|\n ip = conn_string.split(':')[0]\n port = conn_string.split(':')[1].to_i\n @bdrb_servers << klass.new(ip,port)\n end\n end\n @bdrb_servers << klass.new(BackgrounDRb::BDRB_CONFIG[:backgroundrb][:ip],BackgrounDRb::BDRB_CONFIG[:backgroundrb][:port].to_i)\n @bdrb_servers.each_with_index do |connection_info,index|\n next if @backend_connections.detect { |x| x.server_info == \"#{connection_info.ip}:#{connection_info.port}\" }\n @backend_connections << Connection.new(connection_info.ip,connection_info.port,self)\n end\n end",
"def reload_connections!\n hosts = sniffer.hosts\n __rebuild_connections :hosts => hosts, :options => options\n self\n rescue SnifferTimeoutError\n logger.error \"[SnifferTimeoutError] Timeout when reloading connections.\" if logger\n self\n end",
"def _maybe_reconnect()\r\n\t\tif @request_count >= @reconnect_interval\r\n\t\t\t$LOG.debug(\"Completed #{@request_count} requests using this connection, reconnecting...\")\r\n\t\t\t_close_socket(@connection)\r\n\t\t\t@node_id, @connection = _reconnect()\r\n end\r\n end",
"def reconnect\n close_connection\n with_retries do\n open_connection\n end\n end",
"def reconnect\n end",
"def reconnect\n end",
"def reconnect!\n end",
"def reconnect!\n @connection.reset_connection\n end",
"def attempt_reconnect\n #The reconnect method called below is provided by EventMachine\n reconnect HOST, PORT\n end",
"def connect_to_webserver(drb_uri, options, web_server_uri)\n try_counter=0; try_max= 30\n\n loop do\n begin\n puts \"#{Time.now} *** try connecting to : #{web_server_uri}\"\n sleep(5+rand*2)\n RestClient.post web_server_uri+'/connectors', {:connector => {:service => options[:service], :uri => drb_uri, :uid => options[:uid], :prio => options[:prio]}}, :content_type => :json, :accept => :json\n puts \"*** connection succesfully established\"\n $stdout.flush \n return true\n rescue => e\n try_counter=try_counter+1\n puts \"Failed with error:#{e.message} and try number:#{try_counter}\"\n\n if try_counter==try_max\n puts \"Disconnected from Service: #{web_server_uri}\"\n $stdout.flush \n return false\n end\n\n end\n end\nend",
"def reconnect\n # reuse existing connection driver\n # to prevent race condition between fibers\n conn = (self.conn||= @driver.new)\n conn.disconnect if connected?\n @pid = Process.pid\n puts \"connecting: #@host:#@port $$#@pid\" if @debug\n conn.connect(@host, @port, @timeout)\n self\n end",
"def reconnect!\n if active?\n disconnect\n end\n connect\n end",
"def reconnect!\n disconnect\n connect!\n end",
"def connect!\n i = 0\n DRb.start_service(URI, @@queue, verbose: true)\n rescue DRb::DRbConnError, Errno::EADDRINUSE\n sleep 0.1 and retry if (i += 1) < 5\n error 'Could not connect to DRb server.'\n end",
"def _reconn_prep()\n close_socket()\n if @parameters\n change_host()\n end\n @st.kill if @st # Kill ticker thread if any\n @rt.kill if @rt # Kill ticker thread if any\n @socket = nil\n end",
"def reconnect!\n disconnect!\n connect\n end",
"def reconnect!\n disconnect!\n connect\n end",
"def reconnect!\n @active = true\n end",
"def reconnect!\n disconnect!\n @connection = Fb::Database.connect(@config)\n end",
"def attempt_reconnect\n @disconnect_cb.call(@last_err) if @disconnect_cb\n\n # Clear sticky error\n @last_err = nil\n\n # Do reconnect\n srv = nil\n begin\n srv = select_next_server\n\n # Establish TCP connection with new server\n @io = create_socket\n @io.connect\n @stats[:reconnects] += 1\n\n # Set hostname to use for TLS hostname verification\n @hostname = srv[:hostname]\n\n # Established TCP connection successfully so can start connect\n process_connect_init\n\n # Reset reconnection attempts if connection is valid\n srv[:reconnect_attempts] = 0\n srv[:auth_required] ||= true if @server_info[:auth_required]\n\n # Add back to rotation since successfully connected\n server_pool << srv\n rescue NoServersError => e\n raise e\n rescue => e\n # In case there was an error from the server check\n # to see whether need to take it out from rotation\n srv[:auth_required] ||= true if @server_info[:auth_required]\n server_pool << srv if can_reuse_server?(srv)\n\n @last_err = e\n\n # Trigger async error handler\n @err_cb.call(e) if @err_cb\n\n # Continue retrying until there are no options left in the server pool\n retry\n end\n\n # Clear pending flush calls and reset state before restarting loops\n @flush_queue.clear\n @pings_outstanding = 0\n @pongs_received = 0\n\n # Replay all subscriptions\n @subs.each_pair do |sid, sub|\n @io.write(\"SUB #{sub.subject} #{sub.queue} #{sid}#{CR_LF}\")\n end\n\n # Flush anything which was left pending, in case of errors during flush\n # then we should raise error then retry the reconnect logic\n cmds = []\n cmds << @pending_queue.pop until @pending_queue.empty?\n @io.write(cmds.join) unless cmds.empty?\n @status = CONNECTED\n @pending_size = 0\n\n # Reset parser state here to avoid unknown protocol errors\n # on reconnect...\n @parser.reset!\n\n # Now connected to NATS, and we can restart parser loop, flusher\n # and ping interval\n start_threads!\n\n # Dispatch the reconnected callback while holding lock\n # which we should have already\n @reconnect_cb.call if @reconnect_cb\n end",
"def reconnect_if_needed\n reconnect if @concurrent_id != concurrent_id\n end",
"def reconnect\n disconnect\n connect\n end",
"def reconnect!(restore_transactions: false)\n retries_available = connection_retries\n deadline = retry_deadline && Process.clock_gettime(Process::CLOCK_MONOTONIC) + retry_deadline\n\n @lock.synchronize do\n reconnect\n\n enable_lazy_transactions!\n @raw_connection_dirty = false\n @verified = true\n\n reset_transaction(restore: restore_transactions) do\n clear_cache!(new_connection: true)\n configure_connection\n end\n rescue => original_exception\n translated_exception = translate_exception_class(original_exception, nil, nil)\n retry_deadline_exceeded = deadline && deadline < Process.clock_gettime(Process::CLOCK_MONOTONIC)\n\n if !retry_deadline_exceeded && retries_available > 0\n retries_available -= 1\n\n if retryable_connection_error?(translated_exception)\n backoff(connection_retries - retries_available)\n retry\n end\n end\n\n @verified = false\n\n raise translated_exception\n end\n end",
"def reap\n stale_connections = @connections.select do |conn|\n conn.in_use? && !conn.owner.alive?\n end\n\n stale_connections.each do |conn|\n if conn.active?\n conn.reset!\n checkin conn\n else\n remove conn\n end\n end\n end",
"def reap\n stale_connections = synchronize do\n @connections.select do |conn|\n conn.in_use? && !conn.owner.alive?\n end\n end\n\n stale_connections.each do |conn|\n synchronize do\n if conn.active?\n conn.reset!\n checkin conn\n else\n remove conn\n end\n end\n end\n end",
"def mysql_keepalive\n ping_mysql\n end",
"def mysql_keep_alive\n @connection.ping()\n rescue Mysql::Error => e\n @logger.info(\"MySQL connection lost: [#{e.errno}] #{e.error}\")\n @connection = mysql_connect\n end",
"def disconnect!\n @reserved_connections.each do |name,conn|\n checkin conn\n end\n @reserved_connections = {}\n @connections.each do |conn|\n conn.disconnect!\n end\n @connections = []\n end",
"def ensure_db_connection\n conn = ActiveRecord::Base.connection\n begin\n try ||= 3\n conn.reconnect!\n rescue\n try -= 1\n # There is a issue where connection closed unexpectedly, need retry\n retry if try > 0\n end\n end",
"def reconnect!\n close\n connect!\n @on_reconnect.call(self) if @on_reconnect.respond_to?(:call)\n end",
"def reconnect!\n @socket.close\n connect\n end",
"def reconnect\n disconnect rescue nil\n @connected = true\n end",
"def reexecute_connections?\n return true\n end",
"def reconnect\n @read_replica.reconnect\n @primary.reconnect\n end",
"def reconnect\n @subject.reconnect!\n logger.info \"Connection #{connection_uri} reconnected.\"\n end",
"def reconnect!\n clear_cache!\n reset_transaction\n end",
"def rescue_connection_failure(max_retries=30)\n retries = 0\n begin\n yield\n rescue Mongo::ConnectionFailure => ex\n #puts \"Rescue attempt #{retries}: from #{ex}\"\n retries += 1\n raise ex if retries > max_retries\n sleep(2)\n retry\n end\n end",
"def reconnect lost_connection = false\n unless lost_connection\n send_command 'QUIT', [], 'Reconnecting'\n else\n $log.warn(\"IRCConnection.reconnect #{@name}\") { \"Lost connection.\" }\n end\n\n @reconnecting = true\n Events.delete_for @channels\n Events.delete_for @users\n\n EM.add_timer(Bot::Conf[:core][:reconwait]) do\n $log.warn(\"IRCConnection.reconnect #{@name}\") { \"Attempting to reconnect.\" }\n\n @config = Bot::Conf[:servers][name]\n super @config[:address], @config[:port]\n end\n end",
"def _reconnect()\r\n num_nodes = @nodes.size\r\n attempts = 0\r\n new_node_id = @node_id\r\n while attempts < num_nodes\r\n new_node_id = (new_node_id + 1) % num_nodes\r\n new_node = @nodes[new_node_id]\r\n connection = nil\r\n begin\r\n connection = _make_connection(new_node.host, new_node.socket_port)\r\n @request_count = 0\r\n return new_node_id, connection\r\n rescue SocketError => message\r\n _close_socket(connection)\r\n connection.close\r\n $LOG.warn(\"Error connecting to node #{new_node_id}: #{message}\")\r\n attempts += 1\r\n end\r\n end\r\n\r\n # If we get here all nodes have failed us, explode\r\n raise VoldemortException.new('Connections to all nodes failed.')\r\n end",
"def rescue_connection_failure(max_retries=60)\n retries = 0\n begin\n yield\n rescue Mongo::ConnectionFailure => ex\n puts ex\n retries += 1\n raise ex if retries > max_retries\n sleep(0.5)\n retry\n end\nend",
"def reconnect(uri = nil)\n configure(uri) if uri\n @connection_manager.reconnect\n end",
"def wait_connection; end",
"def wait_connection; end",
"def server_connection_failed\n @server_side = nil\n if @connected\n LOGGER.error \"Connection with #{@remote.join(':')} was terminated prematurely.\"\n close_connection\n BeanstalkProxy.connect_error_callback.call(@remote.join(':'))\n elsif @tries < 10\n @tries += 1\n LOGGER.warn \"Retrying connection with #{@remote.join(':')} (##{@tries})\"\n EM.add_timer(0.1) { connect_to_server }\n else\n LOGGER.error \"Connect #{@remote.join(':')} failed after ten attempts.\"\n close_connection\n BeanstalkProxy.connect_error_callback.call(@remote.join(':'))\n end\n end",
"def find_next_except_these connections\n invalid_connections = @backend_connections.select { |x| connections.include?(x.server_info) }\n @backend_connections.delete_if { |x| connections.include?(x.server_info) }\n @round_robin = (0...@backend_connections.length).to_a\n invalid_connections.each do |x|\n @disconnected_connections[x.server_info] = x\n end\n chosen = @backend_connections.detect { |x| !(connections.include?(x.server_info)) }\n raise NoServerAvailable.new(\"No BackgrounDRb server is found running\") unless chosen\n chosen\n end",
"def disconnect!() @connections.each_value(&:disconnect) end",
"def reconnect_from(*exceptions)\n begin\n yield\n rescue *exceptions => ex\n if @reconnect\n logger.debug \"Connection failed: #{ex.message}\"\n EM::Synchrony.sleep(@reconnect_wait)\n logger.debug 'Attempting to reconnect'\n retry\n else\n raise\n end\n end\n end",
"def rescue_connection_failure(max_retries = 30)\n retries = 0\n begin\n yield\n rescue Mongo::ConnectionFailure => ex\n retries += 1\n raise ex if retries > max_retries\n sleep(0.5)\n retry\n end\n end",
"def connection_closed\n end",
"def connect_loop\n loop do\n @websocket.connect\n @websocket.thread.join\n break unless @should_reconnect.shift\n end\n end",
"def reconnect\n EM.stop\n\n connect\n end",
"def handle_tcp_failure(connection, settings)\n\n logger.info(\"Connection to AMQP lost. Finding new host..\")\n\n if @amqp_hosts.size == 1\n logger.info(\"Only a single host.. reconnecting\")\n connection.reconnect(false, 10)\n return\n end\n\n current_host = settings[:host]\n new_host = get_new_amqp_host(@amqp_hosts)\n\n while new_host == current_host\n new_host = get_new_amqp_host(@amqp_hosts)\n end\n\n settings[:host] = new_host\n\n logger.info (\"Reconnecting to AMPQ host: #{new_host}\")\n\n connection.reconnect_to(settings)\n end",
"def reconnect\n @sock.close rescue nil\n sleep 1\n @sock = TCPSocket.open(@server, @port)\n sleep 1\n end",
"def reconnect(options = {})\n use_initial_hosts = options.fetch(:use_initial_hosts, false)\n\n @hosts = @initial_hosts.dup if use_initial_hosts\n\n @mutex.synchronize do\n @pool.nodes.each{|node| node.connection.close}\n @pool.nodes.clear\n reload_pool_nodes_unsync\n end\n end",
"def clear_reloadable_connections!\n self.ensure_ready\n self.connection_pool_list.each(&:clear_reloadable_connections!)\n end",
"def reset_connection\n #close if \n @socket_server = nil\n connect\n end",
"def increase_reconnect_delay\n\n @reconnect_delay *= @parameters[:back_off_multiplier] if @parameters[:use_exponential_back_off]\n @reconnect_delay = @parameters[:max_reconnect_delay] if @reconnect_delay > @parameters[:max_reconnect_delay]\n\n @reconnect_delay\n end",
"def cleanup_connections\n @connections.keep_if do |thread, conns|\n thread.alive?\n end\n end",
"def on_reconnect(&callback)\n @reconnect_cb = callback\n end",
"def start\n connect\n @last_alive = Time.now\n @listener = Thread.new do\n while true\n begin\n @last_alive = Time.now if @hub.fetch_command\n\n if Time.now > @last_alive + @keepalive_timeout\n @logger.error \"connection lost\" if @logger\n @last_alive = Time.now\n reconnect\n end\n\n rescue Exception => e\n exit if e.class == Interrupt\n puts e.message\n puts e.backtrace.join(\"\\n\")\n break\n end\n end\n end\n end",
"def reconnect(options = {})\n use_initial_hosts = options.fetch(:use_initial_hosts, false)\n\n @hosts = @initial_hosts.dup if use_initial_hosts\n\n @mutex.synchronize do\n @pool.nodes.each{|node| node.connection.close}\n @pool.nodes.clear\n reload_pool_nodes_unsync(true)\n end\n end",
"def all_active_connections\n super\n end",
"def closeConnections()\n #N Without this, the connections won't be closed\n @sshAndScp.close()\n end",
"def new_connection\n Connection.new(Backburner.configuration.beanstalk_url) { |conn| Backburner::Hooks.invoke_hook_events(self, :on_reconnect, conn) }\n end",
"def on_scheduled_reconnect &block\n @reconnect_callback = block\n end",
"def connect_to_drb()\n @drb_mutex.synchronize do\n if !@have_retried_connection\n begin\n @have_retried_connection = true\n uri_location = \"http://revtr.cs.washington.edu/vps/failure_isolation/spoof_only_rtr_module.txt\"\n uri = Net::HTTP.get_response(URI.parse(uri_location)).body\n @rtrSvc = DRbObject.new nil, uri\n @rtrSvc.respond_to?(:anything?)\n rescue DRb::DRbConnError\n # Email only gets sent to Dave for now\n Emailer.isolation_warning(\"Revtr Service is down!\", \"choffnes@cs.washington.edu\").deliver\n end \n end\n end\n end",
"def resurrect_dead_connections!\n connections.dead.each { |c| c.resurrect! }\n end",
"def establish_connection\n @connecting_to_socket = true\n start_time = Time.now\n while(@timeout.nil? || Time.now - start_time < @timeout )\n begin\n b = self\n srv = EventMachine::connect_unix_domain(self.socket, EventMachine::Connection, true) do |c|\n logger.info(\"Connected to #{b.socket}\")\n end\n @connected_to_socket = true\n @connecting_to_socket = false\n return\n rescue RuntimeError => e\n @connecting_to_socket = false\n sleep 5\n end\n end\n logger.warn(\"Backend #{socket} did not spin up in the required #{@timeout} seconds.\")\n @dead = true\n end",
"def reconnect\n tries = 0\n begin\n backend.client.reconnect\n rescue Redis::BaseConnectionError\n tries += 1\n\n if tries == 3\n logger.info \"Error reconnecting to Redis; quitting\"\n raise ConnectionError\n end\n\n logger.info \"Error reconnecting to Redis; retrying\"\n sleep(tries)\n retry\n end\n end",
"def clear_reloadable_connections!\n @reserved_connections.each do |name, conn|\n checkin conn\n end\n @reserved_connections = {}\n @connections.each do |conn|\n conn.disconnect! if conn.requires_reloading?\n end\n @connections = []\n end",
"def postgres_keep_alive\n stat = @connection.status()\n rescue PGError => e\n @logger.info(\"Postgresql connection lost: #{e}\")\n @connection = postgres_connect\n if (stat = PGconn.CONNECTION_BAD) then\n @logger.info(\"Postgresql connection lost. Reconnect.\")\n @connection = postgres_connect\n end\n end",
"def with_connection_auto_retry\n with_connection do |connection|\n begin\n yield connection\n rescue Exception => e\n if e.kind_of?(Timeout::Error) || e.kind_of?(@timeout_class) || e.message =~ /expired/\n remove(connection)\n raise\n end\n connection = renew(connection)\n begin\n yield connection\n rescue Exception => e\n remove(connection)\n raise\n end\n end\n end\n end",
"def 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 set_speedy_connection_timeouts!\n allow_any_instance_of(Nsq::Connection).to receive(:snooze).and_return(nil)\n end",
"def post_init\n @healthcheck_poller = EventMachine.add_periodic_timer(CONNECTION_HEALTH_CHECK_INTERVAL) do\n if @intentionally_closed\n @healthcheck_poller.cancel\n elsif (@data_last_received_at) && ((Time.now - @data_last_received_at) >= NO_DATA_RECEIVED_TIMEOUT)\n no_data_received\n close_connection\n end\n end\n end",
"def reconnect\n\t\tif @connection != nil\n\t\t\tself.close\n\n\t\t\t@connection = MonetDBConnection.new(user = @username, passwd = @password, lang = @lang, host = @host, port = @port)\n\t\t\t@connection.connect(db_name = @db_name, auth_type = @auth_type)\n\t\tend\n\tend",
"def ignore_disconnect; end",
"def connection_stale!\n log(:debug, :socket, 'connection is stale.')\n close_connection\n end",
"def connect_timeout; end",
"def connect_timeout; end",
"def clear_active_connections!\n self.ensure_ready\n self.connection_pool_list.each(&:release_connection)\n end",
"def empty_connection_pools!; end",
"def __close_connections\n # to be implemented by specific transports\n end",
"def run_after_fork\n @app.restore_db_connections_after_fork\n end",
"def disconnect\n @conn.close\nend",
"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 simulate_reconnect_to_collector config\n NewRelic::Agent.instance.stubs(:connected?).returns(true)\n @response_handler.configure_agent config\n end",
"def remote_connections; end",
"def reconnect\n @mutex.synchronize do\n require \"mysql2\" unless ::Object.const_defined?(:Mysql2)\n\n args = {\n host: @db.opts[:host],\n username: @db.opts[:user],\n password: @db.opts[:pass],\n database: @db.opts[:db],\n port: @port,\n symbolize_keys: true,\n cache_rows: false,\n encoding: encoding\n }\n\n # Symbolize keys should also be given here, else table-data wont be symbolized for some reason - knj.\n @query_args = {symbolize_keys: true}\n @query_args[:cast] = false unless @db.opts[:type_translation]\n @query_args.merge!(@db.opts[:query_args]) if @db.opts[:query_args]\n\n pos_args = [:as, :async, :cast_booleans, :database_timezone, :application_timezone, :cache_rows, :connect_flags, :cast]\n pos_args.each do |key|\n args[key] = @db.opts[key] if @db.opts.key?(key)\n end\n\n args[:as] = :array\n\n if @db.opts[:conn]\n @conn = @db.opts[:conn]\n else\n @conn = ::Mysql2::Client.new(args)\n end\n\n query(\"SET NAMES '#{esc(encoding)}'\") if encoding\n end\n end",
"def cycle\n @initialized = true\n @socket = UDPSocket.new\n @socket.bind(@listen_address, @listen_port)\n \n initial_counters = {}\n \n if @counters_list_file && File.exist?(@counters_list_file)\n counter_keys = IO.read(@counters_list_file).split(\"\\n\")\n counter_keys.each do |key|\n initial_counters[key] = 0\n end\n end\n \n # block will be called when a request comes from the core\n # if exit is received the method will return\n network_loop(pipe, @socket, initial_counters) do |msg, counters, gauges|\n data = {}\n \n values = gauges\n \n counters.each do |k, v|\n values[k] = v / interval_in_seconds()\n end\n \n unless values.empty?\n if @host\n data['host'] = @host\n end\n \n data[@app] = {}\n data[@app][@res] = values\n end\n \n send_metrics(data)\n end\n \n end",
"def verify_active_connections! #:nodoc:\n clear_stale_cached_connections!\n @connections.each do |connection|\n connection.verify!\n end\n end",
"def pending_connections\n\t\tredirect_to '/my_connections'\n\tend",
"def reconnect\n if @connection != nil\n self.close\n \n @connection = MonetDBConnection.new(user = @username, passwd = @password, lang = @lang, host = @host, port = @port)\n @connection.connect(db_name = @db_name, auth_type = @auth_type)\n end\n end",
"def post_init\n self.pending_connect_timeout = @telnet_options[:connect_timeout]\n self.comm_inactivity_timeout = @telnet_options[:timeout]\n @@_telnet_connection_count += 1\n end",
"def close_connection; end",
"def fetch_connection( start=0 , count=500 , tries = 0 )\n request = EventMachine::HttpRequest.new(@linkedin_url + \"/v1/people/~/connections?format=json&count=#{count}&start=#{start}\")\n request.use EventMachine::Middleware::OAuth, @oauth_config\n http = request.get \n \n http.callback do\n if http.response_header.status != 200\n Rails.logger.fatal \"Linkedin Connection Request Failed with Error Code #{http.response_header.status}\"\n Rails.logger.ap http\n raise \"Unexpect response status #{http}\" unless http.response_header.status == 200\n end\n \n begin\n data = MultiJson.decode(http.response)['values']\n connection_info = data.map{|data| data.deep_symbolize_keys }.keep_if{ |connection| connection.has_key?(:pictureUrl) }.map{ |connection| \n {\n :identity => {\n :uid => connection[:id],\n :context_name => :linkedin,\n :credentials => {},\n :name => connection[:firstName] + ' '+ connection[:lastName],\n :image => self.class.process_image(connection[:pictureUrl]),\n :url => connection[:siteStandardProfileRequest][:url],\n :properties => {\n 'Headline' => connection[:headline]\n }\n },\n :email => nil,\n :connection => {\n :from => 'me',\n :to => 'you',\n :properties => {}\n }\n }\n }\n @connections_buffer.concat( connection_info)\n Rails.logger.info \"Linkedin Connections Dispath Successful Countdown: #{@countdown.count}\"\n rescue Exception => ex\n Rails.logger.fatal \"FATAL : Linekdin Parse Error #{ex.message}\"\n Rails.logger.fatal \"FATAL : Linkedin Parse Error Backtrace ... \"\n ex.backtrace[0..10].each{ |trace| Rails.logger.fatal trace} \n Rails.logger.fatal \"Linkedin Connection Dispatch Bad Response #{@countdown.count}\"\n Rails.logger.ap http.response\n ensure\n stop_if_finished\n end\n end\n\n http.errback do\n if tries <= 3\n Rails.logger.warn \"Linkedin Connection Request #{ @countdown.count}, Trying again\"\n fetch_connection( start , count , tries + 1 )\n else\n Rails.logger.fatal \"Linkedin Connection Request #{ @countdown.count}, Giving Up\"\n stop_if_finished\n end\n end\n end",
"def retry_request(http, *args)\n 5.times do\n begin\n return http.send(:send_request, *args)\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n Chef::Log.debug('couchdb connection failed')\n end\n sleep 1\n end\n Chef::Log.debug('failed to connect to couchdb after 5 tries ... failing chef run')\n fail 'unable to connect to couchdb'\n end"
] |
[
"0.71812356",
"0.6946376",
"0.6926862",
"0.69143933",
"0.6826594",
"0.6811169",
"0.6744435",
"0.67179465",
"0.67179465",
"0.67016524",
"0.6675778",
"0.665093",
"0.6578835",
"0.6561285",
"0.6492736",
"0.6489264",
"0.6468228",
"0.6412572",
"0.6411905",
"0.6411905",
"0.6352755",
"0.63525474",
"0.63474226",
"0.63314337",
"0.6313754",
"0.62836087",
"0.62504596",
"0.62454313",
"0.6228796",
"0.62179977",
"0.6199208",
"0.6181864",
"0.6180721",
"0.61767",
"0.61727697",
"0.61657614",
"0.6160655",
"0.61016476",
"0.6097265",
"0.6095942",
"0.60914326",
"0.6087095",
"0.607581",
"0.60754675",
"0.6073729",
"0.6073729",
"0.60692",
"0.605343",
"0.6041911",
"0.6017012",
"0.6015459",
"0.6012452",
"0.6007734",
"0.5989459",
"0.5986508",
"0.5977991",
"0.5977517",
"0.59761065",
"0.5971988",
"0.5969812",
"0.5967677",
"0.59608406",
"0.59581107",
"0.5954874",
"0.5942588",
"0.5941733",
"0.5938176",
"0.5920941",
"0.5918619",
"0.5915894",
"0.5914494",
"0.5911958",
"0.59058785",
"0.59048355",
"0.59035915",
"0.58996314",
"0.5895102",
"0.5888756",
"0.5886725",
"0.5882182",
"0.58726096",
"0.58559644",
"0.58559644",
"0.5854666",
"0.58516216",
"0.5839833",
"0.58361256",
"0.5829752",
"0.5826217",
"0.5824751",
"0.5824645",
"0.5824305",
"0.58126926",
"0.58098155",
"0.5805609",
"0.5804444",
"0.5803563",
"0.5802631",
"0.5800665",
"0.57996273"
] |
0.7099165
|
1
|
Find live connections except those mentioned in array, because they are already dead.
|
def find_next_except_these connections
invalid_connections = @backend_connections.select { |x| connections.include?(x.server_info) }
@backend_connections.delete_if { |x| connections.include?(x.server_info) }
@round_robin = (0...@backend_connections.length).to_a
invalid_connections.each do |x|
@disconnected_connections[x.server_info] = x
end
chosen = @backend_connections.detect { |x| !(connections.include?(x.server_info)) }
raise NoServerAvailable.new("No BackgrounDRb server is found running") unless chosen
chosen
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def live_neighbours\n self.neighbours.select do |n|\n n && n.is_alive?\n end\n end",
"def resurrect_dead_connections!\n connections.dead.each { |c| c.resurrect! }\n end",
"def unconnected_probes\n observed_connections = Set.new\n connections.each do |conn|\n observed_connections << conn.probe1.to_settable\n observed_connections << conn.probe2.to_settable\n end\n to_return = []\n @sequence_ids.each do |index|\n [:start, :end].each do |side|\n probe = Probe.new\n probe.sequence_index = index\n probe.side = side\n unless observed_connections.include?(probe.to_settable)\n to_return.push probe\n end\n end\n end\n return to_return\n end",
"def live_on(live_cells)\n Set.new(live_cells.select { |p| \n stay_alive?(live_neighbor_count(p, live_cells)) })\nend",
"def connections_stub(array)\n @cleaners = ArrayHelper.zipmap((1..array.size).to_a, array)\n @connections = array\n end",
"def get_disconnected_peers\n filter_by_state = { :state => 1 }\n disconnected = self.peers filter_by_state\n end",
"def unconnected_venues\n unconnected = []\n Venue.all.each do |venue|\n unconnected << venue if venues.exclude? venue\n end\n return unconnected\n end",
"def find_reachable_adjacents\n\t\tfind_all_adjacents.select { |p| (is_free?(p) && !@closed.include?(p)) }\n\tend",
"def extract_connections!\n # Get the connections.\n cnxs = self.each_connection.to_a\n # Remove them from the scope.\n # cnxs.each { |cnx| self.delete_connection!(cnx) }\n # cnxs.delete_all_connections!\n self.delete_all_connections!\n # Return the connections.\n return cnxs\n end",
"def pinger\n binding.pry\n @livehosts = []\n @ips_to_check.each do |ip|\n if(ip.split(\".\").last != \"0\" || ip.split(\".\").last != \"255\")\n if alive?(ip)\n @livehosts << ip\n end\n end\n end\n puts @livehosts\n end",
"def connections\n @mutex.synchronize do\n @connections.values.inject(0, &:+)\n end\n end",
"def each_with_inactive\n @uuids.each do |uuid|\n yield @connections[uuid]\n end\n end",
"def trim_unreachable!\n to_keep = reachable_nodes\n select! { |n| to_keep.include? n }\n end",
"def get_connections\n @connected_to.keys\n end",
"def verify_active_connections! #:nodoc:\n clear_stale_cached_connections!\n @connections.each do |connection|\n connection.verify!\n end\n end",
"def connections\n @connections ||= []\n end",
"def infinite_loops\n reachable_sets = @nodes.group_by(&:forward)\n reachable_sets.each do |reachable,nodes|\n yield reachable if reachable == nodes.to_set\n end\n end",
"def all_connections\n hold do |conn|\n yield conn\n\n # Use a hash to record all connections already seen. As soon as we\n # come across a connection we've already seen, we stop the loop.\n conns = {}\n conns.compare_by_identity\n while true\n conn = nil\n begin\n break unless (conn = @queue.pop(timeout: 0)) && !conns[conn]\n conns[conn] = true\n yield conn\n ensure\n @queue.push(conn) if conn\n end\n end\n end\n end",
"def alive_players\n @players.reject{|p| p.dead? }\n end",
"def new_life(live_cells)\n Set.new(nearby_dead_cells(live_cells).select { |p| \n come_alive?(live_neighbor_count(p, live_cells)) })\nend",
"def get_banned_peers\n filter_by_state = { :state => 0 }\n banned = self.peers filter_by_state\n end",
"def alive_robots\n @robots.select {|r| not r.dead? }\n end",
"def coloring(connections)\n @n = connections.length\n\n for i in 0..@n-1 do\n for j in 0..@n-1 do\n if i != j and connections[i][j] > 0 then\n self[i].must_not == self[j]\n end\n end\n end\n \n end",
"def find_all_non_visited_cities\n all_cities = cities()\n non_visited = []\n for city in all_cities\n if city.visited == 0\n non_visited.push(city)\n end\n end\n return non_visited\n end",
"def connections_here(whom = nil)\n list = []\n if whom\n whom = whom.map(&:downcase)\n end\n @connection.server.connections.each { |key, connection|\n if whom\n if whom.include?(connection.agent.name.downcase) and connection.agent.item == item\n list.push(connection)\n end\n else\n if connection.agent.item == item\n list.push(connection)\n end\n end\n }\n return list\n end",
"def get_connected_peers\n filter_by_state = { :state => 2 }\n connected = self.peers filter_by_state\n end",
"def connected_servers\n related_servers.reject(&:missing_network_topology?)\n end",
"def nicks_connected_with\n @connection_cache.keys\n end",
"def disconnect!() @connections.each_value(&:disconnect) end",
"def reap\n stale_connections = @connections.select do |conn|\n conn.in_use? && !conn.owner.alive?\n end\n\n stale_connections.each do |conn|\n if conn.active?\n conn.reset!\n checkin conn\n else\n remove conn\n end\n end\n end",
"def reap\n stale_connections = synchronize do\n @connections.select do |conn|\n conn.in_use? && !conn.owner.alive?\n end\n end\n\n stale_connections.each do |conn|\n synchronize do\n if conn.active?\n conn.reset!\n checkin conn\n else\n remove conn\n end\n end\n end\n end",
"def incoming\n @incoming ||= [nil] * neighbors.size\n end",
"def manageConnections(classifiedPeers)\n\n n = classifiedPeers.handshakingPeers.size + classifiedPeers.establishedPeers.size\n if n < @targetActivePeerCount\n result = classifiedPeers.disconnectedPeers.shuffle.first(@targetActivePeerCount - n)\n @logger.debug \"There are #{n} peers connected or in handshaking. Will establish #{result.size} more connections to peers.\"\n result\n else\n []\n end\n end",
"def unconnected_sequences\n observed_sequences = Set.new\n connections.each do |conn|\n observed_sequences << conn.probe1.sequence_index\n observed_sequences << conn.probe2.sequence_index\n end\n return @sequence_ids.to_a - observed_sequences.to_a\n end",
"def discover_server_periodically\n @disconnected_connections.each do |key,connection|\n connection.establish_connection\n if connection.connection_status\n @backend_connections << connection\n connection.close_connection\n @disconnected_connections[key] = nil\n end\n end\n @disconnected_connections.delete_if { |key,value| value.nil? }\n @round_robin = (0...@backend_connections.length).to_a\n end",
"def active_local_sockets\n @local_forwarded_sockets.keys\n end",
"def active_remotes\n @remote_forwarded_ports.keys\n end",
"def connections\n connections = @mutex.synchronize { connections = @connections.dup }\n connections.delete_if { |c| c.kind_of?(Thread) }\n connections.freeze\n connections\n end",
"def disconnect_all\n @cache.values.map(&:clear_all_connections!)\n end",
"def find_connected_peer_terminations\r\n if self.in_connection? \r\n self.aln_connection.aln_terminations.to_ary.delete(self)\r\n self.aln_connection.aln_terminations\r\n else \r\n []\r\n end \r\n end",
"def unconnected\n\t\tu = @people.select do | key, person |\n\t\t\tperson.father_id == nil and person.mother_id == nil and\n\t\t\tperson.children_ids == []\n\t\tend \n\t\tu.map { | key, person | person }\t\t\n\tend",
"def discovered_servers\n server_pool.select {|s| s[:discovered] }\n end",
"def unused_ports\n ports = Array.new\n @ports.each_value do |port|\n ports << port if !port.used?\n end\n return ports\n end",
"def unconnected_links\n\t\tLink.available.select { |l| links.find_by(provider: l[:link_name] || l[:name].downcase) == nil }\n\tend",
"def disconnect!\n @reserved_connections.each do |name,conn|\n checkin conn\n end\n @reserved_connections = {}\n @connections.each do |conn|\n conn.disconnect!\n end\n @connections = []\n end",
"def matches\n connectees.select do |element|\n Connection.match?(self,element)\n end\n end",
"def client_connections(client, router=nil)\n cs = @cons.select{|c| c[:client]==client}.sort_by{|c| c[:time]}\n cons = []\n return cs if cs==[]\n\n c = cs.shift\n curr = {client: client, router: try_resolve(c[:router]), start: c[:time], end: c[:time]}\n cs.each do |c|\n #same router as last check and no gap of more than 20 minutes\n if try_resolve(c[:router]) == curr[:router] && c[:time]-curr[:end]<1200\n curr[:end] = c[:time] #still connected -> change end-time\n else #changed routers or offline -> new connection entry\n cons << curr\n curr = {client: client, router: try_resolve(c[:router]), start: c[:time], end: c[:time]}\n end\n end\n cons << curr #put last one in\n\n cons.select!{|c| c[:router] == try_resolve(router)} if !router.nil?\n cons\n end",
"def grab_connections\n connections = []\n connections << @host\n end",
"def m\n @missed_connections = MissedConnection.where(:preference => ['m4m', 'm4t', 'm4w'])\n end",
"def doubly_single_contig_connections\n likelies = []\n\n already_seen_connections = Set.new\n\n @graph.vertices.each do |v|\n # If there is only 1 connection on both sides, then go with that\n neighbours = @graph.neighbours(v)\n log.debug \"Testing connection between #{v} and #{neighbours}\"\n if neighbours.length == 1 and @graph.neighbours(neighbours[0]).length == 1\n log.debug \"Connection passed the doubly-test\" if log.debug?\n neighbour = neighbours[0]\n\n conn = Connection.new\n conn.probe1 = Probe.new(v)\n conn.probe2 = Probe.new(neighbour)\n settable = conn.to_settable\n # Record the connection unless it is duplicate\n unless already_seen_connections.include?(settable)\n likelies.push @connection_hash[settable]\n already_seen_connections << settable\n end\n end\n end\n\n return likelies\n end",
"def without_zeros()\n @hops.find_all { |hop| hop.ip != \"0.0.0.0\" }\n end",
"def friends\n @friends ||= neighbours.count{|sq| sq.alive?}\n end",
"def pool \n @pool.select(&:alive?).size\n end",
"def excluded_hosts\n res = []\n self.excluded_host_ids.each do |h_id|\n res << (Host.find(h_id) rescue nil)\n end\n res.compact\n end",
"def excluded_hosts\n res = []\n self.excluded_host_ids.each do |h_id|\n res << (Host.find(h_id) rescue nil)\n end\n res.compact\n end",
"def excluded_hosts\n res = []\n self.excluded_host_ids.each do |h_id|\n res << (Host.find(h_id) rescue nil)\n end\n res.compact\n end",
"def excluded_hosts\n res = []\n self.excluded_host_ids.each do |h_id|\n res << (Host.find(h_id) rescue nil)\n end\n res.compact\n end",
"def pruned_clients\n now = Time.current.to_i\n\n out = []\n RedisInstance.hgetall(STATE_KEY).each do |uuid, raw|\n data = JSON.parse(raw)\n if stale?(data['last'])\n RedisInstance.hdel(STATE_KEY, uuid)\n else\n out << {\n uuid: sanitize(uuid),\n name: sanitize(data['name']),\n value: data['value'].to_f\n }\n end\n end\n out\n end",
"def index\n @missed_connections = MissedConnection.all\n end",
"def missing_list\n list = []\n active_workers.each do |w|\n if w.sum_time_in_seconds(DateTime.now - 14.days, DateTime.now) == 0\n list << w\n end\n end\n return list\n end",
"def live_bets\n self.bets.select {|bet| bet.status == \"Pending\"}\n end",
"def cull_idle_sockets\n\t\tself.log.debug \"Culling idle sockets.\"\n\n\t\tearliest = Time.now - self.class.idle_timeout\n\n\t\tself.connection_times.each do |sender_id, times|\n\t\t\ttimes.each do |conn_id, lastframe|\n\t\t\t\tnext unless earliest > lastframe\n\n\t\t\t\tself.log.warn \"Timing out connection %s:%d: last seen %0.3fs ago.\" %\n\t\t\t\t\t[ sender_id, conn_id, Time.now - lastframe ]\n\n\t\t\t\t# Make a CLOSE frame\n\t\t\t\tframe = Mongrel2::WebSocket::Frame.close\n\t\t\t\tframe.set_status( CLOSE_EXCEPTION )\n\n\t\t\t\t# Use the connection directly so we can send a frame and close the\n\t\t\t\t# connection\n\t\t\t\tself.conn.send( sender_id, conn_id, frame.to_s )\n\t\t\t\tself.conn.send_close( sender_id, conn_id )\n\t\t\tend\n\t\tend\n\tend",
"def reachable(c)\n\t\t@reachable[c] ||= DIRECTIONS.inject([]) { |r, d|\n\t\t\tnext(r) if self[p = c + d] == :wall\n\t\t\tr << p\n\t\t}.freeze\n\tend",
"def busy_go_cabs\n arr = []\n @go_cabs.select { |cab| arr << cab if (cab.available == false) }\n return arr\n end",
"def dead_opponents(battler = $game_player)\n opponents = []\n @action_battlers.each do |key, members|\n next if key == battler.team_id\n members.compact.each do |member|\n next unless member.dead?\n opponents.push(member)\n end\n end\n return opponents\n end",
"def ignore_hosts\n @host_rules.reject\n end",
"def bad_hosts\n bad_hosts.collect {|r| r.host }\n end",
"def direct_neighbors\n VirtualMachine.where(host: host).select do |vm|\n vm.account == account && vm.id != id\n end\n end",
"def garbage_collect\n $redis.keys(\"#{remote_ip}.*\").each do |key|\n $redis.del(key) unless key =~ /#{session}/ || key =~ /hidden/\n end\n end",
"def process_dead_neighbors\n\n @dead_neighbors.each do |dn|\n row, col = dn.split('_') \n dead_cell = Cell.new(row.to_i, col.to_i, false)\n\n dead_cell.neighbors.each do |n_cell|\n if @current_state.include?(n_cell)\n dead_cell.inc_alive_neighbors\n end\n end\n\n if reproduces?(dead_cell)\n dead_cell.alive = true\n future_state[dn] = dead_cell \n end\n end\n end",
"def nearby_dead_cells(live_cells)\n live_cells.map { |p| neighborhood(p) }.reduce(:|) - live_cells\nend",
"def missed_deadlines(current_time)\n result = []\n while !deadlines.empty? && deadlines.first[0] < current_time\n result << deadlines.shift\n end\n result\n end",
"def known_ip_count\n @mutex.synchronize do\n @connections.size\n end\n end",
"def circular_sequences\n to_return = []\n connections.each do |conn|\n if conn.probe1.sequence_index == conn.probe2.sequence_index and\n conn.probe1.side != conn.probe2.side and\n @graph.edges[conn.probe1.to_settable].length == 1 and\n @graph.edges[conn.probe2.to_settable].length == 1\n\n to_return.push conn.probe1.sequence_index\n end\n end\n return to_return\n end",
"def turn_on\n connections.each(&:disconnect)\n @connections = []\n end",
"def connections\n super.includes(:partners)\n .where(partners: { status: :approved })\n .where.not(partners: { id: id })\n .group(\"connections.id, partners.id\")\n end",
"def bind_connections_as_friend\n connections.where(friend_id: nil).find_each { |fshp| bind_connection(fshp) }\n end",
"def check_all(channels)\n channels.select { |channel| online?(channel) }\n end",
"def remove_redundant_dsts()\n while @hops.size > 1 and @hops[-1].ip == @dst and @hops[-2].ip == @dst\n @hops = @hops[0..-2]\n end\n end",
"def connections\n @connections ||= {}\n end",
"def delete_unused_host_only_networks\n end",
"def all_active_connections\n super\n end",
"def create_suggestions\n array = []\n self.invited_connections.each do |x|\n if x.status == \"connected\"\n x.host.invited_connections.each { |y| array << y.host if y.status == \"connected\" }\n x.host.hosted_connections.each { |y| array << y.guest if y.guest != self && y.status == \"connected\" }\n end\n end\n self.hosted_connections.each do |x|\n if x.status == \"connected\"\n x.guest.invited_connections.each { |y| array << y.host if y.host != self && y.status == \"connected\" && array.include?(y.host) == false }\n x.guest.hosted_connections.each { |y| array << y.guest if y.status == \"connected\" && array.include?(y.guest) == false }\n end\n end\n contacts = select_connections(array)\n contacts.each do |contact|\n invers_connection = Connection.where(guest: contact, host: self).first\n Connection.create(status: \"suggested\", guest: self, host: contact) if invers_connection == nil || invers_connection.status != \"valid\"\n end\n end",
"def bind_connections_as_friend\n connections.where(friend_id: nil).each {|fshp| bind_connection(fshp)}\n end",
"def clear_reloadable_connections!\n synchronize do\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n end\n\n @connections.delete_if(&:finished?)\n\n @available.clear\n @connections.each do |conn|\n @available.add conn\n end\n end\n end",
"def connections\n @connections ||= {}\n end",
"def create_unvisited_set\n @unvisited_set = @nodes.map { |r| r if @table_merged[r] != \"X\" }\n @unvisited_set.delete(nil)\n @unvisited_set\n end",
"def clear_reloadable_connections!\n @reserved_connections.each do |name, conn|\n checkin conn\n end\n @reserved_connections = {}\n @connections.each do |conn|\n conn.disconnect! if conn.requires_reloading?\n end\n @connections = []\n end",
"def connected_rooms\n return (self.exits.map(&:destination) + @entrances.to_a).reject{ |room| room == self }\n end",
"def reachable_nodes\n recursive_set(@start) { |n| n.out }\n end",
"def find_dead_tracks playlist\n playlist.fileTracks.each do |track|\n next unless track.location == nil\n puts \"Dead track: #{track.databaseID}: #{track.artist}/#{track.album}/#{track.name}\"\n @logger.info \"Dead track: #{track.databaseID}: #{track.artist}/#{track.album}/#{track.name}\"\n #@dead_track_list << track\n end\n \n #return @dead_track_list\n end",
"def list_of_inactive_services\n\t services = JSON.parse(RestClient.get(settings.manager + '/configs/services').body)\n\t elements = []\n\t services.each do |service|\n\t\tstat = is_port_open?(service['host'], service['port'])\n\t\tif stat == false\n\t\t elements.push(service)\n\t\tend\n\t end\n\t return elements\n\tend",
"def tick!\n to_die = []\n to_live = []\n\n @cells.each do |row|\n row.each do |cell|\n\n # Add up the number of 'alive' neighbouring cells\n live_neighbour_count = neighbours(cell.x, cell.y).select { |n| n.alive? }.count\n\n if cell.alive? and (live_neighbour_count < 2 || live_neighbour_count > 3)\n to_die << cell\n elsif cell.dead? and live_neighbour_count == 3\n to_live << cell\n end\n end\n end\n\n to_die.each { |cell| cell.die! }\n to_live.each { |cell| cell.live! }\n end",
"def connections?\n @connections.any?\n end",
"def reachable_states\n visited_states = Set.new()\n unvisited_states = Set[@start_state]\n begin\n outbound_transitions = @transitions.select { |t| unvisited_states.include?(t.from) }\n destination_states = outbound_transitions.map(&:to).to_set\n visited_states.merge(unvisited_states) # add the unvisited states to the visited_states\n unvisited_states = destination_states - visited_states\n end until unvisited_states.empty?\n visited_states\n end",
"def connections_for(socket)\n @mutex.synchronize do\n ip = peer_ip(socket)\n @connections[ip] || 0\n end\n end",
"def list_deadservers\n @admin.listDeadServers.to_a\n end",
"def overlay\n connections.map.with_index do |cn, i|\n next if i.zero?\n [cn.departure_in_utc, connections[i - 1].arrival_in_utc].inject(:-)\n end.compact\n end",
"def connected_clients\n @client_mutex.synchronize do\n @clients.values.dup\n end\n end",
"def get_connections(queue)\n @connections.select { |con| con.src.label == queue.label }\n end"
] |
[
"0.67868173",
"0.6353748",
"0.6309217",
"0.62521917",
"0.6147314",
"0.60850143",
"0.6004528",
"0.5976544",
"0.5964049",
"0.5702709",
"0.5679856",
"0.56768495",
"0.56207675",
"0.5598569",
"0.5592869",
"0.54755175",
"0.5466129",
"0.54577994",
"0.5457599",
"0.5452483",
"0.5433949",
"0.54337543",
"0.5417567",
"0.54092085",
"0.5407632",
"0.53993803",
"0.53855735",
"0.5374895",
"0.53664833",
"0.5366228",
"0.5355766",
"0.5353746",
"0.5350008",
"0.5347272",
"0.5336788",
"0.5320832",
"0.5309629",
"0.5304668",
"0.5298077",
"0.5286434",
"0.5280477",
"0.52745134",
"0.5262493",
"0.52507824",
"0.5217241",
"0.52062184",
"0.5196525",
"0.51898175",
"0.5170458",
"0.5163512",
"0.5149804",
"0.5135198",
"0.5132905",
"0.51290166",
"0.51290166",
"0.51290166",
"0.51290166",
"0.5124489",
"0.5110618",
"0.51030123",
"0.5072867",
"0.5059496",
"0.50511765",
"0.5047017",
"0.5044502",
"0.5042356",
"0.50395656",
"0.5036351",
"0.5030207",
"0.50299484",
"0.5027869",
"0.502043",
"0.5011983",
"0.5009295",
"0.5006974",
"0.50067306",
"0.50017405",
"0.4999149",
"0.49972755",
"0.4995834",
"0.49944612",
"0.49893752",
"0.49868342",
"0.49818158",
"0.49781695",
"0.49590236",
"0.49547306",
"0.49522328",
"0.49436167",
"0.49316737",
"0.49285826",
"0.49262452",
"0.49221507",
"0.49146068",
"0.49127036",
"0.49121395",
"0.491186",
"0.49022081",
"0.48914117",
"0.48746738"
] |
0.6228788
|
4
|
Fina a connection by host name and port
|
def find_connection host_info
conn = @backend_connections.detect { |x| x.server_info == host_info }
raise NoServerAvailable.new("BackgrounDRb server is not found running on #{host_info}") unless conn
return conn
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def local_connect(body)\n host = _pop_token(body)\n port = _pop_token(body).to_i\n if host.length < 1\n begin\n host, port = @var[:last_connection]\n rescue\n raise \"usage: /connect <hostname> [port]\"\n end\n end\n port = 9000 if port == 0\n begin\n connect(host, port)\n @var[:last_connection] = [ host, port ]\n _save_env\n rescue\n _notice \"Could not connect to #{host}:#{port} - #{$!}\", :error\n end\nend",
"def host_with_port; end",
"def start(host, port); end",
"def connect_port(port)\n connect_host_port(\"localhost\", port)\n end",
"def connection(host, port)\n\tbegin\n\t @connection = Net::Telnet::new(\n \"Host\" => \"#{host}\",\n \"Port\" => \"#{port}\",\n \"Prompt\" => /[$%#>] \\z/n,\n \"Telnetmode\" => true,\n \"Timeout\" => 10\n )\n\trescue\n\t puts \"Error with the server, try again\"\n\t exit\n\tend\nend",
"def connect(host, port)\n @host = host\n @port = port\n\n @socket = TCPSocket.new(@host, @port)\n start(@socket)\n end",
"def connect()\n @s = @s || TCPsocket.open(@host, @port)\n end",
"def initialize(host_name = 'localhost', port = 20000)\n @host_name = host_name\n @port = port\n end",
"def connect\n TCPSocket.open(@host, @port)\n end",
"def connect (host, port)\n\t\tclose\n\n\t\tbegin\n\t\t\t@socket = TCPSocket.new host, port\n\t\trescue Exception => e\n\t\t\temit :error, e\n\t\tend\n\n\t\tthreads\n\tend",
"def initialize(host, port)\n @host, @port = host, port\n end",
"def initialize(host, port=69)\n self.host = IPSocket.getaddress(host)\n self.port = port\n end",
"def initiate_connection\n Retriable.retriable on: [Errno::ECONNREFUSED, Errno::EHOSTUNREACH] do\n TCPSocket.new(ip, port).close\n end\n end",
"def initialize(host, port)\r\n super(AF_INET, SOCK_STREAM, IPPROTO_TCP)\r\n connect(Socket.sockaddr_in(port, host))\r\n end",
"def raw_host_with_port; end",
"def start(host = T.unsafe(nil), port = T.unsafe(nil)); end",
"def open_port(host, port, tab_port)\n sock = Socket.new(:INET, :STREAM)\n raw = Socket.sockaddr_in(port, host)\n # puts \"#{port} open.\" if sock.connect(raw)\n if sock.connect(raw)\n # Check if port is known in the hash\n if H_ports.any? {|h| h[\"port\"] == port.to_s}\n tab_port.push(H_ports.select{|port_number, service| port_number[\"port\"] == port.to_s })\n else\n tab_port.push([{\"port\" => port.to_s, \"service\" => \"random service\"}])\n end\n end\n\nrescue (Errno::ECONNREFUSED)\n rescue(Errno::ETIMEDOUT)\nend",
"def initialize(host = 'localhost', port = 4444, options = {})\n @host, @port, @async = host, port, options[:async]\n connect\n end",
"def connect(host, port, use_ssl = false)\n @socket = TCPSocket.new(host, port.to_i)\n if use_ssl\n @socket = OpenSSL::SSL::SSLSocket.new(@socket)\n @socket.sync_close\n @socket.connect\n end\n read_greeting\n end",
"def open_port(host, port, tab_port)\n sock = Socket.new(:INET, :STREAM)\n raw = Socket.sockaddr_in(port, host)\n # puts \"#{port} open.\" if sock.connect(raw)\n if sock.connect(raw)\n # Check if port is known in the hash\n if H_ports.any? {|h| h[\"port\"] == port.to_s}\n tab_port.push(H_ports.select{|port_number, service| port_number[\"port\"] == port.to_s })\n else\n tab_port.push([{\"port\" => port.to_s, \"service\" => \"random service\"}])\n end\n end\n\n rescue (Errno::ECONNREFUSED)\n rescue(Errno::ETIMEDOUT)\n end",
"def open(host, port, options = {})\n @host, @port = host, port\n self\n end",
"def slaveof(host, port); end",
"def connect()\n @sock = TCPSocket.open(@server, @port)\n end",
"def initialize(host, port = PORT)\n @host = host\n @port = port\n end",
"def initialize host, port\n @host = host\n @port = port\n @socket = nil\n @buffer = +''\n @connected = false\n end",
"def connect(port: nil)\n return if @tcp_socket\n unless port\n @tcp_socket = TCPSocket.new(@host, ENDPOINT_MAPPER_PORT)\n bind(endpoint: Epm)\n begin\n host_port = get_host_port_from_ept_mapper(\n uuid: @endpoint::UUID,\n maj_ver: @endpoint::VER_MAJOR,\n min_ver: @endpoint::VER_MINOR\n )\n rescue RubySMB::Dcerpc::Error::DcerpcError => e\n e.message.prepend(\n \"Cannot resolve the remote port number for endpoint #{@endpoint::UUID}. \"\\\n \"Set @tcp_socket parameter to specify the service port number and bypass \"\\\n \"EPM port resolution. Error: \"\n )\n raise e\n end\n port = host_port[:port]\n @tcp_socket.close\n @tcp_socket = nil\n end\n @tcp_socket = TCPSocket.new(@host, port)\n end",
"def connect(host, port = FTP_PORT)\n if @debug_mode\n\t print \"connect: \", host, \", \", port, \"\\n\"\n end\n synchronize do\n\t @sock = open_socket(host, port)\n\t voidresp\n end\n end",
"def connect_to(host, port)\n if @http_proxy\n\tproxy_uri = URI.parse(@http_proxy)\n\tNet::HTTP::Proxy(proxy_uri.host, proxy_uri.port).new(host, port)\n else\n\tNet::HTTP.new(host, port)\n end\n end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def test_connection(ip,port)\n\t\tbegin\n\t\t\tsock = Rex::Socket::Tcp.create(\n\t\t\t\t'PeerHost' => ip,\n\t\t\t\t'PeerPort' => port,\n\t\t\t\t'Timeout' => 1\n\t\t\t\t)\n\t\trescue Rex::ConnectionError\n\t\t\treturn :down\n\t\tend\n\t\tsock.close\n\t\treturn :up\n\tend",
"def connect\n @socket = TCPSocket.open @host, @port\n @connected = !@socket.closed?\n end",
"def initialize(host: 'localhost', port: 9200)\n @host = host\n @port = port\n @port_s = port.to_s\n end",
"def initialize port=5554\n @connection = Net::Telnet.new \"Host\" => \"localhost\",\n \"Port\" => port\n end",
"def connect(host = DEFAULT_HOST, port = DEFAULT_PORT)\n self.socket = create_socket(host, port)\n\n identify\n\n remote_host = socket.peeraddr[3]\n remote_port = socket.peeraddr[1]\n\n logger.info(\"Connected to #{remote_host}:#{remote_port}.\")\n return true\n rescue Errno::ECONNREFUSED\n logger.error('Connection refused! Is the Broker running?')\n return false\n end",
"def connect\r\n begin\r\n TCPSocket.new(@server, @port) #used for checking the connection\r\n puts \"Connection successful!\"\r\n run()\r\n rescue => exception\r\n puts \"Failed to connect to : #{@server}:#{@port}\"\r\n puts \"Closing...\"\r\n sleep(2)\r\n end\r\n \r\n end",
"def initialize(host = 'localhost', port = 21_420)\n @host = host || 'localhost'\n @port = port || 21_420\n end",
"def initialize(host, ports)\n @host = host\n @ports = ports\n end",
"def roby_app_call_remote_interface(\n host: \"localhost\", port: Interface::DEFAULT_PORT\n )\n interface = Interface.connect_with_tcp_to(host, port)\n yield(interface) if block_given?\n ensure\n interface&.close\n end",
"def start_client(host = T.unsafe(nil), port = T.unsafe(nil)); end",
"def initialize(host, port = 389, login_dn, base_dn, password)\n @host = host\n @port = port\n @login_dn = login_dn\n @base_dn = base_dn\n @password = password\n\n return connect\n end",
"def connect\n info \"Connecting to #{ @host }\"\n\n begin @session.open(@credentials)\n rescue Exception => e\n error e.message\n end\n \n info \"Transport is #{ @session.transport.class }\"\n end",
"def connect_port_to(task_name, port_name, port)\n\n from_port = Orocos::Async.proxy(task_name).port(port_name)\n\n from_port.on_unreachable do\n $stderr.puts \"the port #{port_name} from task #{task_name} it is unreachable\"\n end\n\n from_port.on_reachable do\n begin\n from_port.to_orocos_port.connect_to port\n rescue\n $stderr.puts \"error when try to connect port\"\n end\n end\nend",
"def connect(transport: :tcp, address: '127.0.0.1', port: 5555)\n endpoint = \"#{ transport }://#{ address }\"\n endpoint << \":#{ port }\" if %i(tcp pgm epgm).include? transport\n @socket.method(__callee__).call(endpoint) == 0\n end",
"def actual_port; end",
"def actual_port; end",
"def connect(conn)\n\t\t@host = conn.to_s\n\t\tbegin\n\t\t\t@conn.connect(@host)\n\t\trescue IOException\n\t\t\traise IOError, \"Cannot connect to #{@host}\"\n\t\tend\n\tend",
"def post_init\n port, ip = Socket.unpack_sockaddr_in(get_peername)\n host = Socket.getaddrinfo(ip, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)[0][2]\n ActiveRecord::Base.logger.info \"-- Collector connection established from #{host}\"\n end",
"def port(port, host = T.unsafe(nil)); end",
"def open( host, port )\n connect_string = \"CONNECT #{host}:#{port} HTTP/1.0\"\n\n socket = TCPSocket.new( @proxy_host, @proxy_port )\n socket.puts connect_string\n socket.puts\n\n resp = parse_response( socket )\n\n return socket if resp[:code] == 200\n\n socket.shutdown\n raise ConnectError, resp.inspect unless resp[:code] == 407\n\n user = proxy_user\n passwd = proxy_password\n\n raise UnauthorizedError, \"no proxy user given\" unless user\n\n auth = resp[:headers][\"Proxy-Authenticate\"]\n scheme, parms = auth.split( / /, 2 )\n\n case scheme\n when \"Basic\"\n credentials =\n Base64.encode64( \"#{user}:#{passwd}\" ).gsub( /\\n/, \"\" )\n else\n raise NotImplementedError,\n \"authorization scheme #{scheme.inspect} is not supported\"\n end\n\n socket = TCPSocket.new( @proxy_host, @proxy_port )\n socket.puts connect_string\n socket.puts \"Proxy-Authorization: #{scheme} #{credentials}\"\n socket.puts\n\n resp = parse_response( socket )\n\n raise ConnectError, resp.inspect if resp[:code] != 200\n\n return socket\n end",
"def connect(*) end",
"def connect (host, username,port=22)\n begin\n pw = get_password(host, username)\n\n tunnelhost = host\n if @connections.key?(host.to_sym)\n port = @connections[host.to_sym]\n tunnelhost = 'localhost'\n @@log.debug(\"Found local-port forward on port \"+port.to_s) \n end\n\n @connections[host.to_sym] = Net::SSH.start(tunnelhost, username, :password => pw, :port => port)\n rescue Net::SSH::AuthenticationFailed\n retry\n end\n end",
"def establish_connection\n if @socket.nil?\n @socket = TCPSocket.new(@host, @port)\n end\n end",
"def establish_connection\n if @socket.nil?\n @socket = TCPSocket.new(@host, @port)\n end\n end",
"def connection(host, port)\n Net::HTTP.new(host, port).tap do |connection|\n connection.use_ssl = true\n connection.ssl_version = SSL_VERSION\n connection.ciphers = SSL_CIPHERS\n end\n end",
"def port\n connect_address.ip_port\n rescue SocketError\n # Not bound to any local port\n rescue IOError\n # Socket has been closed\n end",
"def connect(endpoint,hash)\r\n\t\t\t@endpoint = endpoint\r\n\t\t\t@hash = hash\r\n\t\t\tbegin\r\n\t\t\t\tip,port = @endpoint.strip.split(/:/)\r\n\t\t\t\t@fd = TCPSocket.new(ip,port.to_i)\r\n\t\t\trescue\r\n\t\t\t\t## remove chatroom\r\n\t\t\t\traise 'SocketError'\r\n\t\t\tend\r\n\t\t\t@state = 're'\r\n\t\tend",
"def talk_to_server(host, port, request)\n socket = TCPSocket.open(host, port)\n socket.print(request)\n response = socket.read\n socket.close\n\n response\nend",
"def initialize(host = 'localhost', port = 3000)\n\t\t\t@host, @port = host, port\n\t\tend",
"def connect_to(host, port)\n if @proxy_uri\n Net::HTTP::Proxy(@proxy_uri.host, @proxy_uri.port, unescape(@proxy_uri.user), unescape(@proxy_uri.password)).new(host, port)\n else\n Net::HTTP.new(host, port)\n end\n end",
"def connect_to_unit\n puts \"Connecting to '#{@host}...\"\n begin\n tcp_client = TCPSocket.new @host, @port\n @ssl_client = OpenSSL::SSL::SSLSocket.new tcp_client, @context\n @ssl_client.connect\n rescue Exception => e\n puts \"Could not connect to '#{@host}: #{e}\"\n end\n end",
"def port\n end",
"def connect(args)\n if (args.size != 2)\n puts \"usage: connect [host] [port]\"\n return\n else\n @connections.add(args[0], args[1])\n puts \"connected to #{args[0]}:#{args[1]}\"\n end\n end",
"def port_open?(host, port)\n begin\n Timeout::timeout(1) do\n begin\n s = TCPSocket.new(host, port)\n s.close\n return true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n return false\n end\n end\n rescue Timeout::Error\n end\n return false\nend",
"def sockopen(host, port)\n socket = nil\n msg = nil\n timeout = 5.0\n socket = turbina_timeout(timeout, proc {TCPSocket.open(host, port)})\n return socket\n end",
"def host_with_port\n uhost, uport = self.host, self.port\n if port != protocol.default_port\n \"#{uhost}:#{uport}\"\n else\n uhost\n end\n end",
"def initialize(host, port = DEFAULT_PORT, timeout = 10)\n raise ArgumentError, \"No host specified\" if host.nil? or host.empty?\n raise ArgumentError, \"No port specified\" if port.nil? or port.to_i.zero?\n\n @host = host\n @port = port.to_i\n\n @sock = nil\n @retry = nil\n @status = 'NOT CONNECTED'\n @timeout = timeout\n end",
"def initialize(host, port, *args)\n @host, @port = host, port\n handle_socket_errors { super }\n end",
"def port\n @connection.port\n end",
"def connect(socket_class, host, port, nodelay = T.unsafe(nil)); end",
"def open( host, port )\n sock = TCPSocket.new( @proxy_host, @proxy_port )\n\n ip_addr = IPAddr.new( Resolv.getaddress( host ) )\n \n packet = [ SOCKS_VERSION, SOCKS_CMD_CONNECT,\n port.to_i, ip_addr.to_i,\n proxy_user, 0 ].pack( \"CCnNA*C\" )\n sock.send packet, 0\n\n version, status, port, ip = sock.recv( 8 ).unpack( \"CCnN\" )\n if status != SOCKS_GRANTED\n sock.close\n raise ConnectError, \"error connecting to proxy (#{status})\"\n end\n\n return sock\n end",
"def socket(hostport, num_retries=3)\n\n num_retries.times do |i|\n begin\n sock = TCPSocket.new(*hostport.split(':'))\n rescue Exception\n else\n return sock\n end\n end\n #signal_bad_server(hostport)\n nil\n #raise RuntimeError, \"Unable to connect to job server #{hostport}\"\n end",
"def connection\n @connection ||= KJess::Connection.new( host, port )\n end",
"def port; config[:port]; end",
"def open_TCP_port(host, port)\n begin\n # Try and open the socket\n socket = TCPSocket.open(host, port)\n if socket\n # If it suceeded, port is open, so close it and return true\n socket.close\n return true\n end\n rescue\n # ..in all other cases, close the socket if open, and return false\n if socket != nil\n socket.close\n end\n return false\n end\nend",
"def port(msg)\n nums = msg.split(',')\n port = nums[4].to_i * 256 + nums[5].to_i\n host = nums[0..3].join('.')\n if thread[:datasocket]\n thread[:datasocket].close\n thread[:datasocket] = nil\n end\n thread[:datasocket] = TCPSocket.new(host, port)\n debug \"[DEBUG] Opened passive connection at #{host}:#{port}\"\n \"200 Passive connection established (#{port})\"\n end",
"def initialize(host, port)\n @host = host\n @port = port\n @socket = nil\n @packet = nil\n @authed = false\n @return_packets = false\n end",
"def initialize(host, port)\n @host = host\n @port = port\n @socket = nil\n @packet = nil\n @authed = false\n @return_packets = false\n end",
"def open(host, port, connection_options)\n socket = Socket.tcp(proxy_host, proxy_port, nil, nil,\n connect_timeout: connection_options[:timeout])\n ip_addr = IPAddr.new(Resolv.getaddress(host))\n\n packet = [VERSION, CONNECT, port.to_i, ip_addr.to_i, options[:user]].pack(\"CCnNZ*\")\n socket.send packet, 0\n\n version, status, port, ip = socket.recv(8).unpack(\"CCnN\")\n if status != GRANTED\n socket.close\n raise ConnectError, \"error connecting to proxy (#{status})\"\n end\n\n return socket\n end",
"def connect!\n Timeout::timeout(5) do\n self.remote = TCPSocket.new(host, port)\n end\n rescue Timeout::Error => e\n raise ConnectionTimeoutError\n rescue\n raise CannotConnectError\n end",
"def ScanningPort(host, ports)\n# puts \"Scanning... #{host}\"\n ports.each do |port|\n# puts \"Scanning Port #{port}\"\n begin\n socket = TCPSocket.open(host, port)\n Timeout::timeout(1)\n rescue\n puts \"Scan Error: #{$!}\"\n end\n if (socket)\n socket.close\n puts \"'Port: #{port} / Open\"\n return port\n\t\t else\n\t\t puts \"This host don't have any POP3 guess open port\"\n \t return\n end\n end\n end",
"def initialize(host='127.0.0.1')\n @sock = Socket.new(:INET, :STREAM)\n @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true)\n @sock.bind(Socket.sockaddr_in(0, host))\n @host, @port = @sock.connect_address.ip_unpack\n @addr = \"#{@host}:#{@port}\"\n if block_given?\n begin\n yield self\n ensure\n close\n end\n end\n end",
"def connect!\n host, port = @current_server.split(\":\")\n @socket = TCPSocket.new(host, port)\n @transport = Avro::IPC::SocketTransport.new(@socket)\n @requestor = Avro::IPC::Requestor.new(@options[:protocol], @transport)\n rescue Avro::AvroError, Errno::ECONNREFUSED, Errno::EPIPE, IOError => e\n @transport.close rescue nil\n raise e\n end",
"def open(host, port, connection_options)\n socket = establish_connection(connection_options[:timeout])\n socket.write \"CONNECT #{host}:#{port} HTTP/1.1\\r\\n\"\n socket.write \"Host: #{host}:#{port}\\r\\n\"\n\n if options[:user]\n credentials = [\"#{options[:user]}:#{options[:password]}\"].pack(\"m*\").gsub(/\\s/, \"\")\n socket.write \"Proxy-Authorization: Basic #{credentials}\\r\\n\"\n end\n\n socket.write \"\\r\\n\"\n\n resp = parse_response(socket)\n\n return socket if resp[:code] == 200\n\n socket.close\n raise ConnectError, resp.inspect\n end",
"def port_bound?(host, port)\n Timeout.timeout(1) do\n s = TCPSocket.new(host, port)\n s.close rescue nil\n return true\n end\nrescue Timeout::Error, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, \\\n Errno::ENETUNREACH, Errno::EACCES, Errno::ENOTCONN, \\\n Errno::EADDRNOTAVAIL\n return false\nend",
"def port\n self.port\n end",
"def connect_mock(_, addr)\n port, = Socket.unpack_sockaddr_in(addr)\n if [1234, 4321].include?(port)\n raise Errno::EISCONN\n end\n raise Errno::ECONNREFUSED\n end",
"def set_tcp(host, port)\n @host = host\n @port = port\n LibDrizzle.drizzle_con_set_tcp(@con_ptr, @host, @port)\n end",
"def initialize(ip=\"localhost\", port=P_EXT_PORT)\n @hostname = ip\n @port = port\n end",
"def connect\n @connection = Net::HTTP.new(@params[:server], @params[:port])\n @connection.use_ssl = true if @params[:scheme] == 'https'\n @connection.start\n end",
"def connect\n @comm.connect(opts.user, opts.password, opts.server)\n end",
"def test_port_exists\n port = 20000\n client = ChainReactor::ClientConnection.new(mock_socket(\"\",port),get_logger)\n assert_equal port, client.port\n end",
"def socket_port; end",
"def connect!; end",
"def connect!; end"
] |
[
"0.6963155",
"0.6958152",
"0.69189584",
"0.66422284",
"0.6608101",
"0.66063154",
"0.65560484",
"0.655131",
"0.6549774",
"0.6537549",
"0.65207833",
"0.6506622",
"0.64691544",
"0.64485484",
"0.64443445",
"0.63930655",
"0.63876575",
"0.6383172",
"0.6346155",
"0.63372755",
"0.6314369",
"0.6284524",
"0.62842053",
"0.6256454",
"0.6233202",
"0.6211718",
"0.62106246",
"0.6208918",
"0.6178837",
"0.6178837",
"0.6178837",
"0.6178837",
"0.6178837",
"0.6178837",
"0.6178837",
"0.6178837",
"0.6171965",
"0.6168772",
"0.61523384",
"0.61250293",
"0.6109321",
"0.6101697",
"0.6099701",
"0.60946953",
"0.60683185",
"0.606084",
"0.60593987",
"0.605411",
"0.60491467",
"0.6048025",
"0.6044367",
"0.6044367",
"0.60386455",
"0.6023355",
"0.60122526",
"0.60028845",
"0.5999868",
"0.59935915",
"0.59926087",
"0.59926087",
"0.59922284",
"0.5982052",
"0.5979902",
"0.5958287",
"0.59580445",
"0.5949047",
"0.59457344",
"0.5925852",
"0.5905941",
"0.59059346",
"0.59017706",
"0.59005165",
"0.5897773",
"0.5893839",
"0.5887958",
"0.588436",
"0.58824766",
"0.58752954",
"0.58735496",
"0.5868216",
"0.5866409",
"0.58631194",
"0.58602285",
"0.58602285",
"0.58395934",
"0.58360773",
"0.5828598",
"0.58211845",
"0.5817571",
"0.58151066",
"0.58094037",
"0.58030623",
"0.5794992",
"0.57927644",
"0.5787159",
"0.57842946",
"0.57725984",
"0.5772297",
"0.5761553",
"0.57584786",
"0.57584786"
] |
0.0
|
-1
|
find the local configured connection
|
def find_local
find_connection("#{BackgrounDRb::BDRB_CONFIG[:backgroundrb][:ip]}:#{BackgrounDRb::BDRB_CONFIG[:backgroundrb][:port]}")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def conn\n\t\treturn @conn ||= self.connect\n\tend",
"def get_db_conn\n mongo = nil\n configure :development do\n mongo = Mongo::MongoClient.new('localhost', 27017).db('ddp')\n end\n configure :production do\n mongo = get_remote_connection\n end\n\n #retun connection\n mongo\n end",
"def find_connection host_info\n conn = @backend_connections.detect { |x| x.server_info == host_info }\n raise NoServerAvailable.new(\"BackgrounDRb server is not found running on #{host_info}\") unless conn\n return conn\n end",
"def connect_local\n ActiveRecord::Base.establish_connection(\n :adapter => 'postgresql',\n :encoding => 'unicode',\n :database => ENV['DB_NAME'], # accessmon\n :username => ENV['DB_USERNAME'], # accessmon\n :password => ENV['DB_PASSWORD'],\n :pool => POOL_COUNT,\n :port => PORT_NUMBER,\n :host => 'localhost')\n end",
"def connection\n retrieve_connection\n end",
"def connect\n @connection_pool.get_connection\n end",
"def connection_string\n instance.primary_ip.split('://')[0] == 'unix' ? instance.primary_ip : \"tcp://#{instance.primary_ip}:2376\"\n end",
"def local_name; connection_space.name end",
"def mysql_remote_connection_info(category='root', remote)\n host_info = {\n host: remote,\n port: 3306\n }\n mysql_local_connection_info.merge(host_info)\nend",
"def default_connection\n\t @default_config ||= ActiveRecord::Base.connection.instance_variable_get(\"@config\").dup\n\tend",
"def connection #:nodoc:\n Thread.current['connection'] ||= retrieve_connection\n Thread.current['connection']\n end",
"def connection\n @connection ||= build_connection\n end",
"def get_remote_connection\n retun db_connection if db_connection\n db = URI..parse(ENV['MONGOHQ_URl'])\n db_name = db.path.gsub(/^\\//, '')\n db_connection = Mongo::Connection.new(db.host, db.port).db(db_name)\n db_connection.authenticate(db.user, db.password) unless db.user.nil?\n db_connection\n #check incoming message\n end",
"def connection\n @connection ||= make_connection\n end",
"def conn(server=:default)\n @conns[@servers[server]]\n end",
"def connection\n return nil unless has_connection?\n ActiveRecord::Base.connection\n end",
"def default_connection\n @default_config ||= ActiveRecord::Base.connection.instance_variable_get(\"@config\").dup\n end",
"def default_connection\r\n raise NotConnected unless connected?\r\n\t\t\t\t\treturn @connections.last\r\n\t\t\t\tend",
"def host\n @config.db_hostname\n end",
"def conn\n #if @conn exists and is open\n if @conn and begin @conn.status rescue PGError false end then\n return @conn\n else\n return @conn = connect_to_database\n end\n end",
"def connection\n raise ConnectionNotEstablished unless @@connection\n return @@connection\n end",
"def find(name)\n connection_exists?(name) ? @connections[name] : nil\n end",
"def conn(pty_needed=false)\n Scutil.find_connection(@hostname, @username, pty_needed=false, @options)\n end",
"def connection_info\n ENV['DATABASE_URL']\n end",
"def get_connection(config, &connector)\n @connections ||= {}\n\n connection = @connections[config]\n\n return connection if connection\n\n begin\n @connections[config] = connector.call(config)\n rescue => e\n ::NewRelic::Agent.logger.error(\"Caught exception trying to get connection to DB for explain.\", e)\n nil\n end\n end",
"def connection\n self.field('Connection')\n end",
"def connection\n settings.connection\n end",
"def connection\n self.server[self.database][self.layout]\n end",
"def cf_connecting_ip\n @env[\"HTTP_CF_CONNECTING_IP\"]\n end",
"def alf_connection\n alf_config.connection\n end",
"def connect_if_connection_initialized\n connection.connect if connection.initialized?\n end",
"def remote_connections; end",
"def connection\n @connection || Connection.new\n end",
"def local?\r\n @connect_type == :local\r\n end",
"def connection\n @@connection_proxy\n end",
"def connection\n @@connection_proxy\n end",
"def connection\n @connection ||= Connection.new(nil)\n end",
"def connection\n self.class.connection\n end",
"def connection\n self.class.connection\n end",
"def connection\n self.class.connection\n end",
"def connection\n self.class.connection\n end",
"def connection\n self.class.connection\n end",
"def connect\n connection.connect\n nil\n end",
"def connection\n @connection\n end",
"def get_db_connection\n config = read_database_config\n if config.dig(:adapter) == 'postgresql'\n config[:user] = config.delete(:username) if config[:username]\n config[:dbname] = config.delete(:database) if config[:database]\n config.delete(:adapter)\n valid_param_keys = PG::Connection.conndefaults_hash.keys + [:requiressl]\n config.slice!(*valid_param_keys)\n @db ||= PG::Connection.new(config)\n elsif config.dig(:adapter) == 'mysql2'\n @db ||= Mysql2::Client.new(config)\n else\n @db ||= SQLite3::Database.open(\"spectacles-#{Rails.env}.db\")\n end\n end",
"def mysql_global_vip_connection_info(category='root')\n host_info = {\n host: node[:bcpc][:management][:vip],\n port: 3306\n }\n mysql_local_connection_info.merge(host_info)\nend",
"def connection\n @connection_class.connection\n end",
"def conn\n builder.conn || ::ActiveRecord::Base.connection\n end",
"def host\n @connection.host\n end",
"def connection\n Connection.new(conn_spec)\n end",
"def connection\n @@connection\n end",
"def connection\n if defined?(@active_connection_name) && (conn = active_connections[@active_connection_name])\n conn\n else\n # retrieve_connection sets the cache key.\n conn = retrieve_connection\n active_connections[@active_connection_name] = conn\n end\n end",
"def connection\n @connection = create_connection! unless connected?\n @connection\n end",
"def slave_connection_holder\n @slave_connection_holder ||= Class.new(ActiveRecord::Base) {\n self.abstract_class = true\n\n def self.name\n \"SlaveConnectionHolder\"\n end\n\n spec = [Slavery.spec_key, Slavery.env].find do |spec_key|\n ActiveRecord::Base.configurations[spec_key]\n end or raise Error.new(\"#{Slavery.spec_key} or #{Slavery.env} must exist!\")\n\n establish_connection spec.to_sym\n }\n end",
"def connection\n @connection || ActiveSdb::connection\n end",
"def connection\n @connection\n end",
"def local_port\n return @local_port\n end",
"def connect_to_target_db\n ActiveRecord::Base.establish_connection(Rails.env.to_sym)\n end",
"def connect_remote\n #ENV['DATABASE_URL'] ||= \"postgres://glue.pumpingstationone.org/?pool=5\"\n #ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'])\n ActiveRecord::Base.establish_connection(\n :adapter => 'postgresql',\n :encoding => 'unicode',\n :database => ENV['DB_NAME'], # accessmon\n :username => ENV['DB_USERNAME'], # accessmon\n :password => ENV['DB_PASSWORD'],\n :pool => POOL_COUNT,\n :port => PORT_NUMBER,\n :host => ENV['DB_HOST'])\n end",
"def tunnel_local\n\t\tbegin\n\t\t\trstream.localinfo\n\t\trescue ::Exception\n\t\t\t'127.0.0.1'\n\t\tend\n\tend",
"def connection\n adapter.connection\n end",
"def establish_master_connection\n establish_connection(configuration.merge(\n \"database\" => \"postgres\",\n \"password\" => su_password,\n \"schema_search_path\" => \"public\",\n \"username\" => su_username\n ))\n end",
"def mysql_local_connection_info(category='root')\n #\n # The passwords are ALWAYS stored in a data bag. Sometimes the users\n # are not. If there's no data bag item, use the category name.\n #\n node.run_state[\"bcpc_mysql_#{category}_username\"] ||=\n (get_config(\"mysql-#{category}-user\") || category)\n\n #\n # The password may be in an unencrypted data bag,\n # configs/$ENVIRONMENT, or it may be in a chef vault.\n #\n # Try both.\n #\n node.run_state[\"bcpc_mysql_#{category}_password\"] ||=\n (get_config(\"mysql-#{category}-password\") ||\n get_config('password', \"mysql-#{category}\", 'os'))\n\n if node.run_state[\"bcpc_mysql_#{category}_password\"].nil?\n raise \"Could not find MySQL password for #{category}!\"\n end\n \n {\n username: node.run_state[\"bcpc_mysql_#{category}_username\"],\n password: node.run_state[\"bcpc_mysql_#{category}_password\"]\n }\nend",
"def first_db_host\n @db_host ||= find_servers(:roles => :db).map(&:to_s).first\nend",
"def get_mysql_hostname \n @mysql_hostname = @sequel[\"SELECT @@hostname;\"].first[:@@hostname]\n end",
"def get_mysql_hostname \n @mysql_hostname = @sequel[\"SELECT @@hostname;\"].first[:@@hostname]\n end",
"def socket_host; end",
"def local_ip\n orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily\n\n UDPSocket.open do |s|\n s.connect '64.233.187.99', 1\n s.addr.last\n end\nensure\n Socket.do_not_reverse_lookup = orig\nend",
"def connect_local_admin\n ActiveRecord::Base.establish_connection(\n :adapter => 'postgresql',\n :schema_search_path => 'public',\n :encoding => 'unicode',\n :database => 'postgres',\n :username => ENV['DB_USERNAME'], # accessmon\n :password => ENV['DB_PASSWORD'],\n :pool => POOL_COUNT,\n :port => PORT_NUMBER,\n :host => 'localhost')\n end",
"def host; config[:host]; end",
"def local_ip\n UDPSocket.open {|s| s.connect(\"64.233.187.99\", 1); s.addr.last}\n end",
"def connection\n Connection.new(conn_spec)\n end",
"def connect_to(env)\n ActiveRecord::Base.establish_connection YAML.safe_load(File.open(Rails.root.join(\"config/database.yml\")).read)[env.to_s]\n end",
"def connection\n connection_id = current_connection_id\n unless conn = @reserved_connections.fetch(connection_id, nil)\n synchronize do\n conn = ( @reserved_connections[connection_id] ||= checkout )\n end\n end\n conn\n end",
"def connection\n @connection.connect\n end",
"def client_connection\n if respond_to?(:valid_raw_connection)\n valid_raw_connection\n elsif instance_variable_defined?(:@raw_connection)\n @raw_connection\n else\n @connection\n end\n end",
"def connect\n Connection.new\n end",
"def bare_local_couch_database_url\n \"#{local_couch_host_url}/#{config['couchdb']['local']['database']}\"\n end",
"def retrieve_connection(klass) #:nodoc:\n self.ensure_ready\n pool = self.retrieve_connection_pool(klass)\n (pool && pool.connection) or raise ActiveRecord::ConnectionNotEstablished\n end",
"def connection\n @connection ||= if defined?(ActiveRecord)\n ActiveRecord::Base.connection.raw_connection\n else\n raise \"No connection established or discovered. Use Revenant::MySQL::connection=\"\n end\n end",
"def get_remote_database(print_to_stdout)\n cleardb = api.get_config_vars(app).body[\"CLEARDB_DATABASE_URL\"]\n jawsdb = api.get_config_vars(app).body[\"JAWSDB_URL\"]\n\n if @@db == 'cleardb'\n puts \"Using ClearDB\" if print_to_stdout\n return cleardb\n elsif @@db == 'jawsdb'\n puts \"Using JawsDB\" if print_to_stdout\n return jawsdb\n elsif jawsdb && cleardb\n puts \"Error. Both CLEARDB_DATABASE_URL and JAWSDB_URL config vars are found. Please indicate which database to use with the --db parameter (values accepted: cleardb or jawsdb)\"\n return nil\n elsif cleardb\n puts \"Using ClearDB\" if print_to_stdout\n return cleardb\n elsif jawsdb\n puts \"Using JawsDB\" if print_to_stdout\n return jawsdb\n end\n\n return nil\n end",
"def mysql_config_by_name(name)\n connections = swiftype_config['mysql_connections'] || {}\n critical(\"Unknown MySQL connection: #{name}\") unless connections[name]\n return connections[name]\n end",
"def connection\n @connection ||= Bunny.new RabidMQ::Config.load_config\n end",
"def connect_using conn\n @connection = conn\n end",
"def connection\n @connection_pool\n end",
"def connection\n @conn ||= ETL::Engine.connection(dimension_target)\n end",
"def connection_identifier; end",
"def local_connect(body)\n host = _pop_token(body)\n port = _pop_token(body).to_i\n if host.length < 1\n begin\n host, port = @var[:last_connection]\n rescue\n raise \"usage: /connect <hostname> [port]\"\n end\n end\n port = 9000 if port == 0\n begin\n connect(host, port)\n @var[:last_connection] = [ host, port ]\n _save_env\n rescue\n _notice \"Could not connect to #{host}:#{port} - #{$!}\", :error\n end\nend",
"def get_server\n get_general['server']\n end",
"def connection\n @connection\n end",
"def db_connect\n database_connect_options = @options['database']\n db_connector = DatabaseConnector.new(database_connect_options)\n return db_connector.client\n end",
"def local_ip\n orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily\n\n UDPSocket.open do |s|\n s.connect '64.233.187.99', 1\n s.addr.last\n end\n ensure\n Socket.do_not_reverse_lookup = orig\n end",
"def connection\n ActiveRecord::Base.connection\n end",
"def conn\n @conn ||=\n begin\n if @@require_pg\n require 'pg'\n @@require_pg = false\n end\n initialize_copy nil\n c = PG.connect(arguments)\n @conn_owned = true if c\n c\n end\n end",
"def connection_for nick\n @connection_cache[nick]\n end",
"def connection\n ActiveRecord::Base.connection\n end",
"def this_server\n @this_server ||= db[self.class.schema_and_table(finder_result)]\n end",
"def server_name\n self.setup\n @server_name ||= self.attributes[\"connection\"]||self.class::DEFAULT_SERVER_NAME\n end",
"def local_ip_address\n conf['base_address'] ||\n %x{ip addr show #{conf['base_interface'] || 'br0'} | grep inet}.split(' ')[1].to_s.strip.split('/').first.to_s\nend",
"def connector_server_name\n return @connector_server_name\n end"
] |
[
"0.6640432",
"0.6539895",
"0.6510178",
"0.64693165",
"0.64692324",
"0.6461957",
"0.64516675",
"0.64343923",
"0.6421453",
"0.63956326",
"0.6379554",
"0.6370063",
"0.6316829",
"0.6306686",
"0.62851006",
"0.62837994",
"0.62813705",
"0.6261312",
"0.62353927",
"0.62281036",
"0.6223225",
"0.6220616",
"0.6200655",
"0.61986125",
"0.6191712",
"0.6169805",
"0.6158314",
"0.6147544",
"0.6142699",
"0.61147463",
"0.6082418",
"0.60760665",
"0.6063382",
"0.60511017",
"0.6033651",
"0.6033651",
"0.60333836",
"0.6028204",
"0.602741",
"0.602741",
"0.602741",
"0.602741",
"0.6016291",
"0.6013629",
"0.60029346",
"0.5998178",
"0.59926784",
"0.5982093",
"0.5975454",
"0.5972251",
"0.59720755",
"0.5968772",
"0.59574234",
"0.5953763",
"0.5939822",
"0.5927006",
"0.5918228",
"0.5905035",
"0.5900393",
"0.58994204",
"0.58841544",
"0.58616257",
"0.5859028",
"0.5856593",
"0.58470297",
"0.58470297",
"0.58388215",
"0.58341354",
"0.58311653",
"0.58274835",
"0.5824627",
"0.581991",
"0.5816529",
"0.58163273",
"0.58125514",
"0.58101857",
"0.5794598",
"0.57909733",
"0.5789365",
"0.57803255",
"0.5780294",
"0.57753986",
"0.57742316",
"0.57711726",
"0.5768314",
"0.57675344",
"0.5762817",
"0.5760476",
"0.5759197",
"0.57516825",
"0.5747805",
"0.57464564",
"0.5741555",
"0.57410175",
"0.57372725",
"0.5731696",
"0.57295316",
"0.57215863",
"0.5721539",
"0.57208383"
] |
0.76514256
|
0
|
return the worker proxy
|
def worker(worker_name,worker_key = nil)
update_stats
RailsWorkerProxy.new(worker_name,worker_key,self)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def proxy\n return @proxy\n end",
"def proxy\n @proxy\n end",
"def proxy\n @proxy ||= Proxy.new self\n end",
"def proxy; self end",
"def proxy\n manager_instance(ProxyManager)\n end",
"def __proxy_result__\n @thread.join if @thread && @thread.alive?\n @thread = nil\n raise @proxy_exception if @proxy_exception\n return @proxy_result\n end",
"def __proxy_result__\n @thread.join if @thread && @thread.alive?\n @thread = nil\n raise @proxy_exception if @proxy_exception\n return @proxy_result\n end",
"def using_proxy?; end",
"def proxy\n\t\t\tself.options[:proxy]\n\t\tend",
"def proxy; end",
"def proxy; end",
"def proxy; end",
"def proxy_target\n @target\n end",
"def worker= w\n @worker = w\n end",
"def http_proxy; end",
"def proxy_addr; end",
"def proxy_uri; end",
"def proxy_uri; end",
"def worker_instance\n WorkerWrapper.new(worker_name: worker, job_args: args, job_queue: queue)\n end",
"def proxy\n ENV['HYPERKIT_PROXY']\n end",
"def get!\n index = proxies.find_index(&:connectable?)\n return if index.nil?\n\n proxy = proxies.delete_at(index)\n tail = proxies[index..-1]\n\n @proxies = tail << proxy\n\n proxy\n end",
"def get!\n index = proxies.find_index(&:connectable?)\n return if index.nil?\n\n proxy = proxies.delete_at(index)\n tail = proxies[index..-1]\n\n @proxies = tail << proxy\n\n proxy\n end",
"def http_proxy_uri\n @tools.http_proxy_url\n end",
"def get_proxy(identifier); end",
"def get_proxy(identifier); end",
"def worker\n\n @services['s_worker']\n end",
"def proxy\n ENV['RANCHER_PROXY']\n end",
"def connect_through_proxy; end",
"def proxy_start\n $proxy = Ritm::Proxy::Launcher.new\n $proxy.start\nend",
"def proxy_set?; end",
"def getproxyuri\n proxy = self.getproxy\n proxy_uri = (proxy != nil )? URI.parse(proxy) : nil\n return proxy_uri\n end",
"def get\n return if @proxies.empty?\n\n first_proxy = @proxies.shift\n @proxies << first_proxy\n\n first_proxy\n end",
"def get\n return if @proxies.empty?\n\n first_proxy = @proxies.shift\n @proxies << first_proxy\n\n first_proxy\n end",
"def proxy_pass; end",
"def getproxy\n proxy = (ENV['HTTP_PROXY'] == nil)? ENV['http_proxy'] : ENV['HTTP_PROXY']\n return proxy\n end",
"def proxy\n self.class.proxy.new(session)\n end",
"def proxy\n ENV['BETTERY_PROXY']\n end",
"def proxyaddress\n config[\"proxyaddress\"]\n end",
"def proxy\n @proxy ||= Shoegaze::Proxy.new(@mock_class_double, @mock_instance_double)\n end",
"def proxy_address\n proxy? ? @options['proxy_address'] || '127.0.0.1' : nil\n end",
"def connection\n @@connection_proxy\n end",
"def connection\n @@connection_proxy\n end",
"def __proxy_result__\n @proxy_result = @method_call.call unless defined?(@proxy_result)\n @proxy_result\n end",
"def proxy\n return @proxy if @proxy\n return if not Utility.is_windows?\n\n handle = WinProxy.open(@@HTTP_header['User-Agent'], 1, nil, nil, 0)\n return @proxy if handle.null?\n\n options = WinProxy::Options.new\n options[:flags] = 1\n options[:auto_detect_flags] = 2\n options[:auto_logon] = 1\n info = WinProxy::Info.new\n res = WinProxy.get_proxy(handle, (uri.to_s + \"\\0\").encode('utf-16le'), options, info)\n return @proxy if res == 0 # the call failed so return default proxy\n return unless info.proxy?\n\n puts \"TODO: handle proxy bypass - #{info[:bypass].read_16bit_c_string}\" unless info[:bypass].null?\n\n proxies = info[:proxy].read_16bit_c_string.strip.split(';').select {|p| not p.empty? }.map {|p| p.split(':') }\n @proxy = proxies[0]\n @proxy << '80' if @proxy.length == 1\n @proxy += proxy_userpass(proxies.map {|p| p[0] })\n\n WinProxy.free(info[:proxy])\n WinProxy.free(info[:bypass]) unless info[:bypass].null?\n\n @proxy\n end",
"def public_proxy?; end",
"def public_proxy?; end",
"def http\n @http ||= Net::HTTP::Proxy(@proxy.host, @proxy.port).new @endpoint.host, @endpoint.port\n end",
"def proxy_uri\n @proxy_uri ||= URI.parse(config(\"proxy-uri\"))\n end",
"def get_defined_proxy\n prime_proxy = ENV.select { |k,v| v if k =~ /http_proxy/i }.first\n if prime_proxy.nil?\n prime_proxy = ENV.select { |k,v| v if k =~ /all_proxy/i }.first\n end\n return nil if prime_proxy.nil?\n\n URI.parse(prime_proxy[1])\n end",
"def getproxy\n proxy = (ENV['HTTP_PROXY'] == nil)? ENV['http_proxy'] : ENV['HTTP_PROXY']\n return proxy\n end",
"def proxies; end",
"def legitimate_proxy?; end",
"def getproxyuri\n proxy = self.getproxy\n proxy_uri = (proxy != nil )? URI.parse(proxy) : nil\n return proxy_uri\n end",
"def worker\n read_attribute(:worker) || extract_worker || ''\n end",
"def retrieve_proxy(proxy_name)\n @proxy_map[proxy_name]\n end",
"def proxies\n @proxies ||= {}\n end",
"def proxy # :nodoc:\n return const_get('Proxy', false) if const_defined?('Proxy', false)\n\n const_set('Proxy', Module.new).tap { |proxy| prepend proxy }\n end",
"def worker_pool\n @worker_pool || @mutex.synchronize { @worker_pool ||= ActionCable::Server::Worker.new(max_size: config.worker_pool_size) }\n end",
"def worker_pool; end",
"def worker_pool; end",
"def worker\n Worker.find_by_code worker_code\n end",
"def find_proxy_target(options = {})\n end",
"def proxy meth\n Proxy.new self, meth\n end",
"def write_worker\n @write_worker ||= WriteWorker.new(self)\n end",
"def proxy_google(path)\n res = Net::HTTP.start('www.google.com', 80) do |http|\n http.get path\n end\n res.body\nend",
"def theater\n return @peer.theater.proxy\n end",
"def proxy_mgr\n ProxyFetcher.configure do |config|\n config.provider = %i[free_proxy_list_ssl xroxy proxy_list]\n config.proxy_validation_timeout = 15\n config.user_agent = USER_AGENT\n end\n ProxyFetcher::Manager.new\n end",
"def read_worker\n @read_worker ||= ReadWorker.new(self)\n end",
"def server_by_proxy(proxy)\n raise NotImplementedError, \"Implement #{__callee__} in #{self.class.to_s}\"\n end",
"def proxy=(value)\n @proxy = value\n end",
"def proxy=(value)\n\t\t\t@proxy = value\n\t\tend",
"def workers\n @@workers ||= []\n end",
"def resource_proxy\n resource_proxy_class.new\n end",
"def http_proxy_parts; end",
"def proxy\n ENV['NEARMISS_PROXY']\n end",
"def proxy_port; end",
"def proxy(pattern)\n return Proxy.new(pattern, proxies)\n end",
"def global\n delegate.global_proxy\n end",
"def proxy (value = nil)\n\t\tif value\n\t\t\traise_if_error C.glyr_opt_proxy(to_native, value)\n\t\telse\n\t\t\tto_native[:proxy]\n\t\tend\n\tend",
"def recv_request\n @proxy_msg.recv_request(@proxy_socket)\n end",
"def server\n # we're in a new process (one of the workers on the test_server),\n # so stop the old server from RemoteWorkerServer\n DRb.stop_service\n \n # since RemoteWorkerServer now uses drbfire, we use it here to communicate with it\n DRb.start_service(@server_proxy.uri, nil, DRbFire::ROLE => DRbFire::CLIENT)\n \n DeepTest.logger.debug \"LocalWorkers start_all worker starting with with blackboard: #{@server_proxy.uri.inspect} #{@server_proxy.inspect}\"\n \n # finally, return a remote reference to the RemoteWorkerServer\n DRbObject.new_with_uri(@server_proxy.uri)\n end",
"def be_worker\n before_work\n super\n end",
"def new(*constructor_args)\n @proxy.new do |*call_args|\n @worker.new(constructor_args, @job, &@block).call(call_args, @context)\n end\n end",
"def proxy\n class_name = name.split('::').last\n proxy_class_name = \"#{class_name}Proxy\"\n Economic.const_get(proxy_class_name)\n end",
"def worker_factory(&block)\n end",
"def build_worker\n worker = WorkerConfig.new\n yield worker\n worker\n end",
"def proxy(*value)\n @proxy = value if value && !value.empty?\n\n return @proxy if @proxy\n\n superclass.respond_to?(:proxy) ? superclass.proxy : nil\n end",
"def run\n LibZMQ.zmq_proxy @frontend, @backend, @capture\n end",
"def proxy_params\n params[:proxy]\n end",
"def worker_id\n self.class.worker_id\n end",
"def current\n @listener_proxies[current_pid]\n end",
"def start\n super\n start_proxy\n end",
"def find_http_proxy\n ret = [nil, nil]\n\n # check the platform. If we're running in windows then we need to \n # check the registry\n if @use_proxy\n if RUBY_PLATFORM =~ /win32/i\n # Find a proxy in Windows by checking the registry.\n # this code shamelessly copied from Raggle :D\n\n require 'win32/registry'\n\n Win32::Registry::open(\n Win32::Registry::HKEY_CURRENT_USER,\n 'Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings'\n ) do |reg|\n # check and see if proxy is enabled\n if reg.read('ProxyEnable')[1] != 0\n # get server, port, and no_proxy (overrides)\n server = reg.read('ProxyServer')[1]\n np = reg.read('ProxyOverride')[1]\n\n server =~ /^([^:]+):(.+)$/\n ret = [$1, $2]\n\n # don't bother with no_proxy support\n # ret['no_proxy'] = np.gsub(/;/, ',') if np && np.length > 0\n end\n end\n else\n # handle UNIX systems\n PROXY_ENV_VARS.each do |env_var|\n if ENV[env_var]\n # if we found a proxy, then parse it\n ret = ENV[env_var].sub(/^http:\\/\\/([^\\/]+)\\/?$/, '\\1').split(':')\n ret[1] = ret[1].to_i if ret[1]\n break\n end\n end\n # $stderr.puts \"DEBUG: http_proxy = #{ENV['http_proxy']}, ret = [#{ret.join(',')}]\"\n end\n else \n # proxy is disabled\n ret = [nil, nil]\n end\n\n # return host and port\n ret\n end",
"def workers\r\n @workers ||= []\r\n end",
"def get_public_ip_address\n get_proxy.get_public_ip_address\n end",
"def proxy_context\n @context\n end",
"def proxy?\n false\n end",
"def worker_name\n @client.worker_name\n end",
"def http_proxy=(_arg0); end",
"def smart_proxy_domain\n if proxy_base_domain =~ /^#{appname}/\n return proxy_base_domain \n end\n proxy_domains\n end"
] |
[
"0.7579001",
"0.7385312",
"0.7129743",
"0.6647349",
"0.6573572",
"0.6554234",
"0.6554234",
"0.65130967",
"0.64918905",
"0.6397488",
"0.6397488",
"0.6397488",
"0.62850875",
"0.6248578",
"0.6217216",
"0.62137526",
"0.6178733",
"0.6178733",
"0.617546",
"0.6163984",
"0.6163306",
"0.6163306",
"0.6128367",
"0.60964483",
"0.60964483",
"0.6074395",
"0.6031492",
"0.6029593",
"0.59727174",
"0.5954427",
"0.59411544",
"0.59236526",
"0.59236526",
"0.59225816",
"0.5918325",
"0.59079796",
"0.58974767",
"0.5868098",
"0.58350074",
"0.58193487",
"0.5814782",
"0.5814782",
"0.58146614",
"0.58112746",
"0.58019394",
"0.58019394",
"0.57926095",
"0.578276",
"0.5779134",
"0.57570726",
"0.57549787",
"0.57524616",
"0.5747362",
"0.57409304",
"0.5733757",
"0.5694484",
"0.5667122",
"0.565172",
"0.56412613",
"0.56412613",
"0.5634869",
"0.56278765",
"0.561178",
"0.55998385",
"0.5599392",
"0.5593697",
"0.558784",
"0.5576217",
"0.55713725",
"0.5558769",
"0.55306554",
"0.55233985",
"0.5516638",
"0.5511576",
"0.55020654",
"0.5497095",
"0.5480851",
"0.54712355",
"0.5467419",
"0.5451603",
"0.5434539",
"0.5434424",
"0.54315084",
"0.5419855",
"0.5414174",
"0.5406409",
"0.5395175",
"0.53896034",
"0.53894806",
"0.53822297",
"0.5378864",
"0.53728104",
"0.535975",
"0.5358165",
"0.5351888",
"0.5350785",
"0.5349932",
"0.53430134",
"0.5340206",
"0.5335118"
] |
0.61019003
|
23
|
Update the stats and discover new nodes if they came up.
|
def update_stats
@request_count += 1
discover_server_periodically if(time_to_discover? && !@disconnected_connections.empty?)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_node_info_cache()\n @all_stats = []\n @nodes.each { |node|\n ip = node.private_ip\n acc = AppControllerClient.new(ip, @@secret)\n\n begin\n @all_stats << acc.get_stats()\n rescue FailedNodeException\n Djinn.log_warn(\"Failed to get status update from node at #{ip}, so \" +\n \"not adding it to our cached info.\")\n end\n }\n end",
"def poll\n unless memcached_nodes.empty?\n memcached_nodes.each do | hostname_port |\n stats_text = issue_stats hostname_port \n if stats_text.present?\n @last_stats[hostname_port] = parse_and_report_stats hostname_port, stats_text\n else\n @last_stats[hostname_port] = {}\n end \n end\n\n aggregate_stats\n logger.debug \"Done with aggs\" \n end\n end",
"def refresh_info(peers)\n Node::Refresh::Info.(self, peers)\n end",
"def poll_nodes\n # clear any list of nodes we already know about and start fresh\n @nodes.clear\n transmit Packet::Poll.new\n end",
"def update_nodes\n mongo_driver = Kymera::MongoDriver.new(address, port, database, 'nodes')\n @registered_nodes = mongo_driver.get_collection('nodes')\n end",
"def update_index\n all.nodes.each do |n|\n n.reindex!\n end\n end",
"def get_registered_nodes\n update_nodes\n @registered_nodes\n end",
"def refresh(nodes_to_refresh = seeds)\n refreshed_nodes = []\n seen = {}\n # Set up a recursive lambda function for refreshing a node and it's peers.\n refresh_node = ->(node) do\n unless seen[node]\n seen[node] = true\n # Add the node to the global list of known nodes.\n seeds.push(node) unless seeds.include?(node)\n begin\n node.refresh\n # This node is good, so add it to the list of nodes to return.\n refreshed_nodes.push(node) unless refreshed_nodes.include?(node)\n # Now refresh any newly discovered peer nodes - this will also\n # remove nodes that are not included in the peer list.\n refresh_peers(node, &refresh_node)\n rescue Errors::ConnectionFailure\n # We couldn't connect to the node.\n end\n end\n end\n\n nodes_to_refresh.each(&refresh_node)\n refreshed_nodes\n end",
"def sync\n @cache.flush(true)\n @nodes.sync\n end",
"def network_update\n if (network = params[:network])\n network = JSON.load(network)\n network['nodes'].each do |node|\n @@builder.network.find_node(node.id).coord_x = node.coord_x\n @@builder.network.find_node(node.id).coord_y = node.coord_y\n end\n # @@builder.network.nodes.replace network['nodes']\n Node.num = @@builder.network.nodes.size\n end\n end",
"def update\n\t\t\t@node.evaluate(self)\n\t\tend",
"def auto_discover_nodes!\n @servers = execute(:all_nodes)\n end",
"def reapply_nodes\n @nodes.each { |node| node.data[:cluster] = self }\n end",
"def reload_pool_nodes\n @mutex.synchronize do\n reload_pool_nodes_unsync\n end\n end",
"def update(node); end",
"def nodes(reload = false)\n load if reload\n @info['nodes'].map do |node|\n Drain::Node.new(\n stats['nodes'].find { |n| n[0] == node[0] },\n node,\n client,\n @asg\n )\n end\n end",
"def join\n wait_for_completion\n update_nodes\n end",
"def watch_nodes(opts = {})\n @conn.watch_nodes(opts)\n end",
"def add_nodes(node_info)\n keyname = @creds['keyname']\n new_nodes = Djinn.convert_location_array_to_class(node_info, keyname)\n\n # Since an external thread can modify @nodes, let's put a lock around\n # it to prevent race conditions.\n @state_change_lock.synchronize {\n @nodes.concat(new_nodes)\n Djinn.log_debug(\"Changed nodes to #{@nodes}\")\n }\n\n update_firewall\n initialize_nodes_in_parallel(new_nodes)\n end",
"def update_neighbors_count!\n @neighbors_count = neighbor_mines_count\n end",
"def increment_hits\n @node.increment_hits! if @node\n end",
"def ping_nodes\n\t\twhile true\n\t\t\tsleep(rand(60))\n\t\t\tn = rand(@neighbour_nodes.count)\n\t\t\tnode = @neighbour_nodes[n]\n\t\t\ts = UDPSocket.new\n\t\t\tbegin\n\t\t\t\tTimeout::timeout(10){ \n\t\t\t\t\tputs \"Pinging #{node}\"\n\t\t\t\t\tsend_message [\"PING\", @info], 0, node.host, node.port\n\t\t\t\t\t@waiting = true\n\t\t\t\t\twhile waiting?\n\t\t\t\t\t\tsleep(0.2)\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\trescue Timeout::Error => ex\n\t\t\t\tif waiting?\n\t\t\t\t\tputs \"Conenction to #{node} timed out, sending DROP_NODE to all remaining nodes\"\n\t\t\t\t\t@neighbour_nodes - [node]\n\t\t\t\t\t@neighbour_nodes.each do |n|\n\t\t\t\t\t\tsend_message [\"DROP_NODE\", node], 0, n.host, n.port\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\trescue Socket::Error => ex\n\t\t\t\tputs \"Connection to #{node} failed, trying again in 60 seconds\"\n\t\t\trescue => ex\n\t\t\t\tputs ex.message\n\t\t\tend\n\t\tend\n\tend",
"def help_node_stats_data(name = nil)\n ns = __elasticsearch__.client.nodes.stats(:format => 'json')\n if name\n filtered_ns = ns['nodes'].keys.map do |k|\n [ k, ns['nodes'][k] ] if ns['nodes'][k]['name'] == name\n end.to_h\n ns['nodes'] = filtered_ns\n end\n\n\t\tns\n end",
"def print_all_node_stats\n print_stats(stats: get_stats)\n end",
"def update_stats\r\n @stats.push(@fitness)\r\n end",
"def start_compute_hits_thread\n Thread.new do\n interval = @driver.config['update_routing_interval'].to_i\n while true\n sleep(interval)\n routing = estimate_hits\n\n # Send updated values to the supernodes\n ping_msg = Protocol::Ping.new(routing.authority,routing.hub,routing.authority_prime,routing.hub_prime,routing.supernode?)\n ping_msg.ctime = DateTime.now\n sns = @supernode_table.supernodes\n group = ThreadGroup.new\n sns.each do |sn|\n t = Thread.new(sn) do |sn|\n ping(sn.socket,ping_msg) unless sn.socket.nil?\n end\n group.add(t)\n end\n group.list.each { |t| t.join }\n end\n end\n end",
"def watch_nodes(opts = {})\n core_client.watch_nodes(opts)\n end",
"def refresh_peers(node, &block)\n node.peers.each do |node|\n block.call(node) unless seeds.include?(node)\n peers.push(node) unless peers.include?(node)\n end\n end",
"def index\n @nodes = Node.all\n @rtt = {}\n @loss = {}\n conf = Collectd::Collectd.new\n @nodes.each do |node|\n collectd_node = Collectd::CollectdNode.new(node.id.to_s(16),node.link_local_address)\n begin\n @rtt[node] = conf.stat(collectd_node,\"ping\",nil,nil).rtt_5_min\n @loss[node] = conf.stat(collectd_node,\"ping\",nil,nil).loss_5_min\n rescue Exception => e #Ignore errors in single hosts (-> missing rrd-Files for newly created ...)\n logger.error \"Unable to calculate stats: #{e}\"\n end\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json do \n data = {}\n @nodes.each do |n| \n data[n.id] = {id_hex: n.id_hex, \n loss_5_min: (@loss[n].nil? || @loss[n].nan?) ? nil : @loss[n], \n rtt_5_min: (@loss[n].nil? || @rtt[n].nan?) ? nil : @rtt[n]}\n end\n render json: data\n end\n end\n end",
"def update_stats\n StatService.new(self).update_stats\n end",
"def update!(**args)\n @concurrent_nodes = args[:concurrent_nodes] if args.key?(:concurrent_nodes)\n @minimum_available_nodes = args[:minimum_available_nodes] if args.key?(:minimum_available_nodes)\n end",
"def watch_appropriate_nodes\n remaining_paths.last( threshold + 1 ).reverse_each do |path|\n next if watched_paths.include? path\n watched_paths << path\n finish_node(path) unless zk.exists?(path, :watch => true)\n end\n end",
"def estimate_hits\n nodes = @driver.neighbors\n authority_prime = 0.0\n hub_prime = 0.0\n square_sum_authority_prime = 0.0\n square_sum_hub_prime = 0.0\n # Compute the sum\n nodes.each do |p|\n authority_prime += p.hub\n hub_prime += p.authority\n square_sum_authority_prime += p.authority_prime**2\n square_sum_hub_prime += p.hub_prime**2\n end\n square_sum_authority_prime += authority_prime**2\n square_sum_hub_prime += hub_prime**2\n # Normalize\n authority = authority_prime**2/square_sum_authority_prime\n hub = hub_prime**2/square_sum_hub_prime\n\n # Update routing\n new_routing = @driver.update_routing do |routing|\n routing.authority = authority\n routing.hub = hub\n routing.authority_prime = authority_prime\n routing.hub_prime = hub_prime\n routing.last_update = DateTime.now\n end\n\n new_routing\n end",
"def fillInNodes()\n msg = Msg.new\n msg.setConfig(\"type\", 1)\n msg.setConfig(\"ttl\", $ports.length)\n msg.setConfig(\"seq\", nextSeqNum())\n msg_str = $hostname + \"\\t\"\n if $neighbors.length > 0\n $neighbors.each do |dst, distance|\n msg_str += dst + \",\" + distance.to_s + \"\\t\"\n end\n msg.setMessage(msg_str)\n $clients.each do |dst, client| \n sendMessage(client, msg)\n end\n end\nend",
"def manage_cluster\n @nodes = Node.find(:all)\n end",
"def process_all_nodes\n debug 'Start processing all nodes'\n each_node do |node|\n process_node node\n end\n end",
"def update_nodes\n incr = 0\n self.original_nodes.build(:displayed => true) if not new_record? and self.original_nodes.count == 0 # Insure at least 1 node\n self.original_nodes.each do |node|\n node.title = self.name\n node.menu_name = self.name\n incr = (node.new_record? ? node.set_safe_shortcut(self.name.parameterize.html_safe, 0, incr) : node.set_safe_shortcut(self.name.parameterize.html_safe, node.id, incr))\n node.displayed = self.display\n incr += 1\n end\n end",
"def update_nodes\n incr = 0\n self.nodes.build(:displayed => true) if not new_record? and self.nodes.count == 0 # Insure at least 1 node\n self.nodes.each do |node|\n node.title = name\n node.menu_name = name\n node.set_safe_shortcut(\"#{incr.to_s}-#{name}\")\n node.displayed = display\n incr += 1\n end\n end",
"def manage_nodes\n # Re-discover nodes, since the state of the world may have been changed\n # by the time we've become the primary node manager.\n discover_nodes\n\n # ensure that slaves are correctly pointing to this master\n redirect_slaves_to(@master)\n\n # Periodically update master config state.\n while running? && master_manager?\n @zk_lock.assert!\n sleep(CHECK_INTERVAL)\n\n @lock.synchronize do\n snapshots = current_node_snapshots\n if ensure_sufficient_node_managers(snapshots)\n snapshots.each_key do |node|\n update_master_state(node, snapshots)\n end\n\n # flush current master state\n write_current_redis_nodes\n\n # check if we've exhausted our attempts to promote a master\n unless @master\n @master_promotion_attempts += 1\n raise NoMasterError if @master_promotion_attempts > MAX_PROMOTION_ATTEMPTS\n end\n end\n end\n end\n end",
"def updateTime()\n\tloop {\n $currtime += 0.01\n $flood_trigger += 0.01\n if $flood_trigger >= $update_interval\n $flood_trigger = 0\n Thread.new {\n $mutex.synchronize {\n fillInNodes()\n }\n }\n end\n sleep(0.01)\n\t}\nend",
"def log_nodes_count\n @max_nodes += 1\n end",
"def summary\n \" Discovered #{@discovered_nodes.count} live node(s)\"\n end",
"def replicate_data_before_registration\n sorted_hash_keys = @@dynamo_nodes.sort_by { |_k,v| v.first.second.to_i}.map {|_k,v| v.first.second}\n sorted_hash_keys << @@my_key\n sorted_hash_keys = sorted_hash_keys.sort\n\n hash = Hash[sorted_hash_keys.map.with_index.to_a]\n\n nodes_to_be_replicated = []\n nodes_to_be_replicated << sorted_hash_keys[(hash[@@my_key] + 1 ) % sorted_hash_keys.size]\n nodes_to_be_replicated << sorted_hash_keys[(hash[@@my_key] + 2 ) % sorted_hash_keys.size]\n\n @@dynamo_nodes.each do |ip, data|\n if data.first.second.in?(nodes_to_be_replicated)\n data = JSON.parse(HTTPService.get_request('http://' + ip.to_s + '/node/get_data').body)['response']\n data.each do |key, value|\n store_value_simply(key, value)\n end\n end\n end\n end",
"def ping_stats(url, time)\n\n logger.info \"ping_stats:start: url = #{url}, time = #{time.to_i}\"\n\n jsonResponse = rest_call(url)\n response_hash = JSON.parse(jsonResponse)\n nodes = response_hash['nodes']\n\n this_node = nodes.select { |node| node.has_key?('thisNode') && node['thisNode'] == true }.first\n\n if this_node != nil\n nodes.each do |node|\n if node['otpNode'] != this_node['otpNode']\n hostname = URI.parse(\"http://#{node['hostname']}\").host.downcase\n ping_time = time_socket_open_close(hostname, '22')\n write_to_graphite( construct_metric_name(\"#{this_node['otpNode'].gsub('.','-')}.ping.#{hostname.gsub('.','-')}\", CONST_NODE_LEVEL), ping_time, time)\n end\n end\n else\n logger.info 'No nodes found with thisNode == true'\n end\n\n logger.info 'ping_stats:end: Completed'\n end",
"def update_block_stats\n self.block.calculate_stats\n end",
"def update!(**args)\n @fixed_node_count = args[:fixed_node_count] if args.key?(:fixed_node_count)\n @scaling = args[:scaling] if args.key?(:scaling)\n end",
"def write_our_node_info\n # Since more than one AppController could write its data at the same \n # time, get a lock before we write to it.\n ZKInterface.lock_and_run {\n @last_updated = ZKInterface.add_ip_to_ip_list(my_node.public_ip)\n ZKInterface.write_node_information(my_node, @done_loading)\n }\n\n return\n end",
"def update_visitor_os(start, finish)\n\t\t@visitor_os.each { |v| @visitor_os_counts[v] = { label: v, value: rand(100) } } \n\tend",
"def update_sources\n\t @sources.each { |s| @source_counts[s] = { label: s, value: rand(100) } } \n\tend",
"def discover_nodes\n @lock.synchronize do\n return unless running?\n @slaves, @unavailable = [], []\n if @master = find_existing_master\n logger.info(\"Using master #{@master} from existing znode config.\")\n elsif @master = guess_master(@nodes)\n logger.info(\"Guessed master #{@master} from known redis nodes.\")\n end\n @slaves = @nodes - [@master]\n logger.info(\"Managing master (#{@master}) and slaves #{stringify_nodes(@slaves)}\")\n end\n rescue *NODE_DISCOVERY_ERRORS => ex\n msg = <<-MSG.gsub(/\\s+/, ' ')\n Failed to discover master node: #{ex.inspect}\n In order to ensure a safe startup, redis_failover requires that all redis\n nodes be accessible, and only a single node indicating that it's the master.\n In order to fix this, you can perform a manual failover via redis_failover,\n or manually fix the individual redis servers. This discovery process will\n retry in #{TIMEOUT}s.\n MSG\n logger.warn(msg)\n sleep(TIMEOUT)\n retry\n end",
"def calc_full_nodes_avail\n @full_nodes_available = 0\n #if @cluster_title.eql?(\"Ruby\")\n # # See line 62\n #@full_nodes_available = nodes_info.lines(\"\\n\\n\").select { |node| node.include?(\"dedicated_threads = 0\") && node.include?(\"np = 20\") && node.include?(\"gpu_state=Unallocated\")}.size\n #else\n #@full_nodes_available = nodes_info.lines(\"\\n\\n\").select { |node| node.include?(\"dedicated_threads = 0\") && node.include?(\"gpu_state=Unallocated\") }.size\n #end\n end",
"def reload_pool_nodes_unsync\n if @hosts.is_a?(Array)\n create_multi_node_pool\n refresh_startup_nodes\n else\n create_single_node_pool\n end\n end",
"def find_applying_nodes(hosts, statuses = [])\n Log.debug(\"checking applying status of #{hosts.inspect}\")\n @client.filter[\"identity\"].clear\n hosts.each do |host|\n @client.identity_filter(host)\n end\n\n results = @client.status\n\n hosts.each do |host|\n result = results.select { |r| r[:sender] == host }.first\n status = statuses.select { |s| s[:name] == host }.first\n\n unless status\n status = make_status(host)\n statuses << status\n end\n\n if result\n # check the value of applying as defined in the agent ddl\n if result[:data][:applying] == true\n # we're applying\n if result[:data][:initiated_at]\n # it's a new agent, we can record when it started\n Log.debug(\"#{host} run was started at #{result[:data][:initiated_at]}\")\n status[:initiated_at] = result[:data][:initiated_at]\n else\n Log.debug(\"#{host} run started\")\n end\n else\n # Here we check the \"asked to run but not yet started\" state.\n if result[:data][:lastrun].to_i >= status[:initiated_at]\n Log.debug(\"#{host} run completed\")\n # The node has finished applying, remove from the running set\n statuses.reject! { |s| s[:name] == host }\n next\n else\n # We haven't started yet that we can see, increment the check counter\n status[:checks] += 1\n Log.debug(\"#{host} starting, checks #{status[:checks]}\")\n end\n end\n else\n # We didn't get a result from this host, log and record a check happened\n log(\"Host #{host} did not respond to the status action.\")\n status[:no_response] += 1\n end\n\n if status[:no_response] >= 5\n # If we missed many responses to status, assume it's a dead node\n log(\"Host #{host} failed to respond multiple times. Skipping.\")\n statuses.reject! { |s| s[:name] == host }\n end\n\n if status[:checks] >= 5\n # If we hit more than 5 checks, assume it couldn't start\n log(\"Host #{host} did not move into an applying state. Skipping.\")\n statuses.reject! { |s| s[:name] == host }\n end\n end\n\n return statuses\n end",
"def update_required?(hosts)\n if !@refresh_node || !@refresh_node.active?\n begin\n @refresh_node = get_valid_seed_node\n rescue ConnectionFailure\n warn \"Could not refresh config because no valid seed node was available.\"\n return\n end\n end\n node = @refresh_node\n\n node_list = node.node_list\n\n unconnected_nodes = node_list - hosts\n removed_nodes = hosts - node_list\n\n if unconnected_nodes.empty? && removed_nodes.empty?\n return false\n else\n {:unconnected => unconnected_nodes, :removed => removed_nodes}\n end\n end",
"def update_stats\n # 1. update all board cards lifetime\n @first_player.board_cards.each {|bc| bc.inc_lifetime }\n @second_player.board_cards.each {|bc| bc.inc_lifetime }\n #TODO: 2. should also change board state somehow\n end",
"def nodes\n if self.original_nodes.count == 0 and not new_record?\n self.save # Triggers callback of update_node\n end\n self.original_nodes\n end",
"def reset_stats\n ring.servers.map do |server|\n server.alive? ? server.request(:reset_stats) : nil\n end\n end",
"def sync\n # We replicate our state to the management node(s)\n management_nodes = find_management_nodes\n management_nodes.each do |mng_node|\n remote_db = mng_node.get_node_db\n from_success = @our_node.replicate_from(local_node_db, mng_node, remote_db)\n to_success = @our_node.replicate_to(local_node_db, mng_node, remote_db)\n if from_success && to_success && !our_node.is_management\n break\n end\n end\n end",
"def poll_stats\n curr_time = Time.now\n # After some timeout, send the incremental difference to Hastur\n if curr_time - @last_stat_flush > @stats_interval\n Hastur.counter(\"router.num_msgs\", @num_msgs, curr_time)\n # reset stats\n @num_msgs = 0\n @last_stat_flush = curr_time\n end\n end",
"def stats_refresh(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"stats refresh \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def collect_all_stats()\n\n begin\n logger.info 'collect_all_stats:start: Starting'\n\n cluster_stats_url = \"#{@hostname}/pools/default\"\n bucket_stats_url = \"#{@hostname}/pools/default/buckets\"\n\n time = Time.now\n\n open_tcp_sockets\n\n cluster_stats(cluster_stats_url, time)\n\n bucket_stats(bucket_stats_url, time)\n\n ping_stats(cluster_stats_url, time)\n\n close_tcp_sockets\n\n logger.info 'collect_all_stats:end: Completed'\n rescue Exception => e\n logger.error \"collect_all_stats:exception: #{e}\"\n end\n end",
"def initiate_nodes_upgrade\n upgrade_nodes = Node.all.reject do |node|\n node.admin? || node[:platform] == \"windows\" || node.state != \"crowbar_upgrade\"\n end\n check_if_nodes_are_available upgrade_nodes\n admin_node = Node.admin_node\n upgrade_nodes_failed = []\n\n upgrade_nodes.each do |node|\n node[\"target_platform\"] = admin_node[\"provisioner\"][\"default_os\"]\n node.save\n node.set_state(\"os-upgrading\")\n end\n\n # wait for the pxe_config to be updated, then reboot the nodes\n discovery_dir = \"#{Node.admin_node[:provisioner][:root]}/discovery/\"\n pxecfg_subdir = \"bios/pxelinux.cfg\"\n\n upgrade_nodes.each do |node|\n boot_ip_hex = node[\"crowbar\"][\"boot_ip_hex\"]\n node_arch = node[\"kernel\"][\"machine\"]\n pxe_conf = \"#{discovery_dir}/#{node_arch}/#{pxecfg_subdir}/#{boot_ip_hex}\"\n ready_for_reboot = false\n\n while Time.now.to_i < Time.now.to_i + 120 && !ready_for_reboot\n Rails.logger.debug(\"waiting for pxe configuration to be updated for #{node.name}\")\n if File.file?(pxe_conf)\n File.open(pxe_conf).each_line do |line|\n line.chomp!\n if line =~ /^DEFAULT\\s+.+_install$/\n ready_for_reboot = true\n end\n end.close\n end\n sleep(5) unless ready_for_reboot\n end\n if ready_for_reboot\n Rails.logger.debug(\"Rebooting node #{node.name} for operating system upgrade\")\n ssh_status = node.ssh_cmd(\"/sbin/reboot\")\n if ssh_status[0] != 200\n Rails.logger.error(\"Upgrade failed for machine #{node.name}. Could not ssh.\")\n upgrade_nodes_failed.push(node.name)\n end\n else\n Rails.logger.error(\"Upgrade failed for #{node.name}. Node not ready for reboot\")\n upgrade_nodes_failed.push(node.name)\n end\n end\n # If list is empty, this method was successful.\n upgrade_nodes_failed\n end",
"def reset_dns_statistics\n super\n end",
"def send_node_stats(node_ip)\n metrics_queue = Librato::Metrics::Queue.new\n\n cadvisor_res = Typhoeus.get(\"http://#{node_ip}:4194/api/v1.3/docker/\")\n data = Oj.load(cadvisor_res.body)\n\n data.values.each do |container|\n # Skip containers that aren't managed by kube:\n next if container['spec']['labels'].nil?\n\n # Parse the container name out of the container name auto-generated by kube\n # see https://github.com/kubernetes/heapster/blob/78ff89c01f52c0ab49dac2d356a8371e79482544/sources/datasource/kubelet.go#L156 \n container_name = container['aliases'].first.split('.').first.sub('k8s_','')\n\n # Join all of this together into a librato source name:\n source_name = ENV['CONTEXT'] + '.' + container['spec']['labels']['io.kubernetes.pod.name'].sub('/', '.') + '.' + container_name\n\n puts source_name\n\n stats = container['stats'].last\n\n # k8s_POD form the virtual network for a pod. We must collect net stats from this container,\n # since net counters for indvidual pod containers are always 0. See http://stackoverflow.com/questions/33472741/what-work-does-the-process-in-container-gcr-io-google-containers-pause0-8-0-d\n # for more info. No need to collect memory and cpu stats for this container.\n if container_name == 'POD'\n metrics_queue.add \"kube.network.tx_bytes\" => { type: :counter, value: stats['network']['tx_bytes'], source: source_name }\n metrics_queue.add \"kube.network.rx_bytes\" => { type: :counter, value: stats['network']['rx_bytes'], source: source_name }\n next\n end\n\n if stats['cpu']\n cpu_ms = stats['cpu']['usage']['total'] / 1000000\n metrics_queue.add \"kube.cpu.usage_ms\" => { type: :counter, value: cpu_ms, source: source_name }\n end\n \n if stats['memory']\n metrics_queue.add \"kube.memory.usage\" => { value: stats['memory']['usage'], source: source_name }\n metrics_queue.add \"kube.memory.rss\" => { value: stats['memory']['working_set'], source: source_name }\n end\n end\n\n metrics_queue.submit\nend",
"def on_appear\n @update = true\n unless @checkingCheckins\n update_checkins\n end\n unless @pinging\n location_ping\n end\n @frequency = 20\n end",
"def find_nodes\n puts '1st pass: find nodes'\n find :nodes\n self\n end",
"def updateStats\n \n totalDays = 0\n\n @week.days.each do |day|\n if day.wr\n totalDays += 1\n updateTempValues(day.oTotal, day.dTotal)\n end\n end\n\n assignStats(totalDays)\n\n end",
"def update\n # center force (pull nodes to center)\n @nodes.each do |n|\n n.apply_momentum(Force.center_mom(PVector.sub(n.loc, @center)))\n # apply field force (push nodes apart)\n @nodes.each do |n2|\n n.apply_momentum(Force.field_mom(PVector.sub(n.loc, n2.loc))) unless n == n2\n end\n end\n \n # edge forces (pull connected nodes to each other)\n @edges.each do |e|\n e.from.apply_momentum(Force.edge_mom(PVector.sub(e.to.loc, e.from.loc), e.strength))\n end\n \n # move the nodes\n @nodes.each { |n| n.update }\n end",
"def stats_loop\n sleep 5\n loop do\n @launcher.events.debug \"statsd: notify statsd\"\n begin\n stats = PumaStats.new(fetch_stats)\n @statsd.client.gauge('puma_workers', stats.workers)\n @statsd.client.gauge('puma_booted_workers', stats.booted_workers)\n @statsd.client.gauge('puma_backlog', stats.backlog)\n @statsd.client.gauge('puma_running', stats.running)\n @statsd.client.gauge('puma_pool_capacity', stats.pool_capacity)\n @statsd.client.gauge('puma_max_threads', stats.max_threads)\n rescue StandardError => e\n @launcher.events.error \"! statsd: notify stats failed:\\n #{e.to_s}\\n #{e.backtrace.join(\"\\n \")}\"\n ensure\n sleep 2\n end\n end\n end",
"def run( nodes )\n\t\t\tself.log.debug \"Got %d nodes to check with %p\" % [ nodes.length, self ]\n\t\t\tlookups = self.create_lookups( nodes )\n\t\t\treturn self.wait_for_responses( lookups, nodes )\n\t\tend",
"def update!(**args)\n @node_ip = args[:node_ip] if args.key?(:node_ip)\n @pod_count = args[:pod_count] if args.key?(:pod_count)\n end",
"def update!(**args)\n @node_ip = args[:node_ip] if args.key?(:node_ip)\n @pod_count = args[:pod_count] if args.key?(:pod_count)\n end",
"def update_stats\n t = Time.now; log_me \"GAMERTAG UPDATE :: #{name} :: STARTED\"\n @front_page = get_page(bungie_net_front_page_url) if @front_page.blank?\n @career = get_page(bungie_net_career_url) if @career.blank?\n \n update_front_page_stats\n update_ranked_stats\n update_social_stats\n update_weapon_stats\n update_medals\n self.save\n \n @front_page, @career = nil, nil\n log_me \"GAMERTAG UPDATE :: #{name} :: DONE! (#{Time.now - t}s)\"\n return self\n end",
"def nostats!\n @stats = false\n end",
"def synchronize\n discovery.discover(repo_id) do\n end\n end",
"def update_status\n @servers.each do |type|\n begin\n @server_status.send(\"#{type}_reinitialize\") # re-ping the server\n @status[type] = @server_status.send(\"#{type}_all_info\")\n\n # All sorts of invalid input can potentially cause an error. Whatever it is, just make sure we return a valid object.\n rescue Exception => e\n warn \"[#{Time.now}] #{e.inspect}\"\n e.backtrace.each do |msg|\n warn \"[#{Time.now}] #{msg}\"\n end\n @status[type] = {}\n end\n end\n end",
"def refresh_server_summary\n assert_privileges(\"refresh_server_summary\")\n get_node_info(x_node)\n replace_right_cell(:nodetype => x_node)\n end",
"def scan(current_node, options = {})\n options = {:continual => true}.merge(options)\n uri = URI.parse(current_node.address)\n \n if ADDRESS =~ current_node.address\n address_template = \"#{uri.scheme}://#{$1}.#{$2}.#{$3}.%i:#{Merb.config[:scan_port]}/\"\n path = \"nodes\"\n params = {:address => current_node.address}\n \n 10.upto(240) do |n| # port ranges to test over\n \n address = address_template % n\n Merb.logger.debug(\"Scanning #{address}...\")\n \n begin\n response = nil\n \n Timeout.timeout(1) do\n response = Net::HTTP.post_form(URI.parse(address+path), params)\n end\n \n if Net::HTTPCreated === response\n Merb.logger.debug(\"Positive match on #{address}!\")\n unless node = Node.first(:address => address)\n node = Node.new(:address => address)\n end\n node.save\n end\n rescue Errno::ECONNREFUSED => e\n Merb.logger.debug(\"Connection refused to #{address}.\")\n rescue Errno::EHOSTUNREACH => e\n Merb.logger.debug(\"Host unreachable for #{address}.\")\n rescue Errno::ETIMEDOUT => e\n Merb.logger.debug(\"#{address} timed out.\")\n rescue Timeout::Error => e\n Merb.logger.debug(\"Failed to match on #{address}.\")\n end\n \n end\n end\n \n if options[:continual]\n sleep 60*5\n self.detach_and_scan(current_node)\n end\n end",
"def refresh_all\n success_count = 0\n error_count = 0\n Topic.find_all_external.each do |topic|\n permalink = topic.permalink\n begin\n refresh_topic(topic)\n success_count += 1\n rescue\n log.error \"Error refreshing news for '#{permalink}': #{$!}\"\n error_count += 1\n end\n end #each\n if error_count > 0\n STDERR.puts \"*** #{error_count} errors occurred while refreshing \" +\n \"the news data.\"\n STDERR.puts \"See the intranet log for details.\"\n end #if\n log.info \"#{success_count} news topics were updated successfully.\"\n end",
"def cluster_stats(url, time)\n\n logger.info \"cluster_stats:start: url = #{url}, time = #{time.to_i}\"\n\n jsonResponse = rest_call(url)\n response_hash = JSON.parse(jsonResponse)\n #puts response_hash\n node_count = response_hash['nodes'].count\n nodes = response_hash['nodes']\n\n #puts \"Total number of nodes in the cluster = #{node_count.to_s}\"\n\n #rebalance status in the cluster\n rebalanceStatus = response_hash['rebalanceStatus']\n rebalance = rebalanceStatus.eql?('none') ? 0 : 1\n\n #ram metrics in the cluster\n ram_total = response_hash['storageTotals']['ram']['total']\n ram_quota_total = response_hash['storageTotals']['ram']['quotaTotal']\n ram_quota_used = response_hash['storageTotals']['ram']['quotaUsed']\n ram_used = response_hash['storageTotals']['ram']['used']\n ram_used_by_data = response_hash['storageTotals']['ram']['usedByData']\n ram_quota_used_per_node = response_hash['storageTotals']['ram']['quotaUsedPerNode']\n ram_quota_total_per_node = response_hash['storageTotals']['ram']['quotaTotalPerNode']\n\n #cluster RAM level stats\n write_to_graphite( construct_metric_name('rebalance', CONST_CLUSTER_LEVEL), rebalance, time)\n write_to_graphite( construct_metric_name('ram_total', CONST_CLUSTER_LEVEL), ram_total.to_s, time)\n write_to_graphite( construct_metric_name('ram_quota_total', CONST_CLUSTER_LEVEL), ram_quota_total.to_s, time)\n write_to_graphite( construct_metric_name('ram_quota_used', CONST_CLUSTER_LEVEL), ram_quota_used.to_s, time)\n write_to_graphite( construct_metric_name('ram_used', CONST_CLUSTER_LEVEL), ram_used.to_s, time)\n write_to_graphite( construct_metric_name('ram_used_by_data', CONST_CLUSTER_LEVEL), ram_used_by_data.to_s, time)\n write_to_graphite( construct_metric_name('ram_quota_used_per_node', CONST_CLUSTER_LEVEL), ram_quota_used_per_node.to_s, time)\n write_to_graphite( construct_metric_name('ram_quota_total_per_node', CONST_CLUSTER_LEVEL), ram_quota_total_per_node.to_s, time)\n\n #HDD metrics in the cluster\n hdd_total = response_hash['storageTotals']['hdd']['total']\n hdd_quota_total = response_hash['storageTotals']['hdd']['quotaTotal']\n hdd_used = response_hash['storageTotals']['hdd']['used']\n hdd_used_by_data = response_hash['storageTotals']['hdd']['usedByData']\n hdd_free = response_hash['storageTotals']['hdd']['free']\n\n #cluster HDD level stats\n write_to_graphite( construct_metric_name('hdd_total', CONST_CLUSTER_LEVEL), hdd_total.to_s, time)\n write_to_graphite( construct_metric_name('hdd_quota_total', CONST_CLUSTER_LEVEL), hdd_quota_total.to_s, time)\n write_to_graphite( construct_metric_name('hdd_used', CONST_CLUSTER_LEVEL), hdd_used.to_s, time)\n write_to_graphite( construct_metric_name('hdd_used_by_data', CONST_CLUSTER_LEVEL), hdd_used_by_data.to_s, time)\n write_to_graphite( construct_metric_name('hdd_free', CONST_CLUSTER_LEVEL), hdd_free.to_s, time)\n\n nodes.each do |node|\n\n #systemStats\n swap_total = node['systemStats']['swap_total']\n swap_used = node['systemStats']['swap_used']\n mem_total = node['systemStats']['mem_total']\n mem_free = node['systemStats']['mem_free']\n\n #interestingStats\n cmd_get = node['interestingStats']['cmd_get']\n couch_docs_actual_disk_size = node['interestingStats']['couch_docs_actual_disk_size']\n couch_docs_data_size = node['interestingStats']['couch_docs_data_size']\n curr_items = node['interestingStats']['curr_items']\n curr_items_tot = node['interestingStats']['curr_items_tot']\n ep_bg_fetched = node['interestingStats']['ep_bg_fetched']\n get_hits = node['interestingStats']['get_hits']\n mem_used = node['interestingStats']['mem_used']\n ops = node['interestingStats']['ops']\n vb_replica_curr_items = node['interestingStats']['vb_replica_curr_items']\n\n clusterMembership = node['clusterMembership']\n status = node['status']\n otpNode = node['otpNode']\n otpNode = otpNode.gsub('.','-')\n\n\n if (status =='healthy' && clusterMembership == 'active' )\n @healthy_nodes += 1\n end\n\n if (clusterMembership == 'inactiveFailed' )\n @failover_nodes += 1\n end\n\n #node level systemStats\n write_to_graphite( construct_metric_name(\"#{otpNode}.swap_total\", CONST_NODE_LEVEL), swap_total.to_s, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.swap_used\", CONST_NODE_LEVEL), swap_used.to_s, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.mem_total\", CONST_NODE_LEVEL), mem_total.to_s, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.mem_free\", CONST_NODE_LEVEL), mem_free.to_s, time)\n\n\n #node level interestingStats\n write_to_graphite( construct_metric_name(\"#{otpNode}.cmd_get\", CONST_NODE_LEVEL), cmd_get, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.couch_docs_actual_disk_size\", CONST_NODE_LEVEL), couch_docs_actual_disk_size, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.couch_docs_data_size\", CONST_NODE_LEVEL), couch_docs_data_size, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.curr_items\", CONST_NODE_LEVEL), curr_items)\n write_to_graphite( construct_metric_name(\"#{otpNode}.curr_items_tot\", CONST_NODE_LEVEL), curr_items_tot, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.ep_bg_fetched\", CONST_NODE_LEVEL), ep_bg_fetched, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.get_hits\", CONST_NODE_LEVEL), get_hits, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.mem_used\", CONST_NODE_LEVEL), mem_used, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.ops\", CONST_NODE_LEVEL), ops, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.vb_replica_curr_items\", CONST_NODE_LEVEL), vb_replica_curr_items, time)\n\n end\n\n\n healthy = nodes.length == @healthy_nodes ? 1 : 0\n write_to_graphite( construct_metric_name('healthy_node_num', CONST_CLUSTER_LEVEL), @healthy_nodes.to_s, time)\n write_to_graphite( construct_metric_name('node_num', CONST_CLUSTER_LEVEL), nodes.length.to_s, time)\n write_to_graphite( construct_metric_name('healthy', CONST_CLUSTER_LEVEL), healthy.to_s, time)\n\n logger.info 'cluster_stats:end: Completed'\n end",
"def discover\n init!\n after(discovery_interval + (discovery_jitter * rand)){ discover }\n end",
"def discover\n init!\n after(discovery_interval + (discovery_jitter * rand)){ discover }\n end",
"def update_hosts_info()\n all_nodes = \"\"\n @nodes.each_with_index { |node, index|\n all_nodes << \"#{HelperFunctions.convert_fqdn_to_ip(node.private_ip)} appscale-image#{index}\\n\"\n }\n \n new_etc_hosts = <<HOSTS\n127.0.0.1 localhost.localdomain localhost\n127.0.1.1 localhost\n::1 ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0 ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\nff02::3 ip6-allhosts\n#{all_nodes}\nHOSTS\n\n etc_hosts = \"/etc/hosts\"\n File.open(etc_hosts, \"w+\") { |file| file.write(new_etc_hosts) } \n\n etc_hostname = \"/etc/hostname\"\n my_hostname = \"appscale-image#{@my_index}\"\n File.open(etc_hostname, \"w+\") { |file| file.write(my_hostname) }\n\n Djinn.log_run(\"/bin/hostname #{my_hostname}\")\n end",
"def get_stats\n end_reg = /<\\/All_Nodes>/\n start_reg = /<All_Nodes>/\n lines = get_command_response(command: \"sgnodes all\", start_reg: start_reg, end_reg: end_reg)\n xml_string = lines.join(\"\\n\")\n stats = {\"Total\" => {count: 0}}\n doc = Nokogiri::XML(xml_string)\n handle_node(stats: stats, node: doc.root)\n stats\n end",
"def update\n if @node.update(node_params)\n # initiate service object to process node minimum quantity requirements\n NodeOrderInitiatorService.call(node_id: @node.id)\n render json: {}, status: :ok\n else\n # bug report about the node not able to update itself\n render json: {errors: @node.errors.messages}, status: 400\n end\n end",
"def live \n #@nodes = Node.all\n @live_now = Schedule.live_now\n\n @live_now.each do |l|\n if l.custom_type.empty?\n @nodes = Node.find(:all, :limit => 1, :order => \"updated_at ASC\")\n else\n @nodes = []\n begin\n @nodes << Node.find(l.custom_type)\n rescue\n @nodes <<[]\n end\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nodes }\n end\n end",
"def test_nodes_added_to_graph\r\n\r\n @place_holder.login_goto_profile(@provider_url)\r\n\r\n # Click on the link to add the nodes to the graph\r\n @place_holder.add_to_graph\r\n\r\n # Verify that the expected nodes for the provider are on the graph\r\n # Until there is\r\n #@place_holder.assert_nodes_on_provider_graph\r\n\r\n # Verify that the node count on the graph matches\r\n message = \"node count when they are sent to the graph initially from the profile of #{@provider_node_message}\"\r\n @place_holder.assert_actual_node_count(PropertiesReader.get_expected_initial_node_count, message)\r\n\r\n end",
"def start\n if @supernode_table.empty?\n # The supernode table is empty, so this node is probably \n # starting and not promoted to supernode mode.\n \n # NOTE The +attempt_fetch_supernodes+ will block if no \n # supernode is found. Since supernodes should still work \n # even there is no other active supernodes, a thread is created\n # here. So it can still accept connections from other ordinary\n # nodes.\n Thread.new do \n # 1. Get supernodes from cache or bootstrap node\n Routing.log {|logger| logger.info(self.class) {'1. Getting SNs ...'}}\n sns = attempt_fetch_supernodes\n # 2. Connect to supernodes\n Routing.log {|logger| logger.info(self.class) {'2. Connecting to SNs ...'}}\n connect_supernodes(sns)\n end\n else\n # It is promoted to supernode mode.\n @supernode_table.supernodes.each do |sn|\n @lock.synchronize { @socks << sn.socket }\n end\n end\n\n # 3. Start the background threads\n @request_supernode_thread = start_request_supernodes_thread\n @compute_hits_thread = start_compute_hits_thread\n\n # 4. Create the server socket and handle incoming messages\n @server = TCPServer.open(@driver.config['listening_port'].to_i)\n @socks << @server\n @running = true\n while @running\n # Wait for messages from other nodes\n ready = select(@socks,nil,nil,@timeout)\n readable = ready[0]\n\n unless readable.nil?\n readable.each do |sock|\n if sock == @server # Accept new client\n client = @server.accept\n accepted = on_handshaking(client)\n if accepted\n @lock.synchronize { @socks << client }\n else\n client.close\n end\n elsif sock.eof? # Socket has disconnected\n Routing.log {|logger| logger.info(self.class) {'Socket has disconnected.'}}\n @lock.synchronize {@socks.delete(sock)}\n # Remove it if it is in supernode table\n @supernode_table.delete(sock.node) if @supernode_table.include?(sn.node)\n sock.close\n else # Message is ready for reading\n msg = @protocol.read_message(sock)\n unless msg.nil?\n @bandwidth_manager.downloaded(msg.bytesize,Time.now-message.ftime.to_time) unless @bandwidth_manager.nil?\n handle_message(msg,sock)\n else\n Routing.log {|logger| logger.error(self.class) {'The message read is nil.'}}\n end\n end\n end\n else # Timeout\n @socks.delete_if do |sock|\n sock.closed? # Discarded by supernode table\n end\n end\n end\n end",
"def nodes_percent\n (nodes_used.to_f / nodes_avail.to_f) * 100\n end",
"def run( nodes )\n\t\t\tself.log.debug \"Got nodes to check with %p: %p\" % [ self, nodes ]\n\n\t\t\trecords = nodes.each_with_object( {} ) do |(identifier, node), hash|\n\t\t\t\tself.log.debug \"Looking up whois info for %p (%p)\" % [ identifier, node ]\n\t\t\t\thash[ identifier ] = self.client.lookup( node['name'] )\n\t\t\tend\n\n\t\t\treturn records.each_with_object( {} ) do |(identifier, record), hash|\n\t\t\t\tparser = record.parser\n\t\t\t\thash[ identifier ] = self.parse_record( parser, identifier )\n\t\t\tend\n\n\t\tend",
"def process_all_nodes\n debug 'Start processing all nodes'\n hook 'pre_all'\n each_node do |node|\n process_node node\n end\n hook 'post_all'\n end",
"def index\n @sum = 0\n session[:node] = params[:name]\n if params.has_key?(:role)\n result = NodeObject.all #this is not efficient, please update w/ a search!\n @nodes = result.find_all { |node| node.role? params[:role] }\n if params.has_key?(:names_only)\n names = @nodes.map { |node| node.handle }\n @nodes = {:role=>params[:role], :nodes=>names, :count=>names.count}\n end\n else\n @groups = {}\n @nodes = {}\n raw_nodes = NodeObject.all\n get_node_and_network(params[:selected]) if params[:selected]\n raw_nodes.each do |node|\n @sum = @sum + node.name.hash\n @nodes[node.handle] = { :alias=>node.alias, :description=>node.description, :status=>node.status }\n group = node.group\n @groups[group] = { :automatic=>!node.display_set?('group'), :status=>{\"ready\"=>0, \"failed\"=>0, \"unknown\"=>0, \"unready\"=>0, \"pending\"=>0}, :nodes=>{} } unless @groups.key? group\n @groups[group][:nodes][node.group_order] = node.handle\n @groups[group][:status][node.status] = (@groups[group][:status][node.status] || 0).to_i + 1\n if node.handle === params[:name]\n @node = node\n get_node_and_network(node.handle)\n end\n end\n flash[:notice] = \"<b>#{t :warning, :scope => :error}:</b> #{t :no_nodes_found, :scope => :error}\" if @nodes.empty? #.html_safe if @nodes.empty?\n end\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @nodes }\n format.json { render :json => @nodes }\n end\n end",
"def populate_sources_stats\n # Iterate over each of a user's links, adding to the count of the corresponding source\n @user.links.all.each { |link| @sources_stats[link.source.name] += 1 }\n end",
"def nodes= nodes\n @grpc.node_count = nodes\n end",
"def reload_ldp\n return reload unless !node? && exists?\n clear\n self << RDF::Reader.for(:ttl).new(@http_cache.body).statements\n end",
"def perform\n new_stat_index, prev_stat_index = find_indexes\n return if new_stat_index == prev_stat_index\n\n if new_stat_index >= 0\n stats_to_add = most_recent_ordered_stats[prev_stat_index..new_stat_index] if new_stat_index > prev_stat_index\n stats_to_remove = most_recent_ordered_stats[new_stat_index..prev_stat_index] if prev_stat_index > new_stat_index\n elsif prev_stat_index > 0\n # remove one from the previous stats, as they are now invalid\n last_stat_date = most_recent_ordered_stats.first.end_time\n if new_date > last_stat_date\n stats_to_remove = most_recent_ordered_stats[0..prev_stat_index]\n else\n # new date is in the past, add to all stats up to the prev stat\n stats_to_add = most_recent_ordered_stats[(prev_stat_index + 1)..-1]\n end\n end\n\n stats_to_add&.each { |stat| update_stat('add', stat) }\n stats_to_remove&.each { |stat| update_stat('remove', stat) }\n end",
"def reload\n restart_and_ping\n end",
"def attempt_fetch_supernodes\n interval = 10 # inital interval\n incr = 30 # Incrementation\n sns = fetch_supernodes\n while sns.empty?\n Routing.log {|logger| logger.error(self.class) { \"No supernode. Retry in #{interval} seconds\"}}\n Thread.current.sleep(interval)\n interval += incr\n sns = fetch_supernodes\n end\n sns\n end",
"def refresh_metrics()\n # Only run this on the master\n return unless Config.metrics\n return if not Cluster.is_master?\n Fiber.new {\n Logger.debug log_message(\"Calculating metrics.\")\n # Retrieve last timestamp\n f = Fiber.current\n resp = variables.find_one(_id: 'metrics.last_timestamp')\n resp.callback do |doc|\n f.resume doc\n end\n resp.errback do |err|\n raise *err\n end\n last_timestamp_record = Fiber.yield \n last_timestamp = if last_timestamp_record.nil?\n 0\n else\n last_timestamp_record['timestamp']\n end\n new_timestamp = Time.now.to_i\n work_data.map_reduce(\n map_function,\n reduce_function,\n {\n query: {timestamp: {'$gte' => last_timestamp}},\n out: {reduce: 'slanger.metrics.data'}\n }\n )\n # Save timestamp\n variables.update(\n {_id: 'metrics.last_timestamp'},\n {'$set' => {timestamp: new_timestamp}},\n {upsert: true}\n )\n }.resume\n end",
"def scan_now\n #Check for add/modify\n scan_dir(@directory)\n \n # Check for removed files\n if @on_remove.respond_to?( :call )\n @known_file_stats.each_pair{ |path,stats|\n next if File.file?( path )\n stats[:path] = path\n @on_remove.call( stats )\n @known_file_stats.delete(path)\n }\n end\n \n @scanned_once = true\n end"
] |
[
"0.7586017",
"0.6404108",
"0.6243333",
"0.6238122",
"0.6201604",
"0.612079",
"0.61026865",
"0.6024497",
"0.60125273",
"0.593072",
"0.5886217",
"0.5877398",
"0.5859355",
"0.5840527",
"0.5827332",
"0.58256435",
"0.579957",
"0.57888585",
"0.5774592",
"0.5723694",
"0.5711678",
"0.57064956",
"0.57019717",
"0.569533",
"0.5686743",
"0.567924",
"0.56451815",
"0.5565083",
"0.55380523",
"0.5476525",
"0.544048",
"0.54371023",
"0.54291165",
"0.5417764",
"0.5417424",
"0.5399809",
"0.5385376",
"0.5363852",
"0.5327398",
"0.53220415",
"0.53006667",
"0.5298628",
"0.529334",
"0.5280801",
"0.52711034",
"0.52653176",
"0.5251559",
"0.52468765",
"0.5243993",
"0.52361876",
"0.5213078",
"0.52096754",
"0.52071375",
"0.52037",
"0.5203061",
"0.51941335",
"0.5193259",
"0.5184473",
"0.5181536",
"0.5174285",
"0.51736104",
"0.5150165",
"0.51466715",
"0.5143805",
"0.5137863",
"0.51290756",
"0.5127778",
"0.5123389",
"0.5120606",
"0.5112791",
"0.5112536",
"0.5112536",
"0.5111344",
"0.5104274",
"0.5089609",
"0.5089452",
"0.5088948",
"0.50875866",
"0.50848544",
"0.5083077",
"0.5081981",
"0.5081981",
"0.50785315",
"0.507658",
"0.507564",
"0.5074253",
"0.5065136",
"0.5063692",
"0.5063657",
"0.50603276",
"0.50542325",
"0.505251",
"0.5050847",
"0.50487167",
"0.5042908",
"0.50376016",
"0.5037274",
"0.5037058",
"0.5028489",
"0.5017005"
] |
0.70602787
|
1
|
Check if, we should try to discover new bdrb servers
|
def time_to_discover?
if((@request_count%10 == 0) or (Time.now > (@last_polled_time + 10.seconds)))
@last_polled_time = Time.now
return true
else
return false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def check_server\n raise Exception.new(\"Could not reach Apocalypse server please check the address and port and try again.\") unless server_reachable?\n end",
"def unavailable_servers_check\n # Return unless there are servers that are unavailable.\n return unless @unavailable_servers&.positive?\n\n LOGGER.warn(\"#{@unavailable_servers} servers haven't been cached yet.\")\n LOGGER.warn('Servers may be unavailable due to an outage, or your bot is on very large servers that are taking a while to load.')\n end",
"def server_found!\n @not_found = false\n @requests.keys.each do |request_id|\n msg, blk = @requests.delete request_id\n @client.aquire_connection.send_command(msg, request_id, &blk)\n end\n end",
"def check_connection_health\n begin\n seeds = @connection['config']['mongos'].find.to_a.map{|doc| doc['_id']}\n if @seeds != seeds\n @seeds = seeds\n @refresh_required = true\n end\n rescue Mongo::OperationFailure\n @refresh_required = true\n end\n end",
"def server_is_available?\n return true\n !@http_client.send_request(:get, \"#{@configuration.protocol}://#{@configuration.host}:#{@configuration.port}\", nil, {:timeout => 5}).nil?\n end",
"def detect_failure\n time = Time.now\n server = server_structs.detect do |server|\n server.next_retry > time\n end\n inspect_server(server) if server\n end",
"def check_rbs_availability!; end",
"def discover_ironfan!\n self.servers\n end",
"def find_server!\n @client.clients.each do |client|\n client.force_status! do |status|\n if status == :primary && [:primary, :primary_preferred, :secondary_preferred].include?(@client.read_pref)\n @pending_server = false\n server_found!\n elsif status == :secondary && [:secondary, :primary_preferred, :secondary_preferred].include?(@client.read_pref)\n @pending_server = false\n server_found!\n end\n end\n end\n end",
"def update_job_servers\n # Check if it's been > TIME_BETWEEN_CHECKS or we have no good servers\n return unless time_to_check_connections || @job_servers.empty?\n\n logger.debug \"Found #{@bad_servers.size} zombie connections, checking pulse.\"\n @servers_mutex.synchronize do\n @bad_servers.each do |connection|\n begin\n message = \"Testing server #{connection}...\"\n if connection.is_healthy?\n logger.debug \"#{message} Connection is healthy, putting back into service\"\n activate_connection(connection)\n else\n logger.debug \"#{message} Still down.\"\n end\n end\n end\n end\n\n # Sleep for a few to allow a chance for the world to become sane\n if @job_servers.empty?\n logger.warn \"No job servers available, sleeping for #{SLEEP_TIME} seconds\"\n sleep(SLEEP_TIME)\n end\n\n @last_check_time = Time.now\n end",
"def server_reachable?\n puts \"Checking #{@address}:#{@port}\"\n res = Net::HTTP.start(@address, @port) {|http| http.get('/') }\n return res.code == \"200\"\n end",
"def discovered_servers\n server_pool.select {|s| s[:discovered] }\n end",
"def find_next_except_these connections\n invalid_connections = @backend_connections.select { |x| connections.include?(x.server_info) }\n @backend_connections.delete_if { |x| connections.include?(x.server_info) }\n @round_robin = (0...@backend_connections.length).to_a\n invalid_connections.each do |x|\n @disconnected_connections[x.server_info] = x\n end\n chosen = @backend_connections.detect { |x| !(connections.include?(x.server_info)) }\n raise NoServerAvailable.new(\"No BackgrounDRb server is found running\") unless chosen\n chosen\n end",
"def server_probably_launched?\n success? || server_error?\n end",
"def _check_wildcard(suffix)\n _log \"Checking for wildcards on #{suffix}.\"\n\n all_discovered_wildcards = []\n # First we look for a single address that won't exist\n 10.times do\n random_string = \"#{(0...8).map { (65 + rand(26)).chr }.join.downcase}.#{suffix}\"\n resolved_address = _resolve(random_string)\n\n # keep track of it unless we already have it\n unless resolved_address.nil? || all_discovered_wildcards.include?(resolved_address)\n all_discovered_wildcards << resolved_address\n end\n end\n\n # If that resolved, we know that we're in a wildcard situation.\n #\n # Some domains have a pool of IPs that they'll resolve to, so\n # let's go ahead and test a bunch of different domains to try\n # and collect those IPs\n if all_discovered_wildcards.uniq.count > 1\n _log \"Multiple wildcard ips for #{suffix} after resolving these: #{all_discovered_wildcards}.\"\n _log \"Trying to create an exhaustive list.\"\n\n # Now we have to test for things that return a block of addresses as a wildcard.\n # we to be adaptive (to a point), so let's keep looking in chuncks until we find\n # no new ones...\n no_new_wildcards = false\n\n until no_new_wildcards\n _log \"Testing #{all_discovered_wildcards.count * 20} new entries...\"\n newly_discovered_wildcards = []\n\n (all_discovered_wildcards.count * 20).times do |x|\n random_string = \"#{(0...8).map { (65 + rand(26)).chr }.join.downcase}.#{suffix}\"\n resolved_address = _resolve(random_string)\n\n # keep track of it unless we already have it\n unless resolved_address.nil? || newly_discovered_wildcards.include?(resolved_address)\n newly_discovered_wildcards << resolved_address\n end\n end\n\n # check if our newly discovered is a subset of all\n if (newly_discovered_wildcards - all_discovered_wildcards).empty?\n _log \"Hurray! No new wildcards in #{newly_discovered_wildcards}. Finishing up!\"\n no_new_wildcards = true\n else\n _log \"Continuing to search, found: #{(newly_discovered_wildcards - all_discovered_wildcards).count} new results.\"\n all_discovered_wildcards += newly_discovered_wildcards.uniq\n end\n\n _log \"Known wildcard count: #{all_discovered_wildcards.uniq.count}\"\n _log \"Known wildcards: #{all_discovered_wildcards.uniq}\"\n end\n\n elsif all_discovered_wildcards.uniq.count == 1\n _log \"Only a single wildcard ip: #{all_discovered_wildcards.sort.uniq}\"\n else\n _log \"No wildcard detected! Moving on!\"\n end\n\n all_discovered_wildcards.uniq # if it's not a wildcard, this will be an empty array.\n end",
"def doi_server_reachable?\n Ezid::Client.new.server_status.up? rescue false\n end",
"def doi_server_reachable?\n Ezid::Client.new.server_status.up? rescue false\n end",
"def doi_server_reachable?\n Ezid::Client.new.server_status.up? rescue false\n end",
"def auto_discover_nodes!\n @servers = execute(:all_nodes)\n end",
"def servers\n server_structs.each do |server|\n def server.alive?\n next_retry <= Time.now\n end\n end\n end",
"def check_in\n defaults = OSX::NSUserDefaults.standardUserDefaults\n server_host = defaults.stringForKey(\"server_host\")\n server_port = defaults.integerForKey(\"server_port\")\n \n drb_url = \"druby://#{server_host}:#{server_port}\"\n \n OSX::NSLog(\"Trying to connect to #{drb_url}\")\n \n @server = DRbObject.new(nil, drb_url)\n @host = DRb.uri.scan(/druby:\\/\\/(.*):\\d*/)[0][0]\n begin\n @server.check_in @host\n OSX::NSLog(\"Connected to server\")\n rescue\n @server = nil\n OSX::NSLog(\"Couldn't connect to server: #{$!}\")\n end\n end",
"def exists_on_server?\n false\n end",
"def started?\n server_exist = false\n begin\n @soc = UDPSocket.open\n @soc.bind(\"\", DiscoverableServer::DEFAULT_PORT)\n @soc.close\n rescue Errno::EADDRINUSE\n server_exist = true\n end\n\n server_exist\n end",
"def server_in_pool?( host, port )\n server_list = servers\n !server_list.select{ |s| s[:addr] == host and s[:port] == port.to_i}.empty?\n end",
"def lookup_server_uri\n server_lookup_attempts.times do\n first_alive_listing = service_directory.all_listings_for(service).find do |listing|\n host_alive?(listing.try(:address))\n end\n\n if first_alive_listing\n host = first_alive_listing.try(:address)\n port = first_alive_listing.try(:port)\n @stats.server = [port, host]\n return \"tcp://#{host}:#{port}\"\n end\n\n host = options[:host]\n port = options[:port]\n\n if host_alive?(host)\n @stats.server = [port, host]\n return \"tcp://#{host}:#{port}\"\n end\n\n sleep(1.0 / 100.0)\n end\n\n fail \"Host not found for service #{service}\"\n end",
"def doi_server_reachable?\n # Invoke the API and get response\n true\n end",
"def host_is_okay\n return false unless @report_data[:host]\n return false unless valid_ip(@report_data[:host])\n return false unless @report_data[:state] == Msf::HostState::Alive\n if @args[:blacklist]\n return false if @args[:blacklist].include?(@report_data[:host])\n end\n return true\n end",
"def connection_valid?\n begin\n result = client.call(:fe_dummy).body[:fe_dummy_response][:fe_dummy_result]\n @observations << \"app_server: #{result[:app_server]}, db_server: #{result[:db_server]}, auth_server: #{result[:auth_server]}\"\n result[:app_server] == \"OK\" and result[:db_server] == \"OK\" and result[:auth_server] == \"OK\"\n rescue => e\n @errors << e.message\n @backtrace = e.backtrace\n false\n end\n end",
"def test_centralized_drb_discovery\n\tDRb.stop_service\n\n\tcentral_tuplespace = TupleSpace.new\n\tDRb.start_service 'druby://localhost:1245', central_tuplespace\n\n\tremote_pid = remote_process do\n\t DRb.stop_service\n\t DRb.start_service\n\t central_tuplespace = DRbObject.new_with_uri('druby://localhost:1245')\n\n\t Distributed.state = ConnectionSpace.new :ring_discovery => false, \n\t\t:discovery_tuplespace => central_tuplespace, :plan => plan\n\tend\n\t@local = ConnectionSpace.new :ring_discovery => false, \n\t :discovery_tuplespace => central_tuplespace, :plan => plan\n Distributed.state = local\n\tassert_has_neighbour { |n| n.name == \"#{Socket.gethostname}-#{remote_pid}\" }\n end",
"def after_probe_slaves\n unless @running\n @slaves = Jetpants.topology.class.tracker.determine_slaves(@ip, @port)\n end\n end",
"def does_resolve_to_host?\n mx_records.include? Socket.gethostname\n end",
"def prereqs\n response = getRequest(\"/hosts/#{new_resource.host}\")\n haveHost = response.code.to_i.between?(200,299)\n unless haveHost\n Chef::Log::info \"Can't execute on this resource until host #{new_resource.host} is available\"\n return false\n end\n\n haveService = getRequest(\"/clusters/#{new_resource.cluster}/services/#{new_resource.service}\").code.to_i.between?(200,299)\n unless haveService\n Chef::Log::info \"Can't execute on this resource until service #{new_resource.service} is available\"\n return false\n end \n \n return true\nend",
"def run_reboot_checks\n # one simple check we can do is the backup. Backup can fail if anything is amiss\n @servers.each do |server|\n run_script(\"do_backup\", server)\n end\n end",
"def test_ringserver_discovery\n\tDRb.stop_service\n\n\tremote_pid = remote_process do\n\t DRb.start_service\n\t Distributed.state = ConnectionSpace.new :period => 0.5, :ring_discovery => true, :ring_broadcast => BROADCAST, :plan => plan\n\t Distributed.publish :bind => '127.0.0.2'\n\tend\n\n\tDRb.start_service\n @local = ConnectionSpace.new :period => 0.5, :ring_discovery => true, :ring_broadcast => BROADCAST, :plan => plan\n\tDistributed.state = local\n\tDistributed.publish :bind => '127.0.0.1'\n\n\tassert_has_neighbour { |n| n.name == \"#{Socket.gethostname}-#{remote_pid}\" }\n end",
"def check\n puts\n puts \"Load Apache Balancer-Manager at '#{@balancer_manager_url}'\"\n puts\n puts \"Loading Details\"\n puts\n puts \" Balancer: #{get_balancer_manager.balancer_name}\"\n puts\n get_balancer_manager.hosts_with_status.each{|h,s| puts \" #{h} => #{s}\"}\n\n @live_hosts = get_balancer_manager.enabled_hosts\n puts\n puts \"Checking #{@live_hosts.size} live hosts\"\n puts\n\n @live_hosts.each do |host, state|\n status = check_host(host, @test_page)\n puts \" #{host} is #{status ? 'OK' : 'not responsive. Disabling via BalancerManager.'}\"\n disable_host(host) if !status\n end\n puts\n puts \"#{@live_hosts.size}/#{get_balancer_manager.hosts.size} hosts are enabled\"\n puts\n end",
"def set_timeout\n @not_found = true\n Timeout::timeout(@timeout) do\n while @not_found\n find_server!\n sleep(WAIT)\n end\n end\n rescue Timeout::Error => e\n raise Monga::Exceptions::Disconnected.new \"Can't find appropriate server (all disconnected)\"\n end",
"def relevant?(server)\n server.exists?\n end",
"def setup?\n Crocoduck::Store.server_cluster && \n Crocoduck::Store.server_db && \n Crocoduck::Store.server_collection\n end",
"def servers\n gateway_check\n unavailable_servers_check\n @servers\n end",
"def check_connection\n one_wait = 5\n max_wait = 15\n request = Net::HTTP::Get.new('/selenium-server/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@host, @port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy,\n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy,\n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n p(\"-- ERROR: couldn't connect to Selenium RC on \" + @host)\n return false\n end\n return true\n end",
"def clc_test_server\n puts \"clc_test_server\"\n server = clc_service.servers.find { |s| s.Name == clc_server_name }\n unless server\n server = clc_service.servers.create({\n :Name => clc_server_name\n }.merge(clc_set_test_server_attributes))\n server.wait_for { ready? }\n end\n server\nend",
"def find_orphaned_servers!(site: Site::NoSite, desired_proxy_count: self.max_proxies)\n total_known_proxies = proxies.active.count\n servers_still_building = false\n connection.servers.each do |server|\n if server_is_proxy_type?(server)\n if !server.ready?\n servers_still_building = true\n elsif !Proxy.active.where(:host => server.public_ip_address).exists? \\\n && !recent_decommissions.include?(server.name)\n\n total_known_proxies += 1\n\n save_server server, site\n\n msg = \"Provisioned new proxy #{server.public_ip_address} (#{server.name})\"\n msg += \" for site #{site.name}\" if site.respond_to? 'name'\n Activity << msg\n end\n end\n end\n if total_known_proxies < desired_proxy_count || servers_still_building\n schedule_orphan_search(site, desired_proxy_count)\n end\n end",
"def reachable?\n ping\n true\n rescue Orocos::ComError\n false\n end",
"def setup_done?\n Pillar.exists? pillar: Pillar.all_pillars[:apiserver]\n end",
"def bds_resolvable?\n begin\n Rex::Socket.resolv_to_dotted(datastore['DOMAIN'])\n rescue RuntimeError, SocketError\n return false\n end\n\n true\n end",
"def check_db_connection\n begin\n ActiveRecord::Base.verify_active_connections! if defined?(ActiveRecord)\n rescue Object => bdrb_error\n log_exception(bdrb_error)\n end\n end",
"def reachable?\n !!client\n end",
"def reachable?\n !!client\n end",
"def find_server\n # we assume that guest process and owner process without a InProc server\n # have to start DRb service. so we call it first\n if !(@is_owner_process && @is_in_proc_server)\n DRb.start_service \n end\n\n finger = Rinda::RingFinger.new nil, DiscoverableServer::DEFAULT_PORT\n ring_server = finger.lookup_ring_any\n @server_uri = ring_server.__drburi\n end",
"def server?\n response = Net::HTTP.get_response(URI.parse('http://localhost:9533/'))\n raise unless response.class == Net::HTTPOK\nrescue\n skip 'Local server not detected'\nend",
"def dns_check\n gen_host_records # These are the hosts we have\n load_all_subnets # These are the DNS entries\n \n # We want a standard layout, with the hypervisor API entries being \n @host_record.each do |hr| # Array of host record Hash's\n hn = hr[:hostname]\n shn = hn.split('.',2)[0] # Remove the domain\n forward_hr = @forward_host_record[hn] # Find Host Record\n if forward_hr.nil?\n # We have no IPAM entry for this hostname\n if (rhr = @reverse_host_records[hr[:ip]])\n puts \"Only Reverse IPAM entry for #{shn}: #{rhr}\"\n @infoblox.create_host_record(ip_address: hr[:ip], hostname: hn, aliases: hr[:aliases])\n else\n puts \"No IPAM entry for hostrecord: #{hr}\"\n @infoblox.create_host_record(ip_address: hr[:ip], hostname: hn, aliases: hr[:aliases])\n end\n else\n # We have an IPAM record for this hostname\n if forward_hr[:ip] != hr[:ip]\n puts \"IP mismatch #{shn} #{hr[:ip]} != #{forward_hr[:ip]} for IPAM: #{forward_hr}\"\n elsif forward_hr[:hostname] != hn\n # Reference must be via ALIASES or CNAMES\n if forward_hr[:aliases].include?(shn)\n puts \"Hostname #{shn} is an ALIAS. IPAM: #{forward_hr}\"\n elsif forward_hr[:cnames].include?(hn)\n puts \"Hostname #{shn} is a CNAME. IPAM: #{forward_hr}\"\n end\n end\n end\n end\n \n # We want to find IPAM entries, not matching existing @host_record entries\n @reverse_host_records.each do |ip, ahr| # Hash to array of host records from IPAM, indexed by IP\n ahr.each do |hr| # One IP can have multiple host records, with associated ALIAS and CNAME records\n local_hr = @host_record_index[hr[:hostname]]\n if local_hr.nil?\n puts \"No local entry #{hr[:hostname]} for #{hr}\"\n end\n end\n end\nend",
"def reexecute_connections?\n return true\n end",
"def check_if_nodes_are_available(upgrade_nodes)\n unavailable_nodes = []\n upgrade_nodes.each do |node|\n ssh_status = node.ssh_cmd(\"\")\n if ssh_status[0] != 200\n unavailable_nodes.push node.name\n end\n end\n unless unavailable_nodes.empty?\n raise I18n.t(\"model.service.nodes_not_available\", names: unavailable_nodes.join(\", \"))\n end\n end",
"def servers?\n !@cache.servers.blank?\n # \n # return false if @cache.servers.blank?\n # @cache.stats\n # true\n # rescue\n # false\n end",
"def reconfiguring_replica_set?\n err = details[\"err\"] || details[\"errmsg\"] || details[\"$err\"] || \"\"\n NOT_MASTER.include?(details[\"code\"]) || err.include?(\"not master\")\n end",
"def discover_server_periodically\n @disconnected_connections.each do |key,connection|\n connection.establish_connection\n if connection.connection_status\n @backend_connections << connection\n connection.close_connection\n @disconnected_connections[key] = nil\n end\n end\n @disconnected_connections.delete_if { |key,value| value.nil? }\n @round_robin = (0...@backend_connections.length).to_a\n end",
"def server_exist?(server_name)\n compute = find_match(@compute.servers, server_name)\n Puppet.debug \"found server #{compute.name}\" if compute != nil\n Puppet.debug \"server not found : #{server_name}\" if compute == nil\n return (compute != nil)\n end",
"def startup_config_check\n\t\tfw_connect\n\t\t# they are ALL stale right now...\n\t\tcheck_config_freshness\n\t\tpending = get_pending_commits\n\t\tdo_pending_commits(pending) if pending != 0\n\t\tfw_exit\n\tend",
"def ping?\n false\n end",
"def haveBootstrapped?\n @inventory.haveNode?(@server.mu_name)\n end",
"def for_backups?\n hostname.start_with?('backup') || in_remote_datacenter?\n end",
"def eaddrnotavail?() EADDRNOTAVAIL == @error_code; end",
"def find_connection host_info\n conn = @backend_connections.detect { |x| x.server_info == host_info }\n raise NoServerAvailable.new(\"BackgrounDRb server is not found running on #{host_info}\") unless conn\n return conn\n end",
"def choose_server\n if @round_robin.empty?\n @round_robin = (0...@backend_connections.length).to_a\n end\n if @round_robin.empty? && @backend_connections.empty?\n discover_server_periodically\n raise NoServerAvailable.new(\"No BackgrounDRb server is found running\") if @round_robin.empty? && @backend_connections.empty?\n end\n @backend_connections[@round_robin.shift]\n end",
"def standalone?\n $mongo_client ||= initialize_scanned_client!\n $standalone ||= $mongo_client.cluster.servers.first.standalone?\nend",
"def server_ready?\n begin\n url = URI.parse(TEST_URI)\n req = Net::HTTP.new(url.host, url.port)\n res = req.request_head(\"/\")\n res.code == \"200\"\n rescue Errno::ECONNREFUSED\n false\n end\nend",
"def run_mysqlslap_check\n @servers.each do |server|\n result = server.spot_check_command(\"mysqlslap --concurrency=5000 --iterations=10 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --csv=/tmp/mysqlslap_q1000_innodb.csv --engine=innodb --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=mixed --number-of-queries=1000 --user=root\")\n raise \"FATAL: mysqlslap check failed\" unless result[:output].empty?\n end\n end",
"def implement_workarounds(hosts)\n # workaround for dbus config file mismatch error:\n #\n # \"dbus[562]: [system] Unable to reload configuration: Configuration file\n # needs one or more <listen> elements giving addresses\"\n on hosts, 'systemctl restart dbus'\nend",
"def missing_specifications_detected\n # FIXME: Write propper logic for this\n #(IP_FIXER_HUB.nil? || IP_LOOKUP_URL.nil?) ? true : false\n end",
"def establish_connections\n klass = Struct.new(:ip,:port)\n if t_servers = BackgrounDRb::BDRB_CONFIG[:client]\n connections = t_servers.split(',')\n connections.each do |conn_string|\n ip = conn_string.split(':')[0]\n port = conn_string.split(':')[1].to_i\n @bdrb_servers << klass.new(ip,port)\n end\n end\n @bdrb_servers << klass.new(BackgrounDRb::BDRB_CONFIG[:backgroundrb][:ip],BackgrounDRb::BDRB_CONFIG[:backgroundrb][:port].to_i)\n @bdrb_servers.each_with_index do |connection_info,index|\n next if @backend_connections.detect { |x| x.server_info == \"#{connection_info.ip}:#{connection_info.port}\" }\n @backend_connections << Connection.new(connection_info.ip,connection_info.port,self)\n end\n end",
"def has_borne?\n sncf_self_service_machine == \"t\"\n end",
"def valid?\n ping\n end",
"def available(server)\n available_connections(server).pop || make_new(server)\n end",
"def checkIfDeploopHost(host)\n mc = rpcclient \"rpcutil\"\n\n # https://github.com/deploop/deploop/issues/5\n\n h = Socket.gethostbyname(host)\n mc.identity_filter \"#{h[1][0]}\"\n mc.progress = false\n\n result = mc.inventory\n mc.disconnect \n\n result[0][:data][:agents].include? 'deploop'\n end",
"def verify!\n reconnect! unless active?\n end",
"def exists?\n start_time = Time.now\n timeout = resource[:timeout]\n\n success = validator.attempt_connection\n\n while success == false && ((Time.now - start_time) < timeout)\n # It can take several seconds for the Grafana server to start up;\n # especially on the first install. Therefore, our first connection attempt\n # may fail. Here we have somewhat arbitrarily chosen to retry every 2\n # seconds until the configurable timeout has expired.\n Puppet.notice('Failed to connect to Grafana API; sleeping 2 seconds before retry')\n sleep 2\n success = validator.attempt_connection\n end\n\n unless success\n Puppet.notice(\"Failed to connect to Grafana within timeout window of #{timeout} seconds; giving up.\")\n end\n\n success\n end",
"def properly_configured?\n options = {\n open_timeout: 5,\n use_ssl: true, # all connections are forced SSL now\n verify_mode: OpenSSL::SSL::VERIFY_NONE # because we might not have a valid cert yet\n }\n Net::HTTP.start(website_alias, options) do |http|\n response = http.get(\"/tenant_aliases/#{id}/verify\")\n\n return false unless response.is_a?(Net::HTTPSuccess)\n\n response.body == \"TRUE\"\n end\n rescue SocketError, Net::OpenTimeout, Errno::ECONNREFUSED\n # SocketError if the server name doesn't exist in DNS\n # OpenTimeout if no server responds\n # ECONNREFUSED if the server responds with \"No\"\n false\n end",
"def server_connected?\n ! chef_server.nil?\n end",
"def available?\n fname = File.join(APP_ROOT, 'tmp', 'connection.txt')\n\n Socket.getaddrinfo(\"google.com\", \"http\")\n FileUtils.rm(fname, force: true) rescue true# if good\n true\n\n rescue => err\n File.open(fname, 'w') {|f| f << '1'}\n false\n end",
"def only_configs?(server)\n return false if server['general']['alive'].to_i == 1\n return false unless server['netdb'].empty?\n return false unless server['vmware'].empty?\n\n true\n end",
"def check_status\n response = $RDS.describe_db_instances(:db_instance_identifier => \"#{name}-#{Rails.env}\")\n status = response[:db_instances].first[:db_instance_status]\n if status == \"available\"\n self.url = response[:db_instances].first[:endpoint][:address]\n self.save\n end\n return status\n end",
"def karaf_started?\n n = `netstat -ao | grep 8101 | wc -l`\n n.to_i > 0\n end",
"def server_found(srv)\n @servers << srv unless @servers.include?(srv)\n wake_up!(srv) if stalled?\n end",
"def check_connection\n one_wait = 5\n max_wait = 5\n request = Net::HTTP::Get.new('/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@url.host, @url.port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy, \n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy, \n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n puts(\"-- ERROR: couldn't connect to test host on \" + @url.host.to_s)\n return false\n end\n puts(\"-- SUCCESS: test host is alive !\\n\")\n return true\nend",
"def broker_check\n unless ((Time.now - @hb_received_at) * 1_000) <= (@heartbeat_interval * @heartbeat_retries)\n @reactor.log(:warn, \"#{@klass_name}, Worker [#{@service_name}] has expiring broker, last saw a heartbeat at [#{@hb_received_at}] and is now [#{Time.now}]\")\n reconnect_broker\n else\n @reactor.log(:info, \"#{@klass_name}, Worker [#{@service_name}] has healthy broker, last saw a heartbeat at [#{@hb_received_at}] and is now [#{Time.now}]\")\n end\n end",
"def check_hostnames\n all_good = true\n \n @check_groups.each do |group|\n group.checks.each do |check|\n unless check.hostname && Dnsruby::Resolv.getaddress(check.hostname)\n puts \"Error: check #{check.name} has invalid hostname '#{check.hostname}'\"\n all_good = false\n end\n end\n end\n \n all_good\n end",
"def online?\n sock = UDPSocket.new()\n online = false\n begin\n sock.connect('193.0.14.129', 25) # that address is k.root-servers.net\n online = true\n sock.close\n rescue Exception => exception\n puts \"\n------------------------------------------------------------\nCannot bind to socket:\n #{exception}\n\nThis is an indication you have network problems.\nNo online tests will be run!!\n------------------------------------------------------------\n\"\n end\n online\nend",
"def ensure_prerequisites\n return false unless command_found('netsh')\n return false unless command_found('net')\n return false unless command_found('reg')\n\n unless wired_autoconfig_service_running?\n info('starting \\'Wired AutoConfig\\' service')\n if admin_mode?\n `net start dot3svc`\n else\n require 'win32ole'\n shell = WIN32OLE.new('Shell.Application')\n shell.ShellExecute('net', 'start dot3svc', nil, 'runas', 1)\n end\n service_has_started = Landrush::Util::Retry.retry(tries: 5, sleep: 1) do\n wired_autoconfig_service_running?\n end\n unless service_has_started\n info('Unable to start \\'Wired AutoConfig\\' service. Unable to configure DNS on host. Try manual configuration.')\n return false\n end\n info('\\'Wired AutoConfig\\' service has started.')\n end\n true\n end",
"def active?\n servers.any?\n end",
"def discoverable?\n fails_any = false\n\n # TODO Loop through agent requirements\n\n return !fails_any\n end",
"def replica_set?\n $mongo_client ||= initialize_scanned_client!\n $replica_set ||= $mongo_client.cluster.replica_set?\nend",
"def valid?(server)\n relevant?(server) and !server.bogus?\n end",
"def registered?\n registrations = self.ring_server.read_all([:name,\n @service,\n nil,\n @identifier])\n registrations.any? { |registration| registration[2] == self }\n rescue DRb::DRbConnError\n @ring_server = nil\n false\n end",
"def check_wildcard(suffix)\n _log \"Checking for wildcards on #{suffix}.\"\n all_discovered_wildcards = []\n\n # First check if we can even get a reliable result\n timeout_count = 0\n 10.times do\n random_string = \"#{(0...8).map { (65 + rand(26)).chr }.join.downcase}.#{suffix}\"\n\n # keep track of timeouts\n _log \"Checking: #{random_string}\"\n timeout_count += 1 if check_resolv_sanity random_string\n end\n\n # fail if most timed out\n if timeout_count > 5\n _log_error \"More than 50% of our wildcard checks timed out, cowardly refusing to continue\"\n return nil\n end\n\n # first, check wordpress....\n # www*\n # ww01*\n # web*\n # home*\n # my*\n check_wordpress_list = []\n [\"www.doesntexist.#{suffix}\",\"ww01.#{suffix}\",\"web1.#{suffix}\",\"hometeam.#{suffix}\",\"myc.#{suffix}\"].each do |d|\n resolved_address = _resolve(d)\n check_wordpress_list << resolved_address\n #unless resolved_address.nil? || all_discovered_wildcards.include?(resolved_address)\n # all_discovered_wildcards << resolved_address\n #end\n end\n\n if check_wordpress_list.compact.count == 5\n _log \"Looks like wordpress-connected domain\"\n all_discovered_wildcards = check_wordpress_list\n end\n\n # Now check for wildcards\n 10.times do\n random_string = \"#{(0...8).map { (65 + rand(26)).chr }.join.downcase}.#{suffix}\"\n\n # do the resolution\n # www.shopping.intrigue.io - 198.105.244.228\n # www.search.intrigue.io - 198.105.254.228\n resolved_address = _resolve(random_string)\n\n # keep track of it unless we already have it\n unless resolved_address.nil? || all_discovered_wildcards.include?(resolved_address)\n all_discovered_wildcards << resolved_address\n end\n\n end\n\n # If that resolved, we know that we're in a wildcard situation.\n #\n # Some domains have a pool of IPs that they'll resolve to, so\n # let's go ahead and test a bunch of different domains to try\n # and collect those IPs\n if all_discovered_wildcards.uniq.count > 1\n _log \"Multiple wildcard ips for #{suffix} after resolving these: #{all_discovered_wildcards}.\"\n _log \"Trying to create an exhaustive list.\"\n\n # Now we have to test for things that return a block of addresses as a wildcard.\n # we to be adaptive (to a point), so let's keep looking in chuncks until we find\n # no new ones...\n no_new_wildcards = false\n\n until no_new_wildcards\n _log \"Testing #{all_discovered_wildcards.count * 20} new entries...\"\n newly_discovered_wildcards = []\n\n (all_discovered_wildcards.count * 20).times do |x|\n random_string = \"#{(0...8).map { (65 + rand(26)).chr }.join.downcase}.#{suffix}\"\n resolved_address = _resolve(random_string)\n\n # keep track of it unless we already have it\n unless resolved_address.nil? || newly_discovered_wildcards.include?(resolved_address)\n newly_discovered_wildcards << resolved_address\n end\n end\n\n # check if our newly discovered is a subset of all\n if (newly_discovered_wildcards - all_discovered_wildcards).empty?\n _log \"Hurray! No new wildcards in #{newly_discovered_wildcards}. Finishing up!\"\n no_new_wildcards = true\n else\n _log \"Continuing to search, found: #{(newly_discovered_wildcards - all_discovered_wildcards).count} new results.\"\n all_discovered_wildcards += newly_discovered_wildcards.uniq\n end\n\n _log \"Known wildcard count: #{all_discovered_wildcards.uniq.count}\"\n _log \"Known wildcards: #{all_discovered_wildcards.uniq}\"\n end\n\n elsif all_discovered_wildcards.uniq.count == 1\n _log \"Only a single wildcard ip: #{all_discovered_wildcards.sort.uniq}\"\n else\n _log \"No wildcard detected! Moving on!\"\n end\n\n all_discovered_wildcards.uniq # if it's not a wildcard, this will be an empty array.\n end",
"def validate_server_networking!(update_inventory=false)\n update_inventory! if update_inventory\n\n connected_servers.map do |server|\n validate_network_config(server)\n end.all?\n end",
"def update_required?(hosts)\n if !@refresh_node || !@refresh_node.active?\n begin\n @refresh_node = get_valid_seed_node\n rescue ConnectionFailure\n warn \"Could not refresh config because no valid seed node was available.\"\n return\n end\n end\n node = @refresh_node\n\n node_list = node.node_list\n\n unconnected_nodes = node_list - hosts\n removed_nodes = hosts - node_list\n\n if unconnected_nodes.empty? && removed_nodes.empty?\n return false\n else\n {:unconnected => unconnected_nodes, :removed => removed_nodes}\n end\n end",
"def blacklist_get_remote\n # grab the updates xml file\n remote_list = Net::HTTP.get(URI.parse('http://' + SL_CONFIG[:BLACKLIST_URL])) rescue ''\n # check the server's response code\n server_response = Net::HTTP.get_response(URI.parse('http://' + SL_CONFIG[:BLACKLIST_URL])).value rescue 0\n if remote_list == '' or server_response == 0\n # couldn't get update info from the server--return error msg if necessary\n #render :nothing => true\n render :nothing => true\n return false\n end\n # break it in two\n render :text => remote_list\n return true\n rescue\n # an error of some sort, return error or false\n render :nothing => true\n return false\n end",
"def needs_host_list?\n vima? || okeanos?\n end",
"def is_dynamic?\n !@discovery_config.nil?\n end",
"def remote_server_ready?\n !@remote_server['locked'] &&\n @remote_server['built'] &&\n @remote_server['booted'] &&\n @remote_server['ip_addresses'].present? &&\n @remote_server['total_disk_size'].to_i > 1 &&\n pending_transactions.blank?\n end"
] |
[
"0.61489105",
"0.60756403",
"0.59978515",
"0.5925955",
"0.58976054",
"0.58961076",
"0.58623147",
"0.58590645",
"0.57456833",
"0.57255125",
"0.57227737",
"0.57113326",
"0.56976765",
"0.5684553",
"0.5661205",
"0.5620546",
"0.5620546",
"0.5620546",
"0.5617895",
"0.5617359",
"0.5608117",
"0.5586969",
"0.55843824",
"0.55800617",
"0.5556393",
"0.55380124",
"0.5519275",
"0.5518515",
"0.5514936",
"0.5492681",
"0.5492569",
"0.5482466",
"0.54787695",
"0.5478442",
"0.5469019",
"0.54591024",
"0.5449343",
"0.5442816",
"0.5437441",
"0.5426679",
"0.5409358",
"0.539832",
"0.5394265",
"0.53913087",
"0.5385495",
"0.538301",
"0.53823525",
"0.53823525",
"0.53760433",
"0.53714657",
"0.53651327",
"0.535969",
"0.53565377",
"0.53441834",
"0.53424394",
"0.53409004",
"0.53392506",
"0.53388417",
"0.5329373",
"0.53264534",
"0.5325745",
"0.53199697",
"0.53012115",
"0.5294057",
"0.5292517",
"0.5282903",
"0.5281188",
"0.5280594",
"0.5280239",
"0.52795833",
"0.52789307",
"0.5276768",
"0.5272003",
"0.5263198",
"0.5262744",
"0.52616066",
"0.52602786",
"0.52596766",
"0.5255612",
"0.5250914",
"0.52342606",
"0.52287567",
"0.52283794",
"0.5223222",
"0.52138114",
"0.5213774",
"0.52100325",
"0.52099204",
"0.5203873",
"0.5200527",
"0.5197947",
"0.5191116",
"0.5189749",
"0.51800245",
"0.5172878",
"0.5170541",
"0.5166655",
"0.5163681",
"0.51636803",
"0.51623213"
] |
0.51928174
|
91
|
Send worker information of all currently running workers from all configured bdrb servers
|
def all_worker_info
update_stats
info_data = {}
@backend_connections.each do |t_connection|
info_data[t_connection.server_info] = t_connection.all_worker_info rescue nil
end
return info_data
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def workers\n if known?\n @workers\n else\n know heroku_get_workers\n end\n end",
"def workers\n result = {}\n\n @servers.each do |server|\n\n\n sock=socket server\n if sock.nil?\n result[server] = \"unable to connect to server\" if sock.nil?\n\n else\n result[server] = {}\n result[server][:workers] = []\n if response = send_command(sock, 'workers')\n response.split(\"\\n\").each do |line|\n workers = parse_worker_line line unless line == '.'\n result[server][:workers] << workers\n end\n else\n result[server][:workers] = \"No response from server\"\n\n end #response\n end #if\n end #servers\n result\n end",
"def workers\r\n @workers ||= []\r\n end",
"def list_workers\n Shuttle::Redis.smembers worker_set_key\n end",
"def workers\n @queues.keys\n end",
"def worker_initial_config\n # send blast_cmd to workers\n {:blast_cmd=>@@blast_cmd}\n end",
"def workers\n @worker_supervisor.actors\n end",
"def worker_config\n if BDRB_CONFIG[:workers] && BDRB_CONFIG[:workers][worker_name.to_sym]\n BDRB_CONFIG[:workers][worker_name.to_sym]\n else\n {}\n end\n end",
"def workers_all\n @work_order_workers = WorkOrderWorker.by_id\n render json: serialized_work_order_workers(@work_order_workers)\n end",
"def get_registered_workers\n @registered_workers\n end",
"def workers\n worker_group.accounts\n end",
"def workers\n app = extract_app\n if workers = args.shift\n current = heroku.set_workers(app, workers)\n display \"#{app} now running #{quantify(\"worker\", current)}\"\n else\n workers = heroku.workers(app)\n display \"#{app} is running #{quantify(\"worker\", workers)}\"\n end\n end",
"def running_workers\n pool_manager.workers.fetch(queues, {})\n end",
"def workers\n @@workers ||= []\n end",
"def work\n poll_interval = @config.get(PROVISIONER_WORKER_POLL_INTERVAL).to_i || 1\n poll_error_interval = @config.get(PROVISIONER_WORKER_POLL_ERROR_INTERVAL).to_i || 10\n server_uri = @config.get(PROVISIONER_SERVER_URI)\n\n $PROGRAM_NAME = \"#{$PROGRAM_NAME} (tenant: #{@tenant}, provisioner: #{@provisioner_id}, worker: #{@name})\"\n\n log.info \"Starting worker with id #{@worker_id}, connecting to server #{@config.get(PROVISIONER_SERVER_URI)}\"\n\n loop do\n result = nil\n\n # Poll Coopr Server until a task is retrieved\n task = _poll_server_and_retrieve_task\n\n # While running task, trap and queue TERM signal to prevent shutdown until task is complete\n sigterm = Coopr::Worker::SignalHandler.new('TERM')\n sigterm.dont_interupt do\n begin\n result = delegate_task(task)\n\n result = {} if result.nil? == true\n result['workerId'] = @worker_id\n result['taskId'] = task['taskId']\n result['provisionerId'] = @provisioner_id\n result['tenantId'] = @tenant\n\n log.debug \"Task <#{task['taskId']}> completed, updating results <#{result}>\"\n begin\n response = Coopr::RestHelper.post \"#{server_uri}/v2/tasks/finish\", result.to_json\n rescue StandardError => e\n log.error \"Caught exception posting back to coopr server #{server_uri}/v2/tasks/finish: #{e}\"\n end\n rescue StandardError => e\n result = {} if result.nil? == true\n result['status'] = '1'\n result['workerId'] = @worker_id\n result['taskId'] = task['taskId']\n result['provisionerId'] = @provisioner_id\n result['tenantId'] = @tenant\n if e.class.name == 'CommandExecutionError'\n log.error \"#{e.class.name}: #{e.to_json}\"\n result['stdout'] = e.stdout\n result['stderr'] = e.stderr\n else\n result['stdout'] = e.inspect\n result['stderr'] = \"#{e.inspect}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n log.error \"Task <#{task['taskId']}> failed, updating results <#{result}>\"\n begin\n response = Coopr::RestHelper.post \"#{server_uri}/v2/tasks/finish\", result.to_json\n rescue StandardError => e\n log.error \"Caught exception posting back to server #{server_uri}/v2/tasks/finish: #{e}\"\n end\n end\n end\n\n break if @once\n\n sleep 5\n end\n end",
"def worker_queue\n PingWorker.perform_async(self.id)\n end",
"def worker\n\n @services['s_worker']\n end",
"def worker\n\t\t require \"drb/drb\"\n\t\t require File.dirname(__FILE__) + \"/base\"\n\t\t $: << \"./\"\n\t\t Experiment::Config::init @options.env\n\t\t loop do\n\t\t @server_uri=\"druby://#{@options.master}:8787\"\n \t\t connect\n \t\t Notify::init 0, STDOUT, false, @master\n while item = @master.new_item\n #puts item\n exp = @master.experiment item\n require \"./experiments/experiment\"\n require \"./experiments/#{exp}/#{exp}\"\n \t\t\t cla = eval(as_class_name(exp))\n \t\t\t\texperiment = cla.new :slave, exp, @options\n \t\t\t experiment.master = @master.instance item\n \t\t\t experiment.run! 0\n end\n end\n\t end",
"def worker_pool; end",
"def worker_pool; end",
"def update_workers\n mongo_driver = Kymera::MongoDriver.new(address, port, database, 'workers')\n @registered_workers = mongo_driver.get_collection('workers')\n end",
"def workers(count); end",
"def run\n @workers = (0...[Etc.nprocessors, @server.length].min).map do\n fork do\n DRb.start_service\n server = DRbObject.new_with_uri(@url)\n\n until server.empty?\n klass, method_name = server.pop\n server.add_reporter(klass.run(method_name, @options)) if klass && method_name\n end\n end\n end\n\n shutdown\n @reporter.print_summary\n @reporter.exit_status\n end",
"def index\n @workers = Worker.all\n end",
"def index\n @workers = Worker.all\n end",
"def index\n @workers = Worker.all\n end",
"def index\n @workers = Worker.all\n end",
"def run\n debug \"Hiring workers...\"\n for arg in @args\n Worker.new arg\n end\n\n w = c = 0\n for worker in Beanpicker::workers\n w += 1\n m = \"Worker: #{worker.name} hired to do\"\n f = {}\n for child in worker.childs\n c += 1\n f[child.job_name] ||= 0\n f[child.job_name] += 1\n end\n for job in f.keys.sort\n m << \" #{job}##{f[job]}\"\n end\n debug m\n end\n\n if w == 0\n fatal [\"NOBODY WANT TO WORK TO YOU!!\",\n \"Have you specified a file?\",\n \"e.g. #{$0} lib/my_file_with_jobs.rb\"].join(\"\\n\")\n exit\n end\n\n if c == 0\n fatal [\"ALL YOUR #{w} WORKER#{\"S\" if w > 1} ARE LAZY AND DON'T WANT TO DO ANYTHING!!\",\n \"Have you specified a job in any of yous files?\",\n \"e.g. job('no.lazy.worker') { |args| puts args[:my_money] }\"].join(\"\\n\")\n exit\n end\n\n debug \"#{w} worker#{\"s\" if w > 1} hired to do #{c} job#{\"s\" if c > 1}, counting the money...\"\n \n loop { sleep 1 }\n end",
"def masterrun\n self.workersrun \n self.serverrun \n end",
"def workers(amount = nil)\n heroku = ::Heroku::API.new(:api_key => ENV['HEROKU_API_KEY'])\n #\n # Returns the amount of Delayed Job\n # workers that are currently running on Heroku\n if amount.nil?\n processes = heroku.get_ps(ENV['APP_NAME']).body.select {|p| p['process'] =~ /worker.[0-9]+/}.length\n HireFire::Logger.message(\"Queried Heroku for processes - result: #{processes}\")\n return processes\n end\n\n ##\n # Sets the amount of Delayed Job\n # workers that need to be running on Heroku\n return heroku.post_ps_scale(ENV['APP_NAME'], \"worker\", amount) \n\n rescue Exception\n # Heroku library uses rest-client, currently, and it is quite\n # possible to receive RestClient exceptions through the client.\n HireFire::Logger.message(\"Worker query request failed with #{ $!.class.name } #{ $!.message }\")\n nil\n end",
"def index\n @dock_workers = DockWorker.all\n end",
"def schedules\n workers.map(&:schedule)\n end",
"def worker_config\n worker = JSON.parse(SideJob.redis.get(\"#{redis_key}:worker\"))\n SideJob::Worker.config(worker['queue'], worker['class']) || {}\n end",
"def register_all(queue)\n SideJob.redis.multi do |multi|\n multi.del \"workers:#{queue}\"\n multi.hmset \"workers:#{queue}\", @registry.map {|key, val| [key, val.to_json]}.flatten(1) if @registry.size > 0\n end\n SideJob::Port.group(log: false) do\n SideJob.publish \"/sidejob/workers/#{queue}\", @registry\n end\n end",
"def register_worker\n super\n\n puts \"Fifo Startup - Updating worker list\"\n manager.request_refresh\n end",
"def worker(*queues)\n end",
"def update_workers\n self.workers.delete_if do |worker| \n worker_complete_statuses.include?( Sidekiq::Status::status(worker[:id]) )\n end\n end",
"def start_messages\n Server.log.info(\"* Worker count: #{@configs.count}\")\n end",
"def perform\n Rails.logger.info(\"BranchStatsWorker_PROCESSING_STARTED\")\n Agents::Branch.find_in_batches do |group|\n group.each do |each_branch|\n Rails.logger.info(\"BranchStatsWorker_PROCESSING_STARTED_#{each_branch.id}\")\n each_branch.branch_specific_stats\n Rails.logger.info(\"BranchStatsWorker_PROCESSING_FINISHED_#{each_branch.id}\")\n end\n end\n Rails.logger.info(\"BranchStatsWorker_PROCESSING_FINISHED\")\n end",
"def serverWorker_pods\nend",
"def server\n # we're in a new process (one of the workers on the test_server),\n # so stop the old server from RemoteWorkerServer\n DRb.stop_service\n \n # since RemoteWorkerServer now uses drbfire, we use it here to communicate with it\n DRb.start_service(@server_proxy.uri, nil, DRbFire::ROLE => DRbFire::CLIENT)\n \n DeepTest.logger.debug \"LocalWorkers start_all worker starting with with blackboard: #{@server_proxy.uri.inspect} #{@server_proxy.inspect}\"\n \n # finally, return a remote reference to the RemoteWorkerServer\n DRbObject.new_with_uri(@server_proxy.uri)\n end",
"def workers\n @workers.frozen? ? @workers : @workers.dup.freeze\n end",
"def update_all_worker_deployed\n self.all_worker_deployed = false\n true\n end",
"def spawn_and_monitor_workers\n daemon_log :msg => \"Spawning #{$daemon[:worker_count]} workers...\"\n\n while $daemon[:work]\n daemon_update_heartbeat\n\n # (Re)start workers\n while $daemon[:worker_pids].count < $daemon[:worker_count] do\n sp = Spawnling.new(:argv => $worker[:process_prefix]) do\n worker_runner\n end\n $daemon[:worker_pids] << sp.handle\n end\n\n sleep $daemon[:monitoring_sleep]\n\n # Delete PIDs from the array child_pids which don't exists anymore\n $daemon[:worker_pids].each do |ch_pid|\n begin\n ps = ProcTable.ps(ch_pid)\n rescue\n ps = nil\n daemon_log :msg => \"Error in ProcTable.ps: #{$!}\", :sev => :error\n end\n $daemon[:worker_pids].delete ch_pid unless ps && ps.comm == 'ruby'\n end\n end\nend",
"def rocket_job_active_workers(server_name = nil)\n return [] if !running? || (server_name && !worker_on_server?(server_name))\n [ActiveWorker.new(worker_name, started_at, self)]\n end",
"def init_workers(servers)\n @w = []\n servers.each{|s|\n @w << Worker.new(s)\n }\n end",
"def process_workers\n cleanup_worker_threads\n\n completion_blocks = []\n while !worker_completion_blocks.empty?\n block = worker_completion_blocks.pop\n completion_blocks << PollBlockDefinition.new(\"worker completion handler #{block}\", block, Hash.new)\n end\n call_poll_blocks(completion_blocks)\n end",
"def worker_pids\n work_units.all(:select => 'worker_pid').map(&:worker_pid)\n end",
"def worker_threads\n @workers.synchronize { @workers.size }\n end",
"def build_house() \n gather_team()\n @workers.each do |worker|\n worker.get_to_work()\n end\n end",
"def queue\n workers = %x[ps axe | grep delayed_job].split(\"delayed_job\").length\n j = { :workers => workers, :jobs => Delayed::Job.all }\n render :json=>j\n end",
"def new_worker(options = {})\n update_stats\n succeeded = false\n result = nil\n\n @backend_connections.each do |connection|\n begin\n result = connection.new_worker(options)\n succeeded = true\n rescue BdrbConnError; end\n end\n raise NoServerAvailable.new(\"No BackgrounDRb server is found running\") unless succeeded\n return options[:worker_key]\n end",
"def main()\n # create the worker\n w = Worker.new\n # let him load his settings from the yamlfile\n w.load_settings\n \n # initialize the mails in the maildir\n w.init_mails\n w.init_senders\n w.init_author_mails\n w.unknown_authors\n w.author_mails\n puts\n w.mails_per_day\n \n unm = w.init_mailers\n puts\n w.unknown_mailers(unm)\n \n w.used_mailers\nend",
"def all_servers\n Infrataster::Server.defined_servers.map { |i| server(i.name) }\nend",
"def worker_name\n @client.worker_name\n end",
"def notify_all\n MemberMailerWorker.perform_async(member_id: self.freelancer.id.to_s, job_order_id: self.id.to_s, perform: :send_job_paid_to_freelancer)\n MemberMailerWorker.perform_async(member_id: self.employer.id.to_s, job_order_id: self.id.to_s, perform: :send_job_paid_to_employer)\n TeamMailerWorker.perform_async(job_order_id: self.id.to_s, perform: :send_job_order_paid)\n\n\n MemberMailerWorker.perform_in(4.hours, member_id: self.employer.id.to_s, job_order_id: self.id.to_s, perform: :resend_job_paid_to_employer)\n MemberMailerWorker.perform_in(4.hours, member_id: self.freelancer.id.to_s, job_order_id: self.id.to_s, perform: :resend_job_paid_to_freelancer)\n\n km_properties = self.job.km_properties\n km_properties[:paid_job] = self.currency.convert_to_idr(self.budget)\n km_properties[:job_order_id] = self.id.to_s\n km_properties[:type] = self.class.to_s\n\n KissmetricsWorker.perform_async(perform: :job_paid, identity: self.job.member.email, properties: km_properties)\n\n # notify other applicants that a freelancer has been hired, only for the first job order\n if self.first_paid_order?\n all_applicants = self.job.job_applications\n all_applicants.each do |ja|\n if ja != self.job_application\n MemberMailerWorker.perform_async(member_id: ja.member.id.to_s, job_order_id: self.id.to_s, perform: :send_freelancer_hired_to_other_applicants)\n end\n end\n end\n end",
"def run\n loop do\n next unless @all_workers_started\n begin\n check_workers\n sleep Skynet::CONFIG[:WORKER_CHECK_DELAY]\n rescue SystemExit, Interrupt => e\n printlog \"Manager Exiting!\"\n exit\n rescue Exception => e\n fatal \"Something bad happened #{e.inspect} #{e.backtrace.join(\"\\n\")}\"\n end\n end\n end",
"def run!\r\n\r\n return if running?\r\n\r\n @running = true\r\n\r\n # call this thread 'master'...\r\n rename_process!('master')\r\n\r\n # stop any existing masters...\r\n stop_old_masters!\r\n\r\n # initialize signaling...\r\n init_signaling\r\n\r\n # get all metric ids for applicable roles and apply watches...\r\n # this is run before the call to the before_fork callback\r\n # in case that call has side-effects that would prevent the\r\n # watches from working...\r\n external_ids = application.metrics.ids(roles: roles, external_only: true)\r\n application.publish(*external_ids)\r\n application.watch(*external_ids)\r\n\r\n # call the before-fork callback (if defined)...\r\n @before_fork.call unless @before_fork.nil?\r\n\r\n # now get only internal metric ids for publishing\r\n # since we have no need to call publish on external metrics...\r\n metric_ids = application.metrics.ids(roles: roles, include_external: false)\r\n\r\n # create workers...\r\n add_workers(initial_worker_count)\r\n\r\n # start all the workers...\r\n start_workers\r\n\r\n # initialize run tracking variables...\r\n next_run_at = Time.now\r\n last_run_at = nil\r\n finished_at = nil\r\n iteration_count = 0\r\n\r\n # keep queueing work for each cycle...\r\n while running?\r\n current_time = Time.now\r\n\r\n # wait for the next run and be sure to\r\n # record the queue completion time as well...\r\n if current_time < next_run_at\r\n finished_at = current_time if queue.empty? && finished_at.nil?\r\n sleep 1; next\r\n end\r\n\r\n # get the set of metric ids that are either\r\n # still in the queue or currently being processed\r\n # by workers so that we can avoid requeueing them...\r\n queue_items = drain_queue\r\n queue_items += workers.map { |w| w.current_item }.compact\r\n working_set = Set.new(queue_items.uniq)\r\n\r\n # record performance\r\n if queue_items.length == 0\r\n log(\"Queue empty, finished_at: #{finished_at}\")\r\n record_performance((finished_at - last_run_at).to_f / frequency) if finished_at\r\n else\r\n log(\"Queue NOT empty, #{queue_items.length} remaining... [#{metric_ids.count}, #{queue_items.length}]\")\r\n record_performance(metric_ids.count.to_f / (metric_ids.count - queue_items.length + 1))\r\n end\r\n\r\n # display performance data...\r\n log(\"Beginning cycle; Performance: #{performance_history} (avg: #{average_performance || 'calculating'})\")\r\n\r\n # adjust the worker pool size if needed...\r\n adjust_worker_count!\r\n\r\n # queue the additional work...\r\n metric_ids.each do |metric_id|\r\n if working_set.include?(metric_id)\r\n log(\"Will not requeue unprocessed metric '#{metric_id}'\")\r\n else\r\n queue.push(metric_id)\r\n end\r\n end\r\n\r\n # update the run times...\r\n last_run_at = next_run_at\r\n next_run_at = last_run_at + frequency\r\n finished_at = nil\r\n\r\n # if a maximum number of iterations has been specified,\r\n # and we have reached that number of iterations, then exit...\r\n if iterations != nil && (iteration_count += 1) >= iterations\r\n log(\"Stopping runner because it has reached the desired iteration count of #{iterations}\")\r\n break\r\n end\r\n\r\n end\r\n\r\n # stop all workers...\r\n stop_workers\r\n\r\n # read the signal message to see what to do...\r\n log(\"Runner has been stopped\")\r\n end",
"def workers\n ::Resque.info[:workers].to_i\n end",
"def worker_initial_config\n\n end",
"def notify_workers\n PgJob.connection.execute \"NOTIFY pg_jobs_#{queue_name}\"\n end",
"def run(worker = 1)\n Rails.logger = Logger.new(\"#{Rails.root.to_s}/log/worker-#{worker}.log\", 1, 5242880)\n Delayed::Worker.logger = Rails.logger\n Delayed::Worker.logger.level = Logger::DEBUG\n # label the process with worker title\n puts \"Worker #{worker} process\"\n \n # set the worker attribute to the input value\n @worker = worker\n # label if testing should continue (basically should test forever until the worker quits, could be used to attach a database value and terminate workers remotely.)\n testing = true\n \n while(testing == true)\n @priority = test_order(@worker)\n reset_old_tests(@worker)\n check_schedule() if(@worker == 1)\n try_different_browser = false\n @hub_up = true\n # mark this process name\n #Rails.logger.info \"--- worker #{@worker} ---\"\n current_test = nil\n current_tests = nil\n sleep(2)\n #Rails.logger.info \"Checking for tests\"\n\n # set to empty hash\n current_tests = find_current_tests(@priority)\n \n begin\n if(current_tests.first().nil?)\n #Rails.logger.info \"No Tests to run\"\n raise \"No Tests to run\"\n else\n Rails.logger.info \"- Getting first test from list\"\n current_test = current_tests.first\n Rails.logger.info \"- No Tests to run\"\n begin\n current_test_driver = current_test.Driver\n rescue\n current_test_driver = current_test.driver\n current_test_driver = \"firefox\" if current_test_driver.nil?\n\n end\n Rails.logger.info \"- Checking for browser availability\"\n\n begin\n GridUtilities.browser_available(host: Grid_Processes.where('role = ?', \"hub\").first.ip, port: Grid_Processes.where('role = ?', \"hub\").first.port, driver_name: current_test_driver) if(current_test_driver.include?('grid'))\n rescue => e\n Rails.logger.info e.message\n Rails.logger.info e.backtrace\n @hub_up = false\n end\n\n if(@hub_up)\n if current_test_driver.include?('grid')\n if(GridUtilities.browser_available(host: Grid_Processes.where('role = ?', \"hub\").first.ip, port: Grid_Processes.where('role = ?', \"hub\").first.port, driver_name: current_test_driver))\n if(current_test[\"workerassigned\"] == nil)\n current_test[\"workerassigned\"] = @worker\n current_test.save!\n end\n puts \"- Worker #{@worker} can run test ##{current_test.id}\"\n if(current_test[\"testtype\"].downcase == 'buyflow')\n puts \"- Running Order Purchase TestCase #{current_test['id']}\"\n buyflow(current_test)\n end\n if(current_test[\"testtype\"].downcase.include?('pixel'))\n puts \"- Running Pixels TestCase #{current_test['id']}\"\n pixel(current_test)\n end\n if(current_test[\"testtype\"].downcase.include?('vanity'))\n puts \"- Running Vanity TestCase #{current_test['id']}\"\n vanity(current_test)\n end\n if(current_test[\"testtype\"].downcase.include?('uci'))\n puts \"- Running UCI TestCase #{current_test['id']}\"\n uci(current_test)\n end\n if(current_test[\"testtype\"].downcase.include?('seo'))\n puts \"- Running seo TestCase #{current_test['id']}\"\n seo(current_test)\n end\n else\n Rails.logger.info \"No browser available for this test case\"\n raise \"no_browser\"\n end\n else\n if(current_test[\"workerassigned\"] == nil)\n current_test[\"workerassigned\"] = @worker\n current_test.save!\n end\n Rails.logger.info \"- Worker #{@worker} can run test ##{current_test.id}\"\n if(current_test[\"testtype\"].downcase == 'buyflow')\n puts \"- Running Order Purchase TestCase #{current_test['id']}\"\n buyflow(current_test)\n end\n if(current_test[\"testtype\"].downcase.include?('pixel'))\n puts \"- Running Pixels TestCase #{current_test['id']}\"\n pixel(current_test)\n end\n if(current_test[\"testtype\"].downcase.include?('vanity'))\n puts \"- Running Vanity TestCase #{current_test['id']}\"\n vanity(current_test)\n end\n if(current_test[\"testtype\"].downcase.include?('uci'))\n puts \"- Running UCI TestCase #{current_test['id']}\"\n uci(current_test)\n end\n if(current_test[\"testtype\"].downcase.include?('seo'))\n puts \"- Running seo TestCase #{current_test['id']}\"\n seo(current_test)\n end\n end\n end\n current_test = nil\n end\n rescue ActiveRecord::StaleObjectError => e\n Rails.logger.info e.message\n Rails.logger.info e.backtrace if e.backtrace\n rescue Net::ReadTimeout => e\n Rails.logger.info \"Caught Net::ReadTimeout\"\n reset_old_tests(@worker)\n # catch browser communication failures\n Rails.logger.info e.message\n Rails.logger.info e.backtrace if e.backtrace\n # tell this worker to try another browser for now\n current_tests = Testrun.where(:status => \"Not Started\", :workerassigned => nil).where.not(:Driver => current_test.Driver)\n current_test = nil\n #try_different_browser = true\n retry\n rescue ActiveRecord::RecordNotFound => e\n Rails.logger.info \"Caught RecordNotFound\"\n Rails.logger.info \"#{e.message}\"\n sleep(2)\n rescue => e\n if(e.message == \"no_browser\")\n puts \"Caught no_browser\"\n Rails.logger.info 'No #{current_test.Driver} browser was found for this test run.'\n current_tests = Testrun.where(:status => \"Not Started\", :workerassigned => nil).where.not(:Driver => current_test.Driver)\n current_test = nil\n try_different_browser = true\n elsif(e.message == \"No Tests to run\")\n puts \"Caught 'No Tests to run'\"\n try_different_browser = false\n sleep(2)\n else\n Rails.logger.info \"Run Completed\"\n try_different_browser = false\n Rails.logger.info \"#{e.message}\"\n Rails.logger.info \"#{e.backtrace}\"\n sleep(2)\n if(current_test)\n current_test[\"result\"] = \"Fail\"\n current_test[\"status\"] = \"Complete\"\n current_test[\"Notes\"] = e.message + \" \\n\" + e.backtrace[0]+ \" \\n\" + e.backtrace[1]\n current_test.save!\n # update_suite(current_test.test_suites) \n end\n end\n end\n begin\n Delayed_Job.where(:queue => worker).destroy_all\n rescue => e\n Rails.logger.info e.message\n end\n TestLauncher.new.delay(:queue => worker).run(worker)\n testing == false\n end\n end",
"def workers(amount = nil)\n\n #\n # Returns the amount of Delayed Job\n # workers that are currently running on Heroku\n if amount.nil?\n return heroku.get_ps(ENV['APP_NAME']).body.select {|p| p['process'] =~ /worker.[0-9]+/}.length\n end\n\n ##\n # Sets the amount of Delayed Job\n # workers that need to be running on Heroku\n return heroku.post_ps_scale(ENV['APP_NAME'], \"worker\", amount)\n\n rescue ::Heroku::API::Errors::Error\n HireFire::Logger.message(\"Worker query request failed with #{ $!.class.name } #{ $!.message }\")\n nil\n end",
"def index\n @worker_messages = WorkerMessage.all\n end",
"def start\n boot_app && @@queue.load_jobs\n @worker_list = []\n Belated.config.workers.times do |i|\n @worker_list << Thread.new { Worker.new(number: i.next) }\n end\n return unless Belated.config.connect\n\n connect!\n banner_and_info\n trap_signals\n @@queue.enqueue_future_jobs\n end",
"def worker_pool(count, *queues_and_options)\n end",
"def calibrate_workers \n if !(stopped?)\n # Handle received signals\n @sig_queue.each { |signal| @sig_handlers[signal].call }\n @sig_queue = []\n # Check all channels for dead ones\n @workers.each_pair { |pid, worker|\n worker[:inactive] += 1\n if worker[:inactive] > @options[:timeout]\n running = ( Process.getpgid(pid) rescue false )\n if running \n if worker[:status] == :ALIVE \n @logger.log(Logger::Severity::WARN,\n \"Worker #{worker[:name]} with PID #{pid} timed out .. Terminating the worker process gracefully\", @options[:name])\n kill_worker(:TERM, pid)\n worker[:status] = :TERMINATING\n elsif worker[:status] == :TERMINATING && worker[:inactive] > @options[:timeout] + 60\n @logger.log(Logger::Severity::WARN, \n \"Timedout Worker #{worker[:name]} with PID #{pid} did not terminate gracefully .. Killing the worker process\", @options[:name])\n kill_worker(:KILL, pid)\n worker[:status] = :KILLED\n end\n end\n end\n }\n reap_workers\n if !(stopped?)\n # Fork new_workers if needed\n while @workers.length < @options[:workers]\n @logger.log(Logger::Severity::WARN, \"Missing workers .. Current workers: #{@workers.length} .. Forking new ones \", @options[:name])\n new_worker\n end\n end\n end\n end",
"def list_commands\n Invoker::ProcessPrinter.to_json(workers)\n end",
"def workers!\n LambdaMail::Mailing::SendSpecialEmailMessageWorker.drain\nend",
"def processes\n request('getAllProcessInfo')\n end",
"def adjust_workers\n\t\tself.sample_queue_status\n\n\t\treturn nil if self.throttled?\n\n\t\tif self.needs_a_worker?\n\t\t\tself.log.info \"Too few workers for (%s); spinning one up.\" % [ self.task_class.name ]\n\t\t\tpid = self.start_worker( !self.workers.empty? )\n\t\t\treturn [ pid ]\n\t\tend\n\n\t\treturn nil\n\trescue Timeout::Error => err\n\t\tself.log.warn \"%p while adjusting workers: %s\" % [ err.class, err.message ]\n\t\treturn nil\n\tend",
"def tick\n worker = Model::Worker.find id\n \n # Shut down if there is no worker status stored\n # shutdown! unless worker\n \n # Shut down if worker status is different than 'ok'\n # shutdown! unless worker.status == 'ok'\n \n data = tick_data.merge({\n status: 'ok',\n queues: @queues\n })\n Model::Worker.tick id, data\n end",
"def run\n @managers = Proletariat.worker_classes.map do |worker_class|\n Manager.spawn!(name: \"manager_#{worker_class.to_s}_#{object_id}\",\n supervise: true,\n args: [worker_class])\n end\n\n managers.each { |manager| manager << :run }\n\n nil\n end",
"def worker_runner\n $daemon[:logger_msg_prefix] = 'TaskQueueWorker'\n\n worker_install_signal_handler\n daemon_log :msg => \"Start working...\"\n\n # Fetch pending task queues and start working\n while $worker[:work] do\n # Get next pending taskqueue\n $worker[:task_queue] = $daemon[:task_queue_model].get_next_pending\n\n if $worker[:task_queue]\n # Set Process Name and execute tasks\n $0 = \"#{$worker[:process_prefix]}_#{$worker[:task_queue].id}\"\n $worker[:task_queue].run!(:print_log => ! $daemon[:background], logger: @logger)\n else\n # Set Process Name and sleep\n $0 = \"#{$worker[:process_prefix]}_idle\"\n sleep 15\n end\n end\n\n daemon_log :msg => \"Ended!\"\nrescue => exception\n daemon_log :msg => \"Fatal error in method 'worker_runner': #{$!}\\n#{exception.backtrace}\", :sev => :error\nend",
"def execute! &block\n task = block.call if block_given?\n return raise_no_workers if Server::workers.empty?\n task.service_id = id; self.tasks << task\n # Get worker and send task\n data = Task.send_with_worker(task)\n Logger.info 'Queued task ' + task.to_s + ' for worker: ' + data[:worker].to_s\n\n data\n end",
"def set_workers(app_name, qty)\n deprecate # 07/31/2012\n put(\"/apps/#{app_name}/workers\", :workers => qty).to_s\n end",
"def work\n executor = java.util.concurrent.Executors::newFixedThreadPool THREAD_POOL\n # Pump the requests into the queue for the thread pool to act on.\n while !@people.empty?\n if executor.queue.size < EXECUTOR_QUEUE_LIMIT\n executor.submit( PersonWorker.new(self, @people.pop) )\n break if executor.is_shutdown\n end\n end\n @people_progressbar.log(\"Executor pool populated\")\n # Block until queue is drained\n while !executor.queue.empty? do\n sleep 1\n end\n executor.shutdown\n @people_progressbar.refresh\n\n end",
"def create_workers\n @configs.each_with_index do |config, id|\n pid = fork { Worker.new(id, config).start }\n @forks << { id: id, pid: pid }\n end\n end",
"def worker_init\n raise \"Invalid worker name\" if !worker_name\n Thread.abort_on_exception = true\n\n # stores the job key of currently running job\n Thread.current[:job_key] = nil\n initialize_logger\n\n @thread_pool = ThreadPool.new(self,pool_size || 20,@logger)\n t_worker_key = worker_options && worker_options[:worker_key]\n\n @cache = ResultStorage.new(worker_name,t_worker_key,BDRB_CONFIG[:backgroundrb][:result_storage])\n\n if(worker_options && worker_options[:schedule] && no_auto_load)\n load_schedule_from_args\n elsif(BDRB_CONFIG[:schedules] && BDRB_CONFIG[:schedules][worker_name.to_sym])\n @my_schedule = BDRB_CONFIG[:schedules][worker_name.to_sym]\n new_load_schedule if @my_schedule\n end\n if respond_to?(:create)\n invoke_user_method(:create,worker_options[:data])\n end\n if run_persistent_jobs?\n add_periodic_timer(persistent_delay.to_i) {\n begin\n check_for_enqueued_tasks\n rescue Object => e\n puts(\"Error while running persistent task : #{Time.now}\")\n log_exception(e.backtrace)\n end\n }\n end\n write_pid_file(t_worker_key)\n end",
"def run!\n loop do\n begin\n job = Job.new(get_apps)\n job.fetch_targets!\n post_messages!(job.to_hash)\n sleep(@interval)\n rescue Errno::ECONNREFUSED => ce\n puts \"\"\n sleep(@interval)\n end\n\n end\n end",
"def workers=(workers_config)\n @workers = if workers_config.nil?\n DEFAULT_WORKERS\n else\n workers_config.slice(1, workers_config.length).to_i\n end\n end",
"def threads\n @workers.collect{ |worker| worker.thread }\n end",
"def workers_from_model model\n self.workers.select { |worker| worker[:model] == model.to_s.camelize }\n end",
"def unit_workers\n world.units.active.find_all { |u|\n unit_isworker(u)\n }\n end",
"def register_worker(name, bucket_count, config={})\n options = { :iteration_length => 60, :servers => ['127.0.0.1:11211'] }\n options.merge!(config)\n\n self.group_name = name\n self.iteration_length = options[:iteration_length]\n @memcache_client = client_for(Array(options[:servers]))\n\n @buckets = []\n @bucket_count = bucket_count\n initialize_buckets\n\n\t\t register_with_bonjour\n\t\t \n\t\t log.info { \"Registered #{self} in group #{group_name} at port #{@port}\" }\n end",
"def servers\n servers_for\n end",
"def create_workers\n MAX_WORKERS.times do\n @workers.push(DownloadWorker.new(self))\n end\n end",
"def collect_all_stats()\n\n begin\n logger.info 'collect_all_stats:start: Starting'\n\n cluster_stats_url = \"#{@hostname}/pools/default\"\n bucket_stats_url = \"#{@hostname}/pools/default/buckets\"\n\n time = Time.now\n\n open_tcp_sockets\n\n cluster_stats(cluster_stats_url, time)\n\n bucket_stats(bucket_stats_url, time)\n\n ping_stats(cluster_stats_url, time)\n\n close_tcp_sockets\n\n logger.info 'collect_all_stats:end: Completed'\n rescue Exception => e\n logger.error \"collect_all_stats:exception: #{e}\"\n end\n end",
"def workers\n # deprecation notice added to v2.21.3 on 03/16/12\n display(\"~ `heroku ps:workers QTY` has been deprecated and replaced with `heroku ps:scale workers=QTY`\")\n\n workers = shift_argument\n validate_arguments!\n\n if workers\n action(\"Scaling workers\") do\n new_workers = api.put_workers(app, workers).body[\"workers\"]\n status(\"now running #{new_workers}\")\n end\n else\n app_data = api.get_app(app).body\n if app_data[\"stack\"] == \"cedar\"\n raise(Heroku::Command::CommandFailed, \"For Cedar apps, use `heroku ps`\")\n else\n display(\"#{app} is running #{quantify(\"worker\", app_data[\"workers\"])}\")\n end\n end\n end",
"def run_workers\n @workers_started = true\n @workers.values.each(&:start)\n @worker_threads.values.each(&:join)\n @resurrection_thread.join\n end",
"def send_servers\n\t\tif @master && @sync\n\t\t\tputs \"Sincronizando lista de servidores\"\n\t\t\t# Abrimos un nuevo socket para sincronizar las listas de servidores\n\t\t\tminiSocket = TCPServer.new(@server, @port+1)\n\t\t\tminiSocket.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEADDR, 1 )\n\t\t\tslavesNum = Connections::SERVER_IP.length - 1\n\t\t\tslavesNum.times do\n\t\t\t\tres = IO.select([miniSocket], nil, nil, 10)\n\t\t\t\tif res != nil\n\t\t\t\t\t# Aceptamos el socket\n\t\t\t\t\tslave_server = miniSocket.accept\n\t\t\t\t\t# Enviamos la lista de servidores\n\t\t\t\t\tslave_server.puts(Connections::SERVER_IP.join(\" \"))\n\t\t\t\t\t# Cerramos la conexion\n\t\t\t\t\tslave_server.close\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs \"Sincronizacion terminada\"\n\t\tend\t\n\tend",
"def reap_all_workers\n begin\n wpid, status = Process.waitpid2(-1, Process::WNOHANG)\n wpid or return\n if reexec_pid == wpid\n logger.error \"reaped #{status.inspect} exec()-ed\"\n self.reexec_pid = 0\n self.pid = pid.chomp('.oldbin') if pid\n proc_name 'master'\n else\n worker = WORKERS.delete(wpid) and worker.close rescue nil\n m = \"reaped #{status.inspect} worker=#{worker.nr rescue 'unknown'}\"\n status.success? ? logger.info(m) : logger.error(m)\n end\n rescue Errno::ECHILD\n break\n end while true\n end",
"def reap_all_workers\n begin\n wpid, status = Process.waitpid2(-1, Process::WNOHANG)\n wpid or return\n if reexec_pid == wpid\n logger.error \"reaped #{status.inspect} exec()-ed\"\n self.reexec_pid = 0\n self.pid = pid.chomp('.oldbin') if pid\n proc_name 'master'\n else\n worker = WORKERS.delete(wpid) and worker.close rescue nil\n m = \"reaped #{status.inspect} worker=#{worker.number rescue 'unknown'}\"\n status.success? ? logger.info(m) : logger.error(m)\n end\n rescue Errno::ECHILD\n break\n end while true\n end",
"def index\n @wait_queues = wait_queues\n end",
"def notify\n MemberMailerWorker.perform_async(member_id: self.employer.id.to_s, job_order_id: self.id.to_s, perform: :send_invoice_to_employer)\n TeamMailerWorker.perform_async(job_order_id: self.id.to_s, perform: :send_new_job_order)\n\n end",
"def servers\n sync{@servers.keys}\n end",
"def create_workers\n @workers.times do |id|\n pid = fork { Worker.new(@options.merge(id: id)).start }\n @forks << { id: id, pid: pid }\n end\n end",
"def run\n done = []\n\n queues.each_with_object([]) {|(fqdn, queue), workers|\n @thread_limit.times.map.with_index {|i|\n workers << Thread.start {\n Thread.current[:id] = i+1\n done.push *worker_class(fqdn).new(fqdn, queue(fqdn), cache(fqdn), &@block).run(@thread_limit)\n }\n }\n }.each {|t| t.join }\n\n done\n end",
"def restart_workers_on_latest\n send_status( 'Info', \"Stop and restart all running workers on latest revision\")\n @WORKERS.keys.each do |id|\n info= @WORKERS[id]\n if info['status']=='RUN' # WIP\n cmd= info['cmd'].clone\n #cmd['revision']= '_latest'\n #cmd['revision_small'] = '_latest'\n rev = find_revision( '_latest' )\n cmd['revision']= rev['revision']\n cmd['revision_small']= rev['revision_small']\n @TORESTART[id]= cmd\n manage_worker( { 'worker_id' => id, 'action' => 'QUIT' } )\n end\n end\n @RRESTART= false\n end",
"def servers\n server_structs.each do |server|\n def server.alive?\n next_retry <= Time.now\n end\n end\n end"
] |
[
"0.6800493",
"0.66477734",
"0.6590264",
"0.65490675",
"0.6498326",
"0.6432259",
"0.6413751",
"0.63603693",
"0.6347667",
"0.6346913",
"0.63300866",
"0.6293857",
"0.6290806",
"0.6240705",
"0.6127479",
"0.61128074",
"0.60951334",
"0.6085447",
"0.5925323",
"0.5925323",
"0.5918051",
"0.5916651",
"0.59159195",
"0.5879899",
"0.5879899",
"0.5879899",
"0.5879899",
"0.5825263",
"0.58233047",
"0.58207893",
"0.57880074",
"0.5783541",
"0.5779285",
"0.5776851",
"0.5772211",
"0.57666266",
"0.5740937",
"0.5731118",
"0.57310605",
"0.5722993",
"0.5720645",
"0.57116115",
"0.5697221",
"0.5695444",
"0.5674053",
"0.5634329",
"0.5634063",
"0.5632397",
"0.56275034",
"0.56225294",
"0.5614144",
"0.5606961",
"0.5596926",
"0.5585373",
"0.55706084",
"0.5561246",
"0.5552882",
"0.55472803",
"0.55383116",
"0.5533265",
"0.5530149",
"0.5492241",
"0.548154",
"0.54769456",
"0.5467089",
"0.5444321",
"0.5439065",
"0.5430177",
"0.5428643",
"0.54237735",
"0.5420415",
"0.5414301",
"0.54076064",
"0.54015803",
"0.54008204",
"0.53880286",
"0.538794",
"0.5380648",
"0.5368979",
"0.5368053",
"0.5364943",
"0.5360011",
"0.53592616",
"0.53436583",
"0.5340335",
"0.53224576",
"0.53212684",
"0.532095",
"0.5311189",
"0.5310623",
"0.53072685",
"0.53023165",
"0.53014696",
"0.52978647",
"0.5297122",
"0.5291004",
"0.52815974",
"0.52797866",
"0.5277127",
"0.52757657"
] |
0.7126929
|
0
|
one of the backend connections are chosen and worker is started on it
|
def new_worker(options = {})
update_stats
succeeded = false
result = nil
@backend_connections.each do |connection|
begin
result = connection.new_worker(options)
succeeded = true
rescue BdrbConnError; end
end
raise NoServerAvailable.new("No BackgrounDRb server is found running") unless succeeded
return options[:worker_key]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def on_connection(conn)\n @backends.delete_if { |b| b.dead? }\n logger.debug \"Server:on_connection #{conn} backends #{@backends.count} loads #{@backends.map {|x| x.load}.inspect}\" if logger\n raise ::Heroku::Forward::Errors::BackendFailedToStartError.new if @backends.empty?\n # Find the one with the minimum load.\n b = @backends.select {|b| b.ready?}.reduce() { |t,v| t.load <= v.load ? t : v }\n # If there is no connection wait a bit and try again.\n if b\n prev_load = b.load\n if b.connect(conn)\n return\n else\n # This request is already toast. Just ignore, reset load.\n b.load = prev_load\n end\n else\n s = self\n logger.debug \"Server: EM queuing #{conn} because no available backends yet.\" if logger\n EM.next_tick do\n #logger.info \"Server: next_tick #{conn}.\" if logger\n sleep 1\n if @rejection_data\n s.reject_connection(conn)\n else\n s.on_connection(conn)\n end\n end\n end\n end",
"def start\n Signal.trap('TERM') { safe_stop }\n Signal.trap('INT') { safe_stop }\n\n logger.info \"Worker started with #{backend.class.name} backend\\n\"\n\n backend.queues = queues if backend.respond_to?(:queues=)\n\n while @controller = backend.reserve do\n begin\n @controller.perform\n rescue => error\n if exception_handler\n exception_handler.call(\n error,\n :controller => @controller,\n :pid => $$,\n :worker => self\n )\n else\n raise\n end\n end\n @controller = nil\n\n stop if @terminate_sent\n end\n end",
"def worker_pool; end",
"def worker_pool; end",
"def start\n backend.start\n end",
"def setup\n return unless connection_pool_enabled?\n\n @connection_pool = ::Queue.new\n\n start_pool_size.times { @connection_pool.push(new_client) }\n\n @created_connections = start_pool_size\n end",
"def all_active_connections\n super\n end",
"def establish_connections\n klass = Struct.new(:ip,:port)\n if t_servers = BackgrounDRb::BDRB_CONFIG[:client]\n connections = t_servers.split(',')\n connections.each do |conn_string|\n ip = conn_string.split(':')[0]\n port = conn_string.split(':')[1].to_i\n @bdrb_servers << klass.new(ip,port)\n end\n end\n @bdrb_servers << klass.new(BackgrounDRb::BDRB_CONFIG[:backgroundrb][:ip],BackgrounDRb::BDRB_CONFIG[:backgroundrb][:port].to_i)\n @bdrb_servers.each_with_index do |connection_info,index|\n next if @backend_connections.detect { |x| x.server_info == \"#{connection_info.ip}:#{connection_info.port}\" }\n @backend_connections << Connection.new(connection_info.ip,connection_info.port,self)\n end\n end",
"def start\n boot_app && @@queue.load_jobs\n @worker_list = []\n Belated.config.workers.times do |i|\n @worker_list << Thread.new { Worker.new(number: i.next) }\n end\n return unless Belated.config.connect\n\n connect!\n banner_and_info\n trap_signals\n @@queue.enqueue_future_jobs\n end",
"def choose_server\n if @round_robin.empty?\n @round_robin = (0...@backend_connections.length).to_a\n end\n if @round_robin.empty? && @backend_connections.empty?\n discover_server_periodically\n raise NoServerAvailable.new(\"No BackgrounDRb server is found running\") if @round_robin.empty? && @backend_connections.empty?\n end\n @backend_connections[@round_robin.shift]\n end",
"def start_work_loop\n Hutch.connect\n @worker = Hutch::Worker.new(Hutch.broker, Hutch.consumers)\n @worker.run\n :success\n rescue ConnectionError, AuthenticationError, WorkerSetupError => ex\n logger.fatal ex.message\n :error\n end",
"def launch!(options = {})\n @launch_time = Time.now\n @connected_to_socket = false\n @backend.spawn!\n\n b = self\n estabconn = proc do\n b.establish_connection\n end\n estabconn_callback = proc do |res|\n logger.info(\"Connection to #{b.socket} dead #{b.dead}\")\n end\n EM.defer(estabconn, estabconn_callback)\n end",
"def start\n @nodes.each(&:start)\n @worker = Thread.start do\n Thread.abort_on_exception = true\n catch(:shutdown) do\n loop do\n Moped.logger.debug \"replica_set: waiting for next client\"\n server, client = @manager.next_client\n\n if server\n Moped.logger.debug \"replica_set: proxying incoming request to mongo\"\n server.proxy(client, @mongo)\n else\n Moped.logger.debug \"replica_set: no requests; passing\"\n Thread.pass\n end\n end\n end\n end\n end",
"def worker_begin(worker)\n end",
"def work_pool; end",
"def start(max = 8)\n max.times do\n @pool << @wire.connection\n end\n @log.debug(\"PostgreSQL pool started with #{max} connections\")\n self\n end",
"def active_local_sockets; end",
"def active_connection\n super\n end",
"def maybe_start_taskqueue_worker(app)\n if my_node.is_taskqueue_master? or my_node.is_taskqueue_slave?\n tqc = TaskQueueClient.new()\n result = tqc.start_worker(app) \n Djinn.log_info(\"Starting TaskQueue worker for app #{app}: #{result}\")\n end\n end",
"def preconnect(concurrent = nil)\n hold{}\n end",
"def start\n unless @running\n @connections.each { |conn| conn.start(@start_bytes) }\n @running = true\n end\n end",
"def reexecute_connections?\n return true\n end",
"def new_worker\n r_channel, w_channel = IO.pipe \n worker_number = @missing_workers.shift || @workers.length + 1 \n worker_pid = Process.fork do\n Process.egid= @options[:group]\n Process.euid= @options[:user]\n $0 = \"#{Orchestra::Configurator::DEFAULTS[:name]}_#{worker_number}\"\n # Close all sockets inherited from parent\n @workers.each_value { |worker| worker[:pipe].close }\n @workers = nil\n # Create a new musician \n r_channel.close\n logger = if @options[:daemonize]\n log_file = @options[:log_dir] + ::File::SEPARATOR + \"#{@options[:name]}.#{worker_number}.log\"\n Daemonize::redirect_io(log_file)\n Logger.new(log_file)\n else \n Logger.new(STDOUT)\n end\n worker = Musician.new(@servers, w_channel, logger )\n worker.run \n exit\n end\n @workers[worker_pid] = { :pipe => r_channel, :inactive => 0, :name => worker_number, :status => :ALIVE }\n @reactor.attach(:read, r_channel) do | pipe | \n begin\n pipe.sysread(1)\n @workers[worker_pid][:inactive] = 0\n rescue EOFError \n @reactor.detach(:read, pipe)\n @workers[worker_pid][:inactive] = @options[:timeout]\n end\n end\n end",
"def be_worker\n before_work\n super\n end",
"def new_connection; end",
"def starting(worker)\n end",
"def worker\n\t\t require \"drb/drb\"\n\t\t require File.dirname(__FILE__) + \"/base\"\n\t\t $: << \"./\"\n\t\t Experiment::Config::init @options.env\n\t\t loop do\n\t\t @server_uri=\"druby://#{@options.master}:8787\"\n \t\t connect\n \t\t Notify::init 0, STDOUT, false, @master\n while item = @master.new_item\n #puts item\n exp = @master.experiment item\n require \"./experiments/experiment\"\n require \"./experiments/#{exp}/#{exp}\"\n \t\t\t cla = eval(as_class_name(exp))\n \t\t\t\texperiment = cla.new :slave, exp, @options\n \t\t\t experiment.master = @master.instance item\n \t\t\t experiment.run! 0\n end\n end\n\t end",
"def with_two_connections\n run_without_connection do |original_connection|\n ActiveRecord::Base.establish_connection(original_connection.merge(pool_size: 2))\n begin\n ddl_connection = ActiveRecord::Base.connection_pool.checkout\n begin\n yield original_connection, ddl_connection\n ensure\n ActiveRecord::Base.connection_pool.checkin ddl_connection\n end\n ensure\n ActiveRecord::Base.connection_handler.clear_all_connections!(:all)\n end\n end\n end",
"def work\n Logger.info \"Starting work...\"\n execute_startup(connections) {|c| c.future.connect}\n execute_startup(devices) {|d| d.future.start_device}\n execute_working_code\n end",
"def discover_server_periodically\n @disconnected_connections.each do |key,connection|\n connection.establish_connection\n if connection.connection_status\n @backend_connections << connection\n connection.close_connection\n @disconnected_connections[key] = nil\n end\n end\n @disconnected_connections.delete_if { |key,value| value.nil? }\n @round_robin = (0...@backend_connections.length).to_a\n end",
"def start\n retry_jobs if JR.config[:retry_jobs_at_start]\n EM.start_server(*self.config[:server], Server, self, self.storage)\n self.config[:distributors].each do |distributor|\n connect_to(distributor)\n end\n end",
"def connection\n #@pool ||= {}\n #@pool[Thread.current] ||= Mongoc::Client.new(host, port, :pool_size=>@pool_size)\n #Mongoc::Client.new(host, port, {})\n Thread.current[:_mongo] ||= Mongoc::Client.new(host, port, {})\n end",
"def perform\n ClientPlan.where(status: GlobalConstant::ClientPlan.active_status).all.each do |client_plan|\n client = Client.get_from_memcache(client_plan.client_id)\n client_usage_obj = populate_client_usage(client)\n notify_if_needed(client, client_plan, client_usage_obj)\n return if GlobalConstant::SignalHandling.sigint_received?\n end\n end",
"def worker_init\n raise \"Invalid worker name\" if !worker_name\n Thread.abort_on_exception = true\n\n # stores the job key of currently running job\n Thread.current[:job_key] = nil\n initialize_logger\n\n @thread_pool = ThreadPool.new(self,pool_size || 20,@logger)\n t_worker_key = worker_options && worker_options[:worker_key]\n\n @cache = ResultStorage.new(worker_name,t_worker_key,BDRB_CONFIG[:backgroundrb][:result_storage])\n\n if(worker_options && worker_options[:schedule] && no_auto_load)\n load_schedule_from_args\n elsif(BDRB_CONFIG[:schedules] && BDRB_CONFIG[:schedules][worker_name.to_sym])\n @my_schedule = BDRB_CONFIG[:schedules][worker_name.to_sym]\n new_load_schedule if @my_schedule\n end\n if respond_to?(:create)\n invoke_user_method(:create,worker_options[:data])\n end\n if run_persistent_jobs?\n add_periodic_timer(persistent_delay.to_i) {\n begin\n check_for_enqueued_tasks\n rescue Object => e\n puts(\"Error while running persistent task : #{Time.now}\")\n log_exception(e.backtrace)\n end\n }\n end\n write_pid_file(t_worker_key)\n end",
"def work!\n @status.start!\n \n puts \"Environment: #{Scales.env}\".green\n puts \"Application: #{@type.name}\".green\n puts \"Path: #{Dir.pwd}\".green\n puts \"Log Path: #{@status.log_path}\".green\n puts \"Threads: #{Scales.config.worker_threads}\".green\n puts \"Redis: #{Scales.config.host}:#{Scales.config.port}/#{Scales.config.database}\".green\n \n begin\n start_pool!\n rescue Interrupt => e\n @pool.map(&:exit)\n puts \"Goodbye\".green\n end\n end",
"def setup\n unless APP_CONFIG['single_server']\n @logger.info \"Multiple server mode activated\"\n $redis_listen = EM::Hiredis.connect(APP_CONFIG['redis_url'])\n $redis = EM::Hiredis.connect(APP_CONFIG['redis_url'])\n\n if ENV['TUBEHUB_MODE'] == 'backend'\n $redis_listen.subscribe APP_CONFIG['redis_channel']\n $redis_listen.on(:message) do |channel, msg|\n handle_redis_event((JSON.parse(msg) rescue {}))\n end\n end\n end\n\n reload_channels\n end",
"def setup_shared_connection_pool\n handler = ActiveRecord::Base.connection_handler\n\n handler.connection_pool_names.each do |name|\n pool_manager = handler.send(:connection_name_to_pool_manager)[name]\n pool_manager.shard_names.each do |shard_name|\n writing_pool_config = pool_manager.get_pool_config(ActiveRecord.writing_role, shard_name)\n @saved_pool_configs[name][shard_name] ||= {}\n pool_manager.role_names.each do |role|\n next unless pool_config = pool_manager.get_pool_config(role, shard_name)\n next if pool_config == writing_pool_config\n\n @saved_pool_configs[name][shard_name][role] = pool_config\n pool_manager.set_pool_config(role, shard_name, writing_pool_config)\n end\n end\n end\n end",
"def run\n loop do\n #Kernel.exit\n if @workQ.size < (@pool_size-1)\n Thread.start(@replicaServer.accept) do | client |\n @workQ.push 1\n message_handler(client)\n @workQ.pop(true)\n end\n else\n # if thread pool is full\n sleep 5 \n client.close\n end\n end\n end",
"def setup\n @client.clear(self.signals_redis_key)\n @worker_pool.start\n end",
"def masterrun\n self.workersrun \n self.serverrun \n end",
"def connect\r\n if @opts[:threadsafe]\r\n @conns = Knj::Threadhandler.new\r\n \r\n @conns.on_spawn_new do\r\n self.spawn\r\n end\r\n \r\n @conns.on_inactive do |data|\r\n data[:obj].close\r\n end\r\n \r\n @conns.on_activate do |data|\r\n data[:obj].reconnect\r\n end\r\n else\r\n @conn = self.spawn\r\n end\r\n end",
"def worker_initial_config\n\n end",
"def worker_pool\n @worker_pool || @mutex.synchronize { @worker_pool ||= ActionCable::Server::Worker.new(max_size: config.worker_pool_size) }\n end",
"def reconnect_if_needed\n reconnect if @concurrent_id != concurrent_id\n end",
"def call\n case activejob_workers_strategy\n when :only then activejob_workers\n when :exclude then sneakers_workers\n when :include then sneakers_workers + activejob_workers\n else\n raise \"Unknown activejob_workers_strategy '#{activejob_workers_strategy}'\"\n end\n end",
"def before_starting_workers\n end",
"def server\n self.next\n end",
"def establish_connection\n end",
"def remote_connections; end",
"def assign(work)\n if workers_available?\n @worker = Worker.new(work, @options)\n @worker.start\n @worker = nil\n true\n end\n end",
"def initialize_worker\n nil\n end",
"def connect(conn)\n b = self\n conn.on_connect do\n logger.debug \"OnConnect for Backend ready at #{backend.socket} on Connection #{conn} load #{b.load}\" if logger\n b.on_connect\n b.load += 1\n end\n\n conn.on_data do |data|\n logger.debug \"OnData for Backend ready at #{backend.socket} on Connection #{conn} load #{b.load}.\" if logger\n data\n end\n\n conn.on_response do |backend, resp|\n logger.debug \"OnResponse for Backend ready at #{backend.socket} on Connection #{conn} load #{b.load}.\" if logger\n resp\n end\n\n conn.on_finish do\n logger.debug \"OnFinish for Backend ready at #{backend.socket} on Connection #{conn} load #{b.load}.\" if logger\n b.load -= 1\n end\n conn.server backend, :socket => backend.socket\n return true\n rescue RuntimeError => e\n logger.warn \"#{e.message}\" if logger\n return false\n end",
"def connections\n @connection_pool\n end",
"def start\n return if active?\n begin\n @subject.start\n rescue Errno::ECONNRESET\n raise EventSource::Protocols::Amqp::Error::ConnectionError,\n \"Connection failed. network error to: #{connection_params}\"\n rescue Bunny::TCPConnectionFailed\n raise EventSource::Protocols::Amqp::Error::ConnectionError,\n \"Connection failed to: #{connection_params}\"\n rescue Bunny::PossibleAuthenticationFailureError\n raise EventSource::Protocols::Amqp::Error::AuthenticationError,\n \"Likely athentication failure for account: #{@subject.user}\"\n rescue StandardError\n raise EventSource::Protocols::Amqp::Error::ConnectionError,\n \"Unable to connect to: #{connection_params}\"\n else\n sleep 1.0\n logger.info \"Connection #{connection_uri} started.\" if active?\n active?\n end\n end",
"def connect\n @connection_pool.get_connection\n end",
"def start\n _connect\n sleep 1\n end",
"def pre_connect\n\t\t\ttrue\n\t\tend",
"def setup\n super do |server_app, binder|\n binder.forward :concurrency\n\n yield(server_app, binder) if block_given?\n end\n end",
"def new_connection(handler)\n return unless Config.metrics\n unless handler.application.nil?\n # Get peer's IP and port\n peer = handler.peer_ip_port()\n # Update record\n work_data.update(\n {app_id: handler.application.app_id},\n {'$addToSet' => {connections: {slanger_id: Cluster.node_id, peer: peer}}, '$set' => {timestamp: Time.now.to_i}},\n {upsert: true}\n )\n end\n end",
"def connect!\n # Keep existing connections\n return unless @backend.nil?\n\n @backend = train_connection.connection\n @backend.wait_until_ready\n\n # When the testing function `mock_instance` is used, it will set\n # this instance variable to false and handle this function call\n # after the platform data is mocked; this will allow binding\n # of mixin functions based on the mocked platform.\n mix_in_target_platform! unless @mocked_connection\n rescue Train::UserError => e\n raise ConnectionFailure.new(e, config)\n rescue Train::Error => e\n # These are typically wrapper errors for other problems,\n # so we'll prefer to use e.cause over e if available.\n raise ConnectionFailure.new(e.cause || e, config)\n end",
"def init(worker_threads = 1)\n @mutex.synchronize do\n unless @context\n @context = ZMQ.context(worker_threads)\n @sockets = Set.new\n end\n @context\n end\n end",
"def switch!\n solr_endpoint.switch!\n fcrepo_endpoint.switch!\n redis_endpoint.switch!\n end",
"def checkin_connection(conn)\n @queue.push(conn)\n conn\n end",
"def across_pool_state\n super\n end",
"def redis_pool; end",
"def backends; end",
"def using_connection(connection_or_class, label: nil, &block)\n if connection_or_class.is_a?(Class) && connection_or_class < ActiveRecord::Base\n label ||= connection_or_class.name\n connection_or_class.connection_pool.with_connection do |connection|\n switch_connection_in_block(connection, label: label, &block)\n end\n else\n switch_connection_in_block(connection_or_class, label: label, &block)\n end\n end",
"def start\n raise 'Cannot start a peer pool twice.' if started\n logger.debug 'Start connecting other pears.'\n addr_list = peer_discovery.peers\n\n connect(addr_list)\n\n @started = true\n end",
"def connection_established(*args)\n\tend",
"def switch!\n solr_endpoint.switch!\n fcrepo_endpoint.switch!\n redis_endpoint.switch!\n data_cite_endpoint.switch!\n switch_host!(cname)\n setup_tenant_cache(cache_api?) if self.class.column_names.include?('settings')\n end",
"def preconnect(concurrent = false)\n enum = (max_size - _size).times\n\n conns = if concurrent\n enum.map{Thread.new{make_new(:default)}}.map(&:value)\n else\n enum.map{make_new(:default)}\n end\n\n sync{conns.each{|conn| checkin_connection(conn)}}\n end",
"def find_next_except_these connections\n invalid_connections = @backend_connections.select { |x| connections.include?(x.server_info) }\n @backend_connections.delete_if { |x| connections.include?(x.server_info) }\n @round_robin = (0...@backend_connections.length).to_a\n invalid_connections.each do |x|\n @disconnected_connections[x.server_info] = x\n end\n chosen = @backend_connections.detect { |x| !(connections.include?(x.server_info)) }\n raise NoServerAvailable.new(\"No BackgrounDRb server is found running\") unless chosen\n chosen\n end",
"def checkin_connection(conn)\n @available_connections << conn\n conn\n end",
"def start\n\t\t@quorum.start\n\n\t\t@dispatch_thread = Thread.new do\n\t\t\tbegin\n\t\t\t\tloop do\n\t\t\t\t\tselect_ready = select([@cpg.fd, @quorum.fd], [], [])\n\t\t\t\t\tif select_ready[0].include?(@quorum.fd) then\n\t\t\t\t\t\t@quorum.dispatch\n\t\t\t\t\tend\n\t\t\t\t\tif select_ready[0].include?(@cpg.fd) then\n\t\t\t\t\t\t@cpg.dispatch\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\trescue Exception => e\n\t\t\t\t# something happened that we don't know how to handle. We need to bail out.\n\t\t\t\t$stderr.write \"Fatal exception: #{e.to_s} (#{e.class})\\n#{e.backtrace.join(\"\\n\")}\\n\"\n\t\t\t\texit(1)\n\t\t\tend\n\t\tend\n\tend",
"def acquire(*a)\n conn = nil\n\n 1.times do\n if (conn = super) &&\n (timer = sync{@connection_timestamps.delete(conn)}) &&\n Sequel.elapsed_seconds_since(timer) > @connection_validation_timeout &&\n !db.valid_connection?(conn)\n\n case pool_type\n when :sharded_threaded, :sharded_timed_queue\n sync{@allocated[a.last].delete(Sequel.current)}\n else\n sync{@allocated.delete(Sequel.current)}\n end\n\n disconnect_connection(conn)\n redo\n end\n end\n\n conn\n end",
"def empty_connection_pools!; end",
"def register_worker\n super\n\n puts \"Fifo Startup - Updating worker list\"\n manager.request_refresh\n end",
"def connections\n @_connections ||= {}\n end",
"def start\n # clear work and timeout queues?\n @pool_lock.synchronize {\n @terminate = false\n launch_manager\n 0.upto(@num_threads) { |i| launch_worker }\n }\n end",
"def start\n if @supernode_table.empty?\n # The supernode table is empty, so this node is probably \n # starting and not promoted to supernode mode.\n \n # NOTE The +attempt_fetch_supernodes+ will block if no \n # supernode is found. Since supernodes should still work \n # even there is no other active supernodes, a thread is created\n # here. So it can still accept connections from other ordinary\n # nodes.\n Thread.new do \n # 1. Get supernodes from cache or bootstrap node\n Routing.log {|logger| logger.info(self.class) {'1. Getting SNs ...'}}\n sns = attempt_fetch_supernodes\n # 2. Connect to supernodes\n Routing.log {|logger| logger.info(self.class) {'2. Connecting to SNs ...'}}\n connect_supernodes(sns)\n end\n else\n # It is promoted to supernode mode.\n @supernode_table.supernodes.each do |sn|\n @lock.synchronize { @socks << sn.socket }\n end\n end\n\n # 3. Start the background threads\n @request_supernode_thread = start_request_supernodes_thread\n @compute_hits_thread = start_compute_hits_thread\n\n # 4. Create the server socket and handle incoming messages\n @server = TCPServer.open(@driver.config['listening_port'].to_i)\n @socks << @server\n @running = true\n while @running\n # Wait for messages from other nodes\n ready = select(@socks,nil,nil,@timeout)\n readable = ready[0]\n\n unless readable.nil?\n readable.each do |sock|\n if sock == @server # Accept new client\n client = @server.accept\n accepted = on_handshaking(client)\n if accepted\n @lock.synchronize { @socks << client }\n else\n client.close\n end\n elsif sock.eof? # Socket has disconnected\n Routing.log {|logger| logger.info(self.class) {'Socket has disconnected.'}}\n @lock.synchronize {@socks.delete(sock)}\n # Remove it if it is in supernode table\n @supernode_table.delete(sock.node) if @supernode_table.include?(sn.node)\n sock.close\n else # Message is ready for reading\n msg = @protocol.read_message(sock)\n unless msg.nil?\n @bandwidth_manager.downloaded(msg.bytesize,Time.now-message.ftime.to_time) unless @bandwidth_manager.nil?\n handle_message(msg,sock)\n else\n Routing.log {|logger| logger.error(self.class) {'The message read is nil.'}}\n end\n end\n end\n else # Timeout\n @socks.delete_if do |sock|\n sock.closed? # Discarded by supernode table\n end\n end\n end\n end",
"def started?\n backend.started?\n end",
"def run\n connect\n end",
"def configure(args)\n args[:databases].each do |db|\n @databases[db[:database]] = {\n state: \"enabled\",\n host: db[:host],\n database: db[:database],\n username: db[:username],\n password: db[:password],\n status: {\n state: \"online\",\n respond_time: 0\n } \n }\n end\n @workers = args[:no_of_workers]\n @policy = POLICY_NAME[args[:policy]].new(@databases)\n monitor\n end",
"def workers\n app = extract_app\n if workers = args.shift\n current = heroku.set_workers(app, workers)\n display \"#{app} now running #{quantify(\"worker\", current)}\"\n else\n workers = heroku.workers(app)\n display \"#{app} is running #{quantify(\"worker\", workers)}\"\n end\n end",
"def set_coworker\n @coworker = Coworker.find(params[:id])\n end",
"def serving_loop\n Thread.new { socket_loop }\n @manager.management_loop\n end",
"def acquire(fiber)\n # A special case for rails when doing ActiveRecord stuff when not yet\n # running in the context of a request (fiber) like in the case of AR\n # queries in environment.rb (Root Fiber)\n return @connections.first unless fiber[:callbacks]\n \n fiber[:current_pool_key] = connection_pool_key\n return fiber[connection_pool_key] if fiber[connection_pool_key]\n conn = if !@connections.empty?\n @connections.shift\n elsif (@connections.length + @busy_connections.length) < @size\n @connection_proc.call\n else\n Fiber.yield @queue << fiber\n end\n \n # They're called in reverse order i.e. release then process_queue\n fiber[:callbacks] << self.method(:process_queue)\n fiber[:callbacks] << self.method(:release)\n \n @busy_connections[fiber] = conn\n fiber[connection_pool_key] = conn\n end",
"def switch_server\n self.connection = nil\n servers << servers.shift\n end",
"def backend; end",
"def connect(a, b, weight = 0.5)\n c = Connection.new a, b, weight\n a.join c\n # Also add the Connection here\n connections << c\n end",
"def initialize_servers\n @protocols.each do |protocol, _|\n server = @servers[protocol.protocol]\n block = server[:start]\n server[:server].start(server[:port], @routes[protocol.protocol], views: @views, channel: @channels[protocol.protocol], debug: @debug, &block)\n end\n end",
"def forward!(options = {})\n logger.info \"Launching Backends ...\" if logger\n\n i = 0\n for backend in @backends\n i += 1\n backend.launch!\n logger.info \"Launching Backend #{i} at #{backend.socket}.\" if logger\n end\n\n if @delay && (delay = @delay.to_i) > 0\n logger.info \"Waiting #{delay}s to Launch Proxy Server ...\" if logger\n sleep delay\n end\n\n logger.info \"Launching Proxy Server at #{host}:#{port} ...\" if logger\n s = self\n ::Proxy.start({ :host => host, :port => port, :debug => false }) do |conn|\n s.on_connection(conn)\n end\n\n logger.info \"Proxy Server at #{host}:#{port} Finished.\" if logger\n end",
"def start\n @worker.start\n end",
"def post_init\n @cluster_manager.join(@options[:join]) if @options[:join]\n end",
"def schedule_process_connections\n ProcessQueue.create(:type => \"apply_primary_tags\",\n :priority => 1,\n :params => [self.id])\n ProcessQueue.create(:type => \"make_inner_connections\",\n :priority => 2,\n :params => [self.id])\n ProcessQueue.create(:type => \"make_outer_connections\",\n :priority => 5,\n :params => [self.id])\n end",
"def spawn_drb_queen\n @threads << Thread.new{\n begin \n Thread.current[\"name\"]=\"main\"\n DRb.start_service \"druby://#{@config.drb_host || DRB_HOST}:#{@config.drb_port || DRB_PORT}\", self\n DRb.thread.join\n rescue => e\n logger.error \"There was an error in drb_queen =(. Details: #{e}\\n#{e.backtrace}\"\n end\n }\n end",
"def preconnect(concurrent = false)\n enum = (max_size - size).times\n\n if concurrent\n enum.map{Thread.new{make_new(nil)}}.map(&:join).each{|t| checkin_connection(t.value)}\n else\n enum.each{checkin_connection(make_new(nil))}\n end\n end",
"def check_connection_state\n # Has the connection been established in the meantime? If yes, shut\n # down the work queues thread, all work will be done in this thread \n # from now on. \n if cached_connection_established?\n @work_queue.shutdown\n end\n end",
"def connection_for(client_name)\n connect unless connection\n return nil if client_name == :all\n @clients[client_name] ||= case client_name\n when :resque\n connect_for_resque\n else\n connect_for_any\n end\n end",
"def allow_concurrency; end"
] |
[
"0.67359805",
"0.6388938",
"0.6187251",
"0.6187251",
"0.6096601",
"0.6034333",
"0.6023681",
"0.6002822",
"0.59832776",
"0.5959083",
"0.5882553",
"0.5877238",
"0.586612",
"0.58267134",
"0.5767701",
"0.5729303",
"0.5710896",
"0.57087135",
"0.5704638",
"0.57031626",
"0.57030904",
"0.56878155",
"0.56875813",
"0.5676977",
"0.56763524",
"0.56742454",
"0.56622434",
"0.5659698",
"0.56291",
"0.56257653",
"0.56209856",
"0.55839723",
"0.5570738",
"0.55499333",
"0.55359304",
"0.5525532",
"0.5516242",
"0.55042636",
"0.5499047",
"0.5493269",
"0.5482959",
"0.546861",
"0.546222",
"0.5457862",
"0.5455246",
"0.5454891",
"0.5447449",
"0.5425332",
"0.54138845",
"0.5411817",
"0.54114795",
"0.54020345",
"0.5401801",
"0.5399619",
"0.53887594",
"0.53850234",
"0.5370591",
"0.5368249",
"0.5354991",
"0.53441435",
"0.53389144",
"0.53381205",
"0.5334922",
"0.5326352",
"0.53188366",
"0.5318601",
"0.5315017",
"0.53147566",
"0.5310579",
"0.5309281",
"0.53074175",
"0.5307249",
"0.5306873",
"0.5306612",
"0.53061557",
"0.53022325",
"0.5300784",
"0.5296907",
"0.5296527",
"0.5296074",
"0.5295146",
"0.5291636",
"0.5291212",
"0.5289954",
"0.5286577",
"0.5284399",
"0.5283923",
"0.52797854",
"0.5278791",
"0.5276539",
"0.52761245",
"0.527502",
"0.52743167",
"0.52720517",
"0.52689254",
"0.52672327",
"0.5264232",
"0.52626216",
"0.52558786",
"0.5254114"
] |
0.5774391
|
14
|
choose a server in round robin manner.
|
def choose_server
if @round_robin.empty?
@round_robin = (0...@backend_connections.length).to_a
end
if @round_robin.empty? && @backend_connections.empty?
discover_server_periodically
raise NoServerAvailable.new("No BackgrounDRb server is found running") if @round_robin.empty? && @backend_connections.empty?
end
@backend_connections[@round_robin.shift]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def select_server\n compute.servers.map { |s| [s.name, s.id] }\n end",
"def switch_server\n self.connection = nil\n servers << servers.shift\n end",
"def next\n @server\n end",
"def available(server)\n available_connections(server).pop || make_new(server)\n end",
"def select_server(server_list)\n while true\n puts \"Would you like to connect to any server directly?\"\n if check_in_tmux\n puts \"Please select server\"\n puts \"Select multible server by enter server number comma seperated.\"\n print \"Server numer(s) (Enter to exit): \"\n else\n puts \"Please select a server\"\n puts \"(you could connect to multible server if you run awsssh in tmux)\"\n print \"Server numer (Enter to exit): \"\n end\n server_selection = STDIN.gets.chomp.split(\",\").map{|n| n.strip.to_i if n.strip.to_i != 0}\n server_to_connect = server_selection.reject{ |a| a.nil? || a > server_list.length+1}\n if server_to_connect.length > 1 && check_in_tmux\n session = \"awsssh-connect\"\n `tmux -2 new-session -d -s #{session}`\n server_to_connect.each_with_index do |server, index|\n puts \"connect to #{server_list[server]}\"\n `tmux send -t #{session} \"ssh #{server_list[server]}\" ENTER`\n # `tmux send -t #{session} \"ls -la\" ENTER`\n `tmux split-window -t #{session}:.1`\n `tmux select-layout -t #{session} tiled`\n end\n `tmux send -t #{session} \"exit\" ENTER`\n `tmux set-window-option -t #{session} synchronize-panes on`\n `tmux select-window -t #{session}:1`\n `tmux switch -t #{session}`\n elsif server_to_connect.length == 1\n puts \"connect one to #{server_list[server_to_connect.first]}\"\n connect_server server_list[server_to_connect.first]\n else\n puts \"No Server sellected\"\n puts\n break\n end\n exit 0\n end\n end",
"def next\n @servers.unshift(@servers.pop).first.server\n end",
"def find_server!\n @client.clients.each do |client|\n client.force_status! do |status|\n if status == :primary && [:primary, :primary_preferred, :secondary_preferred].include?(@client.read_pref)\n @pending_server = false\n server_found!\n elsif status == :secondary && [:secondary, :primary_preferred, :secondary_preferred].include?(@client.read_pref)\n @pending_server = false\n server_found!\n end\n end\n end\n end",
"def schedule_primary_and_connect #:nodoc:\n # Dump the one we were trying if it wasn't connected\n current = server_pool.shift\n\n # In case there was an error from the server we will take it out from rotation\n # unless we specify infinite reconnects via setting :max_reconnect_attempts to -1\n if current && (options[:max_reconnect_attempts] < 0 || can_reuse_server?(current))\n server_pool << current\n end\n\n # If we are out of options, go ahead and disconnect then\n # handle closing connection to NATS.\n process_disconnect and return if server_pool.empty?\n\n # bind new one\n next_server = bind_primary\n\n # If the next one was connected and we are trying to reconnect\n # set up timer if we tried once already.\n if should_delay_connect?(next_server)\n schedule_reconnect\n else\n attempt_reconnect\n schedule_primary_and_connect if had_error?\n end\n end",
"def join(server, already); end",
"def select\n sockets = @servers.map {|x| x.socket}.compact\n socket = Kernel.select(sockets, nil, nil, 1)\n \n if socket == nil\n return nil\n else\n socket = socket[0][0]\n return @servers.find {|x| x.socket.__id__ == socket.__id__}\n end\n end",
"def server\n self.next\n end",
"def switch_serve(server)\n\t\t\tif @current_game.check_status == \"#{@player1} wins\" || @current_game.check_status == \"#{@player2} wins\"\n\t\t\t\tself.new_game\n\t\t\telse\n\t\t\t\tif $server == @player1\n\t\t\t\t\t$server = @player2\n\t\t\t\t\tself.hitter1\n\t\t\n\t\t\t\telse\n\t\t\t\t\t$server = @player1\n\t\t\t\t\tself.hitter2\n\t\t\t\tend\n\t\t\t\t\tnew_serve($server)\n\t\t\tend\n\t\tend",
"def next\n srv = shift_servers!\n unless srv\n fib = Fiber.current\n @stalled_fibers << fib\n srv = Fiber.yield\n end\n srv\n end",
"def send_servers\n\t\tif @master && @sync\n\t\t\tputs \"Sincronizando lista de servidores\"\n\t\t\t# Abrimos un nuevo socket para sincronizar las listas de servidores\n\t\t\tminiSocket = TCPServer.new(@server, @port+1)\n\t\t\tminiSocket.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEADDR, 1 )\n\t\t\tslavesNum = Connections::SERVER_IP.length - 1\n\t\t\tslavesNum.times do\n\t\t\t\tres = IO.select([miniSocket], nil, nil, 10)\n\t\t\t\tif res != nil\n\t\t\t\t\t# Aceptamos el socket\n\t\t\t\t\tslave_server = miniSocket.accept\n\t\t\t\t\t# Enviamos la lista de servidores\n\t\t\t\t\tslave_server.puts(Connections::SERVER_IP.join(\" \"))\n\t\t\t\t\t# Cerramos la conexion\n\t\t\t\t\tslave_server.close\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs \"Sincronizacion terminada\"\n\t\tend\t\n\tend",
"def get_server(name=nil)\n if name\n begin\n selected_server = get_server_by_algorithm { |l| name }\n return selected_server == name\n rescue\n return false\n end\n else\n # Mark a random server in-use.\n return get_server_by_algorithm { |l| l[rand(l.length)] }\n end\n end",
"def launch(test = false)\n if(test)\n #open two ports for the server to test multiple connections\n t1 = TCPServer.open(44106)\n t2 = TCPServer.open(44107)\n Thread.new{run_server(t1)}\n Thread.new{run_server(t2)}\n\n return [t1, t2]\n else\n run_server(TCPServer.open(54106))\n end\n end",
"def listen_servers\n\t\tunless @master && !@sync\n\t\t\tputs \"Sincronizando lista de servidores\"\n\t\t\tbegin\n\t\t\t\tminiSocket = TCPSocket.new(Connections::SERVER_IP[0], @port+1)\n\t\t\trescue Errno::ETIMEDOUT => e\n\t\t\t\tputs \"No se pudo relizar la Sincronizacion\"\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\t# Resivimos la lista de Servidores\n\t\t\tres = IO.select([miniSocket], [miniSocket], nil, 10)\n\t\t\tif res != nil\n\t\t\t\t@arry_ips = miniSocket.gets.chomp.split(\" \")\n\t\t\tend\n\t\t\tputs \"Sincronizacion terminada\"\n\t\tend\n\tend",
"def server(name, host, user, options={})\n servers.push(DO::Server.new(name, host, user, options))\n local(name) { servers_selected.replace(servers.select { |s| s.name == name }) }\n end",
"def select_a_server(name, url)\n # no url, no name, try to use current master\n if url.nil? && name.nil?\n if config.current_master\n return config.current_master\n else\n exit_with_error 'URL not specified and current master not selected'\n end\n end\n\n if name && url\n exact_match = config.find_server_by(url: url, name: name)\n return exact_match if exact_match # found an exact match, going to use that one.\n\n name_match = config.find_server(name)\n\n if name_match\n #found a server with the provided name, set the provided url to it and return\n name_match.url = url\n return name_match\n else\n # nothing found, create new.\n return Kontena::Cli::Config::Server.new(name: name, url: url)\n end\n elsif name\n # only --name provided, try to find a server with that name\n name_match = config.find_server(name)\n\n if name_match && name_match.url\n return name_match\n else\n exit_with_error \"Master #{name} was found from config, but it does not have an URL and no URL was provided on command line\"\n end\n elsif url\n # only url provided\n if url =~ /^https?:\\/\\//\n # url is actually an url\n url_match = config.find_server_by(url: url)\n if url_match\n return url_match\n else\n return Kontena::Cli::Config::Server.new(url: url, name: nil)\n end\n else\n name_match = config.find_server(url)\n if name_match\n unless name_match.url\n exit_with_error \"Master #{url} was found from config, but it does not have an URL and no URL was provided on command line\"\n end\n return name_match\n else\n exit_with_error \"Can't find a master with name #{name} from configuration\"\n end\n end\n end\n end",
"def elect_primary(description, servers); self; end",
"def choose_read_pool\n if @secondary_pools.empty?\n @read_pool = @primary_pool\n elsif @secondary_pools.size == 1\n @read_pool = @secondary_pools[0]\n else\n ping_ranges = Array.new(3) { |i| Array.new }\n @secondary_pools.each do |pool|\n case pool.ping_time\n when 0..150\n ping_ranges[0] << pool\n when 150..1000\n ping_ranges[1] << pool\n else\n ping_ranges[2] << pool\n end\n end\n\n for list in ping_ranges do\n break if !list.empty?\n end\n\n @read_pool = list[rand(list.length)]\n end\n end",
"def servers_selected\n @_servers_selected ||=[]\n end",
"def server_selector\n @server_selector ||= ServerSelector.get(read_preference || database.server_selector)\n end",
"def server(servr)\n clone(:server=>servr)\n end",
"def server_selector\n @server_selector ||= if read_preference\n ServerSelector.get(read_preference)\n else\n ServerSelector.primary\n end\n end",
"def select_server(cluster, server_selector, session)\n server_selector.select_server(cluster, nil, session)\n end",
"def server(name, host, user, options={})\n servers.push(DO::Server.new(name, host, user, options))\n task name do |opts, b|\n allowed = opts.map { |k,v| k if remote.include?(k) && v }.compact\n denied = opts.map { |k,v| k if remote.include?(k) && v == false }.compact\n if (allowed.empty? && denied.empty?) ||\n (!allowed.empty? && allowed.include?(name)) ||\n (!denied.empty? && !denied.include?(name))\n @_current_server = servers.find { |s| s.name == name }\n begin\n b.arity == 1 ? b.call(opts) : b.call\n ensure\n @_current_server = nil\n end\n end\n end\n end",
"def server\n @servers.first\n end",
"def shift_server\n return get_server_by_algorithm(false) { |l| [ l.first, '' ] }\n end",
"def run\n loop{\n @client = @server.accept\n @serverPool.schedule(@client)\n }\n end",
"def run\n loop{\n @client = @server.accept\n @serverPool.schedule(@client)\n }\n end",
"def server\n servers[0]\n end",
"def connection\n @connections[Thread.current] or begin\n c = @possibilities[rand @possibilities.size]\n @connections[Thread.current] = c.dup\n end\n end",
"def find_next_except_these connections\n invalid_connections = @backend_connections.select { |x| connections.include?(x.server_info) }\n @backend_connections.delete_if { |x| connections.include?(x.server_info) }\n @round_robin = (0...@backend_connections.length).to_a\n invalid_connections.each do |x|\n @disconnected_connections[x.server_info] = x\n end\n chosen = @backend_connections.detect { |x| !(connections.include?(x.server_info)) }\n raise NoServerAvailable.new(\"No BackgrounDRb server is found running\") unless chosen\n chosen\n end",
"def run servers\n\t\tservers.each do |server|\n\n\t\t\t@clientCount += 1\n\n\t\t\tclient = Kesh::Mumble::MumbleClient.new( server[:host], server[:port], server[:nick], @options )\n\t\t\t@connections[ client ] = server\n\n\t\t\tclient.register_handler :ServerSync, method( :on_connected )\n\t\t\tclient.register_handler :UserState, method( :on_user_state )\n\t\t\tclient.register_handler :UserRemove, method( :on_user_remove )\n\t\t\t# client.register_handler :UDPTunnel, method( :on_audio )\n\n\t\t\tclient.register_text_handler '!help', method( :cmd_help )\n\t\t\tclient.register_text_handler '!find', method( :cmd_find )\n\t\t\tclient.register_text_handler '!goto', method( :cmd_goto )\n\t\t\tclient.register_text_handler '!test', method( :cmd_test )\n\t\t\tclient.register_text_handler '!info', method( :cmd_info )\n\t\t\tclient.register_text_handler '!admin', method( :cmd_admin )\n\t\t\tclient.register_text_handler '!mute', method( :cmd_mute )\n\t\t\tclient.register_text_handler '!result', method( :cmd_result )\n\t\t\tclient.register_text_handler '!list', method( :cmd_list )\n\n\t\t\tclient.register_exception_handler method( :on_exception )\n\n\t\t\tload_roles_ini client\n\n\t\t\tcreate_new_match( client )\n\n\t\t\tclient.connect\n\n\t\t\tcreate_comment( client )\n\n\t\tend\n\n\t\t# Main loop\n\t\tuntil @shutdown do\n\n\t\t\tif ( Time.now - @lastCleanUp ) > 60 * 60\n\t\t\t\tremove_old_matches\n\t\t\t\t@lastCleanUp = Time.now\n\t\t\tend\n\n\n\t\t\tif ( Time.now - @lastTrack ) > 60 * 5\n\t\t\t\ttrack_matches\n\t\t\t\t@lastTrack = Time.now\n\t\t\tend\n\n\t\t\treturn true unless all_connected? # TODO: This is a very ugly way to reset all connections\n\n\t\t\tsleep 0.2\n\n\t\tend\n\n\t\treturn @restart\n\n\tend",
"def serverHandling()\n \n loop {\n #puts \"ServerHandling thread: #{Thread.current}\"\n thread = Thread.start($serv.accept) do |client|\n \n message = client.gets.chomp\n\n \n\n arr = message.split(' ')\n server_cmd = arr[0]\n args = arr[1..-1]\n# if server_cmd != \"UPDATE\" then puts \"THIS IS THE MESSAGE: #{message}\" end\n\n case server_cmd\n when \"EDGEB2\"; edgeb_network(args)\n when \"EDGEU2\"; edgeu_network(args)\n when \"UPDATE\"; updateTable(args)\n when \"TOSOURCE\"; source_console(args)\n when \"PING\"; ping_network(args)\n when \"FORWARD\"; forward_packet(args)\n when \"SEND\"; packet_forward(args)\n when \"SEND2\"; file_forward(args)\n when \"SUCCESS\"; transfer_success(args)\n when \"CIRCUITB2\"; circuitb_network(args)\n else STDERR.puts \"ERROR: INVALID COMMAND \\\"#{server_cmd}\\\"\"\n end\n client.close\n end\n \n }\n\nend",
"def servers\n server_structs.each do |server|\n def server.alive?\n next_retry <= Time.now\n end\n end\n end",
"def select_server(cluster, server_selector, session, failed_server = nil)\n server_selector.select_server(cluster, nil, session, deprioritized: [failed_server].compact)\n end",
"def test_start_auction_to_one_server_should_replicate\n reset(REP_SERVERS)\n server1, server2, server3 = REP_SERVERS\n name = \"gau2\"\n \n do_rest(server1, :start_auction, {name: name, end_time: Time.now.to_i + 3})\n do_rest(server1, :bid, {name: name, client:1, bid:100})\n res = do_rest(server1, :status, {name: name})\n assert_equal(\"1\", res.strip)\n\n res = do_rest(server2, :status, {name: name})\n assert_equal(\"1\", res.strip)\n res = do_rest(server3, :status, {name: name})\n assert_equal(\"1\", res.strip)\n end",
"def shift_servers!\n srv = @servers.pop\n if srv\n @servers.unshift(srv)\n srv\n end\n end",
"def next(options)\n @slaves_list[@slave_index = (@slave_index + 1) % @slaves_list.length]\n end",
"def discover_server_periodically\n @disconnected_connections.each do |key,connection|\n connection.establish_connection\n if connection.connection_status\n @backend_connections << connection\n connection.close_connection\n @disconnected_connections[key] = nil\n end\n end\n @disconnected_connections.delete_if { |key,value| value.nil? }\n @round_robin = (0...@backend_connections.length).to_a\n end",
"def set_server\n @server = Server.includes(:user).includes(:votes).find(params[:id])\n end",
"def mongos_each_direct_client\n return unless ClusterConfig.instance.topology == :sharded\n\n client = ClientRegistry.instance.global_client('basic')\n client.cluster.next_primary\n client.cluster.servers.each do |server|\n direct_client = ClientRegistry.instance.new_local_client(\n [ server.address.to_s ],\n SpecConfig.instance.test_options.merge(\n connect: :sharded\n ).merge(SpecConfig.instance.auth_options)\n )\n yield direct_client\n direct_client.close\n end\n end",
"def given_server(&block)\n @servers.push(Server.new(&block))\n end",
"def server\n\t\treturn @server ||= self.create_server\n\tend",
"def select_shard(&block)\n Octopus.using(:master, &block)\n end",
"def selector\n @selector ||= [socket]\n end",
"def get_servers\n\n if @settings.auto_server_ranking\n\n @self_auto_ranking = 'y'\n\n # if possible fetch server ranked list from cache\n path = get_cache_base_path() + File::SEPARATOR + 'servers'\n\n if File.readable?(path) &&\n (@settings.auto_server_ranking_lifetime == 0 ||\n File.mtime(path) > (Time.now() -\n (60 + [-5,5].sample)*@settings.auto_server_ranking_lifetime))\n\n servers = JSON.parse(File.read(path), :symbolize_names => true)\n\n if !servers.nil?\n @ranking_status = 'A'\n return servers\n end\n\n end\n\n # no or expired server ranked list - rank servers\n servers = rank_servers()\n\n if !servers.nil?\n return servers\n end\n\n end\n\n # check if manual list is cached or not\n # manual list is cached and used for some time when top server fails\n path = get_cache_base_path() + File::SEPARATOR + 'servers-manual'\n if File.readable?(path) &&\n @settings.server_phaseout_lifetime > 0 &&\n File.mtime(path) >\n (Time.now() - (60 + [-5,5].sample)*@settings.server_phaseout_lifetime)\n\n servers = JSON.parse(File.read(path), :symbolize_names => true)\n\n if !servers.nil?\n @ranking_status = 'M'\n return servers\n end\n\n end\n\n # default list\n @ranking_status = 'D'\n return @settings.servers\n\n end",
"def execute_on_servers(options={})\n raise ArgumentError, \"expected a block\" unless block_given?\n\n if task = current_task\n servers = find_servers_for_task(task, options)\n\n if servers.empty?\n if ENV['HOSTFILTER']\n logger.info \"skipping `#{task.fully_qualified_name}' because no servers matched\"\n return\n else\n raise Capistrano::NoMatchingServersError, \"`#{task.fully_qualified_name}' is only run for servers matching #{task.options.inspect}, but no servers matched\"\n end\n end\n\n if task.continue_on_error?\n servers.delete_if { |s| has_failed?(s) }\n return if servers.empty?\n end\n else\n servers = find_servers(options)\n raise Capistrano::NoMatchingServersError, \"no servers found to match #{options.inspect}\" if servers.empty?\n end\n\n servers = [servers.first] if options[:once]\n logger.trace \"servers: #{servers.map { |s| s.host }.inspect}\"\n\n max_hosts = (options[:max_hosts] || (task && task.max_hosts) || servers.size).to_i\n is_subset = max_hosts < servers.size\n\n # establish connections to those servers in groups of max_hosts, as necessary\n servers.each_slice(max_hosts) do |servers_slice|\n begin\n establish_connections_to(servers_slice)\n rescue ConnectionError => error\n raise error unless task && task.continue_on_error?\n error.hosts.each do |h|\n servers_slice.delete(h)\n failed!(h)\n end\n end\n\n begin\n yield servers_slice\n rescue RemoteError => error\n raise error unless task && task.continue_on_error?\n error.hosts.each { |h| failed!(h) }\n end\n\n # if dealing with a subset (e.g., :max_hosts is less than the\n # number of servers available) teardown the subset of connections\n # that were just made, so that we can make room for the next subset.\n teardown_connections_to(servers_slice) if is_subset\n end\n end",
"def server?(server)\n if db.sharded? && !opts[:server]\n server(server)\n else\n self\n end\n end",
"def regist_server(server)\n @server[server.uri] = server\n mutex.synchronize do\n @primary_server = server unless @primary_server\n end\n end",
"def remote(args, &block)\n args = { args => :servers } unless args.is_a?(Hash)\n local(args) do\n name = args.is_a?(Hash) ? args.keys[0] : args\n servers_selected.each do |current|\n begin\n server_was, @_current_server = @_current_server, current\n self.class.send(:define_method, name, &block)\n method = self.class.instance_method(name)\n self.class.send(:remove_method, name)\n block.arity == 1 ? method.bind(self).call(current) : method.bind(current).call\n ensure\n @_current_server = server_was\n end # begin\n end # servers\n end # local\n end",
"def pop_server\n return get_server_by_algorithm(false) { |l| [ l.last, '' ] }\n end",
"def initialize options\n @options = options\n @client_count = options.clients\n#=begin\n @clients = []\n @client_count.times do |i|\n # @clients << Thread.new do\n # client = Client.new(@options)\n # client.run\n # end\n #@clients << Proc.new do\n # client = Client.new(@options)\n # client.run\n #end\n pid = fork {\n client = Client.new(@options)\n client.run\n }\n\n @clients << pid\n puts \"#{pid} started.\"\n sleep 0.5\n end\n#=end\n\n #client = Client.new(@options)\n #client.run\n end",
"def slaveof(host, port); end",
"def server_found(srv)\n @servers << srv unless @servers.include?(srv)\n wake_up!(srv) if stalled?\n end",
"def setup_server\n @port = 0\n begin\n @port = rand(40_000)\n @server = TCPServer.new(@port)\n rescue\n retry\n end\n end",
"def run\n while true\n begin\n res = select( @descriptors, nil, nil)\n if res != nil \n for sock in res[0]\n if sock == @serverSocket \n accept_new_connection\n elsif sock.eof? \n sock.close\n @user_info.delete(@user_info[@descriptors.index(sock)-1])\n @descriptors.delete(sock)\n else\n msg = sock.gets()\n puts msg\n user_info = @user_info[@descriptors.index(sock)-1]\n if (msg =~ /user_info:|source_info:|admin_info:/) and user_info.nil? \n eval_first_msg(msg,sock) \n elsif (msg =~ /user_info:|source_info:|admin_info:/) and !(user_info.nil?)\n sock.write(\"You are registered #{user_info[:nickname]}, do not try to deceive me\\n\")\n else\n response_request(msg,sock)\n end\n end\n end\n end\n rescue => e\n puts \"Somenthing wrong happened #{e}\"\n end\n end\n end",
"def servers\n list = []\n Penctl.execute(@pen, \"servers\", 5).each do |l| \n server = Penctl.parse_server_line(l)\n list[server[:slot]] = server\n end\n list.compact\n end",
"def server(api_method=nil)\n server = BigbluebuttonRails.configuration.select_server.call(self, api_method)\n end",
"def preconnect(concurrent = false)\n enum = (max_size - size).times\n\n if concurrent\n enum.map{Thread.new{make_new(nil)}}.map(&:join).each{|t| checkin_connection(t.value)}\n else\n enum.each{checkin_connection(make_new(nil))}\n end\n end",
"def servers\n sync{@servers.keys}\n end",
"def run\n\t\tputs \"Server waiting for conncetions\"\n\t\tloop do\n\t\t\tThread.start(@serverSocket.accept) do |conection|\n\t\t\t\t# Agregamos al cliente a la lista de conectados si este no\n\t\t\t\t# esta en la lista\n\t\t\t\t(@clients << conection) unless @clients.include? conection\n\t\t\t\t# Registramos la conexion por consola\n\t\t\t\tputs \"Conexion #{conection}\"\n\t\t\t\t# Avisamos de la conexion exitosa\n\t\t\t\tconection.puts \"i Conexion establecida\"\n\t\t\t\t# Enviamos la lista de servidores\n\t\t\t\tconection.puts \"m \" << Connections::SERVER_IP.join(\" \") if @master\n\t\t\t\tconection.puts \"s \" << @arry_ips.join(\" \") unless @master\n\t\t\t\t# Escuchamos los mensajes de la conexion\n\t\t\t\tlisten_user(conection)\n\t\t\t\t# Quitamos la conexion\n\t\t\t\t@clients.delete(conection)\n\t\t\t\t# Avisamos en consola de la desconeccion\n\t\t\t\tputs \"Desconexion #{conection}\"\n\t\t\t\t# Cerramos el socket\n\t\t\t\tconection.close\n\t\t\tend\n\t\tend.join\n\tend",
"def start_server\n @watchman = Thread.new {\n while !@stopped\n @pool_mutex.synchronize\n socket = @server.accept\n @pool << Thread.new(socket) {|socket|\n serve(socket)\n }\n end \n }\n end",
"def aquire_connection(start = nil, &blk)\n server = case @read_pref\n when :primary\n primary\n when :secondary\n secondary\n when :primary_preferred\n primary || secondary\n when :secondary_preferred\n secondary || primary\n when :nearest\n raise ArgumentError, \"nearest read preferrence is not implemented yet\"\n else\n raise ArgumentError, \"`#{@read_pref}` is not valid read preferrence, use :primary, :primary_preferred, :secondary, or :secondary_preferred\"\n end\n if server\n blk.call server\n else\n find_server! unless start\n start ||= Time.now.to_i\n if start + @timeout > Time.now.to_i\n ::EM.add_timer(0.01) do\n aquire_connection(start, &blk)\n end\n else\n raise \"Can't aquire server\"\n end\n end\n end",
"def elect_primary(description, servers)\n if description.replica_set_name == replica_set_name\n unless detect_stale_primary!(description)\n servers.each do |server|\n if server.primary? && server.address != description.address\n server.description.unknown!\n end\n end\n update_max_election_id(description)\n update_max_set_version(description)\n end\n else\n log_warn(\n \"Server #{description.address.to_s} has incorrect replica set name: \" +\n \"'#{description.replica_set_name}'. The current replica set name is '#{replica_set_name}'.\"\n )\n end\n self\n end",
"def initialize(server, options = {})\n unless server.is_a?(Server)\n raise ArgumentError, 'First argument must be a Server instance'\n end\n options = options.dup\n if options[:min_size] && options[:min_pool_size] && options[:min_size] != options[:min_pool_size]\n raise ArgumentError, \"Min size #{options[:min_size]} is not identical to min pool size #{options[:min_pool_size]}\"\n end\n if options[:max_size] && options[:max_pool_size] && options[:max_size] != options[:max_pool_size]\n raise ArgumentError, \"Max size #{options[:max_size]} is not identical to max pool size #{options[:max_pool_size]}\"\n end\n if options[:wait_timeout] && options[:wait_queue_timeout] && options[:wait_timeout] != options[:wait_queue_timeout]\n raise ArgumentError, \"Wait timeout #{options[:wait_timeout]} is not identical to wait queue timeout #{options[:wait_queue_timeout]}\"\n end\n options[:min_size] ||= options[:min_pool_size]\n options.delete(:min_pool_size)\n options[:max_size] ||= options[:max_pool_size]\n options.delete(:max_pool_size)\n if options[:min_size] && options[:max_size] &&\n options[:min_size] > options[:max_size]\n then\n raise ArgumentError, \"Cannot have min size #{options[:min_size]} exceed max size #{options[:max_size]}\"\n end\n if options[:wait_queue_timeout]\n options[:wait_timeout] ||= options[:wait_queue_timeout]\n end\n options.delete(:wait_queue_timeout)\n\n @server = server\n @options = options.freeze\n\n @generation = 1\n @closed = false\n\n # A connection owned by this pool should be either in the\n # available connections array (which is used as a stack)\n # or in the checked out connections set.\n @available_connections = available_connections = []\n @checked_out_connections = Set.new\n @pending_connections = Set.new\n\n # Mutex used for synchronizing access to @available_connections and\n # @checked_out_connections. The pool object is thread-safe, thus\n # all methods that retrieve or modify instance variables generally\n # must do so under this lock.\n @lock = Mutex.new\n\n # Condition variable broadcast when a connection is added to\n # @available_connections, to wake up any threads waiting for an\n # available connection when pool is at max size\n @available_semaphore = Semaphore.new\n\n # Background thread reponsible for maintaining the size of\n # the pool to at least min_size\n @populator = Populator.new(self, options)\n @populate_semaphore = Semaphore.new\n\n ObjectSpace.define_finalizer(self, self.class.finalize(@available_connections, @pending_connections, @populator))\n\n publish_cmap_event(\n Monitoring::Event::Cmap::PoolCreated.new(@server.address, options, self)\n )\n\n @populator.run! if min_size > 0\n end",
"def clc_test_server\n puts \"clc_test_server\"\n server = clc_service.servers.find { |s| s.Name == clc_server_name }\n unless server\n server = clc_service.servers.create({\n :Name => clc_server_name\n }.merge(clc_set_test_server_attributes))\n server.wait_for { ready? }\n end\n server\nend",
"def set_server(job)\n frequency = @frequencies[-1].to_f\n job_cost = job.relative_duration / @performance / frequency\n set_slowdown(frequency)\n set_power()\n return job_cost.round(1)\n end",
"def start_server\n if @task.said_yes?(\"Would you like to start #{@name} server?\")\n action = Marv::Server::Actions.new(@server)\n action.start(false)\n end\n end",
"def _poll_server\n server_uri = @config.get(PROVISIONER_SERVER_URI)\n poll_error_interval = @config.get(PROVISIONER_WORKER_POLL_ERROR_INTERVAL).to_i || 10\n postdata = { 'provisionerId' => @provisioner_id, 'workerId' => @worker_id, 'tenantId' => @tenant }.to_json\n loop do\n begin\n response = Coopr::RestHelper.post \"#{server_uri}/v2/tasks/take\", postdata\n break response\n rescue StandardError => e\n log.error \"Unable to connect to Coopr Server #{server_uri}/v2/tasks/take: #{e}\"\n sleep poll_error_interval\n end\n end\n end",
"def preconnect(concurrent = false)\n enum = (max_size - _size).times\n\n conns = if concurrent\n enum.map{Thread.new{make_new(:default)}}.map(&:value)\n else\n enum.map{make_new(:default)}\n end\n\n sync{conns.each{|conn| checkin_connection(conn)}}\n end",
"def server\n @_server ||= case options.fetch(:type, :tcp)\n when :tcp\n TCPServer.new options.fetch(:host, \"127.0.0.1\"),\n options.fetch(:port, 2010)\n when :unix\n UNIXServer.new options.fetch(:path)\n when :pipe\n FakeServer.new options.fetch(:pipe)\n end\n end",
"def accept\n\t\t\tclient = @client_queue.pop\n\t\t\t@clients << DRbSSHServerConn.new(uri, @config, client)\n\t\t\t@clients.last\n\t\tend",
"def set_server\n @server = Server.find(params[:id])\n end",
"def as_each_server\n initial_server = @current_server\n servers_to_monitor.each do |s|\n impersonate_server(s)\n yield\n end\n ensure\n clear_server_caches if @current_server != initial_server\n end",
"def initiate\n primary, *secondaries = @nodes.shuffle\n\n primary.promote\n secondaries.each(&:demote)\n\n return primary, secondaries\n end",
"def list_serverpool(pool)\r\n current = {:errormsg => \"\", :status => \"\", :time => \"\", :poolstatus => \"\"}\r\n\r\n conn_opts=get_cli_connection\r\n if not pool\r\n Chef::Log.debug(\"#{conn_opts[:host]}...list serverpool\")\r\n Net::SSH.start( conn_opts[:host], conn_opts[:user], :password => conn_opts[:password], :port => conn_opts[:port] ) do|ssh|\r\n output = ssh.exec!(\"list serverpool\")\r\n output.each_line do |line|\r\n if line.match(/Status:/)\r\n current[:status]=line.split[1].strip\r\n elsif line.match(/Time:/)\r\n line[\"Time: \"]=\"\"\r\n current[:time]=line.strip\r\n elsif line.match(/ id:/)\r\n puts line.split(':')[2].strip\r\n elsif line.match(/Error Msg:/)\r\n line[\"Error Msg: \"]=\"\"\r\n current[:errormsg]=line.strip\r\n end\r\n end\r\n end\r\n return current\r\n else\r\n Chef::Log.debug(\"#{conn_opts[:host]}...show serverpool name=#{pool}\")\r\n Net::SSH.start( conn_opts[:host], conn_opts[:user], :password => conn_opts[:password], :port => conn_opts[:port] ) do|ssh|\r\n output = ssh.exec!(\"show serverpool name=#{pool}\")\r\n output.each_line do |line|\r\n if line.match(/Status:/)\r\n current[:status]=line.split[1].strip\r\n elsif line.match(/Time:/)\r\n line[\"Time: \"]=\"\"\r\n current[:time]=line.strip\r\n elsif line.match(/Error Msg:/)\r\n line[\"Error Msg: \"]=\"\"\r\n current[:errormsg]=line.strip\r\n elsif line.match(/ /)\r\n puts line\r\n end\r\n end\r\n end\r\n return current\r\n end\r\n end",
"def queue_server\n Thread.new do\n serv = CONFIG[\"use_unixsock\"] ? UNIXServer.new(CONFIG[\"sockpath\"]) : TCPServer.new(\"localhost\", (CONFIG[\"tcpport\"] || 10751))\n\n begin\n FileUtils.chmod(0666, CONFIG[\"sockpath\"]) if CONFIG[\"use_unixpath\"]\n while s = serv.accept\n id = SecureRandom.uuid\n begin\n json = s.read\n File.open(\"#{CONFIG[\"spooldir\"]}/queue/#{id}.json\", \"w\") do |f|\n f.write json\n end\n @queue.push id\n ensure\n s.close\n end\n end\n ensure\n serv.close\n File.delete CONFIG[\"sockpath\"] if CONFIG[\"use_unixsock\"]\n end\n end\n end",
"def set_server\n @gameserver = Gameserver.find(params[:id])\n end",
"def set_server\n @gameserver = Gameserver.find(params[:id])\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def run\n connect = false\n until connect do\n begin\n call { |server| @server = server ; start }\n rescue\n Waves::Logger.error e.to_s\n sleep 1\n end\n connect = true\n end\n end",
"def has_readable_server?(cluster, server_selector = nil)\n (server_selector || ServerSelector.get(mode: :primary)).candidates(cluster).any?\n end",
"def with_secondary(&block)\n available_nodes = nodes.select(&:secondary?).shuffle!\n while node = available_nodes.shift\n begin\n return yield(node)\n rescue Errors::ConnectionFailure => e\n next\n end\n end\n raise Errors::ConnectionFailure, \"Could not connect to a secondary node for replica set #{inspect}\"\n end",
"def choose_first\n num = 1 + rand(2)\n puts \"Player #{num} will start the game.\"\n if num == 1\n @current_player = @player1\n else\n @current_player = @player2\n end\n end",
"def run_cluster(nids, cmds, o={})\n o[:timeout] ||= 3\n nids.each_with_index do |nid, i|\n thr = Thread.new do\n Thread.current[:nid] = nid\n Thread.current[:idx] = i\n s = nil\n begin\n timeout(o[:timeout]) do\n cmd = (cmds.class == String)? cmds : cmds[i]\n s = `ssh #{nid} '#{cmd}'`\n end\n rescue TimeoutError\n puts \"Timeout #{nid}(#{i})\"\n end#begin\n s\n end#thread\n end\n \n #Collect results\n results = []\n Thread.list.each_with_index do |t,i|\n if t == Thread.main then next end\n t.join\n result = [t[:nid], t.value, t[:idx]]\n if t[:nid] && t.value\n if block_given?\n yield *result\n end\n results << result\n end\n end\n results\nend",
"def set_server\r\n @server = Server.find(params[:id])\r\n end",
"def server(name, options = {}, &block)\n server = Server.new(options.merge(:name => name, :servers => self.__servers))\n self.__servers << server\n end",
"def masterrun\n self.workersrun \n self.serverrun \n end",
"def candidate_servers\n @candidate_servers.select { |s| !['Unknown', 'PossiblePrimary'].include?(s['type']) }\n end",
"def servers\n @_servers ||= []\n end",
"def servers\n @_servers ||= []\n end",
"def computer_selection\n c_choice = rand(0..2)\n @comp = @selections[c_choice]\n end",
"def server(&block)\n @servers << Server.new(self, &block)\n end"
] |
[
"0.63139117",
"0.62591857",
"0.6240648",
"0.61686677",
"0.616389",
"0.6061973",
"0.6056626",
"0.60068345",
"0.5996559",
"0.5987265",
"0.59482604",
"0.5877202",
"0.58486336",
"0.5829915",
"0.5827921",
"0.5819526",
"0.5724076",
"0.57112455",
"0.5700058",
"0.5666263",
"0.56422216",
"0.56043184",
"0.5597398",
"0.5594389",
"0.5589274",
"0.5582552",
"0.5551828",
"0.5534989",
"0.5530909",
"0.55235857",
"0.55235857",
"0.5486251",
"0.543455",
"0.5394411",
"0.53900653",
"0.5383106",
"0.53781",
"0.53726745",
"0.5353616",
"0.53535175",
"0.53527886",
"0.53485924",
"0.53459126",
"0.5340813",
"0.5322793",
"0.5313587",
"0.5312381",
"0.5288615",
"0.5286738",
"0.5276176",
"0.5275662",
"0.52612805",
"0.5255877",
"0.5253512",
"0.5246677",
"0.52095944",
"0.52071065",
"0.51772535",
"0.51659083",
"0.5164464",
"0.5162799",
"0.5154577",
"0.51485914",
"0.51427",
"0.5137601",
"0.51278675",
"0.51269203",
"0.510656",
"0.51019096",
"0.5097523",
"0.5092028",
"0.5091045",
"0.50834227",
"0.5053725",
"0.50458807",
"0.50449187",
"0.5043577",
"0.50319034",
"0.5031785",
"0.5029334",
"0.5029296",
"0.5029296",
"0.50267327",
"0.50267327",
"0.50267327",
"0.50267327",
"0.50267327",
"0.5026715",
"0.5019776",
"0.50172615",
"0.50162196",
"0.5014178",
"0.5011886",
"0.5000889",
"0.5000072",
"0.49989647",
"0.4996562",
"0.4996562",
"0.4995129",
"0.49780086"
] |
0.71050113
|
0
|
=begin Copyright 20062008 the V8 project authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =end This file provides the following methods: encodeURIComponent(componentString) string.charCodeAt(k) component must be String
|
def encodeURIComponent(componentString)
::URI::URIEncodeComponent(componentString)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def encode_string_ex; end",
"def url_encode(string) \r\n encoded_string = ''\r\n string.each_char do |char|\r\n char = (\"%%%02X\" % char.ord) if char.match(/[A-Za-z0-9]/) == nil\r\n encoded_string << char\r\n end\r\n return encoded_string\r\n end",
"def url_encode(string) \r\n encoded_string = ''\r\n string.each_char do |char|\r\n char = (\"%%%02X\" % char.ord) if char.match(/[A-Za-z0-9]/) == nil\r\n encoded_string << char\r\n end\r\n return encoded_string\r\n end",
"def encode_string; end",
"def encode(string); end",
"def _encode(source)\n source.gsub(' ','_').gsub(/%.<.+?>/) { |match|\n CGI.escape(match[3..-2]).gsub('%', match[1..1])\n }\n end",
"def ie9_spray(t, p)\r\n js_code = Rex::Text.to_unescape(p, Rex::Arch.endian(t.arch))\r\n js_random_nops = Rex::Text.to_unescape(make_nops(4), Rex::Arch.endian(t.arch))\r\n\r\n js = %Q|\r\n\r\n function rop_chain(jutil_base){\r\n var arr = [\r\n Number(Math.floor(Math.random()*0xffffffff)),\r\n Number(0x0c0c0c0c),\r\n Number(0x0c0c0c0c),\r\n Number(0x0c0c0c1c),\r\n Number(0x0c0c0c24),\r\n Number(0x0c0c0c28),\r\n Number(Math.floor(Math.random()*0xffffffff)),\r\n Number(Math.floor(Math.random()*0xffffffff)),\r\n Number(0x0c0c0c0c),\r\n Number(0x0c0c0c3c),\r\n jutil_base + Number(0x00212f17),\r\n jutil_base + Number(0x000a5843),\r\n Number(0x0c0c0c34),\r\n jutil_base + Number(0x5de121),\r\n jutil_base + Number(0x20ca),\r\n jutil_base + Number(0x4bebeb),\r\n jutil_base + Number(0x4c03d2),\r\n jutil_base + Number(0x1be314),\r\n jutil_base + Number(0xac8e8),\r\n jutil_base + Number(0xe1859),\r\n Number(0x00000201),\r\n jutil_base + Number(0x219cf9),\r\n Number(0x00000040),\r\n jutil_base + Number(0x182e50),\r\n jutil_base + Number(0x4f5217),\r\n jutil_base + Number(0xe2fd1),\r\n jutil_base + Number(0x1339db),\r\n jutil_base + Number(0x202439),\r\n Number(0x90909090),\r\n jutil_base + Number(0x4fcfe3)\r\n ];\r\n return arr;\r\n }\r\n\r\n function d2u(dword){\r\n var uni = String.fromCharCode(dword & 0xFFFF);\r\n uni += String.fromCharCode(dword>>16);\r\n return uni;\r\n }\r\n\r\n function tab2uni(tab){\r\n var uni = \"\"\r\n for(var i=0;i<tab.length;i++){\r\n uni += d2u(tab[i]);\r\n }\r\n return uni;\r\n }\r\n\r\n function randomblock(blocksize)\r\n {\r\n var theblock = \"\";\r\n for (var i = 0; i < blocksize; i++)\r\n {\r\n theblock += Math.floor(Math.random()*90)+10;\r\n }\r\n return theblock;\r\n }\r\n\r\n function tounescape(block)\r\n {\r\n var blocklen = block.length;\r\n var unescapestr = \"\";\r\n for (var i = 0; i < blocklen-1; i=i+4)\r\n {\r\n unescapestr += \"%u\" + block.substring(i,i+4);\r\n }\r\n return unescapestr;\r\n }\r\n\r\n var heap_obj = new heapLib.ie(0x10000);\r\n var code = unescape(\"#{js_code}\");\r\n var nops = unescape(\"#{js_random_nops}\");\r\n\r\n function heap_spray(jutil_base) {\r\n while (nops.length < 0x80000) nops += nops;\r\n var offset_length = #{t['Offset']};\r\n for (var i=0; i < 0x1000; i++) {\r\n var padding = unescape(tounescape(randomblock(0x1000)));\r\n while (padding.length < 0x1000) padding+= padding;\r\n var junk_offset = padding.substring(0, offset_length);\r\n var rop = tab2uni(rop_chain(jutil_base));\r\n var single_sprayblock = junk_offset + rop + code + nops.substring(0, 0x800 - rop.length - code.length - junk_offset.length);\r\n while (single_sprayblock.length < 0x20000) single_sprayblock += single_sprayblock;\r\n sprayblock = single_sprayblock.substring(0, (0x40000-6)/2);\r\n heap_obj.alloc(sprayblock);\r\n }\r\n }\r\n |\r\n return js\r\n end",
"def encode62 arg\n SmallUrl.send(:encode62, arg)\nend",
"def path_encode(path)\n Addressable::URI.escape(path.encode(Encoding::UTF_8))\n end",
"def url_encode(s)\n s.to_s.b.gsub(/[^a-zA-Z0-9_\\-.~]/n) { |m|\n sprintf(\"%%%02X\", m.unpack1(\"C\"))\n }\n end",
"def url_encode(s)\n s.to_s.b.gsub(/[^a-zA-Z0-9_\\-.]/n) { |m|\n sprintf(\"%%%02X\", m.unpack(\"C\")[0])\n }\n end",
"def path_encode(path)\n URI.encode(path.encode(Encoding::UTF_8))\n end",
"def path_encode(path)\n CGI.escape(path.encode(Encoding::UTF_8))\n end",
"def encodeURI s\n URI.escape s, /[^A-Za-z0-9;,\\/?:@&=+$\\-_.!~*'()#]/\nend",
"def _encode_string(string)\n return string unless string.kind_of? String\n string.encode(\"UTF-8\", :undef => :replace, :invalid => :replace, :replace => \"?\")\n end",
"def encode(string)\n Base32.encode(string).downcase.sub(/=+$/, '')\n end",
"def url_encode\n Rack::Utils.escape self\n end",
"def encode!; end",
"def reencode_string(input); end",
"def encode_key(key)\n @uri_parser.escape(key, /[^-_.a-zA-Z0-9]/n) # //n switch means explicit 'ASCII-8BIT' pattern\n end",
"def url_encode(string)\n string = CGI.escape string\n end",
"def encode(string)\n URI.escape(string)\n end",
"def escape(string)\n string.gsub(/([^ a-zA-Z0-9_.-]+)/) do\n $1.nil? ? nil : ('%' + $1.unpack('H2' * $1.bytesize).\n compact.join('%').upcase)\n end.tr(' ','+')\nend",
"def percent_encode(str)\n # Replaced deprecated URI.escape with CGI.escape\n # CGI.escape replaces spaces with \"+\", so we also need to substitute them with \"%20\"\n CGI.escape(str).gsub('+', '%20')\n end",
"def percent_encode(str)\n URI.encode(str, /[^a-zA-Z0-9\\-\\.\\_\\~]/)\n end",
"def encode!(*); self; end",
"def normalize_encode_params(params); end",
"def escape(string)\n encoding = string.encoding\n string.b.gsub(/([^ a-zA-Z0-9_.\\-~]+)/) do |m|\n '%' + m.unpack('H2' * m.bytesize).join('%').upcase\n end.tr(' ', '+').force_encoding(encoding)\n end",
"def unencode_javascript_unicode_escape(str)\n if str.respond_to?(:gsub!)\n str.gsub!(/\\\\u([0-9a-fA-F]{4})/) do |s| \n int = $1.to_i(16)\n if int.zero? && s != \"0000\"\n s\n else\n [int].pack(\"U\")\n end\n end\n end\n str\n end",
"def encode(byte,sz = schluessel) # given are the to be encoded bytecode and the key\n # only letters will be encoded, numbers & special characters won't\n if ('A'..'Z').include?(byte.chr) || ('a'..'z').include?(byte.chr)\n start = (byte > 96) ? 'a'.ord : 'A'.ord # determine the start-value for decoding a-z & A-Z\n anzahl_zeichen = 26 # das deutsche Alphabet\n\n (byte + sz - start) % anzahl_zeichen + start\n else\n byte\n end\n end",
"def encode_param text\n CGI::escape(text).gsub(\"+\", \"%20\").gsub(\"%\", \"%25\")\n end",
"def url_encode(param)\n URI.escape(param, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n end",
"def encode(*); self; end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def encoding=(_arg0); end",
"def get_utf8cstring(string,buffer,bufferSize)\n JavaScriptCore::Lib.JSStringGetUTF8CString(string,buffer,bufferSize)\n end",
"def is_equal_to_utf8cstring(a,b)\n JavaScriptCore::Lib.JSStringIsEqualToUTF8CString(a,b)\n end",
"def encode(text); end",
"def encode(text); end",
"def x_test_query_string_parameter_values_should_be_cgi_unescaped\n request = request_proxy do |r|\n r.env['QUERY_STRING'] = 'url=http%3A%2F%2Ffoo.com%2F%3Fa%3Db%26c%3Dd'\n end\n assert_equal(\n [['url', 'http://foo.com/?a=b&c=d']],\n request.parameters_for_signature.sort\n )\n end",
"def encode\n index = e_byte(@idx)\n e_byte(NEW_CACHE)+index+@value.encode\n end",
"def encode_str(str)\n require \"base64\"\n encoded_str=Base64.encode64(str)\n return encoded_str\nend",
"def uri_escape_key(string)\n if string.nil?\n nil\n else\n CGI.escape(string.encode('UTF-8')).gsub('+', '%20').gsub('%7E', '~').gsub(\"%2F\", \"/\")\n end\n end",
"def internal_encoding()\n #This is a stub, used for indexing\n end",
"def path_encode(path, *args)\n arguments = []\n args.each do |arg|\n arguments.push(CGI.escape(CGI.unescape(arg.to_s)))\n end\n\n format(path, *arguments)\n end",
"def encode(code, options = T.unsafe(nil)); end",
"def safe_encode(string)\n CGI::escape(string).gsub(/\\+/, '%20')\n end",
"def url_escape(string)\n return '' if string.blank?\n\n string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do\n '%' + $1.unpack('H2' * $1.size).join('%').upcase\n end.tr(' ', '+')\n end",
"def URIEncodeComponent(componentString)\n Encode(componentString, :unescapePredicate);\n end",
"def encode_parameters(**prm)\n encode_parameters!(prm)\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 encode\n ed = encode_edata\n if not ed.reloc.empty?\n puts 'W: encoded string has unresolved relocations: ' + ed.reloc.map { |o, r| r.target.inspect }.join(', ')\n end\n ed.fill\n ed.data\n end",
"def encode(string)\n [string]\n end",
"def check_escaped js, expected\n assert { escaped(js) == expected }\nend",
"def encode\n transform :encode \n end",
"def safe_encode value\n value = URI.encode_www_form_component(value).gsub(/\\+/,'%20').gsub(/\\*/,'%2A').gsub(/%7E/,'~')\n end",
"def e_sh_js(str)\n (e_sh str).gsub(\"\\\\\", \"\\\\\\\\\\\\\\\\\")\nend",
"def external_encoding()\n #This is a stub, used for indexing\n end",
"def encode_string(string)\n string.encode('UTF-8', {\n :invalid => :replace,\n :undef => :replace,\n :replace => '?'\n })\n rescue Exception\n nil\n end",
"def escape(string)\n string.gsub(/([\\<\\>\\:\\\"\\/\\\\\\|\\?\\*]+)/n) do\n '%' + $1.unpack('H2' * $1.size).join('%').upcase\n end.tr(' ', '_')\n end",
"def encode(message, key)\n message.codepoints.zip(key.to_s.chars.map(&:to_i).cycle).map { |x, v| x + v - 96}\nend",
"def urlencode\n #URI.escape(self)\n _rfc2396_parser.escape(self)\n end",
"def base64_encode value\n encoded_str = Base64.urlsafe_encode64 value, padding: false\nend",
"def encode_string(string)\n string.encode('UTF-8', {\n :invalid => :replace,\n :undef => :replace,\n :replace => '?'\n })\n rescue Exception\n nil\n end",
"def encode_with(coder); end",
"def encode_chunk(chunk); end",
"def encoded_url\n CGI.escape(url)\n end",
"def escape(string)\n string.gsub(/([^a-zA-Z0-9_.\\-~\\/]+)/) {\n \"%\" + $1.unpack(\"H2\" * $1.bytesize).join(\"%\").upcase\n }\n end",
"def url_to_javascript(source, options = T.unsafe(nil)); end",
"def safe_escape(uri); end",
"def url_utf8(raw_url)\n URI::escape(raw_url)\n end",
"def encode_URI(path)\n # For each component in the path, URL encode it and add it\n # to the array path component.\n path_components = []\n path.split(\"/\").each do |str|\n path_components << ERB::Util.url_encode(str)\n end\n # Prefix and join the encoded path components.\n \"/#{path_components.join('/')}\"\n end",
"def encode_header(s); s; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encode_method(method)\n method.gsub('?', '-')\n end",
"def encode_method(method)\n method.gsub('?', '-')\n end",
"def to_utf8(s)\n return force_encoding(s.gsub(/&(.*?)-/n) {\n if $1.empty?\n \"&\"\n else\n base64 = $1.tr(\",\", \"/\")\n x = base64.length % 4\n if x > 0\n base64.concat(\"=\" * (4 - x))\n end\n base64.unpack(\"m\")[0].unpack(\"n*\").pack(\"U*\")\n end\n }, \"UTF-8\")\n end",
"def uri_escape(str)\n str.split(//).map {|c| c.match(URI::UNSAFE) ? sprintf('%%%02x',c.ord).upcase : c }.join\nend",
"def uri_escape(str)\n str.split(//).map {|c| c.match(URI::UNSAFE) ? sprintf('%%%02x',c.ord).upcase : c }.join\nend",
"def encode_params_base64(params)\n query = params.map { |(k, v)| \"#{uri_escape(k.to_s)}=#{uri_escape(v.to_s)}\" }.join('&')\n s = Base64.encode64(query)\n s.gsub!(/(\\s|==$)/, '')\n s\n end",
"def encode_code( str, rs )\n\t\t\t#str.gsub( %r{&}, '&' ).\n\t\t\t\t#gsub( %r{<}, '<' ).\n\t\t\t\t#gsub( %r{>}, '>' ).\n\t\t\t\t#gsub( CodeEscapeRegexp ) {|match| EscapeTable[match][:md5]}\n return str\n\t\tend"
] |
[
"0.55740696",
"0.55436206",
"0.55436206",
"0.5534644",
"0.5534061",
"0.53202385",
"0.5256516",
"0.5218073",
"0.51883304",
"0.5177771",
"0.5161475",
"0.51280713",
"0.51190186",
"0.51151645",
"0.5104644",
"0.5075727",
"0.50694495",
"0.50589395",
"0.5043371",
"0.5043219",
"0.50235635",
"0.50107354",
"0.50065887",
"0.49601346",
"0.4911499",
"0.490856",
"0.4899104",
"0.489238",
"0.48791003",
"0.48719427",
"0.47961676",
"0.4794716",
"0.47938013",
"0.47937053",
"0.47937053",
"0.47937053",
"0.47937053",
"0.47937053",
"0.47924632",
"0.47924632",
"0.4786526",
"0.47822356",
"0.4781497",
"0.4781497",
"0.47742507",
"0.4764454",
"0.47624138",
"0.47526944",
"0.47525397",
"0.47518632",
"0.47224075",
"0.47095215",
"0.47075385",
"0.46939257",
"0.46936736",
"0.46862522",
"0.4676693",
"0.46715966",
"0.46688858",
"0.46685115",
"0.46599618",
"0.4657148",
"0.46548474",
"0.46483144",
"0.4645453",
"0.46324182",
"0.4624234",
"0.46211305",
"0.46193027",
"0.4618391",
"0.46161008",
"0.4611461",
"0.45987466",
"0.45886725",
"0.45815042",
"0.45774692",
"0.45767426",
"0.45663968",
"0.454984",
"0.454984",
"0.454984",
"0.454984",
"0.454984",
"0.454984",
"0.454984",
"0.454984",
"0.454984",
"0.454984",
"0.454984",
"0.454984",
"0.454984",
"0.454984",
"0.454984",
"0.45403552",
"0.45403552",
"0.45379502",
"0.45356384",
"0.45356384",
"0.45354238",
"0.45313907"
] |
0.5885299
|
0
|
component must be String
|
def URIEncodeComponent(componentString)
Encode(componentString, :unescapePredicate);
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def component_present\n if component.nil?\n errors.add(:component, 'is not valid.')\n end\n end",
"def valid?(component)\n true\n end",
"def visitComponent component,args=nil\n name=component.name\n type=component.type\n \"component :#{name} => #{type.capitalize}\"\n end",
"def component name\n name = name.to_s\n required_components\n @component_by_name[name] || \n raise(Cabar::Error, \"Cannot find component named #{name.inspect}\")\n end",
"def component_params\n params.permit(:component_name)\n end",
"def initialize(component)\n @component=component\n end",
"def component_name\n @component_name ||= settings(\"components.#{params[:component]}.name\")\n end",
"def component_params\n params.require(:component).permit(:name)\n end",
"def parse_component_value(input = T.unsafe(nil)); end",
"def component!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 40 )\n\n\n\n type = COMPONENT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 217:12: 'component'\n match( \"component\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 40 )\n\n\n end",
"def component\n self.class.component\n end",
"def to_s\n \"Component '#{name}' #{id}\"\n end",
"def components\n\n end",
"def parse_component(component_string)\n # parses the component value for a OLASimple Package sample\n # values are formatted as \"key: value\" or \"key: [val1, val2, val3]\"\n val = nil\n tokens = component_string.split(/\\s*\\:\\s*/)\n m = /\\[(.+)\\]/.match(tokens[1])\n if !m.nil?\n arr_str = m[1]\n val = arr_str.split(/\\s*,\\s*/).map(&:strip)\n else\n val = tokens[1]\n end\n [tokens[0], val]\n end",
"def components; end",
"def _add_component comp #:nodoc:\n end",
"def set_component(component)\n self.namespace(component.name)\n @component = component\n end",
"def _test_component(component, context)\n true\n end",
"def getComponent()\n @component\n end",
"def string?; end",
"def valid_string?(field, param)\n true\n end",
"def component(name)\n components.each { |c| return c if c.name == name.to_sym }\n return nil\n end",
"def component\n simplelist(tk_send('component'))\n end",
"def component(name, value = '', &block)\n txt = block_extract(value, &block)\n @doc_state[:components][name].call(txt)\n end",
"def react_component_params\n params.require(:react_component).permit(:nickname, :component_name)\n\n end",
"def assert_p(component, property, value, componentInfo=nil)\n if(value.is_a? Regexp)\n $marathon.assertProperty(ComponentId.new(component, componentInfo), property, value)\n else\n $marathon.assertProperty(ComponentId.new(component, componentInfo), property, value.to_s)\n end\nend",
"def assert_p(component, property, value, componentInfo=nil)\n if(value.is_a? Regexp)\n $marathon.assertProperty(ComponentId.new(component, componentInfo), property, value)\n else\n $marathon.assertProperty(ComponentId.new(component, componentInfo), property, value.to_s)\n end\nend",
"def consume_component_value(input = T.unsafe(nil)); end",
"def component_name_or_css_class(component_class:, component_name:, css_class:)\n if css_class\n # Don't return a '.' string\n return '' if component_css_class_string(component_class: component_class).blank?\n\n # returns a string like '.slat-actions'\n \".#{component_css_class_string(component_class: component_class)}\" \n else\n component_name\n end\n end",
"def get_component_link(component)\n \"/component-guide/#{component.gsub(' ', '_')}\"\n end",
"def should_component_be_checked(component_name)\n if params[:from].blank?\n true\n else\n if component_name.downcase == params[:from]\n true\n else\n false\n end\n end\n end",
"def set_component\n @component = Component.find(params[:id])\n end",
"def set_component\n @component = Component.find(params[:id])\n end",
"def set_component\n @component = Component.find(params[:id])\n end",
"def set_component\n @component = Component.where(id: params[:id]).includes(:component_subtypes).first\n end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def component\n self\n end",
"def report_component=(component)\n nil\n end",
"def add_component(component)\n\t\t@components << component\n\tend",
"def string\n end",
"def string\n end",
"def string\n end",
"def get_component\n @component = Component.find(params[:id])\n end",
"def expected_type\n 'string'\n end",
"def component_locator\n \"#\" + self.class.name.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n gsub('/', '-').\n downcase\n end",
"def component_types; @component_types; end",
"def render(component)\n\t\t\tcase component\n\t\t\twhen Area\n\t\t\t\t\"<div class=\\\"area #{component.name}\\\" id=\\\"#{component.container.id}-#{component.name}\\\">\\n#{component.components.collect {|c| render c }.join(\"\\n\")}\\n</div>\"\n\t\t\twhen Component\n\t\t\t\tif renderers = self.class.renderers[component.class]\n\t\t\t\t\text = (@cms_extension || :html).to_sym\n\t\t\t\t\trenderer = self.class.renderer_for component.class, ext\n\t\t\t\t\tcase component\n\t\t\t\t\twhen Page\n\t\t\t\t\t\tcontent_type ext\n\t\t\t\t\t\tif renderer\n\t\t\t\t\t\t\tinstance_exec component, &renderer\n\t\t\t\t\t\telsif component.respond_to?(\"to_#{ext.to_s}\".to_sym)\n\t\t\t\t\t\t\tcomponent.send \"to_#{ext.to_s}\".to_sym\n\t\t\t\t\t\tend\n\t\t\t\t\twhen Component\n\t\t\t\t\t\tcomponents.push component\n\t\t\t\t\t\tresult = if renderer\n\t\t\t\t\t\t\tinstance_exec component, &renderer\n\t\t\t\t\t\telsif component.respond_to?(\"to_#{ext.to_s}\".to_sym)\n\t\t\t\t\t\t\tcomponent.send \"to_#{ext.to_s}\".to_sym\n\t\t\t\t\t\tend\n\t\t\t\t\t\tcomponents.pop\n\t\t\t\t\t\tresult\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def add_available_component(component)\n if available_components.include?(component.name)\n raise ArgumentError, \"Component already '#{component.name}' already defined\"\n end\n available_components[component.name] = component\n end",
"def component_class\n raise NotImplementedError, 'Specify component class in settings model.'\n end",
"def expect_string name, value\n expect_type name,\n value, \n \"string\",\n String\n end",
"def to_s\n fail @error if @error && @value.empty?\n\n @template.sub('{value}', URI.encode(@value.to_s)) + @component\n end",
"def PartName=(v) Axlsx::validate_string",
"def get_component( component_class )\n\t\treturn self.world.get_component_for( self, component_class )\n\tend",
"def append_component(name)\n @component = \"/#{name}\"\n self\n end",
"def component(component_name)\n InvokableComponent.new(job, environment, scope.component(component_name))\n end",
"def call(component)\n fail NotImplementedError\n end",
"def string(value)\n message = \"Invalid typeface: must be a string\"\n raise ArgumentError, message unless value.is_a?(String)\n end",
"def set_component\n # Loads a Component object with associated rules, reviews,\n # descriptions, checks and additional answers where ID is equal to params id.\n @component = Component.eager_load(\n rules: [:reviews, :disa_rule_descriptions, :rule_descriptions, :checks,\n :additional_answers, :satisfies, :satisfied_by, {\n srg_rule: %i[disa_rule_descriptions rule_descriptions checks]\n }]\n ).find_by(id: params[:id])\n\n # Returns out of the method If the Component instance variable does exist.\n return if @component.present?\n\n message = 'The requested component could not be found.'\n respond_to do |format|\n # Return an HTML response with an alert flash message if request format is HTML.\n format.html do\n flash.alert = message\n redirect_back(fallback_location: root_path)\n end\n # Return a JSON response with a toast message if request formt is JSON.\n format.json do\n render json: {\n toast: {\n title: 'Control not found',\n message: message,\n variant: 'danger'\n }\n }, status: :not_found\n end\n end\n end",
"def component_matches?(component, uri)\n component_template = component_templates[component]\n if component_template\n component_url = uri.public_send(component).to_s\n unless component_template.extract(component_url)\n # to support Addressable's expansion of queries, ensure it's parsing the fragment as appropriate (e.g. {?params*})\n prefix = COMPONENT_PREFIXES[component]\n return false unless prefix && component_template.extract(prefix + component_url)\n end\n end\n true\n end",
"def render(component, prefix)\n @component = component\n @prefix = prefix\n \n name = self.class.to_s.rpartition('::').last.gsub(/([a-z])([A-Z])/) { \"#{$1}_#{$2}\" }.downcase\n haml(\"fields/#{name}\")\n end",
"def get_component_any(componentName, componentInfo=nil)\n return $marathon.getComponent_any(ComponentId.new(componentName, componentInfo))\nend",
"def string\n @string\n end",
"def string\n @string\n end",
"def get_component_any(componentName, componentInfo=nil)\n return $marathon.getComponent_any(ComponentId.new(componentName, componentInfo))\nend",
"def resolve_valid_choice(component)\n available_string = self.class.available_choices_for(component).join(\", \")\n choice = options[component]\n until valid_choice?(component, choice)\n say(\"Option for --#{component} '#{choice}' is not available.\", :red)\n choice = ask(\"Please enter a valid option for #{component} (#{available_string}):\")\n end\n choice\n end",
"def string(str); end",
"def ui_add(component)\n add component\n end",
"def findComponent(component_name, component_version = nil)\n\n component_version_s = component_version.nil? ? 'latest' : component_version\n component_version = nil if component_version == 'latest'\n\n if component_name.include? '@' and (not component_name.start_with? 'git')\n parts = component_name.split('@')\n component_name = parts[0]\n component_version = parts[1]\n end\n\n # if component specified as git location\n new_name, candidate_git = findComponentGitTemplate(component_name, component_version_s)\n return buildComponent(new_name, candidate_git) unless candidate_git.nil?\n\n # if not git but has .snapshot lookup in default\n if (not component_version.nil?) and component_version.end_with? '.snapshot'\n new_name, default_candidate = findComponentDefault(component_name, component_version_s)\n return buildComponent(new_name, default_candidate) unless default_candidate.nil?\n end\n\n # try in all of the component source\n @component_sources.each do |source|\n component_full_name = \"#{component_name}@#{component_version.nil? ? 'latest' : component_version}\"\n # TODO handle http(s) sources and their download to local\n if source.start_with?('http')\n raise StandardError, 'http(s) sources not supported yet'\n elsif source.start_with?('s3://')\n # s3 candidate\n\n s3_candidate = findComponentS3(source, component_name, component_version_s)\n if not s3_candidate.nil?\n # at this point all component files are download to local file system and consumed from there\n return buildComponent(component_name, s3_candidate)\n end\n\n else\n # file system candidate\n candidate = \"#{source}/#{component_name}\"\n candidate = \"#{candidate}/#{component_version}\" unless component_version.nil?\n candidate_hl_path = \"#{candidate}/#{component_name}.highlander.rb\"\n candidate2_hl_path = \"#{source}/#{component_name}.highlander.rb\"\n puts \"Trying to load #{component_full_name} from #{candidate} ... \"\n if File.exist?(candidate_hl_path)\n return buildComponent(component_name, candidate)\n end\n puts \"Trying to load #{component_full_name} from #{source} ... \"\n if File.exist?(candidate2_hl_path)\n return buildComponent(component_name, source)\n end unless component_version_s != 'latest'\n end\n end\n\n # try default component source on github\n component_name, default_candidate = findComponentDefault(component_name, component_version_s)\n return buildComponent(component_name, default_candidate) unless default_candidate.nil?\n\n raise StandardError, \"highlander template #{component_name}@#{component_version_s} not located\" +\n \" in sources #{@component_sources}\"\n end",
"def components\n @components ||= @string.split('/').reject{|x| x == '' || x == nil} rescue []\n end",
"def parse_component_values(input = T.unsafe(nil)); end",
"def string?(description)\n description.type == :str\n end",
"def string() end",
"def get_component(componentName, componentInfo=nil)\n return $marathon.getComponent(ComponentId.new(componentName, componentInfo))\nend",
"def remove_component(component)\n\t\t@components.delete(component)\n\tend",
"def component(component_name, component_specification, component_options={})\n @current_shard[:components] << {\n :name => component_name,\n :specification => component_specification.to_s, :options => component_options,\n :config_line => get_config_line(caller)\n }\n end",
"def String(p0) end",
"def require_string(value)\n if value.nil? == true || value.to_s.empty?\n log_error_and_raise(\"expected string value, got nil or empty string\")\n end\n\n if value.is_a?(String) != true\n log_error_and_raise(\"expected string value, got #{value.class}, #{value.inspect}\")\n end\n\n end",
"def string=(_arg0); end",
"def input_string; end",
"def get_component(componentName, componentInfo=nil)\n return $marathon.getComponent(ComponentId.new(componentName, componentInfo))\nend",
"def validate_string(value)\n raise CustomErrors::FilterArgumentError, 'Value must be a string' unless value.is_a?(String)\n end",
"def string(*) end",
"def component_params\n params.require(:component).permit(:fiber,:trackingsheet, :countryoforgin, :customer, :mill, :code, :hangtag2, :hangtag3, :mainlabel, :carecontentlabel, :upcsticker, :glovehanger, :hatjhook, :sizelabel)\n end",
"def component_css_class\n ''\n end",
"def component_params\n params.require(:component).permit(:kind, :list_id, :part_id)\n end",
"def get_string_value\n\t\tend",
"def components=(value)\n @components = value\n end",
"def should_be_string(data)\n if data.class != String\n raise \"Data needs to be a string; you passed in a #{data.class}: #{data}\"\n end\n end",
"def course_component?(key)\n valid_components = %w(AttendanceRegisters Glossary News Checklists\n Grades QuestionLibrary Competencies GradesSettings\n Quizzes Content Groups ReleaseConditions CourseFiles\n Homepages Rubrics Discussions IntelligentAgents\n Schedule DisplaySettings Links SelfAssessments\n Dropbox LtiLink Surveys Faq LtiTP ToolNames Forms\n Navbars Widgets)\n valid_components.include?(key)\n # returns whether the key is actually a course component\nend",
"def string()\n #This is a stub, used for indexing\n end",
"def param_check_string(_param, _display, _value)\n critical_error('the param_check_string method was not overridden after being included in a database class')\n end",
"def set_text_component\n @text_component = TextComponent.find(params[:id])\n end",
"def set_text_component\n @text_component = TextComponent.find(params[:id])\n end"
] |
[
"0.66847557",
"0.6398965",
"0.6386892",
"0.62524426",
"0.60941964",
"0.60575044",
"0.59769225",
"0.59567916",
"0.5943029",
"0.5893118",
"0.5840735",
"0.5818399",
"0.5801706",
"0.5775215",
"0.5733513",
"0.56699544",
"0.56215096",
"0.5609815",
"0.5602866",
"0.5584538",
"0.5542884",
"0.5471267",
"0.54576004",
"0.5448585",
"0.5423579",
"0.54201907",
"0.54201907",
"0.53982264",
"0.53976053",
"0.5373112",
"0.5367277",
"0.5355675",
"0.5355675",
"0.5355675",
"0.5351233",
"0.5347719",
"0.5347719",
"0.5347719",
"0.5347719",
"0.5347719",
"0.5347719",
"0.5347719",
"0.5347719",
"0.5347719",
"0.5346608",
"0.53453344",
"0.5344794",
"0.5343816",
"0.5343816",
"0.5343816",
"0.5336805",
"0.5329582",
"0.53072596",
"0.5295756",
"0.5295121",
"0.5291644",
"0.5284584",
"0.5277238",
"0.52733207",
"0.52645403",
"0.5259497",
"0.52381843",
"0.5219448",
"0.5216608",
"0.52093244",
"0.52037877",
"0.51823854",
"0.51710296",
"0.51485914",
"0.5142069",
"0.5142069",
"0.5140408",
"0.5122556",
"0.5119195",
"0.51034915",
"0.5091763",
"0.5087881",
"0.50855476",
"0.50757056",
"0.5069869",
"0.5063267",
"0.5061867",
"0.50466996",
"0.5044976",
"0.5039225",
"0.5037787",
"0.50348353",
"0.50285006",
"0.5024957",
"0.5019534",
"0.50147396",
"0.5010267",
"0.50095105",
"0.50093544",
"0.50032324",
"0.5000894",
"0.4999205",
"0.49949655",
"0.4994681",
"0.4987678",
"0.4987678"
] |
0.0
|
-1
|
Feel free to google "how to generate a random number in ruby"
|
def roll
# code goes here
myArray = ['1', '2', '3', '4', '5', '6']
puts myArray
puts myArray[rand(myArray.length)]
Integer(myArray[rand(myArray.length)])
#myArray[rand(myArray.length)]
#rand(1..6)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def generate_number\r\n return randomNumber = 1 + rand(100)\r\n end",
"def get_random_number()\n rand(0x7fffffff).to_s\nend",
"def gen_num\n rand(1..100)\nend",
"def random_number\n t = Time.now.to_f / (Time.now.to_f % Time.now.to_i)\n random_seed = t * 1103515245 + 12345;\n (random_seed / 65536) % 32768;\nend",
"def rand\n return extract_number / (2**32 -1).to_f\n end",
"def random\n 1 + (10 * rand(0))\n end",
"def generate_number\r\n \r\n #Generate and return a random number between 1 and 1000\r\n return randomNo = 1 + rand(1000)\r\n \r\n end",
"def random_no\n rand(5000)\nend",
"def random_number\n rand(0..20)\n end",
"def random_num_generator\n return rand(1..100)\nend",
"def random_num_generator\n return rand(1..100)\nend",
"def generate_random_number\n rand(1..6) + 1\nend",
"def generate_number\r\n \r\n #Generate and return a random number between 1 and 100\r\n return randomNo = 1 + rand($maxChallengeRange)\r\n \r\n end",
"def generate_one_random_number()\r\n @l = @total_no_of_bits + 1\r\n bit_string = @total_sequence.join('')\r\n numerator = bit_string.to_i(2)\r\n random_number = numerator *1.0 / 2**@l\r\n\r\n return random_number\r\n end",
"def srand(num=0) end",
"def number_generator\n rand(1..20)\n end",
"def generate_number\n \n #generate and return a random number from 1 to 100\n return randomNO = 1 + rand(1000)\n\n end",
"def pick_random_number(digits=1)\n min = 10 ** (digits - 1)\n max = (10 ** digits ) - 1\n semirandom = min + rand(max-min)\n semirandom += 1 if semirandom == 666 #would be unpleasant to receive...\n return semirandom\n end",
"def generate_random_number\n (1..10).to_a.sample\nend",
"def get_random\n File.read(\"/dev/urandom\", 8).unpack(\"H*\")[0].hex\n rescue\n rand(9117854927)\n end",
"def randomizer\n number = rand(0..1)\n return number\nend",
"def random_number\n rand(1..20)\nend",
"def make_not_so_random!\n srand 1213\nend",
"def rand_digit #generate random digit\n\treturn rand(10)\nend",
"def random_number \n rand(6) + 1 \nend",
"def random_number\n rand 0..20\nend",
"def getRand()\n # With 32-bit MAX_INT to be able to have cool numbers\n return Random.rand() * 2147483647;\nend",
"def random_int(max)\n rand(max)\nend",
"def get_random_number(max_value = 10)\n\trand(max_value)\nend",
"def randomNum()\r\n num = rand(1..10)\r\nend",
"def nostalgia; return rand end",
"def digit\n rand(10)\n end",
"def generate_random()\n begin\n r = Kernel.rand()\n end while r == 0.0\n \n if use_flt?\n BigDecimal(r.to_s)\n else\n r\n end\n end",
"def uniform_int(n)\n (rand()*n).to_i\nend",
"def number\n\t\"#{Time.now.to_i}-#{rand(1_000_000)}\"\n end",
"def rand_nr\n return rand(1..2)\nend",
"def get_rand\n rand = \"\";\n File.open(\"/dev/urandom\").read(20).each_byte{|x| rand << sprintf(\"%02x\",x)}\n rand\nend",
"def random_number(min, max)\n rand(max-min+1)+min\n end",
"def random_num(min, max)\n rand(max - min + 1) + min\nend",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def n_generator\n number = rand(10..30)\n end",
"def random_number(seed, range)\n seed = seed.to_i\n return nil if seed <= 0\n rng2 = Random.new(seed)\n num = rng2.rand(range) + 1\n num\n end",
"def new_account_number\n return rand(99999999)\n end",
"def new_account_number\n return rand(99999999)\n end",
"def random_num(min, max)\n rand(max - min + 1) + min\nend",
"def non_zero_digit\n rand(1..9)\n end",
"def random_account_number\r\n acct_num = rand(10**11).to_s.rjust(11, '1')\r\n return acct_num\r\n end",
"def make_rand\n Random.new_seed\n return Random.new\n end",
"def random(range)\n return rand(range + 1)\nend",
"def random\n card = rand(1..52)\n card.to_i\n end",
"def random\n card = rand(1..52)\n card.to_i\n end",
"def ran_str_maker\r\n length = 10\r\n ran_str = rand(36**length).to_s(36)\r\n return ran_str\r\nend",
"def rand_num(range)\n num = @rng.rand(range) + 1\n num\n end",
"def test_random_number_generation\n rand = @game.get_random_number(0, 10)\n assert rand <= 10 && rand >= 0\n end",
"def gen_random_int\n $lasti = ($lasti * IA + IC) % IM\nend",
"def randomBitNum x\n bitString = \"1\"\n (1...x).each do\n bitString += rand(2).to_s\n end\n return bitString.to_i(2)\nend",
"def randomBitNum x\n bitString = \"1\"\n (1...x).each do\n bitString += rand(2).to_s\n end\n return bitString.to_i(2)\nend",
"def get_random_number\n\t\trandom_num = rand(@deck.length)\n\tend",
"def rand_id\n rand(10**7...10**8).to_s\nend",
"def random_id\n rand(1000000) + 20000\nend",
"def rand(max=0) end",
"def rand\n warn \"STUB: rand in distribution.rb\"\n end",
"def random_number( bits )\n m = (1..bits-2).map{ rand() > 0.5 ? '1' : '0' }.join\n s = \"1\" + m + \"1\"\n s.to_i( 2 )\n end",
"def generate_number(store)\n store.number = loop do\n random_number = Digest::SHA1.hexdigest([Time.now, rand].join)[0..5].upcase\n break random_number unless Store.exists?(number: random_number)\n end\n end",
"def random_account_number\n acct_num = rand(10**11).to_s.rjust(11, '1')\n return acct_num\n end",
"def rand\n Kernel.rand(self)\n end",
"def generator_rand(max)\n return nil if max < 0\n\n result = rand(max + 1)\n result\n end",
"def rand_id\n rand(10**7...10**8).to_s\n end",
"def get_random_number(gender)\n\t\tcount = total_count(gender)\n\t\tset_random_seed\n\t\treturn rand(1..count)\n\tend",
"def random20\n rand(20) + 1\n end",
"def get_next_uuid\n rand(8**32).to_s(36)\n end",
"def gen_rand b\n p = rand(2**b)+2**b-1\n while ! rand_test p\n# puts p\n p += 1\n end\n p\nend",
"def get_new_random_number random_numbers\n random_number = 0\n begin\n random_number = rand @working_dataset.get_dataset_size\n end while (random_numbers.has_key?(random_number))\n random_numbers[random_number] = 1\n return random_number\n end",
"def rand_digit\n ascii = Random.rand(10) + 48\n return ascii.chr\nend",
"def random_integer(limit)\n Rubinius.primitive :randomizer_rand_int\n raise PrimitiveFailure, \"Randomizer#rand_int primitive failed\"\n end",
"def random_integer(limit)\n Rubinius.primitive :randomizer_rand_int\n raise PrimitiveFailure, \"Randomizer#rand_int primitive failed\"\n end",
"def sequence_number\n @sequence_number ||= rand(0xFFFFFFFF)\n end",
"def random_float\n rand * rand(10)\n end",
"def get_rand range\n\t\t@random_number = rand(range)\n\tend",
"def any_number(*options)\n number = (rand(2 * MAX_RAND) - MAX_RAND).to_f/100.0\n if options.include? :positive\n number + MAX_RAND\n elsif options.include? :negative\n number - MAX_RAND\n else\n number\n end\n end",
"def random\n rand - rand\nend",
"def generateCode()\n require 'securerandom'\n return SecureRandom.hex\n end",
"def generate_number\n if self.respond_to? :inv_cdf\n inv_cdf(rand)\n else\n generate_sample 1\n end\n end",
"def rand(max)\n max-1\nend",
"def generate_int\n UUIDTools::UUID.random_create.to_i\n end",
"def initialize(num = rand(52))\n self.num = num\n end",
"def generate_random_number_except_123\n x = rand(1000)\n throw :finish if x == 123\nend",
"def random_status_number_generator\n Random.rand(1..10)\n end",
"def rand_phone options={}\r\n\t\"210#{random(1111111, 9999999).to_s}\"\r\nend",
"def rand_seed\n rand(0x7fffffff)\n end",
"def random_integer(max_size)\r\n 1 + rand(max_size)\r\n end",
"def gen_speed\n rand + 15.0\n end",
"def generate_order_number\n r = Random.new\n \"#{self.class.to_s.gsub(/[a-z]/, '')}#{Time.now.to_i}\"\n end",
"def usw_random(max=-1, min=0)\n Sass::Script::Number.new( max.to_i < 0 ? rand() : rand(min.to_i .. max.to_i ))\n end",
"def randr(min, max)\n rand(max - min + 1) + min\nend",
"def random(num_bytes)\n SecureRandom.random_bytes(num_bytes)\n end",
"def int(size)\n rand(size).to_i\n end",
"def randstr\n\trand(36 ** 8).to_s(36)\nend"
] |
[
"0.8495249",
"0.83665675",
"0.8312836",
"0.8223235",
"0.8188632",
"0.81023866",
"0.8082494",
"0.80452955",
"0.80336106",
"0.8030636",
"0.8030636",
"0.80123246",
"0.79662156",
"0.7955537",
"0.7934739",
"0.7909762",
"0.78774667",
"0.78719956",
"0.78630906",
"0.78546405",
"0.78182465",
"0.78144264",
"0.7806386",
"0.77860206",
"0.7784265",
"0.7769858",
"0.7765166",
"0.76942825",
"0.76324296",
"0.7621901",
"0.76177186",
"0.760963",
"0.76073915",
"0.7576107",
"0.75621784",
"0.7535127",
"0.748124",
"0.74642575",
"0.74561596",
"0.7454499",
"0.7454499",
"0.7454499",
"0.7454499",
"0.74522763",
"0.7438381",
"0.7436939",
"0.7436939",
"0.7433478",
"0.7418257",
"0.73946893",
"0.739268",
"0.7388281",
"0.7385159",
"0.7384897",
"0.73724973",
"0.7367194",
"0.7335837",
"0.7312186",
"0.7306853",
"0.7306853",
"0.7306526",
"0.73022056",
"0.73000467",
"0.7298165",
"0.72974473",
"0.72960377",
"0.7296036",
"0.72936445",
"0.72889656",
"0.7279382",
"0.72765255",
"0.72656846",
"0.72603023",
"0.72545",
"0.72519815",
"0.7225546",
"0.7208775",
"0.7195972",
"0.7195972",
"0.7187876",
"0.7176327",
"0.71478534",
"0.71434057",
"0.71375996",
"0.7111428",
"0.7104107",
"0.7093457",
"0.7091851",
"0.70779335",
"0.7069373",
"0.7051465",
"0.6980642",
"0.6951931",
"0.69453204",
"0.69326097",
"0.6931686",
"0.6919324",
"0.6913043",
"0.69050646",
"0.68936175",
"0.6893159"
] |
0.0
|
-1
|
GET /asanas GET /asanas.json
|
def index
@asanas = Asana.joins(:exercise).merge(Exercise.order(:name)).order(:family_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end",
"def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end",
"def show\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @atracao }\n end\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def show\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aroma }\n end\n end",
"def index\n @alleys = Alley.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alleys }\n end\n end",
"def show\n @banana = Banana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @banana }\n end\n end",
"def show\n @aa = Aa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aa }\n end\n end",
"def show\n render json: Alien.find(params[\"id\"])\n end",
"def show\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apunte }\n end\n end",
"def show\n @anuncio = Anuncio.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @anuncio }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend",
"def index\n @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end",
"def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\n end\n end",
"def show\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aactio }\n end\n end",
"def index\n @aromas = Aroma.order(\"lower(name) ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @aromas }\n end\n end",
"def show\n @ano = Ano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ano }\n end\n end",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def index\n @adocao_animals = AdocaoAnimal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @adocao_animals }\n end\n end",
"def json_get(url)\n get url, :parse=>true\n end",
"def show\n @sabio = Sabio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sabio }\n end\n end",
"def show\n @tango = Tango.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tango }\n end\n end",
"def index\n\t\tvendas = Venda.all\n\t\trender json: vendas, status: :ok\n\tend",
"def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def show\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @asiento }\n end\n end",
"def index\n @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @appeal }\n end\n end",
"def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end",
"def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end",
"def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def show\n @avert = Avert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @avert }\n end\n end",
"def index\n render json: @fiestas\n end",
"def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end",
"def show\n @asaaddrobj = Asaaddrobj.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asaaddrobj }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @personas }\n end\n end",
"def index\n @somethings = Something.all\n render json: @somethings\n end",
"def show\n @rua = Rua.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rua }\n end\n end",
"def show\n render json: @todo\n end",
"def show\n render json: @todo\n end",
"def index\n find_organismos\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @organismos }\n end\n end",
"def index\n Rails.logger.info('👻 Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end",
"def index\n @tacos = Taco.all\n\n respond_to do |format|\n format.html { render :index }\n format.json { render @tacos }\n end\n end",
"def index\n @slams = Slam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slams }\n end\n end",
"def show\n @anuncio= set_anuncio\n render json: @anuncio, status: :ok\n end",
"def index\n @normas = Norma.all\n render json: @normas\n end",
"def get(path, query={})\n request_json :get, path, query\n end",
"def index\r\n @salles = Salle.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @salles }\r\n end\r\n end",
"def index\n @requests = Request.all\n\n render json: @requests\n end",
"def index\n @programas = Programa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programas }\n end\n end",
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\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 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 @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tarefa }\n end\n end",
"def ambassador(params = {})\n self.class.get('/ambassador/get', params)\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def index\n @jsons = Json.all\n end",
"def list_all_aos_versions(args = {}) \n get(\"/aosversions.json/all\", args)\nend",
"def show\n @assunto = Assunto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assunto }\n end\n end",
"def show\r\n @asistencia = Asistencia.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @asistencia }\r\n end\r\n end",
"def show\n respond_to do |format|\n format.json\n end\n end",
"def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end",
"def show\n @adocao_animal = AdocaoAnimal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @adocao_animal }\n end\n end",
"def index\n @acuerdos = Acuerdo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acuerdos }\n end\n end",
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"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 show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end",
"def json_get(path, params={})\n json_request(:get, path, params)\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end",
"def show\n render json: @api_v1_todo\n end",
"def show\n @analyst = Analyst.find(params[:id])\n\n render json: @analyst\n end",
"def show\n @asesor = Asesor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asesor }\n end\n end",
"def index\n if params[:tea] && params[:tea][:category]\n @teas = Tea.where(:category => params[:tea][:category])\n else\n @teas = Tea.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teas }\n end\n end",
"def index\n @lbaas = Lbaa.all\n @lbaas = Lbaa.where(:section => 'A').order(\"id\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lbaas }\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 info\n get '/'\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def index\n render json: Todo.all\n end",
"def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @persona }\n end\n end",
"def index\n @lugars = Lugar.all\n\n render json: @lugars\n end",
"def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend",
"def index\n @api_v1_menus = Menu.all\n render json: @api_v1_menus\n end",
"def show\n @escola = Escola.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @escola }\n end\n end",
"def index\n render json: @links\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal }\n end\n end",
"def index\n @loves = Love.all\n render json: @loves\n end",
"def show\n @safra = Safra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safra }\n end\n end",
"def show\n @baton = Baton.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baton }\n end\n end",
"def index\n get('')\n end",
"def index\n @jsons = Json.all\n\n\n end",
"def show\n @etnia = Etnia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etnia }\n end\n end",
"def show\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rayon }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.json { render :json => @requests}\n end\n end"
] |
[
"0.64741975",
"0.6450691",
"0.6450691",
"0.6388076",
"0.6292111",
"0.62849617",
"0.6283308",
"0.62745726",
"0.6270093",
"0.6268471",
"0.6265812",
"0.6262482",
"0.6252009",
"0.62378776",
"0.62320215",
"0.6227566",
"0.6225495",
"0.62177074",
"0.6208354",
"0.62015826",
"0.62012917",
"0.61985844",
"0.6176666",
"0.6176666",
"0.61550915",
"0.61295766",
"0.6105823",
"0.6100476",
"0.60992485",
"0.60896343",
"0.6086126",
"0.6083943",
"0.60817385",
"0.60562617",
"0.60549396",
"0.60549396",
"0.6042462",
"0.6040921",
"0.60384566",
"0.60307086",
"0.60297966",
"0.602673",
"0.60266256",
"0.6026076",
"0.60231745",
"0.60231745",
"0.6016386",
"0.601395",
"0.60067177",
"0.60030454",
"0.60018665",
"0.5999468",
"0.5996736",
"0.5992585",
"0.59913814",
"0.5982439",
"0.5972412",
"0.59700125",
"0.59686506",
"0.5967061",
"0.5963878",
"0.5957319",
"0.59556025",
"0.59556025",
"0.59552044",
"0.59532726",
"0.5953016",
"0.594756",
"0.5944673",
"0.5943826",
"0.5943646",
"0.59429413",
"0.59404415",
"0.5937838",
"0.59351933",
"0.5932634",
"0.5930229",
"0.59288746",
"0.5927795",
"0.5927544",
"0.5916042",
"0.59156275",
"0.59134275",
"0.5911699",
"0.59076023",
"0.59035105",
"0.590094",
"0.589825",
"0.58980083",
"0.58975554",
"0.58972746",
"0.5894394",
"0.5892921",
"0.5892394",
"0.58909",
"0.58877456",
"0.5887646",
"0.58841276",
"0.58828074",
"0.5882116",
"0.5880416"
] |
0.0
|
-1
|
GET /asanas/1 GET /asanas/1.json
|
def show; end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def show\n render json: Alien.find(params[\"id\"])\n end",
"def show\n @ano = Ano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ano }\n end\n end",
"def show\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @atracao }\n end\n end",
"def show\n @banana = Banana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @banana }\n end\n end",
"def show\n @anuncio = Anuncio.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @anuncio }\n end\n end",
"def show\n @aa = Aa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aa }\n end\n end",
"def show\n @sabio = Sabio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sabio }\n end\n end",
"def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def show\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aroma }\n end\n end",
"def show\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apunte }\n end\n end",
"def show\n puts params[:id]\n render json: Todo.find(params[:id])\n end",
"def show\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aactio }\n end\n end",
"def show\n @tango = Tango.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tango }\n end\n end",
"def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend",
"def show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\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 @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end",
"def show\n @asaaddrobj = Asaaddrobj.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asaaddrobj }\n end\n end",
"def show\n @rua = Rua.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rua }\n end\n end",
"def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def show\r\n @asistencia = Asistencia.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @asistencia }\r\n end\r\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def show\n @baton = Baton.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baton }\n end\n end",
"def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end",
"def show\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @asiento }\n end\n end",
"def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\n end\n end",
"def show\n @bla = Bla.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bla }\n end\n end",
"def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\n end\n end",
"def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @persona }\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @respuesta }\n end\n end",
"def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end",
"def show\n @tea = Tea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend",
"def show\n render json: @api_v1_todo\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 get_aos_version(args = {}) \n get(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def show\n client= Client.find_by_id params[:id]\n if client != nil\n render(json: client, status: 200) \n else\n head 404\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 @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end",
"def show\n @adocao_animal = AdocaoAnimal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @adocao_animal }\n end\n end",
"def show\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spaethi }\n end\n end",
"def show\n @selecao = Selecao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @selecao }\n end\n end",
"def show\n @assunto = Assunto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assunto }\n end\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def show\n @apuesta_detail = ApuestaDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apuesta_detail }\n end\n end",
"def show\n recipe = Recipe.find(params[:id])\n # recipes = Recipe.find_by(params[:id])\n # render json: recipe\n render json: recipe\n end",
"def show\n @one = One.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @one }\n end\n end",
"def show\n @goat = Goat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goat }\n end\n end",
"def get_one\n test_data = @test.get_one\n return render json: test_data\n end",
"def show\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solicitud_servicio }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\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 consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def index\n find_organismos\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @organismos }\n end\n end",
"def show\n @sezione = Sezione.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sezione }\n end\n end",
"def show\n render json: @todo\n end",
"def show\n render json: @todo\n end",
"def show\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tarefa }\n end\n end",
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def show\n @repa = Repa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repa }\n end\n end",
"def show\n @caixa = Caixa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caixa }\n end\n end",
"def show\n @avert = Avert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @avert }\n end\n end",
"def show\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rayon }\n end\n end",
"def show\n @a = A.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @a }\n end\n end",
"def show\n @orgao = Orgao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orgao }\n end\n end",
"def show\n @cita = Cita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cita }\n end\n end",
"def show\n @safra = Safra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safra }\n end\n end",
"def show\n @serv = Serv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv }\n end\n end",
"def show\n @escola = Escola.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @escola }\n end\n end",
"def show\n @razmer_go = RazmerGo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @razmer_go }\n end\n end",
"def show\n\t\trender json: @url, status: 200\n\tend",
"def show\n @jakeslink = Jakeslink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jakeslink }\n end\n end",
"def show\n @analyst = Analyst.find(params[:id])\n\n render json: @analyst\n end",
"def show\n @vano = Vano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vano }\n end\n end",
"def show\n @oase = Oasis.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oase }\n end\n end",
"def index\n get('')\n end",
"def index\n @somethings = Something.all\n render json: @somethings\n end",
"def show\r\n @antenne = Antenne.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @antenne }\r\n end\r\n end",
"def show\n @asociado = Asociado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asociado }\n end\n end",
"def show\n @asesor = Asesor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asesor }\n end\n end",
"def show\n @repa = Repa.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repa }\n end\n end",
"def index\n @adocao_animals = AdocaoAnimal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @adocao_animals }\n end\n end",
"def view\n render json: {id: params[:name]}\n end",
"def show\n @cake = Cake.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cake }\n end\n end",
"def json_get(path, params={})\n json_request(:get, path, params)\n end",
"def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def show\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estatuto }\n end\n end"
] |
[
"0.6466704",
"0.6442568",
"0.6442568",
"0.6386861",
"0.6385092",
"0.6343658",
"0.6339805",
"0.63309896",
"0.63200986",
"0.62970054",
"0.62958264",
"0.6290633",
"0.6276254",
"0.62711215",
"0.6249373",
"0.62302566",
"0.62196493",
"0.6197275",
"0.6194641",
"0.61869025",
"0.6177361",
"0.6175711",
"0.6167774",
"0.6158002",
"0.6157424",
"0.61371976",
"0.61344314",
"0.61310166",
"0.61310166",
"0.6123639",
"0.6121185",
"0.61209756",
"0.6120204",
"0.61158574",
"0.6094635",
"0.6086802",
"0.6084413",
"0.60810673",
"0.6079496",
"0.6079496",
"0.6079496",
"0.6077995",
"0.6076251",
"0.607258",
"0.607258",
"0.60704124",
"0.60662585",
"0.60632086",
"0.606164",
"0.605942",
"0.6053627",
"0.6050724",
"0.60498095",
"0.60491955",
"0.60452664",
"0.6044604",
"0.60439456",
"0.60436493",
"0.6043261",
"0.6042828",
"0.6041594",
"0.6040466",
"0.6022876",
"0.601968",
"0.60192055",
"0.6018697",
"0.6013294",
"0.6013162",
"0.6008862",
"0.6008206",
"0.6008206",
"0.600743",
"0.6004096",
"0.6001091",
"0.5999486",
"0.59988064",
"0.599855",
"0.599721",
"0.59956217",
"0.5991738",
"0.59905213",
"0.59902656",
"0.59898335",
"0.5988877",
"0.59887236",
"0.5988486",
"0.5988227",
"0.59878707",
"0.59875304",
"0.5983804",
"0.59827775",
"0.59826064",
"0.5982589",
"0.5982499",
"0.5981198",
"0.59801084",
"0.59800786",
"0.598004",
"0.5979234",
"0.5977979",
"0.597534"
] |
0.0
|
-1
|
POST /asanas POST /asanas.json
|
def create
@asana = Asana.new(asana_params)
respond_to do |format|
if @asana.save
format.html { redirect_to @asana, notice: 'Asana criado com sucesso.' }
format.json { render :show, status: :created, location: @asana }
else
format.html { render :new }
format.json { render json: @asana.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def post_json(path, body)\n uri = build_uri(path)\n #puts \"🤖 POST #{path}\"\n #puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n #puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n #puts result[:result]\n result\nend",
"def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def create\n @atracao = Atracao.new(params[:atracao])\n\n respond_to do |format|\n if @atracao.save\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully created.' }\n format.json { render :json => @atracao, :status => :created, :location => @atracao }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend",
"def post operation, data={}\n body = case data\n when String\n body = data\n else\n Yajl::Encoder.encode(data)\n end\n\n request = new_request operation, body\n request.sign sts\n hydra.queue request\n hydra.run\n response = request.response\n puts response.inspect if @debug\n\n if response.code == 200\n Yajl::Parser.parse response.body\n else\n raise_error response\n end\n end",
"def post(*args)\n super(*wrap_for_json_api(*args))\n end",
"def post(json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name].compact.join('/')\n url += \"/\"\n return HTTParty.post(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def post_json(path, body)\n uri = build_uri(path)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n result = JSON.parse(response.body)\n puts result\n result\nend",
"def post_api(path, params={}, headers={})\n headers.merge!('CONTENT_TYPE' => \"application/json\")\n post path, params, headers\nend",
"def create\n\n @anuncio = Anuncio.new(anuncio_params)\n\n if @anuncio.save\n render :show, status: :created, location: @anuncio\n else\n render json: @anuncio.errors, status: :unprocessable_entity\n end\n end",
"def create\n @ano = Ano.new(params[:ano])\n\n respond_to do |format|\n if @ano.save\n format.html { redirect_to @ano, notice: 'Ano was successfully created.' }\n format.json { render json: @ano, status: :created, location: @ano }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ano.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def post_check(excon, body)\n excon.request(\n method: :post,\n path: '/check',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend",
"def create\n @apunte = Apunte.new(params[:apunte])\n\n respond_to do |format|\n if @apunte.save\n format.html { redirect_to @apunte, notice: 'Apunte was successfully created.' }\n format.json { render json: @apunte, status: :created, location: @apunte }\n else\n format.html { render action: \"new\" }\n format.json { render json: @apunte.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end",
"def post_route(payload)\n with_rescue do\n payload = payload.to_json if payload.is_a?(Hash)\n connection.post do |request|\n request.url routes_path\n request.body = payload\n request.headers['Content-Type'] = 'application/json'\n end\n end\n end",
"def create\n @aa = Aa.new(params[:aa])\n\n respond_to do |format|\n if @aa.save\n format.html { redirect_to root_path , notice: '登録されました' }\n format.json { render json: @aa, status: :created, location: @aa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @banana = Banana.new(params[:banana])\n\n respond_to do |format|\n if @banana.save\n format.html { redirect_to @banana, :notice => 'Banana was successfully created.' }\n format.json { render :json => @banana, :status => :created, :location => @banana }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @banana.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @asiento = Asiento.new(params[:asiento])\n\n respond_to do |format|\n if @asiento.save\n format.html { redirect_to @asiento, :notice => 'El apunte fue creado.' }\n format.json { render :json => @asiento, :status => :created, :location => @asiento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @anio = Anio.new(anio_params)\n\n respond_to do |format|\n if @anio.save\n format.html { redirect_to @anio, notice: 'Anio was successfully created.' }\n format.json { render :show, status: :created, location: @anio }\n else\n format.html { render :new }\n format.json { render json: @anio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @aactio = Aactio.new(params[:aactio])\n\n respond_to do |format|\n if @aactio.save\n format.html { redirect_to @aactio, notice: 'Aactio was successfully created.' }\n format.json { render json: @aactio, status: :created, location: @aactio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aactio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n animal = Animal.new(animal_params)\n if !animal.name.nil?\n animal.save\n render json: animal, status: 201, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end",
"def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end",
"def http_post(path, request)\n @http.post(\n :body => JSON(:request => request.to_hash),\n :headers => headers,\n :path => \"/api/v2/#{path}\",\n :expects => [200, 201, 202]\n )\n end",
"def create\n @tipoapreensao = Tipoapreensao.new(tipoapreensao_params)\n\n respond_to do |format|\n if @tipoapreensao.save\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tipoapreensao }\n else\n format.html { render action: 'new' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n puts request.body.string\n\n if request.body.string.include? %q[\"id\"]\n render json: %q[{\"error\": \"No se puede crear usuario con id\"}], status: 400\n else\n @usuario = Usuario.new(usuario_params)\n #Tuve que hacerlo asi, pq por alguna razon no me dejaba de la forma tradicional!\n #@usuario = Usuario.new\n #@usuario.usuario = params[:usuario]\n #@usuario.nombre = params[:nombre]\n #@usuario.apellido = params[:apellido]\n #@usuario.twitter = params[:twitter]\n\n\n respond_to do |format|\n if @usuario.save\n #format.html { redirect_to @usuario, notice: 'Usuario was successfully created.' }\n format.json { render :show, status: :created, location: @usuario }\n else\n #format.html { render :new }\n format.json { render json: @usuario.errors, status: 404}# status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @tapioca = Tapioca.new(tapioca_params)\n\n respond_to do |format|\n if @tapioca.save\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tapioca }\n else\n format.html { render action: 'new' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(data = {})\n call data, method: :post\n end",
"def post(request)\n # sure thing!\n json_response(200, { message: \"This dummy POST endpoint didn't do anything.\" })\n end",
"def create\n render json: Post.create(params[\"post\"])\n end",
"def create\n @vachana = Vachana.new(params[:vachana])\n\n respond_to do |format|\n if @vachana.save\n format.html { redirect_to @vachana, notice: 'Vachana was successfully created.' }\n format.json { render json: @vachana, status: :created, location: @vachana }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vachana.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vachana = Vachana.new(params[:vachana])\n\n respond_to do |format|\n if @vachana.save\n format.html { redirect_to @vachana, notice: 'Vachana was successfully created.' }\n format.json { render json: @vachana, status: :created, location: @vachana }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vachana.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_aos_version(args = {}) \n post(\"/aosversions.json/\", args)\nend",
"def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end",
"def data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end",
"def create\n @asaaddrobj = Asaaddrobj.new(params[:asaaddrobj])\n\n respond_to do |format|\n if @asaaddrobj.save\n format.html { redirect_to @asaaddrobj, notice: 'Asaaddrobj was successfully created.' }\n format.json { render json: @asaaddrobj, status: :created, location: @asaaddrobj }\n else\n format.html { render action: \"new\" }\n format.json { render json: @asaaddrobj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(api, params)\n url2json(:POST, \"#{@endpoint}#{api}\", params)\n end",
"def post(*args)\n request :post, *args\n end",
"def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @todo = Todo.new(user_params)\n if @todo.save\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end",
"def create\n @tarefa = Tarefa.new(params[:tarefa])\n\n respond_to do |format|\n if @tarefa.save\n format.html { redirect_to @tarefa, notice: 'Tarefa was successfully created.' }\n format.json { render json: @tarefa, status: :created, location: @tarefa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end",
"def create\n @tea = Tea.new(params[:tea])\n\n respond_to do |format|\n if @tea.save\n format.html { redirect_to @tea, notice: 'Tea was successfully created.' }\n format.json { render json: @tea, status: :created, location: @tea }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @persona = Persona.new(params[:persona])\n \n respond_to do |format|\n if @persona.save\n format.json { render :json => @persona,\n :status => :created, :location => @persona }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_aposta = TipoAposta.new(tipo_aposta_params)\n\n respond_to do |format|\n if @tipo_aposta.save\n format.html { redirect_to @tipo_aposta, notice: 'Tipo aposta was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_aposta }\n else\n format.html { render :new }\n format.json { render json: @tipo_aposta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(*args)\n request(:post, *args)\n end",
"def create_post(params)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.post(new_post_endpoint, { 'router.params' => params, format: :json })\n end",
"def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def post(path, **args); end",
"def create\n @test = Test.create!(test_params)\n\n render json: @test\n end",
"def post options\n rest_request({ method: :post }.merge(options))\n end",
"def post options\n rest_request({ method: :post }.merge(options))\n end",
"def create\n @azienda = Azienda.new(azienda_params)\n\n respond_to do |format|\n if @azienda.save\n format.html { redirect_to @azienda, notice: 'Azienda was successfully created.' }\n format.json { render :show, status: :created, location: @azienda }\n else\n format.html { render :new }\n format.json { render json: @azienda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end",
"def post_json(path, body)\n url = [base_url, path].join\n resp = HTTParty.post(url, headers: standard_headers, body: body.to_json)\n parse_json(url, resp)\n end",
"def create\n @tap = Tap.new\n\n respond_to do |format|\n if @tap.save\n format.html { redirect_to taps_path, notice: 'Tap was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tap }\n else\n format.json { render json: @tap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @etapa = Etapa.new(etapa_params)\n\n respond_to do |format|\n if @etapa.save\n format.html { redirect_to @etapa, notice: 'Etapa fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @etapa }\n else\n format.html { render :new }\n format.json { render json: @etapa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prueba_json = PruebaJson.new(prueba_json_params)\n\n respond_to do |format|\n if @prueba_json.save\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully created.' }\n format.json { render action: 'show', status: :created, location: @prueba_json }\n else\n format.html { render action: 'new' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nebulosa = Nebulosa.new(nebulosa_params)\n\n respond_to do |format|\n if @nebulosa.save\n format.html { redirect_to @nebulosa, notice: 'Nebulosa was successfully created.' }\n format.json { render :show, status: :created, location: @nebulosa }\n else\n format.html { render :new }\n format.json { render json: @nebulosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def call method, args = {}\n unless args.is_a? Hash\n raise ArgumentError.new \"argument must be a Hash\"\n end\n\n args.each_key do |key|\n if args[key].is_a?(Array) || args[key].is_a?(Hash)\n args[key] = JSON.dump(args[key])\n end\n end\n\n @faraday.post method, args\n end",
"def POST; end",
"def test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", :api_key => 'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n link = JSON.parse(response.body)\r\n check_new_link(link) \r\n end",
"def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end",
"def api_post(path, data = {})\n api_request(:post, path, :data => data)\n end",
"def create\n @onda = Onda.new(onda_params)\n\n respond_to do |format|\n if @onda.save\n format.html { redirect_to ondas_path, notice: 'Onda was successfully created.' }\n format.json { render :show, status: :created, location: @onda }\n else\n format.html { render :new }\n format.json { render json: @onda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_accounts(json_hash)\n @options = {:path => '/users.json',\n :body => json_hash[:json]}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n :body => @options[:body]\n )\n end",
"def create\n @json = Json.new(json_params)\n\n respond_to do |format|\n if @json.save\n format.html { redirect_to @json, notice: 'Json was successfully created.' }\n format.json { render :show, status: :created, location: @json }\n else\n format.html { render :new }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, form_data=nil)\n parse_json do |parser|\n @http_client.post(path, form_data) {|chunk| parser << chunk }\n end\n end",
"def post(path, options = {})\n nonce, signature = generate_signature\n options = options.merge(key: @api_key, nonce: nonce, signature: signature)\n result = @connection.post(\"#{path}/\", options).body\n JSON.parse(result)\n end",
"def create\n @todo = Todo.create(todo_params)\n render json: @todo\n end",
"def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path, real_params = {}, 'rack.input' => rack_input\nend",
"def create\n @saida = Saida.new(saida_params)\n\n respond_to do |format|\n if @saida.save\n format.html { redirect_to @saida, notice: 'Saida was successfully created.' }\n format.json { render :show, status: :created, location: @saida }\n else\n format.html { render :new }\n format.json { render json: @saida.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @taco = Taco.new(taco_params)\n\n respond_to do |format|\n if @taco.save\n format.html { redirect_to @taco, notice: 'Taco was successfully created.' }\n format.json { render :show, status: :created, location: @taco }\n else\n format.html { render :new }\n format.json { render json: @taco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def create\n @todo = Todo.new(todo_params)\n if @todo.save\n render json: @todo, status: 201\n else\n render json: @todo.errors, status: 422\n end\n end",
"def create\n @alola = Alola.new(alola_params)\n\n respond_to do |format|\n if @alola.save\n format.html { redirect_to @alola, notice: 'Alola was successfully created.' }\n format.json { render :show, status: :created, location: @alola }\n else\n format.html { render :new }\n format.json { render json: @alola.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, data = {}, params = {})\n body = data.to_json\n path = File.join(@prefix, path)\n\n response = @conn.post(path, body) do |req|\n req.params = params\n req.headers['Content-Type'] = 'application/json'\n end\n\n JSON.parse response.body\n end",
"def create\n @safra = Safra.new(params[:safra])\n\n respond_to do |format|\n if @safra.save\n format.html { redirect_to @safra }\n else\n format.html { render action: \"new\" }\n format.json { render json: @safra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def CreateView params = {}\n \n APICall(path: 'views.json',method: 'POST',payload: params.to_json)\n \n end",
"def post(path, params={}, options={})\n request(:post, api_path(path), params, options)\n end",
"def create\n @baton = Baton.new(params[:baton])\n\n respond_to do |format|\n if @baton.save\n format.html { redirect_to @baton, notice: 'Baton was successfully created.' }\n format.json { render json: @baton, status: :created, location: @baton }\n else\n format.html { render action: \"new\" }\n format.json { render json: @baton.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end",
"def create\n @todo = Todo.new(todo_params)\n @todo.save\n #render json: { :success => 1, :todo => @todo } \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 streak, success = jsonapi_create.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end",
"def create\n @safra_averiado = SafraAveriado.new(params[:safra_averiado])\n\n respond_to do |format|\n if @safra_averiado.save\n format.html { redirect_to @safra_averiado, notice: 'Safra averiado was successfully created.' }\n format.json { render json: @safra_averiado, status: :created, location: @safra_averiado }\n else\n format.html { render action: \"new\" }\n format.json { render json: @safra_averiado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path, real_params = {}, {\"rack.input\" => rack_input}\nend",
"def create\n @jamaat = Jamaat.new(params[:jamaat])\n\n respond_to do |format|\n if @jamaat.save\n format.html { redirect_to @jamaat, notice: 'Jamaat was successfully created.' }\n format.json { render json: @jamaat, status: :created, location: @jamaat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @jamaat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @todo = Todo.new(todo_params)\n if @todo.save\n render json: @todo, status: :created, location: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end",
"def create\n @tangazo = Tangazo.new(tangazo_params)\n\n respond_to do |format|\n if @tangazo.save\n format.html { redirect_to @tangazo, notice: 'Tangazo was successfully created.' }\n format.json { render :show, status: :created, location: @tangazo }\n else\n format.html { render :new }\n format.json { render json: @tangazo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tale = Tale.new(tale_params)\n\n respond_to do |format|\n if @tale.save\n format.html { redirect_to '/all', notice: 'Tale was successfully created.' }\n format.json { render :show, status: :created, location: @tale }\n else\n format.html { render :new }\n format.json { render json: @tale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estatuto = Estatuto.new(params[:estatuto])\n\n respond_to do |format|\n if @estatuto.save\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully created.' }\n format.json { render json: @estatuto, status: :created, location: @estatuto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def signed_post_request url, body\n body_json= body.to_json\n token = jwt_post_signature url, body_json\n HTTParty.post('http://localhost:5000'+url,\n {headers:{\n \"Authorization\"=>\"JWT token=\\\"#{token}\\\"\",\n \"Content-Type\"=> \"application/json;charset=utf-8\",\n },\n body: body_json}\n )\n\n end"
] |
[
"0.62142646",
"0.6157509",
"0.6144492",
"0.6091369",
"0.6069187",
"0.606698",
"0.60306704",
"0.60192406",
"0.6007616",
"0.5989976",
"0.5989851",
"0.59437853",
"0.5910471",
"0.58869123",
"0.5879283",
"0.5838797",
"0.5837029",
"0.58351773",
"0.58341056",
"0.58308697",
"0.5830124",
"0.58301",
"0.5814754",
"0.5800847",
"0.57815146",
"0.57805246",
"0.5773773",
"0.57690346",
"0.5764007",
"0.5756316",
"0.5752293",
"0.5749878",
"0.5745617",
"0.574008",
"0.57286197",
"0.571755",
"0.57074666",
"0.57074666",
"0.57066107",
"0.57040066",
"0.5703151",
"0.5699843",
"0.5699079",
"0.56985563",
"0.569692",
"0.5694243",
"0.5693419",
"0.56924534",
"0.56777036",
"0.56745553",
"0.56713694",
"0.5670864",
"0.56695753",
"0.5660962",
"0.5660182",
"0.5651866",
"0.56511277",
"0.56473035",
"0.56473035",
"0.5641273",
"0.5619933",
"0.561333",
"0.5611577",
"0.5610095",
"0.5609652",
"0.55975866",
"0.55966437",
"0.5594472",
"0.5592961",
"0.55900496",
"0.55865127",
"0.55825096",
"0.5580007",
"0.5574543",
"0.55734277",
"0.5573031",
"0.55713683",
"0.5571217",
"0.556383",
"0.55631274",
"0.5562402",
"0.5560787",
"0.55604905",
"0.55602753",
"0.55484873",
"0.5544552",
"0.55422753",
"0.5540122",
"0.5540085",
"0.55360943",
"0.5535703",
"0.55276227",
"0.55235493",
"0.55176985",
"0.5513368",
"0.5510819",
"0.55099416",
"0.5507525",
"0.5507063",
"0.550148"
] |
0.63904315
|
0
|
PATCH/PUT /asanas/1 PATCH/PUT /asanas/1.json
|
def update
respond_to do |format|
if @asana.update(asana_params)
format.html { redirect_to @asana, notice: 'Asana atualizado com sucesso.' }
format.json { render :show, status: :ok, location: @asana }
else
format.html { render :edit }
format.json { render json: @asana.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def patch!\n request! :patch\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\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 patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def put!\n request! :put\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 patch(path, **args); end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, opts = {})\n request(:patch, path, opts).body\n end",
"def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end",
"def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bla = Bla.find(params[:id])\n\n respond_to do |format|\n if @bla.update_attributes(params[:bla])\n format.html { redirect_to @bla, :notice => 'Bla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bla.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, to: nil, as: nil, **constraints, &blk)\n add_route(::Rack::PATCH, path, to, as, constraints, &blk)\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n end",
"def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = {\n 'op' => operation,\n 'path' => path,\n 'value' => value\n }\n response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version)\n @client.response_handler(response)\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\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 render json: User.update(params[\"id\"], params[\"user\"])\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 @rest_api.update(rest_api_params)\n format.html { redirect_to @rest_api, notice: 'Rest api was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rest_api.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\n end",
"def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\n end",
"def update(path)\n output { patch(path, params) }\n end",
"def update(data = :object || :json)\n end",
"def update\n respond_to do |format|\n if @anything.update(anything_params)\n format.html { redirect_to @anything, notice: 'Anything was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @anything.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\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 @todoa.update(todoa_params)\n format.html { redirect_to todoas_url }\n format.json { render :show, status: :ok, location: @todoa }\n else\n format.html { render :edit }\n format.json { render json: @todoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @banana = Banana.find(params[:id])\n\n respond_to do |format|\n if @banana.update_attributes(params[:banana])\n format.html { redirect_to @banana, :notice => 'Banana was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @banana.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_radios_for_array(args = {}) \n put(\"/radios.json/#{args[:arrayId]}\", args)\nend",
"def update\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n if @atracao.update_attributes(params[:atracao])\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n# respond_to do |format|\n# if @req.update(req_params)\n format.json { render :json => {:status => 'success'}}\n# format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n# format.json { render :show, status: :ok, location: @req }\n# else\n format.json { render :json => {:status => 'failed'}}\n# format.html { render :edit }\n# format.json { render json: @req.errors, status: :unprocessable_entity }\n# end\n# end\n end",
"def update\n animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end",
"def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\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 @sala = Sala.find(params[:id])\n\n respond_to do |format|\n if @sala.update_attributes(params[:sala])\n format.html { redirect_to @sala, notice: 'Sala was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sala.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rest.update(rest_params)\n format.html { redirect_to @rest, notice: 'Rest was successfully updated.' }\n format.json { render :show, status: :ok, location: @rest }\n else\n format.html { render :edit }\n format.json { render json: @rest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(action, **args); end",
"def update\n respond_with []\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 patch(path, data, options = {})\n uri = build_uri(path, options)\n\n request = Net::HTTP::Patch.new(uri.request_uri)\n set_authorisation_header(request)\n request.set_form_data(data)\n\n response = https_client(uri).request(request)\n end",
"def update\n @asaaddrobj = Asaaddrobj.find(params[:id])\n\n respond_to do |format|\n if @asaaddrobj.update_attributes(params[:asaaddrobj])\n format.html { redirect_to @asaaddrobj, notice: 'Asaaddrobj was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asaaddrobj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end",
"def update\n respond_to do |format|\n if @awesome_stuff.update(awesome_stuff_params)\n format.html { redirect_to @awesome_stuff, notice: 'Awesome stuff was successfully updated.' }\n format.json { render :show, status: :ok, location: @awesome_stuff }\n else\n format.html { render :edit }\n format.json { render json: @awesome_stuff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def patch(operation, path, value)\n response = @client.rest_patch(@data['uri'], 'body' => [{ op: operation, path: path, value: value }])\n @client.response_handler(response)\n end",
"def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\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 put(*args)\n request :put, *args\n end",
"def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.html { redirect_to personas_path, notice: 'Persona was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { render :show, status: :ok, location: @patch }\n else\n format.html { render :edit }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\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 @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end",
"def update\n @a = A.find(params[:id])\n\n respond_to do |format|\n if @a.update_attributes(params[:a])\n format.html { redirect_to @a, notice: 'A was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @a.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stuff = Stuff.find(params[:id])\n\n respond_to do |format|\n if @stuff.update_attributes(params[:stuff])\n format.html { redirect_to @stuff, :notice => 'Stuff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stuff.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @one = One.find(params[:id])\n\n respond_to do |format|\n if @one.update_attributes(params[:one])\n format.html { redirect_to @one, notice: 'One was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n if @tarefa.update_attributes(params[:tarefa])\n format.html { redirect_to @tarefa, notice: 'Tarefa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resto.update(resto_params)\n format.html { redirect_to @resto, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @resto }\n else\n format.html { render :edit }\n format.json { render json: @resto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_successful\n data = {\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"anh@gmallds.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def patch(uri, options = T.unsafe(nil)); end",
"def patch\n req.patch?\n end",
"def update\n fn = params[:id].gsub('DOTDOT','.').gsub('SLASHSLASH','/')\n File.open(fn,'w+') { |f| \n f.puts params[:content]\n }\n respond_to do |format|\n format.json { render json: { success: true} }\n end\n end",
"def update\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n if @apunte.update_attributes(params[:apunte])\n format.html { redirect_to @apunte, notice: 'Apunte was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @apunte.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def put(path, data = {})\n request 'PUT', path, body: data.to_json\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 @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end",
"def update\n # respond_to do |format|\n # if @thing.update(thing_params)\n # format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n # format.json { render :show, status: :ok, location: @thing }\n # else\n # format.html { render :edit }\n # format.json { render json: @thing.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def update\n respond_to do |format|\n if @api_v1_resource.update(api_v1_resource_params)\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_resource }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tarefa.update(tarefa_params)\n format.html { redirect_to @tarefa, notice: 'Tarefa editada com sucesso.' }\n format.json { render :show, status: :ok, location: @tarefa }\n else\n format.html { render :edit }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6854013",
"0.6778955",
"0.64784384",
"0.64591855",
"0.64414656",
"0.64414656",
"0.635757",
"0.63534933",
"0.63525826",
"0.6290294",
"0.62778383",
"0.6274491",
"0.6255972",
"0.6211508",
"0.6211508",
"0.61897767",
"0.61897767",
"0.6109468",
"0.61065614",
"0.6067725",
"0.6067707",
"0.60551006",
"0.6052922",
"0.60372174",
"0.60354286",
"0.60248214",
"0.60166967",
"0.60094094",
"0.6007122",
"0.6003928",
"0.59716684",
"0.5964074",
"0.59409016",
"0.5929571",
"0.5929571",
"0.5920251",
"0.59093463",
"0.5885753",
"0.5865852",
"0.5861843",
"0.5840166",
"0.5839291",
"0.5837318",
"0.58270717",
"0.58270717",
"0.5818937",
"0.58142436",
"0.5811773",
"0.58112055",
"0.5799464",
"0.5796724",
"0.5791931",
"0.5787826",
"0.5778536",
"0.57640886",
"0.5758574",
"0.57502705",
"0.5748063",
"0.5745059",
"0.5735923",
"0.57295704",
"0.5722371",
"0.5721952",
"0.57212013",
"0.5720309",
"0.5719019",
"0.571538",
"0.5704466",
"0.5704387",
"0.5703091",
"0.5699778",
"0.5689892",
"0.5689892",
"0.5689892",
"0.5689112",
"0.568631",
"0.5683909",
"0.56743866",
"0.5673935",
"0.56723684",
"0.5669918",
"0.5668644",
"0.5666273",
"0.5661102",
"0.5661044",
"0.5659483",
"0.5655604",
"0.5650627",
"0.56463826",
"0.5642885",
"0.5638768",
"0.5636913",
"0.56298226",
"0.56272024",
"0.5625274",
"0.56230164",
"0.5619006",
"0.56177807",
"0.561518",
"0.5614406"
] |
0.576925
|
54
|
DELETE /asanas/1 DELETE /asanas/1.json
|
def destroy
@asana.destroy
respond_to do |format|
format.html { redirect_to asanas_url, notice: 'Asana excluído com sucesso.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete(*rest) end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete(path)\n request(:delete, path)\n end",
"def delete!\n request! :delete\n end",
"def delete\n request(:delete)\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\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 delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end",
"def delete(name)\n\n end",
"def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete(path)\n request(:delete, path)\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def delete\n api(\"Delete\")\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end",
"def delete!(*rest) end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end",
"def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end",
"def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n\n end",
"def delete(path, params)\n request(:delete, path, {})\n end",
"def destroy\n @adocao_animal = AdocaoAnimal.find(params[:id])\n @adocao_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to adocao_animals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end",
"def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete(path = '/files/', params = {})\n request :delete, path, params\n end",
"def destroy\n @vachana = Vachana.find(params[:id])\n @vachana.destroy\n\n respond_to do |format|\n format.html { redirect_to vachanas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vachana = Vachana.find(params[:id])\n @vachana.destroy\n\n respond_to do |format|\n format.html { redirect_to vachanas_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete\n \n end",
"def delete\n supprimer = SondageService.instance.supprimerSondage(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\nend",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete(name); end",
"def delete(name); end",
"def destroy\n @anything.destroy\n respond_to do |format|\n format.html { redirect_to anythings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @banana = Banana.find(params[:id])\n @banana.destroy\n\n respond_to do |format|\n format.html { redirect_to bananas_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, opts = {})\n request(:delete, path, opts).body\n end",
"def delete(path, data={})\n request(:delete, path, data)\n end",
"def delete\n render json: Users.delete(params[\"id\"])\n end",
"def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end",
"def destroy\n @verb.destroy\n\n head :no_content\n end",
"def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def cfa_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_delete method\"\n begin\n id=params[\"format\"] \n cfa=RestClient.delete $api_service+'/cfa_titles/'+id\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} Cfa controller delete method\" }\n end\n redirect_to action: \"index\"\n end",
"def destroy\n @aactio = Aactio.find(params[:id])\n @aactio.destroy\n\n respond_to do |format|\n format.html { redirect_to aactios_url }\n format.json { head :no_content }\n end\n end",
"def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end",
"def delete(url)\n do_request(\"delete\", url)\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end",
"def delete\n delete_from_server single_url\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end"
] |
[
"0.7326207",
"0.72614926",
"0.7079496",
"0.7014899",
"0.6998341",
"0.69722426",
"0.6907703",
"0.69047415",
"0.6859575",
"0.6857132",
"0.6834509",
"0.6809785",
"0.67948407",
"0.6780148",
"0.67765856",
"0.677561",
"0.67673427",
"0.67673427",
"0.6762091",
"0.67607486",
"0.6723615",
"0.6695552",
"0.6690813",
"0.66814554",
"0.66804487",
"0.66802984",
"0.6678833",
"0.66679657",
"0.66499764",
"0.6636397",
"0.6635358",
"0.6635358",
"0.6635358",
"0.6635358",
"0.66342205",
"0.6614657",
"0.6612591",
"0.66114956",
"0.65979236",
"0.65864336",
"0.65679634",
"0.6567064",
"0.65620095",
"0.65620095",
"0.6557671",
"0.6555448",
"0.6552543",
"0.6547295",
"0.6541947",
"0.6541947",
"0.6541947",
"0.6541947",
"0.6541947",
"0.6541947",
"0.6541947",
"0.6541873",
"0.65410566",
"0.651085",
"0.6505909",
"0.6505909",
"0.6505909",
"0.6503084",
"0.6500806",
"0.6500387",
"0.6490281",
"0.64880085",
"0.6484816",
"0.648081",
"0.648081",
"0.64786434",
"0.64783645",
"0.64783645",
"0.6477246",
"0.6476919",
"0.6475623",
"0.64735365",
"0.64680344",
"0.6466238",
"0.6466238",
"0.6464018",
"0.6459561",
"0.6454036",
"0.6447513",
"0.64439917",
"0.6441763",
"0.6437178",
"0.6432238",
"0.64243954",
"0.64243954",
"0.64238995",
"0.64234436",
"0.64176416",
"0.64149356",
"0.64148474",
"0.64129996",
"0.64077264",
"0.64077264",
"0.64077264",
"0.64077264",
"0.64077264"
] |
0.6433334
|
86
|
Use callbacks to share common setup or constraints between actions.
|
def set_asana
exercise = Exercise.find_by(slug: params[:slug])
raise ActiveRecord::RecordNotFound unless exercise
@asana ||= exercise&.content
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 list of trusted parameters through.
|
def asana_params
params.require(:asana).permit(
:translation,
:family_id,
:advanced_actions,
:connections,
:observe,
:benefits,
:caution,
:contraindications,
:content,
:setup,
:entering,
:legs,
:core,
:trunk,
:arms,
:head,
:all,
:leaving,
:curiosities,
exercise_attributes: %i[id name alternative_names image],
movement_ids: [],
word_ids: [],
)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\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 strong_params\n params.require(:user).permit(param_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 allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); 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 param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\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 allowed?(*_)\n true\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 allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\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 permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; 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 url_allowlist=(_arg0); 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 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 list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\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 shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] |
[
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] |
0.0
|
-1
|
Create a new Chef::DataBagItem
|
def initialize(chef_server_rest: nil)
@data_bag = nil
@raw_data = Mash.new
@chef_server_rest = chef_server_rest
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_item(data_bag, item_name, data = {}, metadata = {})\n item = ::SecureDataBag::Item.new(metadata)\n item.raw_data = { 'id' => item_name }.merge(data)\n item.data_bag data_bag\n item\n end",
"def create_data_bag_item(bag, item, value)\n unless data_bag_item_exist?(bag, item)\n require 'json'\n json = { 'id' => item, item => value }.to_json\n puts \"TRACE: creating missing data bag item #{bag}/#{item} -- #{json}\" if verbose\n puts \"TODO: \" + knife_cmd(\"data bag create #{bag} #{item}\")\n end\nend",
"def create\n chef_server_rest.post(\"data/#{data_bag}\", self)\n self\n end",
"def create_bag(bag_name)\n # check that the name is valid\n begin\n Chef::DataBag.validate_name!(bag_name)\n rescue Chef::Exceptions::InvalidDataBagName => e\n ui.fatal(e.message)\n exit(1)\n end\n\n # create the data bag\n begin\n data_bag = Chef::DataBag.new\n data_bag.name(bag_name)\n data_bag.create\n ui.info(\"Created topology data bag [#{bag_name}]\")\n rescue Net::HTTPServerException => e\n raise unless e.to_s =~ /^409/\n data_bag = Chef::DataBag.load(bag_name)\n ui.info(\"Topology data bag #{bag_name} already exists\")\n end\n\n data_bag\n end",
"def create_item\n @item = Fox_Item.new(self, @content.join(\"\\t\"), @icon, @icon)\n end",
"def load_item(data_bag, item_name, metadata = {})\n item = ::SecureDataBag::Item.load(data_bag, item_name, metadata)\n item\n end",
"def create_item(user_id, data) \n data = data.just(SETTABLE_ITEM_FIELDS)\n data[:user_id] = user_id\n data[:title] ||= 'item'\n data[:price] ||= 5\n data[:price] = data[:price].to_i\n data[:slug] = get_unique_slug($items,:slug,data[:title])\n\n data[:imgs] = data[:imgs].to_a.map {|link| {link: link}}\n data[:videos] = data[:videos].to_a.map {|link| {link: link}}\n data[:status] = :pending\n item = $items.add(data)\nend",
"def data_bag_item(key)\n key = key.to_sym if key.respond_to?(:to_sym)\n @cached_items ||= {}\n begin\n if @cached_items[key].nil?\n @cached_items[key] = if encrypted_data_bag_item?(key)\n data_bag_item(\n data_bag_name(key),\n data_bag_item_name(key),\n data_bag_item_secret(key)\n ).to_hash\n else\n data_bag_item(\n data_bag_name(key),\n data_bag_item_name(key)\n ).to_hash\n end\n end\n rescue => e\n Chef::Log.debug(\"Failed to retrieve configuration data bag item (#{key}): #{e}\")\n @cached_items[key] = false\n end\n @cached_items[key]\n end",
"def save(item_id = @raw_data[\"id\"])\n r = chef_server_rest\n begin\n if Chef::Config[:why_run]\n Chef::Log.warn(\"In why-run mode, so NOT performing data bag item save.\")\n else\n r.put(\"data/#{data_bag}/#{item_id}\", self)\n end\n rescue Net::HTTPClientException => e\n raise e unless e.response.code == \"404\"\n\n r.post(\"data/#{data_bag}\", self)\n end\n self\n end",
"def attributes_for_new_item(data)\n { data: data }\n end",
"def create(*args)\n item = build_virtual_item(*args)\n @conglomerate.items.push(item)\n [item]\n end",
"def new_item(content)\n Item.new(:project_id => @project_id, :content => content)\n end",
"def new\n \t@item=Item.new({:ItemName =>'def'})\n end",
"def create(attributes)\n response = JSON.parse(@client.post('items', attributes).body)\n Promisepay::Item.new(@client, response['items'])\n end",
"def new\n @item = Item.new\n end",
"def new\n @item = DoubleDog::Item.new(nil, nil, nil)\n end",
"def create_item(index)\n item = @data[index]\n rect = item_rect(index)\n \n cLabel = CLabel.new(self, rect, item.name)\n \n return cLabel\n end",
"def list_data_bag_items(data_bag_name)\n @items = {} if @items.nil?\n @items[data_bag_name] = @items[data_bag_name] || knife_output_as_array(\"data bag show #{data_bag_name}\")\nend",
"def create(item_attrs = {})\n body = { value: item_attrs }\n Iterable.request(conf, base_path).put(body)\n end",
"def newitem\n entry = Pages::Storage::Entry.new(self)\n\n entry.title = ''\n entry.tags = []\n entry.date = Time.new\n entry.content = ''\n entry.draft = false\n\n @items << entry\n\n return entry\n end",
"def new\n # puts(\"*** Entering CTRL: new tag\")\n @tag = Tag.new(@collection,@item)\n end",
"def load_from_server(bag_name, item_name = nil)\n begin\n if (item_name)\n item = Chef::DataBagItem.load(bag_name, item_name)\n item = Chef::EncryptedDataBagItem.new(item.raw_data, read_secret) if use_encryption\n else\n item = Chef::DataBag.load(bag_name)\n end\n rescue Net::HTTPServerException => e\n raise unless e.to_s =~ /^404/\n end\n item\n end",
"def new\n @item = Item.new\n end",
"def new\n @item = Item.new\n end",
"def new\n @item = Item.new\n end",
"def create objid\n DataObj.new @repo, self, objid, true\n end",
"def create_basket items_string\n @baskets = Array.new if @baskets.nil?\n basket = SalesTaxes::Basket.new items_string\n @baskets << basket\n basket\n end",
"def create_item(item_code)\n \t\txero = XeroConnection.new.connect\n\n \t\tif xero.Item.all(where: 'code == \"%s\"' % item_code).empty?\n \t\t\tnew_item = xero.Item.build(code: item_code)\n \t\t\tnew_item.save\n \t\tend\n \tend",
"def create_item(index)\n item = @data[index]\n rect = item_rect(index)\n \n ucItem = UCVictoryItem.new(self, item, rect)\n \n return ucItem\n end",
"def new_item(opts={})\n defaults = {:number => @items.count + 1}\n @items << ItemRecord.new(defaults.merge(opts))\n end",
"def new_item(which = 0,opts={})\n defaults = {:number => @holdings[which].items.count}\n @holdings[which].new_item(defaults.merge(opts))\n end",
"def create_product(id)\n item = DirectedEdge::Item.new(@database, \"product#{id}\")\n item.add_tag('product')\n item.save\n end",
"def quick_new\n @bill = Bill.new\n @bill.items.build\n end",
"def create_item(data)\n fail 'Base class does not include ::Record!' if @base && !@base.include?(::Record)\n item = (@base || Record).new\n item.data = data\n item\n end",
"def create_item(index)\n item = @data[index]\n rect = item_rect(index)\n \n if item.used\n icon_index = Wora_NSS::SAVED_SLOT_ICON\n else\n icon_index = Wora_NSS::EMPTY_SLOT_ICON\n end\n \n ucSave = UCLabelIcon.new(self, Rect.new(rect.x+24,rect.y,rect.width-24-32-2,24), \n Rect.new(rect.x,rect.y,24,24),\n item.slot_name, icon_index, item.used)\n \n return ucSave\n end",
"def create_item(index)\n item = @data[index]\n rect = item_rect(index)\n \n if item.used\n icon_index = Wora_NSS::SAVED_SLOT_ICON\n else\n icon_index = Wora_NSS::EMPTY_SLOT_ICON\n end\n \n ucSave = UCLabelIcon.new(self, Rect.new(rect.x+24,rect.y,rect.width-24-32-2,24), \n Rect.new(rect.x,rect.y,24,24),\n item.slot_name, icon_index, item.used)\n \n return ucSave\n end",
"def create_item\n object = @spawn_object.call\n\n object.pool_create if object.respond_to? :pool_create\n\n item = PoolItem.new(object)\n\n @item_stack.push(item)\n\n item\n end",
"def resource_class\n Chef::Resource::ChefDataBag\n end",
"def create\n data = CatalogItem.new(name: params[:name], description: params[:description])\n data.save\n render json: data\n end",
"def create_item(index)\n item = @data[index]\n rect = item_rect(index, true)\n \n ucItem = UCItem.new(self, item, rect)\n ucItem.active = enable?(item)\n \n if $game_party.newest_items.include?(item)\n ucItem.cItemName.font.color = Color.new_item_color\n ucItem.cItemNumber.font.color = Color.new_item_color\n end\n \n return ucItem\n end",
"def write_build_data_bags(path)\n ## write data bags to build (must be fed as arg)\n new_resource.data_bags.each_pair do |bag, items|\n r = Chef::Resource::Directory.new(::File.join(path, bag), run_context)\n r.recursive(true)\n r.run_action(:create)\n\n items.each do |item|\n r = Chef::Resource::File.new(::File.join(path, bag, \"#{item}.json\"), run_context)\n r.sensitive(true)\n r.content(Chef::DataBagItem.load(bag, item).to_json)\n r.run_action(:create)\n end\n end\n end",
"def create\n name = @view.ask_user_for_info(\"name\")\n description = @view.ask_user_for_info(\"description\")\n prep_time = @view.ask_user_for_attribute(\"prep_time\")\n difficulty = @view.ask_user_for_attribute(\"difficulty\")\n recipe = Recipe.new(name: name, description: description, prep_time: prep_time, difficulty: difficulty)\n @cookbook.add_recipe(recipe)\n end",
"def create_item(name, price)\r\n new_item = Models::Item.created( name, price, self )\r\n self.item_list.push(new_item)\r\n new_item.save\r\n return new_item\r\n end",
"def create_item( *args )\n raise NotImplementedError.new(\"Subclasses must implement #create_item\")\n end",
"def create(type, *args)\n if type.kind_of?(Class) && type < TkcItem\n # do nothing\n elsif TkcItem.type2class(type.to_s)\n type = TkcItem.type2class(type.to_s)\n else\n fail ArgumentError, \"type must a subclass of TkcItem class, or a string in CItemTypeToClass\"\n end\n type.create(self, *args)\n end",
"def create(params = {})\n item = build(params)\n item.save\n item\n end",
"def chef_vault_item(bag, item)\n begin\n require 'chef-vault'\n rescue LoadError\n Chef::Log.warn(\"Missing gem 'chef-vault', use recipe[chef-vault] to install it first.\")\n end\n\n if node['dev_mode']\n Chef::DataBagItem.load(bag, item)\n else\n ChefVault::Item.load(bag, item)\n end\n end",
"def create_item(name, price)\r\n new_item = Trading::Item.created( name, price, self )\r\n self.item_list.push(new_item) # AK You can also do `item_list << new_item`\r\n return new_item\r\n end",
"def add(product)\n items.create(product: product)\n end",
"def add_item(barcode, name, price)\n @barcodes << barcode\n @names << name\n @prices << price\n end",
"def ensure_data_bag_exists\n data_bag.create(name: DATA_BAG) unless locks\n end",
"def populate_data_bag_item_name\n data_bag, item = node['ca_openldap']['populate']['databag_item_name'].split \":\"\n\n if data_bag == nil or item == nil \n raise \"Attribute node['ca_openldap']['populate']['databag_item_name'] is mal formatted, expected <datab_bag>:<item>, example ca_openldap:populate\"\n end \n\n return [data_bag, item]\n end",
"def create\n @data_item = DataItem.new(data_item_params)\n\n respond_to do |format|\n if @data_item.save\n format.html { redirect_to @data_item, notice: 'Data item was successfully created.' }\n format.json { render :show, status: :created, location: @data_item }\n else\n format.html { render :new }\n format.json { render json: @data_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createItem(title, description, date)\n new_item = List.new\n new_item.title = title\n new_item.description = description\n new_item.save\n new_item.date = date\n end",
"def item(value, note = nil)\n return unless @boss\n raise ArgumentError, \"Must provide an item name or ID\" unless value.present?\n\n @boss.children.create(:object => Item.find_or_create_by_name_or_id(value), :note => note)\n end",
"def load_from_file(bag_name, topo_name)\n \n topo_file = File.join(Dir.pwd, \"#{topologies_path}\", bag_name, topo_name + '.json')\n return unless (loader.file_exists_and_is_readable?(topo_file))\n \n item_data = loader.object_from_file(topo_file)\n item_data = if use_encryption\n secret = read_secret\n Chef::EncryptedDataBagItem.encrypt_data_bag_item(item_data, secret)\n else\n item_data\n end\n item = Chef::DataBagItem.new\n item.data_bag(bag_name)\n item.raw_data = item_data\n item\n end",
"def create\n @header.merge!({'Content-Type' => \"application/json\"})\n query = {name: \"Default\", region: \"sfo1\", size: \"512mb\", image: '5141286'}\n response = self.class.post('/droplets', {query: query, headers: @header})\n tratar_response(response)\n end",
"def item_create\n @brief = Brief.find(params[:brief_id])\n @brief_vendor = @brief.brief_vendors.find_by_org_id(@cur_user.org_id)\n invalid_op unless @brief_vendor\n @brief_vendor.items << Item.new(params[:item]){|r|r.kind = params[:kind]}\n redirect_to vendor_show_brief_path(@brief)\n end",
"def create_item(item_request_body, opts = {})\n data, _status_code, _headers = create_item_with_http_info(item_request_body, opts)\n data\n end",
"def create_item(index)\n item = @data[index]\n rect = item_rect(index, true)\n \n shopItem = UCShopItem.new(self, item, rect,\n SHOP_CONFIG::ITEM_NUMBER_PATTERN)\n \n shopItem.cItemPrice.align = 2\n shopItem.cItemPossess.align = 2 \n shopItem.cItemPossess.font = Font.shop_possess_font\n shopItem.ucItemNumber.cLabelNumber.align = 2\n shopItem.ucItemNumber.min = 0\n shopItem.ucItemNumber.max = shopItem.inventory_quantity\n return shopItem\n end",
"def generate_new_item_object\n @new_item = Flight.new\n insert_required_params_into_new_item_object\n insert_default_params_into_new_item_object\n insert_optional_params_into_new_item_object(self)\n return @new_item\n end",
"def create_item(index)\n item = @data[index]\n rect = item_rect(index, true)\n\n case index\n when 0\n if @actor.two_swords_style\n kindDesc = Vocab::weapon1\n else\n kindDesc = Vocab::weapon\n end\n when 1\n if @actor.two_swords_style\n kindDesc = Vocab::weapon2\n else\n kindDesc = Vocab::armor1\n end\n when 2\n kindDesc = Vocab::armor2\n when 3\n kindDesc = Vocab::armor3\n when 4\n kindDesc = Vocab::armor4\n end\n \n rect.y += WLH*index \n equipItem = UCEquipItem.new(self, item, rect, kindDesc)\n \n f = Font.new()\n f.color = system_color\n equipItem.cEquipKind.font = f\n return equipItem\n end",
"def create(options)\n item = build(options)\n item.save\n item\n end",
"def new\n\t\t@item = Product.new\n\tend",
"def data_bag_safe_item( bag_name, item )\n if data_bag( bag_name ).include?( item )\n return data_bag_item( bag_name, item )\n else\n return {}\n end\n end",
"def create\n recipe_name = @view.ask_name\n recipe_description = @view.ask_description\n recipe = Recipe.new(recipe_name, recipe_description)\n @cookbook.add_recipe(recipe)\n @view.listing\n end",
"def create_vbd(vm_ref, vdi_ref, position)\n vbd_record = {\n \"VM\" => vm_ref,\n \"VDI\" => vdi_ref,\n \"empty\" => false,\n \"other_config\" => {\"owner\"=>\"\"},\n \"userdevice\" => position.to_s,\n \"bootable\" => true,\n \"mode\" => \"RW\",\n \"qos_algorithm_type\" => \"\",\n \"qos_algorithm_params\" => {},\n \"qos_supported_algorithms\" => [],\n \"type\" => \"Disk\"\n }\n\n task = xapi.Async.VBD.create(vbd_record)\n ui.msg \"Waiting for VBD create\"\n vbd_ref = get_task_ref(task) \n end",
"def add\n ensure_client\n required_attributes = %w[deviceVolumeName isShareable storageSystemUri]\n required_attributes.each { |k| raise IncompleteResource, \"Missing required attribute: '#{k}'\" unless @data.key?(k) || @data.key?(k.to_sym) }\n @data['name'] ||= @data['deviceVolumeName']\n response = @client.rest_post(\"#{BASE_URI}/from-existing\", { 'body' => @data }, @api_version)\n set_all(client.response_handler(response))\n self\n end",
"def create_item(name, price, quantity, description=\"No description available\", image=\"\")\n new_item = Item.created( name, price, self.working_for, quantity, description, image)\n if !(identical = self.working_for.list_items_inactive.detect{|i| i == new_item }).nil?\n identical.quantity += new_item.quantity\n else\n self.working_for.offers.push(new_item)\n new_item.save\n end\n Activity.log(self, \"add_item\", new_item, self.working_for)\n return new_item\n end",
"def fetch_item(data_bag, item)\n data = Chef::DSL::DataQuery.data_bag_item(data_bag, item)\n data = data.to_hash.reject do |key|\n %w(chef_type data_bag id).include?(key)\n end\n data\nrescue StandardError => e\n Chef::Log.warn \"#{self} could not find the environment named #{name}\"\n if ignore_missing then {}\n else raise\n end\nend",
"def create\n get_projects\n\n @breadcrumb = 'create'\n @billable_item = BillableItem.new(params[:billable_item])\n @billable_item.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @billable_item.save\n format.html { redirect_to @billable_item, notice: t('activerecord.attributes.billable_item.create') }\n format.json { render json: @billable_item, status: :created, location: @billable_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @billable_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rackitem = Rackitem.new(params[:rackitem])\n\n respond_to do |format|\n if @rackitem.save\n format.html { redirect_to :back, notice: 'Rackitem was successfully created.' }\n format.json { render json: @rackitem, status: :created, location: @rackitem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rackitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = BudgetItem.new(params[:budget_item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create(key, item)\n raise NotImplementedError, \"#{__method__} has not been implemented for this #{name} index\"\n end",
"def new\n @chef = Chef.new\n end",
"def add!(item)\n @ckh[item.class][item] = item\n end",
"def create_item(location_id, body, opts = {})\n data, _status_code, _headers = create_item_with_http_info(location_id, body, opts)\n return data\n end",
"def create!(name, params = {})\n item = build(name, params)\n item.save!\n item\nend",
"def get_databag_item(databag, item)\n unless inside_testkitchen?\n unless chef_server.data_bags.any? { |k| k.name == databag }\n raise format('Databag \"%s\" not found on Chef Infra Server', databag)\n end\n\n chef_server.data_bag_item.fetch(item, bag: databag).data\n else\n filename = File.join(data_bags_path, databag, item + \".json\")\n\n begin\n return JSON.load(File.read(filename))\n rescue\n raise format(\"Error accessing databag file %s, check TestKitchen configuration\", filename)\n end\n end\n end",
"def add_item(new_item)\n item = Item.new(new_item)\n items.push(item)\n end",
"def create\n @bagtype = Bagtype.new(params[:bagtype])\n\n respond_to do |format|\n if @bagtype.save\n format.html { redirect_to @bagtype, notice: 'Bagtype was successfully created.' }\n format.json { render json: @bagtype, status: :created, location: @bagtype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bagtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # defined object to receive strict item_params including :description, :price, :stockQty ; else return 400\n @item = Item.new(item_params)\n \n if @item.save\n render json: @item.to_json, status: 201\n else\n head 400\n end\n end",
"def make_item(object_type_name)\n\n ot = ObjectType.find_by(name: object_type_name)\n raise \"Could not find object type #{name}\" unless ot\n\n Item.make({ quantity: 1, inuse: 0 }, sample: self, object_type: ot)\n\n end",
"def create_auction(item_name, reserved_price)\n Auction.create(\n item_attributes: {\n name: item_name,\n reserved_price: reserved_price\n }\n )\n end",
"def create_bundle(attributes)\n BrickFTP::API::Bundle.create(attributes)\n end",
"def create_bundle(attributes)\n BrickFTP::API::Bundle.create(attributes)\n end",
"def create\n @bin_item = BinItem.new(bin_item_params)\n\n respond_to do |format|\n if @bin_item.save\n format.html { redirect_to @bin_item, notice: 'bin item was successfully created.' }\n format.json { render :show, status: :created, location: @bin_item }\n else\n format.html { render :new }\n format.json { render json: @bin_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(data = {})\n object = self.new(data)\n object.save\n object\n end",
"def create\n @item = @package.items.new\n # bad code !!\n @item.name = params[:item][:name]\n @item.description = params[:item][:description]\n if params[:type] == \"text\"\n @item.item_type = 1\n @item.text_content = params[:item][:text_content]\n else\n if params[:item][:file].nil?\n flash[:notice] = \"Please select a file first!\"\n redirect_to new_package_item_path\n return\n else\n if params[:type] == \"file\"\n @item.item_type = 2\n else\n @item.item_type = 3\n end\n @item.file = params[:item][:file]\n @item.filename = params[:item][:file].original_filename\n @item.file_content_type = params[:item][:file].content_type\n end\n end\n #______________________\n if @package.custom_key\n @item.aes_key = params[:item][:aes_key]\n else\n @item.aes_key = Base64.decode64(@package.encrypted_key)\n end\n if @item.save\n flash[:notice] = \"Item was created successfuly !\"\n redirect_to package_path(@package)\n else\n #i = 0\n #@item.errors.full_messages.each do |message|\n # flash[\"error#{i}\"] = message\n # i+=1\n #end\n flash[:alert] = \"Item was created failed !\"\n render action: :new\n end\n # respond_with @package\n end",
"def new\n @dish_in_basket = DishInBasket.new\n end",
"def create\n @sugar_bag = SugarBag.new(params[:sugar_bag])\n\n respond_to do |format|\n if @sugar_bag.save\n format.html { redirect_to @sugar_bag, notice: 'Sugar bag was successfully created.' }\n format.json { render json: @sugar_bag, status: :created, location: @sugar_bag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sugar_bag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @budgetitem = Budgetitem.new(budgetitem_params)\n\n respond_to do |format|\n if @budgetitem.save\n format.html { redirect_to @budgetitem, notice: 'Budgetitem was successfully created.' }\n format.json { render :show, status: :created, location: @budgetitem }\n else\n format.html { render :new }\n format.json { render json: @budgetitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add(item)\n @ckh[item.class][item] ||= item\n end",
"def create(data={})\n object = self.new(data)\n object.save\n end",
"def add_item(new_item)\n item = Item.new(new_item)\n @items.push(item)\n end",
"def new_from_item(item, options = {})\n cart_item = item.send(self.to_s.tableize).build(options)\n cart_item.attributes.map {|attribute| attribute if item.respond_to?(attribute[0].to_s) && !attribute[0].to_s.include?(\"_at\") }.compact.each {|attribute| cart_item.send(\"#{attribute[0]}=\", item.send(attribute[0].to_s))}\n # TODO Add a callback\n cart_item\n # TODO Add a callback\n end",
"def create_item_from(order_item, lot_code = nil, expires_at = nil, amount = nil)\n transfer_items.create!(\n order_item: order_item,\n product: order_item.product,\n lot_code: lot_code || order_item.lot_code,\n expires_at: expires_at,\n amount: amount || order_item.waiting\n )\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 add(data)\n create(data)\n end",
"def add(data)\n create(data)\n end",
"def show_data_bag_item(bag, item)\n knife_output_as_hash(\"data bag show #{bag} #{item}\")\nend"
] |
[
"0.8240729",
"0.7829642",
"0.74055153",
"0.6852948",
"0.65775305",
"0.64215535",
"0.6355829",
"0.6277713",
"0.62118",
"0.61099654",
"0.6085725",
"0.60855955",
"0.6055589",
"0.6046265",
"0.6026703",
"0.60262614",
"0.59584713",
"0.59207433",
"0.59207255",
"0.5914139",
"0.58989704",
"0.58844376",
"0.58516276",
"0.58516276",
"0.58516276",
"0.5845298",
"0.5844714",
"0.58342767",
"0.582734",
"0.5816382",
"0.5808482",
"0.5808164",
"0.58024096",
"0.5793258",
"0.5792086",
"0.5792086",
"0.5788982",
"0.5773393",
"0.57707983",
"0.5765888",
"0.57653826",
"0.5764543",
"0.5726761",
"0.57215005",
"0.57133967",
"0.5712878",
"0.57100177",
"0.5702643",
"0.5697343",
"0.569056",
"0.5669686",
"0.5665595",
"0.5658246",
"0.5644177",
"0.563166",
"0.5611711",
"0.5608153",
"0.55980235",
"0.55880594",
"0.5587282",
"0.5585217",
"0.5561661",
"0.55465126",
"0.5545963",
"0.55377126",
"0.55172217",
"0.55146706",
"0.5505696",
"0.5499982",
"0.5493247",
"0.5467453",
"0.5459388",
"0.5457822",
"0.54439306",
"0.5442588",
"0.5426615",
"0.541966",
"0.54161096",
"0.54126745",
"0.54094154",
"0.5403607",
"0.5402791",
"0.54005605",
"0.54004437",
"0.53988796",
"0.53988796",
"0.5389713",
"0.53864545",
"0.5384329",
"0.53776485",
"0.53760755",
"0.53715163",
"0.5369783",
"0.536373",
"0.5361531",
"0.5358609",
"0.5356838",
"0.5336573",
"0.533541",
"0.533541",
"0.5332121"
] |
0.0
|
-1
|
Serialize this object as a hash
|
def to_json(*a)
result = {
"name" => object_name,
"json_class" => self.class.name,
"chef_type" => "data_bag_item",
"data_bag" => data_bag,
"raw_data" => raw_data,
}
Chef::JSONCompat.to_json(result, *a)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def serialize\n JSON.dump(@hash)\n end",
"def to_hash\n @_hash_\n end",
"def to_hash\n @hash\n end",
"def serialize\n self.to_hash.to_json\n end",
"def to_hash\n @hash\n end",
"def to_hash\n @hash\n end",
"def hash\n to_s.hash\n end",
"def hash\n @hash ||= self.to_a.hash\n end",
"def serialize\n Base64.encode64(Marshal.dump(self.to_hash)).chop\n end",
"def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end",
"def to_hash() end",
"def hash\n to_h.hash ^ self.class.hash\n end",
"def hash\n [self.class, to_h].hash\n end",
"def hash\n [self.class, to_h].hash\n end",
"def hash\n [self.class, to_h].hash\n end",
"def serialize\n JSON.generate(to_h)\n end",
"def hash\n [self.class, to_s].hash\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n return to_s.hash\n end",
"def serialize(object)\n object.serializable_hash\n end",
"def hash\n to_a.hash\n end",
"def hash\n [self.class, to_s].hash\n end",
"def to_hash\n return self\n end",
"def hash\n { hash: @hash, hashType: @hash_type }\n end",
"def to_h\n recursive_serialization(self)\n end",
"def to_hash\n validate!\n @hash ||= json\n end",
"def to_hash\n object\n end",
"def serialize(hash)\n { Arguments::OBJECT_SERIALIZER_KEY => self.class.name }.merge!(hash)\n end",
"def hash\n data.hash\n end",
"def serializable_hash(_options = nil)\n fail NotImplementedError, 'This is an abstract method. Should be implemented at the concrete adapter.'\n end",
"def to_hash\n @_hash.dup\n end",
"def to_h\n Hash[ self ]\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def to_hash\n @hash.dup\n end",
"def hash\n to_s.hash\n end",
"def hash\n to_s.hash\n end",
"def hash\n end",
"def hash\n end",
"def hash\n end",
"def hash\n self.to_f.hash\n end",
"def hash\n\t\treturn self.name.to_s.hash\n\tend",
"def to_hash\n to_a.hash\n end",
"def as_hash\n @hash\n end",
"def hash\n @hash\n end",
"def to_hash\n Hash[self]\n end",
"def hash\n @__set.to_a.hash\n end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def output_hash; end",
"def to_hash\n h = super\n h['uid'] = @uid\n h\n end",
"def to_hash()\n @data\n end",
"def serialize(hash)\n {Arguments::OBJECT_SERIALIZER_KEY => self.class.name}.merge!(hash)\n end",
"def to_hash\n @data.to_hash\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def serializable_hash\n self.attributes\n end",
"def serialized\n serializer_class.new(self).serializable_hash\n end",
"def to_hash\n @data\n end",
"def to_h\n @_hash.dup\n end",
"def hash\n model.hash + key.hash\n end",
"def __hash\n @hash\n end",
"def to_hash\n @data\n end",
"def to_hash\n self.hash.merge!(:errors => self.errors)\n self.hash.merge!(:valid? => self.valid)\n self.hash\n # binding.pry\n Stamps.format.to_s.downcase == 'hashie' ? Hashie::Trash.new(@hash) : self.hash\n end",
"def to_h\n @hash.dup\n end",
"def serialize\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def to_h\n @hash\n end",
"def to_h\n @hash\n end",
"def to_hash\n @hash.dup\n end",
"def to_hash\n hsh = {\n id: id,\n status: status.to_sym,\n connect: running? ? connect.to_h : nil,\n time: info.wallclock_time.to_i / 60 # only update every minute\n }\n Digest::SHA1.hexdigest(hsh.to_json)\n end",
"def to_dict\n @hash\n end",
"def hash\r\n @_hash ||= _hash\r\n end",
"def hash\n [description, routing_number, account_number, account_type, signatory, metadata, id, signature_url, bank_name, verified, date_created, date_modified, deleted, object].hash\n end",
"def to_h\n @hash.dup\n end",
"def hash\n @hash.hash\n end",
"def serializable_hash options=nil\n hash = super\n eav_attributes_list.each do |attribute|\n hash[attribute] = self.send(attribute)\n end\n\n hash\n end",
"def hash\n\n self.h.fei.hash\n end",
"def to_hash\n {:hashes => @hashes}\n end",
"def hash\n self.state.hash\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n self.class.name.hash\n end"
] |
[
"0.81276625",
"0.7785287",
"0.7754545",
"0.77381307",
"0.76660955",
"0.76660955",
"0.75481015",
"0.752644",
"0.75174963",
"0.7509108",
"0.75017565",
"0.74726546",
"0.74401784",
"0.74401784",
"0.74401784",
"0.742879",
"0.7408174",
"0.7393062",
"0.73829573",
"0.7357966",
"0.73462605",
"0.732752",
"0.732543",
"0.7320677",
"0.7260607",
"0.7215785",
"0.72080827",
"0.7180065",
"0.717973",
"0.7139858",
"0.7122561",
"0.7116027",
"0.7115771",
"0.70967865",
"0.7083185",
"0.7083185",
"0.7062582",
"0.7062582",
"0.7062582",
"0.7062474",
"0.70610386",
"0.7060769",
"0.70525247",
"0.70522285",
"0.70401347",
"0.7034731",
"0.70155656",
"0.70155656",
"0.70155656",
"0.70155656",
"0.70155656",
"0.70155656",
"0.7005514",
"0.70051587",
"0.69991064",
"0.699023",
"0.69869524",
"0.69838554",
"0.69838554",
"0.69838554",
"0.69838554",
"0.69838554",
"0.69838554",
"0.69838554",
"0.69838554",
"0.69838554",
"0.69838554",
"0.6983695",
"0.6945449",
"0.69435865",
"0.69351864",
"0.6935042",
"0.69246393",
"0.69190097",
"0.6918161",
"0.69132906",
"0.69121057",
"0.6899227",
"0.6899227",
"0.6899227",
"0.6894438",
"0.6894438",
"0.6875314",
"0.6872016",
"0.6868073",
"0.6850681",
"0.68501574",
"0.684235",
"0.68401563",
"0.68329066",
"0.6820944",
"0.68120694",
"0.68043286",
"0.6803793",
"0.6803793",
"0.6803793",
"0.6803793",
"0.6803793",
"0.6803793",
"0.6803793",
"0.67931086"
] |
0.0
|
-1
|
Save this Data Bag Item via RESTful API
|
def save(item_id = @raw_data["id"])
r = chef_server_rest
begin
if Chef::Config[:why_run]
Chef::Log.warn("In why-run mode, so NOT performing data bag item save.")
else
r.put("data/#{data_bag}/#{item_id}", self)
end
rescue Net::HTTPClientException => e
raise e unless e.response.code == "404"
r.post("data/#{data_bag}", self)
end
self
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def save\n method, path = id ? [:post, :update] : [:put, :create]\n self.attributes = Connection.send(method, create_route(path), attributes_without_blanks).body['data']\n self\n end",
"def save\n if new_record?\n overwrite @api.post(\"/meetings/#{meeting.shortcode_url}/items.json\",\n 'content' => content)\n else\n overwrite @api.put(\"/items/#{shortcode_url}.json\", 'content' => content)\n end\n end",
"def save(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"\"\n data = {\n \"name\"=> @name, \n \"amount\"=> @amount, \n \"currency\"=> @currency, \n \"metadata\"=> @metadata, \n \"request_email\"=> @request_email, \n \"request_shipping\"=> @request_shipping, \n \"return_url\"=> @return_url, \n \"cancel_url\"=> @cancel_url\n }\n\n response = Response.new(request.put(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"product\"]\n \n \n return_values.push(self.fill_with_data(body))\n \n\n \n return_values[0]\n end",
"def save\n begin\n if Seth::Config[:why_run]\n Seth::Log.warn(\"In whyrun mode, so NOT performing data bag save.\")\n else\n create\n end\n rescue Net::HTTPServerException => e\n raise e unless e.response.code == \"409\"\n end\n self\n end",
"def save(pAuthToken, p_item)\r\n # build request string\r\n request = \"<#{ELE_REQUEST}>\\n\"\r\n request += build_xml(p_item)\r\n request += \"</#{ELE_REQUEST}>\\n\"\r\n\r\n # build service uri\r\n service_uri = \"#{@@m_service_url.path}#{@@m_service_update}.#{@@m_content_format}?authToken=#{pAuthToken}\"\r\n\r\n # if no user id is defined treat it as a new object.\r\n if p_item.id.nil?\r\n service_uri = \"#{@@m_service_url.path}#{@@m_service_save}.#{@@m_content_format}\"\r\n end\r\n\r\n # send http request\r\n state_true?(p_item, post_request(service_uri, \"item=#{request}\").body)\r\n end",
"def save\n response = []\n \n if self.ownership.blank?\n self.ownership = Solve360::Config.config.default_ownership\n end\n \n if new_record?\n response = self.class.request(:post, \"/#{self.class.resource_name}\", to_request)\n \n if !response[\"response\"][\"errors\"]\n self.id = response[\"response\"][\"item\"][\"id\"]\n end\n else\n response = self.class.request(:put, \"/#{self.class.resource_name}/#{id}\", to_request)\n end\n \n if response[\"response\"][\"errors\"]\n message = response[\"response\"][\"errors\"].map {|k,v| \"#{k}: #{v}\" }.join(\"\\n\")\n raise Solve360::SaveFailure, message\n else\n related_items.concat(related_items_to_add)\n\n response\n end\n\n end",
"def save\r\n @@items.push self\r\n end",
"def save\n @items.to_json\n end",
"def save\n response = []\n \n if self.ownership.blank?\n self.ownership = Solve360::Config.config.default_ownership\n end\n \n if new_record?\n response = self.class.request(:post, \"/#{self.class.resource_name}\", to_request)\n \n if !response[\"response\"][\"errors\"]\n self.id = response[\"response\"][\"item\"][\"id\"]\n end\n else\n response = self.class.request(:put, \"/#{self.class.resource_name}/#{id}\", to_request)\n end\n \n if response[\"response\"][\"errors\"]\n message = response[\"response\"][\"errors\"].map {|k,v| \"#{k}: #{v}\" }.join(\"\\n\")\n raise Solve360::SaveFailure, message\n else\n related_items.concat(related_items_to_add)\n self.related_items_to_add = []\n\n categories.concat(categories_to_add)\n self.categories_to_add = []\n\n response\n end\n\n end",
"def save(data)\n raise \"Implement this in subclass\"\n end",
"def save\n file_path = self.class.file_path(@save_id)\n File.open(file_path, 'w') { |file| \n bytes = file.write @items.inspect\n if bytes > 0\n puts \"saved to #{file_path}\"\n else\n puts \"save to #{file_path} failed\"\n end\n }\n end",
"def save\n if self.class.find(name, client: client)\n client.post(api_path, to_json, headers)\n else\n client.put(api_path, to_json, headers)\n end\n true\n end",
"def save\n # TODO validar atributos?\n response = Http.put(\"/accounts/api/service-info/#{identity.uuid}/#{slug}/\", save_body)\n raise \"unexpected response: #{response.code} - #{response.body}\" unless [200,201].include?(response.code)\n attributes_hash = MultiJson.decode(response.body)\n set_attributes(attributes_hash)\n @errors = {}\n @persisted = true\n true\n rescue *[RestClient::Conflict, RestClient::BadRequest] => e\n @errors = MultiJson.decode(e.response.body)\n false\n end",
"def save(object)\n full_name = extract_full_name object\n post 'api/save', :id => full_name\n end",
"def save!\n savable_properties = Hash[instance_variables.map { |name| \n # We need to remove the first character (@) of each name to be correct\n clean_name = name.to_s; \n clean_name[0] = ''; \n [clean_name, instance_variable_get(name)] \n } ]\n # Remove the \"is_new\" property, which is only used internally.\n savable_properties.delete(\"is_new\")\n\n # Also remove the \"_id\" property, which will cause the update to fail.\n savable_properties.delete(\"_id\")\n\n if @is_new\n response = self.class.post '/inventory', :body => savable_properties\n if response['status'] and response['status'] == 'error'\n throw response['message']\n end\n self.class.check_response response\n set_instance_variables response\n @is_new = false\n return true \n else\n response = self.class.put \"/inventory/#{@uuid}\", :body => savable_properties\n print response['status']\n if response['status'] and response['status'] == \"error\"\n throw response['message']\n end\n self.class.check_response response\n return true\n end\n end",
"def save\n return if @content.nil?\n put_rest \"extra/#{@name}\", @content, :content_type => \"application/octet-stream\"\n end",
"def save\n doc = collection.find_one()\n collection.update({\"_id\" => doc[\"_id\"]}, {'boom' => to_json})\n end",
"def save\n attr_hash = {}\n selection_attr = self.Id.nil? ? \"createable\" : \"updateable\"\n self.class.description[\"fields\"].select { |f| f[selection_attr] }.collect { |f| f[\"name\"] }.each { |attr| attr_hash[attr] = self.send(attr) }\n\n if self.Id.nil?\n self.Id = self.client.create(self.class, attr_hash).Id\n else\n self.client.update(self.class, self.Id, attr_hash)\n end\n end",
"def save(item)\n\t\titem = Item.new(item_params(item))\n\t\titem.save\n\t\tflash[:success] = \"Item(s) saved\"\n\tend",
"def save!\n raise \"A database must be setted\" unless self.database\n response = id.nil? ? self.database.post( self ) : self.database.put( self )\n pristine_copy\n response\n end",
"def post data\n commit data\n end",
"def save\n update_attributes(WebPay.client.post(path, @updated_attributes))\n @updated_attributes = {}\n self\n end",
"def save_data(data)\n\tend",
"def create\n @item = Item.new(params[:item])\n @item.budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to after_save_redirection_path, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n end",
"def save\n self.attributes =\n if persisted?\n PROXY.patch(\"#{resources_name}/#{id}\", attributes)\n else\n @persisted = true\n PROXY.post(resources_name, attributes)\n end\n end",
"def create_item(data_bag, item_name, data = {}, metadata = {})\n item = ::SecureDataBag::Item.new(metadata)\n item.raw_data = { 'id' => item_name }.merge(data)\n item.data_bag data_bag\n item\n end",
"def save\n end",
"def save\n end",
"def save!(*)\n super.tap do\n attributes.id = @response.body[\"id\"]\n end\n end",
"def save_to_inventory\n @user = User.find(params[:id])\n @item = Item.find(1)\n @user.items.push(@item)\n end",
"def add_item\n #params[item_id]\n end",
"def add_work_item(data)\n name = @table_name.to_s\n sql = @model.from(name.to_sym).insert_sql(\n description: data[:description],\n guide: data[:guide],\n status: data[:status],\n username: data[:name],\n archived: 0\n )\n sql = _format_sql(sql)\n @logger.info(\"Prepared POST query: #{sql}\")\n response = run_statement(sql, \"post\")\n id = response[0][:long_value]\n @logger.info(\"Successfully created work_item_id: #{id}\")\n id\n end",
"def perform_save\n api.bucket_save(self)\n end",
"def save\n object.save\n end",
"def save\n path = new_record? ? endpoint : \"#{endpoint}/#{attributes[:id]}\"\n response = client.send(persistence_action, path, attributes)\n if response[response_key].present?\n self.attributes = response[response_key]\n true\n else\n @errors = response\n false\n end\n end",
"def save_additional_data\n end",
"def save\n raise 'Blob is empty' if !data\n repository.put(self) if modified?\n id\n end",
"def save\n end",
"def save(opts={})\n return create(opts) if new?\n model.bucket.set(@id, attributes_with_values, opts)\n self\n end",
"def save\n SAVE\n end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save\n json = JSON.dump @attributes\n\n @dbm[@id] = json\n\n true\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def create\n @rackitem = Rackitem.new(params[:rackitem])\n\n respond_to do |format|\n if @rackitem.save\n format.html { redirect_to :back, notice: 'Rackitem was successfully created.' }\n format.json { render json: @rackitem, status: :created, location: @rackitem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rackitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n raise NotImplementedError\n end",
"def save\n\n end",
"def create\n # defined object to receive strict item_params including :description, :price, :stockQty ; else return 400\n @item = Item.new(item_params)\n \n if @item.save\n render json: @item.to_json, status: 201\n else\n head 400\n end\n end",
"def save_object\n end",
"def create\n chef_server_rest.post(\"data/#{data_bag}\", self)\n self\n end",
"def save\n end",
"def save\n end",
"def create\n @data_item = DataItem.new(data_item_params)\n\n respond_to do |format|\n if @data_item.save\n format.html { redirect_to @data_item, notice: 'Data item was successfully created.' }\n format.json { render :show, status: :created, location: @data_item }\n else\n format.html { render :new }\n format.json { render json: @data_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n collection = Object.const_get(self.class.name).send(:collection)\n\n if @attributes.include? '_id'\n collection.update({'_id' => @attributes['_id']}, @attributes, {:upsert => true})\n else\n id = collection.save(@attributes)\n @attributes['_id'] = id\n end\n end",
"def save\n response = Intercom.post(\"/v1/tags\", to_wire)\n self.from_hash(response)\n displayable_self\n end",
"def save!\n if @_id\n retval = collection.update({ '_id' => @_id}, @data.to_hash)\n else\n retval = collection.save(@data.to_hash)\n end\n\n !!retval\n end",
"def Save\n\t\tself.bien[0].save\n\t\tself.save\n\tend",
"def save_object(object, objectID = nil, request_options = {})\n client.put(Protocol.object_uri(name, get_objectID(object, objectID)), object.to_json, :write, request_options)\n end",
"def save\n #code\n end",
"def save(*_)\n end",
"def addBeaconItem\n if params[:type].present? && params[:beacon_id].present? && params[:item_name].present? && params[:item_image].present? && params[:item_description].present? && params[:item_template].present? && params[:item_category].present?\n if params[:type]==\"addBeaconItem\"\n @beacon = Beacon.find(params[:beacon_id])\n @item = Item.new\n @item.name = params[:item_name]\n @item.image = params[:item_image]\n @item.description = params[:item_description]\n @item.template = params[:item_template]\n @item.category = params[:item_category]\n @item.beacon = @beacon\n if @item.save\n # Success Message\n print \"Sucess!\"\n render :json => { :status => :ok, :message => \"Success!\", :description => \"Saved\", :withItemID => @item.id}\n else\n # Fail-Save Error\n print \"Fail!\"\n render :json => { :status => :ok, :message => \"Fail!\", :description => \"Unable to save\"}\n end\n else\n # Wrong Type Error\n render :json => { :status => :ok, :message => \"Fail!\", :description => \"Wrong Type\"}\n print \"Wrong Type!\"\n end\n else\n # Missing Attribute Error\n render :json => { :status => :ok, :message => \"Fail!\", :description => \"Missing Attribute\"}\n print \"Missing Attribute!\"\n end\n end",
"def save\n raise NotImplementedError\n end",
"def save!\n status = orchio_put(to_json_direct) if valid?\n retval status\n end",
"def save\n @id ||= '%064d' % CloudKit.storage_adapter.generate_unique_id\n @etag = UUID.generate unless @deleted\n @last_modified = Time.now.httpdate\n\n CloudKit.storage_adapter[@id] = {\n 'uri' => @uri.cannonical_uri_string,\n 'etag' => escape(@etag),\n 'last_modified' => @last_modified,\n 'json' => @json,\n 'deleted' => escape(@deleted),\n 'archived' => escape(@archived),\n 'remote_user' => escape(@remote_user),\n 'collection_reference' => @collection_reference ||= @uri.collection_uri_fragment,\n 'resource_reference' => @resource_reference ||= @uri.cannonical_uri_string\n }.merge(escape_values(parsed_json))\n reload\n end",
"def save\n if new_record?\n overwrite @api.post(\"/meetings.json\", writeable_attributes)\n else\n overwrite @api.put(\"/meetings/#{shortcode_url}.json\",\n writeable_attributes)\n end\n end",
"def save\n self.client.api_post(\"/feed\", self.create_params)\n end",
"def save!\n resource.save!\n end",
"def save!\n ScriptoriaCore::Ruote.engine.storage_participant.do_update(_workitem)\n end",
"def save!\n end",
"def save_items_data\n @parsed[\"order_items\"].each do |i| \n external_code = i['item']['id']\n item = Item.find_or_create_by(external_code: external_code)\n item.order_id = @order.id\n item.external_code = i['item']['id']\n item.name = i['item']['title']\n item.price = i['unit_price']\n item.quantity = i['quantity']\n item.total = i['full_unit_price']\n @subItems = []\n item.save\n end\n end",
"def create\n @item = Item.new(item_save_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n @client.patch(@endpoint, :content=>@changed)\n return nil\n end",
"def save(object, put_item_options = {})\n @dynamo_db_client.put_item(put_item_options.merge({ item: marshal_into_item(object),\n table_name: object.class.dynamodb_config.table_name }))\n return true\n end",
"def save\n r = self.class.put(\"/domains/#{@@parent_id}/records/#{self.id}\", :query => { \"record[name]\" => self.name,\n \"record[ttl]\" => self.ttl,\n \"record[content]\" => self.content,\n \"record[prio]\" => self.prio,\n \"record[type]\" => self.type })\n r[\"errors\"] and raise StandardError, r[\"errors\"][\"error\"].to_a.join(\", \")\n if r.code == 200\n self.class.find(self.id)\n else\n raise StandardError, 'Could not update the record'\n end\n end",
"def create_item(user_id, data) \n data = data.just(SETTABLE_ITEM_FIELDS)\n data[:user_id] = user_id\n data[:title] ||= 'item'\n data[:price] ||= 5\n data[:price] = data[:price].to_i\n data[:slug] = get_unique_slug($items,:slug,data[:title])\n\n data[:imgs] = data[:imgs].to_a.map {|link| {link: link}}\n data[:videos] = data[:videos].to_a.map {|link| {link: link}}\n data[:status] = :pending\n item = $items.add(data)\nend",
"def save\n # add the id to the book list\n @hub.lpush('book:list', @id)\n\n # creates the couples key-values where we store our data\n BOOK_STRING_ATTRS.each do |attr|\n @hub.set(\"book:#{@id}:#{attr}\", self.send(attr.to_sym))\n end\n\n # creates a set containing all the topic id associated to our book\n # and add the book id to the set of all the books belonging to the\n # same topic\n @topics.each do |topic|\n tid = (topic.is_a?(Book)) ? topic.id : topic\n @hub.sadd(\"book:#{@id}:topics\", tid)\n Topic.add_book(tid, id)\n end\n \n # create a set containing all the authors id of our book and add\n # the book id to the set of all the books belonging to the same\n # author\n @authors.each do |author|\n aid = (author.is_a?(Author)) ? author.id : author\n @hub.sadd(\"book:#{@id}:authors\", author)\n Author.add_book(author, id)\n end\n end",
"def save\n attachable_id = attachable.try(:id) || attachable\n response = api.post(\n \"user/#{api.user_name}/realestate/#{attachable_id}/attachment\",\n nil,\n attachment: Faraday::UploadIO.new(file, content_type, file_name),\n metadata: Faraday::UploadIO.new(\n StringIO.new(to_json),\n 'application/json',\n 'metadata.json'\n )\n )\n handle_response(response)\n self.id = id_from_response(response)\n self\n end",
"def create_saved_object(params, type, id = \"\", space_id = \"\")\n endpoint = if space_id.present?\n \"s/#{space_id}/api/saved_objects/#{type}/#{id}\"\n else\n \"api/saved_objects/#{type}/#{id}\"\n end\n\n request(\n http_method: :post,\n endpoint: endpoint,\n params: params.to_json\n )\n end",
"def save\n put_object\n true\n end",
"def save\n self.class.mapper.put(self)\n end",
"def create\n item = Item.new(item_params)\n item.done = \"0\"\n item.trash = \"0\"\n\n if item.save\n render json: {data:item}, status: :created\n else\n render json: {data:item}, status: :unprocessable_entity\n end\n end",
"def save(params: {}, headers: {})\n new_resource = if id\n self.class.patch(id, @data, params: params, headers: headers)\n else\n self.class.create(@data, params: params, headers: headers)\n end\n\n @data = new_resource.to_h\n\n self\n end",
"def save\n\t\tend",
"def save(options = {})\n handle_errors { self.class.get('/add', :query => options) }\n end",
"def write\n @id = store.put(self)\n end",
"def writeItem(app, repo_url, item)\n headers = defaultHeaders(app[\"token\"])\n data = item.to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n response\nend",
"def save\n etag ? update : create\n end"
] |
[
"0.6632395",
"0.66288227",
"0.6602629",
"0.65995675",
"0.65512246",
"0.6530977",
"0.64825827",
"0.64817667",
"0.64649725",
"0.6416989",
"0.6403048",
"0.63206935",
"0.63086814",
"0.6300408",
"0.62689567",
"0.62675256",
"0.62606794",
"0.62576306",
"0.6255888",
"0.62490916",
"0.6241423",
"0.62324196",
"0.62025696",
"0.61813915",
"0.617971",
"0.6170917",
"0.6161104",
"0.6155353",
"0.6155353",
"0.6155113",
"0.6152795",
"0.61497533",
"0.61270463",
"0.6111083",
"0.6110431",
"0.6109309",
"0.6108316",
"0.61083025",
"0.6096871",
"0.6096365",
"0.6082249",
"0.60675496",
"0.60675496",
"0.60675496",
"0.60675496",
"0.60675496",
"0.60675496",
"0.60675496",
"0.60675496",
"0.6059578",
"0.60567474",
"0.60567474",
"0.60567474",
"0.60567474",
"0.60567474",
"0.60567474",
"0.60567474",
"0.6053522",
"0.6041412",
"0.6034208",
"0.60076237",
"0.6005848",
"0.59976465",
"0.5993348",
"0.5993348",
"0.59928817",
"0.5984196",
"0.59790206",
"0.59734625",
"0.5969519",
"0.5969274",
"0.5950252",
"0.5949799",
"0.59401876",
"0.593853",
"0.593619",
"0.59276366",
"0.59268254",
"0.5920162",
"0.59197193",
"0.59070235",
"0.59043884",
"0.5895541",
"0.58941656",
"0.58876014",
"0.5886801",
"0.588081",
"0.5871742",
"0.5868609",
"0.5865511",
"0.58645",
"0.5862433",
"0.58312714",
"0.5826335",
"0.5825183",
"0.58246255",
"0.5824268",
"0.58177894",
"0.58126104",
"0.5806073"
] |
0.76430017
|
0
|
Create this Data Bag Item via RESTful API
|
def create
chef_server_rest.post("data/#{data_bag}", self)
self
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_item(data_bag, item_name, data = {}, metadata = {})\n item = ::SecureDataBag::Item.new(metadata)\n item.raw_data = { 'id' => item_name }.merge(data)\n item.data_bag data_bag\n item\n end",
"def create\n # defined object to receive strict item_params including :description, :price, :stockQty ; else return 400\n @item = Item.new(item_params)\n \n if @item.save\n render json: @item.to_json, status: 201\n else\n head 400\n end\n end",
"def create\n @data_item = DataItem.new(data_item_params)\n\n respond_to do |format|\n if @data_item.save\n format.html { redirect_to @data_item, notice: 'Data item was successfully created.' }\n format.json { render :show, status: :created, location: @data_item }\n else\n format.html { render :new }\n format.json { render json: @data_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end",
"def create_item(user_id, data) \n data = data.just(SETTABLE_ITEM_FIELDS)\n data[:user_id] = user_id\n data[:title] ||= 'item'\n data[:price] ||= 5\n data[:price] = data[:price].to_i\n data[:slug] = get_unique_slug($items,:slug,data[:title])\n\n data[:imgs] = data[:imgs].to_a.map {|link| {link: link}}\n data[:videos] = data[:videos].to_a.map {|link| {link: link}}\n data[:status] = :pending\n item = $items.add(data)\nend",
"def create\n seth_server_rest.post_rest(\"data\", self)\n self\n end",
"def create\n data = CatalogItem.new(name: params[:name], description: params[:description])\n data.save\n render json: data\n end",
"def create_data_bag_item(bag, item, value)\n unless data_bag_item_exist?(bag, item)\n require 'json'\n json = { 'id' => item, item => value }.to_json\n puts \"TRACE: creating missing data bag item #{bag}/#{item} -- #{json}\" if verbose\n puts \"TODO: \" + knife_cmd(\"data bag create #{bag} #{item}\")\n end\nend",
"def create\n item = Item.new(item_params)\n item.done = \"0\"\n item.trash = \"0\"\n\n if item.save\n render json: {data:item}, status: :created\n else\n render json: {data:item}, status: :unprocessable_entity\n end\n end",
"def create\n create_params = item_params\n item = Item.new(\n name: create_params[:name], \n is_complete: false, #create_params[:is_complete], \n list_id: create_params[:list_id])\n\n item.save!\n render json: item\n end",
"def create\n\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend",
"def create\n @rackitem = Rackitem.new(params[:rackitem])\n\n respond_to do |format|\n if @rackitem.save\n format.html { redirect_to :back, notice: 'Rackitem was successfully created.' }\n format.json { render json: @rackitem, status: :created, location: @rackitem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rackitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @request_item = RequestItem.new(request_item_params)\n @request_item.item = Item.new(name: params[:request_item][:item][:name])\n\n if @request_item.save\n render json: @request_item \n else\n render json: @request_item.errors, status: :bad_request\n end\n end",
"def create\n cart_uuid = params[:cart_id]\n @item = Item.new(item_params.merge(cart_uuid: cart_uuid))\n if @item.save\n render json: @item, status: 201\n else\n render_errors 400, @item.errors.full_messages\n end\n end",
"def create\n @item_datum = ItemData.new(params[:item_datum])\n\n respond_to do |format|\n if @item_datum.save\n format.html { redirect_to @item_datum, notice: 'Item datum was successfully created.' }\n format.json { render json: @item_datum, status: :created, location: @item_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tag_item = TagItem.new(tag_item_params)\n\n if @tag_item.save\n render :show, status: :created, location: @tag_item\n else\n render json: @tag_item.errors, status: :unprocessable_entity\n end\n end",
"def create\n @item = Item.new(params[:item])\n @item.budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to after_save_redirection_path, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n @item.save\n respond_with @item\n end",
"def create\n @api_v1_item = Item.new(api_v1_item_params)\n\n if @api_v1_item.save\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end",
"def create\n \n #debug\n write_log(\n Const::SL::LOG_PATH_SL,\n \"items_controller#create(params[:item] => #{params[:item]})\",\n # __FILE__,\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n \n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = BudgetItem.new(params[:budget_item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @budgetitem = Budgetitem.new(budgetitem_params)\n\n respond_to do |format|\n if @budgetitem.save\n format.html { redirect_to @budgetitem, notice: 'Budgetitem was successfully created.' }\n format.json { render :show, status: :created, location: @budgetitem }\n else\n format.html { render :new }\n format.json { render json: @budgetitem.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 create(item_attrs = {})\n body = { value: item_attrs }\n Iterable.request(conf, base_path).put(body)\n end",
"def create\n @bin_item = BinItem.new(bin_item_params)\n\n respond_to do |format|\n if @bin_item.save\n format.html { redirect_to @bin_item, notice: 'bin item was successfully created.' }\n format.json { render :show, status: :created, location: @bin_item }\n else\n format.html { render :new }\n format.json { render json: @bin_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n #whitelist params and save them to a variable \n item_params = params.require(:item).permit(:name, :category, :image, :price)\n #create a new item from 'item_params'\n @item = Item.new(item_params)\n #if item saves, render the new item in JSON\n if @item.save \n render json: @item\n end\n end",
"def create\n @apiv1_item = Item.new(apiv1_item_params)\n\n respond_to do |format|\n if @apiv1_item.save\n format.html { redirect_to @apiv1_item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @apiv1_item }\n else\n format.html { render :new }\n format.json { render json: @apiv1_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tagged_item = TaggedItem.new(params[:tagged_item])\n\n respond_to do |format|\n if @tagged_item.save\n format.html { redirect_to @tagged_item, notice: 'Tagged item was successfully created.' }\n format.json { render json: @tagged_item, status: :created, location: @tagged_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tagged_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def item_create\n @brief = Brief.find(params[:brief_id])\n @brief_vendor = @brief.brief_vendors.find_by_org_id(@cur_user.org_id)\n invalid_op unless @brief_vendor\n @brief_vendor.items << Item.new(params[:item]){|r|r.kind = params[:kind]}\n redirect_to vendor_show_brief_path(@brief)\n end",
"def add_work_item(data)\n name = @table_name.to_s\n sql = @model.from(name.to_sym).insert_sql(\n description: data[:description],\n guide: data[:guide],\n status: data[:status],\n username: data[:name],\n archived: 0\n )\n sql = _format_sql(sql)\n @logger.info(\"Prepared POST query: #{sql}\")\n response = run_statement(sql, \"post\")\n id = response[0][:long_value]\n @logger.info(\"Successfully created work_item_id: #{id}\")\n id\n end",
"def create\n upload_item params[params[:item_type]], session['username'], params[:alternative_name], params[:tag_name], params[:item_type], params[:details]\n end",
"def create(params = {})\n item = build(params)\n item.save\n item\n end",
"def create(data) # rubocop:disable Rails/Delegate\n client.create(data)\n end",
"def create\n @budget_item = BudgetItem.new(params[:budget_item])\n\n respond_to do |format|\n if @budget_item.save\n format.html { redirect_to(@budget_item, :notice => 'Budget item was successfully created.') }\n format.xml { render :xml => @budget_item, :status => :created, :location => @budget_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @budget_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_save_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n item = Item.new(item_params)\n item.user = current_user\n if item.save\n render json: item\n else\n render json: {errors: item.errors}, status: :unprocessable_entity\n end\n end",
"def item_create\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to item_index_path, notice: 'O item foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :item_new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @generic_item = GenericItem.new(generic_item_params)\n\n respond_to do |format|\n if @generic_item.save\n format.html { redirect_to @generic_item, notice: 'Generic item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @generic_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @generic_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_item\n #params[item_id]\n end",
"def create\n @invoice_data_item = InvoiceDataItem.new(invoice_data_item_params)\n\n respond_to do |format|\n if @invoice_data_item.save\n format.html { redirect_to @invoice_data_item, notice: 'Invoice data item was successfully created.' }\n format.json { render :show, status: :created, location: @invoice_data_item }\n else\n format.html { render :new }\n format.json { render json: @invoice_data_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n if @item.save\n render json: @item\n else\n render json: { error: t('story_create_error') }, status: :unprocessable_entity\n end\n end",
"def create\n @item = Item.new(item_params)\n if @item.save\n render json: ItemSerializer.new(@item)\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end",
"def create\n json_response(current_restaurant.restaurant_food_items.create!(food_item_params), :created)\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n make_create_request\n end",
"def create_item\n if @work_order_item.present?\n render json: :conflict, status: :conflict\n else\n @work_order_item = WorkOrderItem.new\n @work_order_item.assign_attributes(@json['data'])\n if !@json['data']['created_by']\n @work_order_item.created_by = current_user.id if !current_user.nil?\n end\n if @work_order_item.save\n render json: serialized_work_order_item(@work_order_item), status: :created\n else\n render json: format_errors(@work_order_item), status: :unprocessable_entity\n end\n end\n end",
"def create\n @item = build_item\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'アップロードしたでー' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully added.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to root_url, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, item: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(attributes)\n response = JSON.parse(@client.post('items', attributes).body)\n Promisepay::Item.new(@client, response['items'])\n end",
"def create\n @basket_item = BasketItem.new(basket_item_params)\n\n\n respond_to do |format|\n if @basket_item.save\n format.html { redirect_to @basket_item, notice: 'Basket item was successfully created.' }\n format.json { render :show, status: :created, location: @basket_item }\n else\n format.html { render :new }\n format.json { render json: @basket_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n __log_activity\n __debug_route\n @item = create_record(no_raise: true)\n errors = @item&.errors || 'Not created' # TODO: I18n\n user_authorize!\n respond_to do |format|\n if errors.blank?\n format.html { redirect_success(__method__) }\n format.json { render :show, location: @item, status: :created }\n else\n format.html { redirect_failure(__method__, error: errors) }\n format.json { render json: errors, status: :unprocessable_entity }\n end\n end\n rescue Record::SubmitError => error\n post_response(:conflict, error)\n rescue => error\n post_response(error)\n end",
"def create\n @item = Item.new(item_params)\n \n respond_to do |format|\n if @item.save \n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save(item_id = @raw_data[\"id\"])\n r = chef_server_rest\n begin\n if Chef::Config[:why_run]\n Chef::Log.warn(\"In why-run mode, so NOT performing data bag item save.\")\n else\n r.put(\"data/#{data_bag}/#{item_id}\", self)\n end\n rescue Net::HTTPClientException => e\n raise e unless e.response.code == \"404\"\n\n r.post(\"data/#{data_bag}\", self)\n end\n self\n end",
"def create\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n get_projects\n\n @breadcrumb = 'create'\n @billable_item = BillableItem.new(params[:billable_item])\n @billable_item.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @billable_item.save\n format.html { redirect_to @billable_item, notice: t('activerecord.attributes.billable_item.create') }\n format.json { render json: @billable_item, status: :created, location: @billable_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @billable_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to :items, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @slot }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = @resource.new(params[@object_name])\n\n set_attributes_on_create\n\n respond_to do |format|\n if @item.save\n format.html do\n params[:resource] ? create_with_back_to : redirect_on_success\n end\n format.json { render :json => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @sugar_bag = SugarBag.new(params[:sugar_bag])\n\n respond_to do |format|\n if @sugar_bag.save\n format.html { redirect_to @sugar_bag, notice: 'Sugar bag was successfully created.' }\n format.json { render json: @sugar_bag, status: :created, location: @sugar_bag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sugar_bag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create body = {}\n @connection.request(method: :post, path: \"/volumes/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end",
"def create\n @item = Item.new(item_params)\n if @item.save\n @items = Item.all\n render status: 201, :json => @item\n \n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n \n \n end",
"def create\n @item = \"Vger::Resources::#{params[:item][:item_type]}\".constantize.new(params[:item])\n respond_to do |format|\n if @item.save\n format.html { redirect_to suitability_item_path(@item), notice: 'Suitability Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create objid\n DataObj.new @repo, self, objid, true\n end",
"def create\n @item = current_owner.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'Item was created successfully' }\n format.json { render :show, status: :created, location: items_path }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_rest\n @entry_item = EntryItem.new(params[:entry_item])\n\n respond_to do |format|\n if @entry_item.save\n flash[:notice] = 'EntryItem was successfully created.'\n #format.html { redirect_to(@entry_item) }\n format.xml { render :xml => @entry_item, :status => :created, :location => @entry_item }\n else\n #format.html { render :action => \"new\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @inventoryitem = Inventoryitem.new(params[:inventoryitem])\n\n respond_to do |format|\n if @inventoryitem.save\n format.html { redirect_to @inventoryitem, notice: 'Item was successfully created.' }\n format.json { render json: @inventoryitem, status: :created, location: @inventoryitem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inventoryitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item_cardapio = ItemCardapio.new(params[:item_cardapio])\n\n respond_to do |format|\n if @item_cardapio.save\n format.html { redirect_to @item_cardapio, :notice => 'Item cardapio was successfully created.' }\n format.json { render :json => @item_cardapio, :status => :created, :location => @item_cardapio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @item_cardapio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n run_callbacks :create do\n connection.post(collection_path, encode, self.class.headers).tap do |response|\n self.id = id_from_response(response)\n load_attributes_from_response(response)\n end\n end\n end",
"def create\n to_server(collection_url, attributes_to_payload) do |response|\n self.uuid = response.data[\"uuid\"]\n end\n end",
"def create\n HTTParty.post(create_url, :options => { :headers => HEADERS })\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # The item is either \"Local\" or \"Remote\" depending on the source selected\n @item = Item.factory(params[:source], params[@hash_key.to_sym])\n \n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(item_url(@item)) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.743095",
"0.7268267",
"0.70016277",
"0.6961897",
"0.69579524",
"0.69188625",
"0.68935263",
"0.6889679",
"0.6886641",
"0.6844617",
"0.6842436",
"0.67734605",
"0.6745067",
"0.6712992",
"0.6699835",
"0.66924566",
"0.66805416",
"0.6654137",
"0.66516817",
"0.6630951",
"0.66000956",
"0.65977085",
"0.65768605",
"0.6562333",
"0.6553417",
"0.65504754",
"0.65466434",
"0.6544743",
"0.6536697",
"0.6528097",
"0.6523322",
"0.6521235",
"0.65044665",
"0.6485297",
"0.64806795",
"0.6475325",
"0.64630514",
"0.6457916",
"0.645086",
"0.644663",
"0.6436848",
"0.6435891",
"0.6433886",
"0.6430939",
"0.64302886",
"0.64302886",
"0.64302886",
"0.64302886",
"0.64302886",
"0.64302886",
"0.64302886",
"0.6427741",
"0.6425814",
"0.6414776",
"0.6412222",
"0.6410648",
"0.6408206",
"0.64059305",
"0.64036274",
"0.63972425",
"0.63967556",
"0.63887477",
"0.6380648",
"0.6378457",
"0.6377448",
"0.6377448",
"0.6377448",
"0.6377448",
"0.6377448",
"0.6377448",
"0.6377448",
"0.6377448",
"0.6377448",
"0.6377448",
"0.6377448",
"0.6377448",
"0.6377448",
"0.6377448",
"0.6377448",
"0.6377448",
"0.63718176",
"0.63607293",
"0.63572645",
"0.6348429",
"0.63431245",
"0.63415796",
"0.6336477",
"0.63135",
"0.6312418",
"0.6311431",
"0.63048095",
"0.6304156",
"0.62991554",
"0.6292883",
"0.62928444",
"0.62928444",
"0.62928444",
"0.62928444",
"0.62928444",
"0.6277465"
] |
0.7417999
|
1
|
Creates this RTSP profile.
|
def create
super
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n if args.blank?\n error \"Please supply the name for the profile you'd like to create\"\n end\n\n Strongspace::Command.run_internal(\"auth:check\", nil)\n\n if new_profile = ask_for_new_rsync_profile\n add_profile(new_profile)\n\n if args[3] and args[3] == \"schedule\"\n schedule\n end\n end\n\n return new_profile\n end",
"def create_profile!\n bundle_id = Sigh.config[:app_identifier]\n name = Sigh.config[:provisioning_name]\n if !name\n name = Sigh.config[:app_identifier].gsub '.' ,''\n end\n\n UI.important \"Creating new provisioning profile for '#{Sigh.config[:app_identifier]}' with name '#{name}'\"\n profile = profile_type.create!(name: name,\n bundle_id: bundle_id)\n profile\n end",
"def create_profile\n new_profile = Profile.new\n new_profile.user_id = self.id\n new_profile.save!\n end",
"def create_profile\n Profile.create(user_id: self.id)\n end",
"def create_DB_profile\n \n @profile = ProfileId.new\n @profile.user_name = params[:user_name]\n @profile.profile_id = @parsed[\"profileId\"]\n @profile.save\n end",
"def create_profile(profile, options = {})\n options = @@create_profile_option_defaults.merge(options)\n @type = Type::CIM_CREATE_PROFILE\n @fields.merge!(profile.to_hash)\n set_fields(:validation_mode => options[:validation_mode])\n make_request\n end",
"def new_profile\n profile = Profile.new\n profile.user_group = UserGroup.first\n profile.library = Library.real.first\n profile.locale = I18n.default_locale.to_s\n profile.full_name = 'System'\n profile\nend",
"def create_profile\n Profile.create!(member_id:self.id) if self.profile.nil?\n end",
"def create\n logger.info(\"CREATE PROFILE #{params[:profile].inspect}\")\n @profile = Profile.new(params[:profile])\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_profile(sbp_profile, opts = {})\n data, status_code, headers = create_profile_with_http_info(sbp_profile, opts)\n return data\n end",
"def create\n @profile = Profile.new(params[:profile])\n @profile.profile_id = UUIDTools::UUID.timestamp_create().to_s\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_created) }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if current_user.profile.nil?\n profile = Profile.new(profile_params)\n profile.user = current_user\n if profile.save\n redirect_to profiles_path\n return\n end\n end\n redirect_to profiles_path\n end",
"def new_profile\n profile = Profile.new\n profile.user_group = UserGroup.first\n profile.library = Library.real.first\n profile.locale = I18n.default_locale.to_s\n profile\nend",
"def create\n assign_params_to_attributes\n @profile = Profile.new(params[:profile])\n @profile.user_id = current_user.id\n if @profile.save\n flash[:notice] = I18n.t('profile.create.notice')\n redirect_to user_path(current_user)\n else\n @user = current_user\n assing_attributes_to_params\n flash.now[:error] = I18n.t('profile.create.error')\n render :action => \"new\"\n end\n end",
"def create\n @profile = Profile.new(req_params)\n if @profile.save\n redirect_to new_partnership_path(p_id: @profile.id)\n else\n flash[:profile_attempt] = req_params\n respond_with_submission_error(@profile.errors.messages, new_dummy_profile_path)\n end\n end",
"def create\n\t\t@equalizer_profile = current_user.equalizer_profiles.new(params[:equalizer_profile])\n\n\t\trespond_to do |format|\n\t\t\tif @equalizer_profile.save\n\t\t\t\tformat.html { redirect_to(@equalizer_profile, :notice => 'Equalizer profile was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @equalizer_profile, :status => :created, :location => @equalizer_profile }\n\t\t\t\tformat.json { render :json => @equalizer_profile, :status => :created, :location => @equalizer_profile }\n\t\t\t\tformat.yaml { render :text => @equalizer_profile.to_yaml, :content_type => 'text/yaml', :status => :created, :location => @equalizer_profile }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @equalizer_profile.errors, :status => :unprocessable_entity }\n\t\t\t\tformat.json { render :json => @equalizer_profile.errors, :status => :unprocessable_entity }\n\t\t\t\tformat.yaml { render :text => @equalizer_profile.errors.to_yaml, :content_type => 'text/yaml', :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @profile = Profile.new profile_params\n unless current_user.profile\n @profile.user = current_user\n end\n\n respond_to do |format|\n if @profile.save\n if current_user.profile\n AclEntry.set current_user, @profile, :edit\n end\n FeedSubscription.add current_user.profile, @profile\n\n format.html { redirect_to session_path }\n format.xml { render xml: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @profile = Profile.new\n end",
"def create_from_rpx(profile_data)\n user = new_from_rpx(profile_data)\n user.save\n user\n end",
"def create\n @security_profile = Security::Profile.new(security_profile_params)\n @security_profile.user_created_id = current_user.id\n respond_to do |format|\n if @security_profile.save\n format.html { redirect_to security_profiles_path, notice: I18n.t('profiles.controller.create')}\n format.json { render :show, status: :created, location: @security_profile }\n else\n format.html { render :new }\n format.json { render json: @security_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n @profile.member = self.current_member\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to [self.current_member, @profile] }\n format.xml { head :created, :location => [self.current_member, @profile] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors.to_xml }\n end\n end\n end",
"def create\n @profile = current_user.profile || Profile.new\n @profile.user_id = current_user.id\n @profile.status = :start\n @profile.save(validate: false)\n session[:profile_id] = @profile.id\n redirect_to vendor_setup_store_index_path\n end",
"def create\n @profile = current_user.profiles.build(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setup_profile\n @profile = Profile.new({:bit_id => self.id})\n @profile.save()\n end",
"def create\n\n user = User.find(params[:user_id])\n @profile = Profile.new(params[:profile])\n @profile.user = user\n\n if @profile.save\n redirect_to user_profile_path(params[:user_id])\n else\n flash[:alert] = @profile.errors.full_messages.join(\",\")\n render :template => \"profiles/new\"\n end\n\n end",
"def new\n\t\t@profile = Profile.new\n\tend",
"def new\n\t\t@profile = Profile.new\n\tend",
"def new\n super\n resource.build_profile\n end",
"def create_profile_with_http_info(sbp_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VApi#create_profile ...\"\n end\n \n # verify the required parameter 'sbp_profile' is set\n fail \"Missing the required parameter 'sbp_profile' when calling create_profile\" if sbp_profile.nil?\n \n # resource path\n path = \"/v1/profile/create\".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']\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/xml']\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(sbp_profile)\n \n\n auth_names = []\n data, status_code, headers = @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 => 'SbpProfile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VApi#create_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n profile = Payments::Profile.new(profile_params)\n profile.user = current_user\n\n respond_to do |format|\n if profile.save\n format.html {redirect_to payments_profiles_path}\n else\n format.html {redirect_to :back, flash: {error: \"Error saving payment profile\"}}\n end\n end\n end",
"def create\n params[:profile][:tag_list] = params[:profile][:tag_list]\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n # Store friendly profile URI\n current_user.profile_uri = getUniqueURI(current_user) \n current_user.save\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.create({\n name: params['profile']['name'],\n speciality: params['profile']['speciality'],\n city: params['profile']['city'],\n user_id: current_user['id']\n })\n @profile.save\n respond_with(@profile)\n end",
"def createInstanceProfile\n if @config['bare_policies']\n raise MuError, \"#{self} has 'bare_policies' set, cannot create an instance profile without a role to bind\"\n end\n\n resp = begin\n MU.log \"Creating instance profile #{@mu_name} #{@config['credentials']}\"\n MU::Cloud::AWS.iam(credentials: @config['credentials']).create_instance_profile(\n instance_profile_name: @mu_name\n )\n rescue Aws::IAM::Errors::EntityAlreadyExists => e\n MU::Cloud::AWS.iam(credentials: @config['credentials']).get_instance_profile(\n instance_profile_name: @mu_name\n )\n end\n\n # make sure it's really there before moving on\n begin\n MU::Cloud::AWS.iam(credentials: @config['credentials']).get_instance_profile(instance_profile_name: @mu_name)\n rescue Aws::IAM::Errors::NoSuchEntity => e\n MU.log e.inspect, MU::WARN\n sleep 10\n retry\n end\n\n bindTo(\"instance_profile\", @mu_name)\n\n resp.instance_profile.arn\n end",
"def generate_profile(user)\n if user.profile.nil?\n profile_params = { user_id: user.id, name: \"Subscribed User\", bio: \"Coinmitted investor\", language: \"en\", currency: \"USD\", deleted: false, membership: 0 }\n Profile.create(profile_params) if user.profile.nil?\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to profile_url(@profile) }\n format.xml { head :created, :location => profile_url(@profile) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors.to_xml }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: t('controller.profiles.create.success') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@user = current_user\n\t\t@profile = @user.build_profile(profile_params) \n\t\tif @profile.save\n\t\t\tflash[:success] = \"Profile successfully created!\"\n\t\t\tredirect_to user_profile_path(@user)\n\t\telse\n\t\t\tflash[:notice] = 'Error: something went wrong.'\n\t\t\trender :action => \"new\" \n\t\tend\n\tend",
"def new\n @profile = Profile.new\n end",
"def new\n @profile = Profile.new\n end",
"def new\n @profile = Profile.new\n end",
"def build_profile\n Profile.create(user: self) # Associations must be defined correctly for this syntax, avoids using ID's directly.\n end",
"def create\n @current_object = Profile.new(params[:profile])\n respond_to do |format|\n if @current_object.save\n \n @current_object.create_profile_workspace\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to admin_profile_path(@current_object.id) }\n format.xml { render :xml => @current_object, :status => :created, :location => @current_object }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @current_object.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n @profile = current_user.create_profile(params[:profile])\n if @profile \n format.html { redirect_to(profile_url(@profile.user_id), :notice => 'Profile was successfully created.') }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def build_profile\n Profile.create(user: self)\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n authorize @profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to quit_user_profile_path, notice: \"Profile: #{I18n.t('helpers.saved')}\" }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createInstanceProfile\n if @config['bare_policies']\n raise MuError, \"#{self} has 'bare_policies' set, cannot create an instance profile without a role to bind\"\n end\n\n resp = begin\n MU.log \"Creating instance profile #{@mu_name} #{@credentials}\"\n MU::Cloud::AWS.iam(credentials: @credentials).create_instance_profile(\n instance_profile_name: @mu_name\n )\n rescue Aws::IAM::Errors::EntityAlreadyExists\n MU::Cloud::AWS.iam(credentials: @credentials).get_instance_profile(\n instance_profile_name: @mu_name\n )\n end\n\n # make sure it's really there before moving on\n begin\n MU::Cloud::AWS.iam(credentials: @credentials).get_instance_profile(instance_profile_name: @mu_name)\n rescue Aws::IAM::Errors::NoSuchEntity => e\n MU.log e.inspect, MU::WARN\n sleep 10\n retry\n end\n\n bindTo(\"instance_profile\", @mu_name)\n\n resp.instance_profile.arn\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n if @profile.save!\n redirect_to profile_path(@profile.id)\n else\n render :new\n end\n end",
"def new\n build_profile\n end",
"def create\n @profile = Profile.new(params[:profile])\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profiles = current_user.profiles.new(profile_params)\n\n if @profiles.save\n redirect_to profiles_path, notice: 'Profile was successfully created.'\n else\n render :new\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_locally\n write_file(@video_file, @video_name)\n write_file(@poster_file, @poster_name)\n end",
"def create\n user = User.new(user_params_with_profile_picture)\n\n if user.save\n expose user\n else\n error! :invalid_resource, user.errors\n end\n end",
"def create\n\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n @profile.save\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_session(options)\n options[:source_profile] = options[:source_profile].to_sym\n options[:profile] = options[:profile].to_sym\n\n user_prof = user_profile(options[:source_profile], options[:config_file])\n options = user_prof.to_h.deep_merge(options).deep_symbolize_keys\n\n sb = SessionBuilder.new(\n mfa_device: mfa_device(options),\n session_duration_seconds: options[:duration],\n source_profile: user_prof\n )\n set_user_session_profile(options[:profile], sb.session_profile)\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: t(\"controller.shared.flash.create.notice\", model: pick_model_from_locale(:profile)) }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: t(\"controller.shared.flash.create.status\") }\n end\n end\n end",
"def create\n # verificar si el usuario esta logeado\n if user_signed_in?\n # si es nil el valor enviado como parametro se obtiene de session\n params[:profile] ||= session[:profile]\n # Referenciar el usuario en session\n @profile = Profile.new(params[:profile])\n if @profile.save\n session[:profile] = nil\n redirect_to @profile, notice: 'Su perfil fue creado satisfactoriamente.'\n end\n else \n # Guardar el perfil creado en session\n session[:profile] = Profile.new(params[:profile])\n # No esta autenticado el usuario, redireccionar para crear cuenta\n redirect_to new_user_registration_path\n end\n end",
"def create\n @media_profile = MediaProfile.new(params[:media_profile])\n\n respond_to do |format|\n if @media_profile.save\n flash[:notice] = 'MediaProfile was successfully created.'\n format.html { redirect_to(@media_profile) }\n format.xml { render :xml => @media_profile, :status => :created, :location => @media_profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @media_profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user_profile = UserProfile.new(params[:user_profile])\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render json: @user_profile, status: :created, location: @user_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_profile = UserProfile.new(params[:user_profile])\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render json: @user_profile, status: :created, location: @user_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n @profile.user_id = current_user.id\n authorize! :create, @profile\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n parameters = profile_params\r\n parameters[\"user\"] = current_user\r\n current_user.is_active = true\r\n UserRole.create(role_id:1, user_id:current_user.id)\r\n current_user.update(is_active:true)\r\n @profile = Profile.create(parameters)\r\n redirect_to root_path\r\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n current_user.add_role :candidate\n # Send notification to new user that his candidate profile has been created\n RegistrationMailer.registration(@profile.user.id).deliver_now\n\n # Send notification to MOBEEAS Admin that a new candidate user has been created\n RegistrationMailer.new_user_notification(@profile.user.id).deliver_now\n\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tutor_profile = TutorProfile.new(tutor_profile_params)\n @tutor_profile.user_id = current_user.id\n\n respond_to do |format|\n if @tutor_profile.save\n format.html { redirect_to @tutor_profile, notice: 'Tutor profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tutor_profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @tutor_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n build_identity\n save_identity || render(template: 'profiles/show')\n end",
"def create_app_profile instance_id, app_profile_id, app_profile, ignore_warnings: nil\n instances.create_app_profile parent: instance_path(instance_id),\n app_profile_id: app_profile_id,\n app_profile: app_profile,\n ignore_warnings: ignore_warnings\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to '/', notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n current_user.profile = Profile.new(params[:profile])\n @profile = current_user.profile\n\n if !@profile.valid?\n flash[:error_created] = @profile.errors.full_messages.join(\"<br>\").html_safe\n redirect_to new_user_profile_path(current_user)\n else\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_profile_path(current_user), notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end \n end\n end",
"def create_new_profile(project_root, profile_name, profile_base_path)\n # Clean the profile_path to make it a valid path\n profile_base_path = Bebox::Profile.cleanpath(profile_base_path)\n # Check if the profile name is valid\n return unless name_valid?(profile_name, profile_base_path)\n # Check if the profile exist\n profile_path = profile_base_path.empty? ? profile_name : profile_complete_path(profile_base_path, profile_name)\n return error(_('wizard.profile.name_exist')%{profile: profile_path}) if profile_exists?(project_root, profile_path)\n # Profile creation\n profile = Bebox::Profile.new(profile_name, project_root, profile_base_path)\n output = profile.create\n ok _('wizard.profile.creation_success')%{profile: profile_path}\n return output\n end",
"def create\n # Buidles a profile in association witht eh user\n @user = User.find(current_user.id)\n @profile = @user.build_profile(params[:user])\n @profile.update_attributes(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n if @profile.save\n render json: @profile, status: :created\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end",
"def create\n @retailer_profile = RetailerProfile.new(retailer_profile_params)\n @retailer_profile.user = current_user\n\n respond_to do |format|\n if @retailer_profile.save\n format.html { redirect_to root_path, notice: 'Your profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @retailer_profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @retailer_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n flash[:notice] = t('profiles.new.success')\n format.html { redirect_to(@user) }\n format.xml { render :xml => @profile, :status => :created, :location => @user }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.68870723",
"0.6695219",
"0.646176",
"0.63764495",
"0.6307138",
"0.62477463",
"0.6162191",
"0.61386937",
"0.61342424",
"0.61294806",
"0.6063301",
"0.6058073",
"0.60542923",
"0.60349345",
"0.59935313",
"0.5991946",
"0.59486794",
"0.59410787",
"0.58827174",
"0.5876568",
"0.585366",
"0.58273506",
"0.58217835",
"0.5818845",
"0.5803473",
"0.5766812",
"0.5766812",
"0.5761108",
"0.57540745",
"0.5734883",
"0.57292366",
"0.5717988",
"0.57140034",
"0.57082194",
"0.57036364",
"0.5702702",
"0.56992054",
"0.56951654",
"0.56951654",
"0.56951654",
"0.5691182",
"0.5683087",
"0.5677317",
"0.56747854",
"0.56747854",
"0.5672013",
"0.5672013",
"0.5672013",
"0.5671143",
"0.5665546",
"0.5664981",
"0.5658436",
"0.5653272",
"0.5644878",
"0.5637883",
"0.5630131",
"0.5630131",
"0.5630131",
"0.5627584",
"0.56257504",
"0.56230026",
"0.56221557",
"0.56220514",
"0.56208885",
"0.56133753",
"0.5590685",
"0.55898684",
"0.55857587",
"0.558517",
"0.558517",
"0.558396",
"0.55771047",
"0.5575",
"0.55615395",
"0.55615395",
"0.55615395",
"0.55615395",
"0.55615395",
"0.55615395",
"0.55615395",
"0.55546665",
"0.55530554",
"0.5552848",
"0.5549034",
"0.554837",
"0.5545715",
"0.5545715",
"0.5545715",
"0.5545715",
"0.5545715",
"0.5545715",
"0.5545715",
"0.5545715",
"0.55440634",
"0.55413246",
"0.5530663",
"0.5518628",
"0.55107516",
"0.55106246",
"0.5503954",
"0.55026245"
] |
0.0
|
-1
|
Deletes all RTSP profile.
|
def delete_all_profiles
super
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove_all_profiles\n super\n end",
"def destroy\n @profile.destroy\n end",
"def destroy\n @profile.destroy\n @profile.requests.destroy_all\n @profile.member.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'El perfil fue eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @current_object = Profile.find(params[:id])\n User.delete_all(\"id = #{@current_object.user_id}\")\n @current_object.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_profiles_url) }\n format.xml { head :ok }\n end\n end",
"def remove_all_persistence_profiles\n super\n end",
"def destroy\n\t\t@profile.destroy\n\t\tset_flash_message :notice, :destroyed\n\t\tredirect_to admin_profiles_url\n\tend",
"def remove_all_httpclass_profiles\n super\n end",
"def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def cleanup\n self.profile.destroy if self.profile\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, :notice => t('alerts.profiles.destroy') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n end",
"def destroy\n \t@profile.destroy\n\n \trespond_to do |format|\n \t\tprofiles = Profile.all\n \t\tformat.json { render json: profiles}\n \tend\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n redirect_to profiles_url\n end",
"def destroy\n @users_profile = Users::Profile.find(params[:id])\n @users_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile.destroy\n redirect_to '/'\n end",
"def destroy\n @vet_profile.destroy\n respond_to do |format|\n format.html { redirect_to vet_profiles_url, notice: 'Vet profile was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.profile.destroy\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile.destroy\n session[:profile_id] = nil\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n format.html { redirect_to(user_profiles_url) }\n end",
"def destroy\n @media_profile = MediaProfile.find(params[:id])\n @media_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(media_profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile.destroy\n flash[:notice] = 'Profile was successfully deleted.'\n respond_to do |format|\n format.html { redirect_to(space_user_profile_url(@space, @user)) }\n format.xml { head :ok }\n format.atom { head :ok }\n end\n end",
"def clear_all\n # Walk around the read-only profiles\n User.find(session[:user_id]).profiles.each do |p|\n # Restore the profile status if imported\n newp = Profile.find(p.id)\n newp.status = 'Waiting'\n newp.quote_type = ''\n newp.save\n \n # Delete all quotes\n Quote.delete_all([\"profile_id = #{p.id}\"])\n end\n\n # Clear the user portfolio\n User.find(session[:user_id]).portfolios.each {|p| p.destroy}\n \n # Reset status and delete all Pm/investors since quotes are clear.\n\t\treset_without_agent_reserved\n\t\t\n flash[:notice] = 'Your portfolio is empty now and PM/investor have been deleted.'\n redirect_to :action => 'index'\n end",
"def destroy\n system \"ruby streaming_script.rb stop\"\n \tsession[:username] = nil\n User.all.each do |user|\n user.destroy\n end\n User.reset_pk_sequence\n Tweet.all.each do |tweet|\n tweet.destroy\n end\n Tweet.reset_pk_sequence\n \treset_session\n \tredirect_to root_path\n end",
"def destroy\n self.class.delete_all(\"session_id='#{session_id}'\")\n end",
"def destroy\n\t\t@equalizer_profile = current_user.equalizer_profiles.find(params[:id])\n\t\t@equalizer_profile.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(equalizer_profiles_url) }\n\t\t\tformat.xml { head :ok }\n\t\t\tformat.json { head :ok }\n\t\t\tformat.yaml { render :text => \"\", :content_type => 'text/yaml' }\n\t\tend\n\tend",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n # Delete profile\n @profil.destroy\n respond_to do |format|\n format.html { redirect_to profils_url, notice: 'Profil was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retailer_profile.destroy\n respond_to do |format|\n format.html { redirect_to retailer_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resume = Resume.find(params[:id])\n @resume.destroy\n @profile = context\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: '*Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tag_pro_profile.destroy\n respond_with(@tag_pro_profile, location: root_url)\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end",
"def remove_all_authentication_profiles\n super\n end",
"def destroy\n @recurring_profile = RecurringProfile.find(params[:id])\n @recurring_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to recurring_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html do\n redirect_to profiles_url, notice:\n \"Profile was successfully destroyed.\"\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n if current_profile!=@profile\n redirect_to root_url, notice: 'Permission denied'\n end\n\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_path, :notice => \"profile was successfully delete.\" }\n format.json { head :no_content }\n end\n end",
"def delete!\n client.delete_provisioning_profile!(self.id, mac: mac?)\n end",
"def delete_profile\n driver.deleteOperaPrefs\n end",
"def delete_all\n destroy_user_preferences!\n render json: { code: params[:code] }, status: :ok, serializer: DeleteAllUserPreferencesSerializer\n end",
"def delete_profile_set_errors\n RaccError.delete_all([\"package_id = ? and profile_id = -1 and time_segment_id = -1 and routing_id = -1\", self.id])\n end",
"def delete_profile\n system 'clear'\n CoffeeMan.stay_logo\n @userid.delete\n puts \"Your account has been terminated\"\n puts \"NO CAFFEINE\"\n stop_music\n abort\n end",
"def destroy\n institution = @profile.institution\n begin\n @profile.destroy!\n rescue => e\n flash['error'] = \"#{e}\"\n else\n toast!(title: \"Profile deleted\",\n message: \"The metadata profile \\\"#{@profile.name}\\\" has been \"\\\n \"deleted.\")\n ensure\n if current_user.sysadmin?\n redirect_to institution_path(institution)\n else\n redirect_to metadata_profiles_path\n end\n end\n end",
"def destroy\n @profile.destroy\n respond_with(@profile)\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to partnerships_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.6601341",
"0.62867165",
"0.6088836",
"0.6055473",
"0.60162616",
"0.6011098",
"0.60039383",
"0.5994199",
"0.5994199",
"0.5991801",
"0.5931767",
"0.5930769",
"0.590397",
"0.58922464",
"0.58868337",
"0.5877435",
"0.5877435",
"0.5877435",
"0.5877435",
"0.5877435",
"0.5876463",
"0.58758605",
"0.5863079",
"0.5846584",
"0.58421916",
"0.5836748",
"0.5827059",
"0.5811044",
"0.5786302",
"0.57796687",
"0.5775371",
"0.57637244",
"0.57597977",
"0.57597977",
"0.5759595",
"0.57530856",
"0.57467884",
"0.5742396",
"0.5719693",
"0.571474",
"0.5696219",
"0.5671787",
"0.5671787",
"0.5671787",
"0.5671787",
"0.5671787",
"0.5671787",
"0.5671787",
"0.5671787",
"0.56715393",
"0.56593806",
"0.56593806",
"0.56593806",
"0.5657332",
"0.56531477",
"0.5652857",
"0.5641374",
"0.56401247",
"0.5636592",
"0.56361747",
"0.5634635",
"0.56319994",
"0.5628808",
"0.56261027",
"0.56239706",
"0.5622119",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349",
"0.5610349"
] |
0.69172657
|
7
|
Deletes this RTSP profile.
|
def delete_profile
super
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @profile.destroy\n end",
"def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n format.html { redirect_to(user_profiles_url) }\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n end",
"def destroy\n\t\t@profile.destroy\n\t\tset_flash_message :notice, :destroyed\n\t\tredirect_to admin_profiles_url\n\tend",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n redirect_to profiles_url\n end",
"def delete!\n client.delete_provisioning_profile!(self.id, mac: mac?)\n end",
"def destroy\n @vet_profile.destroy\n respond_to do |format|\n format.html { redirect_to vet_profiles_url, notice: 'Vet profile was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile.destroy\n session[:profile_id] = nil\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile.destroy\n flash[:notice] = 'Profile was successfully deleted.'\n respond_to do |format|\n format.html { redirect_to(space_user_profile_url(@space, @user)) }\n format.xml { head :ok }\n format.atom { head :ok }\n end\n end",
"def delete_profile(sbp_profile, opts = {})\n data, status_code, headers = delete_profile_with_http_info(sbp_profile, opts)\n return data\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_path, :notice => \"profile was successfully delete.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.profile.destroy\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, :notice => t('alerts.profiles.destroy') }\n format.json { head :no_content }\n end\n end",
"def destroy\n institution = @profile.institution\n begin\n @profile.destroy!\n rescue => e\n flash['error'] = \"#{e}\"\n else\n toast!(title: \"Profile deleted\",\n message: \"The metadata profile \\\"#{@profile.name}\\\" has been \"\\\n \"deleted.\")\n ensure\n if current_user.sysadmin?\n redirect_to institution_path(institution)\n else\n redirect_to metadata_profiles_path\n end\n end\n end",
"def destroy\n @users_profile = Users::Profile.find(params[:id])\n @users_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tag_pro_profile.destroy\n respond_with(@tag_pro_profile, location: root_url)\n end",
"def destroy\n\t\t@equalizer_profile = current_user.equalizer_profiles.find(params[:id])\n\t\t@equalizer_profile.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(equalizer_profiles_url) }\n\t\t\tformat.xml { head :ok }\n\t\t\tformat.json { head :ok }\n\t\t\tformat.yaml { render :text => \"\", :content_type => 'text/yaml' }\n\t\tend\n\tend",
"def destroy\n @profile.destroy\n respond_with(@profile)\n end",
"def destroy\n @media_profile = MediaProfile.find(params[:id])\n @media_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(media_profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = self.current_member.profile\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to current_member_profile_path }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: '*Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to partnerships_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html do\n redirect_to profiles_url, notice:\n \"Profile was successfully destroyed.\"\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n raise params.inspect\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_profile.destroy\n respond_to do |format|\n format.html { redirect_to user_profiles_url, notice: \"Registro deletado com sucesso!\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retailer_profile.destroy\n respond_to do |format|\n format.html { redirect_to retailer_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n redirect_to '/'\n end",
"def destroy\n authorize @profile\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: \"Profile: #{I18n.t('helpers.deleted')}\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resume = Resume.find(params[:id])\n @resume.destroy\n @profile = context\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n profile = profile_by_name(args.first)\n\n if profile.blank?\n display \"Please supply the name of the profile you'd like to delete\"\n self.list\n return false\n end\n\n if args[1] == \"yes\"\n puts profile['strongspace_path'][12..-1]\n begin\n strongspace.rm(profile['strongspace_path'][12..-1])\n rescue\n end\n end\n\n delete_profile(profile)\n\n display \"#{args.first} has been deleted\"\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_profile(profile_id)\n @type = Type::CIM_DELETE_PROFILE\n handle_profile_id(profile_id)\n make_request\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: \"Profile was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n if current_profile!=@profile\n redirect_to root_url, notice: 'Permission denied'\n end\n\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @skill_user_profile.destroy\n\n head :no_content\n end",
"def destroy\n @profile = current_user.profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @userprofile.destroy\n respond_to do |format|\n format.html { redirect_to userprofiles_url, notice: 'Userprofile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recurring_profile = RecurringProfile.find(params[:id])\n @recurring_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to recurring_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @playerprofile = Playerprofile.find(params[:id])\n @playerprofile.destroy\n\n respond_to do |format|\n format.html { redirect_to playerprofiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profile_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_profile.destroy\n respond_to do |format|\n format.html { redirect_to user_profiles_url, notice: 'User profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sponsor_profile.destroy\n respond_to do |format|\n format.html { redirect_to sponsor_profiles_url, notice: 'Sponsor profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @travel_agent_profile = TravelAgentProfile.find(params[:id])\n @travel_agent_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to travel_agent_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n if !request.xhr?\n format.html { redirect_to(profiles_url) }\n else\n format.html { render :text=> \"SUCCESS\" }\n end\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @profile.destroy\r\n respond_to do |format|\r\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end"
] |
[
"0.6971887",
"0.6891237",
"0.68853074",
"0.6787424",
"0.6771902",
"0.6756531",
"0.6684711",
"0.66793215",
"0.66793215",
"0.667683",
"0.6666987",
"0.6666987",
"0.6666987",
"0.6666987",
"0.6666987",
"0.6661079",
"0.66414016",
"0.66301674",
"0.66237247",
"0.65925777",
"0.6560958",
"0.65572006",
"0.65452635",
"0.65281034",
"0.6518793",
"0.6492484",
"0.6485914",
"0.6483924",
"0.64754415",
"0.64754415",
"0.64754415",
"0.6472204",
"0.6472204",
"0.6472204",
"0.6472204",
"0.6472204",
"0.6472204",
"0.6472204",
"0.6472204",
"0.6454785",
"0.64456624",
"0.64456624",
"0.64456487",
"0.6445059",
"0.64354706",
"0.6422402",
"0.64106405",
"0.64082515",
"0.64082515",
"0.6408104",
"0.6402983",
"0.63975585",
"0.63968253",
"0.63900614",
"0.6379983",
"0.63719946",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.63679814",
"0.6367669",
"0.63649195",
"0.63590485",
"0.63517624",
"0.6350875",
"0.63406175",
"0.63401145",
"0.63351035",
"0.6320725",
"0.6307972",
"0.6290773",
"0.6288393",
"0.62878937",
"0.628647",
"0.6279458",
"0.62737644",
"0.6271505"
] |
0.0
|
-1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.